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

android_test
Last change on this file since 902a27d was 818031e, checked in by Dirk Hohndel <dirk@…>, 18 months ago

updated build scripts for Mac

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

  • Property mode set to 100755
File size: 3.7 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                        install_name_tool -change ${LIBSSH} @executable_path/../Frameworks/${LIBSSH} Subsurface.app/Contents/Frameworks/${SONAME}
36                fi
37        fi
38done
39RPATH=$(otool -L ${EXECUTABLE} | grep rpath  | cut -d\  -f1 | tr -d "\t" | cut -b 8- )
40for i in ${RPATH}; do
41        install_name_tool -change @rpath/$i @executable_path/../Frameworks/$i ${EXECUTABLE}
42done
43MARBLELIB=$(ls Subsurface.app/Contents/Frameworks/libssrfmarblewidget*dylib)
44RPATH=$(otool -L ${MARBLELIB} | grep rpath  | cut -d\  -f1 | tr -d "\t" | cut -b 8- )
45for i in ${RPATH}; do
46        install_name_tool -change @rpath/$i @executable_path/../Frameworks/$i ${MARBLELIB}
47done
48
49# next deal with libGrantlee
50LIBG=$(ls Subsurface.app/Contents/Frameworks/libGrantlee_Templates*dylib)
51for i in QtScript.framework/Versions/5/QtScript QtCore.framework/Versions/5/QtCore ; do
52        install_name_tool -change @rpath/$i @executable_path/../Frameworks/$i ${LIBG}
53done
54
55# it seems the compiler in XCode 4.6 doesn't build Grantlee5 correctly,
56# so cheat and copy over pre-compiled binaries created with a newer compiler
57# and adjust their references to the Grantlee template library
58#
59# -disabled for now as this is still under more investigation-
60# cp -a /Users/hohndel/src/tmp/Subsurface.app/Contents Subsurface.app/
61cp ${DIR}/tmp/Subsurface.app/Contents/Frameworks/lib{sql,usb,zip}* Subsurface.app/Contents/Frameworks
62
63# clean up shared library dependency in the Grantlee plugins
64for i in Subsurface.app/Contents/PlugIns/grantlee/5.0/*.so; do
65        OLD=$(otool -L $i | grep libGrantlee_Templates | cut -d\  -f1 | tr -d "\t")
66        SONAME=$(basename $OLD )
67        install_name_tool -change ${OLD} @executable_path/../Frameworks/${SONAME} $i;
68        mv $i Subsurface.app/Contents/PlugIns/grantlee
69done
70rmdir Subsurface.app/Contents/PlugIns/grantlee/5.0
71
72# copy things into staging so we can create a nice DMG
73rm -rf ./staging
74mkdir ./staging
75cp -a ./Subsurface.app ./staging
76
77sh ${DIR}/subsurface/packaging/macosx/sign
78
79if [ -f ./Subsurface-$VERSION.dmg ]; then
80        rm ./Subsurface-$VERSION.dmg.bak
81        mv ./Subsurface-$VERSION.dmg ./Subsurface-$VERSION.dmg.bak
82fi
83
84$DMGCREATE --background ${DIR}/subsurface/packaging/macosx/DMG-Background.png \
85        --window-size 500 300 --icon-size 96 --volname Subsurface-$VERSION \
86        --app-drop-link 380 205 \
87        --volicon ${DIR}/subsurface/packaging/macosx/Subsurface.icns \
88        --icon "Subsurface" 110 205 ./Subsurface-$VERSION.dmg ./staging
Note: See TracBrowser for help on using the repository browser.