[gedit/gnome-3-2-osx: 4/6] Set additional paths to make OS X bundle relocatable



commit 08e8690df0cffead6da31ced31994e516255ff01
Author: Jesse van den Kieboom <jessevdk gnome org>
Date:   Sun Jan 15 19:24:49 2012 +0100

    Set additional paths to make OS X bundle relocatable

 osx/gedit.bundle                                   |    4 ++
 osx/jhbuild/gedit.modules                          |   20 +++++++++++--
 osx/jhbuild/jhbuildrc-gedit                        |   10 ++++--
 .../patches/gedit-plugins-disable-terminal.patch   |   30 ++++++++++++++++++++
 osx/jhbuild/patches/glib-iconv.patch               |   18 ++++++++++++
 osx/launcher.sh                                    |   22 +++++++++-----
 osx/makebundle.sh                                  |   17 ++++++++++-
 osx/makedmg.sh                                     |    4 +-
 8 files changed, 108 insertions(+), 17 deletions(-)
---
diff --git a/osx/gedit.bundle b/osx/gedit.bundle
index 8bab9cf..ec73ad2 100644
--- a/osx/gedit.bundle
+++ b/osx/gedit.bundle
@@ -89,6 +89,10 @@
   <data>${prefix}/lib/python2.7/site-packages/gi</data>
   <data>${prefix}/lib/python2.7/site-packages/libxml2.py</data>
 
