[runtime] Fix in-tree building for mkbundle
authorAlexander Kyte <alexmkyte@gmail.com>
Wed, 7 Jun 2017 18:44:16 +0000 (14:44 -0400)
committerAlexander Kyte <alexmkyte@gmail.com>
Wed, 30 Aug 2017 16:54:47 +0000 (12:54 -0400)
configure.ac
mcs/build/tests.make
mcs/tools/mkbundle/mkbundle.cs

index ba174a27c1afea4d0f9a898c4e9fc80df8576b39..8ab69e9047276ab0cd779b48c391d83599a20729 100644 (file)
@@ -864,6 +864,8 @@ with_cooperative_gc_default=no
 
 INVARIANT_AOT_OPTIONS=nimt-trampolines=2000,ntrampolines=8000,nrgctx-fetch-trampolines=256,ngsharedvt-trampolines=4000
 
+AOT_BUILD_ATTRS=$INVARIANT_AOT_OPTIONS
+
 if test x$cross_compiling = xyes -o x$enable_mcs_build = xno; then
    DISABLE_MCS_DOCS_default=yes
 elif test x$with_runtime_preset = xnet_4_x; then
@@ -890,8 +892,8 @@ elif test x$with_runtime_preset = xfullaot; then
    mono_feature_disable_appdomains='yes'
 
    AOT_BUILD_FLAGS="--runtime=mobile -O=gsharedvt --aot=full,$INVARIANT_AOT_OPTIONS"
-
    AOT_RUN_FLAGS="--runtime=mobile --full-aot"
+   AOT_MODE="full"
 elif test x$with_runtime_preset = xbitcode; then
    DISABLE_MCS_DOCS_default=yes
    with_testing_aot_full_default=yes
@@ -908,6 +910,7 @@ elif test x$with_runtime_preset = xbitcode; then
 
    AOT_BUILD_FLAGS="--runtime=mobile --aot=llvmonly,$INVARIANT_AOT_OPTIONS"
    AOT_RUN_FLAGS="--runtime=mobile --llvmonly"
+   AOT_MODE="llvmonly"
 elif test x$with_runtime_preset = xhybridaot; then
    DISABLE_MCS_DOCS_default=yes
    with_testing_aot_hybrid_default=yes
@@ -935,6 +938,7 @@ elif test x$with_runtime_preset = xwinaot; then
 
    AOT_BUILD_FLAGS="--runtime=mobile --aot=full,$INVARIANT_AOT_OPTIONS"
    AOT_RUN_FLAGS="--runtime=mobile --full-aot"
+   AOT_MODE="llvmonly"
 elif test x$with_runtime_preset = xorbis; then
    DISABLE_MCS_DOCS_default=yes
    with_orbis_default=yes
@@ -948,6 +952,7 @@ elif test x$with_runtime_preset = xorbis; then
 
    AOT_BUILD_FLAGS="--runtime=mobile --aot=full,$INVARIANT_AOT_OPTIONS"
    AOT_RUN_FLAGS="--runtime=mobile --full-aot"
+   AOT_MODE="full"
 elif test x$with_runtime_preset = xunreal; then
    DISABLE_MCS_DOCS_default=yes
    with_unreal_default=yes
@@ -4751,6 +4756,11 @@ fi
     if test "x$AOT_BUILD_FLAGS" != "x" ; then
       echo "AOT_RUN_FLAGS=$AOT_RUN_FLAGS" >> $srcdir/$mcsdir/build/config.make
       echo "AOT_BUILD_FLAGS=$AOT_BUILD_FLAGS" >> $srcdir/$mcsdir/build/config.make
+      echo "AOT_BUILD_ATTRS=$AOT_BUILD_ATTRS" >> $srcdir/$mcsdir/build/config.make
+    fi
+
+    if test "x$AOT_MODE" != "x" ; then
+      echo "AOT_MODE=$AOT_MODE" >> $srcdir/$mcsdir/build/config.make
     fi
 
     if test "x$enable_btls" = "xyes"; then
