user/lwjgl3: new aport #801

Open
forge wants to merge 2 commits from lwjgl3/initial into edge
7 changed files with 664 additions and 0 deletions

236
user/lwjgl3/APKBUILD Normal file
View file

@ -0,0 +1,236 @@
# Contributor: knuxify <knuxify@gmail.com>
# Maintainer: knuxify <knuxify@gmail.com>
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
"

View file

@ -0,0 +1,25 @@
From f0aa43a634fd86732e3653be0cf117f9f69f5df7 Mon Sep 17 00:00:00 2001
From: knuxify <knuxify@gmail.com>
Date: Sun, 11 Dec 2022 16:13:22 +0100
Subject: [PATCH] add missing include for nfd
---
config/linux/build.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/config/linux/build.xml b/config/linux/build.xml
index 5098004..6acd46a 100644
--- a/config/linux/build.xml
+++ b/config/linux/build.xml
@@ -262,7 +262,7 @@
<condition property="linux.triplet" value="aarch64-linux-gnu"><isset property="build.arch.arm64"/></condition>
<compile>
- <arg line="-I/usr/include/gtk-3.0 -I/usr/include/glib-2.0 -I/usr/lib/${linux.triplet}/glib-2.0/include -I/usr/include/pango-1.0 -I/usr/include/harfbuzz -I/usr/include/cairo -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/atk-1.0"/>
+ <arg line="-I/usr/include/gtk-3.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/pango-1.0 -I/usr/include/harfbuzz -I/usr/include/cairo -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/atk-1.0"/>
<arg value="-I${src.main.rel}"/>
<arg value="-I${src.main.rel}/include"/>
<fileset dir="." includes="${src.main}/nfd_common.c"/>
--
2.38.1

View file

@ -0,0 +1,30 @@
From 80a7bdc48ff5150208c3417c2d0aadf3bc2e5498 Mon Sep 17 00:00:00 2001
From: knuxify <knuxify@gmail.com>
Date: Sun, 11 Dec 2022 16:12:10 +0100
Subject: [PATCH] disable remotery
---
config/build-bindings.xml | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
diff --git a/config/build-bindings.xml b/config/build-bindings.xml
index 7a458f1..8db9186 100644
--- a/config/build-bindings.xml
+++ b/config/build-bindings.xml
@@ -49,12 +49,7 @@ This script is included in /config/build-definitions.xml.
<property name="binding.openxr" value="true"/>
<property name="binding.opus" value="true"/>
<property name="binding.par" value="true"/>
- <condition property="binding.remotery" value="false" else="true">
- <and>
- <isset property="platform.windows"/>
- <isset property="build.arch.arm"/>
- </and>
- </condition>
+ <property name="binding.remotery" value="false"/>
<property name="binding.rpmalloc" value="true"/>
<property name="binding.shaderc" value="true"/>
<property name="binding.spvc" value="true"/>
--
2.38.1

View file

