[geany/geany-osx] 69345e: Add initial version of GTK 3 bundling script

Jiří Techet git-noreply at xxxxx
Sun May 22 10:18:15 UTC 2016


Branch:      refs/heads/master
Author:      Jiří Techet <techet at gmail.com>
Committer:   Jiří Techet <techet at gmail.com>
Date:        Sun, 22 May 2016 10:18:15 UTC
Commit:      69345eeaf9ec3641d71aef0b496b9d17cd444fa1
             https://github.com/geany/geany-osx/commit/69345eeaf9ec3641d71aef0b496b9d17cd444fa1

Log Message:
-----------
Add initial version of GTK 3 bundling script

Not using custom theme yet.

Clean up GTK 2 bundling script on the way a bit.


Modified Paths:
--------------
    geany-gtk3.bundle
    geany.bundle
    launcher-gtk3.sh

Modified: geany-gtk3.bundle
149 lines changed, 149 insertions(+), 0 deletions(-)
===================================================================
@@ -0,0 +1,149 @@
+<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
+<app-bundle>
+
+  <meta>
+    <!-- Where to pick up the GTK+ installation, icon themes,
+         etc. Note that "${env:JHBUILD_PREFIX}" is evaluated to the
+         value of the environment variable JHBUILD_PREFIX. You can
+         define additional prefixes and refer to them in paths
+         throughout this file on the form "${prefix:name}". This is
+         useful for installing certain libraries or even the
+         application itself separately. Note that JHBUILD_PREFIX is
+         defined by jhbuild, so it you are not using jhbuild you can
+         either define your own or just hardcode the path here.
+    -->
+    <prefix name="default">${env:JHBUILD_PREFIX}</prefix>
+
+    <!-- The project directory is the default location of the created
+         app. If you leave out the path, the current directory is
+         used. Note the usage of an environment variable here again.
+    -->
+    <destination overwrite="yes">${project}</destination>
+
+    <image>
+      <!-- Not implemented yet (DMG image). -->
+    </image>
+
+    <!-- Comment this out to keep the install names in binaries -->
+    <run-install-name-tool/>
+ 
+    <!-- Optionally specify a launcher script to use. If the
+         application sets up everything needed itself, like
+         environment variable, linker paths, etc, a launcher script is
+         not needed. If the source path is left out, the default
+         script will be used.
+    -->
+    <launcher-script>${project}/launcher-gtk3.sh</launcher-script >
+
+    <!-- Not implemented: Optional runtime, could be python or mono
+         for example.
+    -->
+    <!-- runtime copy="yes">/usr/bin/python</runtime -->
+    <!-- Indicate the active gtk version to use. This is needed only
+         for gtk+-3.0 projects. -->
+    <gtk>gtk+-3.0</gtk>
+  </meta>
+
+  <!-- The special macro "${project}" refers to the directory where
+       this bundle file is located. The application name and bundle
+       identifier are taken from the plist file.
+  -->
+  <plist>${project}/Info.plist</plist>
+
+  <main-binary>${prefix}/bin/geany</main-binary>
+
+  <!-- Copy in the input methods. Dunno if they actually work with
+       OSX. Note the ${gtkdir} macro, which expands to the correct
+       library subdirectory for the specified gtk version. -->
+  <binary>
+    ${prefix}/lib/${gtkdir}/${pkg:${gtk}:gtk_binary_version}/immodules/*.so
+  </binary>
+
+<!-- And the print backends -->
+  <binary>
+    ${prefix}/lib/${gtkdir}/${pkg:${gtk}:gtk_binary_version}/printbackends/*.so
+  </binary>
+
+<!-- Starting with 2.24, gdk-pixbuf installs into its own directory. -->
+  <binary>
+    ${prefix}/lib/gdk-pixbuf-2.0/${pkg:gdk-pixbuf-2.0:gdk_pixbuf_binary_version}/loaders/*.so
+  </binary>
+
+  <!-- VTE library -->
+  <binary>
+    ${prefix}/lib/libvte2_90*.dylib
+  </binary>
+  <binary  dest="${bundle}/Contents/Resources/libexec/gnome-pty-helper">
+    ${prefix}/libexec/gnome-pty-helper
+  </binary>
+
+  <!-- Geany's plugins -->
+  <binary>
+    ${prefix}/lib/geany/*.so
+  </binary>
+
+  <!-- Translation filenames, one for each program or library that you
+       want to copy in to the bundle. The "dest" attribute is
+       optional, as usual. Bundler will find all translations of that
+       library/program under the indicated directory and copy them.-->
+  <translations  name="gtk30">
+    ${prefix}/share/locale
+  </translations>
+  <translations name="vte-2.90">
+    ${prefix}/share/locale
+  </translations>
+  <translations name="geany">
+    ${prefix}/share/locale
+  </translations>
+  <translations name="geany-plugins">
+    ${prefix}/share/locale
+  </translations>
+
+
+  <!-- Data to copy in, usually Glade/UI files, images, sounds files
+       etc. The destination inside the bundle can be specified if the
+       files should end up at a different location, by using the
+       "dest" property. The destination must then start with the macro
+       "${bundle}", which refers to the bundle root directory.
+  -->
+
+  <!-- Geany's data files; glade, fildefs, default tags, etc. -->
+  <data dest="${bundle}/Contents/Resources/share/geany">
+    ${prefix}/share/geany
+  </data>
+  <!-- Geany plugin's data files -->
+  <data dest="${bundle}/Contents/Resources/share/geany-plugins">
+    ${prefix}/share/geany-plugins
+  </data>
+  <!-- Geany documentation -->
+  <data dest="${bundle}/Contents/Resources/share/doc/geany">
+    ${prefix}/share/doc/geany
+  </data>
+  <!-- Geany plugin documentation -->
+  <data dest="${bundle}/Contents/Resources/share/doc/geany-plugins">
+    ${prefix}/share/doc/geany-plugins
+  </data>
+  <!-- mime data -->
+  <data dest="${bundle}/Contents/Resources/share/mime">
+    ${prefix}/share/mime
+  </data>
+
+  <!-- Copy in the themes data. You may want to trim this to save space
+       in your bundle. -->
+  <data>
+    ${prefix}/share/themes
+  </data>
+
+  <data>
+    ${prefix}/share/icons
+  </data>
+
+  <!-- Copy icons. Note that the .icns file is an Apple format which
+       contains up to 4 sizes of icon. You can use
+       /Developer/Applications/Utilities/Icon Composer.app to import
+       artwork and create the file. -->
+  <data dest="${bundle}/Contents/Resources">
+    ${project}/Geany.icns
+  </data>
+
+  </app-bundle>


Modified: geany.bundle
15 lines changed, 4 insertions(+), 11 deletions(-)
===================================================================
@@ -83,9 +83,9 @@
     ${prefix}/lib/gdk-pixbuf-2.0/${pkg:${gtk}:gtk_binary_version}/loaders/*.so
   </binary>
 
-<!--
+<!-- No longer needed for pango >= 1.38
    <binary>
-    ${prefix}/lib/pango/${pkg:pango:pango_module_version}/modules/*.so
+    ${prefix}/lib/pango/${pkg:pango:pango_module_version}/modules/
   </binary>
 -->
 
@@ -97,13 +97,6 @@
     ${prefix}/libexec/gnome-pty-helper
   </binary>
 
-<!-- Doesn't exist -->
-<!--
-  <data>
-    ${prefix}/etc/pango/
-  </data>
--->
-
   <!-- Geany's plugins -->
   <binary>
     ${prefix}/lib/geany/*.so
@@ -113,10 +106,10 @@
        want to copy in to the bundle. The "dest" attribute is
        optional, as usual. Bundler will find all translations of that
        library/program under the indicated directory and copy them.-->
-  <translations name="vte-0.0">
+  <translations name="gtk20">
     ${prefix}/share/locale
   </translations>
-  <translations name="gtk20">
+  <translations name="vte-0.0">
     ${prefix}/share/locale
   </translations>
   <translations name="geany">


Modified: launcher-gtk3.sh
198 lines changed, 198 insertions(+), 0 deletions(-)
===================================================================
@@ -0,0 +1,198 @@
+#!/bin/bash -l
+
+if test "x$GTK_DEBUG_LAUNCHER" != x; then
+    set -x
+fi
+
+if test "x$GTK_DEBUG_GDB" != x; then
+    EXEC="gdb --args"
+else
+    EXEC=exec
+fi
+
+ORIG_DIR=`pwd`
+
+# simulate readlink -f which isn't present on OS X
+TARGET_FILE=$0
+cd `dirname $TARGET_FILE`
+TARGET_FILE=`basename $TARGET_FILE`
+while [ -L "$TARGET_FILE" ]
+do
+    TARGET_FILE=`readlink $TARGET_FILE`
+    cd `dirname $TARGET_FILE`
+    TARGET_FILE=`basename $TARGET_FILE`
+done
+PHYS_DIR=`pwd -P`
+
+cd "$ORIG_DIR"
+
+tmp=$PHYS_DIR/$TARGET_FILE
+name=`basename "$tmp"`
+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"
+
+# PANGO_* is no longer needed for pango >= 1.38
+export PANGO_RC_FILE="$bundle_etc/pango/pangorc"
+export PANGO_SYSCONFDIR="$bundle_etc"
+export PANGO_LIBDIR="$bundle_lib"
+
+export GDK_PIXBUF_MODULE_FILE="$bundle_lib/gdk-pixbuf-2.0/2.10.0/loaders.cache"
+if [ `uname -r | cut -d . -f 1` -ge 10 ]; then
+    export GTK_IM_MODULE_FILE="$bundle_etc/gtk-3.0/gtk.immodules"
+fi
+
+if test -e ~/.config/geany/use_locale; then 
+
+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
+
+#~/.config/geany/use_locale doesn't exist
+else
+  export LANG="en_US"
+  export LC_MESSAGES="en_US"
+  export LC_ALL="en_US.UTF-8"
+fi
+
+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 /bin/expr "x$1" : '^x-psn_' > /dev/null; then
+    shift 1
+fi
+
+$EXEC "$bundle_contents/MacOS/$name-bin" "$@" $EXTRA_ARGS



--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).


More information about the Commits mailing list