[gtk-osx] Get Devhelp to build in modulesets-stable



commit 2a5a00cdc20b631f72b4e6672801757d56dd0504
Author: Philip Chimento <philip chimento gmail com>
Date:   Sun Nov 13 15:33:40 2011 +0100

    Get Devhelp to build in modulesets-stable
    
    Here are three patches for getting Devhelp to build in
    modulesets-stable. First, Devhelp depends on libunique, which I
    have added to gtk-osx-random.modules. Libunique needs a patch to
    run properly, see bgo#663913, since otherwise it crashes when
    Devhelp starts.
    
    Then, the patch from bgo#646962 corrects a syntax error in Devhelp,
    and the patch from bgo#663789 ports Devhelp to GtkOSXApplication.
    
    There is also an issue with the libtool script in the Devhelp
    tarball. For more info, see the pull request. For that reason
    mainly, I have changed the moduleset entry to
    autogen-sh="autogen.sh" instead of "configure".

 modulesets-stable/gtk-osx-random.modules       |   27 +++-
 modulesets-stable/gtk-osx-unsupported.modules  |    6 +-
 patches/devhelp-646962-variable-name.patch     |   27 ++++
 patches/devhelp-663789-gtkosxapplication.patch |  196 ++++++++++++++++++++++++
 patches/libunique-663913-sockaddr-un.patch     |   48 ++++++
 5 files changed, 298 insertions(+), 6 deletions(-)
---
diff --git a/modulesets-stable/gtk-osx-random.modules b/modulesets-stable/gtk-osx-random.modules
index f7168f2..2aedbc3 100644
--- a/modulesets-stable/gtk-osx-random.modules
+++ b/modulesets-stable/gtk-osx-random.modules
@@ -82,10 +82,24 @@ Libglade itself is deprecated. This is the last release. -->
     </after>
   </autotools>
 
+  <autotools id="libunique" autogen-sh="configure"
+             autogenargs="--without-x --disable-dbus">
+    <branch module="libunique/1.1/libunique-1.1.6.tar.bz2" version="1.1.6"
+            hash="sha256:e5c8041cef8e33c55732f06a292381cb345db946cf792a4ae18aa5c66cdd4fbb">
+      <patch file="http://git.gnome.org/browse/gtk-osx/plain/patches/libunique-663913-sockaddr-un.patch"; strip="1"/>
+    </branch>
+    <dependencies>
+       <dep package="gtk+"/>
+	</dependencies>
+  </autotools>
+
 <!-- This is, I think, the last Gtk+2 version -->
-  <autotools id="devhelp" autogen-sh="configure">
+  <autotools id="devhelp" autogen-sh="autogen.sh">
     <branch module="devhelp/2.32/devhelp-2.32.0.tar.bz2" version="2.32.0"
-            hash="sha256:61b342cbaf27379be9baa5df1f34c9464916601ec4378fa7e1c76fcc686553e4"/>
+            hash="sha256:61b342cbaf27379be9baa5df1f34c9464916601ec4378fa7e1c76fcc686553e4">
+      <patch file="http://git.gnome.org/browse/gtk-osx/plain/patches/devhelp-663789-gtkosxapplication.patch"; strip="1"/>
+      <patch file="http://git.gnome.org/browse/gtk-osx/plain/patches/devhelp-646962-variable-name.patch"; strip="1"/>
+    </branch>
     <after>
       <dep package="meta-gtk-osx-bootstrap"/>
       <dep package="meta-gtk-osx-themes"/>
@@ -93,10 +107,15 @@ Libglade itself is deprecated. This is the last release. -->
     </after>
     <dependencies>
       <dep package="WebKit"/>
+      <dep package="libunique"/>
     </dependencies>
   </autotools>
 
-  <autotools id="devhelp" autogen-sh="configure">
+<!-- Devhelp-gtk3 depends upon Webkit for Gtk3, something that I
+     haven't gotten to build yet. If you want to give it a try, you'll
+     be using WebKit-svn, which is enormous and difficult. Good
+     Luck. -->
+  <autotools id="devhelp-gtk3" autogen-sh="configure">
     <branch module="devhelp/3.2/devhelp-3.2.0.tar.bz2" version="3.2.0"
             hash="sha256:1341d1060c094956e8496c9ed68334192ca963fa211489737a0b84a4693c232d"/>
     <after>
@@ -105,7 +124,7 @@ Libglade itself is deprecated. This is the last release. -->
       <dep package="meta-gtk-osx-gtk3"/>
     </after>
     <dependencies>
-      <dep package="WebKit"/>
+      <dep package="WebKit-svn"/>
     </dependencies>
   </autotools>
 
