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

Last change on this file since ca7f593 was ca7f593, checked in by Miika Turkia <miika.turkia@…>, 11 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
Line 
1#!/bin/sh
2#
3# this simply automates the steps to create a DMG we can ship
4#
5# run this from the top subsurface directory
6
7# find the directory above the sources - typically ~/src
8DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && cd ../../.. && pwd )
9
10# install location of yourway-create-dmg
11# by default we assume it's next to subsurface in ~/src/yoursway-create-dmg
12DMGCREATE=${DIR}/yoursway-create-dmg/create-dmg
13
14# same git version magic as in the Makefile
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)
17
18# first build and install Subsurface and then clean up the staging area
19rm -rf ./Subsurface.app
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
25for i in libssh libssrfmarblewidget libgit2 libGrantlee_TextDocument.dylib libGrantlee_Templates.dylib; do
26        OLD=$(otool -L ${EXECUTABLE} | grep $i | cut -d\  -f1 | tr -d "\t")
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
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}
37                fi
38        fi
39done
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
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
49
50# next deal with libGrantlee
51LIBG=$(ls Subsurface.app/Contents/Frameworks/libGrantlee_Templates*dylib)
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}
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/
62cp ${DIR}/tmp/Subsurface.app/Contents/Frameworks/lib{sql,usb,zip}* Subsurface.app/Contents/Frameworks
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;
69        mv $i Subsurface.app/Contents/PlugIns/grantlee
70done
71rmdir Subsurface.app/Contents/PlugIns/grantlee/5.0
72
73# copy things into staging so we can create a nice DMG
74rm -rf ./staging
75mkdir ./staging
76cp -a ./Subsurface.app ./staging
77
78sh ${DIR}/subsurface/packaging/macosx/sign
79
80if [ -f ./Subsurface-$VERSION.dmg ]; then
81        rm ./Subsurface-$VERSION.dmg.bak
82        mv ./Subsurface-$VERSION.dmg ./Subsurface-$VERSION.dmg.bak
83fi
84
85$DMGCREATE --background ${DIR}/subsurface/packaging/macosx/DMG-Background.png \
86        --window-size 500 300 --icon-size 96 --volname Subsurface-$VERSION \
87        --app-drop-link 380 205 \
88        --volicon ${DIR}/subsurface/packaging/macosx/Subsurface.icns \
89        --icon "Subsurface" 110 205 ./Subsurface-$VERSION.dmg ./staging
Note: See TracBrowser for help on using the repository browser.