From df5a4f8005fca051c37d6aa5cb13d22f0b30c372 Mon Sep 17 00:00:00 2001 From: Maksim Belov <45949002+artdeell@users.noreply.github.com> Date: Sun, 14 Jul 2024 15:04:54 +0300 Subject: [PATCH] Add freetype build for LWJGL bindings (#5) * 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 <40482367+khanhduytran0@users.noreply.github.com> Co-authored-by: Mathias-Boulay --- ci_build_android.bash | 35 +++++++++++++++++++++++++++++++++++ ci_build_ios.bash | 6 ++++++ 2 files changed, 41 insertions(+) diff --git a/ci_build_android.bash b/ci_build_android.bash index 0eac9de5d2..8e155b9bba 100644 --- a/ci_build_android.bash +++ b/ci_build_android.bash @@ -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 @@ -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 diff --git a/ci_build_ios.bash b/ci_build_ios.bash index ca465439b2..5cd7363eeb 100644 --- a/ci_build_ios.bash +++ b/ci_build_ios.bash @@ -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