2018-05-08 17:14:09 +00:00
|
|
|
#!/bin/bash
|
|
|
|
#
|
|
|
|
|
|
|
|
# set version of 3rd party libraries
|
|
|
|
CURRENT_LIBZIP="1.2.0"
|
|
|
|
CURRENT_LIBGIT2="v0.26.0"
|
|
|
|
CURRENT_HIDAPI="hidapi-0.7.0"
|
|
|
|
CURRENT_LIBCURL="curl-7_54_1"
|
|
|
|
CURRENT_LIBUSB="v1.0.21"
|
2018-05-19 20:39:49 +00:00
|
|
|
CURRENT_OPENSSL="OpenSSL_1_1_0h"
|
2018-05-08 17:14:09 +00:00
|
|
|
CURRENT_LIBSSH2="libssh2-1.8.0"
|
|
|
|
CURRENT_XSLT="v1.1.29"
|
|
|
|
CURRENT_SQLITE="3190200"
|
|
|
|
CURRENT_LIBXML2="v2.9.4"
|
|
|
|
CURRENT_LIBFTDI="1.3"
|
|
|
|
|
|
|
|
# deal with all the command line arguments
|
2018-05-16 08:59:27 +00:00
|
|
|
if [[ $# -ne 2 && $# -ne 3 ]] ; then
|
2018-05-08 17:14:09 +00:00
|
|
|
echo "wrong number of parameters, format:"
|
2018-05-16 08:59:27 +00:00
|
|
|
echo "get-dep-lib.sh <platform> <install dir>"
|
|
|
|
echo "get-dep-lib.sh single <install dir> <lib>"
|
2018-05-17 18:55:58 +00:00
|
|
|
echo "get-dep-lib.sh singleAndroid <install dir> <lib>"
|
2018-05-16 08:59:27 +00:00
|
|
|
echo "where"
|
|
|
|
echo "<platform> is one of scripts, ios or android"
|
2018-05-08 17:14:09 +00:00
|
|
|
echo "(the name of the directory where build.sh resides)"
|
2018-05-16 08:59:27 +00:00
|
|
|
echo "<install dir> is the directory to clone in"
|
|
|
|
echo "<lib> is the name to be cloned"
|
2018-05-08 17:14:09 +00:00
|
|
|
exit -1
|
|
|
|
fi
|
|
|
|
|
|
|
|
PLATFORM=$1
|
|
|
|
INSTDIR=$2
|
|
|
|
if [ ! -d ${INSTDIR} ] ; then
|
|
|
|
echo "creating dir"
|
|
|
|
mkdir -p ${INSTDIR}
|
|
|
|
fi
|
|
|
|
|
2018-05-17 18:55:58 +00:00
|
|
|
# FIX FOR ANDROID,
|
|
|
|
if [ "$PLATFORM" == "singleAndroid" ] ; then
|
|
|
|
CURRENT_LIBZIP="1.1.3"
|
2018-05-19 20:39:49 +00:00
|
|
|
CURRENT_OPENSSL="OpenSSL_1_0_2o"
|
2018-05-17 18:55:58 +00:00
|
|
|
fi
|
|
|
|
# no curl and old libs (never version breaks)
|
|
|
|
# check whether to use curl or wget
|
|
|
|
if [ "`which curl`" == "" ] ; then
|
|
|
|
CURL="wget "
|
|
|
|
else
|
|
|
|
CURL="curl -O "
|
|
|
|
fi
|
2018-05-08 17:14:09 +00:00
|
|
|
case ${PLATFORM} in
|
|
|
|
scripts)
|
|
|
|
BUILD="libzip libgit2 googlemaps hidapi libcurl libusb openssl libssh2"
|
|
|
|
;;
|
|
|
|
ios)
|
|
|
|
BUILD="libzip libgit2 googlemaps libxslt"
|
|
|
|
;;
|
|
|
|
android)
|
|
|
|
BUILD="libzip libgit2 googlemaps libxslt sqlite libxml2 openssl libftdi libusb"
|
|
|
|
;;
|
2018-05-16 08:59:27 +00:00
|
|
|
single)
|
|
|
|
BUILD="$3"
|
|
|
|
;;
|
2018-05-17 18:55:58 +00:00
|
|
|
singleAndroid)
|
|
|
|
BUILD="$3"
|
|
|
|
;;
|
2018-05-08 17:14:09 +00:00
|
|
|
*)
|
|
|
|
echo "Unknown platform ${PLATFORM}, choose between native, ios or android"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
# show what you are doing and stop when things break
|
|
|
|
set -x
|
|
|
|
set -e
|
|
|
|
|
|
|
|
# get ready to download needed sources
|
|
|
|
cd ${INSTDIR}
|
|
|
|
|
2018-05-15 14:48:47 +00:00
|
|
|
if [[ "$BUILD" = *"libcurl"* && ! -d libcurl ]]; then
|
|
|
|
git clone https://github.com/curl/curl libcurl
|
2018-05-08 17:14:09 +00:00
|
|
|
pushd libcurl
|
|
|
|
git fetch origin
|
|
|
|
if ! git checkout $CURRENT_LIBCURL ; then
|
|
|
|
echo "Can't find the right tag in libcurl - giving up"
|
|
|
|
exit -1
|
|
|
|
fi
|
|
|
|
popd
|
|
|
|
fi
|
|
|
|
|
2018-05-15 14:48:47 +00:00
|
|
|
if [[ "$BUILD" = *"libftdi"* && ! -d libftdi1 ]]; then
|
2018-05-17 18:55:58 +00:00
|
|
|
${CURL} https://www.intra2net.com/en/developer/libftdi/download/libftdi1-${CURRENT_LIBFTDI}.tar.bz2
|
2018-05-15 14:48:47 +00:00
|
|
|
tar -jxf libftdi1-${CURRENT_LIBFTDI}.tar.bz2
|
2018-05-08 17:14:09 +00:00
|
|
|
mv libftdi1-${CURRENT_LIBFTDI} libftdi1
|
|
|
|
fi
|
|
|
|
|
2018-05-15 14:48:47 +00:00
|
|
|
if [[ "$BUILD" = *"libgit2"* && ! -d libgit2 ]]; then
|
|
|
|
git clone https://github.com/libgit2/libgit2.git
|
2018-05-08 17:14:09 +00:00
|
|
|
pushd libgit2
|
|
|
|
git fetch origin
|
|
|
|
if ! git checkout ${CURRENT_LIBGIT2} ; then
|
|
|
|
echo "Can't find the right tag in libgit2 - giving up"
|
|
|
|
exit -1
|
|
|
|
fi
|
|
|
|
popd
|
|
|
|
fi
|
|
|
|
|
2018-05-15 14:48:47 +00:00
|
|
|
if [[ "$BUILD" = *"libssh2"* && ! -d libssh2 ]]; then
|
|
|
|
git clone https://github.com/libssh2/libssh2
|
2018-05-08 17:14:09 +00:00
|
|
|
pushd libssh2
|
|
|
|
git fetch origin
|
|
|
|
if ! git checkout $CURRENT_LIBSSH2 ; then
|
|
|
|
echo "Can't find the right tag in libssh2 - giving up"
|
|
|
|
exit -1
|
|
|
|
fi
|
|
|
|
popd
|
|
|
|
fi
|
|
|
|
|
2018-05-15 14:48:47 +00:00
|
|
|
if [[ "$BUILD" = *"libusb"* && ! -d libusb ]]; then
|
|
|
|
git clone https://github.com/libusb/libusb
|
2018-05-08 17:14:09 +00:00
|
|
|
pushd libusb
|
|
|
|
git fetch origin
|
|
|
|
if ! git checkout $CURRENT_LIBUSB ; then
|
|
|
|
echo "Can't find the right tag in libusb - giving up"
|
|
|
|
exit -1
|
|
|
|
fi
|
|
|
|
popd
|
|
|
|
fi
|
|
|
|
|
2018-05-15 14:48:47 +00:00
|
|
|
if [[ "$BUILD" = *"libxml2"* && ! -d libxml2 ]]; then
|
|
|
|
git clone https://github.com/GNOME/libxml2.git
|
2018-05-08 17:14:09 +00:00
|
|
|
pushd libxml2
|
|
|
|
git fetch origin
|
|
|
|
if ! git checkout $CURRENT_LIBXML2 ; then
|
|
|
|
echo "Can't find the right tag in libxml2 - giving up"
|
|
|
|
exit -1
|
|
|
|
fi
|
|
|
|
popd
|
|
|
|
fi
|
|
|
|
|
2018-05-15 14:48:47 +00:00
|
|
|
if [[ "$BUILD" = *"libxslt"* && ! -d libxslt ]]; then
|
|
|
|
git clone https://github.com/GNOME/libxslt.git
|
2018-05-08 17:14:09 +00:00
|
|
|
pushd libxslt
|
|
|
|
git fetch origin
|
|
|
|
if ! git checkout $CURRENT_LIBXSLT ; then
|
|
|
|
echo "Can't find the right tag in libxslt - giving up"
|
|
|
|
exit -1
|
|
|
|
fi
|
|
|
|
popd
|
|
|
|
fi
|
|
|
|
|
2018-05-15 14:48:47 +00:00
|
|
|
if [[ "$BUILD" = *"libzip"* && ! -d libzip ]]; then
|
2018-05-17 18:55:58 +00:00
|
|
|
${CURL} https://libzip.org/download/libzip-${CURRENT_LIBZIP}.tar.gz
|
2018-05-15 14:48:47 +00:00
|
|
|
tar xzf libzip-${CURRENT_LIBZIP}.tar.gz
|
|
|
|
mv libzip-${CURRENT_LIBZIP} libzip
|
2018-05-08 17:14:09 +00:00
|
|
|
fi
|
|
|
|
|
2018-05-15 14:48:47 +00:00
|
|
|
if [[ "$BUILD" = *"googlemaps"* && ! -d googlemaps ]]; then
|
|
|
|
git clone https://github.com/Subsurface-divelog/googlemaps.git
|
2018-05-08 17:14:09 +00:00
|
|
|
pushd googlemaps
|
|
|
|
git fetch origin
|
|
|
|
git checkout master
|
|
|
|
git pull --rebase
|
|
|
|
popd
|
|
|
|
fi
|
|
|
|
|
2018-05-15 14:48:47 +00:00
|
|
|
if [[ "$BUILD" = *"hidapi"* && ! -d hidapi ]]; then
|
|
|
|
git clone https://github.com/signal11/hidapi
|
2018-05-08 17:14:09 +00:00
|
|
|
pushd hidapi
|
|
|
|
git fetch origin
|
2018-05-15 14:48:47 +00:00
|
|
|
# there is no good tag, so just build master
|
|
|
|
# if ! git checkout $CURRENT_HIDAPI ; then
|
|
|
|
# echo "Can't find the right tag in hidapi - giving up"
|
|
|
|
# exit -1
|
|
|
|
# fi
|
2018-05-08 17:14:09 +00:00
|
|
|
popd
|
|
|
|
fi
|
|
|
|
|
2018-05-15 14:48:47 +00:00
|
|
|
if [[ "$BUILD" = *"openssl"* && ! -d openssl ]]; then
|
|
|
|
git clone https://github.com/openssl/openssl
|
2018-05-08 17:14:09 +00:00
|
|
|
pushd openssl
|
|
|
|
git fetch origin
|
|
|
|
if ! git checkout $CURRENT_OPENSSL ; then
|
|
|
|
echo "Can't find the right tag in openssl - giving up"
|
|
|
|
exit -1
|
|
|
|
fi
|
|
|
|
popd
|
|
|
|
fi
|
|
|
|
|
2018-05-15 14:48:47 +00:00
|
|
|
if [[ "$BUILD" = *"sqlite"* && ! -d sqlite ]]; then
|
2018-05-17 18:55:58 +00:00
|
|
|
${CURL} http://www.sqlite.org/2017/sqlite-autoconf-${CURRENT_SQLITE}.tar.gz
|
2018-05-15 14:48:47 +00:00
|
|
|
tar -zxf sqlite-autoconf-${CURRENT_SQLITE}.tar.gz
|
|
|
|
mv sqlite-autoconf-${CURRENT_SQLITE} sqlite
|
2018-05-08 17:14:09 +00:00
|
|
|
fi
|