+  <binary>${prefix}/lib/python2.7/lib-dynload/*.so</binary>
+  <data>${prefix}/lib/python2.7</data>
+  <binary>${prefix}/bin/python*</binary>
+
   <!-- GTK+3 data -->
   <data>${prefix}/etc/gtk-3.0/*</data>
 
diff --git a/osx/jhbuild/gedit.modules b/osx/jhbuild/gedit.modules
index 03c007e..633c9c6 100644
--- a/osx/jhbuild/gedit.modules
+++ b/osx/jhbuild/gedit.modules
@@ -8,7 +8,6 @@
   <repository type="tarball" name="ftp.gnome.org" default="yes"
               href="http://ftp.gnome.org/pub/GNOME/sources/"/>
   <repository type="git" name="github" href="git://github.com/"/>
-  <repository type="git" name="githubjessevdk" href="git://github.com/jessevdk/"/>
   <repository type="tarball" name="ftp.gnupg.org" href="ftp://ftp.gnupg.org/"; />
   <repository type="tarball" name="ftp.gnu.org" href="ftp://ftp.gnu.org/gnu/"/>
   <repository type="tarball" name="launchpad" href="http://edge.launchpad.net/"/>
@@ -184,10 +183,11 @@
     </dependencies>
   </autotools>
 
-  <autotools id="gedit-plugins" autogenargs="DATADIRNAME=share">
+  <autotools id="gedit-plugins" autogenargs="DATADIRNAME=share" autogen="autogen.sh">
     <branch module="gedit-plugins/3.2/gedit-plugins-3.2.1.tar.bz2"
             version="3.2.1"
             hash="sha256:8f6b5bc88ca61d8f0bc4dd54b2dc82473acfefd90453e4d4ffc3ca88d4182f4d">
+      <patch file="http://git.gnome.org/browse/gedit/plain/osx/jhbuild/patches/gedit-plugins-disable-terminal.patch"; strip="1"/>
     </branch>
     <dependencies>
       <dep package="meta-gtk-osx-bootstrap"/>
@@ -265,7 +265,7 @@
   </autotools>
 
   <autotools id="gedit" autogenargs="DATADIRNAME=share">
-    <branch repo="githubjessevdk" module="gedit" revision="gnome-3-2"/>
+    <branch module="gedit" revision="3.2.6-osx-2"/>
     <dependencies>
       <dep package="meta-gtk-osx-bootstrap"/>
       <dep package="meta-gtk-osx-gtk3"/>
@@ -307,6 +307,20 @@
     </after>
   </autotools>
 
+  <autotools id="glib-gtk3" autogen-sh="configure">
+    <branch module="glib/2.30/glib-2.30.1.tar.bz2"  version="2.30.1"
+            hash="sha256:4e560319450f31d85b6cdb2b530c3324a510ca04817e360943d0774327d21804">
+      <patch file="http://git.gnome.org/browse/gedit/plain/osx/jhbuild/patches/glib-iconv.patch"; strip="1"/>
+    </branch>
+    <dependencies>
+      <dep package="libffi"/>
+      <dep package="gtk-doc"/>
+    </dependencies>
+    <after>
+      <dep package="meta-gtk-osx-bootstrap"/>
+    </after>
+  </autotools>
+
   <metamodule id="gedit-meta">
     <dependencies>
       <dep package="python"/>
diff --git a/osx/jhbuild/jhbuildrc-gedit b/osx/jhbuild/jhbuildrc-gedit
index 42c1147..6cb086c 100644
--- a/osx/jhbuild/jhbuildrc-gedit
+++ b/osx/jhbuild/jhbuildrc-gedit
@@ -13,13 +13,16 @@ _architecture = _default_arch
 
 if _gsdk == '10.4':
     _sdkversion = "10.4u"
+    os.environ["OBJC"] = "/usr/bin/gcc-4.0"
     _architecture = "i386"
+    append_autogenargs('glib-gtk3', '--with-libiconv=gnu')
 else:
-    skip.append("python")
+    _architecture = "x86_64"
+    append_autogenargs('glib-gtk3', '--with-libiconv=native')
 
 checkoutroot = os.path.expanduser("~/gedit/" + _gsdk + "/source")
 prefix = os.path.expanduser("~/gedit/" + _gsdk + "/inst")
-tarballdir = os.path.expanduser("~/gedit" + _gsdk + "/pkgs")
+tarballdir = os.path.expanduser("~/gedit/pkgs")
 
 # Main setup
 setup_sdk(target=_gsdk, sdk_version=_sdkversion, architectures=[_architecture])
@@ -32,6 +35,7 @@ environ_append("OBJCFLAGS", "-isysroot " + _sdkdir)
 environ_prepend("OBJCFLAGS", "-arch " + _architecture)
 environ_append("OBJCFLAGS", "-mmacosx-version-min=" + _gsdk)
 
+skip.append("libiconv")
+
 # Main module set
 moduleset = "http://git.gnome.org/browse/gedit/plain/osx/jhbuild/gedit.modules";
-
diff --git a/osx/jhbuild/patches/gedit-plugins-disable-terminal.patch b/osx/jhbuild/patches/gedit-plugins-disable-terminal.patch
new file mode 100644
index 0000000..e1d2928
--- /dev/null
+++ b/osx/jhbuild/patches/gedit-plugins-disable-terminal.patch
@@ -0,0 +1,30 @@
+--- a/configure.ac	2011-10-16 22:03:19.000000000 +0200
++++ b/configure.ac	2012-01-15 13:57:54.000000000 +0100
+@@ -246,6 +246,27 @@
+ 	fi
+ fi
+ 
++# ================================================================
++# Terminal (vte)
++# ================================================================
++plugin_defined terminal
++
++if test "$?" = 1
++then
++    AC_CHECK_LIB([vte], [vte_terminal_new], [have_vte=yes], [have_vte=no])
++
++	if test "x$have_vte" = "xno"; then
++		plugin_defined_explicit terminal
++		if test "$?" = 1
++		then
++			AC_MSG_ERROR([vte could not be found, needed for terminal plugin])
++		else
++			AC_MSG_WARN([vte could not be found, terminal plugin will be disabled])
++			undef_plugin terminal "vte not found"
++		fi
++	fi
++fi
++
+ if test -z "$disabled_plugins"
+ then
+ 	disabled_plugins="none"
diff --git a/osx/jhbuild/patches/glib-iconv.patch b/osx/jhbuild/patches/glib-iconv.patch
new file mode 100644
index 0000000..ac2fe94
--- /dev/null
+++ b/osx/jhbuild/patches/glib-iconv.patch
@@ -0,0 +1,18 @@
+--- a/glib/gconvert.c	2011-10-14 05:47:57.000000000 +0200
++++ b/glib/gconvert.c	2012-01-15 12:41:11.000000000 +0100
+@@ -58,13 +58,14 @@
+ 
+ #include "glibintl.h"
+ 
++#if !defined(__APPLE_CC__) || !defined(__LP64__)
+ #if defined(USE_LIBICONV_GNU) && !defined (_LIBICONV_H)
+ #error GNU libiconv in use but included iconv.h not from libiconv
+ #endif
+ #if !defined(USE_LIBICONV_GNU) && defined (_LIBICONV_H)
+ #error GNU libiconv not in use but included iconv.h is from libiconv
+ #endif
+-
++#endif
+ 
+ /**
+  * SECTION:conversions
diff --git a/osx/launcher.sh b/osx/launcher.sh
index 6e9eeaa..f34f724 100755
--- a/osx/launcher.sh
+++ b/osx/launcher.sh
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 
 if test "x$GTK_DEBUG_LAUNCHER" != x; then
 	set -x
@@ -6,11 +6,7 @@ fi
 
 if test "x$GTK_DEBUG_GDB" != x; then
 	EXEC="gdb --args"
-else
-	EXEC=exec
-fi
-
-if test "x$GTK_DEBUG_DTRUSS" != x; then
+elif test "x$GTK_DEBUG_DTRUSS" != x; then
 	EXEC="dtruss"
 else
 	EXEC=exec
@@ -27,6 +23,7 @@ bundle_bin="$bundle_res"/bin
 bundle_data="$bundle_res"/share
 bundle_etc="$bundle_res"/etc
 
+export PATH="$bundle_bin:$PATH"
 export DYLD_LIBRARY_PATH="$bundle_lib:$DYLD_LIBRARY_PATH"
 export XDG_CONFIG_DIRS="$bundle_etc:$XDG_CONFIG_DIRS"
 export XDG_DATA_DIRS="$bundle_data:$XDG_DATA_DIRS"
@@ -39,6 +36,7 @@ export GI_TYPELIB_PATH="$bundle_lib/girepository-1.0"
 export PYTHONPATH="$bundle_lib/python2.6/site-packages:$PYTHONPATH"
 export PANGO_LIBDIR="$bundle_lib"
 export PANGO_SYSCONFDIR="$bundle_etc"
+export PEAS_PLUGIN_LOADERS_DIR="$bundle_lib/libpeas-1.0/loaders"
 
 if test -f "$bundle_lib/charset.alias"; then
 	export CHARSETALIASDIR="$bundle_lib"
@@ -50,6 +48,10 @@ if test -f "$bundle_res/environment.sh"; then
 	source "$bundle_res/environment.sh"
 fi
 
+if test -f "$HOME/.geditenv"; then
+	source "$HOME/.geditenv"
+fi
+
 # Strip out the argument added by the OS.
 if [ x`echo "x$1" | sed -e "s/^x-psn_.*//"` == x ]; then
 	shift 1
