Changeset 73641c4e in subsurface


Ignore:
Timestamp:
Jan 16, 2017, 5:00:55 PM (5 months ago)
Author:
Dirk Hohndel <dirk@…>
Branches:
master
Children:
fe5f15b
Parents:
c749498
git-author:
Dirk Hohndel <dirk@…> (01/16/17 15:56:56)
git-committer:
Dirk Hohndel <dirk@…> (01/16/17 17:00:55)
Message:

build.sh: if new enough libgit2 is installed, use it

Right now this is only designed for Linux where current distros all should have
a new enough libgit2 (and our instructions tell people to install this with
system tools, so we should also use it).

Signed-off-by: Dirk Hohndel <dirk@…>

Files:
3 edited

Legend:

Unmodified
Added
Removed
  • CMakeLists.txt

    r72bcb64 r73641c4e  
    2323#Library Handling
    2424option(FORCE_LIBSSH "force linking with libssh to workaround libgit2 bug" ON)
     25option(LIBGIT2_DYNAMIC "search for libgit2.so before libgit2.a" OFF)
    2526
    2627#Options regarding disabling parts of subsurface.
  • cmake/Modules/FindLIBGIT2.cmake

    rf60e86b r73641c4e  
    2323)
    2424
     25IF ( LIBGIT2_DYNAMIC )
     26    SET( LIBGIT2_SO libgit2.so )
     27ENDIF()
     28
    2529FIND_LIBRARY( LIBGIT2_LIBRARIES
    2630NAMES
     31    ${LIBGIT2_SO}
    2732    libgit2.a
    2833    git2
  • scripts/build.sh

    rc749498 r73641c4e  
    44# look like this:
    55#.../src/subsurface
    6 #       /libgit2
    76#       /marble-source
    87#       /libdivecomputer
     
    7473echo Building in $SRC, installing in $INSTALL_ROOT
    7574
    76 # build libgit2
    77 
    78 cd $SRC
    79 
    80 if [ ! -d libgit2 ] ; then
    81         if [[ $1 = local ]] ; then
    82                 git clone $SRC/../libgit2 libgit2
    83         else
    84                 git clone git://github.com/libgit2/libgit2
    85         fi
    86 fi
    87 cd libgit2
    88 # let's build with a recent enough version of master for the latest features
    89 git fetch origin
    90 if ! git checkout v0.24.5 ; then
    91         echo "Can't find the right tag in libgit2 - giving up"
    92         exit 1
    93 fi
    94 mkdir -p build
    95 cd build
    96 cmake -DCMAKE_INSTALL_PREFIX=$INSTALL_ROOT -DCMAKE_BUILD_TYPE=Release -DBUILD_CLAR=OFF ..
    97 make -j4
    98 make install
    99 
     75# set up the right file name extensions
    10076if [ $PLATFORM = Darwin ] ; then
    101         # in order for macdeployqt to do its job correctly, we need the full path in the dylib ID
    102         cd $INSTALL_ROOT/lib
    103         NAME=$(otool -L libgit2.dylib | grep -v : | head -1 | cut -f1 -d\  | tr -d '\t')
    104         echo $NAME | grep / > /dev/null 2>&1
    105         if [ $? -eq 1 ] ; then
    106                 install_name_tool -id "$INSTALL_ROOT/lib/$NAME" "$INSTALL_ROOT/lib/$NAME"
     77        SH_LIB_EXT=dylib
     78else
     79        SH_LIB_EXT=so
     80
     81        # check if we need to build libgit2 (and do so if necessary)
     82
     83        LIBGIT_ARGS=" -DLIBGIT2_DYNAMIC=ON "
     84        LIBGIT=$(ldconfig -p | grep libgit2\\.so\\. | awk -F. '{ print $NF }')
     85fi
     86
     87if [[ $PLATFORM = Darwin || "$LIBGIT" < "24" ]] ; then
     88
     89        LIBGIT_ARGS=" -DLIBGIT2_INCLUDE_DIR=$INSTALL_ROOT/include -DLIBGIT2_LIBRARIES=$INSTALL_ROOT/lib/libgit2.$SH_LIB_EXT "
     90
     91        cd $SRC
     92
     93        if [ ! -d libgit2 ] ; then
     94                if [[ $1 = local ]] ; then
     95                        git clone $SRC/../libgit2 libgit2
     96                else
     97                        git clone git://github.com/libgit2/libgit2
     98                fi
     99        fi
     100        cd libgit2
     101        # let's build with a recent enough version of master for the latest features
     102        git fetch origin
     103        if ! git checkout v0.24.5 ; then
     104                echo "Can't find the right tag in libgit2 - giving up"
     105                exit 1
     106        fi
     107        mkdir -p build
     108        cd build
     109        cmake -DCMAKE_INSTALL_PREFIX=$INSTALL_ROOT -DCMAKE_BUILD_TYPE=Release -DBUILD_CLAR=OFF ..
     110        make -j4
     111        make install
     112
     113        if [ $PLATFORM = Darwin ] ; then
     114                # in order for macdeployqt to do its job correctly, we need the full path in the dylib ID
     115                cd $INSTALL_ROOT/lib
     116                NAME=$(otool -L libgit2.dylib | grep -v : | head -1 | cut -f1 -d\  | tr -d '\t')
     117                echo $NAME | grep / > /dev/null 2>&1
     118                if [ $? -eq 1 ] ; then
     119                        install_name_tool -id "$INSTALL_ROOT/lib/$NAME" "$INSTALL_ROOT/lib/$NAME"
     120                fi
    107121        fi
    108122fi
     
    228242# finally, build Subsurface
    229243
    230 if [ $PLATFORM = Darwin ] ; then
    231         SH_LIB_EXT=dylib
    232 else
    233         SH_LIB_EXT=so
    234 fi
    235 
    236244cd $SRC/subsurface
    237245for (( i=0 ; i < ${#BUILDS[@]} ; i++ )) ; do
     
    251259        cmake -DCMAKE_BUILD_TYPE=Debug .. \
    252260                -DSUBSURFACE_TARGET_EXECUTABLE=$SUBSURFACE_EXECUTABLE \
    253                 -DLIBGIT2_INCLUDE_DIR=$INSTALL_ROOT/include \
    254                 -DLIBGIT2_LIBRARIES=$INSTALL_ROOT/lib/libgit2.$SH_LIB_EXT \
     261                ${LIBGIT_ARGS} \
    255262                -DLIBDIVECOMPUTER_INCLUDE_DIR=$INSTALL_ROOT/include \
    256263                -DLIBDIVECOMPUTER_LIBRARIES=$INSTALL_ROOT/lib/libdivecomputer.a \
Note: See TracChangeset for help on using the changeset viewer.