From 0d70a597cd0f1bbf673c6bbf7127b0dfdd1895e2 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Tue, 17 Feb 2015 13:10:45 -0800 Subject: Add build and run script for people wanting to build from source These scripts should make it easier to build from source on platforms where we don't supply binaries. They should ensure the correct libraries are build and then used at run time Signed-off-by: Dirk Hohndel --- scripts/build.sh | 87 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100755 scripts/build.sh (limited to 'scripts/build.sh') diff --git a/scripts/build.sh b/scripts/build.sh new file mode 100755 index 000000000..44cf5d52e --- /dev/null +++ b/scripts/build.sh @@ -0,0 +1,87 @@ +#!/bin/bash +# +# this should be run from the src directory, the layout is supposed to +# look like this: +#.../src/subsurface +# /libgit2 +# /marble-source +# /libdivecomputer +# +# the script will build these three libraries from source, even if +# they are installed as part of the host OS since we have seen +# 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 + +SRC=$(pwd) +if [[ ! -d "subsurface" ]] ; then + echo "please start this script from the directory containing the Subsurface source directory" + exit 1 +fi +mkdir -p install + +# build libgit2 + +if [ ! -d libgit2 ] ; then + if [[ $1 = local ]] ; then + git clone $SRC/../libgit2 libgit2 + else + git clone git://github.com/libgit2/libgit2 + fi +fi +cd libgit2 +git checkout v0.21.5 +mkdir -p build +cd build +cmake -DCMAKE_INSTALL_PREFIX=$SRC/install -DCMAKE_BUILD_TYPE=Release -DBUILD_CLAR=OFF .. +cmake --build . --target install + +cd $SRC + +# build libdivecomputer + +if [ ! -d libdivecomputer ] ; then + if [[ $1 = local ]] ; then + git clone $SRC/../libdivecomputer libdivecomputer + else + git clone -b Subsurface-4.4 git://subsurface-divelog.org/libdc libdivecomputer + fi +fi +cd libdivecomputer +git checkout Subsurface-4.4 +if [ ! -f configure ] ; then + autoreconf --install + ./configure --prefix=$SRC/install +fi +make -j4 +make install + +cd $SRC + +# build libssrfmarblewidget + +if [ ! -d marble-source ] ; then + if [[ $1 = local ]] ; then + git clone $SRC/../marble-source marble-source + else + git clone -b Subsurface-4.4 git://subsurface-divelog.org/marble marble-source + fi +fi +cd marble-source +git checkout Subsurface-4.4 +mkdir -p build +cd build +cmake -DCMAKE_BUILD_TYPE=Release -DQTONLY=TRUE -DQT5BUILD=ON \ + -DCMAKE_INSTALL_PREFIX=$SRC/install \ + -DBUILD_MARBLE_TESTS=NO \ + -DWITH_DESIGNER_PLUGIN=NO \ + -DBUILD_MARBLE_APPS=NO \ + $SRC/marble-source +cd src/lib/marble +make -j4 +make install + +cd $SRC/subsurface +qmake-qt5 LIBDCDEVEL=1 LIBMARBLEDEVEL=$SRC/install SPECIAL_MARBLE_PREFIX=1 LIBGIT2DEVEL=$SRC/libgit2 subsurface.pro +make -j4 + -- cgit v1.2.3-70-g09d2 From 26f03be236ca7db89d27369173ca182c17bef7fc Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Tue, 17 Feb 2015 22:03:15 -0800 Subject: build.sh: figure out whether to use qmake or qmake-qt5 Signed-off-by: Dirk Hohndel --- scripts/build.sh | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'scripts/build.sh') diff --git a/scripts/build.sh b/scripts/build.sh index 44cf5d52e..14f235a29 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -18,6 +18,21 @@ if [[ ! -d "subsurface" ]] ; then echo "please start this script from the directory containing the Subsurface source directory" exit 1 fi + +# qmake or qmake-qt5 ? +qmake -v | grep "version 5" > /dev/null 2>&1 +if [[ $? -eq 0 ]] ; then + QMAKE=qmake +else + qmake-qt5 -v | grep "version 5" > /dev/null 2>&1 + if [[ $? -eq 0 ]] ; then + QMAKE=qmake-qt5 + else + echo "can't find a working qmake for Qt5" + exit 1 + fi +fi + mkdir -p install # build libgit2 @@ -82,6 +97,6 @@ make -j4 make install cd $SRC/subsurface -qmake-qt5 LIBDCDEVEL=1 LIBMARBLEDEVEL=$SRC/install SPECIAL_MARBLE_PREFIX=1 LIBGIT2DEVEL=$SRC/libgit2 subsurface.pro +$QMAKE LIBDCDEVEL=1 LIBMARBLEDEVEL=$SRC/install SPECIAL_MARBLE_PREFIX=1 LIBGIT2DEVEL=$SRC/libgit2 subsurface.pro make -j4 -- cgit v1.2.3-70-g09d2 From 86274b603e6e18e8bfa5921a062ad6365d18af97 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Tue, 17 Feb 2015 23:06:43 -0800 Subject: build.sh: use setRpath and remove run.sh Signed-off-by: Dirk Hohndel --- INSTALL | 3 ++- scripts/build.sh | 2 +- scripts/run.sh | 2 -- 3 files changed, 3 insertions(+), 4 deletions(-) delete mode 100755 scripts/run.sh (limited to 'scripts/build.sh') diff --git a/INSTALL b/INSTALL index bbda32e12..c0bb7882a 100644 --- a/INSTALL +++ b/INSTALL @@ -123,7 +123,8 @@ git clone -b v4.4.1 git://subsurface-divelog.org/subsurface Now you can run Subsurface like this: -./subsurface/scripts/run.sh +cd ~/src/subsurface +./subsurface 2. the harder way ~~~~~~~~~~~~~~~~~ diff --git a/scripts/build.sh b/scripts/build.sh index 14f235a29..9ea0f4f76 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -97,6 +97,6 @@ make -j4 make install cd $SRC/subsurface -$QMAKE LIBDCDEVEL=1 LIBMARBLEDEVEL=$SRC/install SPECIAL_MARBLE_PREFIX=1 LIBGIT2DEVEL=$SRC/libgit2 subsurface.pro +$QMAKE CONFIG+=setRpath LIBDCDEVEL=1 LIBMARBLEDEVEL=$SRC/install SPECIAL_MARBLE_PREFIX=1 LIBGIT2DEVEL=$SRC/libgit2 subsurface.pro make -j4 diff --git a/scripts/run.sh b/scripts/run.sh deleted file mode 100755 index 6e0e0d1e9..000000000 --- a/scripts/run.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -LD_LIBRARY_PATH=install/lib:$LD_LIBRARY_PATH ./subsurface/subsurface -- cgit v1.2.3-70-g09d2