source: subsurface/packaging/macosx/make-package.sh @ ca7f593

Last change on this file since ca7f593 was ca7f593, checked in by Miika Turkia <miika.turkia@…>, 12 months ago

Fix MacOS make-package script

We need the full path to the local libssh in order to replace it with the
correct path.

Signed-off-by: Dirk Hohndel <dirk@…>

  • Property mode set to 100755
File size: 3.8 KB
RevLine 
[2d8a203]1#!/bin/sh
[79d204d]2#
3# this simply automates the steps to create a DMG we can ship
[61066b9]4#
5# run this from the top subsurface directory
6
[cb1aac0]7# find the directory above the sources - typically ~/src
8DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && cd ../../.. && pwd )
9
[61066b9]10# install location of yourway-create-dmg
[cb1aac0]11# by default we assume it's next to subsurface in ~/src/yoursway-create-dmg
12DMGCREATE=${DIR}/yoursway-create-dmg/create-dmg
[61066b9]13
[4125653]14# same git version magic as in the Makefile
[cb1aac0]15# for the naming of volume and dmg we want the 3 digits of the full version number
16VERSION=$(cd ${DIR}/subsurface; ./scripts/get-version linux)
[4125653]17
18# first build and install Subsurface and then clean up the staging area
[3212bfd]19rm -rf ./Subsurface.app
[cb1aac0]20LIBRARY_PATH=${DIR}/install-root/lib make -j8
21LIBRARY_PATH=${DIR}/install-root/lib make install
22
23# now adjust a few references that macdeployqt appears to miss
24EXECUTABLE=Subsurface.app/Contents/MacOS/Subsurface
[818031e]25for i in libssh libssrfmarblewidget libgit2 libGrantlee_TextDocument.dylib libGrantlee_Templates.dylib; do
[cb1aac0]26        OLD=$(otool -L ${EXECUTABLE} | grep $i | cut -d\  -f1 | tr -d "\t")
[818031e]27        if [ ! -z ${OLD} ] ; then
28                cp ${DIR}/install-root/lib/$(basename ${OLD}) Subsurface.app/Contents/Frameworks
29                SONAME=$(basename $OLD)
30                install_name_tool -change ${OLD} @executable_path/../Frameworks/${SONAME} ${EXECUTABLE}
31                if [[ "$i" = "libssh" ]] ; then
32                        LIBSSH=$(basename ${OLD})
33                fi
34                if [[ "$i" = "libgit2" && ! -z ${LIBSSH} ]] ; then
[ca7f593]35                        CURLIBSSH=$(otool -L Subsurface.app/Contents/Frameworks/${SONAME} | grep libssh | cut -d\  -f1 | tr -d "\t")
36                        install_name_tool -change ${CURLIBSSH} @executable_path/../Frameworks/${LIBSSH} Subsurface.app/Contents/Frameworks/${SONAME}
[818031e]37                fi
[f66e3a44]38        fi
39done
[7d2a7da]40RPATH=$(otool -L ${EXECUTABLE} | grep rpath  | cut -d\  -f1 | tr -d "\t" | cut -b 8- )
41for i in ${RPATH}; do
42        install_name_tool -change @rpath/$i @executable_path/../Frameworks/$i ${EXECUTABLE}
43done
[818031e]44MARBLELIB=$(ls Subsurface.app/Contents/Frameworks/libssrfmarblewidget*dylib)
45RPATH=$(otool -L ${MARBLELIB} | grep rpath  | cut -d\  -f1 | tr -d "\t" | cut -b 8- )
46for i in ${RPATH}; do
47        install_name_tool -change @rpath/$i @executable_path/../Frameworks/$i ${MARBLELIB}
48done
[f66e3a44]49
50# next deal with libGrantlee
[818031e]51LIBG=$(ls Subsurface.app/Contents/Frameworks/libGrantlee_Templates*dylib)
[f66e3a44]52for i in QtScript.framework/Versions/5/QtScript QtCore.framework/Versions/5/QtCore ; do
53        install_name_tool -change @rpath/$i @executable_path/../Frameworks/$i ${LIBG}
[cb1aac0]54done
55
56# it seems the compiler in XCode 4.6 doesn't build Grantlee5 correctly,
57# so cheat and copy over pre-compiled binaries created with a newer compiler
58# and adjust their references to the Grantlee template library
59#
60# -disabled for now as this is still under more investigation-
61# cp -a /Users/hohndel/src/tmp/Subsurface.app/Contents Subsurface.app/
[f66e3a44]62cp ${DIR}/tmp/Subsurface.app/Contents/Frameworks/lib{sql,usb,zip}* Subsurface.app/Contents/Frameworks
[cb1aac0]63
64# clean up shared library dependency in the Grantlee plugins
65for i in Subsurface.app/Contents/PlugIns/grantlee/5.0/*.so; do
66        OLD=$(otool -L $i | grep libGrantlee_Templates | cut -d\  -f1 | tr -d "\t")
67        SONAME=$(basename $OLD )
68        install_name_tool -change ${OLD} @executable_path/../Frameworks/${SONAME} $i;
[f66e3a44]69        mv $i Subsurface.app/Contents/PlugIns/grantlee
[cb1aac0]70done
[f66e3a44]71rmdir Subsurface.app/Contents/PlugIns/grantlee/5.0
[61066b9]72
[d3065d8]73# copy things into staging so we can create a nice DMG
74rm -rf ./staging
75mkdir ./staging
76cp -a ./Subsurface.app ./staging
[61066b9]77
[cb1aac0]78sh ${DIR}/subsurface/packaging/macosx/sign
[61066b9]79
[44c7e02]80if [ -f ./Subsurface-$VERSION.dmg ]; then
81        rm ./Subsurface-$VERSION.dmg.bak
82        mv ./Subsurface-$VERSION.dmg ./Subsurface-$VERSION.dmg.bak
[79d204d]83fi
[61066b9]84
[cb1aac0]85$DMGCREATE --background ${DIR}/subsurface/packaging/macosx/DMG-Background.png \
[44c7e02]86        --window-size 500 300 --icon-size 96 --volname Subsurface-$VERSION \
[61066b9]87        --app-drop-link 380 205 \
[cb1aac0]88        --volicon ${DIR}/subsurface/packaging/macosx/Subsurface.icns \
[44c7e02]89        --icon "Subsurface" 110 205 ./Subsurface-$VERSION.dmg ./staging
Note: See TracBrowser for help on using the repository browser.