Ticket #42766: gtk-mac-bundler.patch

File gtk-mac-bundler.patch, 18.0 KB (added by gellule.xg@…, 10 years ago)
  • dports/devel/gtk-mac-bundler/Portfile

     
    22# $Id$
    33
    44PortSystem          1.0
     5PortGroup           github 1.0
    56
     7github.setup        jralls gtk-mac-bundler bundler-0.7.3
     8
    69name                gtk-mac-bundler
    710version             0.7.3
    8 set branch          0.7
     11revision            1
    912categories          devel
    1013license             GPL-2
    1114platforms           darwin
    12 maintainers         gmail.com:gellule.xg
     15maintainers         openmaintainer \
     16                    gmail.com:gellule.xg
    1317supported_archs     noarch
    1418
    1519description         Mac OS X application bundle utility
     
    1721long_description    A utility that aids in the creation of Mac OS X \
    1822                    application bundles
    1923
    20 homepage            http://sourceforge.net/projects/gtk-osx
    21 
    2224#---------
    23 # FETCHING
     25# CHECKSUM
    2426#---------
    25 master_sites        ftp://ftp.gnome.org/pub/GNOME/sources/${name}/${branch}
     27checksums           rmd160  d7773e2394ea46c70510e7481a390db19fca937e \
     28                    sha256  f35828c539879bab3d00d53f9c05bbad739756ba733afcfd61ee7e8e3b49d339
    2629
    27 distfiles           ${name}-${version}.tar.xz
    28 
    29 #----------------------------
    30 # EXTRACTION AND CHECKSUMMING
    31 #----------------------------
    32 use_xz yes
    33 
    34 checksums           rmd160  05837f17ce94fe6822c0896007419b9b5ae4bc2c \
    35                     sha256  799d8d2bbd747ddddba55d32b7c9f08116e5f2b349358175b05544a4baa91365
    36 
    3730#---------
    3831# PATCHING
    3932#---------
    40 patchfiles          patch-bundler_py.diff \
     33# Note: patch-0.73_2014.02.24.diff brings 0.7.3 to commit dated 2014.02.24, remove on next release version
     34patchfiles          patch-0.7.3_2014.02.24.diff \
     35                    patch-bundler_py.diff \
    4136                    patch-launcher_sh.diff
    4237
    4338#---------------------------
     
    5752    copy ${worksrcpath}/bundler ${destroot}${prefix}/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/
    5853}
    5954destroot.args       bindir=${destroot}${prefix}/bin
    60 
    61 #-----------
    62 # LIVECHECK
    63 #-----------
    64 livecheck.type      gnome-with-unstable
  • dports/devel/gtk-mac-bundler/files/patch-0.7.3_2014.02.24.diff

     
     1diff --git bundler/bundler.py bundler/bundler.py
     2index abca042..8db5e13 100644
     3--- bundler/bundler.py
     4+++ bundler/bundler.py
     5@@ -73,7 +73,7 @@ class Bundler:
     6         module_version = utils.evaluate_pkgconfig_variables("${pkg:pango:pango_module_version}")
     7         modulespath = self.project.get_bundle_path("Contents/Resources/lib/pango/" +
     8                                                    module_version +
     9-                                                   "modules/")
     10+                                                   "/modules/")
     11 
     12         from distutils.version import StrictVersion as V
     13         import tempfile
     14diff --git bundler/launcher.sh bundler/launcher.sh
     15index 7b15121..069fbda 100755
     16--- bundler/launcher.sh
     17+++ bundler/launcher.sh
     18@@ -33,7 +33,8 @@ export GTK_PATH="$bundle_res"
     19 export GTK2_RC_FILES="$bundle_etc/gtk-2.0/gtkrc"
     20 export GTK_IM_MODULE_FILE="$bundle_etc/gtk-2.0/gtk.immodules"
     21 export GDK_PIXBUF_MODULE_FILE="$bundle_etc/gtk-2.0/gdk-pixbuf.loaders"
     22-export PANGO_RC_FILE="$bundle_etc/pango/pangorc"
     23+export PANGO_LIBDIR="$bundle_lib"
     24+export PANGO_SYSCONFDIR="$bundle_etc"
     25 
     26 # Localization settings. It's better to do this inside your program
     27 # using NSLocale if possible.
     28diff --git bundler/run-install-name-tool-change.sh bundler/run-install-name-tool-change.sh
     29index 3a3b6a8..a69796a 100755
     30--- bundler/run-install-name-tool-change.sh
     31+++ bundler/run-install-name-tool-change.sh
     32@@ -10,6 +10,8 @@ WRONG_PREFIX=$2
     33 RIGHT_PREFIX="@executable_path/../$3"
     34 ACTION=$4
     35 
     36+chmod u+w $LIBRARY
     37+
     38 if [ "x$ACTION" == "xchange" ]; then
     39     libs="`otool -L $LIBRARY 2>/dev/null | fgrep compatibility | cut -d\( -f1 | grep $WRONG_PREFIX | sort | uniq`"
     40     for lib in $libs; do
     41diff --git examples/Info-gtk-demo.plist examples/Info-gtk-demo.plist
     42index a47c60d..80b04f4 100644
     43--- examples/Info-gtk-demo.plist
     44+++ examples/Info-gtk-demo.plist
     45@@ -7,7 +7,7 @@
     46     <key>CFBundleExecutable</key>
     47     <string>GtkDemo</string>
     48     <key>CFBundleGetInfoString</key>
     49-    <string>2.16.2, (C) 1997-2009 The GTK+ Team http://www.gtk.org</string>
     50+    <string>2.24.18, (C) 1997-2013 The GTK+ Team http://www.gtk.org</string>
     51     <key>CFBundleIconFile</key>
     52     <string>Giggle.icns</string>
     53     <key>CFBundleIdentifier</key>
     54@@ -17,13 +17,13 @@
     55     <key>CFBundlePackageType</key>
     56     <string>APPL</string>
     57     <key>CFBundleShortVersionString</key>
     58-    <string>2.16.2</string>
     59+    <string>2.24.18</string>
     60     <key>CFBundleSignature</key>
     61     <string>????</string>
     62     <key>CFBundleVersion</key>
     63-    <string>2.16.2</string>
     64+    <string>2.24.18</string>
     65     <key>NSHumanReadableCopyright</key>
     66-    <string>Copyright 1997 - 2009 The GTK+ Tean, GNU General Public License.</string>
     67+    <string>Copyright 1997 - 2013 The GTK+ Team, GNU General Public License.</string>
     68     <key>LSMinimumSystemVersion</key>
     69     <string>10.4</string>
     70 </dict>
     71diff --git examples/Info-pygtk-demo.plist examples/Info-pygtk-demo.plist
     72index 37876b4..55b6807 100644
     73--- examples/Info-pygtk-demo.plist
     74+++ examples/Info-pygtk-demo.plist
     75@@ -7,7 +7,7 @@
     76     <key>CFBundleExecutable</key>
     77     <string>PyGtkDemo</string>
     78     <key>CFBundleGetInfoString</key>
     79-    <string>2.16.0, (C) 1997-2009 The GTK+ Team http://www.gtk.org</string>
     80+    <string>2.24.0, (C) 1997-2012 The GTK+ Team http://www.gtk.org</string>
     81     <key>CFBundleIconFile</key>
     82     <string>Giggle.icns</string>
     83     <key>CFBundleIdentifier</key>
     84@@ -17,13 +17,13 @@
     85     <key>CFBundlePackageType</key>
     86     <string>APPL</string>
     87     <key>CFBundleShortVersionString</key>
     88-    <string>2.16.0</string>
     89+    <string>2.24.0</string>
     90     <key>CFBundleSignature</key>
     91     <string>????</string>
     92     <key>CFBundleVersion</key>
     93-    <string>2.16.0</string>
     94+    <string>2.24.0</string>
     95     <key>NSHumanReadableCopyright</key>
     96-    <string>Copyright 1997 - 2009 The GTK+ Tean, GNU General Public License.</string>
     97+    <string>Copyright 1997 - 2012 The GTK+ Team GNU General Public License.</string>
     98     <key>LSMinimumSystemVersion</key>
     99     <string>10.5</string>
     100 </dict>
     101diff --git examples/gtk-demo.bundle examples/gtk-demo.bundle
     102index 32173b9..4b32d6b 100644
     103--- examples/gtk-demo.bundle
     104+++ examples/gtk-demo.bundle
     105@@ -69,16 +69,25 @@
     106   <binary>
     107     ${prefix}/lib/${gtkdir}/${pkg:${gtk}:gtk_binary_version}/engines/*.so
     108   </binary>
     109+
     110   <binary>
     111     ${prefix}/lib/${gtkdir}/${pkg:${gtk}:gtk_binary_version}/printbackends/*.so
     112   </binary>
     113 
     114 <!-- Starting with 2.24, gdk-pixbuf installs into its own directory. -->
     115   <binary>
     116-    ${prefix}/lib/gdk-pixbuf-2.0/${pkg:${gtk}:gtk_binary_version}/*.so
     117+    ${prefix}/lib/gdk-pixbuf-2.0/${pkg:${gtk}:gtk_binary_version}/loaders/*.so
     118+  </binary>
     119+
     120+   <binary>
     121+    ${prefix}/lib/pango/${pkg:pango:pango_module_version}/modules/
     122   </binary>
     123 
     124-  <!-- Translation filenames, one for each program or library that you
     125+  <data>
     126+    ${prefix}/etc/pango/
     127+  </data>
     128+
     129+ <!-- Translation filenames, one for each program or library that you
     130        want to copy in to the bundle. The "dest" attribute is
     131        optional, as usual. Bundler will find all translations of that
     132        library/program under the indicated directory and copy them.-->
     133diff --git examples/gtk3-demo.bundle examples/gtk3-demo.bundle
     134index b74f2ca..ba15cd3 100644
     135--- examples/gtk3-demo.bundle
     136+++ examples/gtk3-demo.bundle
     137@@ -33,7 +33,7 @@
     138          not needed. If the source path is left out, the default
     139          script will be used.
     140     -->
     141-    <launcher-script>${project}/launcher.sh</launcher-script >
     142+    <launcher-script>${project}/gtk3-launcher.sh</launcher-script >
     143 
     144     <!-- Not implemented: Optional runtime, could be python or mono
     145          for example.
     146@@ -52,23 +52,14 @@
     147 
     148   <main-binary>${prefix}/bin/gtk3-demo</main-binary>
     149 
     150-  <!-- Copy in GTK+ modules. Note the ${gtkdir} macro, which expands
     151-       to the correct library subdirectory for the specified gtk
     152-       version.
     153-  -->
     154+  <!-- Copy in the input methods. Dunno if they actually work with
     155+       OSX. Note the ${gtkdir} macro, which expands to the correct
     156+       library subdirectory for the specified gtk version. -->
     157   <binary>
     158-     ${prefix}/lib/${gtkdir}/modules/*.so
     159+    ${prefix}/lib/${gtkdir}/${pkg:${gtk}:gtk_binary_version}/immodules/*.so
     160   </binary>
     161 
     162-  <!-- Copy in GTK+ theme engines and print backends. Note the use of the
     163-       "${pkg:module:variable}" macro, which evaluates to a pkg-config
     164-       variable in the specified module. Note that any libraries that
     165-       binaries link to are also copied in automatically.  Note also
     166-       the included ${gtk} macro, which gets the correct package name
     167-       to get. -->
     168-  <binary>
     169-    ${prefix}/lib/${gtkdir}/${pkg:${gtk}:gtk_binary_version}/theming-engines/*.so
     170-  </binary>
     171+<!-- And the print backends -->
     172   <binary>
     173     ${prefix}/lib/${gtkdir}/${pkg:${gtk}:gtk_binary_version}/printbackends/*.so
     174   </binary>
     175@@ -78,6 +69,14 @@
     176     ${prefix}/lib/gdk-pixbuf-2.0/${pkg:gdk-pixbuf-2.0:gdk_pixbuf_binary_version}/loaders/*.so
     177   </binary>
     178 
     179+  <binary>
     180+    ${prefix}/lib/pango/${pkg:pango:pango_module_version}/modules/
     181+  </binary>
     182+
     183+  <data>
     184+    ${prefix}/etc/pango/
     185+  </data>
     186+
     187   <!-- Translation filenames, one for each program or library that you
     188        want to copy in to the bundle. The "dest" attribute is
     189        optional, as usual. Bundler will find all translations of that
     190diff --git examples/gtk3-launcher.sh examples/gtk3-launcher.sh
     191new file mode 100755
     192index 0000000..4aed833
     193--- /dev/null
     194+++ examples/gtk3-launcher.sh
     195@@ -0,0 +1,170 @@
     196+#!/bin/sh
     197+
     198+if test "x$GTK_DEBUG_LAUNCHER" != x; then
     199+    set -x
     200+fi
     201+
     202+if test "x$GTK_DEBUG_GDB" != x; then
     203+    EXEC="gdb --args"
     204+else
     205+    EXEC=exec
     206+fi
     207+
     208+name=`basename "$0"`
     209+tmp="$0"
     210+tmp=`dirname "$tmp"`
     211+tmp=`dirname "$tmp"`
     212+bundle=`dirname "$tmp"`
     213+bundle_contents="$bundle"/Contents
     214+bundle_res="$bundle_contents"/Resources
     215+bundle_lib="$bundle_res"/lib
     216+bundle_bin="$bundle_res"/bin
     217+bundle_data="$bundle_res"/share
     218+bundle_etc="$bundle_res"/etc
     219+
     220+export DYLD_LIBRARY_PATH="$bundle_lib"
     221+export XDG_CONFIG_DIRS="$bundle_etc"/xdg
     222+export XDG_DATA_DIRS="$bundle_data"
     223+export GTK_DATA_PREFIX="$bundle_res"
     224+export GTK_EXE_PREFIX="$bundle_res"
     225+export GTK_PATH="$bundle_res"
     226+
     227+export GTK2_RC_FILES="$bundle_etc/gtk-3.0/gtkrc"
     228+export GTK_IM_MODULE_FILE="$bundle_etc/gtk-3.0/gtk.immodules"
     229+export GDK_PIXBUF_MODULE_FILE="$bundle_etc/gtk-3.0/gdk-pixbuf.loaders"
     230+export PANGO_LIBDIR="$bundle_lib"
     231+export PANGO_SYSCONFDIR="$bundle_etc"
     232+
     233+
     234+APP=name
     235+I18NDIR="$bundle_data/locale"
     236+# Set the locale-related variables appropriately:
     237+unset LANG LC_MESSAGES LC_MONETARY LC_COLLATE
     238+
     239+# Has a language ordering been set?
     240+# If so, set LC_MESSAGES and LANG accordingly; otherwise skip it.
     241+# 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.
     242+APPLELANGUAGES=`defaults read .GlobalPreferences AppleLanguages | sed -En   -e 's/\-/_/' -e 's/Hant/TW/' -e 's/Hans/CN/' -e 's/[[:space:]]*\"?([[:alnum:]_]+)\"?,?/\1/p' `
     243+if test "$APPLELANGUAGES"; then
     244+    # A language ordering exists.
     245+    # Test, item per item, to see whether there is an corresponding locale.
     246+    for L in $APPLELANGUAGES; do
     247+       #test for exact matches:
     248+       if test -f "$I18NDIR/${L}/LC_MESSAGES/$APP.mo"; then
     249+           export LANG=$L
     250+            break
     251+        fi
     252+       #This is a special case, because often the original strings are in US
     253+       #English and there is no translation file.
     254+       if test "x$L" == "xen_US"; then
     255+           export LANG=$L
     256+           break
     257+       fi
     258+       #OK, now test for just the first two letters:
     259+        if test -f "$I18NDIR/${L:0:2}/LC_MESSAGES/$APP.mo"; then
     260+           export LANG=${L:0:2}
     261+           break
     262+       fi
     263+       #Same thing, but checking for any english variant.
     264+       if test "x${L:0:2}" == "xen"; then
     265+           export LANG=$L
     266+           break
     267+       fi;
     268+    done 
     269+fi
     270+unset APPLELANGUAGES L
     271+
     272+# If we didn't get a language from the language list, try the Collation preference, in case it's the only setting that exists.
     273+APPLECOLLATION=`defaults read .GlobalPreferences AppleCollationOrder`
     274+if test -z ${LANG} -a -n $APPLECOLLATION; then
     275+    if test -f "$I18NDIR/${APPLECOLLATION:0:2}/LC_MESSAGES/$APP.mo"; then
     276+       export LANG=${APPLECOLLATION:0:2}
     277+    fi
     278+fi
     279+if test ! -z $APPLECOLLATION; then
     280+    export LC_COLLATE=$APPLECOLLATION
     281+fi
     282+unset APPLECOLLATION
     283+
     284+# Continue by attempting to find the Locale preference.
     285+APPLELOCALE=`defaults read .GlobalPreferences AppleLocale`
     286+
     287+if test -f "$I18NDIR/${APPLELOCALE:0:5}/LC_MESSAGES/$APP.mo"; then
     288+    if test -z $LANG; then
     289+        export LANG="${APPLELOCALE:0:5}"
     290+    fi
     291+
     292+elif test -z $LANG -a -f "$I18NDIR/${APPLELOCALE:0:2}/LC_MESSAGES/$APP.mo"; then
     293+    export LANG="${APPLELOCALE:0:2}"
     294+fi
     295+
     296+#Next we need to set LC_MESSAGES. If at all possilbe, we want a full
     297+#5-character locale to avoid the "Locale not supported by C library"
     298+#warning from Gtk -- even though Gtk will translate with a
     299+#two-character code.
     300+if test -n $LANG; then
     301+#If the language code matches the applelocale, then that's the message
     302+#locale; otherwise, if it's longer than two characters, then it's
     303+#probably a good message locale and we'll go with it.
     304+    if test $LANG == ${APPLELOCALE:0:5} -o $LANG != ${LANG:0:2}; then
     305+       export LC_MESSAGES=$LANG
     306+#Next try if the Applelocale is longer than 2 chars and the language
     307+#bit matches $LANG
     308+    elif test $LANG == ${APPLELOCALE:0:2} -a $APPLELOCALE > ${APPLELOCALE:0:2}; then
     309+       export LC_MESSAGES=${APPLELOCALE:0:5}
     310+#Fail. Get a list of the locales in $PREFIX/share/locale that match
     311+#our two letter language code and pick the first one, special casing
     312+#english to set en_US
     313+    elif test $LANG == "en"; then
     314+       export LC_MESSAGES="en_US"
     315+    else
     316+       LOC=`find $PREFIX/share/locale -name $LANG???`
     317+       for L in $LOC; do
     318+           export LC_MESSAGES=$L
     319+       done
     320+    fi
     321+else
     322+#All efforts have failed, so default to US english
     323+    export LANG="en_US"
     324+    export LC_MESSAGES="en_US"
     325+fi
     326+CURRENCY=`echo $APPLELOCALE |  sed -En 's/.*currency=([[:alpha:]]+).*/\1/p'`
     327+if test "x$CURRENCY" != "x"; then
     328+#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.
     329+    if test -f /usr/local/share/$LC_MESSAGES/LC_MONETARY; then
     330+       if test -a `cat /usr/local/share/$LC_MESSAGES/LC_MONETARY` == $CURRENCY; then
     331+           export LC_MONETARY=$LC_MESSAGES
     332+       fi
     333+    fi
     334+    if test -z "$LC_MONETARY"; then
     335+       FILES=`find /usr/share/locale -name LC_MONETARY -exec grep -H $CURRENCY {} \;`
     336+       if test -n "$FILES"; then
     337+           export LC_MONETARY=`echo $FILES | sed -En 's%/usr/share/locale/([[:alpha:]_]+)/LC_MONETARY.*%\1%p'`
     338+       fi
     339+    fi
     340+fi
     341+#No currency value means that the AppleLocale governs:
     342+if test -z "$LC_MONETARY"; then
     343+    LC_MONETARY=${APPLELOCALE:0:5}
     344+fi
     345+#For Gtk, which only looks at LC_ALL:
     346+export LC_ALL=$LC_MESSAGES
     347+
     348+unset APPLELOCALE FILES LOC
     349+
     350+if test -f "$bundle_lib/charset.alias"; then
     351+    export CHARSETALIASDIR="$bundle_lib"
     352+fi
     353+
     354+# Extra arguments can be added in environment.sh.
     355+EXTRA_ARGS=
     356+if test -f "$bundle_res/environment.sh"; then
     357+  source "$bundle_res/environment.sh"
     358+fi
     359+
     360+# Strip out the argument added by the OS.
     361+if /bin/expr "x$1" : '^x-psn_' > /dev/null; then
     362+    shift 1
     363+fi
     364+
     365+$EXEC "$bundle_contents/MacOS/$name-bin" "$@" $EXTRA_ARGS
     366diff --git examples/launcher.sh examples/launcher.sh
     367index d92f9e5..a1dfd1b 100755
     368--- examples/launcher.sh
     369+++ examples/launcher.sh
     370@@ -32,7 +32,8 @@ export GTK_PATH="$bundle_res"
     371 export GTK2_RC_FILES="$bundle_etc/gtk-2.0/gtkrc"
     372 export GTK_IM_MODULE_FILE="$bundle_etc/gtk-2.0/gtk.immodules"
     373 export GDK_PIXBUF_MODULE_FILE="$bundle_etc/gtk-2.0/gdk-pixbuf.loaders"
     374-export PANGO_RC_FILE="$bundle_etc/pango/pangorc"
     375+export PANGO_LIBDIR="$bundle_lib"
     376+export PANGO_SYSCONFDIR="$bundle_etc"
     377 
     378 APP=name
     379 I18NDIR="$bundle_data/locale"
     380diff --git examples/pygtk-demo.bundle examples/pygtk-demo.bundle
     381index 699ff43..2025312 100644
     382--- examples/pygtk-demo.bundle
     383+++ examples/pygtk-demo.bundle
     384@@ -96,10 +96,14 @@
     385 
     386 <!-- Starting with 2.24, gdk-pixbuf installs into its own directory. -->
     387   <binary>
     388-    ${prefix}/lib/gdk-pixbuf-2.0/${pkg:${gtk}:gtk_binary_version}/*.so
     389+    ${prefix}/lib/gdk-pixbuf-2.0/${pkg:gdk-pixbuf-2.0:gdk_pixbuf_binary_version}/loaders/*.so
     390   </binary>
     391 
     392-  <!-- Translation filenames, one for each program or library that you
     393+  <binary>
     394+    ${prefix}/lib/pango/${pkg:pango:pango_module_version}/modules/*.so
     395+  </binary>
     396+
     397+ <!-- Translation filenames, one for each program or library that you
     398        want to copy in to the bundle. The "dest" attribute is
     399        optional, as usual. Bundler will find all translations of that
     400        library/program under the indicated directory and copy them.-->
     401diff --git examples/pygtk-demo.sh examples/pygtk-demo.sh
     402index 9c8ec33..ecbf1c0 100755
     403--- examples/pygtk-demo.sh
     404+++ examples/pygtk-demo.sh
     405@@ -22,7 +22,8 @@ export GTK_PATH="$bundle_res"
     406 export GTK2_RC_FILES="$bundle_etc/gtk-2.0/gtkrc"
     407 export GTK_IM_MODULE_FILE="$bundle_etc/gtk-2.0/gtk.immodules"
     408 export GDK_PIXBUF_MODULE_FILE="$bundle_etc/gtk-2.0/gdk-pixbuf.loaders"
     409-export PANGO_RC_FILE="$bundle_etc/pango/pangorc"
     410+export PANGO_LIBDIR="$bundle_lib"
     411+export PANGO_SYSCONFDIR="$bundle_etc"
     412 
     413 #Set $PYTHON to point inside the bundle
     414 export PYTHON="$bundle_contents/MacOS/python"