commit f64f87fa62c9bb5a05e86d4aeb4d8fa8997b27d2
parent 625ab59ec875afa457538fab386bf6614b3309f8
Author: Alexander Kojevnikov <alexander@kojevnikov.com>
Date: Mon, 21 Feb 2011 18:51:39 +0800
osx: First take at moving to ige-mac-bundle
Diffstat:
10 files changed, 308 insertions(+), 94 deletions(-)
diff --git a/.gitignore b/.gitignore
@@ -1,41 +1,43 @@
+!src/spek-audio.c
+!src/spek-fft.c
+!src/spek-platform.c
+*.bz2
+*.msi
*~
+.DS_Store
+.deps
+.svn
+Makefile
+Makefile.in
+Makefile.in.in
aclocal.m4
autom4te.cache
-*.bz2
compile
config.*
configure
data/spek.desktop
data/spek.desktop.in
depcomp
-.deps
-.DS_Store
install-sh
intltool-extract.in
intltool-merge.in
intltool-update.in
libtool
ltmain.sh
-Makefile
-Makefile.in
-Makefile.in.in
missing
mkinstalldirs
-*.msi
omf.make
+osx/Spek.app
+osx/bin
+po/*.gmo
po/.intltool-merge-cache
po/POTFILES
po/stamp-it
-po/*.gmo
samples/
src/*.c
-!src/spek-audio.c
-!src/spek-fft.c
-!src/spek-platform.c
src/*.o
src/*.stamp
src/spek
stamp-h1
-.svn
test*
xmldocs.make
diff --git a/.gitmodules b/.gitmodules
@@ -1,3 +0,0 @@
-[submodule "bockbuild"]
- path = bockbuild
- url = git://github.com/alexkay/bockbuild.git
diff --git a/bockbuild b/bockbuild
@@ -1 +0,0 @@
-Subproject commit 436732d847cef8b8a7e448ffe387e0ddc042911f
diff --git a/bundle.sh b/bundle.sh
@@ -1,78 +0,0 @@
-#!/bin/sh
-
-# This script creates a Mac OS X app bundle and a DMG image from it using bockbuild.
-
-pushd $(dirname $0)
-
-case "$(uname)" in
- Darwin) profile_name=darwin ;;
- *)
- echo "Unsupported system type: $(uname)"
- exit 1
- ;;
-esac
-
-# Build Spek and all its dependencies
-pushd bockbuild/profiles/spek
-./profile."$profile_name".py -bvr
-
-# Build Solitary
-pushd ../../solitary
-make
-popd
-
-# Bundle
-./profile."$profile_name".py -z
-
-# Make DMG image
-cd bundle."$profile_name"
-VOLUME_NAME=Spek
-DMG_APP=Spek.app
-DMG_FILE=$VOLUME_NAME.dmg
-MOUNT_POINT=$VOLUME_NAME.mounted
-
-rm -f $DMG_FILE
-rm -f $DMG_FILE.master
-
-# Compute an approximated image size in MB, and bloat by 1MB
-image_size=$(du -ck $DMG_APP | tail -n1 | cut -f1)
-image_size=$((($image_size + 5000) / 1000))
-
-echo "Creating disk image (${image_size}MB)..."
-hdiutil create $DMG_FILE -megabytes $image_size -volname $VOLUME_NAME -fs HFS+ -quiet || exit $?
-
-echo "Attaching to disk image..."
-hdiutil attach $DMG_FILE -readwrite -noautoopen -mountpoint $MOUNT_POINT -quiet
-
-echo "Populating image..."
-
-cp -Rp $DMG_APP $MOUNT_POINT
-
-find $MOUNT_POINT -type d -iregex '.*\.svn$' &>/dev/null | xargs rm -rf
-
-pushd $MOUNT_POINT &>/dev/null
-ln -s /Applications " "
-popd &>/dev/null
-
-cp ../DS_Store $MOUNT_POINT/.DS_Store
-
-echo "Detaching from disk image..."
-hdiutil detach $MOUNT_POINT -quiet
-
-mv $DMG_FILE $DMG_FILE.master
-
-echo "Creating distributable image..."
-hdiutil convert -quiet -format UDBZ -o $DMG_FILE $DMG_FILE.master
-
-#echo "Installing end user license agreement..."
-#hdiutil flatten -quiet $DMG_FILE
-#/Developer/Tools/Rez /Developer/Headers/FlatCarbon/*.r dmg-data/license.r -a -o $DMG_FILE
-#hdiutil unflatten -quiet $DMG_FILE
-
-echo "Done."
-
-if [ ! "x$1" = "x-m" ]; then
- rm $DMG_FILE.master
-fi
-
-popd &>/dev/null
diff --git a/osx/Info.plist b/osx/Info.plist
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>CFBundleDevelopmentRegion</key>
+ <string>English</string>
+ <key>CFBundleExecutable</key>
+ <string>Spek</string>
+ <key>CFBundleGetInfoString</key>
+ <string>Spek 0.4</string>
+ <key>CFBundleIconFile</key>
+ <string>Spek.icns</string>
+ <key>CFBundleIdentifier</key>
+ <string>org.spek-project</string>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>6.0</string>
+ <key>CFBundlePackageType</key>
+ <string>APPL</string>
+ <key>CFBundleShortVersionString</key>
+ <string>0.4</string>
+ <key>CFBundleSignature</key>
+ <string>????</string>
+ <key>CFBundleVersion</key>
+ <string>0.4</string>
+ <key>NSHumanReadableCopyright</key>
+ <string>Copyright (c) 2010 Alexander Kojevnikov</string>
+ <key>LSMinimumSystemVersion</key>
+ <string>10.4</string>
+</dict>
+</plist>
diff --git a/osx/Spek.icns b/osx/Spek.icns
Binary files differ.
diff --git a/osx/bundle.sh b/osx/bundle.sh
@@ -0,0 +1,46 @@
+#!/bin/sh
+
+cd $(dirname $0)/..
+case "$(uname)" in
+ Darwin) profile_name=darwin ;;
+ *)
+ echo "Unsupported system type: $(uname)"
+ exit 1
+ ;;
+esac
+
+./autogen.sh --prefix=$(pwd)/osx/bin
+gmake
+gmake install
+
+ige-mac-bundler osx/spek.bundle
+
+# Make DMG image
+cd osx
+VOLUME_NAME=Spek
+DMG_APP=Spek.app
+DMG_FILE=$VOLUME_NAME.dmg
+MOUNT_POINT=$VOLUME_NAME.mounted
+
+rm -f $DMG_FILE
+rm -f $DMG_FILE.master
+
+# Compute an approximated image size in MB, and bloat by 1MB
+image_size=$(du -ck $DMG_APP | tail -n1 | cut -f1)
+image_size=$((($image_size + 5000) / 1000))
+
+echo "Creating disk image (${image_size}MB)..."
+hdiutil create $DMG_FILE -megabytes $image_size -volname $VOLUME_NAME -fs HFS+ -quiet || exit $?
+
+echo "Attaching to disk image..."
+hdiutil attach $DMG_FILE -readwrite -noautoopen -mountpoint $MOUNT_POINT -quiet
+
+echo "Populating image..."
+
+cp -Rp $DMG_APP $MOUNT_POINT
+
+find $MOUNT_POINT -type d -iregex '.*\.svn$' &>/dev/null | xargs rm -rf
+
+#pushd $MOUNT_POINT &>/dev/null
+
+cd ..
diff --git a/osx/gtkrc b/osx/gtkrc
@@ -0,0 +1,2 @@
+gtk-icon-theme-name = "Tango"
+gtk-enable-mnemonics = 0
diff --git a/osx/launcher.sh b/osx/launcher.sh
@@ -0,0 +1,168 @@
+#!/bin/sh
+
+if test "x$IGE_DEBUG_LAUNCHER" != x; then
+ set -x
+fi
+
+if test "x$IGE_DEBUG_GDB" != x; then
+ EXEC="gdb --args"
+else
+ EXEC=exec
+fi
+
+name="`basename $0`"
+tmp="`pwd`/$0"
+tmp=`dirname "$tmp"`
+tmp=`dirname "$tmp"`
+bundle=`dirname "$tmp"`
+bundle_contents="$bundle"/Contents
+bundle_res="$bundle_contents"/Resources
+bundle_lib="$bundle_res"/lib
+bundle_bin="$bundle_res"/bin
+bundle_data="$bundle_res"/share
+bundle_etc="$bundle_res"/etc
+
+export DYLD_LIBRARY_PATH="$bundle_lib"
+export XDG_CONFIG_DIRS="$bundle_etc"/xdg
+export XDG_DATA_DIRS="$bundle_data"
+export GTK_DATA_PREFIX="$bundle_res"
+export GTK_EXE_PREFIX="$bundle_res"
+export GTK_PATH="$bundle_res"
+
+export GTK2_RC_FILES="$bundle_etc/gtk-2.0/gtkrc"
+export GTK_IM_MODULE_FILE="$bundle_etc/gtk-2.0/gtk.immodules"
+export GDK_PIXBUF_MODULE_FILE="$bundle_etc/gtk-2.0/gdk-pixbuf.loaders"
+export PANGO_RC_FILE="$bundle_etc/pango/pangorc"
+
+APP=name
+I18NDIR="$bundle_data/locale"
+# Set the locale-related variables appropriately:
+unset LANG LC_MESSAGES LC_MONETARY LC_COLLATE
+
+# Has a language ordering been set?
+# If so, set LC_MESSAGES and LANG accordingly; otherwise skip it.
+# First step uses sed to clean off the quotes and commas, to change - to _, and change the names for the chinese scripts from "Hans" to CN and "Hant" to TW.
+APPLELANGUAGES=`defaults read .GlobalPreferences AppleLanguages | sed -En -e 's/\-/_/' -e 's/Hant/TW/' -e 's/Hans/CN/' -e 's/[[:space:]]*\"?([[:alnum:]_]+)\"?,?/\1/p' `
+if test "$APPLELANGUAGES"; then
+ # A language ordering exists.
+ # Test, item per item, to see whether there is an corresponding locale.
+ for L in $APPLELANGUAGES; do
+ #test for exact matches:
+ if test -f "$I18NDIR/${L}/LC_MESSAGES/$APP.mo"; then
+ export LANG=$L
+ break
+ fi
+ #This is a special case, because often the original strings are in US
+ #English and there is no translation file.
+ if test "x$L" == "xen_US"; then
+ export LANG=$L
+ break
+ fi
+ #OK, now test for just the first two letters:
+ if test -f "$I18NDIR/${L:0:2}/LC_MESSAGES/$APP.mo"; then
+ export LANG=${L:0:2}
+ break
+ fi
+ #Same thing, but checking for any english variant.
+ if test "x${L:0:2}" == "xen"; then
+ export LANG=$L
+ break
+ fi;
+ done
+fi
+unset APPLELANGUAGES L
+
+# If we didn't get a language from the language list, try the Collation preference, in case it's the only setting that exists.
+APPLECOLLATION=`defaults read .GlobalPreferences AppleCollationOrder`
+if test -z ${LANG} -a -n $APPLECOLLATION; then
+ if test -f "$I18NDIR/${APPLECOLLATION:0:2}/LC_MESSAGES/$APP.mo"; then
+ export LANG=${APPLECOLLATION:0:2}
+ fi
+fi
+if test ! -z $APPLECOLLATION; then
+ export LC_COLLATE=$APPLECOLLATION
+fi
+unset APPLECOLLATION
+
+# Continue by attempting to find the Locale preference.
+APPLELOCALE=`defaults read .GlobalPreferences AppleLocale`
+
+if test -f "$I18NDIR/${APPLELOCALE:0:5}/LC_MESSAGES/$APP.mo"; then
+ if test -z $LANG; then
+ export LANG="${APPLELOCALE:0:5}"
+ fi
+
+elif test -z $LANG -a -f "$I18NDIR/${APPLELOCALE:0:2}/LC_MESSAGES/$APP.mo"; then
+ export LANG="${APPLELOCALE:0:2}"
+fi
+
+#Next we need to set LC_MESSAGES. If at all possilbe, we want a full
+#5-character locale to avoid the "Locale not supported by C library"
+#warning from Gtk -- even though Gtk will translate with a
+#two-character code.
+if test -n $LANG; then
+#If the language code matches the applelocale, then that's the message
+#locale; otherwise, if it's longer than two characters, then it's
+#probably a good message locale and we'll go with it.
+ if test $LANG == ${APPLELOCALE:0:5} -o $LANG != ${LANG:0:2}; then
+ export LC_MESSAGES=$LANG
+#Next try if the Applelocale is longer than 2 chars and the language
+#bit matches $LANG
+ elif test $LANG == ${APPLELOCALE:0:2} -a $APPLELOCALE > ${APPLELOCALE:0:2}; then
+ export LC_MESSAGES=${APPLELOCALE:0:5}
+#Fail. Get a list of the locales in $PREFIX/share/locale that match
+#our two letter language code and pick the first one, special casing
+#english to set en_US
+ elif test $LANG == "en"; then
+ export LC_MESSAGES="en_US"
+ else
+ LOC=`find $PREFIX/share/locale -name $LANG???`
+ for L in $LOC; do
+ export LC_MESSAGES=$L
+ done
+ fi
+else
+#All efforts have failed, so default to US english
+ export LANG="en_US"
+ export LC_MESSAGES="en_US"
+fi
+CURRENCY=`echo $APPLELOCALE | sed -En 's/.*currency=([[:alpha:]]+).*/\1/p'`
+if test "x$CURRENCY" != "x"; then
+#The user has set a special currency. Gtk doesn't install LC_MONETARY files, but Apple does in /usr/share/locale, so we're going to look there for a locale to set LC_CURRENCY to.
+ if test -f /usr/local/share/$LC_MESSAGES/LC_MONETARY; then
+ if test -a `cat /usr/local/share/$LC_MESSAGES/LC_MONETARY` == $CURRENCY; then
+ export LC_MONETARY=$LC_MESSAGES
+ fi
+ fi
+ if test -z "$LC_MONETARY"; then
+ FILES=`find /usr/share/locale -name LC_MONETARY -exec grep -H $CURRENCY {} \;`
+ if test -n "$FILES"; then
+ export LC_MONETARY=`echo $FILES | sed -En 's%/usr/share/locale/([[:alpha:]_]+)/LC_MONETARY.*%\1%p'`
+ fi
+ fi
+fi
+#No currency value means that the AppleLocale governs:
+if test -z "$LC_MONETARY"; then
+ LC_MONETARY=${APPLELOCALE:0:5}
+fi
+#For Gtk, which only looks at LC_ALL:
+export LC_ALL=$LC_MESSAGES
+
+unset APPLELOCALE FILES LOC
+
+if test -f "$bundle_lib/charset.alias"; then
+ export CHARSETALIASDIR="$bundle_lib"
+fi
+
+# Extra arguments can be added in environment.sh.
+EXTRA_ARGS=
+if test -f "$bundle_res/environment.sh"; then
+ source "$bundle_res/environment.sh"
+fi
+
+# Strip out the argument added by the OS.
+if [ x`echo "x$1" | sed -e "s/^x-psn_.*//"` == x ]; then
+ shift 1
+fi
+
+$EXEC "$bundle_contents/MacOS/$name-bin" $* $EXTRA_ARGS
diff --git a/osx/spek.bundle b/osx/spek.bundle
@@ -0,0 +1,48 @@
+<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
+<app-bundle>
+ <meta>
+ <prefix name="default">/opt/local</prefix>
+ <destination overwrite="yes">${project}</destination>
+ <run-install-name-tool/>
+ <launcher-script>${project}/launcher.sh</launcher-script >
+ <gtk>gtk+-2.0</gtk>
+ </meta>
+ <plist>${project}/Info.plist</plist>
+ <main-binary dest="${bundle}/Contents/Resources/bin">
+ ${project}/bin/bin/spek
+ </main-binary>
+ <binary>
+ ${prefix}/lib/${gtkdir}/modules/*.so
+ </binary>
+ <binary>
+ ${prefix}/lib/${gtkdir}/${pkg:${gtk}:gtk_binary_version}/engines/*.so
+ </binary>
+ <binary>
+ ${prefix}/lib/pango/${pkg:pango:pango_module_version}/modules/pango-basic-atsui.so
+ </binary>
+
+ <!-- translations name="gtk20">
+ ${prefix}/share/locale
+ </translations -->
+
+ <data dest="${bundle}/Contents/Resources/share">
+ ${project}/bin/share
+ </data>
+
+ <!-- Copy in the themes data. You may want to trim this to save space
+ in your bundle. -->
+ <!-- data>
+ ${prefix}/share/themes
+ </data -->
+
+ <data dest="${bundle}/Contents/Resources">
+ ${project}/Spek.icns
+ </data>
+ <data dest="${bundle}/Contents/Resources/etc/${gtkdir}/gtkrc">
+ ${project}/gtkrc
+ </data>
+
+ <!-- icon-theme icons="auto">
+ Tango
+ </icon-theme -->
+</app-bundle>