@ -0,0 +1,257 @@
From 48a3172ef8f3a0dc0538cec1c4305bcdf9c31016 Mon Sep 17 00:00:00 2001
From: Ioannis Tsakpinis <iotsakp@gmail.com>
Date: Mon, 3 Oct 2022 01:26:12 +0300
Subject: [PATCH] feat(libffi) update to 3.4.3
---
.../java/org/lwjgl/system/libffi/LibFFI.java | 4 +-
modules/lwjgl/core/src/main/c/libffi/ffi.h | 68 +++++++++++--------
.../core/src/main/c/libffi/x86/ffitarget.h | 7 +-
.../kotlin/core/libffi/templates/LibFFI.kt | 19 +++---
4 files changed, 55 insertions(+), 43 deletions(-)
diff --git a/modules/lwjgl/core/src/generated/java/org/lwjgl/system/libffi/LibFFI.java b/modules/lwjgl/core/src/generated/java/org/lwjgl/system/libffi/LibFFI.java
index 465295188d..a3485820c7 100644
--- a/modules/lwjgl/core/src/generated/java/org/lwjgl/system/libffi/LibFFI.java
+++ b/modules/lwjgl/core/src/generated/java/org/lwjgl/system/libffi/LibFFI.java
@@ -102,12 +102,14 @@ public class LibFFI {
* <li>{@link #FFI_OK OK}</li>
* <li>{@link #FFI_BAD_TYPEDEF BAD_TYPEDEF}</li>
* <li>{@link #FFI_BAD_ABI BAD_ABI}</li>
+ * <li>{@link #FFI_BAD_ARGTYPE BAD_ARGTYPE}</li>
* </ul>
*/
public static final int
FFI_OK = 0,
FFI_BAD_TYPEDEF = 1,
- FFI_BAD_ABI = 2;
+ FFI_BAD_ABI = 2,
+ FFI_BAD_ARGTYPE = 3;
protected LibFFI() {
throw new UnsupportedOperationException();
diff --git a/modules/lwjgl/core/src/main/c/libffi/ffi.h b/modules/lwjgl/core/src/main/c/libffi/ffi.h
index 5b5efd2697..6c16184a77 100644
--- a/modules/lwjgl/core/src/main/c/libffi/ffi.h
+++ b/modules/lwjgl/core/src/main/c/libffi/ffi.h
@@ -1,6 +1,7 @@
/* -----------------------------------------------------------------*-C-*-
- libffi @VERSION@ - Copyright (c) 2011, 2014, 2019 Anthony Green
- - Copyright (c) 1996-2003, 2007, 2008 Red Hat, Inc.
+ libffi @VERSION@
+ - Copyright (c) 2011, 2014, 2019, 2021, 2022 Anthony Green
+ - Copyright (c) 1996-2003, 2007, 2008 Red Hat, Inc.
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
@@ -62,6 +63,31 @@ extern "C" {
#define FFI_EXEC_TRAMPOLINE_TABLE 0
#endif
+/* If these change, update src/mips/ffitarget.h. */
+#define FFI_TYPE_VOID 0
+#define FFI_TYPE_INT 1
+#define FFI_TYPE_FLOAT 2
+#define FFI_TYPE_DOUBLE 3
+#if HAVE_LONG_DOUBLE
+#define FFI_TYPE_LONGDOUBLE 4
+#else
+#define FFI_TYPE_LONGDOUBLE FFI_TYPE_DOUBLE
+#endif
+#define FFI_TYPE_UINT8 5
+#define FFI_TYPE_SINT8 6
+#define FFI_TYPE_UINT16 7
+#define FFI_TYPE_SINT16 8
+#define FFI_TYPE_UINT32 9
+#define FFI_TYPE_SINT32 10
+#define FFI_TYPE_UINT64 11
+#define FFI_TYPE_SINT64 12
+#define FFI_TYPE_STRUCT 13
+#define FFI_TYPE_POINTER 14
+#define FFI_TYPE_COMPLEX 15
+
+/* This should always refer to the last type code (for sanity checks). */
+#define FFI_TYPE_LAST FFI_TYPE_COMPLEX
+
#include <ffitarget.h>
#ifndef LIBFFI_ASM
@@ -224,7 +250,8 @@ FFI_EXTERN ffi_type ffi_type_complex_longdouble;
typedef enum {
FFI_OK = 0,
FFI_BAD_TYPEDEF,
- FFI_BAD_ABI
+ FFI_BAD_ABI,
+ FFI_BAD_ARGTYPE
} ffi_status;
typedef struct {
@@ -317,11 +344,17 @@ typedef struct {
void *trampoline_table;
void *trampoline_table_entry;
#else
- char tramp[FFI_TRAMPOLINE_SIZE];
+ union {
+ char tramp[FFI_TRAMPOLINE_SIZE];
+ void *ftramp;
+ };
#endif
ffi_cif *cif;
void (*fun)(ffi_cif*,void*,void**,void*);
void *user_data;
+#if defined(_MSC_VER) && defined(_M_IX86)
+ void *padding;
+#endif
} ffi_closure
#ifdef __GNUC__
__attribute__((aligned (8)))
@@ -362,7 +395,7 @@ ffi_prep_closure_loc (ffi_closure*,
ffi_cif *,
void (*fun)(ffi_cif*,void*,void**,void*),
void *user_data,
- void*codeloc);
+ void *codeloc);
#ifdef __sgi
# pragma pack 8
@@ -498,31 +531,6 @@ ffi_status ffi_get_struct_offsets (ffi_abi abi, ffi_type *struct_type,
#endif
-/* If these change, update src/mips/ffitarget.h. */
-#define FFI_TYPE_VOID 0
-#define FFI_TYPE_INT 1
-#define FFI_TYPE_FLOAT 2
-#define FFI_TYPE_DOUBLE 3
-#if HAVE_LONG_DOUBLE
-#define FFI_TYPE_LONGDOUBLE 4
-#else
-#define FFI_TYPE_LONGDOUBLE FFI_TYPE_DOUBLE
-#endif
-#define FFI_TYPE_UINT8 5
-#define FFI_TYPE_SINT8 6
-#define FFI_TYPE_UINT16 7
-#define FFI_TYPE_SINT16 8
-#define FFI_TYPE_UINT32 9
-#define FFI_TYPE_SINT32 10
-#define FFI_TYPE_UINT64 11
-#define FFI_TYPE_SINT64 12
-#define FFI_TYPE_STRUCT 13
-#define FFI_TYPE_POINTER 14
-#define FFI_TYPE_COMPLEX 15
-
-/* This should always refer to the last type code (for sanity checks). */
-#define FFI_TYPE_LAST FFI_TYPE_COMPLEX
-
#ifdef __cplusplus
}
#endif
diff --git a/modules/lwjgl/core/src/main/c/libffi/x86/ffitarget.h b/modules/lwjgl/core/src/main/c/libffi/x86/ffitarget.h
index 60caf0db97..3cc1b29b44 100644
--- a/modules/lwjgl/core/src/main/c/libffi/x86/ffitarget.h
+++ b/modules/lwjgl/core/src/main/c/libffi/x86/ffitarget.h
@@ -203,9 +203,11 @@ typedef enum ffi_abi {
# define FFI_NATIVE_RAW_API 1 /* x86 has native raw api support */
#endif
-#if !defined(GENERATE_LIBFFI_MAP) && defined(__ASSEMBLER__) \
- && defined(__CET__)
+#if !defined(GENERATE_LIBFFI_MAP) && defined(__CET__)
# include <cet.h>
+# if (__CET__ & 1) != 0
+# define ENDBR_PRESENT
+# endif
# define _CET_NOTRACK notrack
#else
# define _CET_ENDBR
@@ -213,4 +215,3 @@ typedef enum ffi_abi {
#endif
#endif
-
diff --git a/modules/lwjgl/core/src/templates/kotlin/core/libffi/templates/LibFFI.kt b/modules/lwjgl/core/src/templates/kotlin/core/libffi/templates/LibFFI.kt
index 18f922c12e..28d2dafc38 100644
--- a/modules/lwjgl/core/src/templates/kotlin/core/libffi/templates/LibFFI.kt
+++ b/modules/lwjgl/core/src/templates/kotlin/core/libffi/templates/LibFFI.kt
@@ -62,7 +62,7 @@ typedef void (*FFI_CLOSURE_FUN)(ffi_cif*, void*, void**, void*);""")
val ABI = EnumConstant(
"""
ABI enumeration.
-
+
<b>LWJGL note</b>: ABIs that are not applicable to the current platform will have a value of -1 and should not be used.
""",
@@ -107,7 +107,8 @@ typedef void (*FFI_CLOSURE_FUN)(ffi_cif*, void*, void**, void*);""")
"OK".enum,
"BAD_TYPEDEF".enum,
- "BAD_ABI".enum
+ "BAD_ABI".enum,
+ "BAD_ARGTYPE".enum
)
macro..Address..ffi_type.p("type_void", "The {@code ffi_type_void} struct.", void())
@@ -140,7 +141,7 @@ typedef void (*FFI_CLOSURE_FUN)(ffi_cif*, void*, void**, void*);""")
"prep_cif",
"""
Initializes the specified Call Interface (CIF) according to the given parameters.
-
+
The resulting {@code ffi_cif} holds pointers to all the {@code ffi_type} objects that were used during initialization. You must ensure that these type
objects have a lifetime at least as long as that of the {@code ffi_cif}.
""",
@@ -195,7 +196,7 @@ typedef void (*FFI_CLOSURE_FUN)(ffi_cif*, void*, void**, void*);""")
"call",
"""
Calls the function {@code fn} according to the description given in {@code cif}.
-
+
{@code cif} must have already been prepared using #prep_cif().
""",
@@ -208,7 +209,7 @@ typedef void (*FFI_CLOSURE_FUN)(ffi_cif*, void*, void**, void*);""")
"rvalue",
"""
a pointer to a chunk of memory that will hold the result of the function call.
-
+
This must be large enough to hold the result, no smaller than the system register size (generally 32 or 64 bits), and must be suitably aligned; it
is the caller's responsibility to ensure this. If CIF declares that the function returns {@code void} (using #type_void), then {@code rvalue} is
ignored.
@@ -223,7 +224,7 @@ typedef void (*FFI_CLOSURE_FUN)(ffi_cif*, void*, void**, void*);""")
"avalues",
"""
a vector of {@code void *} pointers that point to the memory locations holding the argument values for a call.
-
+
If {@code cif} declares that the function has no arguments (i.e., {@code nargs} was 0), then {@code avalues} is ignored. Note that argument values
may be modified by the callee (for instance, structs passed by value); the burden of copying pass-by-value arguments is placed on the caller.
@@ -260,7 +261,7 @@ typedef void (*FFI_CLOSURE_FUN)(ffi_cif*, void*, void**, void*);""")
"closure_alloc",
"""
Allocates a chunk of memory holding {@code size} bytes.
-
+
Returns a pointer to the writable address, and sets {@code *code} to the corresponding executable address.
""",
@@ -281,7 +282,7 @@ typedef void (*FFI_CLOSURE_FUN)(ffi_cif*, void*, void**, void*);""")
"prep_closure_loc",
"""
Prepares a closure function.
-
+
After calling {@code ffi_prep_closure_loc,} you can cast {@code codeloc} to the appropriate pointer-to-function type.
""",
@@ -295,7 +296,7 @@ typedef void (*FFI_CLOSURE_FUN)(ffi_cif*, void*, void**, void*);""")
"{@code cif} - The {@code ffi_cif} passed to {@code ffi_prep_closure_loc}.",
"""
{@code ret} - a pointer to the memory used for the function's return value.
-
+
If the function is declared as returning {@code void}, then this value is garbage and should not be used.
Otherwise, {@code fun} must fill the object to which this points, following the same special promotion behavior as {@code ffi_call}. That is,

View file

@ -0,0 +1,38 @@
From 6fc0c85eabffd4208221d74868702b52a6a3d17e Mon Sep 17 00:00:00 2001
From: knuxify <knuxify@gmail.com>
Date: Sun, 11 Dec 2022 16:04:23 +0100
Subject: [PATCH] force use of system libffi
---
config/linux/build.xml | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)
diff --git a/config/linux/build.xml b/config/linux/build.xml
index 299ca65..5098004 100644
--- a/config/linux/build.xml
+++ b/config/linux/build.xml
@@ -187,13 +187,8 @@
<include name="${module.lwjgl}/jawt/src/generated/c/*.c" if:true="${binding.jawt}"/>
</fileset>
</source>
- <beforeLink>
- <parallel threadsPerProcessor="2" failonany="true" unless:set="lib-dependencies-uptodate">
- <update-dependency module="core" artifact="core/libffi.a"/>
- </parallel>
- </beforeLink>
<link>
- <fileset dir="${lib.native}/org/lwjgl">
+ <fileset dir="/usr/lib">
<include name="libffi.a"/>
</fileset>
<arg value="-ldl"/>
@@ -476,4 +471,4 @@
<touch file="${lib.native}/touch.txt" verbose="false"/>
</sequential>
</target>
-</project>
\ No newline at end of file
+</project>
--
2.38.1

View file

@ -0,0 +1,26 @@
From 1b5ccef4539d7a1dadac4c35112cdc5a1fbf4e90 Mon Sep 17 00:00:00 2001
From: knuxify <knuxify@gmail.com>
Date: Sun, 5 Feb 2023 16:19:58 +0100
Subject: [PATCH] remove prefixes for aarch64/arm32
---
config/linux/build.xml | 5 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/config/linux/build.xml b/config/linux/build.xml
index 299ca65..e2fe8fe 100644
--- a/config/linux/build.xml
+++ b/config/linux/build.xml
@@ -5,9 +5,6 @@
<project name="native-linux" basedir="../.." xmlns:if="ant:if" xmlns:unless="ant:unless">
<import file="../build-definitions.xml"/>
- <property name="gcc.prefix" value="aarch64-linux-gnu-" if:set="build.arch.arm64"/>
- <property name="gcc.prefix" value="arm-linux-gnueabihf-" if:set="build.arch.arm32"/>
-
<condition property="gcc.prefix" value="${gcc.prefix}" else="">
<isset property="gcc.prefix"/>
</condition>
--
2.39.1

View file

@ -0,0 +1,52 @@
From 77cce2fea2c6bf657a3d3fddecc731f596fe14dc Mon Sep 17 00:00:00 2001
From: knuxify <knuxify@gmail.com>
Date: Sat, 26 Nov 2022 10:06:53 +0100
Subject: [PATCH] rip preadv2 out of this file we don't have it
---
.../kotlin/core/linux/templates/uio.kt | 24 +------------------
1 file changed, 1 insertion(+), 23 deletions(-)
diff --git a/modules/lwjgl/core/src/templates/kotlin/core/linux/templates/uio.kt b/modules/lwjgl/core/src/templates/kotlin/core/linux/templates/uio.kt
index 2d8f9bf..da03b03 100644
--- a/modules/lwjgl/core/src/templates/kotlin/core/linux/templates/uio.kt
+++ b/modules/lwjgl/core/src/templates/kotlin/core/linux/templates/uio.kt
@@ -67,28 +67,6 @@ val uio = "UIO".nativeClass(Module.CORE_LINUX, nativeSubPath = "linux") {
off_t("__offset", "")
)
- SaveErrno..ssize_t(
- "preadv2",
- "",
-
- int("__fd", ""),
- iovec.const.p("__iovec", ""),
- int("__count", ""),
- off_t("__offset", ""),
- int("__flags", "")
- )
-
- SaveErrno..ssize_t(
- "pwritev2",
- "",
-
- int("__fd", ""),
- iovec.const.p("__iovec", ""),
- int("__count", ""),
- off_t("__offset", ""),
- int("__flags", "")
- )
-
SaveErrno..ssize_t(
"process_vm_readv",
"Read from another process' address space.",
@@ -112,4 +90,4 @@ val uio = "UIO".nativeClass(Module.CORE_LINUX, nativeSubPath = "linux") {
unsigned_long_int("__riovcnt", ""),
unsigned_long_int("__flags", "")
)
-}
\ No newline at end of file
+}
--
2.38.1