build.sh: add flags to only build / not build dependencies

This is mainly intended for use when creating Coverity builds. This
commit is easier to understand with git show -w as almost all changes
are whitespace.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2017-12-27 08:35:13 -08:00
parent 55a3cd13cd
commit 40c6d9521e

View file

@ -59,6 +59,16 @@ while [[ $# -gt 0 ]] ; do
# hack for Travix Mac build
SKIP_GOOGLEMAPS="1"
;;
-only-deps)
# for Coverity build we want a mode to just build Subsurface and libdivecomputer (those will be analyzed),
# and build the rest, first.
ONLY_DEPS="1"
;;
-no-deps)
# for Coverity build we want a mode to just build Subsurface and libdivecomputer (those will be analyzed),
# and build the rest, first.
NO_DEPS="1"
;;
*)
echo "Unknown command line argument $arg"
;;
@ -304,6 +314,7 @@ if [[ $PLATFORM = Darwin || "$LIBGIT" < "24" ]] ; then
cd $SRC
if [ -z "$NO_DEPS" ] ; then
if [ ! -d libgit2 ] ; then
if [[ $1 = local ]] ; then
git clone $SRC/../libgit2 libgit2
@ -323,6 +334,7 @@ if [[ $PLATFORM = Darwin || "$LIBGIT" < "24" ]] ; then
cmake $OLDER_MAC_CMAKE -DCMAKE_INSTALL_PREFIX=$INSTALL_ROOT -DCMAKE_BUILD_TYPE=Release -DBUILD_CLAR=OFF ..
make -j4
make install
fi
if [ $PLATFORM = Darwin ] ; then
# in order for macdeployqt to do its job correctly, we need the full path in the dylib ID
@ -339,28 +351,30 @@ cd $SRC
# build libdivecomputer
cd subsurface
if [ -z "$ONLY_DEPS" ] ; then
cd subsurface
if [ ! -d libdivecomputer/src ] ; then
if [ ! -d libdivecomputer/src ] ; then
git submodule init
git submodule update --recursive
fi
fi
cd libdivecomputer
cd libdivecomputer
mkdir -p build
cd build
mkdir -p build
cd build
if [ ! -f ../configure ] ; then
if [ ! -f ../configure ] ; then
# this is not a typo
# in some scenarios it appears that autoreconf doesn't copy the
# ltmain.sh file; running it twice, however, fixes that problem
autoreconf --install ..
autoreconf --install ..
fi
CFLAGS="$OLDER_MAC -I$INSTALL_ROOT/include $LIBDC_CFLAGS" ../configure --prefix=$INSTALL_ROOT --disable-examples
make -j4
make install
fi
CFLAGS="$OLDER_MAC -I$INSTALL_ROOT/include $LIBDC_CFLAGS" ../configure --prefix=$INSTALL_ROOT --disable-examples
make -j4
make install
if [ $PLATFORM = Darwin ] ; then
if [ -z "$CMAKE_PREFIX_PATH" ] ; then
@ -401,6 +415,7 @@ if [ "$BUILDGRANTLEE" = "1" ] ; then
# build grantlee
PRINTING="-DNO_PRINTING=OFF"
if [ -z "$NO_DEPS" ] ; then
cd $SRC
if [ ! -d grantlee ] ; then
@ -423,6 +438,7 @@ if [ "$BUILDGRANTLEE" = "1" ] ; then
$SRC/grantlee
make -j4
make install
fi
else
PRINTING="-DNO_PRINTING=ON"
fi
@ -430,6 +446,7 @@ fi
if [ "$SKIP_GOOGLEMAPS" != "1" ] ; then
# build the googlemaps map plugin
if [ -z "$NO_DEPS" ] ; then
cd $SRC
if [ ! -d googlemaps ] ; then
if [[ $1 = local ]] ; then
@ -453,14 +470,16 @@ if [ "$SKIP_GOOGLEMAPS" != "1" ] ; then
cat Makefile.bak | sed -e 's/std=c++1z/std=c++11/g ; s/-Wdate-time//' > Makefile
make -j4
make install
fi
fi
# finally, build Subsurface
set -x
cd $SRC/subsurface
for (( i=0 ; i < ${#BUILDS[@]} ; i++ )) ; do
if [ -z "$ONLY_DEPS" ] ; then
cd $SRC/subsurface
for (( i=0 ; i < ${#BUILDS[@]} ; i++ )) ; do
SUBSURFACE_EXECUTABLE=${BUILDS[$i]}
BUILDDIR=${BUILDDIRS[$i]}
echo "build $SUBSURFACE_EXECUTABLE in $BUILDDIR"
@ -504,4 +523,7 @@ for (( i=0 ; i < ${#BUILDS[@]} ; i++ )) ; do
cp subsurface/appdata/subsurface.appdata.xml appdir/usr/share/metainfo/
cp subsurface/icons/subsurface-icon.png appdir/usr/share/icons/hicolor/256x256/apps/
fi
done
done
else
echo "Done building the dependencies, did not build libdivecomputer and Subsurface"
fi