| 
									
										
										
										
											2016-09-25 21:54:39 +02:00
										 |  |  | #!/bin/bash
 | 
					
						
							| 
									
										
										
										
											2015-02-17 13:10:45 -08:00
										 |  |  | # | 
					
						
							| 
									
										
										
										
											2017-12-03 11:48:51 -08:00
										 |  |  | # this should be run from the src directory which contains the subsurface | 
					
						
							|  |  |  | # directory; the layout should look like this: | 
					
						
							| 
									
										
										
										
											2019-12-10 21:23:44 -05:00
										 |  |  | # .../src/subsurface | 
					
						
							| 
									
										
										
										
											2015-02-17 13:10:45 -08:00
										 |  |  | # | 
					
						
							| 
									
										
										
										
											2017-12-03 11:48:51 -08:00
										 |  |  | # the script will build Subsurface and libdivecomputer (plus some other | 
					
						
							|  |  |  | # dependencies if requestsed) from source. | 
					
						
							| 
									
										
										
										
											2015-04-15 11:33:14 -07:00
										 |  |  | # | 
					
						
							|  |  |  | # it installs the libraries and subsurface in the install-root subdirectory | 
					
						
							|  |  |  | # of the current directory (except on Mac where the Subsurface.app ends up | 
					
						
							| 
									
										
										
										
											2019-12-11 11:55:34 -05:00
										 |  |  | # in subsurface/build) | 
					
						
							|  |  |  | # | 
					
						
							|  |  |  | # by default it puts the build folders in | 
					
						
							| 
									
										
										
										
											2019-12-22 13:46:30 +01:00
										 |  |  | # ./subsurface/libdivecomputer/build (libdivecomputer build) | 
					
						
							| 
									
										
										
										
											2019-12-11 11:55:34 -05:00
										 |  |  | # ./subsurface/build                  (desktop build) | 
					
						
							|  |  |  | # ./subsurface/build-mobile           (mobile build) | 
					
						
							| 
									
										
										
										
											2019-12-10 21:23:44 -05:00
										 |  |  | # | 
					
						
							|  |  |  | # there is basic support for building from a shared directory, e.g., with | 
					
						
							|  |  |  | # one subsurface source tree on a host computer, accessed from multiple | 
					
						
							|  |  |  | # VMs as well as the host to build without stepping on each other - the | 
					
						
							|  |  |  | # one exceptioin is running autotools for libdiveconputer which has to | 
					
						
							|  |  |  | # happen in the shared libdivecomputer folder | 
					
						
							| 
									
										
										
										
											2019-12-11 11:55:34 -05:00
										 |  |  | # one way to achieve this is to have ./subsurface be a symlink; in that | 
					
						
							|  |  |  | # case the build directories are libdivecomputer/build, build, build-mobile | 
					
						
							|  |  |  | # alternatively a build prefix can be explicitly given with -build-prefix | 
					
						
							|  |  |  | # that build prefix is directly pre-pended to the destinations mentioned | 
					
						
							|  |  |  | # above - if this is a directory, it needs to end with '/' | 
					
						
							| 
									
										
										
										
											2019-10-14 14:13:00 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  | # don't keep going if we run into an error | 
					
						
							|  |  |  | set -e | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-12-11 11:55:34 -05:00
										 |  |  | # create a log file of the build | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-06-02 10:22:10 -07:00
										 |  |  | exec 1> >(tee build.log) 2>&1 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-07-15 21:39:54 -07:00
										 |  |  | SRC=$(pwd) | 
					
						
							| 
									
										
										
										
											2019-12-11 11:55:34 -05:00
										 |  |  | 
 | 
					
						
							|  |  |  | if [[ -L subsurface && -d subsurface ]] ; then | 
					
						
							|  |  |  | 	# ./subsurface is a symbolic link to the source directory, so let's | 
					
						
							|  |  |  | 	# set up a prefix that puts the build directories in the current directory | 
					
						
							|  |  |  | 	# but this can be overwritten via the command line | 
					
						
							| 
									
										
										
										
											2019-12-11 16:17:27 -05:00
										 |  |  | 	BUILD_PREFIX="$SRC/" | 
					
						
							| 
									
										
										
										
											2019-12-11 11:55:34 -05:00
										 |  |  | fi | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-07-15 21:39:54 -07:00
										 |  |  | PLATFORM=$(uname) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-15 21:49:50 -04:00
										 |  |  | BTSUPPORT="ON" | 
					
						
							| 
									
										
										
										
											2018-07-09 09:53:43 -07:00
										 |  |  | DEBUGRELEASE="Debug" | 
					
						
							| 
									
										
										
										
											2020-01-22 18:55:08 +01:00
										 |  |  | SRC_DIR="subsurface" | 
					
						
							| 
									
										
										
										
											2017-10-15 21:49:50 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-07-28 07:44:09 -07:00
										 |  |  | # deal with all the command line arguments | 
					
						
							|  |  |  | while [[ $# -gt 0 ]] ; do | 
					
						
							|  |  |  | 	arg="$1" | 
					
						
							|  |  |  | 	case $arg in | 
					
						
							| 
									
										
										
										
											2017-10-15 21:49:50 -04:00
										 |  |  | 		-no-bt) | 
					
						
							|  |  |  | 			# force Bluetooth support off | 
					
						
							|  |  |  | 			BTSUPPORT="OFF" | 
					
						
							| 
									
										
										
										
											2017-10-15 22:17:58 -04:00
										 |  |  | 			;; | 
					
						
							| 
									
										
										
										
											2019-09-05 08:22:50 -07:00
										 |  |  | 		-quick) | 
					
						
							|  |  |  | 			# only build libdivecomputer and Subsurface - this assumes that all other dependencies don't need rebuilding | 
					
						
							|  |  |  | 			QUICK="1" | 
					
						
							|  |  |  | 			;; | 
					
						
							| 
									
										
										
										
											2020-01-22 18:55:08 +01:00
										 |  |  | 		-src-dir) | 
					
						
							|  |  |  | 			# instead of using "subsurface" as source directory, use src/<srcdir> | 
					
						
							|  |  |  | 			# this is convinient when using "git worktree" to have multiple branches | 
					
						
							|  |  |  | 			# checked out on the computer. | 
					
						
							|  |  |  | 			# remark <srcdir> must be in src (in parallel to subsurface), in order to | 
					
						
							|  |  |  | 			# use the same 3rd party set. | 
					
						
							|  |  |  | 			shift | 
					
						
							|  |  |  | 			SRC_DIR="$1" | 
					
						
							|  |  |  | 			;;			 | 
					
						
							| 
									
										
										
										
											2017-07-28 07:44:09 -07:00
										 |  |  | 		-build-deps) | 
					
						
							|  |  |  | 			# in order to build the dependencies on Mac for release builds (to deal with the macosx-version-min for those | 
					
						
							|  |  |  | 			# call this script with -build-deps | 
					
						
							|  |  |  | 			BUILD_DEPS="1" | 
					
						
							|  |  |  | 			;; | 
					
						
							| 
									
										
										
										
											2019-12-10 21:23:44 -05:00
										 |  |  | 		-build-prefix) | 
					
						
							|  |  |  | 			# instead of building in build & build-mobile in the current directory, build in <buildprefix>build | 
					
						
							|  |  |  | 			# and <buildprefix>build-mobile; notice that there's no slash between the prefix and the two directory | 
					
						
							|  |  |  | 			# names, so if the prefix is supposed to be a path, add the slash at the end of it, or do funky things | 
					
						
							|  |  |  | 			# where build/build-mobile get appended to partial path name | 
					
						
							|  |  |  | 			shift | 
					
						
							|  |  |  | 			BUILD_PREFIX="$1" | 
					
						
							|  |  |  | 			;; | 
					
						
							| 
									
										
										
										
											2017-07-28 07:44:09 -07:00
										 |  |  | 		-build-with-webkit) | 
					
						
							|  |  |  | 			# unless you build Qt from source (or at least webkit from source, you won't have webkit installed | 
					
						
							|  |  |  | 			# -build-with-webkit tells the script that in fact we can assume that webkit is present (it usually | 
					
						
							|  |  |  | 			# is still available on Linux distros) | 
					
						
							|  |  |  | 			BUILD_WITH_WEBKIT="1" | 
					
						
							|  |  |  | 			;; | 
					
						
							|  |  |  | 		-mobile) | 
					
						
							|  |  |  | 			# we are building Subsurface-mobile | 
					
						
							| 
									
										
										
										
											2018-05-08 11:28:33 +02:00
										 |  |  | 			# Note that this will run natively on the host OS. | 
					
						
							|  |  |  | 			# To cross build for Android or iOS (including simulator)  | 
					
						
							|  |  |  | 			# use the scripts in packaging/xxx | 
					
						
							| 
									
										
										
										
											2017-07-28 07:44:09 -07:00
										 |  |  | 			BUILD_MOBILE="1" | 
					
						
							|  |  |  | 			;; | 
					
						
							|  |  |  | 		-desktop) | 
					
						
							|  |  |  | 			# we are building Subsurface | 
					
						
							|  |  |  | 			BUILD_DESKTOP="1" | 
					
						
							|  |  |  | 			;; | 
					
						
							|  |  |  | 		-both) | 
					
						
							|  |  |  | 			# we are building Subsurface and Subsurface-mobile | 
					
						
							|  |  |  | 			BUILD_MOBILE="1" | 
					
						
							|  |  |  | 			BUILD_DESKTOP="1" | 
					
						
							|  |  |  | 			;; | 
					
						
							| 
									
										
										
										
											2017-11-05 11:55:52 -08:00
										 |  |  | 		-create-appdir) | 
					
						
							|  |  |  | 			# we are building an AppImage as by product | 
					
						
							|  |  |  | 			CREATE_APPDIR="1" | 
					
						
							|  |  |  | 			;; | 
					
						
							| 
									
										
										
										
											2018-07-09 09:53:43 -07:00
										 |  |  | 		-release) | 
					
						
							|  |  |  | 			# don't build Debug binaries | 
					
						
							|  |  |  | 			DEBUGRELEASE="Release" | 
					
						
							|  |  |  | 			;; | 
					
						
							| 
									
										
										
										
											2017-07-28 07:44:09 -07:00
										 |  |  | 		*) | 
					
						
							|  |  |  | 			echo "Unknown command line argument $arg" | 
					
						
							| 
									
										
										
										
											2020-01-22 18:55:08 +01:00
										 |  |  | 			echo "Usage: build.sh [-no-bt] [-quick] [-build-deps] [-src-dir <SUBSURFACE directory>] [-build-prefix <PREFIX>] [-build-with-webkit] [-mobile] [-desktop] [-both] [-create-appdir] [-release]" | 
					
						
							| 
									
										
										
										
											2018-07-09 10:33:04 -07:00
										 |  |  | 			exit 1 | 
					
						
							| 
									
										
										
										
											2017-07-28 07:44:09 -07:00
										 |  |  | 			;; | 
					
						
							|  |  |  | 	esac | 
					
						
							| 
									
										
										
										
											2017-07-04 01:45:05 +09:00
										 |  |  | 	shift | 
					
						
							| 
									
										
										
										
											2017-07-28 07:44:09 -07:00
										 |  |  | done | 
					
						
							| 
									
										
										
										
											2017-07-04 01:45:05 +09:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-09-05 08:22:50 -07:00
										 |  |  | if [ "$BUILD_DEPS" = "1" ] && [ "$QUICK" = "1" ] ; then | 
					
						
							|  |  |  | 	echo "Conflicting options; cannot request combine -build-deps and -quick" | 
					
						
							|  |  |  | 	exit 1; | 
					
						
							|  |  |  | fi | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-03-16 09:02:03 +01:00
										 |  |  | # Verify that the Xcode Command Line Tools are installed | 
					
						
							| 
									
										
										
										
											2019-12-11 16:17:27 -05:00
										 |  |  | if [ "$PLATFORM" = Darwin ] ; then | 
					
						
							| 
									
										
										
										
											2017-07-15 10:37:50 -07:00
										 |  |  | 	if [ -d /Developer/SDKs ] ; then | 
					
						
							|  |  |  | 		SDKROOT=/Developer/SDKs | 
					
						
							|  |  |  | 	elif [ -d /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs ] ; then | 
					
						
							|  |  |  | 		SDKROOT=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs | 
					
						
							|  |  |  | 	else | 
					
						
							|  |  |  | 		echo "Cannot find SDK sysroot (usually /Developer/SDKs or" | 
					
						
							|  |  |  | 		echo "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs)" | 
					
						
							|  |  |  | 		exit 1; | 
					
						
							|  |  |  | 	fi | 
					
						
							|  |  |  | 	BASESDK=$(ls $SDKROOT | grep "MacOSX10\.1.\.sdk" | head -1 | sed -e "s/MacOSX//;s/\.sdk//") | 
					
						
							| 
									
										
										
										
											2018-09-12 21:33:21 -07:00
										 |  |  | 	OLDER_MAC="-mmacosx-version-min=10.11 -isysroot${SDKROOT}/MacOSX${BASESDK}.sdk" | 
					
						
							| 
									
										
										
										
											2017-07-15 10:37:50 -07:00
										 |  |  | 	OLDER_MAC_CMAKE="-DCMAKE_OSX_DEPLOYMENT_TARGET=${BASESDK} -DCMAKE_OSX_SYSROOT=${SDKROOT}/MacOSX${BASESDK}.sdk/" | 
					
						
							| 
									
										
										
										
											2018-10-03 18:54:44 +02:00
										 |  |  | 	if [[ ! -d /usr/include && ! -d "${SDKROOT}/MacOSX.sdk/usr/include" ]] ; then | 
					
						
							| 
									
										
										
										
											2016-03-16 09:02:03 +01:00
										 |  |  | 		echo "Error: Xcode Command Line Tools are not installed" | 
					
						
							|  |  |  | 		echo "" | 
					
						
							|  |  |  | 		echo "Please run:" | 
					
						
							|  |  |  | 		echo " xcode-select --install" | 
					
						
							|  |  |  | 		echo "to install them (you'll have to agree to Apple's licensing terms etc), then run build.sh again" | 
					
						
							|  |  |  | 		exit 1; | 
					
						
							|  |  |  | 	fi | 
					
						
							|  |  |  | fi | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-17 10:44:00 -08:00
										 |  |  | # normally this script builds the desktop version in subsurface/build | 
					
						
							| 
									
										
										
										
											2019-12-10 21:23:44 -05:00
										 |  |  | # if the first argument is "-mobile" then build Subsurface-mobile in "$BUILD_PREFIX"build-mobile | 
					
						
							|  |  |  | # if the first argument is "-both" then build both in subsurface/build and "$BUILD_PREFIX"build-mobile | 
					
						
							| 
									
										
										
										
											2017-07-28 07:44:09 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  | if [ "$BUILD_MOBILE" = "1" ] ; then | 
					
						
							| 
									
										
										
										
											2020-01-22 18:55:08 +01:00
										 |  |  | 	echo "building Subsurface-mobile in ${SRC_DIR}/build-mobile" | 
					
						
							| 
									
										
										
										
											2016-01-17 10:44:00 -08:00
										 |  |  | 	BUILDS=( "MobileExecutable" ) | 
					
						
							| 
									
										
										
										
											2019-12-10 21:23:44 -05:00
										 |  |  | 	BUILDDIRS=( "${BUILD_PREFIX}build-mobile" ) | 
					
						
							| 
									
										
										
										
											2016-01-17 10:44:00 -08:00
										 |  |  | else | 
					
						
							| 
									
										
										
										
											2017-07-28 07:44:09 -07:00
										 |  |  | 	# if no options are given, build Subsurface | 
					
						
							|  |  |  | 	BUILD_DESKTOP="1" | 
					
						
							|  |  |  | fi | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | if [ "$BUILD_DESKTOP" = "1" ] ; then | 
					
						
							| 
									
										
										
										
											2020-01-22 18:55:08 +01:00
										 |  |  | 	echo "building Subsurface in ${SRC_DIR}/build" | 
					
						
							| 
									
										
										
										
											2017-07-28 07:44:09 -07:00
										 |  |  | 	BUILDS+=( "DesktopExecutable" ) | 
					
						
							| 
									
										
										
										
											2019-12-10 21:23:44 -05:00
										 |  |  | 	BUILDDIRS+=( "${BUILD_PREFIX}build" ) | 
					
						
							| 
									
										
										
										
											2017-07-15 21:39:54 -07:00
										 |  |  | 	if [ "$BUILD_WITH_WEBKIT" = "1" ] ; then | 
					
						
							| 
									
										
										
										
											2019-09-05 08:22:50 -07:00
										 |  |  | 		PRINTING="-DNO_PRINTING=OFF" | 
					
						
							|  |  |  | 	else | 
					
						
							|  |  |  | 		PRINTING="-DNO_PRINTING=ON" | 
					
						
							| 
									
										
										
										
											2017-07-15 21:39:54 -07:00
										 |  |  | 	fi | 
					
						
							| 
									
										
										
										
											2016-01-17 10:44:00 -08:00
										 |  |  | fi | 
					
						
							| 
									
										
										
										
											2016-01-07 06:59:33 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-01-22 18:55:08 +01:00
										 |  |  | if [[ ! -d "${SRC_DIR}" ]] ; then | 
					
						
							| 
									
										
										
										
											2015-02-17 13:10:45 -08:00
										 |  |  | 	echo "please start this script from the directory containing the Subsurface source directory" | 
					
						
							|  |  |  | 	exit 1 | 
					
						
							|  |  |  | fi | 
					
						
							| 
									
										
										
										
											2015-02-17 22:03:15 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-12-11 16:26:23 -05:00
										 |  |  | if [ -z "$BUILD_PREFIX" ] ; then | 
					
						
							|  |  |  | 	INSTALL_ROOT=$SRC/install-root | 
					
						
							|  |  |  | else | 
					
						
							|  |  |  | 	INSTALL_ROOT="$BUILD_PREFIX"install-root | 
					
						
							|  |  |  | fi | 
					
						
							|  |  |  | mkdir -p "$INSTALL_ROOT" | 
					
						
							| 
									
										
										
										
											2017-08-03 16:50:23 -07:00
										 |  |  | export INSTALL_ROOT | 
					
						
							| 
									
										
										
										
											2015-02-17 13:10:45 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-06-04 13:52:13 -07:00
										 |  |  | # make sure we find our own packages first (e.g., libgit2 only uses pkg_config to find libssh2) | 
					
						
							|  |  |  | export PKG_CONFIG_PATH=$INSTALL_ROOT/lib/pkgconfig:$PKG_CONFIG_PATH | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-12-11 16:17:27 -05:00
										 |  |  | echo Building from "$SRC", installing in "$INSTALL_ROOT" | 
					
						
							| 
									
										
										
										
											2015-04-15 11:33:14 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-08-26 09:36:27 -07:00
										 |  |  | # find qmake | 
					
						
							| 
									
										
										
										
											2019-12-11 16:17:27 -05:00
										 |  |  | if [ -n "$CMAKE_PREFIX_PATH" ] ; then | 
					
						
							| 
									
										
										
										
											2017-08-26 09:36:27 -07:00
										 |  |  | 	QMAKE=$CMAKE_PREFIX_PATH/../../bin/qmake | 
					
						
							|  |  |  | else | 
					
						
							| 
									
										
										
										
											2018-09-05 17:12:44 -07:00
										 |  |  | 	hash qmake > /dev/null 2> /dev/null && QMAKE=qmake | 
					
						
							|  |  |  | 	[ -z $QMAKE ] && hash qmake-qt5 > /dev/null 2> /dev/null && QMAKE=qmake-qt5 | 
					
						
							|  |  |  | 	[ -z $QMAKE ] && echo "cannot find qmake or qmake-qt5" && exit 1 | 
					
						
							| 
									
										
										
										
											2017-08-26 09:36:27 -07:00
										 |  |  | fi | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-08-26 11:51:03 -07:00
										 |  |  | # on Debian and Ubuntu based systems, the private QtLocation and | 
					
						
							|  |  |  | # QtPositioning headers aren't bundled. Download them if necessary. | 
					
						
							| 
									
										
										
										
											2019-12-11 16:17:27 -05:00
										 |  |  | if [ "$PLATFORM" = Linux ] ; then | 
					
						
							|  |  |  | 	QT_HEADERS_PATH=$($QMAKE -query QT_INSTALL_HEADERS) | 
					
						
							|  |  |  | 	QT_VERSION=$($QMAKE -query QT_VERSION) | 
					
						
							| 
									
										
										
										
											2017-08-26 11:51:03 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-09-16 10:49:35 +02:00
										 |  |  | 	if [ ! -d "$QT_HEADERS_PATH/QtLocation/$QT_VERSION/QtLocation/private" ] && | 
					
						
							| 
									
										
										
										
											2019-12-11 16:17:27 -05:00
										 |  |  |            [ ! -d "$INSTALL_ROOT"/include/QtLocation/private ] ; then | 
					
						
							| 
									
										
										
										
											2017-09-16 10:49:35 +02:00
										 |  |  | 		echo "Missing private Qt headers for $QT_VERSION; downloading them..." | 
					
						
							| 
									
										
										
										
											2017-08-26 11:51:03 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  | 		QTLOC_GIT=./qtlocation_git | 
					
						
							|  |  |  | 		QTLOC_PRIVATE=$INSTALL_ROOT/include/QtLocation/private | 
					
						
							|  |  |  | 		QTPOS_PRIVATE=$INSTALL_ROOT/include/QtPositioning/private | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		rm -rf $QTLOC_GIT > /dev/null 2>&1 | 
					
						
							| 
									
										
										
										
											2019-12-11 16:17:27 -05:00
										 |  |  | 		rm -rf "$INSTALL_ROOT"/include/QtLocation > /dev/null 2>&1 | 
					
						
							|  |  |  | 		rm -rf "$INSTALL_ROOT"/include/QtPositioning > /dev/null 2>&1 | 
					
						
							| 
									
										
										
										
											2017-08-26 11:51:03 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-12-11 16:17:27 -05:00
										 |  |  | 		git clone --branch "v$QT_VERSION" git://code.qt.io/qt/qtlocation.git --depth=1 $QTLOC_GIT | 
					
						
							| 
									
										
										
										
											2017-08-26 11:51:03 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-12-11 16:17:27 -05:00
										 |  |  | 		mkdir -p "$QTLOC_PRIVATE" | 
					
						
							| 
									
										
										
										
											2017-08-26 11:51:03 -07:00
										 |  |  | 		cd $QTLOC_GIT/src/location | 
					
						
							| 
									
										
										
										
											2019-12-11 16:17:27 -05:00
										 |  |  | 		find . -name '*_p.h' -print0 | xargs -0 cp -t "$QTLOC_PRIVATE" | 
					
						
							|  |  |  | 		cd "$SRC" | 
					
						
							| 
									
										
										
										
											2017-08-26 11:51:03 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-12-11 16:17:27 -05:00
										 |  |  | 		mkdir -p "$QTPOS_PRIVATE" | 
					
						
							| 
									
										
										
										
											2017-08-26 11:51:03 -07:00
										 |  |  | 		cd $QTLOC_GIT/src/positioning | 
					
						
							| 
									
										
										
										
											2019-12-11 16:17:27 -05:00
										 |  |  | 		find . -name '*_p.h' -print0 | xargs -0 cp -t "$QTPOS_PRIVATE" | 
					
						
							|  |  |  | 		cd "$SRC" | 
					
						
							| 
									
										
										
										
											2017-08-26 11:51:03 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  | 		echo "* cleanup..." | 
					
						
							|  |  |  | 		rm -rf $QTLOC_GIT > /dev/null 2>&1 | 
					
						
							|  |  |  | 	fi | 
					
						
							|  |  |  | fi | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-01-16 15:56:56 -08:00
										 |  |  | # set up the right file name extensions | 
					
						
							| 
									
										
										
										
											2019-12-11 16:17:27 -05:00
										 |  |  | if [ "$PLATFORM" = Darwin ] ; then | 
					
						
							| 
									
										
										
										
											2017-01-16 15:56:56 -08:00
										 |  |  | 	SH_LIB_EXT=dylib | 
					
						
							| 
									
										
										
										
											2018-07-07 10:26:31 -07:00
										 |  |  | 	if [ ! "$BUILD_DEPS" == "1" ] ; then | 
					
						
							| 
									
										
										
										
											2020-04-09 16:52:33 -07:00
										 |  |  | 		pkg-config --exists libgit2 && LIBGIT=$(pkg-config --modversion libgit2) && LIBGITMAJ=$(echo $LIBGIT | cut -d. -f1) && LIBGIT=$(echo $LIBGIT | cut -d. -f2) | 
					
						
							|  |  |  | 		if [[ "$LIBGITMAJ" -gt "0" || "$LIBGIT" -gt "25" ]] ; then | 
					
						
							| 
									
										
										
										
											2018-07-07 10:26:31 -07:00
										 |  |  | 			LIBGIT2_FROM_PKGCONFIG="-DLIBGIT2_FROM_PKGCONFIG=ON" | 
					
						
							|  |  |  | 		fi | 
					
						
							|  |  |  | 	fi | 
					
						
							| 
									
										
										
										
											2017-01-16 15:56:56 -08:00
										 |  |  | else | 
					
						
							|  |  |  | 	SH_LIB_EXT=so | 
					
						
							| 
									
										
										
										
											2015-02-17 13:10:45 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-01-16 15:56:56 -08:00
										 |  |  | 	LIBGIT_ARGS=" -DLIBGIT2_DYNAMIC=ON " | 
					
						
							| 
									
										
										
										
											2018-05-19 17:14:15 -07:00
										 |  |  | 	# check if we need to build libgit2 (and do so if necessary) | 
					
						
							|  |  |  | 	# first check pkgconfig (that will capture our own local build if | 
					
						
							|  |  |  | 	# this script has been run before) | 
					
						
							|  |  |  | 	if pkg-config --exists libgit2 ; then | 
					
						
							| 
									
										
										
										
											2020-04-09 16:52:33 -07:00
										 |  |  | 		LIBGIT=$(pkg-config --modversion libgit2) | 
					
						
							|  |  |  | 		LIBGITMAJ=$(echo $LIBGIT | cut -d. -f1) | 
					
						
							|  |  |  | 		LIBGIT=$(echo $LIBGIT | cut -d. -f2) | 
					
						
							|  |  |  | 		if [[ "$LIBGITMAJ" -gt "0" || "$LIBGIT" -gt "25" ]] ; then | 
					
						
							|  |  |  | 			LIBGIT2_FROM_PKGCONFIG="-DLIBGIT2_FROM_PKGCONFIG=ON" | 
					
						
							|  |  |  | 		fi | 
					
						
							| 
									
										
										
										
											2018-05-19 17:14:15 -07:00
										 |  |  | 	fi | 
					
						
							| 
									
										
										
										
											2020-04-09 16:52:33 -07:00
										 |  |  | 	if [[ "$LIBGITMAJ" -lt "1" && "$LIBGIT" -lt "26" ]] ; then | 
					
						
							| 
									
										
										
										
											2018-05-19 17:14:15 -07:00
										 |  |  | 		# maybe there's a system version that's new enough? | 
					
						
							| 
									
										
										
										
											2020-04-09 16:52:33 -07:00
										 |  |  | 		# Ugh that's uggly - read the ultimate filename, split at the last 'o' which gets us ".0.26.3" or ".1.0.0" | 
					
						
							|  |  |  | 		# since that starts with a dot, the field numbers in the cut need to be one higher | 
					
						
							| 
									
										
										
										
											2020-10-16 19:06:32 -07:00
										 |  |  | 		LDCONFIG=$(PATH=/sbin:/usr/sbin:$PATH which ldconfig) | 
					
						
							|  |  |  | 		if [ ! -z "$LDCONFIG" ] ; then | 
					
						
							|  |  |  | 			LIBGIT=$(realpath $("$LDCONFIG" -p | grep libgit2\\.so\\. | cut -d\  -f4) | awk -Fo '{ print $NF }') | 
					
						
							|  |  |  | 			LIBGITMAJ=$(echo $LIBGIT | cut -d. -f2) | 
					
						
							|  |  |  | 			LIBGIT=$(echo $LIBGIT | cut -d. -f3) | 
					
						
							|  |  |  | 		fi | 
					
						
							| 
									
										
										
										
											2017-07-04 01:45:05 +09:00
										 |  |  | 	fi | 
					
						
							| 
									
										
										
										
											2018-05-19 17:14:15 -07:00
										 |  |  | fi | 
					
						
							| 
									
										
										
										
											2017-01-16 15:56:56 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-05-20 10:53:02 +02:00
										 |  |  | if [[ $PLATFORM = Darwin && "$BUILD_DEPS" == "1" ]] ; then | 
					
						
							|  |  |  | 	# when building distributable binaries on a Mac, we cannot rely on anything from Homebrew, | 
					
						
							|  |  |  | 	# because that always requires the latest OS (how stupid is that - and they consider it a | 
					
						
							|  |  |  | 	# feature). So we painfully need to build the dependencies ourselves. | 
					
						
							| 
									
										
										
										
											2019-12-11 16:17:27 -05:00
										 |  |  | 	cd "$SRC" | 
					
						
							| 
									
										
										
										
											2020-09-12 17:33:37 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	./${SRC_DIR}/scripts/get-dep-lib.sh single . libz | 
					
						
							|  |  |  | 	pushd libz | 
					
						
							|  |  |  | 	# no, don't install pkgconfig files in .../libs/share/pkgconf - that's just weird | 
					
						
							|  |  |  | 	sed -i .bak 's/share\/pkgconfig/pkgconfig/' CMakeLists.txt | 
					
						
							|  |  |  | 	mkdir -p build | 
					
						
							|  |  |  | 	cd build | 
					
						
							|  |  |  | 	cmake "$OLDER_MAC_CMAKE" -DCMAKE_BUILD_TYPE="$DEBUGRELEASE" \
 | 
					
						
							|  |  |  | 		-DCMAKE_INSTALL_PREFIX="$INSTALL_ROOT" \
 | 
					
						
							|  |  |  | 		.. | 
					
						
							|  |  |  | 	make -j4 | 
					
						
							|  |  |  | 	make install | 
					
						
							|  |  |  | 	popd | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-01-22 18:55:08 +01:00
										 |  |  | 	./${SRC_DIR}/scripts/get-dep-lib.sh single . libcurl | 
					
						
							| 
									
										
										
										
											2018-05-20 10:53:02 +02:00
										 |  |  | 	pushd libcurl | 
					
						
							|  |  |  | 	bash ./buildconf | 
					
						
							|  |  |  | 	mkdir -p build | 
					
						
							|  |  |  | 	cd build | 
					
						
							| 
									
										
										
										
											2019-12-11 16:17:27 -05:00
										 |  |  | 	CFLAGS="$OLDER_MAC" ../configure --prefix="$INSTALL_ROOT" --with-darwinssl \
 | 
					
						
							| 
									
										
										
										
											2018-05-20 10:53:02 +02:00
										 |  |  | 		--disable-tftp --disable-ftp --disable-ldap --disable-ldaps --disable-imap --disable-pop3 --disable-smtp --disable-gopher --disable-smb --disable-rtsp | 
					
						
							|  |  |  | 	make -j4 | 
					
						
							|  |  |  | 	make install | 
					
						
							|  |  |  | 	popd | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-01-22 18:55:08 +01:00
										 |  |  | 	./${SRC_DIR}/scripts/get-dep-lib.sh single . openssl | 
					
						
							| 
									
										
										
										
											2019-11-07 13:13:36 +01:00
										 |  |  | 	pushd openssl | 
					
						
							|  |  |  | 	mkdir -p build | 
					
						
							|  |  |  | 	cd build | 
					
						
							| 
									
										
										
										
											2019-12-11 16:17:27 -05:00
										 |  |  | 	../Configure --prefix="$INSTALL_ROOT" --openssldir="$INSTALL_ROOT" "$OLDER_MAC" darwin64-x86_64-cc | 
					
						
							| 
									
										
										
										
											2019-11-07 13:13:36 +01:00
										 |  |  | 	make depend | 
					
						
							|  |  |  | 	# all the tests fail because the assume that openssl is already installed. Odd? Still thinks work | 
					
						
							|  |  |  | 	make -j4 -k | 
					
						
							|  |  |  | 	make -k install | 
					
						
							|  |  |  | 	popd | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-01-22 18:55:08 +01:00
										 |  |  | 	./${SRC_DIR}/scripts/get-dep-lib.sh single . libssh2 | 
					
						
							| 
									
										
										
										
											2018-05-20 10:53:02 +02:00
										 |  |  | 	pushd libssh2 | 
					
						
							|  |  |  | 	mkdir -p build | 
					
						
							|  |  |  | 	cd build | 
					
						
							| 
									
										
										
										
											2019-12-11 16:17:27 -05:00
										 |  |  | 	cmake "$OLDER_MAC_CMAKE" -DCMAKE_INSTALL_PREFIX="$INSTALL_ROOT" -DCMAKE_BUILD_TYPE=$DEBUGRELEASE -DBUILD_SHARED_LIBS=ON -DBUILD_TESTING=OFF -DBUILD_EXAMPLES=OFF .. | 
					
						
							| 
									
										
										
										
											2018-05-20 10:53:02 +02:00
										 |  |  | 	make -j4 | 
					
						
							|  |  |  | 	make install | 
					
						
							|  |  |  | 	popd | 
					
						
							| 
									
										
										
										
											2019-12-11 16:17:27 -05:00
										 |  |  | 	if [ "$PLATFORM" = Darwin ] ; then | 
					
						
							| 
									
										
										
										
											2018-07-07 11:31:44 -07:00
										 |  |  | 		# in order for macdeployqt to do its job correctly, we need the full path in the dylib ID | 
					
						
							| 
									
										
										
										
											2019-12-11 16:17:27 -05:00
										 |  |  | 		cd "$INSTALL_ROOT"/lib | 
					
						
							| 
									
										
										
										
											2018-07-07 11:31:44 -07:00
										 |  |  | 		NAME=$(otool -L libssh2.dylib | grep -v : | head -1 | cut -f1 -d\  | tr -d '\t') | 
					
						
							| 
									
										
										
										
											2019-12-11 16:17:27 -05:00
										 |  |  | 		echo "$NAME" | if grep -v / > /dev/null 2>&1 ; then | 
					
						
							| 
									
										
										
										
											2018-07-07 11:31:44 -07:00
										 |  |  | 			install_name_tool -id "$INSTALL_ROOT/lib/$NAME" "$INSTALL_ROOT/lib/$NAME" | 
					
						
							|  |  |  | 		fi | 
					
						
							|  |  |  | 	fi | 
					
						
							| 
									
										
										
										
											2018-05-20 10:53:02 +02:00
										 |  |  | fi | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-04-09 16:52:33 -07:00
										 |  |  | if [[ "$LIBGITMAJ" -lt "1" && "$LIBGIT" -lt "26" ]] ; then | 
					
						
							| 
									
										
										
										
											2017-01-16 15:56:56 -08:00
										 |  |  | 	LIBGIT_ARGS=" -DLIBGIT2_INCLUDE_DIR=$INSTALL_ROOT/include -DLIBGIT2_LIBRARIES=$INSTALL_ROOT/lib/libgit2.$SH_LIB_EXT " | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-12-11 16:17:27 -05:00
										 |  |  | 	cd "$SRC" | 
					
						
							| 
									
										
										
										
											2017-01-16 15:56:56 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-01-22 18:55:08 +01:00
										 |  |  | 	./${SRC_DIR}/scripts/get-dep-lib.sh single . libgit2 | 
					
						
							| 
									
										
										
										
											2018-05-16 12:46:41 +02:00
										 |  |  | 	pushd libgit2 | 
					
						
							| 
									
										
										
										
											2017-01-16 15:56:56 -08:00
										 |  |  | 	mkdir -p build | 
					
						
							|  |  |  | 	cd build | 
					
						
							| 
									
										
										
										
											2019-12-11 16:17:27 -05:00
										 |  |  | 	cmake "$OLDER_MAC_CMAKE" -DCMAKE_INSTALL_PREFIX="$INSTALL_ROOT" -DCMAKE_BUILD_TYPE="$DEBUGRELEASE" -DBUILD_CLAR=OFF .. | 
					
						
							| 
									
										
										
										
											2017-01-16 15:56:56 -08:00
										 |  |  | 	make -j4 | 
					
						
							|  |  |  | 	make install | 
					
						
							| 
									
										
										
										
											2018-05-16 12:46:41 +02:00
										 |  |  | 	popd | 
					
						
							| 
									
										
										
										
											2017-01-16 15:56:56 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-12-11 16:17:27 -05:00
										 |  |  | 	if [ "$PLATFORM" = Darwin ] ; then | 
					
						
							| 
									
										
										
										
											2017-01-16 15:56:56 -08:00
										 |  |  | 		# in order for macdeployqt to do its job correctly, we need the full path in the dylib ID | 
					
						
							| 
									
										
										
										
											2019-12-11 16:17:27 -05:00
										 |  |  | 		cd "$INSTALL_ROOT/lib" | 
					
						
							| 
									
										
										
										
											2017-01-16 15:56:56 -08:00
										 |  |  | 		NAME=$(otool -L libgit2.dylib | grep -v : | head -1 | cut -f1 -d\  | tr -d '\t') | 
					
						
							| 
									
										
										
										
											2019-12-11 16:17:27 -05:00
										 |  |  | 		echo "$NAME" | if grep -v / > /dev/null 2>&1 ; then | 
					
						
							| 
									
										
										
										
											2017-01-16 15:56:56 -08:00
										 |  |  | 			install_name_tool -id "$INSTALL_ROOT/lib/$NAME" "$INSTALL_ROOT/lib/$NAME" | 
					
						
							|  |  |  | 		fi | 
					
						
							| 
									
										
										
										
											2015-04-15 11:33:14 -07:00
										 |  |  | 	fi | 
					
						
							|  |  |  | fi | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-05-19 17:14:15 -07:00
										 |  |  | if [[ $PLATFORM = Darwin && "$BUILD_DEPS" == "1" ]] ; then | 
					
						
							|  |  |  | 	# when building distributable binaries on a Mac, we cannot rely on anything from Homebrew, | 
					
						
							|  |  |  | 	# because that always requires the latest OS (how stupid is that - and they consider it a | 
					
						
							|  |  |  | 	# feature). So we painfully need to build the dependencies ourselves. | 
					
						
							| 
									
										
										
										
											2019-12-11 16:17:27 -05:00
										 |  |  | 	cd "$SRC" | 
					
						
							| 
									
										
										
										
											2020-01-22 18:55:08 +01:00
										 |  |  | 	./${SRC_DIR}/scripts/get-dep-lib.sh single . libzip | 
					
						
							| 
									
										
										
										
											2018-05-19 17:14:15 -07:00
										 |  |  | 	pushd libzip | 
					
						
							|  |  |  | 	mkdir -p build | 
					
						
							|  |  |  | 	cd build | 
					
						
							| 
									
										
										
										
											2019-12-11 16:17:27 -05:00
										 |  |  | 	cmake "$OLDER_MAC_CMAKE" -DCMAKE_BUILD_TYPE="$DEBUGRELEASE" \
 | 
					
						
							|  |  |  | 		-DCMAKE_INSTALL_PREFIX="$INSTALL_ROOT" \
 | 
					
						
							| 
									
										
										
										
											2018-08-04 12:20:47 -07:00
										 |  |  | 		.. | 
					
						
							| 
									
										
										
										
											2018-05-19 17:14:15 -07:00
										 |  |  | 	make -j4 | 
					
						
							|  |  |  | 	make install | 
					
						
							|  |  |  | 	popd | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-01-22 18:55:08 +01:00
										 |  |  | 	./${SRC_DIR}/scripts/get-dep-lib.sh single . hidapi | 
					
						
							| 
									
										
										
										
											2018-05-19 17:14:15 -07:00
										 |  |  | 	pushd hidapi | 
					
						
							|  |  |  | 	# there is no good tag, so just build master | 
					
						
							|  |  |  | 	bash ./bootstrap | 
					
						
							|  |  |  | 	mkdir -p build | 
					
						
							|  |  |  | 	cd build | 
					
						
							| 
									
										
										
										
											2019-12-11 16:17:27 -05:00
										 |  |  | 	CFLAGS="$OLDER_MAC" ../configure --prefix="$INSTALL_ROOT" | 
					
						
							| 
									
										
										
										
											2018-05-19 17:14:15 -07:00
										 |  |  | 	make -j4 | 
					
						
							|  |  |  | 	make install | 
					
						
							|  |  |  | 	popd | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-01-22 18:55:08 +01:00
										 |  |  | 	./${SRC_DIR}/scripts/get-dep-lib.sh single . libusb | 
					
						
							| 
									
										
										
										
											2018-05-19 17:14:15 -07:00
										 |  |  | 	pushd libusb | 
					
						
							|  |  |  | 	bash ./bootstrap.sh | 
					
						
							|  |  |  | 	mkdir -p build | 
					
						
							|  |  |  | 	cd build | 
					
						
							| 
									
										
										
										
											2019-12-11 16:17:27 -05:00
										 |  |  | 	CFLAGS="$OLDER_MAC" ../configure --prefix="$INSTALL_ROOT" --disable-examples | 
					
						
							| 
									
										
										
										
											2018-05-19 17:14:15 -07:00
										 |  |  | 	make -j4 | 
					
						
							|  |  |  | 	make install | 
					
						
							|  |  |  | 	popd | 
					
						
							| 
									
										
										
										
											2020-09-12 17:33:37 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-10-31 16:09:26 -07:00
										 |  |  | 	./${SRC_DIR}/scripts/get-dep-lib.sh single . libmtp | 
					
						
							|  |  |  | 	pushd libmtp | 
					
						
							|  |  |  | 	echo 'N' | NOCONFIGURE="1" bash ./autogen.sh | 
					
						
							|  |  |  | 	mkdir -p build | 
					
						
							|  |  |  | 	cd build | 
					
						
							|  |  |  | 	CFLAGS="$OLDER_MAC" ../configure --prefix="$INSTALL_ROOT" | 
					
						
							|  |  |  | 	make -j4 | 
					
						
							|  |  |  | 	make install | 
					
						
							|  |  |  | 	popd | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-09-12 17:33:37 -07:00
										 |  |  | 	./${SRC_DIR}/scripts/get-dep-lib.sh single . libftdi1 | 
					
						
							|  |  |  | 	pushd libftdi1 | 
					
						
							|  |  |  | 	mkdir -p build | 
					
						
							|  |  |  | 	cd build | 
					
						
							|  |  |  | 	cmake "$OLDER_MAC_CMAKE" -DCMAKE_BUILD_TYPE="$DEBUGRELEASE" \
 | 
					
						
							|  |  |  | 		-DCMAKE_INSTALL_PREFIX="$INSTALL_ROOT" \
 | 
					
						
							|  |  |  | 		.. | 
					
						
							|  |  |  | 	make -j4 | 
					
						
							|  |  |  | 	make install | 
					
						
							|  |  |  | 	popd | 
					
						
							| 
									
										
										
										
											2018-05-19 17:14:15 -07:00
										 |  |  | fi | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-11-11 18:48:27 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-12-11 16:17:27 -05:00
										 |  |  | cd "$SRC" | 
					
						
							| 
									
										
										
										
											2015-02-17 13:10:45 -08:00
										 |  |  | 
 | 
					
						
							|  |  |  | # build libdivecomputer | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-01-22 18:55:08 +01:00
										 |  |  | cd ${SRC_DIR} | 
					
						
							| 
									
										
										
										
											2017-12-03 11:48:51 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-12-04 02:23:34 +01:00
										 |  |  | if [ ! -d libdivecomputer/src ] ; then | 
					
						
							| 
									
										
										
										
											2017-12-13 21:36:26 +02:00
										 |  |  | 	git submodule init | 
					
						
							| 
									
										
										
										
											2017-12-03 11:48:51 -08:00
										 |  |  | 	git submodule update --recursive | 
					
						
							| 
									
										
										
										
											2015-02-17 13:10:45 -08:00
										 |  |  | fi | 
					
						
							| 
									
										
										
										
											2017-12-03 11:48:51 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-12-10 21:23:44 -05:00
										 |  |  | mkdir -p "${BUILD_PREFIX}libdivecomputer/build" | 
					
						
							|  |  |  | cd "${BUILD_PREFIX}libdivecomputer/build" | 
					
						
							| 
									
										
										
										
											2016-02-02 10:17:51 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-01-22 18:55:08 +01:00
										 |  |  | if [ ! -f "$SRC"/${SRC_DIR}/libdivecomputer/configure ] ; then | 
					
						
							| 
									
										
										
										
											2017-01-16 10:12:17 -08:00
										 |  |  | 	# this is not a typo | 
					
						
							|  |  |  | 	# in some scenarios it appears that autoreconf doesn't copy the | 
					
						
							|  |  |  | 	# ltmain.sh file; running it twice, however, fixes that problem | 
					
						
							| 
									
										
										
										
											2020-01-22 18:55:08 +01:00
										 |  |  | 	autoreconf --install "$SRC"/${SRC_DIR}/libdivecomputer | 
					
						
							|  |  |  | 	autoreconf --install "$SRC"/${SRC_DIR}/libdivecomputer | 
					
						
							| 
									
										
										
										
											2015-02-17 13:10:45 -08:00
										 |  |  | fi | 
					
						
							| 
									
										
										
										
											2020-01-22 18:55:08 +01:00
										 |  |  | CFLAGS="$OLDER_MAC -I$INSTALL_ROOT/include $LIBDC_CFLAGS" "$SRC"/${SRC_DIR}/libdivecomputer/configure --prefix="$INSTALL_ROOT" --disable-examples | 
					
						
							| 
									
										
										
										
											2019-12-11 16:17:27 -05:00
										 |  |  | if [ "$PLATFORM" = Darwin ] ; then | 
					
						
							| 
									
										
										
										
											2018-10-03 15:56:27 +02:00
										 |  |  | 	# remove some copmpiler options that aren't supported on Mac | 
					
						
							|  |  |  | 	# otherwise the log gets very noisy | 
					
						
							| 
									
										
										
										
											2018-05-11 21:07:58 -07:00
										 |  |  | 	for i in $(find . -name Makefile) | 
					
						
							|  |  |  | 	do | 
					
						
							| 
									
										
										
										
											2019-12-11 16:17:27 -05:00
										 |  |  | 		sed -i .bak 's/-Wrestrict//;s/-Wno-unused-but-set-variable//' "$i" | 
					
						
							| 
									
										
										
										
											2018-05-11 21:07:58 -07:00
										 |  |  | 	done | 
					
						
							| 
									
										
										
										
											2018-10-03 15:56:27 +02:00
										 |  |  | 	# it seems that on my Mac some of the configure tests for libdivecomputer | 
					
						
							|  |  |  | 	# pass even though the feature tested for is actually missing | 
					
						
							|  |  |  | 	# let's hack around that | 
					
						
							|  |  |  | 	# touch config.status, recreate config.h and then disable HAVE_CLOCK_GETTIME | 
					
						
							|  |  |  | 	# this seems to work so that the Makefile doesn't re-run the | 
					
						
							|  |  |  | 	# configure process and overwrite all the changes we just made | 
					
						
							|  |  |  | 	touch config.status | 
					
						
							|  |  |  | 	make config.h | 
					
						
							|  |  |  | 	grep CLOCK_GETTIME config.h | 
					
						
							|  |  |  | 	sed -i .bak 's/^#define HAVE_CLOCK_GETTIME 1/#undef HAVE_CLOCK_GETTIME /' config.h | 
					
						
							| 
									
										
										
										
											2018-05-11 21:07:58 -07:00
										 |  |  | fi | 
					
						
							| 
									
										
										
										
											2015-02-17 13:10:45 -08:00
										 |  |  | make -j4 | 
					
						
							|  |  |  | make install | 
					
						
							| 
									
										
										
										
											2020-10-16 21:11:19 -07:00
										 |  |  | # make sure we know where the libdivecomputer.a was installed - sometimes it ends up in lib64, sometimes in lib | 
					
						
							|  |  |  | STATIC_LIBDC="$INSTALL_ROOT/$(grep ^libdir Makefile | cut -d/ -f2)/libdivecomputer.a" | 
					
						
							| 
									
										
										
										
											2015-02-17 13:10:45 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-12-11 16:17:27 -05:00
										 |  |  | if [ "$PLATFORM" = Darwin ] ; then | 
					
						
							| 
									
										
										
										
											2017-07-15 21:41:47 -07:00
										 |  |  | 	if [ -z "$CMAKE_PREFIX_PATH" ] ; then | 
					
						
							| 
									
										
										
										
											2019-12-11 16:17:27 -05:00
										 |  |  | 		libdir=$($QMAKE -query QT_INSTALL_LIBS) | 
					
						
							| 
									
										
										
										
											2017-07-15 21:41:47 -07:00
										 |  |  | 		if [ $? -eq 0 ]; then | 
					
						
							|  |  |  | 			export CMAKE_PREFIX_PATH=$libdir/cmake | 
					
						
							|  |  |  | 		elif [ -d "$HOME/Qt/5.9.1" ] ; then | 
					
						
							|  |  |  | 			export CMAKE_PREFIX_PATH=~/Qt/5.9.1/clang_64/lib/cmake | 
					
						
							|  |  |  | 		elif [ -d "$HOME/Qt/5.9" ] ; then | 
					
						
							|  |  |  | 			export CMAKE_PREFIX_PATH=~/Qt/5.9/clang_64/lib/cmake | 
					
						
							|  |  |  | 		elif [ -d "$HOME/Qt/5.8" ] ; then | 
					
						
							|  |  |  | 			export CMAKE_PREFIX_PATH=~/Qt/5.8/clang_64/lib/cmake | 
					
						
							|  |  |  | 		elif [ -d "$HOME/Qt/5.7" ] ; then | 
					
						
							|  |  |  | 			export CMAKE_PREFIX_PATH=~/Qt/5.7/clang_64/lib/cmake | 
					
						
							|  |  |  | 		elif [ -d "$HOME/Qt/5.6" ] ; then | 
					
						
							|  |  |  | 			export CMAKE_PREFIX_PATH=~/Qt/5.6/clang_64/lib/cmake | 
					
						
							|  |  |  | 		elif [ -d "$HOME/Qt/5.5" ] ; then | 
					
						
							|  |  |  | 			export CMAKE_PREFIX_PATH=~/Qt/5.5/clang_64/lib/cmake | 
					
						
							|  |  |  | 		elif [ -d /usr/local/opt/qt5/lib ] ; then | 
					
						
							|  |  |  | 			# Homebrew location for qt5 package | 
					
						
							|  |  |  | 			export CMAKE_PREFIX_PATH=/usr/local/opt/qt5/lib/cmake | 
					
						
							|  |  |  | 		else | 
					
						
							|  |  |  | 			echo "cannot find Qt 5.5 or newer in ~/Qt" | 
					
						
							|  |  |  | 			exit 1 | 
					
						
							|  |  |  | 		fi | 
					
						
							|  |  |  | 	fi | 
					
						
							|  |  |  | fi | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-12-11 16:17:27 -05:00
										 |  |  | cd "$SRC" | 
					
						
							| 
									
										
										
										
											2015-02-17 13:10:45 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-07-28 07:44:09 -07:00
										 |  |  | if [ "$BUILD_WITH_WEBKIT" = "1" ]; then | 
					
						
							| 
									
										
										
										
											2019-02-01 04:11:25 +02:00
										 |  |  | 	EXTRA_OPTS="-DNO_USERMANUAL=OFF" | 
					
						
							| 
									
										
										
										
											2017-07-28 07:44:09 -07:00
										 |  |  | else | 
					
						
							| 
									
										
										
										
											2019-02-01 04:11:25 +02:00
										 |  |  | 	EXTRA_OPTS="-DNO_USERMANUAL=ON" | 
					
						
							| 
									
										
										
										
											2017-07-28 07:44:09 -07:00
										 |  |  | fi | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-09-05 08:22:50 -07:00
										 |  |  | if [ "$QUICK" != "1" ] ; then | 
					
						
							|  |  |  | 	# build the googlemaps map plugin | 
					
						
							| 
									
										
										
										
											2016-06-22 18:17:25 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-12-11 16:17:27 -05:00
										 |  |  | 	cd "$SRC" | 
					
						
							| 
									
										
										
										
											2020-01-22 18:55:08 +01:00
										 |  |  | 	./${SRC_DIR}/scripts/get-dep-lib.sh single . googlemaps | 
					
						
							| 
									
										
										
										
											2019-09-05 08:22:50 -07:00
										 |  |  | 	pushd googlemaps | 
					
						
							|  |  |  | 	mkdir -p build | 
					
						
							|  |  |  | 	mkdir -p J10build | 
					
						
							|  |  |  | 	cd build | 
					
						
							|  |  |  | 	$QMAKE "INCLUDEPATH=$INSTALL_ROOT/include" ../googlemaps.pro | 
					
						
							|  |  |  | 	# on Travis the compiler doesn't support c++1z, yet qmake adds that flag; | 
					
						
							|  |  |  | 	# since things compile fine with c++11, let's just hack that away | 
					
						
							|  |  |  | 	# similarly, don't use -Wdata-time | 
					
						
							|  |  |  | 	if [ "$TRAVIS" = "true" ] ; then | 
					
						
							|  |  |  | 		mv Makefile Makefile.bak | 
					
						
							|  |  |  | 		cat Makefile.bak | sed -e 's/std=c++1z/std=c++11/g ; s/-Wdate-time//' > Makefile | 
					
						
							|  |  |  | 	fi | 
					
						
							|  |  |  | 	make -j4 | 
					
						
							|  |  |  | 	make install | 
					
						
							|  |  |  | 	popd | 
					
						
							| 
									
										
										
										
											2017-08-02 22:59:02 +03:00
										 |  |  | fi | 
					
						
							| 
									
										
										
										
											2016-06-22 18:17:25 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-06-04 11:53:31 -07:00
										 |  |  | # finally, build Subsurface | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-11-11 18:48:27 -08:00
										 |  |  | set -x | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-17 10:44:00 -08:00
										 |  |  | for (( i=0 ; i < ${#BUILDS[@]} ; i++ )) ; do | 
					
						
							|  |  |  | 	SUBSURFACE_EXECUTABLE=${BUILDS[$i]} | 
					
						
							|  |  |  | 	BUILDDIR=${BUILDDIRS[$i]} | 
					
						
							|  |  |  | 	echo "build $SUBSURFACE_EXECUTABLE in $BUILDDIR" | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-01-22 18:55:08 +01:00
										 |  |  | 	cd "$SRC"/${SRC_DIR} | 
					
						
							| 
									
										
										
										
											2019-12-10 21:23:44 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-18 11:20:05 -08:00
										 |  |  | 	# pull the plasma-mobile components from upstream if building Subsurface-mobile | 
					
						
							|  |  |  | 	if [ "$SUBSURFACE_EXECUTABLE" = "MobileExecutable" ] ; then | 
					
						
							|  |  |  | 		bash ./scripts/mobilecomponents.sh | 
					
						
							| 
									
										
										
										
											2020-12-03 12:42:09 -08:00
										 |  |  | 		EXTRA_OPTS="$EXTRA_OPTS -DECM_DIR=$SRC/$SRC_DIR/mobile-widgets/3rdparty/ECM" | 
					
						
							| 
									
										
										
										
											2016-01-18 11:20:05 -08:00
										 |  |  | 	fi | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-12-11 16:17:27 -05:00
										 |  |  | 	mkdir -p "$BUILDDIR" | 
					
						
							|  |  |  | 	cd "$BUILDDIR" | 
					
						
							| 
									
										
										
										
											2016-03-16 09:00:37 +01:00
										 |  |  | 	export CMAKE_PREFIX_PATH="$INSTALL_ROOT/lib/cmake;${CMAKE_PREFIX_PATH}" | 
					
						
							| 
									
										
										
										
											2019-12-11 16:17:27 -05:00
										 |  |  | 	cmake -DCMAKE_BUILD_TYPE="$DEBUGRELEASE" \
 | 
					
						
							|  |  |  | 		-DSUBSURFACE_TARGET_EXECUTABLE="$SUBSURFACE_EXECUTABLE" \
 | 
					
						
							|  |  |  | 		"$LIBGIT_ARGS" \
 | 
					
						
							|  |  |  | 		-DLIBDIVECOMPUTER_INCLUDE_DIR="$INSTALL_ROOT"/include \
 | 
					
						
							| 
									
										
										
										
											2020-10-16 21:11:19 -07:00
										 |  |  | 		-DLIBDIVECOMPUTER_LIBRARIES="$STATIC_LIBDC" \
 | 
					
						
							| 
									
										
										
										
											2019-12-11 16:17:27 -05:00
										 |  |  | 		-DCMAKE_PREFIX_PATH="$CMAKE_PREFIX_PATH" \
 | 
					
						
							|  |  |  | 		-DBTSUPPORT="$BTSUPPORT" \
 | 
					
						
							|  |  |  | 		-DCMAKE_INSTALL_PREFIX="$INSTALL_ROOT" \
 | 
					
						
							| 
									
										
										
										
											2018-07-07 10:26:31 -07:00
										 |  |  | 		$LIBGIT2_FROM_PKGCONFIG \
 | 
					
						
							| 
									
										
										
										
											2017-11-11 18:48:27 -08:00
										 |  |  | 		-DFORCE_LIBSSH=OFF \
 | 
					
						
							| 
									
										
										
										
											2019-12-11 16:17:27 -05:00
										 |  |  | 		$PRINTING $EXTRA_OPTS \
 | 
					
						
							| 
									
										
										
										
											2020-01-22 18:55:08 +01:00
										 |  |  | 		"$SRC"/${SRC_DIR} | 
					
						
							| 
									
										
										
										
											2016-01-17 10:44:00 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-12-11 16:17:27 -05:00
										 |  |  | 	if [ "$PLATFORM" = Darwin ] ; then | 
					
						
							| 
									
										
										
										
											2016-01-17 10:44:00 -08:00
										 |  |  | 		rm -rf Subsurface.app | 
					
						
							|  |  |  | 		rm -rf Subsurface-mobile.app | 
					
						
							|  |  |  | 	fi | 
					
						
							| 
									
										
										
										
											2015-06-02 10:43:13 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-17 10:44:00 -08:00
										 |  |  | 	LIBRARY_PATH=$INSTALL_ROOT/lib make -j4 | 
					
						
							| 
									
										
										
										
											2017-11-05 07:05:08 -08:00
										 |  |  | 	LIBRARY_PATH=$INSTALL_ROOT/lib make install | 
					
						
							| 
									
										
										
										
											2017-11-05 11:55:52 -08:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	if [ "$CREATE_APPDIR" = "1" ] ; then | 
					
						
							|  |  |  | 		# if we create an AppImage this makes gives us a sane starting point | 
					
						
							| 
									
										
										
										
											2019-12-11 16:17:27 -05:00
										 |  |  | 		cd "$SRC" | 
					
						
							| 
									
										
										
										
											2017-11-05 11:55:52 -08:00
										 |  |  | 		mkdir -p ./appdir | 
					
						
							|  |  |  | 		mkdir -p appdir/usr/share/metainfo | 
					
						
							|  |  |  | 		mkdir -p appdir/usr/share/icons/hicolor/256x256/apps | 
					
						
							|  |  |  | 		cp -r ./install-root/* ./appdir/usr | 
					
						
							| 
									
										
										
										
											2020-01-22 18:55:08 +01:00
										 |  |  | 		cp ${SRC_DIR}/appdata/subsurface.appdata.xml appdir/usr/share/metainfo/ | 
					
						
							|  |  |  | 		cp ${SRC_DIR}/icons/subsurface-icon.png appdir/usr/share/icons/hicolor/256x256/apps/ | 
					
						
							| 
									
										
										
										
											2017-11-05 11:55:52 -08:00
										 |  |  | 	fi | 
					
						
							| 
									
										
										
										
											2016-01-17 10:44:00 -08:00
										 |  |  | done |