ports/118514: [Patch] www/epiphany: Fix plist and add WebKit support

Ed Schouten ed at fxq.nl
Sun Dec 9 21:30:01 UTC 2007


>Number:         118514
>Category:       ports
>Synopsis:       [Patch] www/epiphany: Fix plist and add WebKit support
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Dec 09 21:30:01 UTC 2007
>Closed-Date:
>Last-Modified:
>Originator:     Ed Schouten
>Release:        FreeBSD 6.3-PRERELEASE i386
>Organization:
>Environment:
System: FreeBSD palm.hoeg.nl 6.3-PRERELEASE FreeBSD 6.3-PRERELEASE #0: Sun Nov 4 14:26:14 CET 2007 ed at palm.hoeg.nl:/usr/obj/usr/src/sys/PALM i386
>Description:
This PR should have actually been a change-request, but it also contains
a subtle bugfix, so I'm filing it under sw-bug.

In PR 118512 I sent a patch to add the www/webkit-gtk port, but
unfortunately we can't let Epiphany play with it yet. This is because
not long after the GNOME 2.20 release the WebKit folks changed their
API. I backported some of the fixes from the Epiphany SVN, which brings
it on par with the functionality before the API change.

I also noticed a bug when pkg_delete'ing Epiphany. I don't have pygnome
on my box, but it still tries to remove a file that's only present on
systems with pygnome installed. We'd better only remove it when pygnome
is installed. The proper %%PYTHON%% bits were already present in the
Makefile.
>How-To-Repeat:
Deinstall Epiphany on a system where it was built without pygnome. It
can't delete the proper .defs.
>Fix:
Apply the following patch. The small %%PYTHON%% part in the pkg-plist
fixes the plist issue.

--- www/epiphany/Makefile	2007-10-25 01:36:46.000000000 +0200
+++ www/epiphany/Makefile	2007-12-09 22:05:33.000000000 +0100
@@ -27,13 +27,11 @@
 USE_XLIB=	yes
 USE_PYTHON=	yes
 GNOME_DESKTOP_VERSION=2
-USE_GECKO=	firefox seamonkey firefox15<->firefox xulrunner
 USE_GNOME=	gnomeprefix gnomehack intlhack gnomedesktop desktopfileutils
 WANT_GNOME=	yes
 GNU_CONFIGURE=	yes
 USE_GMAKE=	yes
 INSTALLS_OMF=	yes
-CONFIGURE_ARGS=	--with-gecko=${GECKO}
 CONFIGURE_ENV=	CPPFLAGS="-I${LOCALBASE}/include ${PTHREAD_CFLAGS}" \
 		LIBS="-L${LOCALBASE}/lib ${PTHREAD_LIBS}"
 
@@ -71,10 +69,20 @@
 PLIST_SUB+=	PYTHON="@comment "
 .endif
 
+.if defined(WITH_WEBKIT)
+LIB_DEPENDS=	WebKitGtk:${PORTSDIR}/www/webkit-gtk
+CONFIGURE_ARGS+=--with-engine=webkit
+PLIST_SUB+=	GECKO="@comment "
+.else
+USE_GECKO=	firefox seamonkey firefox15<->firefox xulrunner
+CONFIGURE_ARGS+=--with-gecko=${GECKO}
+PLIST_SUB+=	GECKO=""
+.endif
+
 post-patch:
 	@${FIND} ${WRKSRC} -name "Makefile.in*" | ${XARGS} ${REINPLACE_CMD} -e \
 		 's|-lpthread|${PTHREAD_LIBS}|g'
-	@${REINPLACE_CMD} -e 's|execinfo.h|#|g' \
+	@${REINPLACE_CMD} -e 's|execinfo.h|#|g' -e 's|WebKitGdk|WebKitGtk|' \
 		${WRKSRC}/configure
 	@${REINPLACE_CMD} -e 's|/lib/mozilla/plugins"|/lib/browser_plugins" ":" MOZILLA_PREFIX "/lib/browser_linux_plugins"|' \
 		${WRKSRC}/embed/mozilla/mozilla-embed-single.cpp
