changeset 335:aa852b477e4d

More OS/X deployment: Try to set shared library dependencies separately for each source arch
author Chris Cannam
date Wed, 02 Mar 2011 15:58:34 +0000
parents 67feb05754ee
children 4229b6a8e9c6
files deploy/osx/combine.sh deploy/osx/deploy.sh deploy/osx/paths.sh easyhg.pro
diffstat 4 files changed, 67 insertions(+), 46 deletions(-) [+]
line wrap: on
line diff
--- a/deploy/osx/combine.sh	Wed Mar 02 13:27:32 2011 +0000
+++ b/deploy/osx/combine.sh	Wed Mar 02 15:58:34 2011 +0000
@@ -1,30 +1,34 @@
 #!/bin/bash
-app=EasyMercurial.app
-if [ ! -d "$app.carbon" ] || [ ! -d "$app.cocoa" ]; then
+app=EasyMercurial
+if [ ! -d "$app.carbon.app" ] || [ ! -d "$app.cocoa.app" ]; then
 	echo Carbon or Cocoa bundle not found
 	exit 1
 fi
-(cd "$app.cocoa" ; find . -type f -print) | while read f; do
+(cd "$app.cocoa.app" ; find . -type f -print) | while read f; do
         d=$(dirname "$f")
-        mkdir -p "$app.output/$d"
-	case $(file "$app.cocoa/$f") in
+        mkdir -p "$app.app/$d"
+	case $(file "$app.cocoa.app/$f") in
+	*universal*x86_64*)
+		lipo "$app.cocoa.app/$f" -extract x86_64 -output "/tmp/$$.x86_64";;
 	*x86_64*)
-		lipo "$app.cocoa/$f" -extract x86_64 -output "/tmp/$$.x86_64"
-		case $(file "$app.carbon/$f") in
-		*x86_64*)
-			lipo "$app.carbon/$f" -remove x86_64 -output "/tmp/$$.rest"
-			;;
-		*)
-			cp "$app.carbon/$f" "/tmp/$$.rest"
-			;;
-		esac
-		lipo "/tmp/$$.x86_64" "/tmp/$$.rest" -create -output "$app.output/$f"
-		rm "/tmp/$$".*
+		lipo "$app.cocoa.app/$f" -create -output "/tmp/$$.x86_64";;
+	*)
+		cp "$app.cocoa.app/$f" "$app.app/$f"
+		continue;;
+	esac
+	case $(file "$app.carbon.app/$f") in
+	*x86_64*)
+		lipo "$app.carbon.app/$f" -remove x86_64 -output "/tmp/$$.rest"
+		;;
+	*universal*)
+		cp "$app.carbon.app/$f" "/tmp/$$.rest"
 		;;
 	*)
-		cp "$app.cocoa/$f" "$app.output/$f"
+		lipo "$app.carbon.app/$f" -create -output "/tmp/$$.rest"
 		;;
 	esac
+	lipo "/tmp/$$.x86_64" "/tmp/$$.rest" -create -output "$app.app/$f"
+	rm "/tmp/$$".*
 done
 
 
--- a/deploy/osx/deploy.sh	Wed Mar 02 13:27:32 2011 +0000
+++ b/deploy/osx/deploy.sh	Wed Mar 02 15:58:34 2011 +0000
@@ -19,37 +19,17 @@
 perl -p -e "s/EASYHG_VERSION/$bundleVersion/" deploy/osx/Info.plist \
     > "$app".app/Contents/Info.plist
 
-echo "Done: check $app.app for sanity please"
+echo "Done: check $app.app/Contents/Info.plist for sanity please"
 
