| 
									
										
										
										
											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) | 
					
						
							| 
									
										
										
										
											2020-12-29 11:00:13 -08:00
										 |  |  | # ./subsurface/build-downloader       (headless downloader 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 | 
					
						
							| 
									
										
										
										
											2020-12-29 11:00:13 -08:00
										 |  |  | # one exception is running autotools for libdiveconputer which has to | 
					
						
							| 
									
										
										
										
											2019-12-10 21:23:44 -05:00
										 |  |  | # 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" | 
					
						
							| 
									
										
										
										
											2022-04-10 13:46:50 -10:00
										 |  |  | ARCHS="" | 
					
						
							| 
									
										
										
										
											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" | 
					
						
							| 
									
										
										
										
											2022-04-26 21:20:06 -07:00
										 |  |  | 			;; | 
					
						
							| 
									
										
										
										
											2017-07-28 07:44:09 -07:00
										 |  |  | 		-build-deps) | 
					
						
							| 
									
										
										
										
											2020-12-29 11:00:13 -08:00
										 |  |  | 			# in order to build the dependencies on Mac for release builds (to deal with the macosx-version-min for those) | 
					
						
							| 
									
										
										
										
											2017-07-28 07:44:09 -07:00
										 |  |  | 			# call this script with -build-deps | 
					
						
							|  |  |  | 			BUILD_DEPS="1" | 
					
						
							|  |  |  | 			;; | 
					
						
							| 
									
										
										
										
											2023-12-08 15:23:53 -08:00
										 |  |  | 		-prep-only) | 
					
						
							|  |  |  | 			# use this script to build dependencies and set things up with default values, but don't actually run | 
					
						
							|  |  |  | 			# the build | 
					
						
							|  |  |  | 			PREP_ONLY="1" | 
					
						
							|  |  |  | 			;; | 
					
						
							| 
									
										
										
										
											2022-04-10 13:46:50 -10:00
										 |  |  | 		-fat-build) | 
					
						
							|  |  |  | 			# build a fat binary for macOS | 
					
						
							|  |  |  | 			# ignored on other platforms | 
					
						
							| 
									
										
										
										
											2022-04-27 21:05:40 -07:00
										 |  |  | 			# this implies a Qt6 build (as m1 isn't supported in Qt5) | 
					
						
							| 
									
										
										
										
											2022-04-10 13:46:50 -10:00
										 |  |  | 			ARCHS="arm64 x86_64" | 
					
						
							| 
									
										
										
										
											2022-04-27 21:05:40 -07:00
										 |  |  | 			BUILD_WITH_QT6="1" | 
					
						
							| 
									
										
										
										
											2022-04-10 13:46:50 -10:00
										 |  |  | 			;; | 
					
						
							| 
									
										
										
										
											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" | 
					
						
							|  |  |  | 			;; | 
					
						
							| 
									
										
										
										
											2022-04-23 10:29:05 -07:00
										 |  |  | 		-build-with-qt6) | 
					
						
							|  |  |  | 			# Qt6 is not enabled by default as there are a few issues still with the port | 
					
						
							|  |  |  | 			# - by default the Qt6 packages don't include QtLocation, so no maps (see below) | 
					
						
							|  |  |  | 			# - WebKit doesn't work with Qt6, so no printing or in-app user manual | 
					
						
							|  |  |  | 			# - there are a few other random bugs that we still find here and there | 
					
						
							|  |  |  | 			# So by default we only try to build against Qt5. This overwrites that | 
					
						
							|  |  |  | 			BUILD_WITH_QT6="1" | 
					
						
							|  |  |  | 			;; | 
					
						
							| 
									
										
										
										
											2022-04-08 14:38:29 -10:00
										 |  |  | 		-build-with-map) | 
					
						
							|  |  |  | 			# Qt6 doesn't include QtLocation (as of Qt 6.3) - but you can build / install it from source. | 
					
						
							|  |  |  | 			# use this flag to force building googlemaps with Qt6 | 
					
						
							|  |  |  | 			BUILD_WITH_MAP="1" | 
					
						
							|  |  |  | 			;; | 
					
						
							| 
									
										
										
										
											2017-07-28 07:44:09 -07:00
										 |  |  | 		-mobile) | 
					
						
							|  |  |  | 			# we are building Subsurface-mobile | 
					
						
							| 
									
										
										
										
											2018-05-08 11:28:33 +02:00
										 |  |  | 			# Note that this will run natively on the host OS. | 
					
						
							| 
									
										
										
										
											2022-04-26 21:20:06 -07:00
										 |  |  | 			# To cross build for Android or iOS (including simulator) | 
					
						
							| 
									
										
										
										
											2018-05-08 11:28:33 +02:00
										 |  |  | 			# 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" | 
					
						
							|  |  |  | 			;; | 
					
						
							| 
									
										
										
										
											2020-12-19 09:30:49 -08:00
										 |  |  | 		-downloader) | 
					
						
							| 
									
										
										
										
											2020-12-29 11:00:13 -08:00
										 |  |  | 			# we are building Subsurface-downloader | 
					
						
							| 
									
										
										
										
											2020-12-19 09:30:49 -08:00
										 |  |  | 			BUILD_DOWNLOADER="1" | 
					
						
							|  |  |  | 			;; | 
					
						
							| 
									
										
										
										
											2017-07-28 07:44:09 -07:00
										 |  |  | 		-both) | 
					
						
							|  |  |  | 			# we are building Subsurface and Subsurface-mobile | 
					
						
							|  |  |  | 			BUILD_MOBILE="1" | 
					
						
							|  |  |  | 			BUILD_DESKTOP="1" | 
					
						
							|  |  |  | 			;; | 
					
						
							| 
									
										
										
										
											2020-12-19 09:30:49 -08:00
										 |  |  | 		-all) | 
					
						
							| 
									
										
										
										
											2020-12-29 11:00:13 -08:00
										 |  |  | 			# we are building Subsurface, Subsurface-mobile, and Subsurface-downloader | 
					
						
							| 
									
										
										
										
											2020-12-19 09:30:49 -08:00
										 |  |  | 			BUILD_MOBILE="1" | 
					
						
							|  |  |  | 			BUILD_DESKTOP="1" | 
					
						
							|  |  |  | 			BUILD_DOWNLOADER="1" | 
					
						
							|  |  |  | 			;; | 
					
						
							| 
									
										
										
										
											2023-12-09 03:31:18 +09:00
										 |  |  | 		-ftdi) | 
					
						
							|  |  |  | 			# make sure we include the user space FTDI drivers | 
					
						
							|  |  |  | 			FTDI="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" | 
					
						
							| 
									
										
										
										
											2024-02-07 08:43:30 -08:00
										 |  |  | 			echo "Usage: build.sh [-all] [-both] [-build-deps] [-build-prefix <PREFIX>] [-build-with-map] [-build-with-qt6] [-build-with-webkit] [-create-appdir] [-desktop] [-downloader] [-fat-build] [-ftdi] [-mobile] [-no-bt] [-prep-only] [-quick] [-release] [-src-dir <SUBSURFACE directory>] " | 
					
						
							| 
									
										
										
										
											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
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-01-09 14:04:40 -08:00
										 |  |  | # recreate the old default behavior - no flag set implies build desktop | 
					
						
							|  |  |  | if [ "$BUILD_MOBILE$BUILD_DOWNLOADER" = "" ] ; then | 
					
						
							|  |  |  | 	BUILD_DESKTOP="1" | 
					
						
							|  |  |  | fi | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											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 | 
					
						
							| 
									
										
										
										
											2021-05-17 19:43:51 -04:00
										 |  |  | 	elif [ -d  /Library/Developer/CommandLineTools/SDKs ] ; then | 
					
						
							|  |  |  | 		SDKROOT=/Library/Developer/CommandLineTools/SDKs | 
					
						
							| 
									
										
										
										
											2017-07-15 10:37:50 -07:00
										 |  |  | 	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 | 
					
						
							| 
									
										
										
										
											2021-05-17 19:43:51 -04:00
										 |  |  | 	# find a 10.x base SDK to use, or if none can be found, find a numbered 11.x base SDK to use | 
					
						
							| 
									
										
										
										
											2022-11-21 12:55:47 -08:00
										 |  |  | 	BASESDK=$(ls $SDKROOT | grep -E "MacOSX1[0-6]\.[0-9]+\.sdk" | head -1 | sed -e "s/MacOSX//;s/\.sdk//") | 
					
						
							| 
									
										
										
										
											2021-05-17 19:43:51 -04:00
										 |  |  | 	if [ -z "$BASESDK" ] ; then | 
					
						
							| 
									
										
										
										
											2022-11-21 12:55:47 -08:00
										 |  |  | 		echo "Cannot find a base SDK of type 1[0-6].x under the SDK root of ${SDKROOT}" | 
					
						
							|  |  |  | 		exit 1; | 
					
						
							| 
									
										
										
										
											2021-05-17 19:56:24 -04:00
										 |  |  | 	fi | 
					
						
							| 
									
										
										
										
											2022-04-10 13:46:50 -10:00
										 |  |  | 	if [ "$ARCHS" != "" ] ; then | 
					
						
							|  |  |  | 		# we do assume that the two architectures mentioned are x86_64 and arm64 .. that's kinda wrong | 
					
						
							|  |  |  | 		MAC_CMAKE="-DCMAKE_OSX_DEPLOYMENT_TARGET=${BASESDK} -DCMAKE_OSX_SYSROOT=${SDKROOT}/MacOSX${BASESDK}.sdk/ -DCMAKE_OSX_ARCHITECTURES='x86_64;arm64'" | 
					
						
							|  |  |  | 		MAC_OPTS="-mmacosx-version-min=${BASESDK} -isysroot${SDKROOT}/MacOSX${BASESDK}.sdk -arch arm64 -arch x86_64" | 
					
						
							|  |  |  | 	else | 
					
						
							|  |  |  | 		MAC_CMAKE="-DCMAKE_OSX_DEPLOYMENT_TARGET=${BASESDK} -DCMAKE_OSX_SYSROOT=${SDKROOT}/MacOSX${BASESDK}.sdk/" | 
					
						
							|  |  |  | 		MAC_OPTS="-mmacosx-version-min=${BASESDK} -isysroot${SDKROOT}/MacOSX${BASESDK}.sdk" | 
					
						
							| 
									
										
										
										
											2022-04-27 21:00:14 -07:00
										 |  |  | 		ARCHS=$(uname -m) # crazy, I know, but $(arch) results in the incorrect 'i386' on an x86_64 Mac | 
					
						
							| 
									
										
										
										
											2022-04-10 13:46:50 -10:00
										 |  |  | 	fi | 
					
						
							|  |  |  | 	# OpenSSL can't deal with multi arch build | 
					
						
							|  |  |  | 	MAC_OPTS_OPENSSL="-mmacosx-version-min=${BASESDK} -isysroot${SDKROOT}/MacOSX${BASESDK}.sdk" | 
					
						
							| 
									
										
										
										
											2021-05-17 19:56:24 -04:00
										 |  |  | 	echo "Using ${BASESDK} as the BASESDK under ${SDKROOT}" | 
					
						
							| 
									
										
										
										
											2021-05-17 19:43:51 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	if [[ ! -d /usr/include && ! -d "${SDKROOT}/MacOSX${BASESDK}.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 | 
					
						
							| 
									
										
										
										
											2020-12-19 09:30:49 -08:00
										 |  |  | # the user can explicitly pick the builds requested | 
					
						
							|  |  |  | # for historic reasons, -both builds mobile and desktop, -all builds the downloader as well | 
					
						
							| 
									
										
										
										
											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" | 
					
						
							| 
									
										
										
										
											2020-12-19 09:30:49 -08:00
										 |  |  | 	BUILDS+=( "MobileExecutable" ) | 
					
						
							|  |  |  | 	BUILDDIRS+=( "${BUILD_PREFIX}build-mobile" ) | 
					
						
							| 
									
										
										
										
											2017-07-28 07:44:09 -07:00
										 |  |  | fi | 
					
						
							| 
									
										
										
										
											2020-12-19 09:30:49 -08:00
										 |  |  | if [ "$BUILD_DOWNLOADER" = "1" ] ; then | 
					
						
							|  |  |  | 	echo "building Subsurface-downloader in ${SRC_DIR}/build-downloader" | 
					
						
							|  |  |  | 	BUILDS+=( "DownloaderExecutable" ) | 
					
						
							|  |  |  | 	BUILDDIRS+=( "${BUILD_PREFIX}build-downloader" ) | 
					
						
							|  |  |  | fi | 
					
						
							|  |  |  | if [ "$BUILD_DESKTOP" = "1" ] || [ "$BUILDS" = "" ] ; then | 
					
						
							|  |  |  | 	# if no option is given, we build the desktopb version | 
					
						
							| 
									
										
										
										
											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" ) | 
					
						
							| 
									
										
										
										
											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 | 
					
						
							| 
									
										
										
										
											2022-02-27 12:41:09 -08:00
										 |  |  | fi | 
					
						
							|  |  |  | if [[ -z $QMAKE  ||  ! -x $QMAKE ]] ; then | 
					
						
							| 
									
										
										
										
											2022-11-13 18:59:44 +01:00
										 |  |  | 	[ -z $QMAKE ] && [ "$BUILD_WITH_QT6" = "1" ] && hash qmake6 > /dev/null 2> /dev/null && QMAKE=qmake6 | 
					
						
							|  |  |  | 	[ -z $QMAKE ] && [ "$BUILD_WITH_QT6" = "1" ] && hash qmake-qt6 > /dev/null 2> /dev/null && QMAKE=qmake-qt6 | 
					
						
							|  |  |  | 	[ -z $QMAKE ] && hash qmake > /dev/null 2> /dev/null && QMAKE=qmake | 
					
						
							| 
									
										
										
										
											2018-09-05 17:12:44 -07:00
										 |  |  | 	[ -z $QMAKE ] && hash qmake-qt5 > /dev/null 2> /dev/null && QMAKE=qmake-qt5 | 
					
						
							| 
									
										
										
										
											2022-02-03 21:26:23 -08:00
										 |  |  | 	[ -z $QMAKE ] && hash qmake-qt6 > /dev/null 2> /dev/null && QMAKE=qmake-qt6 | 
					
						
							|  |  |  | 	[ -z $QMAKE ] && echo "cannot find qmake, qmake-qt5, or qmake-qt6" && exit 1 | 
					
						
							| 
									
										
										
										
											2017-08-26 09:36:27 -07:00
										 |  |  | fi | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-02-03 21:27:50 -08:00
										 |  |  | # grab the Qt version | 
					
						
							|  |  |  | QT_VERSION=$($QMAKE -query QT_VERSION) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-12-29 12:13:20 -08:00
										 |  |  | # it's not entirely clear why we only set this on macOS, but this appears to be what works | 
					
						
							|  |  |  | if [ "$PLATFORM" = Darwin ] ; then | 
					
						
							|  |  |  | 	if [ -z "$CMAKE_PREFIX_PATH" ] ; then | 
					
						
							|  |  |  | 		# we already found qmake and can get the right path information from that | 
					
						
							|  |  |  | 		libdir=$($QMAKE -query QT_INSTALL_LIBS) | 
					
						
							|  |  |  | 		if [ $? -eq 0 ]; then | 
					
						
							|  |  |  | 			export CMAKE_PREFIX_PATH=$libdir/cmake | 
					
						
							|  |  |  | 		else | 
					
						
							|  |  |  | 			echo "something is broken with the Qt install" | 
					
						
							|  |  |  | 			exit 1 | 
					
						
							|  |  |  | 		fi | 
					
						
							|  |  |  | 	fi | 
					
						
							|  |  |  | 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. | 
					
						
							| 
									
										
										
										
											2022-02-03 21:27:50 -08:00
										 |  |  | if [ "$PLATFORM" = Linux ] && [[ $QT_VERSION == 5* ]] ; then | 
					
						
							| 
									
										
										
										
											2019-12-11 16:17:27 -05:00
										 |  |  | 	QT_HEADERS_PATH=$($QMAKE -query QT_INSTALL_HEADERS) | 
					
						
							| 
									
										
										
										
											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
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-04-15 18:40:19 +02:00
										 |  |  | 		git clone --branch "v$QT_VERSION" https://code.qt.io/qt/qtlocation.git --depth=1 $QTLOC_GIT || | 
					
						
							|  |  |  | 			git clone --branch "v$QT_VERSION-lts-lgpl" https://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 | 
					
						
							| 
									
										
										
										
											2022-04-10 13:46:50 -10:00
										 |  |  | 	cmake $MAC_CMAKE -DCMAKE_BUILD_TYPE="$DEBUGRELEASE" \
 | 
					
						
							| 
									
										
										
										
											2020-09-12 17:33:37 -07:00
										 |  |  | 		-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 | 
					
						
							| 
									
										
										
										
											2022-04-10 13:46:50 -10:00
										 |  |  | 	CFLAGS="$MAC_OPTS" ../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 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-04-10 13:46:50 -10:00
										 |  |  | 	# openssl doesn't support fat binaries out of the box | 
					
						
							|  |  |  | 	# this tries to hack around this by first doing an install for x86_64, then a build for arm64 | 
					
						
							|  |  |  | 	# and then manually creating fat libraries from that | 
					
						
							|  |  |  | 	# I worry if there are issues with using the arm or x86 include files...??? | 
					
						
							| 
									
										
										
										
											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 | 
					
						
							| 
									
										
										
										
											2022-04-10 13:46:50 -10:00
										 |  |  | 	for ARCH in $ARCHS; do | 
					
						
							|  |  |  | 		mkdir -p build-$ARCH | 
					
						
							|  |  |  | 		cd build-$ARCH | 
					
						
							|  |  |  | 		OS_ARCH=darwin64-$ARCH-cc | 
					
						
							|  |  |  | 		../Configure --prefix="$INSTALL_ROOT" --openssldir="$INSTALL_ROOT" "$MAC_OPTS_OPENSSL" $OS_ARCH | 
					
						
							|  |  |  | 		make depend | 
					
						
							|  |  |  | 		# all the tests fail because the assume that openssl is already installed. Odd? Still things work | 
					
						
							|  |  |  | 		make -j4 -k | 
					
						
							|  |  |  | 		make -k install | 
					
						
							|  |  |  | 		cd .. | 
					
						
							|  |  |  | 	done | 
					
						
							|  |  |  | 	if [[ $ARCHS == *" "* ]] ; then | 
					
						
							|  |  |  | 		# now manually add the binaries together and overwrite them in the INSTALL_ROOT | 
					
						
							|  |  |  | 		cd build-arm64 | 
					
						
							|  |  |  | 		lipo -create ./libcrypto.a ../build-x86_64/libcrypto.a -output "$INSTALL_ROOT"/lib/libcrypto.a | 
					
						
							|  |  |  | 		lipo -create ./libssl.a ../build-x86_64/libssl.a -output "$INSTALL_ROOT"/lib/libssl.a | 
					
						
							|  |  |  | 		LIBSSLNAME=$(readlink libssl.dylib) | 
					
						
							|  |  |  | 		lipo -create ./$LIBSSLNAME ../build-x86_64/$LIBSSLNAME -output "$INSTALL_ROOT"/lib/$LIBSSLNAME | 
					
						
							|  |  |  | 		LIBCRYPTONAME=$(readlink libcrypto.dylib) | 
					
						
							|  |  |  | 		lipo -create ./$LIBCRYPTONAME ../build-x86_64/$LIBCRYPTONAME -output "$INSTALL_ROOT"/lib/$LIBCRYPTONAME | 
					
						
							|  |  |  | 	fi | 
					
						
							| 
									
										
										
										
											2019-11-07 13:13:36 +01:00
										 |  |  | 	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 | 
					
						
							| 
									
										
										
										
											2022-04-10 13:46:50 -10:00
										 |  |  | 	cmake $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 | 
					
						
							| 
									
										
										
										
											2022-04-10 13:46:50 -10:00
										 |  |  | 	cmake $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 | 
					
						
							| 
									
										
										
										
											2022-04-10 13:46:50 -10:00
										 |  |  | 	cmake $MAC_CMAKE -DCMAKE_BUILD_TYPE="$DEBUGRELEASE" \
 | 
					
						
							| 
									
										
										
										
											2019-12-11 16:17:27 -05:00
										 |  |  | 		-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 | 
					
						
							| 
									
										
										
										
											2022-04-10 13:46:50 -10:00
										 |  |  | 	CFLAGS="$MAC_OPTS" ../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 | 
					
						
							| 
									
										
										
										
											2022-04-10 13:46:50 -10:00
										 |  |  | 	CFLAGS="$MAC_OPTS" ../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 | 
					
						
							| 
									
										
										
										
											2022-04-08 14:38:29 -10:00
										 |  |  | 	patch -p1 < ../${SRC_DIR}/scripts/libmtp.patch || true | 
					
						
							| 
									
										
										
										
											2020-10-31 16:09:26 -07:00
										 |  |  | 	echo 'N' | NOCONFIGURE="1" bash ./autogen.sh | 
					
						
							| 
									
										
										
										
											2023-02-08 19:42:39 -06:00
										 |  |  | 	CFLAGS="$MAC_OPTS" ./configure --prefix="$INSTALL_ROOT" | 
					
						
							| 
									
										
										
										
											2020-10-31 16:09:26 -07:00
										 |  |  | 	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 | 
					
						
							| 
									
										
										
										
											2022-04-10 13:46:50 -10:00
										 |  |  | 	cmake $MAC_CMAKE -DCMAKE_BUILD_TYPE="$DEBUGRELEASE" \
 | 
					
						
							| 
									
										
										
										
											2020-09-12 17:33:37 -07:00
										 |  |  | 		-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 | 
					
						
							| 
									
										
										
										
											2022-04-10 13:46:50 -10:00
										 |  |  | CFLAGS="$MAC_OPTS -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
										 |  |  | cd "$SRC" | 
					
						
							| 
									
										
										
										
											2015-02-17 13:10:45 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-04-08 14:38:29 -10:00
										 |  |  | if [ "$QUICK" != "1" ] && [ "$BUILD_DESKTOP$BUILD_MOBILE" != "" ] && ( [[ $QT_VERSION == 5* ]] || [ "$BUILD_WITH_MAP" = "1" ] ); then | 
					
						
							| 
									
										
										
										
											2019-09-05 08:22:50 -07:00
										 |  |  | 	# 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 | 
					
						
							| 
									
										
										
										
											2022-04-08 14:38:29 -10:00
										 |  |  | 	if [ "$PLATFORM" = Darwin ]  && [[ $QT_VERSION == 6* ]]; then | 
					
						
							|  |  |  | 		# since we are currently building QtLocation from source, we don't have a way to easily install | 
					
						
							|  |  |  | 		# the private headers... so this is a bit of a hack to get those for googlemaps... | 
					
						
							| 
									
										
										
										
											2022-04-10 19:50:19 -10:00
										 |  |  | 		# regardless of whether we do a fat build or not, let's do the 'native' build here | 
					
						
							| 
									
										
										
										
											2022-04-27 21:00:14 -07:00
										 |  |  | 		$QMAKE "INCLUDEPATH=$INSTALL_ROOT/../qtlocation/build/include/QtLocation/6.3.0" QMAKE_APPLE_DEVICE_ARCHS="$(uname -m)" ../googlemaps.pro | 
					
						
							| 
									
										
										
										
											2022-04-08 14:38:29 -10:00
										 |  |  | 	else | 
					
						
							|  |  |  | 		$QMAKE "INCLUDEPATH=$INSTALL_ROOT/include" ../googlemaps.pro | 
					
						
							|  |  |  | 	fi | 
					
						
							| 
									
										
										
										
											2019-09-05 08:22:50 -07:00
										 |  |  | 	make -j4 | 
					
						
							| 
									
										
										
										
											2022-04-10 19:50:19 -10:00
										 |  |  | 	if [ "$PLATFORM" = Darwin ]  && [[ $QT_VERSION == 6* ]] && [[ $ARCHS == *" "* ]] ; then | 
					
						
							|  |  |  | 		# we can't build fat binaries directly here, so let's do it in two steps | 
					
						
							|  |  |  | 		# above we build the 'native' binary, now build the other one | 
					
						
							| 
									
										
										
										
											2022-04-27 21:00:14 -07:00
										 |  |  | 		OTHERARCH=${ARCHS//$(uname -m)/} | 
					
						
							| 
									
										
										
										
											2022-04-10 19:50:19 -10:00
										 |  |  | 		OTHERARCH=${OTHERARCH// /} | 
					
						
							|  |  |  | 		mkdir -p ../build-$OTHERARCH | 
					
						
							|  |  |  | 		cd ../build-$OTHERARCH | 
					
						
							|  |  |  | 		$QMAKE "INCLUDEPATH=$INSTALL_ROOT/../qtlocation/build/include/QtLocation/6.3.0" QMAKE_APPLE_DEVICE_ARCHS=$OTHERARCH ../googlemaps.pro | 
					
						
							|  |  |  | 		make -j4 | 
					
						
							|  |  |  | 		# now combine them into one .dylib | 
					
						
							|  |  |  | 		mkdir -p "$INSTALL_ROOT"/plugins/geoservices | 
					
						
							|  |  |  | 		lipo -create ./libqtgeoservices_googlemaps.dylib ../build/libqtgeoservices_googlemaps.dylib -output "$INSTALL_ROOT"/plugins/geoservices/libqtgeoservices_googlemaps.dylib | 
					
						
							|  |  |  | 	else | 
					
						
							|  |  |  | 		make install | 
					
						
							|  |  |  | 	fi | 
					
						
							| 
									
										
										
										
											2019-09-05 08:22:50 -07:00
										 |  |  | 	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-12-19 09:38:08 -08:00
										 |  |  | 	if [ "$SUBSURFACE_EXECUTABLE" = "DesktopExecutable" ] && [ "$BUILD_WITH_WEBKIT" = "1" ]; then | 
					
						
							|  |  |  | 		EXTRA_OPTS="-DNO_USERMANUAL=OFF -DNO_PRINTING=OFF" | 
					
						
							|  |  |  | 	else | 
					
						
							|  |  |  | 		EXTRA_OPTS="-DNO_USERMANUAL=ON -DNO_PRINTING=ON" | 
					
						
							|  |  |  | 	fi | 
					
						
							| 
									
										
										
										
											2023-12-09 03:31:18 +09:00
										 |  |  | 	if [ "$FTDI" = "1" ] ; then | 
					
						
							| 
									
										
										
										
											2023-12-08 14:52:14 -08:00
										 |  |  | 		EXTRA_OPTSi="$EXTRA_OPTS -DFTDISUPPORT=ON" | 
					
						
							| 
									
										
										
										
											2023-12-09 03:31:18 +09:00
										 |  |  | 	fi | 
					
						
							| 
									
										
										
										
											2022-04-23 10:29:05 -07:00
										 |  |  | 	if [ "$BUILD_WITH_QT6" = "1" ] ; then | 
					
						
							|  |  |  | 		EXTRA_OPTS="$EXTRA_OPTS -DBUILD_WITH_QT6=ON" | 
					
						
							|  |  |  | 	fi | 
					
						
							| 
									
										
										
										
											2020-12-19 09:38:08 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											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 \
 | 
					
						
							| 
									
										
										
										
											2020-12-19 09:38:08 -08:00
										 |  |  | 		$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
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-12-08 15:23:53 -08:00
										 |  |  | 	if [ ! "$PREP_ONLY" = "1" ] ; then | 
					
						
							|  |  |  | 		LIBRARY_PATH=$INSTALL_ROOT/lib make -j4 | 
					
						
							|  |  |  | 		LIBRARY_PATH=$INSTALL_ROOT/lib make install | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		if [ "$CREATE_APPDIR" = "1" ] ; then | 
					
						
							|  |  |  | 			# if we create an AppImage this makes gives us a sane starting point | 
					
						
							|  |  |  | 			cd "$SRC" | 
					
						
							|  |  |  | 			mkdir -p ./appdir | 
					
						
							|  |  |  | 			mkdir -p appdir/usr/share/metainfo | 
					
						
							|  |  |  | 			mkdir -p appdir/usr/share/icons/hicolor/256x256/apps | 
					
						
							|  |  |  | 			cp -r ./install-root/* ./appdir/usr | 
					
						
							| 
									
										
										
										
											2024-01-14 04:05:51 +00:00
										 |  |  | 			cp ${SRC_DIR}/metainfo/subsurface.metainfo.xml appdir/usr/share/metainfo/ | 
					
						
							| 
									
										
										
										
											2023-12-08 15:23:53 -08:00
										 |  |  | 			cp ${SRC_DIR}/icons/subsurface-icon.png appdir/usr/share/icons/hicolor/256x256/apps/ | 
					
						
							|  |  |  | 		fi | 
					
						
							| 
									
										
										
										
											2017-11-05 11:55:52 -08:00
										 |  |  | 	fi | 
					
						
							| 
									
										
										
										
											2016-01-17 10:44:00 -08:00
										 |  |  | done |