From f3cc956bfeedfbcc96e257f90571bc838f889022 Mon Sep 17 00:00:00 2001 From: Antoine Martin Date: Fri, 20 Dec 2024 18:43:35 -0500 Subject: [PATCH] user/lwjgl3: initial commit --- user/lwjgl3/APKBUILD | 236 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 236 insertions(+) create mode 100644 user/lwjgl3/APKBUILD diff --git a/user/lwjgl3/APKBUILD b/user/lwjgl3/APKBUILD new file mode 100644 index 0000000..939ea46 --- /dev/null +++ b/user/lwjgl3/APKBUILD @@ -0,0 +1,236 @@ + Contributor: knuxify +# Maintainer: knuxify +pkgname=lwjgl3 +pkgver=3.3.1 +pkgrel=0 +pkgdesc="LWJGL - Lightweight Java Game Library 3" +url="https://www.lwjgl.org/" +# Not officialy available for other architectures +arch="x86 x86_64 armhf armv7 aarch64" +# lwjgl3 itself is BSD-3-Clause, remaining licenses are for included libraries +license="BSD-3-Clause AND Zlib AND LGPL-2.0-or-later AND BSD-2-Clause" +makedepends="bash + openjdk8 + apache-ant + libffi-dev + gtk+3.0-dev + glib-dev + glfw-dev + jemalloc-dev + opus-dev + " + +case $CARCH in + armhf|armv7|x86) ;; + *) depends="openjdk17-jre"; makedepends="$makedepends openjdk17";; +esac + +source="https://github.com/LWJGL/lwjgl3/archive/refs/tags/$pkgver/lwjgl3-$pkgver.tar.gz + remove-preadv2.patch + ffi-patches.patch + force-use-of-system-libffi.patch + disable-remotery.patch + add-missing-include-for-nfd.patch + remove-gcc-prefixes-for-aarch64-arm32.patch" +options="!check" # test suite fails +subpackages="$pkgname-dev" + +# Java dependencies +_kotlin_compiler_ver=1.6.20-M1 + +_jsr305_version=3.0.2 +_testng_version=7.4.0 +_jcommander_version=1.78 +_jquery_version=3.5.1 +_joml_version=1.10.4 +_jmh_core_version=1.33 +_jmh_generator_annprocess_version=1.33 +_jopt_simple_version=5.0.4 +_commons_math3_version=3.6.1 + +# https://repo.maven.apache.org/maven2/@{group}/@{artifact}/@{version}/@{artifact}-@{version}@{classifier}.jar +# https://repo.maven.apache.org/maven2/@{group}/@{artifact}/@{version}/@{artifact}-@{version}-sources.jar +source="$source + https://github.com/JetBrains/kotlin/releases/download/v$_kotlin_compiler_ver/kotlin-compiler-$_kotlin_compiler_ver.zip + + https://repo.maven.apache.org/maven2/com/google/code/findbugs/jsr305/$_jsr305_version/jsr305-$_jsr305_version.jar + https://repo.maven.apache.org/maven2/com/google/code/findbugs/jsr305/$_jsr305_version/jsr305-$_jsr305_version-sources.jar + + https://repo.maven.apache.org/maven2/org/testng/testng/$_testng_version/testng-$_testng_version.jar + https://repo.maven.apache.org/maven2/org/testng/testng/$_testng_version/testng-$_testng_version-sources.jar + + https://repo.maven.apache.org/maven2/com/beust/jcommander/$_jcommander_version/jcommander-$_jcommander_version.jar + + https://repo.maven.apache.org/maven2/org/webjars/jquery/$_jquery_version/jquery-$_jquery_version.jar + + https://repo.maven.apache.org/maven2/org/joml/joml/$_joml_version/joml-$_joml_version.jar + https://repo.maven.apache.org/maven2/org/joml/joml/$_joml_version/joml-$_joml_version-sources.jar + + https://repo.maven.apache.org/maven2/org/openjdk/jmh/jmh-core/$_jmh_core_version/jmh-core-$_jmh_core_version.jar + https://repo.maven.apache.org/maven2/org/openjdk/jmh/jmh-core/$_jmh_core_version/jmh-core-$_jmh_core_version-sources.jar + + https://repo.maven.apache.org/maven2/org/openjdk/jmh/jmh-generator-annprocess/$_jmh_generator_annprocess_version/jmh-generator-annprocess-$_jmh_generator_annprocess_version.jar + + https://repo.maven.apache.org/maven2/net/sf/jopt-simple/jopt-simple/$_jopt_simple_version/jopt-simple-$_jopt_simple_version.jar + + https://repo.maven.apache.org/maven2/org/apache/commons/commons-math3/$_commons_math3_version/commons-math3-$_commons_math3_version.jar + " + +# Static dependencies; see https://github.com/LWJGL-CI for commit sources +# The build process refuses to build working native libraries without them +_glfw_commit="203b8a711fdfb8814d499b84891224ebe032076c" +_openal_soft_commit="b9601498e8c017fd9b219bad18b5cb068741edd5" +_jemalloc_commit="9104a8ad776eaf6445195b478405cd4a29d5dddf" + +# glfw makedepends +makedepends="$makedepends libxinerama-dev linux-headers mesa-dev cmake samurai + libx11-dev libxcursor-dev libxrandr-dev libxi-dev" + +# openal-soft makedepends (except cmake, samurai, linux-headers) +makedepends="$makedepends alsa-lib-dev jack-dev libsndfile-dev portaudio-dev + qt5-qtbase-dev" + +# jemalloc makedepends +makedepends="$makedepends autoconf" + +source="$source + https://github.com/LWJGL-CI/glfw/archive/$_glfw_commit.tar.gz + https://github.com/LWJGL-CI/openal-soft/archive/$_openal_soft_commit.tar.gz + https://github.com/LWJGL-CI/jemalloc/archive/$_jemalloc_commit.tar.gz + " + +prepare() { + default_prepare + + mkdir -p "$builddir"/bin/libs/ + mv "$srcdir"/kotlinc "$builddir"/bin/libs/ + + mkdir -p "$builddir"/bin/libs/java + for dep in "$srcdir"/*-sources.jar; do + _dep=${dep%%.*} + mv $dep "$builddir"/bin/libs/java/"$(basename ${_dep%-*})"-sources.jar + done + for dep in "$srcdir"/*.jar; do + mv $dep "$builddir"/bin/libs/java/"$(basename ${dep%-*})".jar + done +} + +# Build and copy static dependencies +build_glfw() { + cd "$srcdir"/glfw-$_glfw_commit + cmake -G Ninja -B build \ + -DCMAKE_BUILD_TYPE=MinSizeRel \ + -DBUILD_SHARED_LIBS=ON \ + -DGLFW_BUILD_TESTS=OFF \ + -DGLFW_BUILD_EXAMPLES=OFF + cmake --build build + + mkdir -p "$builddir"/bin/libs/native/linux/x64/org/lwjgl/glfw + cp build/src/libglfw.so.3 "$builddir"/bin/libs/native/linux/x64/org/lwjgl/glfw/libglfw.so + + cd "$builddir" +} + +build_openal() { + cd "$srcdir"/openal-soft-$_openal_soft_commit + cmake -B build -G Ninja \ + -DCMAKE_BUILD_TYPE=MinSizeRel \ + -DBUILD_SHARED_LIBS=OFF + ninja -C build + + mkdir -p "$builddir"/bin/libs/native/linux/x64/org/lwjgl/openal + cp build/libopenal.so "$builddir"/bin/libs/native/linux/x64/org/lwjgl/openal + + cd "$builddir" +} + +build_jemalloc() { + cd "$srcdir"/jemalloc-$_jemalloc_commit + + local _pgs + case "$CARCH" in + x86|x86_64) _pgs=12 ;; + ppc64le) export CPPFLAGS="$CPPFLAGS -maltivec -mabi=altivec" && _pgs=16 ;; + *) _pgs=16 ;; + esac + + autoconf + ./configure \ + --enable-xmalloc \ + --with-lg-page="$_pgs" \ + --with-lg-hugepage=21 + make all dist + + mkdir -p "$builddir"/bin/libs/native/linux/x64/org/lwjgl/jemalloc + cp lib/libjemalloc.so "$builddir"/bin/libs/native/linux/x64/org/lwjgl/jemalloc + + cd "$builddir" +} + +build() { + build_glfw + build_openal + build_jemalloc + + export LWJGL_BUILD_OFFLINE=true + export JAVA8_HOME="/usr/lib/jvm/java-1.8-openjdk" + ant init + ant compile-templates + ant generate + touch "$builddir"/bin/libs/touch.txt + touch "$builddir"/bin/libs/native/linux/x64/touch.txt + ant compile-native + ant -Djavadoc.skip=true release +} + +check() { + ant tests +} + +package() { + mkdir -p "$pkgdir"/usr/lib/lwjgl/$pkgver + mv "$builddir"/bin/RELEASE/* "$pkgdir"/usr/lib/lwjgl/$pkgver + mv "$builddir"/bin/libs/native/linux/x64/org/lwjgl/liblwjgl.so "$pkgdir"/usr/lib + + # Remove arm native libraries from non-arm systems + # (TODO: Do these do anything on ARM, or can it use the regular jars?) + for file in $(find $pkgdir/usr/lib/lwjgl -name '*natives-linux-arm32.jar'); do + rm "$file" + done +} + +dev() { + pkgdesc="$pkgdesc (source jars)" + + cd "$pkgdir" + for file in "$(find usr/lib/lwjgl -name '*-sources.jar')"; do + amove "$file" + done +} + +sha512sums=" +4c87383a6329aa7a6c0e7bc7d607a196bdcaba1f59adab62fcc98c3c806d51c8d7c7f54911f341f4ad3111643287430f7405c0f660ad2077673b1f6e3f675642 lwjgl3-3.3.1.tar.gz +0f52edb7b57ec967a2d8d6efae913a9a0430cbf5482dcf190c069572d1b58bd4c1dccab48bcdda26ac0788a68b9a65c773139444ea9f614e955f03d8f770ef7a remove-preadv2.patch +797eafb2efa75c4d065d10fedf1943422af1d22231ccf804e62ddf8f9273b241ae5342c08e9872867577933b767ee244a7eff96fc0a9e1ab0597fc29e60289bc ffi-patches.patch +1ca9bceecbd33a84ee708e45d718bec45788a2c382ed7ab73ff49f659c9df33ace8cc976a4cecd51bbe110df934648542a20346058b06475a4b1ac3db8b7e17e force-use-of-system-libffi.patch +55c3f5aeb366994c99bc7159c8ddab1b0c1d280f766791eb75bc8f700baf434f2c21958d990ee08c3fdaf5c6dd3628b4948934b62ec5b50d5c7573a2f38519a9 disable-remotery.patch +d8f68ed3d88e1948cf4560f32da27f5c8f0d80e11d3abd64eec3cf921e2539370202ebfa365e7b38b543def72d5755d276e843fccd22840ad0ae5562fed8b03d add-missing-include-for-nfd.patch +c3e49e7d4fa2313f6e3c2778d2b55ed90f4852c59099937acfa0d2ff6ae15e0caba79507b1cae0888f7407a731fa53de4057889147858a764cfbd73487f0b730 remove-gcc-prefixes-for-aarch64-arm32.patch +b42e47d3d93bc71d89589d54640104055b3196078908e11d7d8d652ede1f1253515cc4d2745354593c009e021c9e4d39e719d3a518b8a4b613afe94378235ec3 kotlin-compiler-1.6.20-M1.zip +bb09db62919a50fa5b55906013be6ca4fc7acb2e87455fac5eaf9ede2e41ce8bbafc0e5a385a561264ea4cd71bbbd3ef5a45e02d63277a201d06a0ae1636f804 jsr305-3.0.2.jar +02327071dde09470c8cd0fe39405263146d7e86b15312bc3f909c6a6fa9b11c730bdb833b6cdbdf1aee0c6553e519cecd0257a296947f94636650e88cd8c5b79 jsr305-3.0.2-sources.jar +4a0239524b0d5dbcd957d01a465d1958529a1cfe5e37d1bfecacb7d855a0251be762316ef98987de49c16292ef92a33bead603132bacf575fb886e6a740e093c testng-7.4.0.jar +e7cf92e6045b43c0768bb3004e2902a287d507e3a781b13e7f6e09df30f224cef4b88b54db2bfe17c61ede22dbbf91d6e2482339efc40554de8b4b0bad4f43b9 testng-7.4.0-sources.jar +5ee2ef4c12888a48d7c830189d06ee8a653c7664a53c9b6fa935d4e7866b0454111f8092d7ece086ec80c61edab2856187a1e247873e5c8e4724efb02c37504b jcommander-1.78.jar +9f560415b36875958ff1d3c6d37fa79d6d134c5f5fc7719dd21db36d1f24dec39787834b2a9ffb104ec6b56e725ccc524a8ff9b189ced3d68e24296b2daae720 jquery-3.5.1.jar +01e97f749902a7f7904ee1a11051948022796904136d7496fcba63c1d82e791626c4fdb769761b9595ef7b96f9380f5ba04ff682e949b6423c6793080a921579 joml-1.10.4.jar +4d6c65bdd7be66352d7d834c6e22e5c467b27edd8dcd6efcca71be34f49f5ac8b230961470f568bc859ef234b951e04f5b6ec2990de29f9d0d6dd5661e8136f5 joml-1.10.4-sources.jar +016dcab45f7bbfda9bdc8aeafef86abfbd53a83141e491db76956150e5a7cb21e8f8c03f8cbf28acdca85667c6ab3005aa83d257350d69de6087b62a1e91c493 jmh-core-1.33.jar +ee257caaa076af83775ec5e691e6348212614a47758fd960f3d0b7d035341b9a804e1be54ba18023a16a8e9ad0eaae66bf99eb8d1659418268d2cbdf93feaeae jmh-core-1.33-sources.jar +a117fc0cba413990c2ba409dd8c8759bcf75aad009dc36a2f58a146bf3263c9998b7ed7aafc4d159e844e5cd9386b539eb48ff95074cf8972f3439e1f9816ab8 jmh-generator-annprocess-1.33.jar +cbc27e0b6da6ae4b6245353d6626d2e3c171c3026a555fa21e8ef61b30714e286db85086d1a57c167016e8a7f07be2a243e34b3ab504b1877806f3bcec5df986 jopt-simple-5.0.4.jar +8bc2438b3b4d9a6be4a47a58410b2d4d0e56e05787ab24badab8cbc9075d61857e8d2f0bffedad33f18f8a356541d00f80a8597b5dedb995be8480d693d03226 commons-math3-3.6.1.jar +0404cf3a2aea284dd89e87c502e80115a72014a33e0b85e1472e85ce1cf1604b4e87a9e0a443b011cf37392485476dec9bf00d8bda7442e7138c535b9a893b8c 203b8a711fdfb8814d499b84891224ebe032076c.tar.gz +b7174fa1982710d579a96093badc4a4130c7083d052b52f7a8a7176ce51b0fbe3f3d9a948fe0254319fa619ed249885e4d785b0ecdaf24a9cd5692da346bc00b b9601498e8c017fd9b219bad18b5cb068741edd5.tar.gz +8f8598d0dd33a897fcdbe595891d628c62acc9a4ba4cfdcf5a8021b79a7cf6976a77aac59bc4ebbc37a24720268d00313683ef98130fdd8a48587c059ce474d9 9104a8ad776eaf6445195b478405cd4a29d5dddf.tar.gz +"