From d2ef2e17d1962111d0f6f91394dce81e8706d48b Mon Sep 17 00:00:00 2001 From: Mark Kim Date: Sun, 7 Oct 2018 17:48:41 -0400 Subject: [PATCH] macOS 10.7 compatibility It's been reported that the latest version of Tux Paint does not run on macOS 10.7 (Lion). This change fixes the issue. BACKGROUND A user has reported Tux Paint 0.9.23 does not run on macOS 10.7. She also identified that the issue is due to a system library required by Tux Paint, /System/Library/Frameworks/CoreGraphics.framework does not exist on macOS 10.7 Some investigation revealed that CoreGraphics.framework is a library required by libSDL, and it exists under an alternate path in macOS 10.7, underneath /System/Library/Frameworks/ApplicationServices.framework/Frameworks/. CoreGraphics.framework also exists underneath this path in newer version of macOS as a symlink to the real directory as well, so the issue can be fixed by simply relinking SDL to use the old (compatible) path instead of the new (default) path to CoreGraphics.framework. This change adds the code such that, during the `make install` step to create TuxPaint.app, any library referencing CoreGraphics.framework is re-linked to the compatible path rather than the path that only exists on the newer version of macOS. For more information, see: https://stackoverflow.com/questions/20206985/xcode-linking-against-applicationservices-framework-with-sdk-10-9-causes-10-7 --- Makefile | 2 +- custom/macos.sh | 15 +++++++++++++++ macos/Info.plist | 6 +++--- 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 70699ec30..c08be9e9e 100644 --- a/Makefile +++ b/Makefile @@ -9,7 +9,7 @@ # The version number, for release: -VER_VERSION:=0.9.23a +VER_VERSION:=0.9.23c ifdef SOURCE_DATE_EPOCH VER_DATE=$(shell date -u -d "@$(SOURCE_DATE_EPOCH)" "+%Y-%m-%d" 2>/dev/null || date -u -r "$(SOURCE_DATE_EPOCH)" "+%Y-%m-%d" 2>/dev/null || date -u "+%Y-%m-%d") else diff --git a/custom/macos.sh b/custom/macos.sh index f0e31e915..b0a9325aa 100755 --- a/custom/macos.sh +++ b/custom/macos.sh @@ -52,6 +52,21 @@ for i in "$BINARY" $LIBS $LIBDIR/*; do n=`echo "$j" | sed 's/^[/]opt[/]local[/]/@executable_path\/..\//'` install_name_tool -change "$j" "$n" "$i" done + + # libSDL links to /System/Library/Frameworks/CoreGraphics.framework by + # default on newer versions of macOS, but this library is located under + # /System/Library/Frameworks/ApplicationServices.framework/Frameworks + # instead in macOS 10.7, and is a symlink to its real location in later + # versions of macOS. For compatibility reasons, we tell libSDL to link to + # the former location instead. See here for more information: + # + # https://stackoverflow.com/questions/20206985/xcode-linking-against-applicationservices-framework-with-sdk-10-9-causes-10-7 + # + if [ `otool -L "$i" | grep -c '^\t\/System\/Library\/Frameworks\/CoreGraphics\.framework\/Versions\/A\/CoreGraphics'` -gt 0 ]; then + defaultlib="/System/Library/Frameworks/CoreGraphics.framework/Versions/A/CoreGraphics" + compatlib="/System/Library/Frameworks/ApplicationServices.framework/Frameworks/CoreGraphics.framework/Versions/A/CoreGraphics" + install_name_tool -change "$defaultlib" "$compatlib" "$i" + fi done # Some libraries require config files, so copy those... diff --git a/macos/Info.plist b/macos/Info.plist index 270977726..9deb9ab58 100644 --- a/macos/Info.plist +++ b/macos/Info.plist @@ -7,7 +7,7 @@ CFBundleExecutable tuxpaint CFBundleGetInfoString - 0.9.23b, Copyright 2009-2018, Tux Paint Development Team + 0.9.23c, Copyright 2009-2018, Tux Paint Development Team CFBundleIconFile tuxpaint.icns CFBundleIdentifier @@ -19,10 +19,10 @@ CFBundlePackageType APPL CFBundleShortVersionString - 0.9.23b + 0.9.23c CFBundleSignature TXPT CFBundleVersion - 2018-09-28 + 2018-10-07