termux / termux-packages

A package build system for Termux.
https://termux.dev
Other
13.28k stars 3.06k forks source link

[Package]: openjfx #10225

Open ghost opened 3 years ago

ghost commented 3 years ago

Package description

Rich client application platform for Java

Home page URL

https://openjfx.io

Source code URL

https://github.com/openjdk/jfx

Building instructions

https://wiki.openjdk.java.net/display/OpenJFX/Building+OpenJFX

Packaging policy acknowledgement

Additional information

Screenshot_2021-09-03-13-51-55-725_com termux

I tried to build the package using Termux from my own device (armv7l architecture), but it seems that arm is not supported for building it. Rather, it supports cross-compiling, so it can be built on another Linux architecture targeting my device architecture and others.

More information

JavaFX/OpenJFX is the latest GUI application development toolkit for OpenJDK. JavaFX was included in Java SE till JDK 8. Afterwards, to speed up the development of JavaFX, it was excluded from Java SE and open sourced as OpenJFX, and now developed separately (but still under the management of Oracle). As Java's older GUI toolkits such as AWT/Swing had many limitations and didn't support many modern UI/UX APIs, here JavaFX provides many rich APIs, including hardware acceleration and so on, so its now most popular.

Now, as OpenJDK 17 is available on Termux as openjdk-17 package, it is right time to add OpenJFX as a package also. OpenJDK 17 can run OpenJFX 17 & 18 versions (OpenJFX N is compatible with OpenJDK N & N-1). If you can add OpenJFX 18, please add it. Otherwise 17 will also be also OK.

Ubuntu and other popular Linux distributions provides OpenJFX as openjfx package. I coded and built one JavaFX application in proot-distro ubuntu (hirsute), using packages openjdk-16-jdk & openjfx there, and was able to run perfectly on Termux’s X11 window system (not the proot-distro's) with XFCE4 & VNC Viewer app using xhost (xorg-xhosts).

PiprTuff commented 2 years ago

Has someone tried to build it? There are people interested in this package, see: https://stackoverflow.com/questions/72076687/openjdk-17-0-2-with-javafx-in-termux/72328639

PiprTuff commented 2 years ago

Now, as OpenJDK 17 is available on Termux as openjdk-17 package, it is right time to add OpenJFX as a package also. OpenJDK 17 can run OpenJFX 17 & 18 versions (OpenJFX N is compatible with OpenJDK N & N-1). If you can add OpenJFX 18, please add it. Otherwise 17 will also be also OK.

JavaFX 17 should be added as it is the latest LTS version which will have updates until 2026 where JavaFX 18 is a short term update version, it may be unstable and have critical bugs. The latest JavaFX 17 LTS version as of now is 17.0.2. Source code for JavaFX 17 latest updates are available at https://github.com/openjdk/jfx17u, not https://github.com/openjdk/jfx.

PiprTuff commented 2 years ago

OpenJFX was successfully (excluding the native libraries for WebKit, SWT and Media modules) built on device using this fork https://github.com/tempaccforissue/openjfx-17-termux: IMG_20220524_084944_471

It can be used to compile JavaFX apps successfully, but when I try to run any app, it says that gtk2 and gtk3 signals were detected in the same process which is not supported. Now if I add -Djdk.gtk.verbose=true to investigate this, the app launches successfully which is very odd: Screenshot_2022-05-23_22-41-04

However, I used openjdk-17 (provided by Termux) as the bootstrap JDK, and LLVM's clang (provided by Termux) to compile openjfx-17 which is not recommended and shows up many unsupported flags warnings. Officially openjfx uses OpenJDK 16 (see https://github.com/openjdk/jfx17u/blob/103cac04472d3eddb1f28a6a0b4f8d60f5ce3d7f/.github/workflows/submit.yml#L69) and GCC to build it. And I think all the changes I've made may not be needed if its built on Termux's host.

The build process is described here: https://wiki.openjdk.java.net/display/OpenJFX/Building+OpenJFX.

More details can be found at: https://github.com/openjdk/jfx17u/blob/master/.github/workflows/submit.yml.