subsurface/packaging/macosx/make-package.sh
Cristian Ionescu-Idbohrn 727ee3aa98 Unified handling of version extraction.
Removed oddly named and ridiculously outdated documentation text (scripts).

Created new directory 'scripts'.

Added unified version extraction script (scripts/get-version). Yes, it's
more shell script code but faster and more maintainable than the sed commands
and the swearwords/regexps repeated over and over again.

Makefile and packaging/macosx/make-package.sh modified accordingly.

I don't do windos neither macos but, AFAICS my tests show, it should be safe.

Signed-off-by: Cristian Ionescu-Idbohrn <cristian.ionescu-idbohrn@axis.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-02-16 15:41:58 -08:00

69 lines
2.2 KiB
Bash
Executable file

#!/bin/sh
#
# 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
# adjust to your install location of gtk-mac-bundler. I appear to need at
# least 0.7.2
BUNDLER="../.local/bin/gtk-mac-bundler"
BUNDLER_SRC="${HOME}/gtk-mac-bundler"
# install location of yourway-create-dmg
DMGCREATE="../yoursway-create-dmg/create-dmg"
# This is the directory into which MacPorts, libdivecomputer and all the
# other components have been installed
PREFIX="/Applications/Subsurface.app/Contents/Resources"
INFOPLIST=./packaging/macosx/Info.plist
# same git version magic as in the Makefile
VERSION=$(./scripts/get-version darwin)
# gtk-mac-bundler allegedly supports signing by setting this environment
# variable, but this fails as we change the shared objects below and all
# the signatures become invalid.
# export APPLICATION_CERT="Dirk"
# force rebuilding of Info.plist
rm ${INFOPLIST}
# first build and install Subsurface and then clean up the staging area
make
make install-macosx
rm -rf ./staging
# now populate it with the bundle
${BUNDLER} packaging/macosx/subsurface.bundle
# correct the paths and names
cd staging/Subsurface.app/Contents
for i in Resources/lib/gdk-pixbuf-2.0/2.10.0/loaders/* ; do
${BUNDLER_SRC}/bundler/run-install-name-tool-change.sh $i ${PREFIX} Resources change ;
done
for i in Resources/lib/*.dylib;
do
install_name_tool -id "@executable_path/../$i" $i
done
cd ../../..
codesign -s Dirk ./staging/Subsurface.app/Contents/MacOS/subsurface \
./staging/Subsurface.app/Contents/MacOS/subsurface-bin
if [ -f ./Subsurface-${VERSION}.dmg ]; then
rm ./Subsurface-${VERSION}.dmg.bak
mv ./Subsurface-${VERSION}.dmg ./Subsurface-${VERSION}.dmg.bak
fi
${DMGCREATE} --background ./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 \
--icon "Subsurface" 110 205 ./Subsurface-${VERSION}.dmg ./staging