Skip to content

Commit

Permalink
MacOS: make png and freetype optional ...
Browse files Browse the repository at this point in the history
... and disable them since SDL_TTF bundles the dependencies now.
  • Loading branch information
black-sliver committed Aug 10, 2022
1 parent 8e702b9 commit f640813
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 30 deletions.
57 changes: 32 additions & 25 deletions macosx/build_thirdparty.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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=]"
}
Expand Down Expand Up @@ -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

Expand Down
10 changes: 5 additions & 5 deletions macosx/bundle_macosx_app.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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

Expand All @@ -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

Expand All @@ -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

Expand Down

0 comments on commit f640813

Please sign in to comment.