mono: Use the relocated directory for finding support libraries in data/config
authorBernhard Urban <bernhard.urban@xamarin.com>
Thu, 23 Jul 2015 21:32:24 +0000 (14:32 -0700)
committerBernhard Urban <bernhard.urban@xamarin.com>
Thu, 23 Jul 2015 21:32:24 +0000 (14:32 -0700)
data/config.in
mono/metadata/mono-config.c

index b7601766e9549accaa0bea356184ddbe6dfe08dc..b4b7243ecfd001bb60aeb9b0979840a8cd170c28 100644 (file)
@@ -10,7 +10,7 @@
        <dllmap dll="i:odbc32.dll" target="libiodbc.dylib" os="osx"/>
        <dllmap dll="oci" target="libclntsh@libsuffix@" os="!windows"/>
        <dllmap dll="db2cli" target="libdb2_36@libsuffix@" os="!windows"/>
-       <dllmap dll="MonoPosixHelper" target="@prefix@/@reloc_libdir@/libMonoPosixHelper@libsuffix@" os="!windows" />
+       <dllmap dll="MonoPosixHelper" target="$mono_libdir/libMonoPosixHelper@libsuffix@" os="!windows" />
        <dllmap dll="i:msvcrt" target="@LIBC@" os="!windows"/>
        <dllmap dll="i:msvcrt.dll" target="@LIBC@" os="!windows"/>
        <dllmap dll="sqlite" target="@SQLITE@" os="!windows"/>
index cfa830cca82fa944915b48e6812e5f8d8d823ba1..e73a86b94d28c186bff61876870d5d243bc4a4b2 100644 (file)
@@ -277,9 +277,24 @@ dllmap_start (gpointer user_data,
                for (i = 0; attribute_names [i]; ++i) {
                        if (strcmp (attribute_names [i], "dll") == 0)
                                info->dll = g_strdup (attribute_values [i]);
-                       else if (strcmp (attribute_names [i], "target") == 0)
-                               info->target = g_strdup (attribute_values [i]);
-                       else if (strcmp (attribute_names [i], "os") == 0 && !arch_matches (CONFIG_OS, attribute_values [i]))
+                       else if (strcmp (attribute_names [i], "target") == 0) {
+                               char *match = strstr (attribute_values [i], "$mono_libdir");
+                               if (match != NULL) {
+                                       /* substitude $mono_libdir */
+                                       const char *libdir = mono_assembly_getrootdir ();
+                                       const int libdir_len = strlen (libdir);
+                                       const int varname_len = strlen ("$mono_libdir");
+                                       const int pre_len = match - attribute_values [i];
+                                       const int post_len = strlen (match) - varname_len + 3;
+
+                                       char *result = g_malloc (pre_len + libdir_len + post_len + 1);
+                                       g_strlcpy (result, attribute_values [i], pre_len);
+                                       strncat (result, libdir, libdir_len);
+                                       strncat (result, match + varname_len, post_len);
+                                       info->target = result;
+                               } else
+                                       info->target = g_strdup (attribute_values [i]);
+                       } else if (strcmp (attribute_names [i], "os") == 0 && !arch_matches (CONFIG_OS, attribute_values [i]))
                                info->ignore = TRUE;
                        else if (strcmp (attribute_names [i], "cpu") == 0 && !arch_matches (CONFIG_CPU, attribute_values [i]))
                                info->ignore = TRUE;