Update the script to build Mac Bundle

This is trying to clean things up quite a bit and make it less specific to
my directory layout.

It still calls the signing script that tries to sign things with my keys,
so it won't work for others without tuning, but this should get you
closer.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2015-09-04 12:13:52 -07:00
parent a0e33bec71
commit cb1aac0c4d

View file

@ -2,44 +2,60 @@
#
# this simply automates the steps to create a DMG we can ship
#
# for this to work you need to have a custom build of MacPorts / gtk / etc
# with prefix=/Applications/Subsurface.app/Contents/Resources
# yes, that's a major hack, but otherwise gettext cannot seem to find
# the gtk related .mo files and localization is only partial
#
# run this from the top subsurface directory
# find the directory above the sources - typically ~/src
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && cd ../../.. && pwd )
# install location of yourway-create-dmg
DMGCREATE=../yoursway-create-dmg/create-dmg
# by default we assume it's next to subsurface in ~/src/yoursway-create-dmg
DMGCREATE=${DIR}/yoursway-create-dmg/create-dmg
# same git version magic as in the Makefile
# for the naming of volume and dmg we don't need the "always 3 digits"
# darwin version - the 'regular' version that has 2 digits for releases
# is better
VERSION=$(cd ../subsurface; ./scripts/get-version linux)
# for the naming of volume and dmg we want the 3 digits of the full version number
VERSION=$(cd ${DIR}/subsurface; ./scripts/get-version linux)
# first build and install Subsurface and then clean up the staging area
rm -rf ./Subsurface.app
make -j8
make install
install_name_tool -change /Users/hohndel/src/marble/install/libssrfmarblewidget.0.19.2.dylib @executable_path/../Frameworks/libssrfmarblewidget.0.19.2.dylib Subsurface.app/Contents/MacOS/Subsurface
install_name_tool -change /Users/hohndel/src/libgit2/build/libgit2.22.dylib @executable_path/../Frameworks/libgit2.22.dylib Subsurface.app/Contents/MacOS/Subsurface
LIBRARY_PATH=${DIR}/install-root/lib make -j8
LIBRARY_PATH=${DIR}/install-root/lib make install
# now adjust a few references that macdeployqt appears to miss
EXECUTABLE=Subsurface.app/Contents/MacOS/Subsurface
for i in libssrfmarblewidget libgit2; do
OLD=$(otool -L ${EXECUTABLE} | grep $i | cut -d\ -f1 | tr -d "\t")
SONAME=$(basename $OLD)
install_name_tool -change ${OLD} @executable_path/../Frameworks/${SONAME} ${EXECUTABLE}
done
# it seems the compiler in XCode 4.6 doesn't build Grantlee5 correctly,
# so cheat and copy over pre-compiled binaries created with a newer compiler
# and adjust their references to the Grantlee template library
#
# -disabled for now as this is still under more investigation-
# cp -a /Users/hohndel/src/tmp/Subsurface.app/Contents Subsurface.app/
# clean up shared library dependency in the Grantlee plugins
for i in Subsurface.app/Contents/PlugIns/grantlee/5.0/*.so; do
OLD=$(otool -L $i | grep libGrantlee_Templates | cut -d\ -f1 | tr -d "\t")
SONAME=$(basename $OLD )
install_name_tool -change ${OLD} @executable_path/../Frameworks/${SONAME} $i;
done
# copy things into staging so we can create a nice DMG
rm -rf ./staging
mkdir ./staging
cp -a ./Subsurface.app ./staging
sh ../subsurface/packaging/macosx/sign
sh ${DIR}/subsurface/packaging/macosx/sign
if [ -f ./Subsurface-$VERSION.dmg ]; then
rm ./Subsurface-$VERSION.dmg.bak
mv ./Subsurface-$VERSION.dmg ./Subsurface-$VERSION.dmg.bak
fi
$DMGCREATE --background ../subsurface/packaging/macosx/DMG-Background.png \
$DMGCREATE --background ${DIR}/subsurface/packaging/macosx/DMG-Background.png \
--window-size 500 300 --icon-size 96 --volname Subsurface-$VERSION \
--app-drop-link 380 205 \
--volicon ../subsurface/packaging/macosx/Subsurface.icns \
--volicon ${DIR}/subsurface/packaging/macosx/Subsurface.icns \
--icon "Subsurface" 110 205 ./Subsurface-$VERSION.dmg ./staging