[gedit/gnome-3-2] Fix dbus and dconf issues for OS X
- From: Jesse van den Kieboom <jessevdk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gedit/gnome-3-2] Fix dbus and dconf issues for OS X
- Date: Thu, 19 Jan 2012 22:18:45 +0000 (UTC)
commit 548fc8a12af9254c7cba5d65199bc6d99d2fa8c8
Author: Jesse van den Kieboom <jessevdk gnome org>
Date: Tue Jan 17 22:24:18 2012 +0100
Fix dbus and dconf issues for OS X
gedit/gedit-app-osx.c | 2 +-
gedit/gedit-dbus.c | 23 +++++++++---
gedit/gedit.c | 31 ++++++++++++++++
osx/README | 18 +++++++--
osx/gedit.bundle | 2 +
osx/jhbuild/gedit.modules | 21 ++++++++++-
.../patches/dbus-relocatable-services.patch | 37 ++++++++++++++++++++
osx/launcher.sh | 4 ++-
osx/makebundle.sh | 14 +++++---
osx/makedmg.sh | 2 +-
osx/template.dmg | Bin 19345408 -> 19345408 bytes
11 files changed, 135 insertions(+), 19 deletions(-)
---
diff --git a/gedit/gedit-app-osx.c b/gedit/gedit-app-osx.c
index 294c604..1c0f652 100644
--- a/gedit/gedit-app-osx.c
+++ b/gedit/gedit-app-osx.c
@@ -371,7 +371,7 @@ on_osx_open_files (GtkOSXApplication *osxapp,
while (paths && *paths)
{
locations = g_slist_prepend (locations,
- g_file_new_for_uri (*paths));
+ g_file_new_for_path (*paths));
++paths;
}
diff --git a/gedit/gedit-dbus.c b/gedit/gedit-dbus.c
index 64aafe8..0b8e52d 100644
--- a/gedit/gedit-dbus.c
+++ b/gedit/gedit-dbus.c
@@ -31,6 +31,10 @@
#include "gedit-window.h"
#include "gedit-utils.h"
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
#ifdef GDK_WINDOWING_X11
#include <gdk/gdkx.h>
#endif
@@ -300,7 +304,12 @@ get_display_arguments (GeditDBus *dbus,
screen = gdk_screen_get_default ();
display = gdk_screen_get_display (screen);
+#ifdef OS_OSX
+ /* On OS X gdk_display_get_name seems to block... */
+ dparams->display_name = NULL;
+#else
dparams->display_name = g_strdup (gdk_display_get_name (display));
+#endif
dparams->screen_number = gdk_screen_get_number (screen);
dparams->workspace = gedit_utils_get_current_workspace (screen);
@@ -402,10 +411,13 @@ compose_open_parameters (GeditDBus *dbus)
/* display parameters like display name, screen, workspace, viewport */
get_display_arguments (dbus, &dparams);
- g_variant_builder_add (&options,
- "{sv}",
- "display_name",
- g_variant_new_string (dparams.display_name));
+ if (dparams.display_name)
+ {
+ g_variant_builder_add (&options,
+ "{sv}",
+ "display_name",
+ g_variant_new_string (dparams.display_name));
+ }
g_free (dparams.display_name);
@@ -1670,6 +1682,8 @@ gedit_dbus_run (GeditDBus *dbus)
}
}
+ dbus->priv->main_loop = g_main_loop_new (NULL, FALSE);
+
g_bus_own_name (G_BUS_TYPE_SESSION,
"org.gnome.gedit",
G_BUS_NAME_OWNER_FLAGS_NONE,
@@ -1681,7 +1695,6 @@ gedit_dbus_run (GeditDBus *dbus)
gedit_debug_message (DEBUG_DBUS, "Own name org.gnome.gedit\n");
- dbus->priv->main_loop = g_main_loop_new (NULL, FALSE);
g_main_loop_run (dbus->priv->main_loop);
g_main_loop_unref (dbus->priv->main_loop);
diff --git a/gedit/gedit.c b/gedit/gedit.c
index b210fbe..da93d46 100644
--- a/gedit/gedit.c
+++ b/gedit/gedit.c
@@ -226,6 +226,11 @@ main (int argc, char *argv[])
GeditDBusResult dbusret;
gboolean service = FALSE;
+#ifdef OS_OSX
+ GPollFunc orig_poll_func;
+ GPollFunc gdk_poll_func;
+#endif
+
#ifndef ENABLE_GVFS_METADATA
const gchar *cache_dir;
gchar *metadata_filename;
@@ -263,6 +268,10 @@ main (int argc, char *argv[])
g_free (metadata_filename);
#endif
+#ifdef OS_OSX
+ orig_poll_func = g_main_context_get_poll_func (NULL);
+#endif
+
/* Parse command line arguments */
command_line = gedit_command_line_get_default ();
@@ -274,10 +283,32 @@ main (int argc, char *argv[])
return 1;
}
+#ifdef OS_OSX
+ /* Note: this is a bit of a hack. What happens here is that we are going to
+ * store the poll function installed by gdk (happens in post-parse of options)
+ * and replace it with the original main loop poll handler. We do this because
+ * the gedit dbus stuff is going to run some main loops to run async gdbus calls.
+ * The problem is that for OS X, the gdk poll func in the main context (which
+ * will be run due to the fact that the main loops in our dbus code iterate the
+ * main context) is going to process events from NSApp, INCLUDING apple events
+ * such as OpenFiles. Since we are not setup yet, we are going to miss these
+ * events. By swapping out the gdk poll func, and swapping it back in later,
+ * we prevent this from happening. Note that we only do this when building
+ * on OS X to prevent any possible future problems for other platforms.
+ * This is a dirty hack, but it works for now.
+ */
+ gdk_poll_func = g_main_context_get_poll_func (NULL);
+ g_main_context_set_poll_func (NULL, orig_poll_func);
+#endif
+
/* Run over dbus */
dbus = gedit_dbus_new ();
dbusret = gedit_dbus_run (dbus);
+#ifdef OS_OSX
+ g_main_context_set_poll_func (NULL, gdk_poll_func);
+#endif
+
switch (dbusret)
{
case GEDIT_DBUS_RESULT_SUCCESS:
diff --git a/osx/README b/osx/README
index d666391..4428273 100644
--- a/osx/README
+++ b/osx/README
@@ -1,6 +1,6 @@
This is a guide to building gedit on OS X. This guide assumes that you are
already familiar with building gtk+ software on OS X (natively) using jhbuild.
-Please make sure to read http://sourceforge.net/apps/trac/gtk-osx/wiki/Build
+Please make sure to read https://live.gnome.org/GTK%2B/OSX/Building
before proceeding.
Note: Terminal commands are preceded by dollar signs.
@@ -14,9 +14,19 @@ http://git.gnome.org/browse/gtk-osx/plain/gtk-osx-build-setup.sh
$ curl -O http://git.gnome.org/browse/gtk-osx/plain/gtk-osx-build-setup.sh
$ sh gtk-osx-build-setup.sh
-Make sure that you are not conflicting anything from fink/macports. If you
-are using fink/macports, you can add the following to your ~/.bashrc to
-remove any PATHS related to fink/macports when using jhbuild:
+Some of the newer releases of gnome software are only providing .xz packages.
+To be able to extract the contents of these packages, you will need to install
+xz utils. The easiest way to install is to use a dmg package available on:
+
+http://macpkg.sourceforge.net/
+
+Make sure to include /usr/local/bin in your PATH and alsothat you are not
+conflicting anything from fink/macports. If you are using fink/macports, you
+can add the following to your ~/.bashrc to remove any PATHS related to
+fink/macports when using jhbuild:
+
+ # Add /usr/local/bin
+ export PATH="$PATH:/usr/local/bin"
# Remove fink/macports path from PATH and store in local var origpath
origpath=$(echo $PATH | sed -E -e 's;:?/opt/local/bin;;' -e 's;:?/opt/local/sbin;;')
diff --git a/osx/gedit.bundle b/osx/gedit.bundle
index ec73ad2..d2ffa96 100644
--- a/osx/gedit.bundle
+++ b/osx/gedit.bundle
@@ -73,6 +73,7 @@
<!-- DBUS -->
<binary>${prefix}/bin/dbus-*</binary>
<data>${prefix}/etc/dbus-1</data>
+ <data>${prefix}/share/dbus-1</data>
<binary>${prefix}/libexec/dbus-daemon-launch-helper</binary>
<!-- Copy in peas modules -->
@@ -88,6 +89,7 @@
<data>${prefix}/lib/python2.7/site-packages/cairo</data>
<data>${prefix}/lib/python2.7/site-packages/gi</data>
<data>${prefix}/lib/python2.7/site-packages/libxml2.py</data>
+ <data>${prefix}/include/python2.7/pyconfig.h</data>
<binary>${prefix}/lib/python2.7/lib-dynload/*.so</binary>
<data>${prefix}/lib/python2.7</data>
diff --git a/osx/jhbuild/gedit.modules b/osx/jhbuild/gedit.modules
index 633c9c6..007bb72 100644
--- a/osx/jhbuild/gedit.modules
+++ b/osx/jhbuild/gedit.modules
@@ -20,6 +20,9 @@
href="http://www.abisource.com/downloads/enchant/" />
<repository type="tarball" name="sourceware.org"
href="ftp://sourceware.org/pub/"/>
+ <repository type="tarball" name="dbus.freedesktop.org"
+ href="http://dbus.freedesktop.org/releases/"/>
+
<autotools id="iso-codes" autogen-sh="configure" >
<branch repo="iso-codes" version="3.32"
module="iso-codes-3.32.tar.bz2"/>
@@ -104,7 +107,7 @@
</dependencies>
</autotools>
- <autotools id="dconf">
+ <autotools id="dconf" autogen-sh="autoreconf">
<branch module="dconf/0.10/dconf-0.10.0.tar.bz2"
version="0.10.0"
hash="sha256:4b034e9e5560ab703f60bb2b6dc1ada7856416660af7dd1207c2c3ab9c9d533b">
@@ -256,6 +259,20 @@
</dependencies>
</autotools>
+ <autotools id="dbus" autogen-sh='configure'
+ autogenargs="--disable-selinux --without-x --disable-launchd
+ --with-session-socket-dir=/var/tmp">
+ <branch module="dbus/dbus-1.4.1.tar.gz" version="1.4.1"
+ repo="dbus.freedesktop.org">
+ <patch file="http://git.gnome.org/browse/gtk-osx/plain/patches/dbus-install.patch"/>
+ <patch file="http://git.gnome.org/browse/gtk-osx/plain/patches/dbus-msg-nosignal.patch" strip="1"/>
+ <patch file="http://git.gnome.org/browse/gedit/plain/osx/jhbuild/patches/dbus-relocatable-services.patch" strip="1"/>
+ </branch>
+ <after>
+ <dep package="gtk+-3.0"/>
+ </after>
+ </autotools>
+
<autotools id="libgcrypt" autogen-sh="configure" autogenargs="--disable-asm --disable-aesni-support">
<branch repo='ftp.gnupg.org' version='1.5.0'
module='gcrypt/libgcrypt/libgcrypt-1.5.0.tar.bz2'/>
@@ -265,7 +282,7 @@
</autotools>
<autotools id="gedit" autogenargs="DATADIRNAME=share">
- <branch module="gedit" revision="3.2.6-osx-2"/>
+ <branch repo="git.gnome.org" module="gedit" revision="3.2.6-osx-3"/>
<dependencies>
<dep package="meta-gtk-osx-bootstrap"/>
<dep package="meta-gtk-osx-gtk3"/>
diff --git a/osx/jhbuild/patches/dbus-relocatable-services.patch b/osx/jhbuild/patches/dbus-relocatable-services.patch
new file mode 100644
index 0000000..e51e6df
--- /dev/null
+++ b/osx/jhbuild/patches/dbus-relocatable-services.patch
@@ -0,0 +1,37 @@
+--- a/dbus/dbus-sysdeps-unix.c 2010-12-16 14:53:48.000000000 +0100
++++ b/dbus/dbus-sysdeps-unix.c 2012-01-17 13:24:13.000000000 +0100
+@@ -55,6 +55,7 @@
+ #include <netinet/in.h>
+ #include <netdb.h>
+ #include <grp.h>
++#include <limits.h>
+
+ #ifdef HAVE_ERRNO_H
+ #include <errno.h>
+@@ -3828,7 +3829,25 @@
+ const char *
+ _dbus_replace_install_prefix (const char *configure_time_path)
+ {
+- return configure_time_path;
++ const char *runtime_prefix;
++ static char retval[PATH_MAX];
++
++ if (!configure_time_path)
++ return NULL;
++
++ runtime_prefix = getenv ("DBUS_REPLACE_INSTALL_PREFIX");
++
++ if (!runtime_prefix ||
++ strncmp (configure_time_path, DBUS_PREFIX "/",
++ strlen (DBUS_PREFIX) + 1)) {
++ strcat (retval, configure_time_path);
++ return retval;
++ }
++
++ strncpy (retval, runtime_prefix, PATH_MAX - 1);
++ strncat (retval, configure_time_path + strlen (DBUS_PREFIX) + 1, PATH_MAX - 1 - strlen (runtime_prefix));
++
++ return retval;
+ }
+
+ /* tests in dbus-sysdeps-util.c */
diff --git a/osx/launcher.sh b/osx/launcher.sh
index f34f724..4c707da 100755
--- a/osx/launcher.sh
+++ b/osx/launcher.sh
@@ -33,10 +33,12 @@ export GTK_PATH="$bundle_res"
export GDK_PIXBUF_MODULE_FILE="$bundle_lib/gdk-pixbuf-2.0/2.10.0/loaders.cache"
export GIO_EXTRA_MODULES="$bundle_lib/gio/modules"
export GI_TYPELIB_PATH="$bundle_lib/girepository-1.0"
-export PYTHONPATH="$bundle_lib/python2.6/site-packages:$PYTHONPATH"
+export PYTHONPATH="$bundle_lib/python2.7/site-packages:$PYTHONPATH"
+export PYTHONHOME="$bundle_res"
export PANGO_LIBDIR="$bundle_lib"
export PANGO_SYSCONFDIR="$bundle_etc"
export PEAS_PLUGIN_LOADERS_DIR="$bundle_lib/libpeas-1.0/loaders"
+export DBUS_REPLACE_INSTALL_PREFIX="$bundle_res/"
if test -f "$bundle_lib/charset.alias"; then
export CHARSETALIASDIR="$bundle_lib"
diff --git a/osx/makebundle.sh b/osx/makebundle.sh
index 75d4a54..429988e 100755
--- a/osx/makebundle.sh
+++ b/osx/makebundle.sh
@@ -1,10 +1,14 @@
-#!/bin/sh
+#!/bin/bash
if [ -d gedit.app ] && [ "$1x" = "-fx" ]; then
rm -rf gedit.app
fi
-gtk-mac-bundler gedit.bundle
+if [ ! -d gedit.app ]; then
+ gtk-mac-bundler gedit.bundle
+else
+ echo "Note gedit.app bundle already exists, only stripping it..."
+fi
function do_strip {
tp=$(file -b --mime-type "$1")
@@ -18,9 +22,9 @@ function do_strip {
strip -o "$name" -S "$1"
mv -f "$name" "$1"
-
+
chmod "$st" "$1"
- chmod u+w "$1"
+ chmod u+w "$1"
}
echo "Removing unneeded files from bundle"
@@ -33,7 +37,7 @@ done
echo "Strip debug symbols from bundle binaries"
# Strip debug symbols
-for i in $(find gedit.app/Contents/Resources -type f -regex '\.(so|dylib)$'); do
+for i in $(find -E 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 7c57f85..3f89870 100755
--- a/osx/makedmg.sh
+++ b/osx/makedmg.sh
@@ -5,7 +5,7 @@
pushd $(dirname $0) &>/dev/null
echo "Generating bundle..."
-./makebundle.sh -f
+./makebundle.sh
VOLUME_NAME=gedit
diff --git a/osx/template.dmg b/osx/template.dmg
index 9f79d71..01eb9e0 100644
Binary files a/osx/template.dmg and b/osx/template.dmg differ
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]