forked from mapeditor/tiled
-
Notifications
You must be signed in to change notification settings - Fork 1
/
make-dist-mac.sh
executable file
·58 lines (47 loc) · 2.53 KB
/
make-dist-mac.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/bin/bash
# This script generates a mac release from an already compiled Tiled.app in
# the bin folder. You should compile the release before running this:
# qmake -r -spec macx-g++ CONFIG+=release CONFIG+=x86 CONFIG+=x86_64
# make
# Get the version
if [ "$#" -eq "0" ]; then
echo "Usage: make-dist-mac.sh <version>"
exit 1
fi
name="tiled-qt-$1"
# Get various directories
baseDir=`dirname $01`
binDir="$baseDir/bin"
# Create a temporary staging directory
tempDir=`mktemp -d /tmp/${name}.XXXXXX` || exit 1
echo $tempDir
# Copy things to temp directory
cp "$baseDir/AUTHORS" "$tempDir/"
cp "$baseDir/COPYING" "$tempDir/"
cp "$baseDir/NEWS" "$tempDir/"
cp "$baseDir/README" "$tempDir/"
cp -R "$baseDir/examples" "$tempDir/"
cp -R "$binDir/Tiled.app" "$tempDir/"
# Create symlink to application directory
ln -s /Applications "$tempDir/Applications"
# Get various in-bundle directories
pluginsDir="$tempDir/Tiled.app/Contents/PlugIns"
macOSDir="$tempDir/Tiled.app/Contents/MacOS"
frameworksDir="$tempDir/Tiled.app/Contents/Frameworks"
# Use macdeployqt to copy Qt frameworks to the app
macdeployqt "$tempDir/Tiled.app"
qtCoreDir="$frameworksDir/QtCore.framework"
qtGuiDir="$frameworksDir/QtGui.framework"
# Modify plugins to use Qt frameworks contained within the app bundle (perhaps theres some way to get macdeployqt to do this?)
install_name_tool -change "QtCore.framework/Versions/4/QtCore" "@executable_path/../Frameworks/QtCore.framework/Versions/4/QtCore" "$frameworksDir/libtiled.dylib"
install_name_tool -change "QtCore.framework/Versions/4/QtCore" "@executable_path/../Frameworks/QtCore.framework/Versions/4/QtCore" "$pluginsDir/libtmw.dylib"
install_name_tool -change "QtCore.framework/Versions/4/QtCore" "@executable_path/../Frameworks/QtCore.framework/Versions/4/QtCore" "$pluginsDir/libtengine.dylib"
install_name_tool -change "QtGui.framework/Versions/4/QtGui" "@executable_path/../Frameworks/QtGui.framework/Versions/4/QtGui" "$frameworksDir/libtiled.dylib"
install_name_tool -change "QtGui.framework/Versions/4/QtGui" "@executable_path/../Frameworks/QtGui.framework/Versions/4/QtGui" "$pluginsDir/libtmw.dylib"
install_name_tool -change "QtGui.framework/Versions/4/QtGui" "@executable_path/../Frameworks/QtGui.framework/Versions/4/QtGui" "$pluginsDir/libtengine.dylib"
# Copy tmx icon to the application
cp "$baseDir/src/tiled/images/tmx-icon-mac.icns" "$tempDir/Tiled.app/Contents/Resources/"
# Create dmg from the temp directory
hdiutil create "$baseDir/$name.dmg" -srcfolder "$tempDir" -volname "Tiled $1"
# Delete the temp directory
rm -rf "$tempDir"