Fix text not displaying on systems without Fontconfig installed.

This commit is contained in:
Mark K. Kim 2017-12-20 23:19:19 -05:00
parent 558b74b7fc
commit 912cd2e625
3 changed files with 34 additions and 16 deletions

View file

@ -1018,13 +1018,13 @@ install-man:
install-bundlefiles: install-bundlefiles:
@echo @echo
@echo "...Installing App Bundle Support Files..." @echo "...Installing App Bundle Support Files..."
@mkdir -p $(BUNDLE)/Contents/MacOS @install -d -m 755 $(BUNDLE)/Contents/MacOS
@mkdir -p $(BUNDLE)/Contents/Resources @install -d -m 755 $(BUNDLE)/Contents/Resources
@mkdir -p $(BUNDLE)/Contents/lib @install -d -m 755 $(BUNDLE)/Contents/lib
@cp -p tuxpaint $(BUNDLE)/Contents/MacOS @install -m 755 tuxpaint $(BUNDLE)/Contents/MacOS
@cp -p macos/PkgInfo $(BUNDLE)/Contents @install -m 644 macos/PkgInfo $(BUNDLE)/Contents
@cp -p macos/Info.plist $(BUNDLE)/Contents @install -m 644 macos/Info.plist $(BUNDLE)/Contents
@cp -p macos/tuxpaint.icns $(BUNDLE)/Contents/Resources @install -m 644 macos/tuxpaint.icns $(BUNDLE)/Contents/Resources
@custom/macos.sh @custom/macos.sh

View file

@ -3,7 +3,9 @@
BUNDLE=TuxPaint.app BUNDLE=TuxPaint.app
BINARY="$BUNDLE/Contents/MacOS/tuxpaint" BINARY="$BUNDLE/Contents/MacOS/tuxpaint"
LIBS=`find $BUNDLE/Contents/Resources/lib -type f` LIBS=`find $BUNDLE/Contents/Resources/lib -type f`
TARGET="$BUNDLE/Contents/lib" LIBDIR="$BUNDLE/Contents/lib"
CONF_FILES="/opt/local/etc/fonts/fonts.conf"
CONFDIR="$BUNDLE/Contents/Resources/etc"
# Sanity check # Sanity check
@ -17,8 +19,9 @@ if [ ! -d "$BUNDLE" ]; then
exit 1 exit 1
fi fi
# Ensure the shared library folder exists # Ensure the target folders exist
mkdir -p "$TARGET" install -d -m 755 "$LIBDIR"
install -d -m 755 "$CONFDIR"
# Copy there any shared libraries referenced by the tuxpaint binary, and any # Copy there any shared libraries referenced by the tuxpaint binary, and any
# shared libraries those shared libraries reference, and so on. We do this by # shared libraries those shared libraries reference, and so on. We do this by
@ -31,19 +34,19 @@ dylib="$BINARY $LIBS"
count=0; last=-1 count=0; last=-1
echo " * Copying Shared Libraries..." echo " * Copying Shared Libraries..."
while [ $count -ne $last ]; do while [ $count -ne $last ]; do
cp -p `otool -L $dylib | grep '^\t[/]opt[/]local[/]' | sed -e 's/^[[:space:]]*\([^[:space:]]*\)[[:space:]].*/\1/' | sort | uniq` $TARGET cp -p `otool -L $dylib | grep '^\t[/]opt[/]local[/]' | sed -e 's/^[[:space:]]*\([^[:space:]]*\)[[:space:]].*/\1/' | sort | uniq` $LIBDIR
dylib="$TARGET/*" dylib="$LIBDIR/*"
last=$count last=$count
count=`ls -f $dylib | wc -l` count=`ls -f $dylib | wc -l`
done done
echo " -> Copied" $count "files to $TARGET" echo " -> Copied" $count "files to $LIBDIR"
# We just copied over a bunch of shared libraries into a random folder in our # We just copied over a bunch of shared libraries into a random folder in our
# bundle, but the tuxpaint binary and the shared libraries won't know to look # app bundle, but the tuxpaint binary and the shared libraries won't know to
# in that folder unless we tell them. So we tell them. # look in that folder unless we tell them. So we tell them.
echo " * Fixing Shared Library References..." echo " * Fixing Shared Library References..."
for i in "$BINARY" $LIBS $TARGET/*; do for i in "$BINARY" $LIBS $LIBDIR/*; do
echo " -> $i..." echo " -> $i..."
for j in `otool -L $dylib | grep '^\t[/]opt[/]local[/]' | sed -e 's/^[[:space:]]*\([^[:space:]]*\)[[:space:]].*/\1/'`; do for j in `otool -L $dylib | grep '^\t[/]opt[/]local[/]' | sed -e 's/^[[:space:]]*\([^[:space:]]*\)[[:space:]].*/\1/'`; do
n=`echo "$j" | sed 's/^[/]opt[/]local[/]/@executable_path\/..\//'` n=`echo "$j" | sed 's/^[/]opt[/]local[/]/@executable_path\/..\//'`
@ -51,3 +54,10 @@ for i in "$BINARY" $LIBS $TARGET/*; do
done done
done done
# Some libraries require config files, so copy those...
echo " * Copying Shared Library Configuration Files..."
for i in "$CONF_FILES"; do
echo " -> $i..."
cp -p "$i" "$CONFDIR"
done

View file

@ -23635,6 +23635,14 @@ int main(int argc, char *argv[])
CLOCK_ASM(time2); CLOCK_ASM(time2);
#endif #endif
#if defined(__APPLE__)
/* Pango uses Fontconfig which requires /opt/local/etc/fonts/fonts.conf. This
* file may not exist on the runtime system, however, so we copy the file
* into our app bundle at compile time, and tell Fontconfig here to look for
* the file within the app bundle. */
putenv((char*) "FONTCONFIG_PATH=Resources/etc");
#endif
#ifdef FORKED_FONTS #ifdef FORKED_FONTS
/* must start ASAP, but depends on locale which in turn needs the config */ /* must start ASAP, but depends on locale which in turn needs the config */
#ifdef NO_SDLPANGO #ifdef NO_SDLPANGO