diff --git a/Makefile b/Makefile index 6cd23aa11..463dfbcae 100644 --- a/Makefile +++ b/Makefile @@ -92,8 +92,7 @@ linux_ARCH_LIBS:=obj/postscript_print.o ARCH_LIBS:=$($(OS)_ARCH_LIBS) windows_ARCH_CFLAGS:= -# osx_ARCH_CFLAGS:=-isystem /opt/local/include -Wno-unused-variable -Wno-unused-function -Wno-unused-parameter -Wno-unused-result -Wno-deprecated-declarations -Wno-missing-braces -Wno-parentheses-equality -Wno-cast-align -Wno-incompatible-pointer-types-discards-qualifiers -Wno-missing-prototypes -Wno-incompatible-function-pointer-types -Wno-format -Wno-bitwise-op-parentheses -Wno-strict-prototypes -Wno-sign-compare -Wno-\#warnings -Wno-ignored-optimization-argument -Wno-implicit-function-declaration -Wno-tautological-pointer-compare -Wno-self-assign -Wno-absolute-value -osx_ARCH_CFLAGS:=-DHAVE_STRCASESTR -isystem /opt/local/include -Wno-unused-variable -Wno-unused-function -Wno-unused-parameter -Wno-unused-result -Wno-sign-compare -Wno-ignored-optimization-argument -Wno-deprecated-declarations -Wno-absolute-value -Wno-missing-prototypes -Wno-cast-align -Wno-incompatible-pointer-types-discards-qualifiers -Wno-incompatible-function-pointer-types -Wno-bitwise-op-parentheses -Wno-format -Wno-implicit-function-declaration -Wno-self-assign -Wno-parentheses-equality -Wno-strict-prototypes +osx_ARCH_CFLAGS:=-mmacosx-version-min=10.6 -isystem /opt/local/include -DHAVE_STRCASESTR -w beos_ARCH_CFLAGS:= linux_ARCH_CFLAGS:= ARCH_CFLAGS:=$($(OS)_ARCH_CFLAGS) @@ -592,6 +591,7 @@ clean: @-rm -f templates/.thumbs/*.png @if [ -d templates/.thumbs ]; then rmdir templates/.thumbs; fi @-if [ "x$(BUNDLE)" != "x" ]; then rm -rf $(BUNDLE); fi + @-rm -f TuxPaint.dmg @echo # "make uninstall" should remove the various parts from their @@ -1018,13 +1018,13 @@ install-man: install-bundlefiles: @echo @echo "...Installing App Bundle Support Files..." - @mkdir -p $(BUNDLE)/Contents/MacOS - @mkdir -p $(BUNDLE)/Contents/Resources - @mkdir -p $(BUNDLE)/Contents/lib - @cp -p tuxpaint $(BUNDLE)/Contents/MacOS - @cp -p macos/PkgInfo $(BUNDLE)/Contents - @cp -p macos/Info.plist $(BUNDLE)/Contents - @cp -p macos/tuxpaint.icns $(BUNDLE)/Contents/Resources + @install -d -m 755 $(BUNDLE)/Contents/MacOS + @install -d -m 755 $(BUNDLE)/Contents/Resources + @install -d -m 755 $(BUNDLE)/Contents/lib + @install -m 755 tuxpaint $(BUNDLE)/Contents/MacOS + @install -m 644 macos/PkgInfo $(BUNDLE)/Contents + @install -m 644 macos/Info.plist $(BUNDLE)/Contents + @install -m 644 macos/tuxpaint.icns $(BUNDLE)/Contents/Resources @custom/macos.sh @hdiutil create -volname "Tux Paint $(VER_VERSION)" -srcfolder $(BUNDLE) -ov -format UDBZ -o TuxPaint.dmg diff --git a/custom/macos.sh b/custom/macos.sh index b91720faa..f0e31e915 100755 --- a/custom/macos.sh +++ b/custom/macos.sh @@ -3,7 +3,9 @@ BUNDLE=TuxPaint.app BINARY="$BUNDLE/Contents/MacOS/tuxpaint" 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 @@ -17,8 +19,9 @@ if [ ! -d "$BUNDLE" ]; then exit 1 fi -# Ensure the shared library folder exists -mkdir -p "$TARGET" +# Ensure the target folders exist +install -d -m 755 "$LIBDIR" +install -d -m 755 "$CONFDIR" # 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 @@ -31,19 +34,19 @@ dylib="$BINARY $LIBS" count=0; last=-1 echo " * Copying Shared Libraries..." while [ $count -ne $last ]; do - cp -p `otool -L $dylib | grep '^\t[/]opt[/]local[/]' | sed -e 's/^[[:space:]]*\([^[:space:]]*\)[[:space:]].*/\1/' | sort | uniq` $TARGET - dylib="$TARGET/*" + cp -p `otool -L $dylib | grep '^\t[/]opt[/]local[/]' | sed -e 's/^[[:space:]]*\([^[:space:]]*\)[[:space:]].*/\1/' | sort | uniq` $LIBDIR + dylib="$LIBDIR/*" last=$count count=`ls -f $dylib | wc -l` 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 -# bundle, but the tuxpaint binary and the shared libraries won't know to look -# in that folder unless we tell them. So we tell them. +# app bundle, but the tuxpaint binary and the shared libraries won't know to +# look in that folder unless we tell them. So we tell them. echo " * Fixing Shared Library References..." -for i in "$BINARY" $LIBS $TARGET/*; do +for i in "$BINARY" $LIBS $LIBDIR/*; do echo " -> $i..." 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\/..\//'` @@ -51,3 +54,10 @@ for i in "$BINARY" $LIBS $TARGET/*; do 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 + diff --git a/src/tuxpaint.c b/src/tuxpaint.c index e37a8a997..9de0c584e 100644 --- a/src/tuxpaint.c +++ b/src/tuxpaint.c @@ -23635,6 +23635,14 @@ int main(int argc, char *argv[]) CLOCK_ASM(time2); #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 /* must start ASAP, but depends on locale which in turn needs the config */ #ifdef NO_SDLPANGO