Merge branch 'mac-dmg'

This commit is contained in:
Dirk Hohndel 2013-02-15 02:34:33 -08:00
commit 4790850a60
3 changed files with 87 additions and 22 deletions

View file

@ -4,23 +4,27 @@ Creating a Subsurface bundle
(we now have a small shell script that should automate this process; (we now have a small shell script that should automate this process;
look for make-package.sh) look for make-package.sh)
install gtk-mac-bundler (this has been tested with version 0.7.0) and run After you build Subsurface and install it on your Mac
make install-macosx
you need gtk-mac-bundler (this has been tested with version 0.7.3); run
$ gtk-mac-bundler subsurface.bundle $ gtk-mac-bundler subsurface.bundle
This should install a self-contained Subsurface application under This should install an almost self-contained Subsurface application under
./staging/Subsurface.app ./staging/Subsurface.app
Sadly because of the way gettext accesses the gtk20.mo file, this fails Sadly because of the way gettext accesses the gtk20.mo file, this fails
for localized use - in that case you need to rebuild MacPorts with for localized use - so I ended up building MacPorts with
-prefix /Applications/Subsurface.app/Contents/Resources -prefix /Applications/Subsurface.app/Contents/Resources
And then things work correctly IFF the app gets installed with that path. And then things work correctly IFF the app gets installed with that path.
What a pain. What a pain.
Worse, gtk-mac-bundler misses fails to catch the .so files that Worse, gtk-mac-bundler fails to catch the .so files that are part of the
are part of the gdk-pixbuf loader infrastructure. So we need to gdk-pixbuf loader infrastructure. So we need to manually adjust the load
manually adjust the load paths in them: paths in them:
cd packaging/macosx/staging/Subsurface.app/Contents cd packaging/macosx/staging/Subsurface.app/Contents
for i in Resources/lib/gdk-pixbuf-2.0/2.10.0/loaders/* ; do \ for i in Resources/lib/gdk-pixbuf-2.0/2.10.0/loaders/* ; do \
@ -32,10 +36,23 @@ Finally, you need to change the IDs of the libraries:
for i in Resources/lib/*.dylib; do install_name_tool -id "@executable_path/../$i" $i; done for i in Resources/lib/*.dylib; do install_name_tool -id "@executable_path/../$i" $i; done
You still need to manually build a DMG if you want to easily distribute this. Next you should sign your binaries if you plan to use them 10.8 (or later).
cd ../../.. Then you can use git://github.com/dirkhh/yoursway-create-dmg.git to create
hdiutil create -volname Subsurface -srcfolder staging Subsurface-<version>.dmg a DMG (use the readlink-fix branch - unless this has been pulled into the
main project by the time you read this).
Here is roughly how I run this to create the official DMG
~/yoursway-create-dmg/create-dmg --background ./Subsurface-Background.png \
--window-size 500 300 --icon-size 96 \
--volname "Subsurface-${VERSION}" --app-drop-link 380 205 \
--volicon ~/subsurface/packaging/macosx/Subsurface.icns \
--icon "Subsurface" 110 205 ./Subsurface-${VERSION}.dmg ./staging
The --volicon doesn't appear to work for me even though it does create the
correct file in the DMG. I'm leaving it in here to remind me to
investigate this issue.
Caveats Caveats
------- -------
@ -44,7 +61,9 @@ Caveats
$ sudo port install pango +builtin_modules +no_x11 +quartz $ sudo port install pango +builtin_modules +no_x11 +quartz
Without the builtin modules the installed application fails to find the modules and doesn't render any text. Without the builtin modules the installed application fails to find the
modules and doesn't render any text.
Also note the comment above about the -prefix Also note the comment above about the -prefix
* It seems that gtk-mac-bundler expects the charset.alias file to be * It seems that gtk-mac-bundler expects the charset.alias file to be
@ -53,6 +72,6 @@ Also note the comment above about the -prefix
$ sudo cp /usr/lib/charset.alias /opt/local/lib $ sudo cp /usr/lib/charset.alias /opt/local/lib
* libdivecomputer needs to be configured with --with-prefix=/opt/local * libdivecomputer needs to be configured with
(or /Applications/Subsurface.app/Contents/Resources for localized builds) --with-prefix=/Applications/Subsurface.app/Contents/Resources
as well.

View file

@ -1,20 +1,45 @@
#!/bin/bash #!/bin/bash
# #
# this simply automates the steps to create a DMG we can ship # this simply automates the steps to create a DMG we can ship
#
# for this to work you need to have a custom build of MacPorts / gtk / etc # for this to work you need to have a custom build of MacPorts / gtk / etc
# with prefix=/Applications/Subsurface.app/Contents/Resources # with prefix=/Applications/Subsurface.app/Contents/Resources
# yes, that's a major hack, but otherwise gettext cannot seem to find # yes, that's a major hack, but otherwise gettext cannot seem to find
# the gtk related .mo files and localization is only partial # the gtk related .mo files and localization is only partial
# #
# run this from the packaging/macosx directory # run this from the top subsurface directory
VERSION=`grep -1 CFBundleVersionString Info.plist | tail -1 | cut -d\> -f 2 | cut -d\< -f 1` # adjust to your install location of gtk-mac-bundler. I appear to need at
BUNDLER="../../../.local/bin/gtk-mac-bundler" # least 0.7.2
BUNDLER="../.local/bin/gtk-mac-bundler"
BUNDLER_SRC="${HOME}/gtk-mac-bundler"
${BUNDLER} subsurface.bundle # install location of yourway-create-dmg
DMGCREATE="../yoursway-create-dmg/create-dmg"
# This is the directory into which MacPorts, libdivecomputer and all the
# other components have been installed
PREFIX="/Applications/Subsurface.app/Contents/Resources"
# maybe we want to update this to use the git tag magic instead. That
# would be more consistent
VERSION=`grep -1 CFBundleVersionString packaging/macosx/Info.plist | tail -1 | cut -d\> -f 2 | cut -d\< -f 1`
# gtk-mac-bundler allegedly supports signing by setting this environment
# variable, but this fails as we change the shared objects below and all
# the signatures become invalid.
# export APPLICATION_CERT="Dirk"
# first clean up the staging area
rm -rf ./staging
# now populate it with the bundle
${BUNDLER} packaging/macosx/subsurface.bundle
# correct the paths and names
cd staging/Subsurface.app/Contents cd staging/Subsurface.app/Contents
for i in Resources/lib/gdk-pixbuf-2.0/2.10.0/loaders/* ; do for i in Resources/lib/gdk-pixbuf-2.0/2.10.0/loaders/* ; do
~/gtk-mac-bundler/bundler/run-install-name-tool-change.sh $i /Applications/Subsurface.app/Contents/Resources Resources change ; ${BUNDLER_SRC}/bundler/run-install-name-tool-change.sh $i ${PREFIX} Resources change ;
done done
for i in Resources/lib/*.dylib; for i in Resources/lib/*.dylib;
do do
@ -22,8 +47,18 @@ do
done done
cd ../../.. cd ../../..
if [ -f Subsurface-${VERSION}.dmg ]; then
mv Subsurface-${VERSION}.dmg Subsurface-${VERSION}.dmg.bak codesign -s Dirk ./staging/Subsurface.app/Contents/MacOS/subsurface \
fi ./staging/Subsurface.app/Contents/MacOS/subsurface-bin
hdiutil create -volname Subsurface -srcfolder staging Subsurface-${VERSION}.dmg
if [ -f ./Subsurface-${VERSION}.dmg ]; then
rm ./Subsurface-${VERSION}.dmg.bak
mv ./Subsurface-${VERSION}.dmg ./Subsurface-${VERSION}.dmg.bak
fi
${DMGCREATE} --background ./packaging/macosx/DMG-Background.png \
--window-size 500 300 --icon-size 96 --volname Subsurface-${VERSION} \
--app-drop-link 380 205 \
--volicon ~/subsurface/packaging/macosx/Subsurface.icns \
--icon "Subsurface" 110 205 ./Subsurface-${VERSION}.dmg ./staging

View file

@ -110,6 +110,17 @@
${prefix}/share/themes ${prefix}/share/themes
</data> </data>
<!-- Copy the mime.cache -->
<data>
${prefix}/share/mime/mime.cache
</data>
<!-- Copy the jpeg library that is missed by the dependency generation
-->
<data>
${prefix}/lib/libjpeg.9.dylib
</data>
<!-- Copy icons. Note that the .icns file is an Apple format which <!-- Copy icons. Note that the .icns file is an Apple format which
contains up to 4 sizes of icon. You can use contains up to 4 sizes of icon. You can use
/Developer/Applications/Utilities/Icon Composer.app to import /Developer/Applications/Utilities/Icon Composer.app to import