2007-07-18 Jb Evain <jbevain@novell.com>
authorJb Evain <jbevain@gmail.com>
Wed, 18 Jul 2007 09:51:34 +0000 (09:51 -0000)
committerJb Evain <jbevain@gmail.com>
Wed, 18 Jul 2007 09:51:34 +0000 (09:51 -0000)
* tuner: new tool to tune the Mono assemblies from a full 2.1
profile to a stripped down silverlight compatible assembly set.

svn path=/trunk/mcs/; revision=82182

mcs/tools/tuner/ChangeLog [new file with mode: 0644]
mcs/tools/tuner/Makefile [new file with mode: 0644]
mcs/tools/tuner/Mono.Tuner/PrintStatus.cs [new file with mode: 0644]
mcs/tools/tuner/README [new file with mode: 0644]

diff --git a/mcs/tools/tuner/ChangeLog b/mcs/tools/tuner/ChangeLog
new file mode 100644 (file)
index 0000000..0fa3fd7
--- /dev/null
@@ -0,0 +1,4 @@
+2007-07-18  Jb Evain  <jbevain@novell.com>
+
+       * tuner: new tool to tune the Mono assemblies from a full 2.1
+       profile to a stripped down silverlight compatible assembly set.
diff --git a/mcs/tools/tuner/Makefile b/mcs/tools/tuner/Makefile
new file mode 100644 (file)
index 0000000..408c29c
--- /dev/null
@@ -0,0 +1,51 @@
+thisdir = tools/tuner
+SUBDIRS =
+include ../../build/rules.make
+
+LINKER = ../linker/monolinker.exe
+MASTER_INFOS_ZIP = http://mono.ximian.com/masterinfos/masterinfo-sl11a.zip
+
+LINKER_PLUGINS = \
+       Mono.Tuner/PrintStatus.dll      \
+#      Mono.Tuner/InjectAttributes.dll \
+
+LOCAL_MCS_FLAGS = -r:$(LINKER) -r:Mono.Cecil.dll
+
+LINKER_SOURCES = $(LINKER_PLUGINS:.dll=.cs)
+
+DISTFILES = $(LINKER_PLUGINS)
+
+ifeq (net_2_1, $(PROFILE))
+all-local: tune
+else
+all-local: $(LINKER_PLUGINS)
+endif
+
+install-local:
+
+clean-local:
+       rm -f Mono.Tuner/*.dll
+       rm -f Mono.Tuner/*.mdb
+       rm -f Mono.Tuner/*.pdb
+       rm -rf masterinfos*
+
+WORKING_DIR = $(mono_libdir)/mono/2.1
+
+masterinfos/silverlight.infos:
+       wget -O masterinfos.zip $(MASTER_INFOS_ZIP)
+       unzip masterinfos.zip
+
+MCS_MASTER_INFOS =     \
+       masterinfos/silverlight/mscorlib.info   \
+       masterinfos/silverlight/System.info             \
+       masterinfos/silverlight/System.Xml.Core.info    \
+
+LINKER_FLAGS = -d $(WORKING_DIR) -o $(WORKING_DIR) -l none -c link
+#LINKER_STEPS = -s Mono.Tuner.PrintStatus,PrintStatus -s Mono.Tuner.InjectAttributes,InjectAttributes:OutputStep
+LINKER_STEPS = -s Mono.Tuner.PrintStatus,PrintStatus:OutputStep
+
+tune: masterinfos/silverlight.infos
+       MONO_PATH="Mono.Tuner:$$MONO_PATH" $(RUNTIME) $(RUNTIME_FLAGS) $(LINKER) $(LINKER_FLAGS) $(LINKER_STEPS) $(MCS_MASTER_INFOS:%=-i %)
+
+%.dll: %.cs
+       $(CSCOMPILE) /t:library $^
diff --git a/mcs/tools/tuner/Mono.Tuner/PrintStatus.cs b/mcs/tools/tuner/Mono.Tuner/PrintStatus.cs
new file mode 100644 (file)
index 0000000..9a39b96
--- /dev/null
@@ -0,0 +1,17 @@
+using System;
+
+using Mono.Linker;
+using Mono.Linker.Steps;
+
+using Mono.Cecil;
+
+namespace Mono.Tuner {
+       
+       public class PrintStatus : BaseStep {
+
+               protected override void ProcessAssembly (AssemblyDefinition assembly)
+               {
+                       Console.WriteLine ("Assembly `{0}' ({1}) tuned", assembly.Name, assembly.MainModule.Image.FileInformation);
+               }
+       }
+}
diff --git a/mcs/tools/tuner/README b/mcs/tools/tuner/README
new file mode 100644 (file)
index 0000000..09184ba
--- /dev/null
@@ -0,0 +1,8 @@
+monotuner
+===
+
+monotuner is an internal tool to re-shape the Mono assemblies to have
+a 2.1 assembly set compatible with Microsoft's Silverlight.
+
+The tuner uses the monolinker, and augment it with some plugins.
+