diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2015-04-15 11:33:14 -0700 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2015-04-15 11:37:30 -0700 |
commit | 1f0bf92a3474009b44e750b96646b3bb0d865c2e (patch) | |
tree | d7d403da6930c9645f0499f12a04adea55cd63e5 | |
parent | 193edd9f13b4a1a6cbddd494de6b7aa38709be95 (diff) | |
download | subsurface-1f0bf92a3474009b44e750b96646b3bb0d865c2e.tar.gz |
build.sh: successfully build an App bundle on the Mac
Some install name magic on two of the libraries we build was necessary for
things to work out correctly.
And I added an install step to the default build that puts Subsurface in the
install_root on other OSs and creates the Subsurface.app under
subsurface/build/Subsurface.app on the Mac.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rwxr-xr-x | scripts/build.sh | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/scripts/build.sh b/scripts/build.sh index 6095202fd..2ab97255a 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -12,8 +12,14 @@ # numerous cases where building with random versions (especially older, # but sometimes also newer versions than recommended here) will lead # to all kinds of unnecessary pain +# +# it installs the libraries and subsurface in the install-root subdirectory +# of the current directory (except on Mac where the Subsurface.app ends up +# in subsurface/build SRC=$(pwd) +PLATFORM=$(uname) + if [[ ! -d "subsurface" ]] ; then echo "please start this script from the directory containing the Subsurface source directory" exit 1 @@ -22,6 +28,8 @@ fi mkdir -p install-root INSTALL_ROOT=$SRC/install-root +echo Building in $SRC, installing in $INSTALL_ROOT + # build libgit2 if [ ! -d libgit2 ] ; then @@ -38,6 +46,16 @@ cd build cmake -DCMAKE_INSTALL_PREFIX=$INSTALL_ROOT -DCMAKE_BUILD_TYPE=Release -DBUILD_CLAR=OFF .. cmake --build . --target install +if [ $PLATFORM = Darwin ] ; then + # in order for macdeployqt to do its job correctly, we need the full path in the dylib ID + cd $INSTALL_ROOT/lib + NAME=$(otool -L libgit2.dylib | grep -v : | head -1 | cut -f1 -d\ | tr -d '\t') + echo $NAME | grep / > /dev/null 2>&1 + if [ $? -eq 1 ] ; then + install_name_tool -id "$INSTALL_ROOT/lib/$NAME" "$INSTALL_ROOT/lib/$NAME" + fi +fi + cd $SRC # build libdivecomputer @@ -83,8 +101,19 @@ cd src/lib/marble make -j4 make install +if [ $PLATFORM = Darwin ] ; then + # in order for macdeployqt to do its job correctly, we need the full path in the dylib ID + cd $INSTALL_ROOT/lib + NAME=$(otool -L libssrfmarblewidget.dylib | grep -v : | head -1 | cut -f1 -d\ | tr -d '\t') + echo $NAME | grep / > /dev/null 2>&1 + if [ $? -eq 1 ] ; then + install_name_tool -id "$INSTALL_ROOT/lib/$NAME" "$INSTALL_ROOT/lib/$NAME" + fi +fi + cd $SRC/subsurface mkdir -p build cd build cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=$INSTALL_ROOT .. make -j4 +make install |