Index: browser-plugin/totemStringGlue.h =================================================================== --- browser-plugin/totemStringGlue.h (revision 5028) +++ browser-plugin/totemStringGlue.h (working copy) @@ -1,58 +0,0 @@ -/* Totem browser plugin - * - * Copyright © 2006 Bastien Nocera - * Copyright © 2006 Christian Persch - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#include - -#ifndef NS_LITERAL_CSTRING -#define NS_LITERAL_CSTRING(x) (x) -#endif - -class nsString : public nsEmbedString { - public: - PRBool IsEmpty () { return !Length (); } -}; - -class nsCString : public nsEmbedCString { - public: - nsCString () : nsEmbedCString () { } - explicit nsCString (const char *aData, PRUint32 aLength) : nsEmbedCString (aData, aLength) { } - explicit nsCString (const abstract_string_type& aOther) { Assign (aOther); } - explicit nsCString (const char *&aOther) { Assign (aOther); } - explicit nsCString (const nsCString& aData, int aStartPos, PRUint32 aLength) : nsEmbedCString (aData.get() + aStartPos, aLength-aStartPos) { } - PRBool IsEmpty () { return !Length (); } - PRBool Equals (const self_type& aOther) { return !strcmp (aOther.get (), get ()); } - PRBool Equals (const char_type *aOther) { return !strcmp (aOther, get ()); } - void SetLength (PRUint32 aLen) { Assign (""); } - self_type& operator=(const abstract_string_type& aOther) { Assign (aOther); return *this; } - self_type& operator=(const char_type* aOther) { Assign (aOther); return *this; } -}; - -class NS_ConvertUTF16toUTF8 : public nsCString { - public: - explicit NS_ConvertUTF16toUTF8 (const nsAString& aString) { - NS_UTF16ToCString (aString, NS_CSTRING_ENCODING_UTF8, *this); - } -}; - -typedef nsString nsDependentString; -typedef nsCString nsDependentCString; -typedef nsCString nsDependentCSubstring; - Index: browser-plugin/totemPlugin.h =================================================================== --- browser-plugin/totemPlugin.h (revision 5028) +++ browser-plugin/totemPlugin.h (working copy) @@ -29,9 +29,8 @@ #include -#ifdef NEED_STRING_GLUE -#include "totemStringGlue.h" -#endif +#define NS_STATIC_CAST(__type, __ptr) static_cast< __type >(__ptr) +#define NS_REINTERPRET_CAST(__type, __expr) reinterpret_cast< __type >(__expr) #if defined(TOTEM_COMPLEX_PLUGIN) && defined(HAVE_NSTARRAY_H) #include Index: browser-plugin/Makefile.am =================================================================== --- browser-plugin/Makefile.am (revision 5028) +++ browser-plugin/Makefile.am (working copy) @@ -144,7 +144,6 @@ totemPluginGlue.h \ totemPlugin.cpp \ totemPlugin.h \ - totemStringGlue.h \ totemBasicPlugin.cpp \ totemBasicPlugin.h \ totemClassInfo.h \ @@ -182,12 +181,13 @@ libtotempluginviewer_helper.la \ $(DBUS_LIBS) \ $(BROWSER_PLUGIN_LIBS) \ - $(LIBXPCOMGLUE_S) + $(GECKO_LIBS) libtotem_basic_plugin_la_LDFLAGS = \ -avoid-version \ -export-symbols $(srcdir)/plugin.symbols \ -module \ + -no-undefined \ $(AM_LDFLAGS) endif @@ -210,7 +210,6 @@ totemPluginGlue.h \ totemPlugin.cpp \ totemPlugin.h \ - totemStringGlue.h \ totemGMPPlugin.cpp \ totemGMPPlugin.h \ totemClassInfo.h \ @@ -248,12 +247,13 @@ libtotempluginviewer_helper.la \ $(DBUS_LIBS) \ $(BROWSER_PLUGIN_LIBS) \ - $(LIBXPCOMGLUE_S) + $(GECKO_LIBS) libtotem_gmp_plugin_la_LDFLAGS = \ -avoid-version \ -export-symbols $(srcdir)/plugin.symbols \ -module \ + -no-undefined \ $(AM_LDFLAGS) endif @@ -270,7 +270,6 @@ totemPluginGlue.h \ totemPlugin.cpp \ totemPlugin.h \ - totemStringGlue.h \ totemComplexPlugin.cpp \ totemComplexPlugin.h \ totemClassInfo.h \ @@ -308,12 +307,13 @@ libtotempluginviewer_helper.la \ $(DBUS_LIBS) \ $(BROWSER_PLUGIN_LIBS) \ - $(LIBXPCOMGLUE_S) + $(GECKO_LIBS) libtotem_complex_plugin_la_LDFLAGS = \ -avoid-version \ -export-symbols $(srcdir)/plugin.symbols \ -module \ + -no-undefined \ $(AM_LDFLAGS) endif @@ -330,7 +330,6 @@ totemPluginGlue.h \ totemPlugin.cpp \ totemPlugin.h \ - totemStringGlue.h \ totemNarrowSpacePlugin.cpp \ totemNarrowSpacePlugin.h \ totemClassInfo.h \ @@ -368,12 +367,13 @@ libtotempluginviewer_helper.la \ $(DBUS_LIBS) \ $(BROWSER_PLUGIN_LIBS) \ - $(LIBXPCOMGLUE_S) + $(GECKO_LIBS) libtotem_narrowspace_plugin_la_LDFLAGS = \ -avoid-version \ -export-symbols $(srcdir)/plugin.symbols \ -module \ + -no-undefined \ $(AM_LDFLAGS) endif @@ -390,7 +390,6 @@ totemPluginGlue.h \ totemPlugin.cpp \ totemPlugin.h \ - totemStringGlue.h \ totemMullYPlugin.cpp \ totemMullYPlugin.h \ totemClassInfo.h \ @@ -428,12 +427,13 @@ libtotempluginviewer_helper.la \ $(DBUS_LIBS) \ $(BROWSER_PLUGIN_LIBS) \ - $(LIBXPCOMGLUE_S) + $(GECKO_LIBS) libtotem_mully_plugin_la_LDFLAGS = \ -avoid-version \ -export-symbols $(srcdir)/plugin.symbols \ -module \ + -no-undefined \ $(AM_LDFLAGS) endif @@ -450,7 +450,6 @@ totemPluginGlue.h \ totemPlugin.cpp \ totemPlugin.h \ - totemStringGlue.h \ totemConePlugin.cpp \ totemConePlugin.h \ totemClassInfo.h \ @@ -488,12 +487,13 @@ libtotempluginviewer_helper.la \ $(DBUS_LIBS) \ $(BROWSER_PLUGIN_LIBS) \ - $(LIBXPCOMGLUE_S) + $(GECKO_LIBS) libtotem_cone_plugin_la_LDFLAGS = \ -avoid-version \ -export-symbols $(srcdir)/plugin.symbols \ -module \ + -no-undefined \ $(AM_LDFLAGS) endif Index: configure.in =================================================================== --- configure.in (revision 5028) +++ configure.in (working copy) @@ -40,6 +40,7 @@ GNOMEICON_REQS=2.15.90 DBUS_REQS=0.61 VALA_REQS=0.1.6 +XULRUNNER_REQS=1.9 TOTEM_VERSION_MAJOR=totem_version_major TOTEM_VERSION_MINOR=totem_version_minor @@ -560,61 +561,23 @@ [AS_HELP_STRING([--enable-browser-plugins],[compile the totem browser plugins])], [],[enable_browser_plugins=autodetect]) -# Backward compatibility -AC_ARG_ENABLE([mozilla],[],[enable_browser_plugins=$enableval],[]) - AC_MSG_RESULT([$enable_browser_plugins]) # Check which mozilla to use if test "$enable_browser_plugins" != "no" ; then - AC_MSG_CHECKING([which gecko to use]) + PKG_CHECK_MODULES([GECKO], [libxul >= $XULRUNNER_REQS], [gecko=xulrunner], [gecko=""]) - AC_ARG_WITH([gecko], - [AS_HELP_STRING([--with-gecko],[Which gecko engine to use (default: autodetect)])]) - - # backward compat - AC_ARG_WITH([mozilla],[],[with_gecko=$withval]) - - GECKOS="xulrunner firefox mozilla-firefox seamonkey mozilla" - gecko=$with_gecko - - if test -z "$with_gecko"; then - dnl Autodetect gecko - for g in $GECKOS; do - if $PKG_CONFIG --exists $g-xpcom; then - gecko=$g - break; - fi - done - elif ! $PKG_CONFIG --exists $gecko-xpcom; then - AC_MSG_ERROR([Gecko "$gecko" not found]) - fi - - if test -z "$gecko" -a "$enable_browser_plugins" = "autodetect"; then + if "x$enable_browser_plugins" = "xautodetect"; then dnl No gecko found, disable plugin AC_MSG_WARN([No gecko found, disabling plugin]) enable_browser_plugins=no elif test -z "$gecko"; then - AC_MSG_ERROR([No gecko found]) - elif ! ( echo "$GECKOS" | egrep "(^| )$gecko(\$| )" > /dev/null); then - AC_MSG_ERROR([Unknown gecko "$gecko" specified]) + AC_MSG_ERROR([No xulrunner found]) else enable_browser_plugins=yes fi - AC_MSG_RESULT([$gecko]) - - case "$gecko" in - mozilla) MOZILLA_VERSION_MIN=1.7 ;; - seamonkey) MOZILLA_VERSION_MIN=1.0 ;; - *firefox) MOZILLA_VERSION_MIN=1.0 ;; - xulrunner) MOZILLA_VERSION_MIN=1.8 ;; - esac - - MOZILLA=$gecko - AC_SUBST([MOZILLA]) - if test "$enable_cxx_warnings" != "no" -a "$GXX" = "yes"; then PLUGIN_EXTRA_WARN_CXXFLAGS="-Wno-ctor-dtor-privacy -Wno-non-virtual-dtor -Woverloaded-virtual" else @@ -625,15 +588,14 @@ # Check for mozilla modules, but keep the CFLAGS and LIBS in # separate vars -if test "$enable_browser_plugins" = "yes" ; then +if test "x$enable_browser_plugins" = "xyes" ; then PKG_CHECK_MODULES([MOZILLA_NOT_LINKED], - [$MOZILLA-xpcom >= $MOZILLA_VERSION_MIN \ - $MOZILLA-plugin],, + [libxul >= $XULRUNNER_REQS],, [enable_browser_plugins=no]) fi # Check for other required modules, and merge CFLAGS, but not link # flags to avoid linking against -lxpcom -lplds4 -lplc4 -lnspr4 -if test "$enable_browser_plugins" = "yes" ; then +if test "x$enable_browser_plugins" = "xyes" ; then PKG_CHECK_MODULES([BROWSER_PLUGIN], [glib-2.0 gnome-vfs-2.0 >= $GNOMEVFS_REQS @@ -654,7 +616,7 @@ >= 0.22 to function.])]) fi -if test "$enable_browser_plugins" = "yes" ; then +if test "x$enable_browser_plugins" = "xyes" ; then PKG_CHECK_MODULES([DBUS], [dbus-glib-1 >= $DBUS_REQS],, [enable_browser_plugins=no]) DBUSLIBDIR="`$PKG_CONFIG dbus-glib-1 --variable=libdir`" @@ -675,56 +637,46 @@ # Sets some variables, and check for xpidl if test "$enable_browser_plugins" = "yes" ; then - MOZILLA_PREFIX="`$PKG_CONFIG $MOZILLA-xpcom --variable=prefix`" - MOZILLA_LIBDIR="`$PKG_CONFIG $MOZILLA-xpcom --variable=libdir`" - MOZILLA_INCLUDE_ROOT="`$PKG_CONFIG --variable=includedir $MOZILLA-xpcom`" - MOZILLA_XPCOM_CFLAGS="-I`$PKG_CONFIG --variable=includedir $MOZILLA-xpcom`" + LIBXUL_SDK_DIR=`$PKG_CONFIG --variable=sdkdir libxul` + MOZILLA_PREFIX="`$PKG_CONFIG libxul --variable=prefix`" + MOZILLA_LIBDIR="`$PKG_CONFIG libxul --variable=libdir`" + MOZILLA_INCLUDE_ROOT="`$PKG_CONFIG --variable=includedir libxul`" + MOZILLA_XPCOM_CFLAGS="`$PKG_CONFIG --cflags libxul-unstable`" + MOZILLA_LIBS="`$PKG_CONFIG --libs libxul`" + MOZILLA_IDLDIR="`$PKG_CONFIG --variable=idldir libxul`" + MOZILLA_PLUGINDIR="${MOZILLA_PLUGINDIR:-"\${libdir}/mozilla/plugins"}" - AC_PATH_PROG([MOZILLA_XPIDL], [xpidl], [no], [$MOZILLA_LIBDIR:$PATH]) + AC_PATH_PROG([MOZILLA_XPIDL], [xpidl], [no], [$LIBXUL_SDK_DIR/bin:$PATH]) if test "x$MOZILLA_XPIDL" = "xno"; then AC_MSG_ERROR([xpidl compiler not found]) fi - AC_PATH_PROG([MOZILLA_XPT_LINK],[xpt_link],[no],[$MOZILLA_LIBDIR:$PATH]) + AC_PATH_PROG([MOZILLA_XPT_LINK],[xpt_link],[no],[$LIBXUL_SDK_DIR/bin:$PATH]) if test "$MOZILLA_XPT_LINK" = "no"; then AC_MSG_ERROR([xpt_link not found]) fi AC_SUBST([MOZILLA_PREFIX]) AC_SUBST([MOZILLA_LIBDIR]) + AC_SUBST([MOZILLA_LIBS]) AC_SUBST([MOZILLA_XPCOM_CFLAGS]) AC_SUBST([MOZILLA_INCLUDE_ROOT]) + AC_SUBST([MOZILLA_IDLDIR]) AC_ARG_VAR([MOZILLA_PLUGINDIR],[Where to install the plugin to]) fi -# Search for the idl include directory -if test "$enable_browser_plugins" = "yes" ; then - dnl This only works on gecko 1.8 - MOZILLA_IDLDIR="`$PKG_CONFIG --variable=idldir $MOZILLA-xpcom`" - dnl Fallback for older versions - if test "x$MOZILLA_IDLDIR" = "x"; then - MOZILLA_IDLDIR="`echo $MOZILLA_LIBDIR | sed -e s!lib!share/idl!`" - fi - dnl Some distributions (Gentoo) have it in unusual places - if test "x$MOZILLA_IDLDIR" = "x"; then - MOZILLA_IDLDIR="$MOZILLA_INCLUDE_ROOT/idl" - fi - - AC_SUBST([MOZILLA_IDLDIR]) -fi - -if test "$enable_browser_plugins" = "yes" ; then +if test "x$enable_browser_plugins" = "xyes" ; then AC_DEFINE([ENABLE_BROWSER_PLUGINS],[1],[Define if you build the mozilla plugin]) fi -AM_CONDITIONAL([ENABLE_BROWSER_PLUGINS], [test "$enable_browser_plugins" = "yes"]) +AM_CONDITIONAL([ENABLE_BROWSER_PLUGINS], [test "x$enable_browser_plugins" = "xyes"]) # check for libxpcomglue_s LIBXPCOMGLUE_S= -if test "$enable_browser_plugins" = "yes"; then +if test "x$enable_browser_plugins" = "xyes"; then AC_LANG_PUSH([C++]) __SAVE_CPPFLAGS=$CPPFLAGS __SAVE_CXXFLAGS=$CXXFLAGS @@ -765,7 +717,7 @@ # check for -fno-rtti flag -if test "$enable_browser_plugins" = "yes"; then +if test "x$enable_browser_plugins" = "xyes"; then AC_LANG_PUSH([C++]) __SAVE_CXXFLAGS=$CXXFLAGS CXXFLAGS="-fno-rtti $CXXFLAGS" @@ -782,35 +734,9 @@ fi fi -# check for some additional xpcom headers and for string compatibility - -if test "$enable_browser_plugins" = "yes"; then - AC_LANG_PUSH([C++]) - __SAVE_CPPFLAGS=$CPPFLAGS - CPPFLAGS="$CPPFLAGS $MOZILLA_NOT_LINKED_CFLAGS -I$MOZILLA_INCLUDE_ROOT -I$MOZILLA_INCLUDE_ROOT/xpcom" - - AC_CHECK_HEADERS([nsTArray.h]) - - AC_MSG_CHECKING([whether we need string glue]) - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([ - #include - #include - ],[ - nsDependentCString test("Test"); - ])],[need_string_glue=no],[need_string_glue=yes]) - AC_MSG_RESULT([$need_string_glue]) - - CPPFLAGS=$__SAVE_CPPFLAGS - AC_LANG_POP([C++]) - - if test "$need_string_glue" = "yes"; then - AC_DEFINE([NEED_STRING_GLUE],[1],[Define if we need string glue]) - fi -fi - # check which plugins to enable -if test "$enable_browser_plugins" = "yes"; then +if test "x$enable_browser_plugins" = "xyes"; then AC_MSG_CHECKING([whether to enable the basic browser plugin]) AC_ARG_ENABLE([basic-plugin], @@ -1097,7 +1023,7 @@ AC_MSG_NOTICE([ No Totem plugins enabled]) fi if test x$enable_browser_plugins = xyes ; then - AC_MSG_NOTICE([** Browser plugin enabled (using $MOZILLA)]) + AC_MSG_NOTICE([** Browser plugin enabled (using xulrunner)]) if test x$enable_basic_plugin = xyes ; then AC_MSG_NOTICE([** Basic browser plugin enabled]) else