-echo
-echo "I expect you to have already copied QtCore, QtNetwork and QtGui to "
-echo "$app.app/Contents/Frameworks and PyQt4/QtCore.so and PyQt4/QtGui.so to "
-echo "$app.app/Contents/MacOS -- expect errors to follow if they're missing"
-echo
-
-echo "Fixing up loader paths in binaries..."
-
-install_name_tool -id QtCore "$app.app/Contents/Frameworks/QtCore"
-install_name_tool -id QtGui "$app.app/Contents/Frameworks/QtGui"
-install_name_tool -id QtNetwork "$app.app/Contents/Frameworks/QtNetwork"
-
-for fwk in QtCore QtGui QtNetwork; do
-	find "$app.app" -type f -print | while read x; do
-		current=$(otool -L "$x" | grep "$fwk.framework/" | awk '{ print $1; }')
-		[ -z "$current" ] && continue
-		echo "$x has $current"
-		relative=$(echo "$x" | sed -e "s,$app.app/Contents/,," \
-			-e 's,[^/]*/,../,g' -e 's,/[^/]*$,/Frameworks/'"$fwk"',' )
-		echo "replacing with relative path $relative"
-		install_name_tool -change "$current" "@loader_path/$relative" "$x"
-	done
-done
-
-echo "Done: be sure to run the app and see that it works!"
+bash deploy/osx/paths.sh "$app"
 
 echo
 echo "Making dmg..."
 
-hdiutil create -srcfolder "$app".app "$app"-"$version".dmg -volname "$app"-"$version"
+mkdir "$app"-"$version" &&
+	ln -s /Applications "$app"-"$version"/Applications &&
+	cp -rp "$app".app "$app"-"$version"/ &&
+	hdiutil create -srcfolder "$app"-"$version" "$app"-"$version".dmg -volname "$app"-"$version" && 
+	rm -r "$app"-"$version"
 
 echo "Done"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/deploy/osx/paths.sh	Wed Mar 02 15:58:34 2011 +0000
@@ -0,0 +1,36 @@
+#!/bin/bash
+
+app="$1"
+if [ -z "$app" ]; then
+	echo "Usage: $0 <appname>"
+	echo "Provide appname without the .app extension, please"
+	exit 2
+fi
+
+echo
+echo "I expect you to have already copied QtCore, QtNetwork and QtGui to "
+echo "$app.app/Contents/Frameworks and PyQt4/QtCore.so and PyQt4/QtGui.so to "
+echo "$app.app/Contents/MacOS -- expect errors to follow if they're missing"
+echo
+
+echo "Fixing up loader paths in binaries..."
+
+install_name_tool -id QtCore "$app.app/Contents/Frameworks/QtCore"
+install_name_tool -id QtGui "$app.app/Contents/Frameworks/QtGui"
+install_name_tool -id QtNetwork "$app.app/Contents/Frameworks/QtNetwork"
+
+for fwk in QtCore QtGui QtNetwork; do
+        find "$app.app" -type f -print | while read x; do
+                current=$(otool -L "$x" | grep "$fwk.framework/" | awk '{ print $1; }')
+                [ -z "$current" ] && continue
+                echo "$x has $current"
+                relative=$(echo "$x" | sed -e "s,$app.app/Contents/,," \
+                        -e 's,[^/]*/,../,g' -e 's,/[^/]*$,/Frameworks/'"$fwk"',' )
+                echo "replacing with relative path $relative"
+                install_name_tool -change "$current" "@loader_path/$relative" "$x"
+        done
+done
+
+echo "Done: be sure to run the app and see that it works!"
+
+
--- a/easyhg.pro	Wed Mar 02 13:27:32 2011 +0000
+++ b/easyhg.pro	Wed Mar 02 15:58:34 2011 +0000
@@ -4,17 +4,18 @@
 TEMPLATE = app
 TARGET = EasyMercurial
 
+# We use the 10.4 SDK and Carbon for all 32-bit OS/X,
+# and 10.6 with Cocoa for all 64-bit
 macx-g++40 {
     # Note, to use the 10.4 SDK on 10.6+ you need qmake -spec macx-g++40
     QMAKE_MAC_SDK = /Developer/SDKs/MacOSX10.4u.sdk
     QMAKE_CFLAGS += -mmacosx-version-min=10.4
     QMAKE_CXXFLAGS += -mmacosx-version-min=10.4
-    QMAKE_LFLAGS_RELEASE += -bind_at_load
     CONFIG += x86 ppc 
 }
 macx-g++ {
     QMAKE_MAC_SDK = /Developer/SDKs/MacOSX10.6.sdk
-    CONFIG += x86 x86_64
+    CONFIG += x86_64
 }
 
 unix {