| 
									
										
										
										
											2017-11-11 18:48:27 -08:00
										 |  |  | #!/bin/bash
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-11-24 08:14:17 -08:00
										 |  |  | set -x | 
					
						
							|  |  |  | set -e | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-11-11 18:48:27 -08:00
										 |  |  | # this gets executed by Travis when building an App for Mac | 
					
						
							|  |  |  | # it gets started from inside the subsurface directory | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-05-19 06:14:57 -07:00
										 |  |  | export QT_ROOT=${TRAVIS_BUILD_DIR}/Qt/5.12.3/clang_64 | 
					
						
							| 
									
										
										
										
											2017-11-11 18:48:27 -08:00
										 |  |  | export PATH=$QT_ROOT/bin:$PATH # Make sure correct qmake is found on the $PATH | 
					
						
							|  |  |  | export CMAKE_PREFIX_PATH=$QT_ROOT/lib/cmake | 
					
						
							|  |  |  | export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | # the global build script expects to be called from the directory ABOVE subsurface | 
					
						
							|  |  |  | cd ${TRAVIS_BUILD_DIR}/.. | 
					
						
							|  |  |  | DIR=$(pwd) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-10-08 14:38:12 -07:00
										 |  |  | # first build Subsurface-mobile to ensure this didn't get broken | 
					
						
							|  |  |  | bash -e -x ./subsurface/scripts/build.sh -mobile | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | # now Subsurface with WebKit | 
					
						
							| 
									
										
										
										
											2018-07-09 10:50:52 -07:00
										 |  |  | bash -e -x ./subsurface/scripts/build.sh -desktop -build-with-webkit -release | 
					
						
							| 
									
										
										
										
											2017-11-11 18:48:27 -08:00
										 |  |  | 
 | 
					
						
							|  |  |  | cd ${TRAVIS_BUILD_DIR}/build | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-09-09 11:53:22 -07:00
										 |  |  | # build export-html to make sure that didn't get broken | 
					
						
							|  |  |  | make export-html | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-11-11 18:48:27 -08:00
										 |  |  | # first build and install Subsurface and then clean up the staging area | 
					
						
							|  |  |  | LIBRARY_PATH=${DIR}/install-root/lib make -j2 install | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | # now adjust a few references that macdeployqt appears to miss | 
					
						
							| 
									
										
										
										
											2020-10-07 12:46:06 -07:00
										 |  |  | # there used to be more - having the for-loop for just one seems overkill, but I | 
					
						
							|  |  |  | # wouldn't be surprised if there will be more again in the future, so leave it for now | 
					
						
							| 
									
										
										
										
											2017-11-11 18:48:27 -08:00
										 |  |  | EXECUTABLE=Subsurface.app/Contents/MacOS/Subsurface | 
					
						
							| 
									
										
										
										
											2020-10-07 12:46:06 -07:00
										 |  |  | for i in libgit2 ; do | 
					
						
							| 
									
										
										
										
											2017-11-11 18:48:27 -08:00
										 |  |  | 	OLD=$(otool -L ${EXECUTABLE} | grep $i | cut -d\  -f1 | tr -d "\t") | 
					
						
							| 
									
										
										
										
											2018-05-19 19:52:46 -07:00
										 |  |  | 	if [[ ! -z ${OLD} && ! -f Subsurface.app/Contents/Frameworks/$(basename ${OLD}) ]] ; then | 
					
						
							| 
									
										
										
										
											2017-11-11 18:48:27 -08:00
										 |  |  | 		# copy the library into the bundle and make sure its id and the reference to it are correct | 
					
						
							|  |  |  | 		cp ${DIR}/install-root/lib/$(basename ${OLD}) Subsurface.app/Contents/Frameworks | 
					
						
							|  |  |  | 		SONAME=$(basename $OLD) | 
					
						
							|  |  |  | 		install_name_tool -change ${OLD} @executable_path/../Frameworks/${SONAME} ${EXECUTABLE} | 
					
						
							|  |  |  | 		install_name_tool -id @executable_path/../Frameworks/${SONAME} Subsurface.app/Contents/Frameworks/${SONAME} | 
					
						
							|  |  |  | 	fi | 
					
						
							|  |  |  | done | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | # next, replace @rpath references with @executable_path references in Subsurface | 
					
						
							|  |  |  | RPATH=$(otool -L ${EXECUTABLE} | grep rpath  | cut -d\  -f1 | tr -d "\t" | cut -b 8- ) | 
					
						
							|  |  |  | for i in ${RPATH}; do | 
					
						
							|  |  |  | 	install_name_tool -change @rpath/$i @executable_path/../Frameworks/$i ${EXECUTABLE} | 
					
						
							|  |  |  | done | 
					
						
							|  |  |  | 
 |