diff --git a/modulesets-stable/gtk-osx-unsupported.modules b/modulesets-stable/gtk-osx-unsupported.modules
index 48f25b7..59808db 100644
--- a/modulesets-stable/gtk-osx-unsupported.modules
+++ b/modulesets-stable/gtk-osx-unsupported.modules
@@ -182,11 +182,13 @@ This issue was closed by revision r827.
       <patch file="http://git.gnome.org/browse/gtk-osx/plain/patches/webkit-disallowctype.patch"; strip="1"/>
     </branch>
     <dependencies>
-      <dep package="libsoup"/>
       <dep package="enchant"/>
     </dependencies>
     <after>
+      <dep package="libsoup"/>
+      <dep package="libsoup-gtk3"/>
       <dep package="meta-gtk-osx-core"/>
+      <dep package="meta-gtk-osx-gtk3"/>
       <dep package="libcurl"/>
       <dep package="bison"/>
     </after>
@@ -196,7 +198,7 @@ This issue was closed by revision r827.
 	     autogenargs="--with-target=quartz --disable-video --with-font-backend=pango">
     <branch repo="svn.webkit.org" module="webkit/trunk" checkoutdir="WebKit"/>
     <dependencies>
-      <dep package="libsoup"/>
+      <dep package="libsoup-gtk3"/>
       <dep package="enchant"/>
       <!--dep package="libgail"/-->
     </dependencies>