--- www/epiphany/files/patch-webkit	1970-01-01 01:00:00.000000000 +0100
+++ www/epiphany/files/patch-webkit	2007-12-09 22:06:38.000000000 +0100
@@ -0,0 +1,171 @@
+--- embed/webkit/webkit-embed-single.cpp	2007-08-27 22:19:01.000000000 +0200
++++ embed/webkit/webkit-embed-single.cpp	2007-12-09 21:48:54.000000000 +0100
+@@ -22,6 +22,8 @@
+ #include <glib/gi18n.h>
+ #include <libgnomevfs/gnome-vfs-utils.h>
+ 
++#include <webkitglobal.h>
++
+ #include "webkit-embed-single.h"
+ #include "ephy-embed-single.h"
+ #include "ephy-cookie-manager.h"
+@@ -129,7 +131,7 @@
+ {
+   /* If you alter the return values here, remember to update
+    * the docs in ephy-embed-single.c */
+-  return "webkit"; 
++  return "WebKit"; 
+ }
+ 
+ static GList *
+@@ -207,6 +209,8 @@
+ static gboolean
+ impl_init (EphyEmbedSingle *esingle)
+ {
++  webkit_init();
++
+   return TRUE;
+ }
+ 
+--- embed/webkit/webkit-embed.cpp	2007-08-27 22:19:01.000000000 +0200
++++ embed/webkit/webkit-embed.cpp	2007-12-09 22:01:43.000000000 +0100
+@@ -27,8 +27,8 @@
+ #include "ephy-string.h"
+ #include "ephy-embed-event.h"
+ 
+-#include <webkitgtkpage.h>
+-#include <webkitgtkglobal.h>
++#include <webkitwebframe.h>
++#include <webkitwebview.h>
+ #include <string.h>
+ 
+ #include "webkit-embed.h"
+@@ -80,7 +80,7 @@
+ 
+ struct WebKitEmbedPrivate
+ {
+-  WebKitGtkPage *page;
++  WebKitWebView *web_view;
+   WebKitEmbedLoadState load_state;
+ };
+ 
+@@ -141,7 +141,7 @@
+ static void
+ webkit_embed_init (WebKitEmbed *embed)
+ {
+-  WebKitGtkPage *page;
++  WebKitWebView *web_view;
+ 
+   embed->priv = WEBKIT_EMBED_GET_PRIVATE (embed);
+ 
+@@ -150,11 +150,10 @@
+ 
+   gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (embed),
+                                   GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
+-  webkit_gtk_init ();
+-  page = WEBKIT_GTK_PAGE (webkit_gtk_page_new ());
+-  embed->priv->page = page;
+-  gtk_container_add (GTK_CONTAINER (embed), GTK_WIDGET (page));
+-  gtk_widget_show (GTK_WIDGET (page));
++  web_view = WEBKIT_WEB_VIEW (webkit_web_view_new ());
++  embed->priv->web_view = web_view;
++  gtk_container_add (GTK_CONTAINER (embed), GTK_WIDGET (web_view));
++  gtk_widget_show (GTK_WIDGET (web_view));
+ 
+ #if 0
+   g_signal_connect (G_OBJECT (page), "load-started",
+@@ -194,10 +193,24 @@
+                const char *url)
+ {
+   WebKitEmbed *wembed = WEBKIT_EMBED (embed);
++  char *effective_url;
+ 
+-  g_debug ("a url %s", url);
+-  
+-  webkit_gtk_page_open (wembed->priv->page, url);
++  /* FIXME: WebKit has some strange bug for which there must be
++   * protocol prefix into the parsed URL, or it will not show images
++   * and lock badly.  I copied this function from WebKit's
++   * GdkLauncher.
++   */
++  if (strncmp ("about:", url, 6)   != 0 &&
++      strncmp ("http://", url, 7)  != 0 &&
++      strncmp ("https://", url, 8) != 0 &&
++      strncmp ("file://", url, 7)  != 0 &&
++      strncmp ("ftp://", url, 6)   != 0) {
++    effective_url = g_strconcat ("http://", url, NULL);
++    webkit_web_view_open (wembed->priv->web_view, effective_url);
++    g_free (effective_url);
++  } else {
++    webkit_web_view_open (wembed->priv->web_view, url);
++  }
+ }
+ 
+ static char * impl_get_location (EphyEmbed *embed, gboolean toplevel);
+@@ -208,28 +221,25 @@
+ 	   EphyEmbedLoadFlags flags,
+ 	   EphyEmbed *preview_embed)
+ {
+-  WebKitEmbed *wembed = WEBKIT_EMBED (embed);
+-
+-  g_debug ("url %s", url);
+-  webkit_gtk_page_open (wembed->priv->page, url);
++  impl_load_url(embed, url);
+ }
+ 
+ static void
+ impl_stop_load (EphyEmbed *embed)
+ {
+-  webkit_gtk_page_stop_loading (WEBKIT_EMBED (embed)->priv->page);
++  webkit_web_view_stop_loading (WEBKIT_EMBED (embed)->priv->web_view);
+ }
+ 
+ static gboolean
+ impl_can_go_back (EphyEmbed *embed)
+ {
+-  return webkit_gtk_page_can_go_backward (WEBKIT_EMBED (embed)->priv->page);
++  return webkit_web_view_can_go_backward (WEBKIT_EMBED (embed)->priv->web_view);
+ }
+ 
+ static gboolean
+ impl_can_go_forward (EphyEmbed *embed)
+ {
+-  return webkit_gtk_page_can_go_forward (WEBKIT_EMBED (embed)->priv->page);
++  return webkit_web_view_can_go_forward (WEBKIT_EMBED (embed)->priv->web_view);
+ }
+ 
+ static gboolean
+@@ -247,13 +257,13 @@
+ static void
+ impl_go_back (EphyEmbed *embed)
+ {
+-  webkit_gtk_page_go_backward (WEBKIT_EMBED (embed)->priv->page);
++  webkit_web_view_go_backward (WEBKIT_EMBED (embed)->priv->web_view);
+ }
+ 		
+ static void
+ impl_go_forward (EphyEmbed *embed)
+ {
+-  webkit_gtk_page_go_forward (WEBKIT_EMBED (embed)->priv->page);
++  webkit_web_view_go_forward (WEBKIT_EMBED (embed)->priv->web_view);
+ }
+ 
+ static void
+@@ -283,14 +293,15 @@
+ impl_get_location (EphyEmbed *embed, 
+                    gboolean toplevel)
+ {
+-  return NULL;
++  WebKitWebFrame *web_frame = webkit_web_view_get_main_frame (WEBKIT_EMBED (embed)->priv->web_view);
++  return g_strdup (webkit_web_frame_get_location (web_frame));
+ }
+ 
+ static void
+ impl_reload (EphyEmbed *embed, 
+              gboolean force)
+ {
+-  webkit_gtk_page_reload (WEBKIT_EMBED (embed)->priv->page);  
++  webkit_web_view_reload (WEBKIT_EMBED (embed)->priv->web_view);  
+ }
+ 
+ static void
--- www/epiphany/pkg-plist	2007-10-25 01:36:46.000000000 +0200
+++ www/epiphany/pkg-plist	2007-12-09 22:11:49.000000000 +0100
@@ -33,8 +33,8 @@
 include/epiphany/%%EPHY_VERSION%%/epiphany/ephy-tab.h
 include/epiphany/%%EPHY_VERSION%%/epiphany/ephy-type-builtins.h
 include/epiphany/%%EPHY_VERSION%%/epiphany/ephy-window.h
