diff options
author | Christian Persch <chpe@src.gnome.org> | 2008-03-11 05:57:45 +0800 |
---|---|---|
committer | Christian Persch <chpe@src.gnome.org> | 2008-03-11 05:57:45 +0800 |
commit | 7720c783b8a8f8911a79b965d9176aba839829e6 (patch) | |
tree | 7163a9238c97b44b40b0c455e7c7ebc70c08fa79 | |
parent | 888c589bd3ee139571fccf55d2b4bdfee27c2c7f (diff) | |
download | gsoc2013-epiphany-7720c783b8a8f8911a79b965d9176aba839829e6.tar.gz gsoc2013-epiphany-7720c783b8a8f8911a79b965d9176aba839829e6.tar.zst gsoc2013-epiphany-7720c783b8a8f8911a79b965d9176aba839829e6.zip |
Allow building with xulrunner 1.9. Patch by Alexander Sack; part of bug #503657
svn path=/trunk/; revision=8094
-rw-r--r-- | configure.ac | 40 | ||||
-rw-r--r-- | doc/reference/Makefile.am | 4 | ||||
-rw-r--r-- | embed/Makefile.am | 1 | ||||
-rw-r--r-- | embed/ephy-password-manager.c | 4 | ||||
-rw-r--r-- | embed/ephy-password-manager.h | 5 | ||||
-rw-r--r-- | embed/mozilla/AutoModalDialog.cpp | 1 | ||||
-rw-r--r-- | embed/mozilla/EphyBrowser.cpp | 1 | ||||
-rw-r--r-- | embed/mozilla/GtkNSSDialogs.cpp | 4 | ||||
-rw-r--r-- | embed/mozilla/Makefile.am | 8 | ||||
-rw-r--r-- | embed/mozilla/mozilla-embed-single.cpp | 250 | ||||
-rw-r--r-- | m4/gecko.m4 | 141 | ||||
-rw-r--r-- | plugins/desktop-file/Makefile.am | 7 | ||||
-rw-r--r-- | src/Makefile.am | 15 |
13 files changed, 424 insertions, 57 deletions
diff --git a/configure.ac b/configure.ac index 42375b823..b21883565 100644 --- a/configure.ac +++ b/configure.ac @@ -238,12 +238,44 @@ fi case "$gecko_cv_gecko" in xulrunner) min_version=1.8 ;; +libxul*) min_version=1.9 ;; *firefox) min_version=1.5 ;; *) AC_MSG_ERROR([Unsupported gecko "$gecko_cv_gecko"]) ;; esac # Added $gecko_cv_gecko-js for debian xulrunner brokenness -PKG_CHECK_MODULES([GECKO],[${gecko_cv_gecko}-xpcom >= $min_version ${gecko_cv_gecko}-js $gecko_cv_extra_pkg_dependencies]) +if test $gecko_cv_gecko != "libxul-embedding" -a $gecko_cv_gecko != "libxul"; then + PKG_CHECK_MODULES([GECKO],[ ${gecko_cv_gecko}-xpcom >= $min_version ${gecko_cv_gecko}-js $gecko_cv_extra_pkg_dependencies]) +else + GECKO_CFLAGS="$GECKO_CFLAGS -UDEBUG" + GECKO_LIBS="$GECKO_LIBS `pkg-config --libs ${gecko_cv_gecko}`" +fi + +AC_MSG_CHECKING(nspr in gecko) +if test "$GECKO_NSPR" != yes; then + AC_MSG_RESULT(no) + AC_MSG_CHECKING(nspr in system) + gecko_nspr= + if $PKG_CONFIG --exists mozilla-nspr; then + gecko_nspr=mozilla-nspr + elif $PKG_CONFIG --exists ${gecko_cv_gecko}-nspr; then + gecko_nspr=${gecko_cv_gecko}-nspr + fi + if $PKG_CONFIG --exists nspr; then + gecko_nspr=nspr + fi + if test -z "$gecko_nspr"; then + AC_MSG_ERROR([no nspr available]) + fi + + GECKO_CFLAGS="$GECKO_CFLAGS `$PKG_CONFIG --cflags ${gecko_nspr}`" + GECKO_LIBS="$GECKO_LIBS `$PKG_CONFIG --libs ${gecko_nspr}`" + _GECKO_CFLAGS="$GECKO_CFLAGS" + AC_MSG_RESULT(yes) +else + AC_MSG_RESULT(yes) +fi + AC_SUBST([GECKO_CFLAGS]) AC_SUBST([GECKO_LIBS]) @@ -533,7 +565,11 @@ AC_ARG_ENABLE([desktop-file-plugin], AC_MSG_RESULT([$enable_desktop_file_plugin]) if test "$enable_desktop_file_plugin" = "yes"; then - PKG_CHECK_MODULES([DESKTOP_FILE_PLUGIN_DEP],[${gecko_cv_gecko}-xpcom ${gecko_cv_gecko}-plugin gtk+-2.0 >= 2.6.0]) + if test "${gecko_cv_gecko}" = "libxul-embedding" -o "${gecko_cv_gecko}" = "libxul"; then + PKG_CHECK_MODULES([DESKTOP_FILE_PLUGIN_DEP],[${gecko_cv_gecko} mozilla-plugin gtk+-2.0 >= 2.6.0]) + else + PKG_CHECK_MODULES([DESKTOP_FILE_PLUGIN_DEP],[${gecko_cv_gecko}-xpcom ${gecko_cv_gecko}-plugin gtk+-2.0 >= 2.6.0]) + fi AC_SUBST([DESKTOP_FILE_PLUGIN_DEP_CFLAGS]) AC_SUBST([DESKTOP_FILE_PLUGIN_DEP_LIBS]) fi diff --git a/doc/reference/Makefile.am b/doc/reference/Makefile.am index 42d39f0a3..9ab714de9 100644 --- a/doc/reference/Makefile.am +++ b/doc/reference/Makefile.am @@ -207,10 +207,10 @@ DOC_OVERRIDES = if GTK_DOC_USE_LIBTOOL GTKDOC_CC = $(LIBTOOL) --mode=compile $(CC) $(INCLUDES) $(AM_CFLAGS) $(CFLAGS) -GTKDOC_LD = $(LIBTOOL) --mode=link $(CC) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) +GTKDOC_LD = $(LIBTOOL) --mode=link $(CXX) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) else GTKDOC_CC = $(CC) $(INCLUDES) $(AM_CFLAGS) $(CFLAGS) -GTKDOC_LD = $(CC) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) +GTKDOC_LD = $(CXX) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) endif # We set GPATH here; this gives us semantics for GNU make diff --git a/embed/Makefile.am b/embed/Makefile.am index e01687e74..7e93fe444 100644 --- a/embed/Makefile.am +++ b/embed/Makefile.am @@ -107,6 +107,7 @@ libephyembedfactory_la_CPPFLAGS += -I$(GECKO_INCLUDE_ROOT)/gtkembedmoz endif libephyembedfactory_la_CFLAGS = \ + $(GECKO_CFLAGS) \ $(DEPENDENCIES_CFLAGS) \ $(AM_CFLAGS) diff --git a/embed/ephy-password-manager.c b/embed/ephy-password-manager.c index ef3bb1e2c..a702d713e 100644 --- a/embed/ephy-password-manager.c +++ b/embed/ephy-password-manager.c @@ -80,6 +80,10 @@ ephy_password_info_copy (const EphyPasswordInfo *info) copy->host = g_strdup (info->host); copy->username = g_strdup (info->username); copy->password = g_strdup (info->password); + copy->httpRealm = g_strdup (info->httpRealm); + copy->passwordField = g_strdup (info->passwordField); + copy->usernameField = g_strdup (info->usernameField); + copy->formSubmitURL = g_strdup (info->formSubmitURL); return copy; } diff --git a/embed/ephy-password-manager.h b/embed/ephy-password-manager.h index 8dd2751af..499ccc9cf 100644 --- a/embed/ephy-password-manager.h +++ b/embed/ephy-password-manager.h @@ -44,6 +44,11 @@ typedef struct char *host; char *username; char *password; + + char *httpRealm; + char *formSubmitURL; + char *usernameField; + char *passwordField; } EphyPasswordInfo; struct _EphyPasswordManagerIface diff --git a/embed/mozilla/AutoModalDialog.cpp b/embed/mozilla/AutoModalDialog.cpp index 48df678fa..034730850 100644 --- a/embed/mozilla/AutoModalDialog.cpp +++ b/embed/mozilla/AutoModalDialog.cpp @@ -35,7 +35,6 @@ #include <nsIDOMDocument.h> #include <nsIDOMEvent.h> #include <nsIDOMEventTarget.h> -#include <nsIJSContextStack.h> #include <nsIPrivateDOMEvent.h> #include <nsPIDOMWindow.h> #include <nsServiceManagerUtils.h> diff --git a/embed/mozilla/EphyBrowser.cpp b/embed/mozilla/EphyBrowser.cpp index d4a53811b..3445e6d74 100644 --- a/embed/mozilla/EphyBrowser.cpp +++ b/embed/mozilla/EphyBrowser.cpp @@ -1567,6 +1567,7 @@ EphyBrowser::GetPIDOMWindow(nsPIDOMWindow **aPIWin) // get the private DOM window nsCOMPtr<nsPIDOMWindow> domWindowPrivate = do_QueryInterface(mDOMWindow); + NS_ENSURE_TRUE (domWindowPrivate, NS_ERROR_UNEXPECTED); // and the root window for that DOM window *aPIWin = domWindowPrivate->GetPrivateRoot(); diff --git a/embed/mozilla/GtkNSSDialogs.cpp b/embed/mozilla/GtkNSSDialogs.cpp index c21460b8c..6346ecb83 100644 --- a/embed/mozilla/GtkNSSDialogs.cpp +++ b/embed/mozilla/GtkNSSDialogs.cpp @@ -217,7 +217,7 @@ higgy_setup_dialog (GtkDialog *dialog, const gchar *stock_icon, } } - +#ifndef HAVE_GECKO_1_9 /** * Display a dialog box, showing 'View Certificate', 'Cancel', * and 'Accept' buttons. Optionally a checkbox can be shown, @@ -321,7 +321,7 @@ display_cert_warning_box (nsIInterfaceRequestor *ctx, gtk_widget_destroy (dialog); return res; } - +#endif /* HAVE_GECKO_1_9 */ /* Helper functions */ diff --git a/embed/mozilla/Makefile.am b/embed/mozilla/Makefile.am index 007cac5d0..f2581b887 100644 --- a/embed/mozilla/Makefile.am +++ b/embed/mozilla/Makefile.am @@ -91,6 +91,7 @@ libephymozillaembed_la_SOURCES += \ GtkNSSSecurityWarningDialogs.h endif + if ENABLE_SPELLCHECKER libephymozillaembed_la_SOURCES += \ GeckoSpellCheckEngine.cpp \ @@ -153,6 +154,13 @@ libephymozillaembed_la_CPPFLAGS = \ -DALLOW_PRIVATE_API \ $(AM_CPPFLAGS) +if HAVE_GECKO_1_9 +if HAVE_GECKO_XPCOM_GLUE +libephymozillaembed_la_CPPFLAGS += \ + -DXPCOM_GLUE_USE_NSPR +endif +endif + libephymozillaembed_la_CXXFLAGS = \ $(GECKO_CFLAGS) \ $(DEPENDENCIES_CFLAGS) \ diff --git a/embed/mozilla/mozilla-embed-single.cpp b/embed/mozilla/mozilla-embed-single.cpp index f95c8a107..7f71c1a0b 100644 --- a/embed/mozilla/mozilla-embed-single.cpp +++ b/embed/mozilla/mozilla-embed-single.cpp @@ -33,6 +33,11 @@ #include <nsStringAPI.h> +#ifdef XPCOM_GLUE +#include <nsXPCOMGlue.h> +#include <gtkmozembed_glue.cpp> +#endif + #include <gtkmozembed.h> #include <gtkmozembed_internal.h> #include <nsComponentManagerUtils.h> @@ -62,8 +67,11 @@ #include <nsNetCID.h> #endif /* ALLOW_PRIVATE_API */ -#ifndef HAVE_GECKO_1_9 -#include <nsIPassword.h> +#ifdef HAVE_GECKO_1_9 +#include <nsILoginInfo.h> +#include <nsILoginManager.h> +#else +init#include <nsIPassword.h> #include <nsIPasswordManager.h> #endif /* !HAVE_GECKO_1_9 */ @@ -324,6 +332,7 @@ mozilla_init_profile (void) profile_path = g_build_filename (ephy_dot_dir (), MOZILLA_PROFILE_DIR, (char *) NULL); + gtk_moz_embed_set_comp_path (profile_path); gtk_moz_embed_set_profile_path (profile_path, MOZILLA_PROFILE_NAME); g_free (profile_path); } @@ -371,6 +380,19 @@ mozilla_init_observer (MozillaEmbedSingle *single) } static void +mozilla_init_login_manager (MozillaEmbedSingle *single) +{ +#ifdef HAVE_GECKO_1_9 + nsCOMPtr<nsILoginManager> loginManager = + do_GetService (NS_LOGINMANAGER_CONTRACTID); + if (!loginManager) + g_warning ("Failed to instantiate LoginManager"); + else + g_debug ("LoginManager tapped"); +#endif /* HAVE_GECKO_1_9 */ +} + +static void user_css_register (MozillaEmbedSingle *single) { MozillaEmbedSinglePrivate *priv = single->priv; @@ -565,6 +587,57 @@ impl_init (EphyEmbedSingle *esingle) NS_LogInit (); #endif + nsresult rv; +#ifdef XPCOM_GLUE + static const GREVersionRange greVersion = { + "1.9a", PR_TRUE, + "2", PR_TRUE + }; + char xpcomLocation[4096]; + rv = GRE_GetGREPathWithProperties(&greVersion, 1, nsnull, 0, xpcomLocation, 4096); + if (NS_FAILED (rv)) + { + g_warning ("Could not find a suitable GRE!\n"); + return FALSE; + } + + // Startup the XPCOM Glue that links us up with XPCOM. + rv = XPCOMGlueStartup(xpcomLocation); + if (NS_FAILED (rv)) + { + g_warning ("Could not startup XPCOM glue!\n"); + return FALSE; + } + + rv = GTKEmbedGlueStartup(); + if (NS_FAILED (rv)) + { + g_warning ("Could not startup embed glue!\n"); + return FALSE; + } + + rv = GTKEmbedGlueStartupInternal(); + if (NS_FAILED (rv)) + { + g_warning ("Could not startup internal glue!\n"); + return FALSE; + } + + char *lastSlash = strrchr(xpcomLocation, '/'); + if (lastSlash) + *lastSlash = '\0'; + + gtk_moz_embed_set_path(xpcomLocation); +#else +#ifdef HAVE_GECKO_1_9 + gtk_moz_embed_set_path (MOZILLA_HOME); +#else + gtk_moz_embed_set_comp_path (MOZILLA_HOME); +#endif +#endif // XPCOM_GLUE + /* Fire up the beast */ + gtk_moz_embed_push_startup (); + /* Pre initialization */ mozilla_init_plugin_path (); @@ -581,8 +654,6 @@ impl_init (EphyEmbedSingle *esingle) gtk_moz_embed_set_directory_service_provider (dp); - /* Fire up the beast */ - gtk_moz_embed_push_startup (); /* FIXME check that it succeeded! */ mozilla_register_components (); @@ -600,7 +671,9 @@ impl_init (EphyEmbedSingle *esingle) mozilla_init_observer (single); - mozilla_stylesheet_init (single); + mozilla_stylesheet_init (single); + + mozilla_init_login_manager (single); return TRUE; } @@ -848,16 +921,95 @@ impl_list_passwords (EphyPasswordManager *manager) { GList *passwords = NULL; -#ifndef HAVE_GECKO_1_9 + nsCOMPtr<nsIIDNService> idnService + (do_GetService ("@mozilla.org/network/idn-service;1")); + NS_ENSURE_TRUE (idnService, NULL); + +#ifdef HAVE_GECKO_1_9 + nsILoginInfo **logins = nsnull; + PRUint32 count,i; + nsresult rv; + + nsCOMPtr<nsILoginManager> loginManager = + do_GetService (NS_LOGINMANAGER_CONTRACTID); + NS_ENSURE_TRUE (loginManager, NULL); + + loginManager -> GetAllLogins(&count, &logins); + + for (i=0; i < count; i++) { + nsString transfer; + nsString unicodeName; + rv = logins[i]->GetHostname (transfer); + if (NS_FAILED (rv)) continue; + + nsCString host; + idnService->ConvertACEtoUTF8 (NS_ConvertUTF16toUTF8(transfer), host); + if(transfer.IsVoid()) host.SetIsVoid(PR_TRUE); + + rv = logins[i]->GetHttpRealm (unicodeName); + if (NS_FAILED (rv)) continue; + nsCString httpRealm; + NS_UTF16ToCString (unicodeName, + NS_CSTRING_ENCODING_UTF8, httpRealm); + if(unicodeName.IsVoid()) httpRealm.SetIsVoid(PR_TRUE); + + rv = logins[i]->GetUsername (unicodeName); + if (NS_FAILED (rv)) continue; + nsCString userName; + NS_UTF16ToCString (unicodeName, + NS_CSTRING_ENCODING_UTF8, userName); + if(unicodeName.IsVoid()) userName.SetIsVoid(PR_TRUE); + + rv = logins[i]->GetUsernameField (unicodeName); + if (NS_FAILED (rv)) continue; + nsCString usernameField; + NS_UTF16ToCString (unicodeName, + NS_CSTRING_ENCODING_UTF8, usernameField); + if(unicodeName.IsVoid()) usernameField.SetIsVoid(PR_TRUE); + + rv = logins[i]->GetPassword (unicodeName); + if (NS_FAILED (rv)) continue; + nsCString userPassword; + NS_UTF16ToCString (unicodeName, + NS_CSTRING_ENCODING_UTF8, userPassword); + if(unicodeName.IsVoid()) userPassword.SetIsVoid(PR_TRUE); + + rv = logins[i]->GetPasswordField (unicodeName); + if (NS_FAILED (rv)) continue; + nsCString passwordField; + NS_UTF16ToCString (unicodeName, + NS_CSTRING_ENCODING_UTF8, passwordField); + if(unicodeName.IsVoid()) passwordField.SetIsVoid(PR_TRUE); + + rv = logins[i]->GetFormSubmitURL (unicodeName); + if (NS_FAILED (rv)) continue; + nsCString formSubmitURL; + NS_UTF16ToCString (unicodeName, + NS_CSTRING_ENCODING_UTF8, formSubmitURL); + if(unicodeName.IsVoid()) formSubmitURL.SetIsVoid(PR_TRUE); + + + EphyPasswordInfo *p = g_new0 (EphyPasswordInfo, 1); + p->host = !userName.IsVoid() ? g_strdup (host.get()) : nsnull; + p->username = !userName.IsVoid() ? g_strdup (userName.get()) : nsnull; + p->password = !userPassword.IsVoid() ? g_strdup (userPassword.get()) : nsnull; + p->httpRealm = !httpRealm.IsVoid() ? g_strdup(httpRealm.get()) : nsnull; + p->usernameField = !usernameField.IsVoid() ? g_strdup(usernameField.get()) : nsnull; + p->passwordField = !passwordField.IsVoid() ? g_strdup(passwordField.get()) : nsnull; + p->formSubmitURL = !formSubmitURL.IsVoid() ? g_strdup(formSubmitURL.get()) : nsnull; + + passwords = g_list_prepend (passwords, p); + } + + NS_FREE_XPCOM_ISUPPORTS_POINTER_ARRAY (count, logins); + +#else // HAVE_GECKO_1_9 + nsresult rv; nsCOMPtr<nsIPasswordManager> passwordManager = do_GetService (NS_PASSWORDMANAGER_CONTRACTID); if (!passwordManager) return NULL; - nsCOMPtr<nsIIDNService> idnService - (do_GetService ("@mozilla.org/network/idn-service;1")); - NS_ENSURE_TRUE (idnService, NULL); - nsCOMPtr<nsISimpleEnumerator> passwordEnumerator; passwordManager->GetEnumerator (getter_AddRefs(passwordEnumerator)); NS_ENSURE_TRUE (passwordEnumerator, NULL); @@ -910,31 +1062,85 @@ static void impl_remove_password (EphyPasswordManager *manager, EphyPasswordInfo *info) { -#ifndef HAVE_GECKO_1_9 - nsCOMPtr<nsIPasswordManager> pm = - do_GetService (NS_PASSWORDMANAGER_CONTRACTID); - if (!pm) return; + nsresult rv; + nsString host; + nsString userName; + nsString userNameField; + nsString password; + nsString passwordField; + nsString httpRealm; + nsString formSubmitURL; nsCOMPtr<nsIIDNService> idnService (do_GetService ("@mozilla.org/network/idn-service;1")); NS_ENSURE_TRUE (idnService, ); - nsresult rv; - nsCString host; - rv = idnService->ConvertUTF8toACE (nsCString(info->host), host); - NS_ENSURE_SUCCESS (rv, ); + if(info->formSubmitURL != nsnull) + g_debug("form submit url: %s", info->formSubmitURL); + else + g_debug("form submit url is NULL"); - nsString userName; NS_CStringToUTF16 (nsCString(info->username), NS_CSTRING_ENCODING_UTF8, userName); - pm->RemoveUser (host, userName); -#endif /* !HAVE_GECKO_1_9 */ + NS_CStringToUTF16 (nsCString(info->usernameField), + NS_CSTRING_ENCODING_UTF8, userNameField); + NS_CStringToUTF16 (nsCString(info->host), + NS_CSTRING_ENCODING_UTF8, host); + NS_CStringToUTF16 (nsCString(info->httpRealm), + NS_CSTRING_ENCODING_UTF8, httpRealm); + NS_CStringToUTF16 (nsCString(info->password), + NS_CSTRING_ENCODING_UTF8, password); + NS_CStringToUTF16 (nsCString(info->passwordField), + NS_CSTRING_ENCODING_UTF8, passwordField); + NS_CStringToUTF16 (nsCString(info->formSubmitURL), + NS_CSTRING_ENCODING_UTF8, formSubmitURL); + +#ifdef HAVE_GECKO_1_9 + if(!info->username) userName.SetIsVoid(PR_TRUE); + if(!info->usernameField) userNameField.SetIsVoid(PR_TRUE); + if(!info->host) host.SetIsVoid(PR_TRUE); + if(!info->httpRealm) httpRealm.SetIsVoid(PR_TRUE); + if(!info->password) password.SetIsVoid(PR_TRUE); + if(!info->passwordField) passwordField.SetIsVoid(PR_TRUE); + if(!info->formSubmitURL) formSubmitURL.SetIsVoid(PR_TRUE); + + nsCOMPtr<nsILoginManager> loginManager = + do_GetService (NS_LOGINMANAGER_CONTRACTID); + NS_ENSURE_TRUE (loginManager, ); + + nsCOMPtr<nsILoginInfo> login + (do_CreateInstance(NS_LOGININFO_CONTRACTID)); + + login->SetUsername(userName); + login->SetUsernameField(userNameField); + login->SetHostname(host); + login->SetHttpRealm(httpRealm); + login->SetFormSubmitURL(formSubmitURL); + login->SetPassword(password); + login->SetPasswordField(passwordField); + + rv = loginManager->RemoveLogin(login); + +#else /* !HAVE_GECKO_1_9 */ + nsCOMPtr<nsIPasswordManager> pm = + do_GetService (NS_PASSWORDMANAGER_CONTRACTID); + if (!pm) return; + + pm->RemoveUser (nsCString(info->host), userName); +#endif /* HAVE_GECKO_1_9 */ } static void impl_remove_all_passwords (EphyPasswordManager *manager) { -#ifndef HAVE_GECKO_1_9 +#ifdef HAVE_GECKO_1_9 + nsCOMPtr<nsILoginManager> loginManager = + do_GetService (NS_LOGINMANAGER_CONTRACTID); + NS_ENSURE_TRUE (loginManager, ); + + loginManager->RemoveAllLogins(); + +#else /* HAVE_GECKO_1_9 */ nsresult rv; nsCOMPtr<nsIPasswordManager> passwordManager = do_GetService (NS_PASSWORDMANAGER_CONTRACTID); diff --git a/m4/gecko.m4 b/m4/gecko.m4 index 0e8d58813..3455e94e2 100644 --- a/m4/gecko.m4 +++ b/m4/gecko.m4 @@ -32,6 +32,7 @@ # VARIABLE: Which gecko was found (e.g. "xulrunnner", "seamonkey", ...) # VARIABLE_FLAVOUR: The flavour of the gecko that was found # VARIABLE_HOME: +# VARIABLE_NSPR: set if nspr is provided by gecko flags # VARIABLE_PREFIX: # VARIABLE_INCLUDE_ROOT: # VARIABLE_VERSION: The version of the gecko that was found @@ -51,7 +52,7 @@ AC_PROG_AWK AC_MSG_CHECKING([which gecko to use]) AC_ARG_WITH([gecko], - AS_HELP_STRING([--with-gecko@<:@=mozilla|firefox|seamonkey|xulrunner@:>@], + AS_HELP_STRING([--with-gecko@<:@=mozilla|firefox|seamonkey|xulrunner|libxul-embedding|libxul@:>@], [Which gecko engine to use (autodetected by default)])) # Backward compat @@ -60,12 +61,15 @@ AC_ARG_WITH([mozilla],[],[with_gecko=$withval],[]) gecko_cv_gecko=$with_gecko # Autodetect gecko -_geckos="xulrunner firefox mozilla-firefox seamonkey mozilla" +_geckos="xulrunner firefox mozilla-firefox seamonkey mozilla libxul-embedding libxul" if test -z "$gecko_cv_gecko"; then for lizard in $_geckos; do if $PKG_CONFIG --exists $lizard-xpcom; then gecko_cv_gecko=$lizard break; + elif $PKG_CONFIG --exists $lizard-unstable; then + gecko_cv_gecko=$lizard + break; fi done fi @@ -82,6 +86,14 @@ else gecko_cv_have_gecko=yes fi +AC_MSG_CHECKING([manual gecko home set]) + +AC_ARG_WITH([gecko-home], + AS_HELP_STRING([--with-gecko-home@<:@=[path]@:>@], + [Manually set MOZILLA_FIVE_HOME])) + +gecko_cv_gecko_home=$with_gecko_home + # **************** # Define variables # **************** @@ -93,13 +105,24 @@ mozilla) gecko_cv_gecko_flavour=mozilla ;; seamonkey) gecko_cv_gecko_flavour=mozilla ;; *firefox) gecko_cv_gecko_flavour=toolkit ;; xulrunner) gecko_cv_gecko_flavour=toolkit ;; +libxul*) gecko_cv_gecko_flavour=toolkit ;; esac -_GECKO_INCLUDE_ROOT="`$PKG_CONFIG --variable=includedir ${gecko_cv_gecko}-xpcom`" -_GECKO_LIBDIR="`$PKG_CONFIG --variable=libdir ${gecko_cv_gecko}-xpcom`" -_GECKO_HOME="`$PKG_CONFIG --variable=libdir ${gecko_cv_gecko}-xpcom`" -_GECKO_PREFIX="`$PKG_CONFIG --variable=prefix ${gecko_cv_gecko}-xpcom`" - +if $PKG_CONFIG --exists ${gecko_cv_gecko}-xpcom; then + _GECKO_INCLUDE_ROOT="`$PKG_CONFIG --variable=includedir ${gecko_cv_gecko}-xpcom`" + _GECKO_CFLAGS="-I$_GECKO_INCLUDE_ROOT" + _GECKO_LIBDIR="`$PKG_CONFIG --variable=libdir ${gecko_cv_gecko}-xpcom`" + _GECKO_HOME="`$PKG_CONFIG --variable=libdir ${gecko_cv_gecko}-xpcom`" + _GECKO_PREFIX="`$PKG_CONFIG --variable=prefix ${gecko_cv_gecko}-xpcom`" + _GECKO_NSPR=no # XXX asac: this is currently a blind guess and should be a AC test +else + _GECKO_INCLUDE_ROOT="`$PKG_CONFIG --variable=includedir ${gecko_cv_gecko}`/unstable" + _GECKO_CFLAGS="`$PKG_CONFIG --cflags ${gecko_cv_gecko}` `$PKG_CONFIG --cflags ${gecko_cv_gecko}-unstable`" + _GECKO_LIBDIR="`$PKG_CONFIG --variable=sdkdir ${gecko_cv_gecko}`/bin" + _GECKO_HOME=$with_gecko_home + _GECKO_PREFIX="`$PKG_CONFIG --variable=prefix ${gecko_cv_gecko}`" + _GECKO_NSPR=no # XXX asac: this is currently a blind guess and should be a AC test +fi fi # if gecko_cv_have_gecko if test "$gecko_cv_gecko_flavour" = "toolkit"; then @@ -109,9 +132,11 @@ fi $1[]=$gecko_cv_gecko $1[]_FLAVOUR=$gecko_cv_gecko_flavour $1[]_INCLUDE_ROOT=$_GECKO_INCLUDE_ROOT +$1[]_CFLAGS=$_GECKO_CFLAGS $1[]_LIBDIR=$_GECKO_LIBDIR $1[]_HOME=$_GECKO_HOME $1[]_PREFIX=$_GECKO_PREFIX +$1[]_NSPR=$_GECKO_NSPR # ************************************************************** # This is really gcc-only @@ -182,7 +207,7 @@ if test "$gecko_cv_have_gecko" = "yes"; then AC_LANG_PUSH([C++]) _SAVE_CPPFLAGS="$CPPFLAGS" -CPPFLAGS="$CPPFLAGS $_GECKO_EXTRA_CPPFLAGS -I$_GECKO_INCLUDE_ROOT" +CPPFLAGS="$CPPFLAGS $_GECKO_EXTRA_CPPFLAGS $_GECKO_CFLAGS" AC_MSG_CHECKING([[whether we have a gtk 2 gecko build]]) AC_RUN_IFELSE( @@ -215,6 +240,18 @@ AC_COMPILE_IFELSE( [gecko_cv_have_debug=no]) AC_MSG_RESULT([$gecko_cv_have_debug]) +AC_MSG_CHECKING([[whether we have a xpcom glue]]) +AC_COMPILE_IFELSE( + [AC_LANG_SOURCE( + [[ + #ifndef XPCOM_GLUE + #error "no xpcom glue found" + #endif]] + )], + [gecko_cv_have_xpcom_glue=yes], + [gecko_cv_have_xpcom_glue=no]) +AC_MSG_RESULT([$gecko_cv_have_xpcom_glue]) + CPPFLAGS="$_SAVE_CPPFLAGS" AC_LANG_POP([C++]) @@ -226,8 +263,14 @@ if test "$gecko_cv_have_debug" = "yes"; then AC_DEFINE([HAVE_GECKO_DEBUG],[1],[Define if gecko is a debug build]) fi +if test "$gecko_cv_have_xpcom_glue" = "yes"; then + AC_DEFINE([HAVE_GECKO_XPCOM_GLUE],[1],[Define if xpcom glue is used]) +fi + fi # if gecko_cv_have_gecko +AM_CONDITIONAL([HAVE_GECKO_DEBUG],[test "$gecko_cv_have_debug" = "yes"]) +AM_CONDITIONAL([HAVE_GECKO_XPCOM_GLUE],[test "$gecko_cv_have_xpcom_glue" = "yes"]) # *********************** # Check for gecko version @@ -238,7 +281,7 @@ if test "$gecko_cv_have_gecko" = "yes"; then AC_LANG_PUSH([C++]) _SAVE_CPPFLAGS="$CPPFLAGS" -CPPFLAGS="$CPPFLAGS -I$_GECKO_INCLUDE_ROOT" +CPPFLAGS="$CPPFLAGS $_GECKO_CFLAGS" AC_CACHE_CHECK([for gecko version], [gecko_cv_gecko_version], @@ -320,8 +363,11 @@ gecko_cv_glue_libs= gecko_cv_extra_pkg_dependencies= if test "$gecko_cv_gecko_version_int" -ge "1009000"; then - gecko_cv_extra_libs="-L$_GECKO_LIBDIR -lxul" - gecko_cv_glue_libs="-L$_GECKO_LIBDIR -lxpcomglue_s" + if ! test "$gecko_cv_have_xpcom_glue" = "yes"; then + gecko_cv_extra_libs="-L$_GECKO_LIBDIR -lxul" + else + gecko_cv_glue_libs="-L$_GECKO_LIBDIR -lxpcomglue" + fi else gecko_cv_extra_pkg_dependencies="${gecko_cv_gecko}-gtkmozembed" fi @@ -350,6 +396,7 @@ AM_CONDITIONAL([HAVE_GECKO_1_7],[test "$gecko_cv_have_gecko" = "yes" -a "$gecko_ AM_CONDITIONAL([HAVE_GECKO_1_8],[test "$gecko_cv_have_gecko" = "yes" -a "$gecko_cv_gecko_version_int" -ge "1008000"]) AM_CONDITIONAL([HAVE_GECKO_1_8_1],[test "$gecko_cv_have_gecko" = "yes" -a "$gecko_cv_gecko_version_int" -ge "1008001"]) AM_CONDITIONAL([HAVE_GECKO_1_9],[test "$gecko_cv_have_gecko" = "yes" -a "$gecko_cv_gecko_version_int" -ge "1009000"]) +AM_CONDITIONAL([HAVE_GECKO_HOME],[test "x$_GECKO_HOME" != "x"]) ]) # *************************************************************************** @@ -371,10 +418,20 @@ _SAVE_CPPFLAGS="$CPPFLAGS" _SAVE_CXXFLAGS="$CXXFLAGS" _SAVE_LDFLAGS="$LDFLAGS" _SAVE_LIBS="$LIBS" -CPPFLAGS="$CPPFLAGS $_GECKO_EXTRA_CPPFLAGS -I$_GECKO_INCLUDE_ROOT $($PKG_CONFIG --cflags-only-I ${gecko_cv_gecko}-xpcom)" -CXXFLAGS="$CXXFLAGS $_GECKO_EXTRA_CXXFLAGS $($PKG_CONFIG --cflags-only-other ${gecko_cv_gecko}-xpcom)" -LDFLAGS="$LDFLAGS $_GECKO_EXTRA_LDFLAGS -Wl,--rpath=$_GECKO_HOME" -LIBS="$LIBS $($PKG_CONFIG --libs ${gecko_cv_gecko}-xpcom)" +if test "${gecko_cv_gecko}" = "libxul-embedding" -o "${gecko_cv_gecko}" = "libxul"; then + CPPFLAGS="$CPPFLAGS $_GECKO_EXTRA_CPPFLAGS $_GECKO_CFLAGS $($PKG_CONFIG --cflags-only-I ${gecko_cv_gecko}-unstable)" + CXXFLAGS="$CXXFLAGS $_GECKO_EXTRA_CXXFLAGS $_GECKO_CFLAGS $($PKG_CONFIG --cflags-only-other ${gecko_cv_gecko}-unstable)" + LIBS="$LIBS $($PKG_CONFIG --libs ${gecko_cv_gecko}) -ldl" +else + CPPFLAGS="$CPPFLAGS $_GECKO_EXTRA_CPPFLAGS $_GECKO_CFLAGS $($PKG_CONFIG --cflags-only-I ${gecko_cv_gecko}-xpcom)" + CXXFLAGS="$CXXFLAGS $_GECKO_EXTRA_CXXFLAGS $_GECKO_CFLAGS $($PKG_CONFIG --cflags-only-other ${gecko_cv_gecko}-xpcom)" + LIBS="$LIBS $($PKG_CONFIG --libs ${gecko_cv_gecko}-xpcom)" +fi +if test -n "$_GECKO_HOME"; then + LDFLAGS="$LDFLAGS $_GECKO_EXTRA_LDFLAGS -Wl,--rpath=$_GECKO_HOME" +else + LDFLAGS="$LDFLAGS $_GECKO_EXTRA_LDFLAGS" +fi _GECKO_DISPATCH_INCLUDEDIRS="$2" @@ -383,9 +440,11 @@ _GECKO_DISPATCH_INCLUDEDIRS="$2" # Mind you, it's useful to be able to test against uninstalled mozilla builds... _GECKO_DISPATCH_INCLUDEDIRS="$_GECKO_DISPATCH_INCLUDEDIRS dom necko pref" -# Now add them to CPPFLAGS +# Now add them to CPPFLAGS - asac: well ... not anymore since 1.9 -> test whether they exist before adding. for i in $_GECKO_DISPATCH_INCLUDEDIRS; do - CPPFLAGS="$CPPFLAGS -I$_GECKO_INCLUDE_ROOT/$i" + if test -d "$_GECKO_INCLUDE_ROOT/$i"; then + CPPFLAGS="$CPPFLAGS -I$_GECKO_INCLUDE_ROOT/$i" + fi done m4_indir([$1],m4_shiftn(2,$@)) @@ -438,11 +497,17 @@ AC_DEFUN([GECKO_XPCOM_PROGRAM], #include <mozilla-config.h> #include <stdlib.h> #include <stdio.h> + +#ifdef XPCOM_GLUE +#include <nsXPCOMGlue.h> +#else #include <nsXPCOM.h> +#endif // XPCOM_GLUE + #include <nsCOMPtr.h> #include <nsILocalFile.h> #include <nsIServiceManager.h> -#ifdef HAVE_GECKO_1_8 +#if defined(HAVE_GECKO_1_8) || defined(HAVE_GECKO_1_9) #include <nsStringAPI.h> #else #include <nsString.h> @@ -450,16 +515,37 @@ AC_DEFUN([GECKO_XPCOM_PROGRAM], ]] [$1], [[ + +nsresult rv; +#ifdef XPCOM_GLUE + static const GREVersionRange greVersion = { + "1.8", PR_TRUE, + "1.9.*", PR_TRUE + }; + char xpcomLocation[4096]; + rv = GRE_GetGREPathWithProperties(&greVersion, 1, nsnull, 0, xpcomLocation, 4096); + if (NS_FAILED(rv)) { + exit(123); + } + + // Startup the XPCOM Glue that links us up with XPCOM. + XPCOMGlueStartup(xpcomLocation); + if (NS_FAILED(rv)) { + exit(124); + } +#endif // XPCOM_GLUE + // redirect unwanted mozilla debug output to the bit bucket freopen ("/dev/null", "w", stdout); -nsresult rv; -nsCOMPtr<nsILocalFile> directory; +nsCOMPtr<nsILocalFile> directory = nsnull; +#ifndef XPCOM_GLUE rv = NS_NewNativeLocalFile (NS_LITERAL_CSTRING("$_GECKO_HOME"), PR_FALSE, getter_AddRefs (directory)); if (NS_FAILED (rv) || !directory) { exit (126); } +#endif rv = NS_InitXPCOM2 (nsnull, directory, nsnull); if (NS_FAILED (rv)) { @@ -607,21 +693,22 @@ fi AC_DEFUN([GECKO_XPIDL], [AC_REQUIRE([GECKO_INIT])dnl -_GECKO_LIBDIR="`$PKG_CONFIG --variable=libdir ${gecko_cv_gecko}-xpcom`" +if test ${gecko_cv_gecko} = "libxul-embedding" -o ${gecko_cv_gecko} = "libxul"; then + _GECKO_LIBDIR="`$PKG_CONFIG pkg-config --variable=sdkdir ${gecko_cv_gecko}`/bin" +else + _GECKO_LIBDIR="`$PKG_CONFIG --variable=libdir ${gecko_cv_gecko}-xpcom`" +fi AC_PATH_PROG([XPIDL],[xpidl],[no],[$_GECKO_LIBDIR:$PATH]) +if test ${gecko_cv_gecko} = "libxul-embedding" -o ${gecko_cv_gecko} = "libxul"; then +XPIDL_IDLDIR="`$PKG_CONFIG --variable=idldir ${gecko_cv_gecko}`" +else XPIDL_IDLDIR="`$PKG_CONFIG --variable=idldir ${gecko_cv_gecko}-xpcom`" - -# Older geckos don't have this variable, see -# https://bugzilla.mozilla.org/show_bug.cgi?id=240473 - if test -z "$XPIDL_IDLDIR" -o ! -f "$XPIDL_IDLDIR/nsISupports.idl"; then XPIDL_IDLDIR="`echo $_GECKO_LIBDIR | sed -e s!lib!share/idl!`" fi - # Some distributions (Gentoo) have it in unusual places - if test -z "$XPIDL_IDLDIR" -o ! -f "$XPIDL_IDLDIR/nsISupports.idl"; then XPIDL_IDLDIR="$_GECKO_INCLUDE_ROOT/idl" fi diff --git a/plugins/desktop-file/Makefile.am b/plugins/desktop-file/Makefile.am index 6c6c22303..5cf130d9b 100644 --- a/plugins/desktop-file/Makefile.am +++ b/plugins/desktop-file/Makefile.am @@ -25,8 +25,13 @@ libdesktopfileplugin_la_LIBADD = \ libdesktopfileplugin_la_LDFLAGS = \ -module -avoid-version \ -export-symbols $(srcdir)/plugin.symbols \ - -R$(GECKO_HOME) \ $(AM_LDFLAGS) +if !HAVE_GECKO_XPCOM_GLUE + libdesktopfileplugin_la_LDFLAGS += \ + -R$(GECKO_HOME) \ + $(NULL) +endif + EXTRA_DIST = \ plugin.symbols diff --git a/src/Makefile.am b/src/Makefile.am index 6d8c4b968..19dffcd9d 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -180,6 +180,16 @@ libpyphany_la_LIBADD = \ $(PYGTK_LIBS) endif + +# we do this to force c++ linkage if we are using the glue and +# are running gecko 1.9 because standalone glue embedders that use +# gtk_moz_embed_* need to #include <gtkmozembed_glue.cpp> +if HAVE_GECKO_1_9 +if HAVE_GECKO_XPCOM_GLUE +nodist_EXTRA_epiphany_SOURCES = dummy.cpp +endif +endif + epiphany_SOURCES = ephy-main.c epiphany_CPPFLAGS = \ @@ -194,6 +204,7 @@ epiphany_CPPFLAGS = \ epiphany_CFLAGS = \ $(DEPENDENCIES_CFLAGS) \ + $(GECKO_CFLAGS) \ $(DBUS_CFLAGS) \ $(AM_CFLAGS) @@ -214,6 +225,7 @@ endif if WITH_GECKO_ENGINE epiphany_LDADD += \ + $(GECKO_LIBS) \ $(top_builddir)/embed/mozilla/libephymozillaembed.la endif @@ -234,7 +246,9 @@ epiphany_LDADD += $(LIBXUL_LIBS) -lxpcomglue endif if WITH_GECKO_ENGINE +if !HAVE_GECKO_XPCOM_GLUE epiphany_LDFLAGS += -R$(GECKO_HOME) +endif epiphany_LDADD += \ $(GECKO_LIBS) \ @@ -248,6 +262,7 @@ epiphany_LDADD += \ endif epiphany_LDADD += \ + $(GECKO_LIBS) \ $(DEPENDENCIES_LIBS) \ $(DBUS_LIBS) \ $(LIBINTL) |