Author: miguel
Date: 2007-06-10 18:45:15 -0400 (Sun, 10 Jun 2007)
New Revision: 79132
Added:
trunk/moon/plugin/mono.cpp
trunk/moon/plugin/moon-mono.h
trunk/moon/plugin/moonlight.cs
Modified:
trunk/moon/TODO
trunk/moon/configure.ac
trunk/moon/plugin/
trunk/moon/plugin/ChangeLog
trunk/moon/plugin/Makefile.am
trunk/moon/plugin/plugin-glue.cpp
Log:
Embed the Mono VM in the Mozilla plugin
2007-06-10 Miguel de Icaza <[EMAIL PROTECTED]>
* moonlight.cs: the startup code, will contain the helper classes
to create new AppDomains for each instance create.
* mono.cpp: New file, embeds the Mono VM.
2007-06-10 Miguel de Icaza <[EMAIL PROTECTED]>
* configure.ac: Check for mono, prepare cflags and libs to embed
the Mono VM.
Modified: trunk/moon/TODO
===================================================================
--- trunk/moon/TODO 2007-06-10 22:39:35 UTC (rev 79131)
+++ trunk/moon/TODO 2007-06-10 22:45:15 UTC (rev 79132)
@@ -1,6 +1,17 @@
Feel free to add items to this TODO list
+* Managed Code:
+
+ Change all the calls to DependencyProperty.Register to
+ DependencyProperty.Lookup so that we actually get the
+ unmanaged properties.
+
+ Complete the marshalling in both directions for all known
+ values in DependencyObject.
+
+ Write sample code to exercise every property.
+
* DependecyProperty-fication
A few components still have instance properties that
Modified: trunk/moon/configure.ac
===================================================================
--- trunk/moon/configure.ac 2007-06-10 22:39:35 UTC (rev 79131)
+++ trunk/moon/configure.ac 2007-06-10 22:45:15 UTC (rev 79132)
@@ -39,6 +39,13 @@
exit 1
fi
+if pkg-config mono; then
+ echo Found Mono
+else
+ echo You are missing Mono
+ echo I was looking for mono.pc file
+fi
+
AC_MSG_CHECKING(Mozilla NSPR pkg-config module name)
mozilla_nspr_pcs="nspr mozilla-nspr firefox-nspr xulrunner-nspr seamonkey-nspr"
for pc in $mozilla_nspr_pcs; do
@@ -84,24 +91,25 @@
exit 1
fi
-PLUGIN_CFLAGS=`pkg-config --cflags gtk+-2.0 $mozilla_nspr $mozilla_xpcom`
-PLUGIN_LIBS=`pkg-config --libs gtk+-2.0 $mozilla_nspr $mozilla_xpcom`
-
-AC_SUBST(PLUGIN_CFLAGS)
-AC_SUBST(PLUGIN_LIBS)
-
XPIDL=`pkg-config --variable=libdir $mozilla_xpcom`/xpidl
XPFLAGS=-I`pkg-config --variable=includedir $mozilla_xpcom`
AC_SUBST(XPIDL)
AC_SUBST(XPFLAGS)
-MOON_CFLAGS=`pkg-config --cflags gtk+-2.0 libavcodec libavformat gthread-2.0
libswscale alsa`
-MOON_LIBS=`pkg-config --libs gtk+-2.0 libavcodec libavformat gthread-2.0
libswscale alsa`
-
+MOON_PKGS="gtk+-2.0 libavcodec libavformat gthread-2.0 libswscale alsa"
+MOON_CFLAGS=`pkg-config --cflags $MOON_PKGS`
+MOON_LIBS=`pkg-config --libs gtk+-2.0 $MOON_PKGS`
AC_SUBST(MOON_CFLAGS)
AC_SUBST(MOON_LIBS)
+PLUGIN_CFLAGS=`pkg-config --cflags gtk+-2.0 $mozilla_nspr $mozilla_xpcom
$MOON_PKGS mono`
+PLUGIN_LIBS=`pkg-config --libs gtk+-2.0 $mozilla_nspr $mozilla_xpcom
$MOON_PKGS mono`
+
+AC_SUBST(PLUGIN_CFLAGS)
+AC_SUBST(PLUGIN_LIBS)
+
+
#CFLAGS="$CFLAGS `pkg-config --cflags gtk+-2.0 libavcodec libavformat
gthread-2.0 libswscale alsa $mozilla_nspr $mozilla_nss`"
#CXXFLAGS="$CXXFLAGS `pkg-config --libs gtk+-2.0 libavcodec libavformat
gthread-2.0 libswscale alsa $mozilla_nspr $mozilla_nss`"
#LIBS="$LIBS `pkg-config --libs gtk+-2.0 libavcodec libavformat gthread-2.0
libswscale alsa $mozilla_nspr $mozilla_nss`"
Property changes on: trunk/moon/plugin
___________________________________________________________________
Name: svn:ignore
- Makefile.in
Makefile
.libs
.deps
+ Makefile.in
*.exe
*.exe.mdb
Makefile
.libs
.deps
Modified: trunk/moon/plugin/ChangeLog
===================================================================
--- trunk/moon/plugin/ChangeLog 2007-06-10 22:39:35 UTC (rev 79131)
+++ trunk/moon/plugin/ChangeLog 2007-06-10 22:45:15 UTC (rev 79132)
@@ -1,3 +1,10 @@
+2007-06-10 Miguel de Icaza <[EMAIL PROTECTED]>
+
+ * moonlight.cs: the startup code, will contain the helper classes
+ to create new AppDomains for each instance create.
+
+ * mono.cpp: New file, embeds the Mono VM.
+
2007-06-10 Everaldo Canuto <[EMAIL PROTECTED]>
* plugin-glue.cpp: Call plugin instance destructor, now it dont causes
Modified: trunk/moon/plugin/Makefile.am
===================================================================
--- trunk/moon/plugin/Makefile.am 2007-06-10 22:39:35 UTC (rev 79131)
+++ trunk/moon/plugin/Makefile.am 2007-06-10 22:45:15 UTC (rev 79132)
@@ -12,18 +12,26 @@
-module \
-L$(top_srcdir)/src/.libs
-libmoonplugin_la_LIBADD = -lmoon $(MOON_LIBS) $(PLUGIN_LIBS)
+libmoonplugin_la_LIBADD = -lmoon $(PLUGIN_LIBS) $(PLUGIN_LIBS)
libmoonplugin_la_SOURCES = \
- moon-plugin.cpp \
- moon-plugin.h \
- plugin-entry.cpp \
- plugin-glue.cpp \
- plugin-class.cpp \
- plugin-class.h
+ mono.cpp \
+ moon-plugin.cpp \
+ moon-plugin.h \
+ plugin-entry.cpp \
+ plugin-glue.cpp \
+ plugin-class.cpp \
+ moon-mono.h \
+ plugin-class.h
# custom install rule
-install-plugin: libmoonplugin.la
+install-plugin: libmoonplugin.la moonlight.exe
mkdir -p ~/.mozilla/plugins
cp .libs/libmoonplugin.so ~/.mozilla/plugins
+ cp moonlight.exe ~/.mozilla/plugins
cp $(top_srcdir)/src/.libs/libmoon.so ~/.mozilla/plugins
+
+EXTRA_DIST = moonlight.cs
+
+moonlight.exe: moonlight.cs
+ gmcs -debug moonlight.cs
\ No newline at end of file
Added: trunk/moon/plugin/mono.cpp
===================================================================
--- trunk/moon/plugin/mono.cpp 2007-06-10 22:39:35 UTC (rev 79131)
+++ trunk/moon/plugin/mono.cpp 2007-06-10 22:45:15 UTC (rev 79132)
@@ -0,0 +1,47 @@
+/*
+ * mono.cpp: Support routines to load the Mono VM as a browser plugin.
+ *
+ * Author:
+ * Miguel de Icaza ([EMAIL PROTECTED])
+ *
+ * Copyright 2007 Novell, Inc. (http://www.novell.com)
+ *
+ * See the LICENSE file included with the distribution for details.
+ *
+ */
+
+#include "config.h"
+#include <stdlib.h>
+#include <glib.h>
+G_BEGIN_DECLS
+#include <mono/jit/jit.h>
+#include <mono/metadata/environment.h>
+#include <mono/metadata/mono-config.h>
+#include "moon-mono.h"
+G_END_DECLS
+
+MonoDomain *moon_domain;
+MonoAssembly *moon_boot_assembly;
+static char *boot_assembly;
+
+gboolean
+vm_init ()
+{
+ const char *home = g_get_home_dir ();
+ gboolean result = FALSE;
+
+ boot_assembly = g_build_path ("/", home, ".mozilla", "plugins",
"moonlight.exe", NULL);
+ mono_config_parse (NULL);
+ moon_domain = mono_jit_init (boot_assembly);
+ moon_boot_assembly = mono_domain_assembly_open (moon_domain,
boot_assembly);
+ if (moon_boot_assembly){
+ char *argv [2];
+
+ argv [0] = boot_assembly;
+ argv [1] = NULL;
+
+ result = TRUE;
+ mono_jit_exec (moon_domain, moon_boot_assembly, 1, argv);
+ }
+ return result;
+}
Property changes on: trunk/moon/plugin/mono.cpp
___________________________________________________________________
Name: svn:eol-style
+ native
Added: trunk/moon/plugin/moon-mono.h
===================================================================
--- trunk/moon/plugin/moon-mono.h 2007-06-10 22:39:35 UTC (rev 79131)
+++ trunk/moon/plugin/moon-mono.h 2007-06-10 22:45:15 UTC (rev 79132)
@@ -0,0 +1,5 @@
+G_BEGIN_DECLS
+
+gboolean vm_init ();
+
+G_END_DECLS
Property changes on: trunk/moon/plugin/moon-mono.h
___________________________________________________________________
Name: svn:eol-style
+ native
Added: trunk/moon/plugin/moonlight.cs
===================================================================
--- trunk/moon/plugin/moonlight.cs 2007-06-10 22:39:35 UTC (rev 79131)
+++ trunk/moon/plugin/moonlight.cs 2007-06-10 22:45:15 UTC (rev 79132)
@@ -0,0 +1,10 @@
+using System;
+
+class Moonlight {
+ static int count;
+
+ static void Main ()
+ {
+ Console.WriteLine ("Running Moonlight.cs {0}", count++);
+ }
+}
Property changes on: trunk/moon/plugin/moonlight.cs
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: trunk/moon/plugin/plugin-glue.cpp
===================================================================
--- trunk/moon/plugin/plugin-glue.cpp 2007-06-10 22:39:35 UTC (rev 79131)
+++ trunk/moon/plugin/plugin-glue.cpp 2007-06-10 22:45:15 UTC (rev 79132)
@@ -14,6 +14,7 @@
#include "npapi.h"
#include "npupp.h"
#include "moon-plugin.h"
+#include "moon-mono.h"
NPError
NPP_New (NPMIMEType pluginType, NPP instance, uint16 mode, int16 argc, char*
argn[], char* argv[], NPSavedData* saved)
@@ -216,6 +217,7 @@
gtk_init (0, 0);
runtime_init ();
+ vm_init ();
return NPERR_NO_ERROR;
}
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches