forked from LWJGL/lwjgl3
-
Notifications
You must be signed in to change notification settings - Fork 12
/
ci_build_ios.bash
93 lines (81 loc) · 2.92 KB
/
ci_build_ios.bash
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#!/bin/bash
set -e
export LIBFFI_VERSION=3.4.4
export LWJGL_BUILD_OFFLINE=1
export LWJGL_BUILD_ARCH=arm64
LWJGL_NATIVE=bin/libs/native/macos/$LWJGL_BUILD_ARCH/org/lwjgl
mkdir -p $LWJGL_NATIVE
if [ "$SKIP_LIBFFI" != "1" ]; then
# Get libffi
if [ ! -d libffi ]; then
wget https://github.com/libffi/libffi/releases/download/v$LIBFFI_VERSION/libffi-$LIBFFI_VERSION.tar.gz
tar xvf libffi-$LIBFFI_VERSION.tar.gz
mv libffi-$LIBFFI_VERSION libffi
fi
cd libffi
# Patch generator to produce iOS arm64 only
sed -i'.bak' \
-e '/\(64_platform\)/! s/build_target(ios_/#build_target(ios_/g' \
generate-darwin-source-and-headers.py
# Generate configure file
python3 generate-darwin-source-and-headers.py --only-ios
# Restore generator
mv generate-darwin-source-and-headers.py.bak generate-darwin-source-and-headers.py
# Build libffi
xcodebuild -arch arm64 -sdk iphoneos -target libffi-iOS || echo "Exit code: $?"
# Copy libffi
cd ..
cp libffi/build/Release-iphoneos/libffi.a $LWJGL_NATIVE/
fi
# Download libraries
#POJAV_NATIVES="https://github.com/PojavLauncherTeam/PojavLauncher_iOS/raw/main/Natives/resources/Frameworks"
#wget -nc $POJAV_NATIVES/libopenal.so -P $LWJGL_NATIVE/openal
wget -nc "https://nightly.link/PojavLauncherTeam/shaderc/workflows/ios/main/libshaderc.zip"
unzip -o libshaderc.zip -d $LWJGL_NATIVE/shaderc
rm $LWJGL_NATIVE/shaderc/libshaderc_shared.1.dylib
mv $LWJGL_NATIVE/shaderc/libshaderc_shared.dylib $LWJGL_NATIVE/shaderc/libshaderc.dylib
# HACK: Skip compiling and running the generator to save time and keep LWJGLX functions
mkdir -p bin/classes/{generator,templates/META-INF}
touch bin/classes/{generator,templates}/touch.txt bin/classes/generator/generated-touch.txt
# Build LWJGL 3
ant -version
yes | ant -Dplatform.macos=true \
-Dbinding.assimp=false \
-Dbinding.bgfx=false \
-Dbinding.cuda=false \
-Dbinding.egl=false \
-Dbinding.jawt=false \
-Dbinding.jemalloc=false \
-Dbinding.libdivide=false \
-Dbinding.llvm=false \
-Dbinding.lmdb=false \
-Dbinding.lz4=false \
-Dbinding.meow=false \
-Dbinding.meshoptimizer=false \
-Dbinding.nfd=false \
-Dbinding.nuklear=false \
-Dbinding.odbc=false \
-Dbinding.opencl=false \
-Dbinding.openvr=false \
-Dbinding.openxr=false \
-Dbinding.opus=false \
-Dbinding.par=false \
-Dbinding.remotery=false \
-Dbinding.rpmalloc=false \
-Dbinding.spvc=false \
-Dbinding.sse=false \
-Dbinding.tinyexr=false \
-Dbinding.tootle=false \
-Dbinding.xxhash=false \
-Dbinding.yoga=false \
-Dbinding.zstd=false \
-Dbuild.type=release/3.3.1 \
-Djavadoc.skip=true \
-Dnashorn.args="--no-deprecation-warning" \
compile compile-native release
# Copy native libraries
rm -rf bin/out; mkdir bin/out
find $LWJGL_NATIVE -name 'liblwjgl*.dylib' -exec cp {} bin/out/ \;
cp $LWJGL_NATIVE/shaderc/libshaderc.dylib bin/out/
# Cleanup unused output jar files
find bin/RELEASE \( -name '*-natives-*' -o -name '*-sources.jar' \) -delete