diff options
author | Salvador Cuñat <salvador.cunat@gmail.com> | 2017-10-28 15:50:12 +0200 |
---|---|---|
committer | Lubomir I. Ivanov <neolit123@gmail.com> | 2017-10-29 17:08:36 +0100 |
commit | c6d85838b527d0a276eed08164880985f70004e0 (patch) | |
tree | 9b2c0b041a6fb69e73ee8b1d1fd8639d7d15cd4b /scripts/smtk2ssrf-build.sh | |
parent | 9367610220b6bae1db2cfbd24f50774de537fe8b (diff) | |
download | subsurface-c6d85838b527d0a276eed08164880985f70004e0.tar.gz |
smtk2ssrf-build.sh: Build a stripped version of subsurface
Till now we have been building against a previous built of subsurface.
This was handy and fast, but there is a huge drawback in this approach
because we were including a lot of unneeded dependencies (e.g. marble
or serial-ftdi), some of which are, indeed, optional.
With this patch, a stripped down version of susbsurface is built and
used to link in smtk2ssrf.
The bad news are that this - almost unusable - version of subsurface
overrides any preexisting binary, so the user has to rebuild.
Signed-off-by: Salvador Cuñat <salvador.cunat@gmail.com>
Diffstat (limited to 'scripts/smtk2ssrf-build.sh')
-rwxr-xr-x | scripts/smtk2ssrf-build.sh | 55 |
1 files changed, 46 insertions, 9 deletions
diff --git a/scripts/smtk2ssrf-build.sh b/scripts/smtk2ssrf-build.sh index 1059cb07b..701932abb 100755 --- a/scripts/smtk2ssrf-build.sh +++ b/scripts/smtk2ssrf-build.sh @@ -98,18 +98,55 @@ else echo "----> Mdbtools already installed: $(pkg-config --print-provides libmdb)" fi -# We are done. Move on -# No need to update subsurface sources, as it has been previously -# done by build.sh -# -# Do we want to build a branch or commit other than the one used -# for build.sh? -# +# Build bare metal Subsurface. +# We are going to modify some of the building parameters of Subsurface so +# will get a copy of the cmake cache to restore them after building smtk2ssrf. +cd "$SSRF_PATH" || aborting "Couldn't cd into $SSRF_PATH" +echo "----> Saving a copy of $SSRF_PATH/build/CMakeCache.txt" +cp -vf "$SSRF_PATH/build/CMakeCache.txt" "$SSRF_PATH/build/CMakeCache.txt.bak" if [ ! "$SSRF_TAG" == "" ]; then - cd "$SSRF_PATH" || aborting "Couldn't cd into $SSRF_PATH" - git checkout "$SSRF_TAG" || aborting "Couldn't checkout $SSRF_TAG. Is it correct?" + PREV_GIT="$(git branch --no-color 2> /dev/null | sed -e '/^[^*]/d')" + PREV_GIT=${PREV_GIT##*\ }; PREV_GIT=${PREV_GIT%)} + git checkout "$SSRF_TAG" || STATUS=1 +fi + +# abort if git checkout failed +if [ ! -z "$STATUS" ] && [ "$STATUS" -eq 1 ]; then + mv -f "$SSRF_PATH/build/CMakeCache.txt.bak" "$SSRF_PATH/build/CMakeCache.txt" + aborting "Couldn't checkout $SSRF_TAG. Is it correct?" fi +cmake -DBTSUPPORT=OFF \ + -DCMAKE_BUILD_TYPE="$RELEASE" \ + -DFBSUPPORT=OFF \ + -DFORCE_LIBSSH=OFF \ + -DFTDISUPPORT=OFF \ + -DMAKE_TESTS=OFF \ + -DNO_DOCS=ON \ + -DNO_MARBLE=ON \ + -DNO_PRINTING=ON \ + -DNO_USERMANUAL=ON \ + -DUSE_WEBENGINE=OFF \ + -DSUBSURFACE_TARGET_EXECUTABLE=DesktopExecutable \ + build +cd build || aborting "Couldn't cd into $SSRF_PATH/build directory" +make clean +make "$JOBS" || STATUS=1 + +# Restore initial state of subsurface building system: +echo "----> Restoring Subsurface tree state" +[[ ! -z $PREV_GIT ]] && echo "------> Restoring git branch to - $PREV_GIT -" && \ + git checkout "$PREV_GIT" >/dev/null +echo "------> Restoring cmake cache" && \ + mv -f "$SSRF_PATH/build/CMakeCache.txt.bak" "$SSRF_PATH/build/CMakeCache.txt" +cmake . +echo "----> Restored. Rebuild subsurface if needed" + +# Abort if failed to build subsurface +[[ ! -z $STATUS ]] && [[ $STATUS -eq 1 ]] && aborting "Couldn't build Subsurface" + +# We are done. Move on +# echo "----> Building smtk2ssrf SmartTrak divelogs importer" cd "$SSRF_PATH"/smtk-import || aborting "Couldnt cd into $SSRF_PATH/smtk-import" |