Author: toshok
Date: 2007-10-03 14:56:43 -0400 (Wed, 03 Oct 2007)
New Revision: 86826
Modified:
trunk/moon/plugin/ChangeLog
trunk/moon/plugin/moonlight.h
trunk/moon/plugin/plugin-entry.cpp
trunk/moon/plugin/plugin-proxy.cpp
Log:
2007-10-03 Chris Toshok <[EMAIL PROTECTED]>
* moonlight.h, plugin-entry.cpp, plugin-proxy.cpp: if we're using
libmoonloader.so, we need to rename the 4 symbols we proxy in
plugin-entry.cpp, and load them up via our mangled names in
plugin-proxy.cpp. This is so mozilla doesn't try to load
libmoonplugin.so as a plugin itself. It should only load
libmoonloader.so. Also, add code in plugin-proxy.cpp to handle
the case where the .so lives in ~/.mozilla/plugins. This requires
#define PLUGIN_INSTALL 1 to be used, so we should figure out how
to build with that when building the XPI.
Modified: trunk/moon/plugin/ChangeLog
===================================================================
--- trunk/moon/plugin/ChangeLog 2007-10-03 18:31:17 UTC (rev 86825)
+++ trunk/moon/plugin/ChangeLog 2007-10-03 18:56:43 UTC (rev 86826)
@@ -1,3 +1,15 @@
+2007-10-03 Chris Toshok <[EMAIL PROTECTED]>
+
+ * moonlight.h, plugin-entry.cpp, plugin-proxy.cpp: if we're using
+ libmoonloader.so, we need to rename the 4 symbols we proxy in
+ plugin-entry.cpp, and load them up via our mangled names in
+ plugin-proxy.cpp. This is so mozilla doesn't try to load
+ libmoonplugin.so as a plugin itself. It should only load
+ libmoonloader.so. Also, add code in plugin-proxy.cpp to handle
+ the case where the .so lives in ~/.mozilla/plugins. This requires
+ #define PLUGIN_INSTALL 1 to be used, so we should figure out how
+ to build with that when building the XPI.
+
2007-10-01 Rolf Bjarne Kvinge <[EMAIL PROTECTED]>
* plugin.cpp, plugin.h: Added SetPageURL, updates the Surface' source
Modified: trunk/moon/plugin/moonlight.h
===================================================================
--- trunk/moon/plugin/moonlight.h 2007-10-03 18:31:17 UTC (rev 86825)
+++ trunk/moon/plugin/moonlight.h 2007-10-03 18:56:43 UTC (rev 86826)
@@ -44,6 +44,20 @@
#define MAX_STREAM_SIZE 65536
+#define USE_LIBMOONLOADER 1
+
+#if USE_LIBMOONLOADER
+#define LOADER_RENAMED_SYM(x) Plugin_##x
+#define LOADER_QUOTE(x) #x
+#define LOADER_RENAMED_NAME(x) LOADER_QUOTE(Plugin_##x)
+
+// define his to 1 if we're building the xpi, leave it 0 if we're not
+#define PLUGIN_INSTALL 0
+#else
+#define LOADER_RENAMED_SYM(x) x
+#define LOADER_RENAMED_NAME(x) #x
+#endif
+
#ifdef DEBUG
#ifdef G_LOG_DOMAIN
#undef G_LOG_DOMAIN
Modified: trunk/moon/plugin/plugin-entry.cpp
===================================================================
--- trunk/moon/plugin/plugin-entry.cpp 2007-10-03 18:31:17 UTC (rev 86825)
+++ trunk/moon/plugin/plugin-entry.cpp 2007-10-03 18:56:43 UTC (rev 86826)
@@ -16,6 +16,8 @@
#include "npapi.h"
#include "npupp.h"
+#include "moonlight.h"
+
// Version information
#define NP_VERSION_MIN_SUPPORTED 13
#define NP_VERSION_HAS_RUNTIME 14
@@ -288,22 +290,22 @@
/*** These functions are located automagically by mozilla
*********************/
char*
-NP_GetMIMEDescription (void)
+LOADER_RENAMED_SYM(NP_GetMIMEDescription) (void)
{
return NPP_GetMIMEDescription ();
}
NPError
-NP_GetValue (void *future, NPPVariable variable, void *value)
+LOADER_RENAMED_SYM(NP_GetValue) (void *future, NPPVariable variable, void
*value)
{
return NPP_GetValue ((NPP) future, variable, value);
}
NPError OSCALL
#ifdef XP_UNIX
-NP_Initialize (NPNetscapeFuncs *mozilla_funcs, NPPluginFuncs *plugin_funcs)
+LOADER_RENAMED_SYM(NP_Initialize) (NPNetscapeFuncs *mozilla_funcs,
NPPluginFuncs *plugin_funcs)
#else
-NP_Initialize (NPNetscapeFuncs *mozilla_funcs)
+LOADER_RENAMED_SYM(NP_Initialize) (NPNetscapeFuncs *mozilla_funcs)
#endif
{
if (mozilla_funcs == NULL || plugin_funcs == NULL)
@@ -422,7 +424,7 @@
}
NPError OSCALL
-NP_Shutdown (void)
+LOADER_RENAMED_SYM(NP_Shutdown) (void)
{
NPP_Shutdown ();
return NPERR_NO_ERROR;
Modified: trunk/moon/plugin/plugin-proxy.cpp
===================================================================
--- trunk/moon/plugin/plugin-proxy.cpp 2007-10-03 18:31:17 UTC (rev 86825)
+++ trunk/moon/plugin/plugin-proxy.cpp 2007-10-03 18:56:43 UTC (rev 86826)
@@ -16,6 +16,8 @@
#include "npapi.h"
#include "npupp.h"
+#include "moonlight.h"
+
#ifdef XP_UNIX
typedef NPError (*np_initialize_func) (void *a, void *b);
#else
@@ -33,33 +35,43 @@
static NPError
load (void)
{
- void *real_plugin = dlopen (PLUGIN_DIR "/plugin/libmoonplugin.so",
RTLD_NOW);
+ char *plugin_path;
+#if PLUGIN_INSTALL
+ plugin_path = g_strconcat (g_get_home_dir(),
"/.mozilla/plugins/libmoonplugin.so", NULL);
+#else
+ plugin_path = g_strdup (PLUGIN_DIR "/plugin/libmoonplugin.so");
+#endif
+
+ void *real_plugin = dlopen (plugin_path, RTLD_NOW);
+
+ g_free (plugin_path);
+
if (real_plugin == NULL){
fprintf (stderr, "Unable to load the real plugin %s\n", dlerror
());
return FALSE;
}
- initialize = (np_initialize_func) dlsym (real_plugin, "NP_Initialize");
+ initialize = (np_initialize_func) dlsym (real_plugin,
LOADER_RENAMED_NAME(NP_Initialize));
if (initialize == NULL){
- fprintf (stderr, "NP_Initialize not found %s", dlerror ());
+ fprintf (stderr, "NP_Initialize not found %s\n", dlerror ());
return FALSE;
}
- getvalue = (np_getvalue_func) dlsym (real_plugin, "NP_GetValue");
+ getvalue = (np_getvalue_func) dlsym (real_plugin,
LOADER_RENAMED_NAME(NP_GetValue));
if (getvalue == NULL){
fprintf (stderr, "NP_GetValue not found %s\n", dlerror ());
return FALSE;
}
- getmime = (np_getmime_func) dlsym (real_plugin,
"NP_GetMIMEDescription");
+ getmime = (np_getmime_func) dlsym (real_plugin,
LOADER_RENAMED_NAME(NP_GetMIMEDescription));
if (getmime == NULL){
fprintf (stderr, "NP_GetMIMEDescription not found %s\n",
dlerror ());
return FALSE;
}
- shutdown = (np_shutdown_func) dlsym (real_plugin, "NP_Shutdown");
+ shutdown = (np_shutdown_func) dlsym (real_plugin,
LOADER_RENAMED_NAME(NP_Shutdown));
if (shutdown == NULL){
fprintf (stderr, "NP_Shutdown not found %s\n", dlerror ());
return FALSE;
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches