Changeset bd18b6b in subsurface


Ignore:
Timestamp:
Jul 3, 2017, 9:45:55 AM (3 weeks ago)
Author:
Dirk Hohndel <dirk@…>
Branches:
master
Children:
20254a43
Parents:
acee6f4
git-author:
Dirk Hohndel <dirk@…> (07/03/17 09:45:05)
git-committer:
Dirk Hohndel <dirk@…> (07/03/17 09:45:55)
Message:

build.sh: add option to build all dependencies

Using the Homebrew dependencies is much easier and faster, but then
we run into the problem that Homebrew always builds against your current
OSX version. This instead allows us to build the dependencies ourselves
and set the SDK / minimum OSX version. This is mainly important for
binaries that we want to distribute.

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • scripts/build.sh

    racee6f4 rbd18b6b  
    2020exec 1> >(tee build.log) 2>&1
    2121
     22# in order to build the dependencies on Mac for release builds (to deal with the macosx-version-min for those
     23# call this script with -build-deps
     24if [ "$1" == "-build-deps" ] ; then
     25        shift
     26        BUILD_DEPS="1"
     27fi
     28
    2229SRC=$(pwd)
    2330PLATFORM=$(uname)
     31
     32# most of these will only be needed with -build-deps on a Mac
     33CURRENT_LIBZIP="1.2.0"
     34CURRENT_HIDAPI="hidapi-0.7.0"
     35CURRENT_LIBCURL="curl-7_54_1"
     36CURRENT_LIBUSB="v1.0.21"
     37CURRENT_OPENSSL="OpenSSL_1_1_0f"
     38CURRENT_LIBSSH2="libssh2-1.8.0"
     39CURRENT_LIBGIT2="v0.26.0"
    2440
    2541# Verify that the Xcode Command Line Tools are installed
     
    88104
    89105if [[ $PLATFORM = Darwin || "$LIBGIT" < "24" ]] ; then
     106        # when building distributable binaries on a Mac, we cannot rely on anything from Homebrew,
     107        # because that always requires the latest OS (how stupid is that - and they consider it a
     108        # feature). So we painfully need to build the dependencies ourselves.
     109
     110        if [ "$BUILD_DEPS" == "1" ] ; then
     111                if [ ! -d libzip-${CURRENT_LIBZIP} ] ; then
     112                        curl -O https://nih.at/libzip/libzip-${CURRENT_LIBZIP}.tar.gz
     113                        tar xzf libzip-${CURRENT_LIBZIP}.tar.gz
     114                fi
     115                cd libzip-${CURRENT_LIBZIP}
     116                mkdir -p build
     117                cd build
     118                ../configure CFLAGS="$OLDER_MAC" --prefix=$INSTALL_ROOT
     119                make -j4
     120                make install
     121
     122                cd $SRC
     123
     124                if [ ! -d hidapi ] ; then
     125                        git clone https://github.com/signal11/hidapi
     126                fi
     127                cd hidapi
     128                # there is no good tag, so just build master
     129                bash ./bootstrap
     130                mkdir -p build
     131                cd build
     132                CFLAGS="$OLDER_MAC" ../configure --prefix=$INSTALL_ROOT
     133                make -j4
     134                make install
     135
     136                cd $SRC
     137
     138                if [ ! -d libcurl ] ; then
     139                        git clone https://github.com/curl/curl libcurl
     140                fi
     141                cd libcurl
     142                if ! git checkout $CURRENT_LIBCURL ; then
     143                        echo "Can't find the right tag in libcurl - giving up"
     144                        exit 1
     145                fi
     146                bash ./buildconf
     147                mkdir -p build
     148                cd build
     149                CFLAGS="$OLDER_MAC" ../configure --prefix=$INSTALL_ROOT --with-darwinssl \
     150                        --disable-tftp --disable-ftp --disable-ldap --disable-ldaps --disable-imap --disable-pop3 --disable-smtp --disable-gopher --disable-smb --disable-rtsp
     151                make -j4
     152                make install
     153
     154                cd $SRC
     155
     156                if [ ! -d libusb ] ; then
     157                        git clone https://github.com/libusb/libusb
     158                fi
     159                cd libusb
     160                if ! git checkout $CURRENT_LIBUSB ; then
     161                        echo "Can't find the right tag in libusb - giving up"
     162                        exit 1
     163                fi
     164                bash ./bootstrap.sh
     165                mkdir -p build
     166                cd build
     167                CFLAGS="$OLDER_MAC" ../configure --prefix=$INSTALL_ROOT --disable-examples
     168                make -j4
     169                make install
     170
     171                cd $SRC
     172
     173                if [ ! -d openssl ] ; then
     174                        git clone https://github.com/openssl/openssl
     175                fi
     176                cd openssl
     177                if ! git checkout $CURRENT_OPENSSL ; then
     178                        echo "Can't find the right tag in openssl - giving up"
     179                        exit 1
     180                fi
     181                mkdir -p build
     182                cd build
     183                ../Configure --prefix=$INSTALL_ROOT --openssldir=$INSTALL_ROOT $OLDER_MAC darwin64-x86_64-cc
     184                make depend
     185                # all the tests fail because the assume that openssl is already installed. Odd? Still thinks work
     186                make -j4 -k
     187                make -k install
     188
     189                cd $SRC
     190
     191                if [ ! -d libssh2 ] ; then
     192                        git clone https://github.com/libssh2/libssh2
     193                fi
     194                cd libssh2
     195                if ! git checkout $CURRENT_LIBSSH2 ; then
     196                        echo "Can't find the right tag in libssh2 - giving up"
     197                        exit 1
     198                fi
     199                mkdir -p build
     200                cd build
     201                cmake $OLDER_MAC_CMAKE -DCMAKE_INSTALL_PREFIX=$INSTALL_ROOT -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON -DBUILD_TESTING=OFF -DBUILD_EXAMPLES=OFF ..
     202                make -j4
     203                make install
     204        fi
    90205
    91206        LIBGIT_ARGS=" -DLIBGIT2_INCLUDE_DIR=$INSTALL_ROOT/include -DLIBGIT2_LIBRARIES=$INSTALL_ROOT/lib/libgit2.$SH_LIB_EXT "
     
    103218        # let's build with a recent enough version of master for the latest features
    104219        git fetch origin
    105         if ! git checkout v0.24.5 ; then
     220        if ! git checkout $CURRENT_LIBGIT2 ; then
    106221                echo "Can't find the right tag in libgit2 - giving up"
    107222                exit 1
Note: See TracChangeset for help on using the changeset viewer.