diff --git a/patches/devhelp-646962-variable-name.patch b/patches/devhelp-646962-variable-name.patch
new file mode 100644
index 0000000..df3b486
--- /dev/null
+++ b/patches/devhelp-646962-variable-name.patch
@@ -0,0 +1,27 @@
+From f52897a18a73ab6ff406016ada80932511ec5e25 Mon Sep 17 00:00:00 2001
+From: P. F. Chimento <philip chimento gmail com>
+Date: Wed, 6 Apr 2011 23:28:22 +0200
+Subject: [PATCH] Fix variable name for OS X build
+
+There was a syntax error in book_manager_add_from_xcode_docset,
+which broke the build on OS X.
+---
+ src/dh-book-manager.c |    2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+diff --git a/src/dh-book-manager.c b/src/dh-book-manager.c
+index 4416d7f..aa1d605 100644
+--- a/src/dh-book-manager.c
++++ b/src/dh-book-manager.c
+@@ -563,7 +563,7 @@ book_manager_add_from_xcode_docset (DhBookManager *book_manager,
+                                ".devhelp2") == 0) {
+                         gchar *book_path;
+ 
+-                        book_path = g_build_filename (path, name, NULL);
++                        book_path = g_build_filename (dir_path, name, NULL);
+                         /* Add book from filepath */
+                         book_manager_add_from_filepath (book_manager,
+                                                         book_path);
+-- 
+1.7.3.2
+
diff --git a/patches/devhelp-663789-gtkosxapplication.patch b/patches/devhelp-663789-gtkosxapplication.patch
new file mode 100644
index 0000000..db93a55
--- /dev/null
+++ b/patches/devhelp-663789-gtkosxapplication.patch
@@ -0,0 +1,196 @@
+From 8ab0bd8207146f231b20c1bf66e9e806a05ebb97 Mon Sep 17 00:00:00 2001
+From: Philip Chimento <philip chimento gmail com>
+Date: Thu, 10 Nov 2011 17:47:22 +0100
+Subject: [PATCH] Convert IgeMacIntegration to GtkOSXApplication
+
+IgeMacIntegration is deprecated and only works on 32-bit Macs;
+this change is necessary for Devhelp to build on 64-bit Macs.
+---
+ configure.ac    |    6 +++---
+ src/dh-util.c   |   51 ++++++++-------------------------------------------
+ src/dh-window.c |   38 +++++++++++++++++++++++---------------
+ 3 files changed, 34 insertions(+), 61 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index 7b6ee60..94742a3 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -42,14 +42,14 @@ IGE_PLATFORM_CHECK
+ if test "x$IGE_PLATFORM" = xx11; then
+    gconf_pkgconfig="gconf-2.0 >= 2.6.0"
+    libwnck_pkgconfig="libwnck-1.0 >= 2.10.0"
+-   igemacintegration_pkgconfig=
++   gtkmacintegration_pkgconfig=
+    REQUIRES_LIBWNCK=libwnck-1.0
+    PLATFORM_CFLAGS=
+    PLATFORM_LDFLAGS=
+ else
+    gconf_pkgconfig=
+    libwnck_pkgconfig=
+-   igemacintegration_pkgconfig="ige-mac-integration >= 0.8.2"
++   gtkmacintegration_pkgconfig="gtk-mac-integration >= 1.0.0"
+    REQUIRES_LIBWNCK=
+    PLATFORM_CFLAGS=
+    PLATFORM_LDFLAGS=
+@@ -70,7 +70,7 @@ PKG_CHECK_MODULES(LIBDEVHELP, [
+   gtk+-2.0 >= 2.10.0
+   $gconf_pkgconfig
+   $libwnck_pkgconfig
+-  $igemacintegration_pkgconfig
++  $gtkmacintegration_pkgconfig
+   webkit-1.0 >= 1.1.13
+ ])
+ 
+diff --git a/src/dh-util.c b/src/dh-util.c
+index 2453c9b..9c1bc51 100644
+--- a/src/dh-util.c
++++ b/src/dh-util.c
+@@ -24,7 +24,7 @@
+ #include <stdlib.h>
+ #include <gtk/gtk.h>
+ #ifdef GDK_WINDOWING_QUARTZ
+-#include <CoreFoundation/CoreFoundation.h>
++#include <gtkosxapplication.h>
+ #endif
+ #include "ige-conf.h"
+ #include "dh-util.h"
+@@ -120,34 +120,10 @@ dh_util_builder_connect (GtkBuilder *builder,
+ 
+ #ifdef GDK_WINDOWING_QUARTZ
+ static gchar *
+-cf_string_to_utf8 (CFStringRef str)
+-{
+-  CFIndex  len;
+-  gchar   *ret;
+-
+-  len = CFStringGetMaximumSizeForEncoding (CFStringGetLength (str),
+-                                           kCFStringEncodingUTF8) + 1;
+-
+-  ret = g_malloc (len);
+-  ret[len] = '\0';
+-
+-  if (CFStringGetCString (str, ret, len, kCFStringEncodingUTF8))
+-    return ret;
+-
+-  g_free (ret);
+-  return NULL;
+-}
+-
+-static gchar *
+ util_get_mac_data_dir (void)
+ {
+-        const gchar *env;
+-        CFBundleRef  cf_bundle;
+-        UInt32       type;
+-        UInt32       creator;
+-        CFURLRef     cf_url;
+-        CFStringRef  cf_string;
+-        gchar       *ret, *tmp;
++        const gchar *env, *ret;
++        gchar       *tmp;
+ 
+         /* The environment variable overrides all. */
+         env = g_getenv ("DEVHELP_DATADIR");
+@@ -155,25 +131,14 @@ util_get_mac_data_dir (void)
+                 return g_strdup (env);
+         }
+ 
+-        cf_bundle = CFBundleGetMainBundle ();
+-        if (!cf_bundle) {
+-                return NULL;
+-        }
+-
+-        /* Only point into the bundle if it's an application. */
+-        CFBundleGetPackageInfo (cf_bundle, &type, &creator);
+-        if (type != 'APPL') {
++        /* If we are not in a bundle, then follow the normal rules. */
++        if (quartz_application_get_bundle_id () == NULL) {
+                 return NULL;
+         }
+ 
+-        cf_url = CFBundleCopyBundleURL (cf_bundle);
+-        cf_string = CFURLCopyFileSystemPath (cf_url, kCFURLPOSIXPathStyle);
+-        ret = cf_string_to_utf8 (cf_string);
+-        CFRelease (cf_string);
+-        CFRelease (cf_url);
+-
+-        tmp = g_build_filename (ret, "Contents", "Resources", NULL);
+-        g_free (ret);
++        ret = quartz_application_get_resource_path ();
++        tmp = g_strdup (ret);
++        g_printerr("ret: %s\n", tmp);
+ 
+         return tmp;
+ }
+diff --git a/src/dh-window.c b/src/dh-window.c
+index 2fcec5f..d5036d5 100644
+--- a/src/dh-window.c
++++ b/src/dh-window.c
+@@ -33,7 +33,7 @@
+ #include <webkit/webkit.h>
+ 
+ #ifdef GDK_WINDOWING_QUARTZ
+-#include <ige-mac-integration.h>
++#include <gtkosxapplication.h>
+ #endif
+ 
+ #include "dh-book-tree.h"
+@@ -1086,33 +1086,41 @@ window_populate (DhWindow *window)
+ 
+ #ifdef GDK_WINDOWING_QUARTZ
+         {
+-                GtkWidget       *widget;
+-                IgeMacMenuGroup *group;
++                GtkWidget         *widget, *sep;
++                GtkOSXApplication *theApp;
+ 
+                 /* Hide toolbar labels. */
+                 gtk_toolbar_set_style (GTK_TOOLBAR (toolbar), GTK_TOOLBAR_ICONS);
+ 
+                 /* Setup menubar. */
+-                ige_mac_menu_set_menu_bar (GTK_MENU_SHELL (menubar));
++                theApp = g_object_new (GTK_TYPE_OSX_APPLICATION, NULL);
++                gtk_osxapplication_set_menu_bar (theApp, GTK_MENU_SHELL (menubar));
+                 gtk_widget_hide (menubar);
+ 
+                 widget = gtk_ui_manager_get_widget (priv->manager, "/MenuBar/FileMenu/Quit");
+-                ige_mac_menu_set_quit_menu_item (GTK_MENU_ITEM (widget));
++                gtk_widget_hide (widget);
+ 
+-                group =  ige_mac_menu_add_app_menu_group ();
+                 widget = gtk_ui_manager_get_widget (priv->manager, "/MenuBar/HelpMenu/About");
+-                ige_mac_menu_add_app_menu_item (group, GTK_MENU_ITEM (widget),
+-                                                /* i18n: please don't translate
+-                                                 * "Devhelp", it's a name, not a
+-                                                 * generic word. */
+-                                                _("About Devhelp"));
++                gtk_osxapplication_insert_app_menu_item (theApp, widget, 0);
++                sep = gtk_separator_menu_item_new ();
++                g_object_ref (sep);
++                gtk_osxapplication_insert_app_menu_item (theApp, sep, 1);
+ 
+-                group =  ige_mac_menu_add_app_menu_group ();
+                 widget = gtk_ui_manager_get_widget (priv->manager, "/MenuBar/EditMenu/Preferences");
+-                ige_mac_menu_add_app_menu_item (group, GTK_MENU_ITEM (widget),
+-                                                _("Preferencesâ"));
++                gtk_osxapplication_insert_app_menu_item (theApp, widget, 2);
++                sep = gtk_separator_menu_item_new ();
++                g_object_ref (sep);
++                gtk_osxapplication_insert_app_menu_item (theApp, sep, 3);
+ 
+-                ige_mac_menu_set_global_key_handler_enabled (TRUE);
++                widget = gtk_ui_manager_get_widget (priv->manager, "/MenuBar/HelpMenu");
++                gtk_osxapplication_set_help_menu (theApp, GTK_MENU_ITEM (widget));
++
++                g_signal_connect (theApp,
++                                  "NSApplicationWillTerminate",
++                                  G_CALLBACK (window_activate_quit),
++                                  window);
++
++                gtk_osxapplication_ready (theApp);
+         }
+ #endif
+ 
+-- 
+1.7.3.2
+
diff --git a/patches/libunique-663913-sockaddr-un.patch b/patches/libunique-663913-sockaddr-un.patch
new file mode 100644
index 0000000..a46c118
--- /dev/null
+++ b/patches/libunique-663913-sockaddr-un.patch
@@ -0,0 +1,48 @@
+From 82526c33fac5e6d9ebf64b741f804fb3c604e691 Mon Sep 17 00:00:00 2001
+From: Philip Chimento <philip chimento gmail com>
+Date: Thu, 10 Nov 2011 23:20:08 +0100
+Subject: [PATCH] Don't use UNIX_PATH_MAX in struct sockaddr_un
+
+Use sizeof (uaddr.sun_path) in uniquebackend-bacon.c, since the
+fixed value of UNIX_PATH_MAX is not portable and caused crashes on
+OSX, for example.
+---
+ unique/bacon/uniquebackend-bacon.c |    8 ++------
+ 1 files changed, 2 insertions(+), 6 deletions(-)
+
+diff --git a/unique/bacon/uniquebackend-bacon.c b/unique/bacon/uniquebackend-bacon.c
+index bf5e297..c762df5 100644
+--- a/unique/bacon/uniquebackend-bacon.c
++++ b/unique/bacon/uniquebackend-bacon.c
+@@ -45,10 +45,6 @@
+ #include "uniquemessage-bacon.h"
+ #include "uniquebackend-bacon.h"
+ 
+-#ifndef UNIX_PATH_MAX
+-#define UNIX_PATH_MAX 108
+-#endif
+-
+ struct _UniqueBackendBacon
+ {
+   UniqueBackend parent_instance;
+@@ -258,7 +254,7 @@ try_client (UniqueBackendBacon *backend)
+ 
+   g_assert (backend->socket_path != NULL);
+ 
+-  path_len = MIN (strlen (backend->socket_path) + 1, UNIX_PATH_MAX);
++  path_len = MIN (strlen (backend->socket_path) + 1, sizeof (uaddr.sun_path));
+ 
+   uaddr.sun_family = AF_UNIX;
+   strncpy (uaddr.sun_path, backend->socket_path, path_len);
+@@ -289,7 +285,7 @@ create_server (UniqueBackendBacon *backend)
+ 
+   g_assert (backend->socket_path != NULL);
+ 
+-  path_len = MIN (strlen (backend->socket_path) + 1, UNIX_PATH_MAX);
++  path_len = MIN (strlen (backend->socket_path) + 1, sizeof (uaddr.sun_path));
+ 
+   uaddr.sun_family = AF_UNIX;
+   strncpy (uaddr.sun_path, backend->socket_path, path_len);
+-- 
+1.7.3.2
+



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