build-system: made get-dep-lib faster and more robust.

Secured git work only happens when cloning a dir.

There is a version for hidapi, but scripts/build.sh
(which are the source for that part of depend) has a
line:
	# there is no good tag, so just build master
and then continues with master, so it should be good
enough for get-dep-lib as well.

Signed-off-by: Jan Iversen <jani@apache.org>
This commit is contained in:
jan Iversen 2018-05-15 16:48:47 +02:00 committed by Dirk Hohndel
parent 77b9a62f7f
commit 6d3637fce0

View file

@ -54,10 +54,8 @@ set -e
# get ready to download needed sources # get ready to download needed sources
cd ${INSTDIR} cd ${INSTDIR}
if [[ $BUILD = *"libcurl"* ]]; then if [[ "$BUILD" = *"libcurl"* && ! -d libcurl ]]; then
if [ ! -d libcurl ] ; then
git clone https://github.com/curl/curl libcurl git clone https://github.com/curl/curl libcurl
fi
pushd libcurl pushd libcurl
git fetch origin git fetch origin
if ! git checkout $CURRENT_LIBCURL ; then if ! git checkout $CURRENT_LIBCURL ; then
@ -67,18 +65,14 @@ if [[ $BUILD = *"libcurl"* ]]; then
popd popd
fi fi
if [[ $BUILD = *"libftdi"* ]]; then if [[ "$BUILD" = *"libftdi"* && ! -d libftdi1 ]]; then
if [ ! -d libftdi1 ] ; then
curl -O https://www.intra2net.com/en/developer/libftdi/download/libftdi1-${CURRENT_LIBFTDI}.tar.bz2 curl -O https://www.intra2net.com/en/developer/libftdi/download/libftdi1-${CURRENT_LIBFTDI}.tar.bz2
tar -jxf libftdi1-${CURRENT_LIBFTDI}.tar.bz2 tar -jxf libftdi1-${CURRENT_LIBFTDI}.tar.bz2
mv libftdi1-${CURRENT_LIBFTDI} libftdi1 mv libftdi1-${CURRENT_LIBFTDI} libftdi1
fi fi
fi
if [[ $BUILD = *"libgit2"* ]]; then if [[ "$BUILD" = *"libgit2"* && ! -d libgit2 ]]; then
if [ ! -d libgit2 ] ; then
git clone https://github.com/libgit2/libgit2.git git clone https://github.com/libgit2/libgit2.git
fi
pushd libgit2 pushd libgit2
git fetch origin git fetch origin
if ! git checkout ${CURRENT_LIBGIT2} ; then if ! git checkout ${CURRENT_LIBGIT2} ; then
@ -88,10 +82,8 @@ if [[ $BUILD = *"libgit2"* ]]; then
popd popd
fi fi
if [[ $BUILD = *"libssh2"* ]]; then if [[ "$BUILD" = *"libssh2"* && ! -d libssh2 ]]; then
if [ ! -d libssh2 ] ; then
git clone https://github.com/libssh2/libssh2 git clone https://github.com/libssh2/libssh2
fi
pushd libssh2 pushd libssh2
git fetch origin git fetch origin
if ! git checkout $CURRENT_LIBSSH2 ; then if ! git checkout $CURRENT_LIBSSH2 ; then
@ -101,10 +93,8 @@ if [[ $BUILD = *"libssh2"* ]]; then
popd popd
fi fi
if [[ $BUILD = *"libusb"* ]]; then if [[ "$BUILD" = *"libusb"* && ! -d libusb ]]; then
if [ ! -d libusb ] ; then
git clone https://github.com/libusb/libusb git clone https://github.com/libusb/libusb
fi
pushd libusb pushd libusb
git fetch origin git fetch origin
if ! git checkout $CURRENT_LIBUSB ; then if ! git checkout $CURRENT_LIBUSB ; then
@ -114,10 +104,8 @@ if [[ $BUILD = *"libusb"* ]]; then
popd popd
fi fi
if [[ $BUILD = *"libxml2"* ]]; then if [[ "$BUILD" = *"libxml2"* && ! -d libxml2 ]]; then
if [ ! -d libxml2 ] ; then
git clone https://github.com/GNOME/libxml2.git git clone https://github.com/GNOME/libxml2.git
fi
pushd libxml2 pushd libxml2
git fetch origin git fetch origin
if ! git checkout $CURRENT_LIBXML2 ; then if ! git checkout $CURRENT_LIBXML2 ; then
@ -127,10 +115,8 @@ if [[ $BUILD = *"libxml2"* ]]; then
popd popd
fi fi
if [[ $BUILD = *"libxslt"* ]]; then if [[ "$BUILD" = *"libxslt"* && ! -d libxslt ]]; then
if [ ! -d libxslt ] ; then
git clone https://github.com/GNOME/libxslt.git git clone https://github.com/GNOME/libxslt.git
fi
pushd libxslt pushd libxslt
git fetch origin git fetch origin
if ! git checkout $CURRENT_LIBXSLT ; then if ! git checkout $CURRENT_LIBXSLT ; then
@ -140,18 +126,14 @@ if [[ $BUILD = *"libxslt"* ]]; then
popd popd
fi fi
if [[ $BUILD = *"libzip"* ]]; then if [[ "$BUILD" = *"libzip"* && ! -d libzip ]]; then
if [ ! -d libzip ] ; then
curl -O https://libzip.org/download/libzip-${CURRENT_LIBZIP}.tar.gz curl -O https://libzip.org/download/libzip-${CURRENT_LIBZIP}.tar.gz
tar xzf libzip-${CURRENT_LIBZIP}.tar.gz tar xzf libzip-${CURRENT_LIBZIP}.tar.gz
mv libzip-${CURRENT_LIBZIP} libzip mv libzip-${CURRENT_LIBZIP} libzip
fi fi
fi
if [[ $BUILD = *"googlemaps"* ]]; then if [[ "$BUILD" = *"googlemaps"* && ! -d googlemaps ]]; then
if [ ! -d googlemaps ] ; then
git clone https://github.com/Subsurface-divelog/googlemaps.git git clone https://github.com/Subsurface-divelog/googlemaps.git
fi
pushd googlemaps pushd googlemaps
git fetch origin git fetch origin
git checkout master git checkout master
@ -159,23 +141,20 @@ if [[ $BUILD = *"googlemaps"* ]]; then
popd popd
fi fi
if [[ $BUILD = *"hidapi"* ]]; then if [[ "$BUILD" = *"hidapi"* && ! -d hidapi ]]; then
if [ ! -d hidapi ] ; then
git clone https://github.com/signal11/hidapi git clone https://github.com/signal11/hidapi
fi
pushd hidapi pushd hidapi
git fetch origin git fetch origin
if ! git checkout $CURRENT_HIDAPI ; then # there is no good tag, so just build master
echo "Can't find the right tag in hidapi - giving up" # if ! git checkout $CURRENT_HIDAPI ; then
exit -1 # echo "Can't find the right tag in hidapi - giving up"
fi # exit -1
# fi
popd popd
fi fi
if [[ $BUILD = *"openssl"* ]]; then if [[ "$BUILD" = *"openssl"* && ! -d openssl ]]; then
if [ ! -d openssl ] ; then
git clone https://github.com/openssl/openssl git clone https://github.com/openssl/openssl
fi
pushd openssl pushd openssl
git fetch origin git fetch origin
if ! git checkout $CURRENT_OPENSSL ; then if ! git checkout $CURRENT_OPENSSL ; then
@ -185,12 +164,8 @@ if [[ $BUILD = *"openssl"* ]]; then
popd popd
fi fi
if [[ $BUILD = *"sqlite"* ]]; then if [[ "$BUILD" = *"sqlite"* && ! -d sqlite ]]; then
if [ ! -d sqlite ] ; then
curl -O http://www.sqlite.org/2017/sqlite-autoconf-${CURRENT_SQLITE}.tar.gz curl -O http://www.sqlite.org/2017/sqlite-autoconf-${CURRENT_SQLITE}.tar.gz
tar -zxf sqlite-autoconf-${CURRENT_SQLITE}.tar.gz tar -zxf sqlite-autoconf-${CURRENT_SQLITE}.tar.gz
mv sqlite-autoconf-${CURRENT_SQLITE} sqlite mv sqlite-autoconf-${CURRENT_SQLITE} sqlite
fi fi
fi
exit 0