[gcompris/gcomprixogoo] Create the MacOSX bundle from a simple script.



commit e7f01907f5dbb45be49295a1e852cf8a3b288da6
Author: Bruno Coudoin <bruno ordinateur-de-bruno-coudoin local>
Date:   Sun Apr 25 23:35:38 2010 +0200

    Create the MacOSX bundle from a simple script.

 .gitignore                |    2 +-
 configure.ac              |    1 +
 macosx/.gitignore         |    4 ++
 macosx/GComprisAdmin      |  132 +++++++++++++++++++++++++++++++++++++++++++++
 macosx/Info.plist.in      |   30 ++++++++++
 macosx/InfoAdmin.plist.in |   30 ++++++++++
 macosx/configure_mac.sh   |    2 +
 macosx/createBundle.sh    |   23 ++++++++
 8 files changed, 223 insertions(+), 1 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index 33990a1..2b81fd7 100644
--- a/.gitignore
+++ b/.gitignore
@@ -29,7 +29,7 @@ intltool-merge.in
 intltool-update.in
 libtool
 ltmain.sh
-m4/
+m4
 missing
 mkinstalldirs
 win32-install-dir
diff --git a/configure.ac b/configure.ac
index f836ef1..117ac71 100644
--- a/configure.ac
+++ b/configure.ac
@@ -568,6 +568,7 @@ docs/eu/Makefile
 docs/fr/Makefile
 gcompris-installer.nsi
 macosx/Info.plist
+macosx/InfoAdmin.plist
 po/Makefile.in
 src/Makefile
 src/administration-activity/Makefile
