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