@@ -63,7 +65,7 @@ if [ -f "$dbusenv" ]; then
 fi
 
 if [ -z "$DBUS_SESSION_BUS_PID" ] || ! ps -p "$DBUS_SESSION_BUS_PID" >/dev/null; then
-	"$bundle_bin"/dbus-launch > "$dbusenv"
+	"$bundle_bin/dbus-launch" --config-file "$bundle_etc/dbus-1/session.conf" > "$dbusenv"
 
 	source "$dbusenv"
 fi
@@ -71,4 +73,8 @@ fi
 export DBUS_SESSION_BUS_PID
 export DBUS_SESSION_BUS_ADDRESS
 
-$EXEC "$bundle_contents/MacOS/$name-bin" "$@" $EXTRA_ARGS
+if [ "x$GTK_DEBUG_SHELL" != "x" ]; then
+	exec bash
+else
+	$EXEC "$bundle_contents/MacOS/$name-bin" "$@" $EXTRA_ARGS
+fi
diff --git a/osx/makebundle.sh b/osx/makebundle.sh
index bc6d2f5..75d4a54 100755
--- a/osx/makebundle.sh
+++ b/osx/makebundle.sh
@@ -7,6 +7,12 @@ fi
 gtk-mac-bundler gedit.bundle
 
 function do_strip {
+    tp=$(file -b --mime-type "$1")
+
+    if [ "$tp" != "application/octet-stream" ]; then
+        return
+    fi
+
     name=$(mktemp -t bundle)
     st=$(stat -f %p "$1")
     
@@ -17,8 +23,17 @@ function do_strip {
 	chmod u+w "$1"
 }
 
+echo "Removing unneeded files from bundle"
+
+# Remove pyc and pyo files
+for i in $(find gedit.app/Contents/Resources/lib/python2.7 -type f -regex '.*\.py[oc]'); do
+    rm -f "$i"
+done
+
+echo "Strip debug symbols from bundle binaries"
+
 # Strip debug symbols
-for i in $(find gedit.app/Contents/Resources | grep -E '\.(so|dylib)'); do
+for i in $(find gedit.app/Contents/Resources -type f -regex '\.(so|dylib)$'); do
     do_strip "$i"
 done
 
diff --git a/osx/makedmg.sh b/osx/makedmg.sh
index d8ecb23..7c57f85 100755
--- a/osx/makedmg.sh
+++ b/osx/makedmg.sh
@@ -21,9 +21,9 @@ MOUNT_POINT=$VOLUME_NAME.mounted
 rm -f $DMG_FILE
 rm -f $DMG_FILE.master
 
-# Compute an approximated image size in MB, and bloat by 10 MB
+# Compute an approximated image size in MB, and bloat by 15 MB
 image_size=$(du -ck $DMG_APP dmg-data | tail -n1 | cut -f1)
-image_size=$((($image_size + 10000) / 1000))
+image_size=$((($image_size + 15000) / 1000))
 
 echo "Creating disk image (${image_size}MB)..."
 #hdiutil create $DMG_FILE -megabytes $image_size -volname $VOLUME_NAME -fs HFS+ -quiet || exit $?



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