From f6408136eaf30accadfbb9f6df76d0c4764d38d8 Mon Sep 17 00:00:00 2001 From: black-sliver <59490463+black-sliver@users.noreply.github.com> Date: Thu, 11 Aug 2022 00:25:21 +0200 Subject: [PATCH] MacOS: make png and freetype optional ... ... and disable them since SDL_TTF bundles the dependencies now. --- macosx/build_thirdparty.sh | 57 +++++++++++++++++++++---------------- macosx/bundle_macosx_app.sh | 10 +++---- 2 files changed, 37 insertions(+), 30 deletions(-) diff --git a/macosx/build_thirdparty.sh b/macosx/build_thirdparty.sh index 3e2fb83c..b438e0fc 100755 --- a/macosx/build_thirdparty.sh +++ b/macosx/build_thirdparty.sh @@ -9,6 +9,9 @@ CLEAR_LIB_DIR=no LIB_DIR="libs" DEPLOYMENT_TARGET="10.12" +#WITH_FREETYPE=true # latest SDL_TTF bundles freetype +#WITH_PNG=true # only required as dependency of freetype + function usage() { echo "Usage: `basename $0` [--build-dir=] [--clear-build-dir] [--lib-dir=] [--clear-lib-dir] [--deployment-target=]" } @@ -93,44 +96,48 @@ fi mkdir -p $BUILD_DIR mkdir -p $LIB_DIR -# Build Png +if [ "$WITH_PNG" ]; then + # Build Png -if [ ! -d $LIB_PNG_DEST_DIR ]; then - git clone $LIB_PNG_URL $LIB_PNG_DEST_DIR || (echo "Could not clone $LIB_PNG_URL" ; exit 1) -fi + if [ ! -d $LIB_PNG_DEST_DIR ]; then + git clone $LIB_PNG_URL $LIB_PNG_DEST_DIR || (echo "Could not clone $LIB_PNG_URL" ; exit 1) + fi -cd $LIB_PNG_DEST_DIR + cd $LIB_PNG_DEST_DIR -git pull -git checkout $LIB_PNG_TAG + git pull + git checkout $LIB_PNG_TAG -./configure $CONFIGURE_FLAGS -make -j3 + ./configure $CONFIGURE_FLAGS + make -j3 -[ -f "$LIB_PNG_TARGET" ] || (echo "Missing $LIB_PNG_TARGET..." ; exit 1) + [ -f "$LIB_PNG_TARGET" ] || (echo "Missing $LIB_PNG_TARGET..." ; exit 1) -cp "$LIB_PNG_TARGET" "../../$LIB_DIR" -cd "../.." + cp "$LIB_PNG_TARGET" "../../$LIB_DIR" + cd "../.." +fi -# Build Freetype +if [ "$WITH_FREETYPE" ]; then + # Build Freetype -if [ ! -d $LIB_FREETYPE_DEST_DIR ]; then - git clone $LIB_FREETYPE_URL $LIB_FREETYPE_DEST_DIR || (echo "Could not clone $LIB_FREETYPE_URL" ; exit 1) -fi + if [ ! -d $LIB_FREETYPE_DEST_DIR ]; then + git clone $LIB_FREETYPE_URL $LIB_FREETYPE_DEST_DIR || (echo "Could not clone $LIB_FREETYPE_URL" ; exit 1) + fi -cd $LIB_FREETYPE_DEST_DIR + cd $LIB_FREETYPE_DEST_DIR -git pull -git checkout $LIB_FREETYPE_TAG + git pull + git checkout $LIB_FREETYPE_TAG -./autogen.sh -./configure $CONFIGURE_FLAGS --with-harfbuzz=no --with-brotli=no --with-png=yes -make -j3 + ./autogen.sh + ./configure $CONFIGURE_FLAGS --with-harfbuzz=no --with-brotli=no --with-png=yes + make -j3 -[ -f $LIB_FREETYPE_TARGET ] || (echo "Missing $LIB_FREETYPE_TARGET..." ; exit 1) + [ -f $LIB_FREETYPE_TARGET ] || (echo "Missing $LIB_FREETYPE_TARGET..." ; exit 1) -cp "$LIB_FREETYPE_TARGET" "../../$LIB_DIR" -cd "../.." + cp "$LIB_FREETYPE_TARGET" "../../$LIB_DIR" + cd "../.." +fi # Build SDL diff --git a/macosx/bundle_macosx_app.sh b/macosx/bundle_macosx_app.sh index 5d191f8c..79e135fd 100755 --- a/macosx/bundle_macosx_app.sh +++ b/macosx/bundle_macosx_app.sh @@ -128,7 +128,7 @@ if test $BUILD_THIRD_PARTY = yes ; then sh $SRC_DIR/build_thirdparty.sh \ --deployment-target=$DEPLOYMENT_TARGET \ --build-dir=$BUILD_DIR \ - --lib-dir=$LIB_DIR + --lib-dir=$LIB_DIR || exit 1 fi LIB_SDL2="libSDL2-2.0.0.dylib" @@ -142,8 +142,8 @@ LIB_CRYPTO="libcrypto.1.1.dylib" cp "$SRC_DIR/$LIB_DIR/$LIB_SDL2" $APP_BUNDLE_FRAMEWORKS_DIR cp "$SRC_DIR/$LIB_DIR/$LIB_SDL2_IMAGE" $APP_BUNDLE_FRAMEWORKS_DIR cp "$SRC_DIR/$LIB_DIR/$LIB_SDL2_TTF" $APP_BUNDLE_FRAMEWORKS_DIR -cp "$SRC_DIR/$LIB_DIR/$LIB_FREETYPE" $APP_BUNDLE_FRAMEWORKS_DIR -cp "$SRC_DIR/$LIB_DIR/$LIB_PNG" $APP_BUNDLE_FRAMEWORKS_DIR +[ -f "$SRC_DIR/$LIB_DIR/$LIB_FREETYPE" ] && cp "$SRC_DIR/$LIB_DIR/$LIB_FREETYPE" $APP_BUNDLE_FRAMEWORKS_DIR +[ -f "$SRC_DIR/$LIB_DIR/$LIB_PNG" ] && cp "$SRC_DIR/$LIB_DIR/$LIB_PNG" $APP_BUNDLE_FRAMEWORKS_DIR cp "$SRC_DIR/$LIB_DIR/$LIB_OPENSSL" $APP_BUNDLE_FRAMEWORKS_DIR cp "$SRC_DIR/$LIB_DIR/$LIB_CRYPTO" $APP_BUNDLE_FRAMEWORKS_DIR @@ -166,7 +166,7 @@ OLD_LIB_SDL2=`otool -LX $APP_BUNDLE_FRAMEWORKS_DIR/$LIB_SDL2_TTF | grep $LIB_SD OLD_LIB_FREETYPE=`otool -LX $APP_BUNDLE_FRAMEWORKS_DIR/$LIB_SDL2_TTF | grep $LIB_FREETYPE | awk '{print $1}'` install_name_tool -change $OLD_LIB_SDL2 @executable_path/../Frameworks/$LIB_SDL2 $APP_BUNDLE_FRAMEWORKS_DIR/$LIB_SDL2_TTF -install_name_tool -change $OLD_LIB_FREETYPE @executable_path/../Frameworks/$LIB_FREETYPE $APP_BUNDLE_FRAMEWORKS_DIR/$LIB_SDL2_TTF +[ -f "$OLD_LIB_FREETYPE" ] && install_name_tool -change $OLD_LIB_FREETYPE @executable_path/../Frameworks/$LIB_FREETYPE $APP_BUNDLE_FRAMEWORKS_DIR/$LIB_SDL2_TTF # Change paths on libpng @@ -177,7 +177,7 @@ install_name_tool -id @executable_path/../Frameworks/$LIB_PNG $APP_BUNDLE_FRAMEW install_name_tool -id @executable_path/../Frameworks/$LIB_FREETYPE $APP_BUNDLE_FRAMEWORKS_DIR/$LIB_FREETYPE OLD_LIB_PNG=`otool -LX $APP_BUNDLE_FRAMEWORKS_DIR/$LIB_FREETYPE | grep $LIB_PNG | awk '{print $1}'` -install_name_tool -change $OLD_LIB_PNG @executable_path/../Frameworks/$LIB_PNG $APP_BUNDLE_FRAMEWORKS_DIR/$LIB_FREETYPE +[ -f "$OLD_LIB_PNG" ] && install_name_tool -change $OLD_LIB_PNG @executable_path/../Frameworks/$LIB_PNG $APP_BUNDLE_FRAMEWORKS_DIR/$LIB_FREETYPE # Change paths on libOpenSSL