index 3936085129185dd930c942d03c24ba14bc749d03..f5c4f99070f6d88cdde8baaf7ce58b9726d13215 100644 (file)
@@ -151,8 +151,8 @@ BUNDLED_ASSEMBLIES := $(sort $(patsubst .//%,%,$(filter-out %.exe.static %.dll.d
 $(MKBUNDLE_EXE):
        make -C $(topdir)/tools/mkbundle
 
-$(TEST_HARNESS_BIN): $(MKBUNDLE_EXE)
-       $(TEST_RUNTIME) $(MKBUNDLE_EXE) -L $(topdir)/class/lib/$(PROFILE) -v --deps $(TEST_HARNESS) $(BUNDLED_ASSEMBLIES) -o $(TEST_HARNESS_BIN) --aot-mode $(STATIC_AOT_BUNDLE) --aot-runtime $(RUNTIME)
+$(TEST_HARNESS_BIN): $(MKBUNDLE_EXE) $(test_assemblies) $(BUNDLED_ASSEMBLIES)
+       PKG_CONFIG_PATH="$(topdir)/../data" $(TEST_RUNTIME) $(MKBUNDLE_EXE) -L $(topdir)/class/lib/$(PROFILE) -v --deps $(TEST_HARNESS) $(test_assemblies) $(BUNDLED_ASSEMBLIES) -o $(TEST_HARNESS_BIN) --aot-mode $(AOT_MODE) --aot-runtime $(RUNTIME) --aot-args $(AOT_BUILD_ATTRS) --in-tree $(topdir)/.. --keeptemp
 
 else 
 TEST_HARNESS_EXEC = $(TEST_RUNTIME) $(RUNTIME_FLAGS) $(AOT_RUN_FLAGS) $(TEST_HARNESS) 
index a929ed237e6cf82d96b0a6c33a0393565bcf873d..f9b442451541f248d0aba24e92f5e18fb8be9959 100755 (executable)
@@ -44,6 +44,7 @@ class MakeBundle {
        static List<string> aot_names = new List<string> ();
        static Dictionary<string,string> libraries = new Dictionary<string,string> ();
        static bool autodeps = false;
+       static string in_tree = null;
        static bool keeptemp = false;
        static bool compile_only = false;
        static bool static_link = false;
@@ -358,8 +359,21 @@ class MakeBundle {
                        case "--bundled-header":
                                bundled_header = true;
                                break;
+                       case "--in-tree":
+                               if (i+1 == top) {
+                                       Console.WriteLine ("Usage: --in-tree <path/to/headers> ");
+                                       return 1;
+                               }
+                               in_tree = args [++i];
+                               break;
                        case "--aot-runtime":
+                               if (i+1 == top) {
+                                       Console.WriteLine ("Usage: --aot-runtime <path/to/runtime> ");
+                                       return 1;
+                               }
                                aot_runtime = args [++i];
+                               aot_compile = true;
+                               static_link = true;
                                break;
                        case "--aot-dedup":
                                if (i+1 == top) {
@@ -370,6 +384,7 @@ class MakeBundle {
                                sources.Add (dedup_file);
                                aot_dedup_assembly = sources.Count () - 1;
                                aot_compile = true;
+                               static_link = true;
                                break;
                        case "--aot-mode":
                                if (i+1 == top) {
@@ -384,6 +399,7 @@ class MakeBundle {
                                }
 
                                aot_compile = true;
+                               static_link = true;
                                break;
                        case "--aot-args":
                                if (i+1 == top) {
@@ -396,11 +412,13 @@ class MakeBundle {
                                }
                                aot_args = String.Format("static,{0}", args [++i]);
                                aot_compile = true;
+                               static_link = true;
                                break;
                        default:
                                sources.Add (args [i]);
                                break;
                        }
+
                }
                // Modern bundling starts here
                if (!custom_mode){
@@ -766,7 +784,11 @@ void          mono_register_config_for_assembly (const char* assembly_name, cons
                        } else {
                                tc.WriteLine ("#include <mono/metadata/mono-config.h>");
                                tc.WriteLine ("#include <mono/metadata/assembly.h>\n");
-                               tc.WriteLine ("#include <mono/jit/jit.h>\n");
+
+                               if (in_tree != null)
+                                       tc.WriteLine ("#include <mono/mini/jit.h>\n");
+                               else
+                                       tc.WriteLine ("#include <mono/jit/jit.h>\n");
                        }
 
                        if (compress) {
@@ -1103,10 +1125,17 @@ void          mono_register_config_for_assembly (const char* assembly_name, cons
                                                platform_libs = "";
                                        }
 
-                                       cmd = String.Format("{4} -o '{2}' -Wall `pkg-config --cflags mono-2` {0} {3} " +
+                                       string in_tree_include = "";
+                                       
+                                       if (in_tree != null) {
+                                               smonolib = String.Format ("{0}/mono/mini/.libs/libmonosgen-2.0.a", in_tree);
+                                               in_tree_include = String.Format (" -I{0} ", in_tree);
+                                       }
+
+                                       cmd = String.Format("{4} -o '{2}' -Wall `pkg-config --cflags mono-2` {7} {0} {3} " +
                                                "`pkg-config --libs-only-L mono-2` {5} {6} " + platform_libs +
                                                "`pkg-config --libs-only-l mono-2 | sed -e \"s/\\-lmono-2.0 //\"` {1} -g ",
-                                               temp_c, temp_o, output, zlib, cc, smonolib, String.Join (" ", aot_paths));
+                                               temp_c, temp_o, output, zlib, cc, smonolib, String.Join (" ", aot_paths), in_tree_include);
                                }
                                else
                                {