Skip to content

Instantly share code, notes, and snippets.

@ABelliqueux
Created April 1, 2022 13:57
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ABelliqueux/3e4af7450412dd102a9e9a6a421d9a6f to your computer and use it in GitHub Desktop.
Save ABelliqueux/3e4af7450412dd102a9e9a6a421d9a6f to your computer and use it in GitHub Desktop.
AUR-java8-openjfx-fixbuild.patch
--- rt-8u202-ga/build.gradle 2018-12-10 17:30:22.000000000 +0100
+++ rt-8u202-ga/build1.gradle 2022-04-01 15:47:37.791321075 +0200
@@ -737,24 +737,10 @@
// Java HotSpot(TM) 64-Bit Server VM (build 24.45-b08, mixed mode)
//
// We need to parse the second line
-def inStream = new java.io.BufferedReader(new java.io.InputStreamReader(new java.lang.ProcessBuilder(JAVA, "-version").start().getErrorStream()));
-try {
- if (inStream.readLine() != null) {
- String v = inStream.readLine();
- if (v != null) {
- int ib = v.indexOf(" (build ");
- if (ib != -1) {
- String ver = v.substring(ib + 8, v.size() - 1);
+defineProperty("jdkRuntimeVersion", "1.8.0_332-b04")
+defineProperty("jdkVersion", "1.8.0_332")
+defineProperty("jdkBuildNumber", "04")
- defineProperty("jdkRuntimeVersion", ver)
- defineProperty("jdkVersion", jdkRuntimeVersion.split("-")[0])
- defineProperty("jdkBuildNumber", jdkRuntimeVersion.substring(jdkRuntimeVersion.lastIndexOf("-b") + 2))
- }
- }
- }
-} finally {
- inStream.close();
-}
if (!project.hasProperty("jdkRuntimeVersion")) throw new Exception("Unable to determine the version of Java in JDK_HOME at $JDK_HOME");
# ORIGINAL FILE AT https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=java8-openjfx
# Only modification is at line 71 to apply new patch
# Maintainer: Levente Polyak <anthraxx[at]archlinux[dot]org>
# Maintainer: Frederik Schwan <freswa at archlinux dot org>
# Contributor: Guillaume Alaux <guillaume@archlinux.org>
# Contributor: Maxime Gauduin <alucryd@archlinux.org>
# Contributor: William Gathoye <william + archlinux at gathoye dot be>
# Contributor: Emanuel Couto <emanuel dot amaral dot couto at gmail dot com>
# Contributor: Richard Jackson <rdjack21 at gmail dot com>
# Contributor: Tinx <arch at tinx dot eu>
# Contributor: Jens Kapitza <j dot kapitza at schwarze-allianz dot de>
# Contributor: Olli <olli at coderkun dot de>
pkgbase=java8-openjfx
pkgname=(
java8-openjfx
java8-openjfx-doc
java8-openjfx-src
)
pkgver=8.u202
pkgrel=4
pkgdesc='Java OpenJFX 8 client application platform (open-source implementation of JavaFX)'
arch=(x86_64)
url=https://wiki.openjdk.java.net/display/OpenJFX/Main
license=(GPL)
makedepends=(
alsa-lib
cairo
cmake
ffmpeg4.4
freetype2
gdk-pixbuf2
glib2
gperf
gtk2
gtk3
java-environment-openjdk=8
libgl
libx11
libxtst
pango
python
qt5-base
ruby
unzip
webkit2gtk
)
source=(
https://hg.openjdk.java.net/openjfx/8u-dev/rt/archive/${pkgver//./}-ga.tar.bz2
gradle.properties
https://services.gradle.org/distributions/gradle-4.8-bin.zip
java8-openjfx-flags.patch
java8-openjfx-no-xlocale.patch
java8-openjfx-no-sys-sysctl.patch
java8-openjfx-CVE-2021-3517-fix.patch::https://gitlab.gnome.org/GNOME/libxml2/-/commit/bf22713507fe1fc3a2c4b525cf0a88c2dc87a3a2.patch
java8-openjfx-CVE-2021-3522-fix.patch::https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/commit/8a88e5c1db05ebadfd4569955f6f47c23cdca3c4.patch
)
sha256sums=('12b0538d04c4bd451e4692ee06357ac36233ff4ec2af9fa3b9bbdbab48c3f2fc'
'd1c2255893e5ec6268d7c92bb6539cde629d325872f26cffb5f1f616c9d5f30d'
'f3e29692a8faa94eb0b02ebf36fa263a642b3ae8694ef806c45c345b8683f1ba'
'a2e0d5ac5cdb83958d2886aef7f5a419f460e103959f65aaadd69cb26cc6adec'
'b21f6b254acc7aa2124521b6521d3bdfdfcfd9b062624a84ef73608120957d0d'
'cd1a2bd60f636662e4f3334217b3e14f1d51cf30b77b9ca3eff8d030312fd26a'
'4db6e995d46f5ab29c4169dab5dbbe367ebd01dee66ef1750abe5cf0c8364d42'
'3487eb180fff9866c8b8b08be45f13fa9e8edd04e5719bc867e59b09b81954b4')
prepare() {
cd rt-${pkgver//./}-ga
ln -sf ../gradle.properties .
patch -Np1 -i ../fixbuild.patch
patch -Np1 -i ../java8-openjfx-flags.patch
patch -Np1 -i ../java8-openjfx-no-xlocale.patch
patch -Np1 -i ../java8-openjfx-no-sys-sysctl.patch
# loose match the following patch due to whitespace differences
patch -Np1 -l -i "$srcdir"/java8-openjfx-CVE-2021-3517-fix.patch -d modules/web/src/main/native/Source/ThirdParty/libxml/src
patch -Np1 -i "$srcdir"/java8-openjfx-CVE-2021-3522-fix.patch -d modules/media/src/main/native/gstreamer/gstreamer-lite/gst-plugins-base
}
build() {
cd rt-${pkgver//./}-ga
# https://wiki.gentoo.org/wiki/Gcc_10_porting_notes/fno_common
CFLAGS+=' -fcommon'
# build against ffmpeg4.4
export PKG_CONFIG_PATH='/usr/lib/ffmpeg4.4/pkgconfig'
../gradle-4.8/bin/gradle
}
package_java8-openjfx() {
depends=(
java-runtime-openjdk=8
libgl
libx11
libxtst
)
optdepends=(
'ffmpeg4.4: Media support',
'gtk2: GTK2 support',
'gtk3: GTK3 support',
'webkit2gtk: Web support'
)
provides=('java-openjfx=8')
cd rt-${pkgver//./}-ga
install -dm 755 "${pkgdir}"/usr/lib/jvm/java-8-openjdk/jre
cp -dr --no-preserve=ownership build/sdk/{bin,lib} "${pkgdir}"/usr/lib/jvm/java-8-openjdk/
cp -dr --no-preserve=ownership build/sdk/rt/lib "${pkgdir}"/usr/lib/jvm/java-8-openjdk/jre/
}
package_java8-openjfx-doc() {
cd rt-${pkgver//./}-ga
install -dm 755 "${pkgdir}"/usr/share/doc
cp -dr --no-preserve=ownership build/javadoc "${pkgdir}"/usr/share/doc/java8-openjfx
}
package_java8-openjfx-src() {
cd rt-${pkgver//./}-ga
install -Dm 644 build/javafx-src.zip -t "${pkgdir}"/usr/lib/jvm/java-8-openjdk/
}
# vim: ts=2 sw=2 et:
@ABelliqueux
Copy link
Author

ABelliqueux commented Apr 1, 2022

Issue description

This is a dirty work around to get java8-openjfx to install from AUR on Arch/Manjaro linux, as of 03/2022.

For reference, package is here : https://aur.archlinux.org/packages/java8-openjfx

The issue seems to be that the gradle script in src/rt-8u202-ga/build.gradle tries to extract the current java version from parsing the result of java -version (see l.740) and searching for the string " (build ".
On my system, this seems to result in the third line to be parsed instead of the second one.

Dirty solution is to hardcode the correct java version in the script.

Instructions :

  • Try to install java8-openjfx from AUR once to get the files in /tmp/trizen-blah
  • Find your java version with java -version. E.G. :
openjdk version "1.8.0_332"
OpenJDK Runtime Environment (build 1.8.0_332-b04)
OpenJDK 64-Bit Server VM (build 25.332-b04, mixed mode)

Keep the part that's after "build" on the second line, e.g : 1.8.0_332-b04

  • Adapt the properties in the patch file to your java version, and create the patchfile fixbuild.patch in /tmp/trizen-blah/java8-openjfx/src/
  • Replace PKGBUILD in /tmp/trizen-blah/java8-openjfx with the one above, or just add the following instruction at line 69 :
patch -Np1 -i ../fixbuild.patch
  • Run makepkg in /tmp/trizen-blah/java8-openjfx
  • Install with sudo pacman -U /tmp/trizen-blah/java8-openjfx/java8-openjfx-8.u202-4-x86_64.pkg.tar.xz

If you get an error about "jfxrt.jar must be removed before building sdk", just move the file with :

sudo mv /usr/lib/jvm/java-8-openjdk/jre/lib/ext/jfxrt.jar /usr/lib/jvm/java-8-openjdk/jre/lib/ext/jfxrt.jar.bak

@guemidiborhane
Copy link

guemidiborhane commented Apr 3, 2022

Hey, thanks it worked like a charm. Just heads up for people like me who have python3 as default python version just run the makepkg a first time and after it complains about perl, just edit ./src/rt-8u202-ga/modules/web/build/linux/Release/CMakeCache.txt and set the correct path to python 2 e.g: /usr/bin/python2

Edit:
Search for

  • PYTHON_EXECUTABLE:FILEPATH
  • FIND_PACKAGE_MESSAGE_DETAILS_PythonInterp:INTERNAL

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment