| 
									
										
										
										
											2018-05-08 19:14:09 +02:00
										 |  |  | #!/bin/bash
 | 
					
						
							|  |  |  | # | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | # set version of 3rd party libraries | 
					
						
							| 
									
										
										
										
											2020-09-12 17:32:05 -07:00
										 |  |  | CURRENT_LIBZ="v1.2.11" | 
					
						
							| 
									
										
										
										
											2018-08-04 12:20:47 -07:00
										 |  |  | CURRENT_LIBZIP="rel-1-5-1" | 
					
						
							| 
									
										
										
										
											2020-11-18 19:00:12 +00:00
										 |  |  | CURRENT_LIBGIT2="v1.0.1" | 
					
						
							| 
									
										
										
										
											2018-05-08 19:14:09 +02:00
										 |  |  | CURRENT_LIBCURL="curl-7_54_1" | 
					
						
							| 
									
										
										
										
											2022-02-09 15:08:55 -08:00
										 |  |  | CURRENT_LIBUSB="v1.0.25" | 
					
						
							| 
									
										
										
										
											2022-02-03 21:23:04 -08:00
										 |  |  | CURRENT_OPENSSL="OpenSSL_1_1_1m" | 
					
						
							| 
									
										
										
										
											2018-05-08 19:14:09 +02:00
										 |  |  | CURRENT_LIBSSH2="libssh2-1.8.0" | 
					
						
							| 
									
										
										
										
											2020-04-02 12:00:27 -07:00
										 |  |  | CURRENT_XSLT="v1.1.34" | 
					
						
							| 
									
										
										
										
											2018-05-08 19:14:09 +02:00
										 |  |  | CURRENT_SQLITE="3190200" | 
					
						
							|  |  |  | CURRENT_LIBXML2="v2.9.4" | 
					
						
							| 
									
										
										
										
											2023-12-08 12:31:24 -08:00
										 |  |  | CURRENT_LIBFTDI="abd19b721f7e9b4d514ed319ece173ebc7b1ea72" | 
					
						
							| 
									
										
										
										
											2020-11-23 09:34:02 -08:00
										 |  |  | CURRENT_KIRIGAMI="v5.76.0" | 
					
						
							| 
									
										
										
										
											2020-02-23 18:19:11 -08:00
										 |  |  | CURRENT_BREEZE_ICONS="4daac191fb33c8c03bba8356db9767816cb8ee02" | 
					
						
							| 
									
										
										
										
											2023-12-15 06:37:40 +01:00
										 |  |  | CURRENT_MDBTOOLS="v1.0.0" | 
					
						
							| 
									
										
										
										
											2020-04-23 08:18:29 -07:00
										 |  |  | CURRENT_QT_ANDROID_CMAKE="master" | 
					
						
							| 
									
										
										
										
											2020-10-28 07:15:20 -07:00
										 |  |  | CURRENT_LIBMTP="master" | 
					
						
							| 
									
										
										
										
											2018-05-08 19:14:09 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-06-16 16:24:46 +02:00
										 |  |  | # Checkout library from git | 
					
						
							|  |  |  | # Ensure specified version is checked out, | 
					
						
							|  |  |  | # while avoiding cloning/fetching if unnecessary. | 
					
						
							|  |  |  | # | 
					
						
							|  |  |  | # Arguments: | 
					
						
							|  |  |  | #	name - used as directory name | 
					
						
							|  |  |  | #	version - any tag/sha usable by git | 
					
						
							|  |  |  | #	url - repository url | 
					
						
							|  |  |  | # | 
					
						
							|  |  |  | git_checkout_library() { | 
					
						
							| 
									
										
										
										
											2018-06-18 21:36:22 +02:00
										 |  |  | 	[ $# -ne 3 ] && return 1 | 
					
						
							| 
									
										
										
										
											2018-06-16 16:24:46 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	# for clarity | 
					
						
							|  |  |  | 	local name=$1 | 
					
						
							|  |  |  | 	local version=$2 | 
					
						
							|  |  |  | 	local url=$3 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	if [ ! -d "$name" ]; then | 
					
						
							|  |  |  | 		git clone "$url" "$name" | 
					
						
							|  |  |  | 	fi | 
					
						
							|  |  |  | 	pushd "$name" | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-06-16 18:27:35 +02:00
										 |  |  | 	local current_sha=$(git rev-parse HEAD) | 
					
						
							|  |  |  | 	local target_sha=$(git rev-parse "$version") | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	if [ ! "$current_sha" = "$target_sha" ] ; then | 
					
						
							|  |  |  | 		git fetch origin | 
					
						
							| 
									
										
										
										
											2019-01-09 08:08:59 -08:00
										 |  |  | 		if ! git checkout -f "$version" ; then | 
					
						
							| 
									
										
										
										
											2018-06-16 18:27:35 +02:00
										 |  |  | 			echo "Can't find the right tag in $name - giving up" | 
					
						
							| 
									
										
										
										
											2019-01-09 08:08:59 -08:00
										 |  |  | 			exit 1 | 
					
						
							| 
									
										
										
										
											2018-06-16 18:27:35 +02:00
										 |  |  | 		fi | 
					
						
							| 
									
										
										
										
											2018-06-16 16:24:46 +02:00
										 |  |  | 	fi | 
					
						
							|  |  |  | 	popd | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-06-17 09:44:20 +02:00
										 |  |  | # Download and extract tarball dependencies | 
					
						
							|  |  |  | # | 
					
						
							|  |  |  | # Arguments: | 
					
						
							|  |  |  | #	name - used as output directory | 
					
						
							|  |  |  | #	base_url - | 
					
						
							|  |  |  | #	filename - tarball file name | 
					
						
							|  |  |  | # | 
					
						
							|  |  |  | curl_download_library() { | 
					
						
							| 
									
										
										
										
											2018-06-18 21:36:22 +02:00
										 |  |  | 	[ $# -ne 3 ] && return 1 | 
					
						
							| 
									
										
										
										
											2018-06-17 09:44:20 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	local name=$1 | 
					
						
							|  |  |  | 	local base_url=$2 | 
					
						
							|  |  |  | 	local filename=$3 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	if [ ! -f "$filename" ]; then | 
					
						
							|  |  |  | 		${CURL} "${base_url}${filename}" | 
					
						
							| 
									
										
										
										
											2018-06-18 22:23:12 +02:00
										 |  |  | 	fi | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	if [ ! -d "$name" ] || [ "$name" -ot "$filename" ] ; then | 
					
						
							| 
									
										
										
										
											2018-06-17 09:44:20 +02:00
										 |  |  | 		rm -rf "$name" | 
					
						
							|  |  |  | 		mkdir "$name" | 
					
						
							|  |  |  | 		tar -C "$name" --strip-components=1 -xf "$filename" | 
					
						
							|  |  |  | 	fi | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-06-16 16:24:46 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-05-08 19:14:09 +02:00
										 |  |  | # deal with all the command line arguments | 
					
						
							| 
									
										
										
										
											2018-06-18 21:36:22 +02:00
										 |  |  | if [ $# -ne 2 ] && [ $# -ne 3 ] ; then | 
					
						
							| 
									
										
										
										
											2018-05-08 19:14:09 +02:00
										 |  |  | 	echo "wrong number of parameters, format:" | 
					
						
							| 
									
										
										
										
											2018-05-16 10:59:27 +02:00
										 |  |  | 	echo "get-dep-lib.sh <platform> <install dir>" | 
					
						
							|  |  |  | 	echo "get-dep-lib.sh single <install dir> <lib>" | 
					
						
							| 
									
										
										
										
											2018-05-17 20:55:58 +02:00
										 |  |  | 	echo "get-dep-lib.sh singleAndroid <install dir> <lib>" | 
					
						
							| 
									
										
										
										
											2018-05-16 10:59:27 +02:00
										 |  |  | 	echo "where" | 
					
						
							|  |  |  | 	echo "<platform> is one of scripts, ios or android" | 
					
						
							| 
									
										
										
										
											2018-05-08 19:14:09 +02:00
										 |  |  | 	echo "(the name of the directory where build.sh resides)" | 
					
						
							| 
									
										
										
										
											2018-05-16 10:59:27 +02:00
										 |  |  | 	echo "<install dir> is the directory to clone in" | 
					
						
							|  |  |  | 	echo "<lib> is the name to be cloned" | 
					
						
							| 
									
										
										
										
											2018-05-08 19:14:09 +02:00
										 |  |  | 	exit -1 | 
					
						
							|  |  |  | fi | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | PLATFORM=$1 | 
					
						
							|  |  |  | INSTDIR=$2 | 
					
						
							| 
									
										
										
										
											2018-06-18 21:36:22 +02:00
										 |  |  | if [ ! -d "${INSTDIR}" ] ; then | 
					
						
							| 
									
										
										
										
											2018-05-08 19:14:09 +02:00
										 |  |  | 	echo "creating dir" | 
					
						
							| 
									
										
										
										
											2018-06-18 21:36:22 +02:00
										 |  |  | 	mkdir -p "${INSTDIR}" | 
					
						
							| 
									
										
										
										
											2018-05-08 19:14:09 +02:00
										 |  |  | fi | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-05-17 20:55:58 +02:00
										 |  |  | # FIX FOR ANDROID, | 
					
						
							|  |  |  | if [ "$PLATFORM" == "singleAndroid" ] ; then | 
					
						
							| 
									
										
										
										
											2022-02-03 21:23:04 -08:00
										 |  |  | 	CURRENT_OPENSSL="OpenSSL_1_1_1m" | 
					
						
							| 
									
										
										
										
											2024-01-08 07:51:43 +13:00
										 |  |  | # If changing the openSSL version here, make sure to change it in scripts/docker/android-build-container/variables.sh also. | 
					
						
							| 
									
										
										
										
											2018-05-17 20:55:58 +02:00
										 |  |  | fi | 
					
						
							|  |  |  | # no curl and old libs (never version breaks) | 
					
						
							|  |  |  | # check whether to use curl or wget | 
					
						
							| 
									
										
										
										
											2018-06-18 21:36:22 +02:00
										 |  |  | if [ "$(which curl)" == "" ] ; then | 
					
						
							| 
									
										
										
										
											2018-05-17 20:55:58 +02:00
										 |  |  | 	CURL="wget " | 
					
						
							|  |  |  | else | 
					
						
							|  |  |  | 	CURL="curl -O " | 
					
						
							|  |  |  | fi | 
					
						
							| 
									
										
										
										
											2018-06-18 22:25:11 +02:00
										 |  |  | COMMON_PACKAGES=(libzip libgit2 googlemaps) | 
					
						
							| 
									
										
										
										
											2018-05-08 19:14:09 +02:00
										 |  |  | case ${PLATFORM} in | 
					
						
							|  |  |  | 	scripts) | 
					
						
							| 
									
										
										
										
											2018-06-18 22:25:11 +02:00
										 |  |  | 		PACKAGES=("${COMMON_PACKAGES[@]}" hidapi libcurl libusb openssl libssh2) | 
					
						
							| 
									
										
										
										
											2018-05-08 19:14:09 +02:00
										 |  |  | 		;; | 
					
						
							|  |  |  | 	ios) | 
					
						
							| 
									
										
										
										
											2020-04-02 09:36:44 -07:00
										 |  |  | 		PACKAGES=("${COMMON_PACKAGES[@]}" libxml2 libxslt) | 
					
						
							| 
									
										
										
										
											2018-05-08 19:14:09 +02:00
										 |  |  | 		;; | 
					
						
							|  |  |  | 	android) | 
					
						
							| 
									
										
										
										
											2018-06-18 22:32:02 +02:00
										 |  |  | 		PACKAGES=("${COMMON_PACKAGES[@]}" libxslt sqlite libxml2 openssl libftdi1 libusb) | 
					
						
							| 
									
										
										
										
											2018-05-08 19:14:09 +02:00
										 |  |  | 		;; | 
					
						
							| 
									
										
										
										
											2018-05-16 10:59:27 +02:00
										 |  |  | 	single) | 
					
						
							| 
									
										
										
										
											2018-06-18 22:25:11 +02:00
										 |  |  | 		PACKAGES=("$3") | 
					
						
							| 
									
										
										
										
											2018-05-16 10:59:27 +02:00
										 |  |  | 		;; | 
					
						
							| 
									
										
										
										
											2018-05-17 20:55:58 +02:00
										 |  |  | 	singleAndroid) | 
					
						
							| 
									
										
										
										
											2018-06-18 22:25:11 +02:00
										 |  |  | 		PACKAGES=("$3") | 
					
						
							| 
									
										
										
										
											2018-05-17 20:55:58 +02:00
										 |  |  | 		;; | 
					
						
							| 
									
										
										
										
											2018-05-08 19:14:09 +02: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 | 
					
						
							| 
									
										
										
										
											2018-06-18 21:36:22 +02:00
										 |  |  | cd "${INSTDIR}" | 
					
						
							| 
									
										
										
										
											2018-05-08 19:14:09 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-06-18 22:25:11 +02:00
										 |  |  | for package in "${PACKAGES[@]}" ; do | 
					
						
							|  |  |  | 	case "$package" in | 
					
						
							|  |  |  | 		libcurl) | 
					
						
							|  |  |  | 			git_checkout_library libcurl $CURRENT_LIBCURL https://github.com/curl/curl.git | 
					
						
							|  |  |  | 			;; | 
					
						
							|  |  |  | 		libgit2) | 
					
						
							|  |  |  | 			git_checkout_library libgit2 $CURRENT_LIBGIT2 https://github.com/libgit2/libgit2.git | 
					
						
							|  |  |  | 			;; | 
					
						
							|  |  |  | 		libssh2) | 
					
						
							|  |  |  | 			git_checkout_library libssh2 $CURRENT_LIBSSH2 https://github.com/libssh2/libssh2.git | 
					
						
							|  |  |  | 			;; | 
					
						
							|  |  |  | 		libusb) | 
					
						
							|  |  |  | 			git_checkout_library libusb $CURRENT_LIBUSB https://github.com/libusb/libusb.git | 
					
						
							|  |  |  | 			;; | 
					
						
							| 
									
										
										
										
											2020-10-28 07:15:20 -07:00
										 |  |  | 		libmtp) | 
					
						
							|  |  |  | 			git_checkout_library libmtp $CURRENT_LIBMTP https://github.com/libmtp/libmtp.git | 
					
						
							|  |  |  | 			;; | 
					
						
							| 
									
										
										
										
											2018-06-18 22:25:11 +02:00
										 |  |  | 		libxml2) | 
					
						
							|  |  |  | 			git_checkout_library libxml2 $CURRENT_LIBXML2 https://github.com/GNOME/libxml2.git | 
					
						
							|  |  |  | 			;; | 
					
						
							|  |  |  | 		libxslt) | 
					
						
							|  |  |  | 			git_checkout_library libxslt $CURRENT_XSLT https://github.com/GNOME/libxslt.git | 
					
						
							|  |  |  | 			;; | 
					
						
							|  |  |  | 		breeze-icons) | 
					
						
							| 
									
										
										
										
											2020-02-23 18:19:11 -08:00
										 |  |  | 			git_checkout_library breeze-icons $CURRENT_BREEZE_ICONS https://github.com/kde/breeze-icons.git | 
					
						
							| 
									
										
										
										
											2018-06-18 22:25:11 +02:00
										 |  |  | 			;; | 
					
						
							|  |  |  | 		googlemaps) | 
					
						
							| 
									
										
										
										
											2020-04-26 16:36:27 -07:00
										 |  |  | 			git_checkout_library googlemaps master https://github.com/Subsurface/googlemaps.git | 
					
						
							| 
									
										
										
										
											2018-06-18 22:25:11 +02:00
										 |  |  | 			;; | 
					
						
							|  |  |  | 		hidapi) | 
					
						
							| 
									
										
										
										
											2020-10-13 17:25:40 -07:00
										 |  |  | 			git_checkout_library hidapi master https://github.com/libusb/hidapi.git | 
					
						
							| 
									
										
										
										
											2018-06-18 22:25:11 +02:00
										 |  |  | 			;; | 
					
						
							|  |  |  | 		kirigami) | 
					
						
							|  |  |  | 			git_checkout_library kirigami $CURRENT_KIRIGAMI https://github.com/KDE/kirigami.git | 
					
						
							|  |  |  | 			;; | 
					
						
							| 
									
										
										
										
											2020-11-24 20:15:45 -08:00
										 |  |  | 		extra-cmake-modules) # we want this intentionally at the same version as kirigami | 
					
						
							|  |  |  | 			git_checkout_library extra-cmake-modules $CURRENT_KIRIGAMI https://github.com/KDE/extra-cmake-modules.git | 
					
						
							|  |  |  | 			;; | 
					
						
							| 
									
										
										
										
											2018-06-18 22:25:11 +02:00
										 |  |  | 		openssl) | 
					
						
							|  |  |  | 			git_checkout_library openssl $CURRENT_OPENSSL https://github.com/openssl/openssl.git | 
					
						
							|  |  |  | 			;; | 
					
						
							| 
									
										
										
										
											2020-09-12 17:32:05 -07:00
										 |  |  | 		libz) | 
					
						
							|  |  |  | 			git_checkout_library libz $CURRENT_LIBZ https://github.com/madler/zlib.git | 
					
						
							|  |  |  | 			;; | 
					
						
							| 
									
										
										
										
											2018-06-18 22:25:11 +02:00
										 |  |  | 		libzip) | 
					
						
							| 
									
										
										
										
											2018-08-04 12:20:47 -07:00
										 |  |  | 			git_checkout_library libzip $CURRENT_LIBZIP https://github.com/nih-at/libzip.git | 
					
						
							| 
									
										
										
										
											2018-06-18 22:25:11 +02:00
										 |  |  | 			;; | 
					
						
							| 
									
										
										
										
											2018-06-18 22:32:02 +02:00
										 |  |  | 		libftdi1) | 
					
						
							| 
									
										
										
										
											2023-12-08 12:31:24 -08:00
										 |  |  | 			git_checkout_library libftdi1 $CURRENT_LIBFTDI git://developer.intra2net.com/libftdi | 
					
						
							| 
									
										
										
										
											2018-06-18 22:25:11 +02:00
										 |  |  | 			;; | 
					
						
							|  |  |  | 		sqlite) | 
					
						
							| 
									
										
										
										
											2018-07-20 22:39:50 +02:00
										 |  |  | 			curl_download_library sqlite https://www.sqlite.org/2017/ sqlite-autoconf-${CURRENT_SQLITE}.tar.gz | 
					
						
							| 
									
										
										
										
											2018-06-18 22:25:11 +02:00
										 |  |  | 			;; | 
					
						
							| 
									
										
										
										
											2018-10-14 21:53:59 +02:00
										 |  |  | 		mdbtools) | 
					
						
							| 
									
										
										
										
											2023-12-15 06:37:40 +01:00
										 |  |  | 			git_checkout_library mdbtools $CURRENT_MDBTOOLS https://github.com/mdbtools/mdbtools.git | 
					
						
							| 
									
										
										
										
											2018-10-14 21:53:59 +02:00
										 |  |  | 			;; | 
					
						
							| 
									
										
										
										
											2018-10-27 10:01:00 -04:00
										 |  |  | 		qt-android-cmake) | 
					
						
							|  |  |  | 			git_checkout_library qt-android-cmake $CURRENT_QT_ANDROID_CMAKE https://github.com/LaurentGomila/qt-android-cmake.git | 
					
						
							|  |  |  | 			;; | 
					
						
							| 
									
										
										
										
											2018-06-18 22:25:11 +02:00
										 |  |  | 		*) | 
					
						
							|  |  |  | 			echo "unknown package \"$package\"" | 
					
						
							|  |  |  | 			exit 1 | 
					
						
							|  |  |  | 			;; | 
					
						
							|  |  |  | 	esac | 
					
						
							|  |  |  | done |