提交 59737b2a 编写于 作者: D Dean Ellis 提交者: Alexander Köplinger

[mkbundle] Add support for generating monodroid compatible mkbundle code at runtime (#4728)

monodroid used to build its own version of mkbundle since it
requires slightly different code than the desktop. This
logic was protected in a #if block. Now that monodroid is
trying to make use of the shipped mkbundle rather than use
its own we need to turn this logic on at runtime.

A new parameter has been added

	--bundled-header

When this option is passed, the code which skips including

	mono/metadata/mono-config.h

will be skipped in favour of defining the required structures
and entry points directly.
上级 2d964d86
......@@ -49,6 +49,7 @@ class MakeBundle {
static string machine_config_file = null;
static string config_dir = null;
static string style = "linux";
static bool bundled_header = false;
static string os_message = "";
static bool compress;
static bool nomain;
......@@ -347,6 +348,9 @@ class MakeBundle {
else
environment.Add (env.Substring (0, p), env.Substring (p+1));
break;
case "--bundled-header":
bundled_header = true;
break;
default:
sources.Add (args [i]);
break;
......@@ -700,10 +704,10 @@ class MakeBundle {
using (StreamWriter tc = new StreamWriter (File.Create (temp_c))) {
string prog = null;
#if XAMARIN_ANDROID
tc.WriteLine ("/* This source code was produced by mkbundle, do not edit */");
tc.WriteLine ("\n#ifndef NULL\n#define NULL (void *)0\n#endif");
tc.WriteLine (@"
if (bundled_header) {
tc.WriteLine ("/* This source code was produced by mkbundle, do not edit */");
tc.WriteLine ("\n#ifndef NULL\n#define NULL (void *)0\n#endif");
tc.WriteLine (@"
typedef struct {
const char *name;
const unsigned char *data;
......@@ -712,10 +716,10 @@ typedef struct {
void mono_register_bundled_assemblies (const MonoBundledAssembly **assemblies);
void mono_register_config_for_assembly (const char* assembly_name, const char* config_xml);
");
#else
tc.WriteLine ("#include <mono/metadata/mono-config.h>");
tc.WriteLine ("#include <mono/metadata/assembly.h>\n");
#endif
} else {
tc.WriteLine ("#include <mono/metadata/mono-config.h>");
tc.WriteLine ("#include <mono/metadata/assembly.h>\n");
}
if (compress) {
tc.WriteLine ("typedef struct _compressed_data {");
......@@ -1238,6 +1242,7 @@ void mono_register_config_for_assembly (const char* assembly_name, cons
" --skip-scan Skip scanning assemblies that could not be loaded (but still embed them).\n" +
" --i18n ENCODING none, all or comma separated list of CJK, MidWest, Other, Rare, West.\n" +
" -v Verbose output\n" +
" --bundled-header Do not attempt to include 'mono-config.h'. Define the entry points directly in the generated code\n" +
"\n" +
"--simple Simple mode does not require a C toolchain and can cross compile\n" +
" --cross TARGET Generates a binary for the given TARGET\n"+
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册