Skip to content

Commit

Permalink
Add freetype build for LWJGL bindings (#5)
Browse files Browse the repository at this point in the history
* Feat[freetype]: add freetype into build script

* Fix[freetype]: add missing slash, properly copy lib

* Fix[freetype]: proper copy path

* Fix[freetype]: Why is LWJGL_NATIVE relative?!?

* Fix[freetype]: fix path again

* Feat[freetype]: reuse macOS prebuilt library for iOS

* Fix[freetype]: missing backslash

* Fix[freetype]: iOS script missing vtool arg

* fix(build): remove bzip

---------

Co-authored-by: Duy Tran Khanh <[email protected]>
Co-authored-by: Mathias-Boulay <[email protected]>
  • Loading branch information
3 people authored Jul 14, 2024
1 parent 6b0684e commit df5a4f8
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 0 deletions.
35 changes: 35 additions & 0 deletions ci_build_android.bash
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,38 @@ if [ "$SKIP_LIBFFI" != "1" ]; then
cp libffi/$NDK_TARGET-linux-android$NDK_SUFFIX/.libs/libffi.a $LWJGL_NATIVE/
fi

if [ "$SKIP_FREETYPE" != "1" ]; then
#!/bin/bash
export BUILD_FREETYPE_VERSION=2.13.2
wget https://downloads.sourceforge.net/project/freetype/freetype2/$BUILD_FREETYPE_VERSION/freetype-$BUILD_FREETYPE_VERSION.tar.gz
tar xf freetype-$BUILD_FREETYPE_VERSION.tar.gz
rm freetype-$BUILD_FREETYPE_VERSION.tar.gz
cd freetype-$BUILD_FREETYPE_VERSION

export CC=$NDK_TARGET-linux-android${NDK_SUFFIX}21-clang

./configure \
--host=$TARGET \
--prefix=`pwd`/build_android-$LWJGL_BUILD_ARCH \
--without-zlib \
--with-brotli=no \
--with-bzip2=no \
--with-png=no \
--with-harfbuzz=no \
--enable-static=no \
--enable-shared=yes

make -j4
make install
llvm-strip ./build_android-$LWJGL_BUILD_ARCH/lib/libfreetype.so

cd ..
cp freetype-$BUILD_FREETYPE_VERSION/build_android-$LWJGL_BUILD_ARCH/lib/libfreetype.so $LWJGL_NATIVE/
rm -rf freetype-$BUILD_FREETYPE_VERSION
unset BUILD_FREETYPE_VERSION
unset CC
fi

# Download libraries
POJAV_NATIVES="https://github.com/PojavLauncherTeam/PojavLauncher/raw/v3_openjdk/app_pojavlauncher/src/main/jniLibs/$NDK_ABI"
wget -nc $POJAV_NATIVES/libopenal.so -P $LWJGL_NATIVE/openal
Expand Down Expand Up @@ -97,6 +129,9 @@ yes | ant -Dplatform.linux=true \
rm -rf bin/out; mkdir bin/out
find $LWJGL_NATIVE -name 'liblwjgl*.so' -exec cp {} bin/out/ \;
cp $LWJGL_NATIVE/shaderc/libshaderc.so bin/out/
if [ -e "$LWJGL_NATIVE/libfreetype.so" ]; then
cp $LWJGL_NATIVE/libfreetype.so bin/out/
fi

# Cleanup unused output jar files
find bin/RELEASE \( -name '*-natives-*' -o -name '*-sources.jar' \) -delete
6 changes: 6 additions & 0 deletions ci_build_ios.bash
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,12 @@ yes | ant -Dplatform.macos=true \
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/
vtool -arch arm64 -set-build-version 2 14.0 16.0 -replace -output bin/out/libfreetype.dylib $LWJGL_NATIVE/freetype/libfreetype.dylib
install_name_tool \
-change /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation /System/Library/Frameworks/CoreFoundation.framework/CoreFoundation \
-change /System/Library/Frameworks/CoreGraphics.framework/Versions/A/CoreGraphics /System/Library/Frameworks/CoreGraphics.framework/CoreGraphics \
-change /System/Library/Frameworks/CoreText.framework/Versions/A/CoreText /System/Library/Frameworks/CoreText.framework/CoreText \
bin/out/libfreetype.dylib

# Cleanup unused output jar files
find bin/RELEASE \( -name '*-natives-*' -o -name '*-sources.jar' \) -delete

0 comments on commit df5a4f8

Please sign in to comment.