Chris@232: #!/bin/bash Chris@232: Chris@232: # Execute this from the top-level directory of the project (the one Chris@232: # that contains the .app bundle). Chris@232: Chris@232: app=EasyMercurial Chris@232: Chris@232: version=`perl -p -e 's/^[^"]*"([^"]*)".*$/$1/' version.h` Chris@260: case "$version" in Chris@260: [0-9].[0-9]) bundleVersion="$version".0 ;; Chris@260: [0-9].[0-9].[0-9]) bundleVersion="$version" ;; Chris@260: *) echo "Error: Version $version is neither two- nor three-part number" ;; Chris@260: esac Chris@232: Chris@232: echo Chris@232: echo "Writing version $bundleVersion in to bundle." Chris@232: echo "(This should be a three-part number: major.minor.point)" Chris@232: Chris@232: perl -p -e "s/EASYHG_VERSION/$bundleVersion/" deploy/osx/Info.plist \ Chris@232: > "$app".app/Contents/Info.plist Chris@232: Chris@232: echo "Done: check $app.app for sanity please" Chris@232: Chris@232: echo Chris@256: echo "I expect you to have already copied QtCore, QtNetwork and QtGui to " Chris@256: echo "$app.app/Contents/Frameworks and PyQt4/QtCore.so and PyQt4/QtGui.so to " Chris@256: echo "$app.app/Contents/MacOS -- expect errors to follow if they're missing" Chris@256: echo Chris@256: Chris@256: echo "Fixing up loader paths in binaries..." Chris@256: Chris@256: install_name_tool -id QtCore "$app.app/Contents/Frameworks/QtCore" Chris@256: install_name_tool -id QtGui "$app.app/Contents/Frameworks/QtGui" Chris@256: install_name_tool -id QtNetwork "$app.app/Contents/Frameworks/QtNetwork" Chris@256: Chris@316: for fwk in QtCore QtGui QtNetwork; do Chris@316: find "$app.app" -type f -print | while read x; do Chris@316: current=$(otool -L "$x" | grep "$fwk.framework/" | awk '{ print $1; }') Chris@316: [ -z "$current" ] && continue Chris@316: echo "$x has $current" Chris@316: relative=$(echo "$x" | sed -e "s,$app.app/Contents/,," \ Chris@316: -e 's,[^/]*/,../,g' -e 's,/[^/]*$,/Frameworks/'"$fwk"',' ) Chris@316: echo "replacing with relative path $relative" Chris@316: install_name_tool -change "$current" "@loader_path/$relative" "$x" Chris@316: done Chris@316: done Chris@256: Chris@256: echo "Done: be sure to run the app and see that it works!" Chris@256: Chris@256: echo Chris@232: echo "Making dmg..." Chris@232: Chris@232: hdiutil create -srcfolder "$app".app "$app"-"$version".dmg -volname "$app"-"$version" Chris@232: Chris@232: echo "Done"