diff options
author | Aaron Bockover <abockover@novell.com> | 2010-01-11 21:25:08 +0300 |
---|---|---|
committer | Aaron Bockover <abockover@novell.com> | 2010-01-11 21:31:37 +0300 |
commit | 4b2dd20181f9befd3d86d48fc09e72ed29d6d62e (patch) | |
tree | 459e279cee8e145eba5c7abfcd279b6f67671d43 /packages | |
parent | 559a000b9ac7aa70b8bdf9468a6d0269929ea5b4 (diff) |
[build] build mono that supports being relocated
Applies my patch from yesterday, rebased from trunk to 2.6.
Diffstat (limited to 'packages')
-rw-r--r-- | packages/mono.py | 9 | ||||
-rw-r--r-- | packages/patches/mono-runtime-relocation.patch | 70 |
2 files changed, 77 insertions, 2 deletions
diff --git a/packages/mono.py b/packages/mono.py index 21759e4..b90ac88 100644 --- a/packages/mono.py +++ b/packages/mono.py @@ -2,7 +2,8 @@ class MonoPackage (Package): def __init__ (self): Package.__init__ (self, 'mono', '2.6.1', sources = [ - 'http://ftp.novell.com/pub/%{name}/sources/%{name}/%{name}-%{version}.tar.bz2' + 'http://ftp.novell.com/pub/%{name}/sources/%{name}/%{name}-%{version}.tar.bz2', + 'patches/mono-runtime-relocation.patch' ], configure_flags = [ '--with-jit=yes', @@ -12,7 +13,11 @@ class MonoPackage (Package): '--enable-quiet-build' ] ) - + + def prep (self): + Package.prep (self) + self.sh ('patch -p1 < "%{sources[1]}"') + def install (self): Package.install (self) if Package.profile.name == 'darwin': diff --git a/packages/patches/mono-runtime-relocation.patch b/packages/patches/mono-runtime-relocation.patch new file mode 100644 index 0000000..61f7a6e --- /dev/null +++ b/packages/patches/mono-runtime-relocation.patch @@ -0,0 +1,70 @@ +From ae4ba92baf2ef554abbb5c31295068e68c7ae087 Mon Sep 17 00:00:00 2001 +From: Aaron Bockover <abockover@novell.com> +Date: Mon, 11 Jan 2010 01:15:43 -0500 +Subject: [PATCH] Support Mono runtime relocation on OS X + +assembly.c (mono_set_rootdir): support finding the Mono paths on OS X +at runtime in the same way as on Windows, which yields a relocatable +Mono. Uses dyld's _NSGetExecutablePath and realpath to resolve the path +of the running mono process. + +On TARGET_ARM, fallback () will always be executed. +--- + mono/metadata/assembly.c | 31 ++++++++++++++++++++++++++++++- + 1 files changed, 30 insertions(+), 1 deletions(-) + +diff --git a/mono/metadata/assembly.c b/mono/metadata/assembly.c +index 1e7f733..ce37e8e 100644 +--- a/mono/metadata/assembly.c ++++ b/mono/metadata/assembly.c +@@ -38,6 +38,10 @@ + #include <sys/stat.h> + #endif + ++#ifdef PLATFORM_MACOSX ++#include <mach-o/dyld.h> ++#endif ++ + /* AssemblyVersionMap: an assembly name and the assembly version set on which it is based */ + typedef struct { + const char* assembly_name; +@@ -549,10 +553,35 @@ set_dirs (char *exe) + void + mono_set_rootdir (void) + { +-#ifdef PLATFORM_WIN32 ++#if defined(PLATFORM_WIN32) || (defined(PLATFORM_MACOSX) && !defined(TARGET_ARM)) + gchar *bindir, *installdir, *root, *name, *config; + ++#ifdef PLATFORM_WIN32 + name = mono_get_module_file_name ((HMODULE) &__ImageBase); ++#else ++ { ++ /* ++ * _NSGetExecutablePath may return -1 to indicate buf is not large ++ * enough, but we ignore that case to avoid having to do extra dynamic ++ * allocation for the path and hope that 4096 is enough - this is ++ * ok in the Linux/Solaris case below at least... ++ */ ++ ++ gchar buf[4096]; ++ guint buf_size = sizeof (buf); ++ ++ name = NULL; ++ if (_NSGetExecutablePath (buf, &buf_size) == 0) { ++ name = realpath (buf, NULL); ++ } ++ ++ if (name == NULL) { ++ fallback (); ++ return; ++ } ++ } ++#endif ++ + bindir = g_path_get_dirname (name); + installdir = g_path_get_dirname (bindir); + root = g_build_path (G_DIR_SEPARATOR_S, installdir, "lib", NULL); +-- +1.6.5.5 + |