From 6b5f6dd0434b66062110cf764688975ecfed646f Mon Sep 17 00:00:00 2001 From: Bernhard Urban Date: Thu, 23 Jul 2015 14:32:24 -0700 Subject: [PATCH] mono: Use the relocated directory for finding support libraries in data/config --- data/config.in | 2 +- mono/metadata/mono-config.c | 21 ++++++++++++++++++--- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/data/config.in b/data/config.in index b7601766e95..b4b7243ecfd 100644 --- a/data/config.in +++ b/data/config.in @@ -10,7 +10,7 @@ - + diff --git a/mono/metadata/mono-config.c b/mono/metadata/mono-config.c index cfa830cca82..e73a86b94d2 100644 --- a/mono/metadata/mono-config.c +++ b/mono/metadata/mono-config.c @@ -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; -- 2.25.1