diff --git a/macosx/.gitignore b/macosx/.gitignore
new file mode 100644
index 0000000..0197fbe
--- /dev/null
+++ b/macosx/.gitignore
@@ -0,0 +1,4 @@
+Info.plist
+InfoAdmin.plist
+GCompris
+GCompris.dmg
diff --git a/macosx/GComprisAdmin b/macosx/GComprisAdmin
new file mode 100755
index 0000000..a660b21
--- /dev/null
+++ b/macosx/GComprisAdmin
@@ -0,0 +1,132 @@
+#!/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"`
+# We point to the 'real' bundle relatively to where we are
+bundle=`dirname "$tmp"`/../GCompris.app
+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"
+
+export PYTHONPATH=$bundle_lib/python2.6/site-packages:$bundle_lib/python2.6/site-packages/gtk-2.0/:$bundle_lib/python2.6:$bundle_lib/python2.6/plat-darwin:$bundle_lib/python2.6/plat-mac:$bundle_lib/python2.6/lib-dynload
+
+# Set the locale-related variables appropriately:
+unset LANG LC_MESSAGES LC_MONETARY
+
+# Start by trying the Collation preference, in case it's the only setting that exists.
+APPLECOLLATION=`defaults read .GlobalPreferences AppleCollationOrder`
+if test "${APPLECOLLATION}"; then
+  COLL=`ls -d /usr/share/locale/${APPLECOLLATION}*.UTF-8 2>> /dev/null`
+  if test "${COLL}"; then
+    # $COLL is potentially multi-line; concatenate lines by not using quotes.
+    export LANG=`echo ${COLL} | awk '{print $1}' | awk -F/ '{print $5}'`
+  fi
+fi
+unset APPLECOLLATION COLL
+
+# Continue by attempting to find the Locale preference.
+APPLELOCALE=`defaults read .GlobalPreferences AppleLocale`
+if test "${APPLELOCALE}"; then
+    LOCALELANG=`echo "${APPLELOCALE}" | awk -F@ '{print $1".UTF-8"}'`
+    if test -d "/usr/share/locale/${LOCALELANG}"; then
+        export LANG="${LOCALELANG}"
+    fi
+fi
+unset LOCALELANG
+
+# If there is still no locale value, then set US English as a default.
+if test -z "${LANG}"; then
+    export LANG=en_US.UTF-8
+fi
+
+# The AppleLocale setting may contain a currency-related substring.
+# Attempt to act on it.
+# First strip the string to just the currency symbol and the language symbol
+APPLECURRENCY=`echo "${APPLELOCALE}" | awk -F= '{print $2}'`
+APPLELANG=`echo "${APPLELOCALE}" | awk -F_ '{print $1}'`
+if test "${APPLECURRENCY}"; then
+    # The user has set a currency different from that of their locale.
+    # Search for a locale that uses that currency, and set LC_MONETARY accordingly.
+
+    # First try to find an LC_MONETARY file that combines the language with the currency.
+    FILES=`find /usr/share/locale/${APPLELANG}*UTF-8 -name LC_MONETARY -exec grep -H $APPLECURRENCY {} \;`
+    if test -z "$FILES"; then
+        # Otherwise try to find any LC_MONETARY file that uses that currency.
+        FILES=`find /usr/share/locale/*UTF-8 -name LC_MONETARY -exec grep -H $APPLECURRENCY {} \;`
+    fi
+
+    if test "$FILES"; then
+        # We found a locale that matches; set LC_MONETARY.
+        export LC_MONETARY=`echo ${FILES} | awk -F: '{print $1}' | awk -F/ '{print $5}'`
+    fi
+fi
+unset APPLECURRENCY APPLELANG APPLELOCALE FILES
+
+# Has a language ordering been set?
+# If so, set LC_MESSAGES accordingly; otherwise skip it.
+APPLELANGUAGES=`defaults read .GlobalPreferences AppleLanguages | awk 'length > 2' | awk -F, '{print $1}' | sed s/\ //g | sed s/-/_/ | sed s/\"//g`
+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
+        POS=`echo ${L} | awk '{print index(ENVIRON["LANG"], $0)}'`
+        if test $POS -eq 1; then
+            # The language symbol is a subset of the $LANG variable. We're done!
+            break
+        fi
+        # NOTE: the following may fail for the alternate Chinese localizations.
+        LC=`ls -d /usr/share/locale/${L}*.UTF-8 2>> /dev/null`
+        # $LC is potentially multi-line; concatenate lines by not using quotes.
+        if test $LC; then
+            # There is a UTF-8 locale matching this language.
+            export LC_MESSAGES=`echo ${LC} | awk '{print $1}' | awk -F/ '{print $5}'`
+            break
+        fi
+    done
+fi
+unset APPLELANGUAGES POS LC L
+
+if test -f "$bundle_lib/charset.alias"; then
+    export CHARSETALIASDIR="$bundle_lib"
+fi
+
+# Extra arguments can be added in environment.sh.
+EXTRA_ARGS=-a
+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/GCompris-bin" $* $EXTRA_ARGS
diff --git a/macosx/Info.plist.in b/macosx/Info.plist.in
new file mode 100644
index 0000000..080f152
--- /dev/null
+++ b/macosx/Info.plist.in
@@ -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>GCompris</string>
+    <key>CFBundleGetInfoString</key>
+    <string>@VERSION@, Copyright 2000-2010 Bruno Coudoin and Others</string>
+    <key>CFBundleIconFile</key>
+    <string>GCompris.icns</string>
+    <key>CFBundleIdentifier</key>
+    <string>net.gcompris</string>
+    <key>CFBundleInfoDictionaryVersion</key>
+    <string>6.0</string>
+    <key>CFBundlePackageType</key>
+    <string>APPL</string>
+    <key>CFBundleShortVersionString</key>
+    <string>@VERSION@</string>
+    <key>CFBundleSignature</key>
+    <string>????</string>
+    <key>CFBundleVersion</key>
+    <string>@VERSION@</string>
+    <key>NSHumanReadableCopyright</key>
+    <string>Copyright 2000-2010 Bruno Coudoin and Others.</string>
+    <key>LSMinimumSystemVersion</key>
+    <string>10.4</string>
+</dict>
+</plist>
diff --git a/macosx/InfoAdmin.plist.in b/macosx/InfoAdmin.plist.in
new file mode 100644
index 0000000..b6c5b4b
--- /dev/null
+++ b/macosx/InfoAdmin.plist.in
@@ -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>GComprisAdmin</string>
+    <key>CFBundleGetInfoString</key>
+    <string>@VERSION@, Copyright 2000-2010 Bruno Coudoin and Others</string>
+    <key>CFBundleIconFile</key>
+    <string>GComprisAdmin.icns</string>
+    <key>CFBundleIdentifier</key>
+    <string>net.gcompris</string>
+    <key>CFBundleInfoDictionaryVersion</key>
+    <string>6.0</string>
+    <key>CFBundlePackageType</key>
+    <string>APPL</string>
+    <key>CFBundleShortVersionString</key>
+    <string>@VERSION@</string>
+    <key>CFBundleSignature</key>
+    <string>????</string>
+    <key>CFBundleVersion</key>
+    <string>@VERSION@</string>
+    <key>NSHumanReadableCopyright</key>
+    <string>Copyright 2000-2010 Bruno Coudoin and Others.</string>
+    <key>LSMinimumSystemVersion</key>
+    <string>10.4</string>
+</dict>
+</plist>
diff --git a/macosx/configure_mac.sh b/macosx/configure_mac.sh
new file mode 100755
index 0000000..f3ba84d
--- /dev/null
+++ b/macosx/configure_mac.sh
@@ -0,0 +1,2 @@
+cd ..
+./configure --prefix /Users/bruno/gtk/inst/ --libdir /Users/bruno/gtk/inst/lib --enable-shared --disable-static --enable-gnet --enable-py-build-only --with-python=/Users/bruno/gtk/inst/bin/python --enable-nsbundle --enable-sdlmixer
diff --git a/macosx/createBundle.sh b/macosx/createBundle.sh
new file mode 100755
index 0000000..40c9772
--- /dev/null
+++ b/macosx/createBundle.sh
@@ -0,0 +1,23 @@
+#!/bin/sh
+
+# First we create the bundle directory to host the bundle
+rm -rf GCompris
+echo "Creating the bundle dir"
+mkdir -p GCompris/GComprisAdmin.app/Contents/MacOS
+mkdir -p GCompris/GComprisAdmin.app/Contents/Resources
+echo -n "APPL????" > GCompris/GComprisAdmin.app/Contents/PkgInfo
+cp GComprisAdmin.icns GCompris/GComprisAdmin.app/Contents/Resources
+cp GComprisAdmin GCompris/GComprisAdmin.app/Contents/MacOS
+cp InfoAdmin.plist GCompris/GComprisAdmin.app/Contents/Info.plist
+cd GCompris
+ln -s /Applications .
+cd -
+
+# Create the bundle of the complete application
+echo "Create the bundle of the complete application"
+ige-mac-bundler gcompris.bundle
+
+# Create the distributable .dmg
+echo "Creating the final GCompris.dmg"
+rm -f GCompris.dmg
+./mkdmg GCompris



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]