From c6d85838b527d0a276eed08164880985f70004e0 Mon Sep 17 00:00:00 2001 From: Salvador Cuñat Date: Sat, 28 Oct 2017 15:50:12 +0200 Subject: smtk2ssrf-build.sh: Build a stripped version of subsurface MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- scripts/smtk2ssrf-build.sh | 55 ++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 46 insertions(+), 9 deletions(-) (limited to 'scripts') 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" -- cgit v1.2.3-70-g09d2