-lib/epiphany/%%EPHY_VERSION%%/plugins/libdesktopfileplugin.la
-lib/epiphany/%%EPHY_VERSION%%/plugins/libdesktopfileplugin.so
+%%GECKO%%lib/epiphany/%%EPHY_VERSION%%/plugins/libdesktopfileplugin.la
+%%GECKO%%lib/epiphany/%%EPHY_VERSION%%/plugins/libdesktopfileplugin.so
 libdata/pkgconfig/epiphany-%%EPHY_VERSION%%.pc
 share/aclocal/epiphany.m4
 share/applications/bme.desktop
@@ -287,7 +287,7 @@
 share/omf/epiphany/epiphany-ru.omf
 share/omf/epiphany/epiphany-sv.omf
 share/omf/epiphany/epiphany-uk.omf
-share/pygtk/2.0/defs/epiphany.defs
+%%PYTHON%%share/pygtk/2.0/defs/epiphany.defs
 @dirrm share/omf/epiphany
 @dirrm share/gnome/help/epiphany/uk/figures
 @dirrm share/gnome/help/epiphany/uk
@@ -353,9 +353,9 @@
 @dirrm %%DATADIR%%/art
 @dirrm %%DATADIR%%
 @dirrm %%DOCSDIR%%
- at dirrm lib/epiphany/%%EPHY_VERSION%%/plugins
- at dirrm lib/epiphany/%%EPHY_VERSION%%
- at dirrm lib/epiphany
+%%GECKO%%@dirrm lib/epiphany/%%EPHY_VERSION%%/plugins
+%%GECKO%%@dirrm lib/epiphany/%%EPHY_VERSION%%
+%%GECKO%%@dirrm lib/epiphany
 @dirrm include/epiphany/%%EPHY_VERSION%%/epiphany
 @dirrm include/epiphany/%%EPHY_VERSION%%
 @dirrm include/epiphany
>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the freebsd-ports-bugs mailing list