[banshee] [build] build mono that supports being relocated
- From: Aaron Bockover <abock src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [banshee] [build] build mono that supports being relocated
- Date: Mon, 11 Jan 2010 18:31:58 +0000 (UTC)
commit befbc15ae4693e206e2ac29c2ee4e7af9f53f76d
Author: Aaron Bockover <abockover novell com>
Date: Mon Jan 11 13:25:08 2010 -0500
[build] build mono that supports being relocated
Applies my patch from yesterday, rebased from trunk to 2.6.
build/bundle/packages/mono.py | 9 ++-
.../packages/patches/mono-runtime-relocation.patch | 70 ++++++++++++++++++++
2 files changed, 77 insertions(+), 2 deletions(-)
---
diff --git a/build/bundle/packages/mono.py b/build/bundle/packages/mono.py
index 21759e4..b90ac88 100644
--- a/build/bundle/packages/mono.py
+++ b/build/bundle/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/build/bundle/packages/patches/mono-runtime-relocation.patch b/build/bundle/packages/patches/mono-runtime-relocation.patch
new file mode 100644
index 0000000..61f7a6e
--- /dev/null
+++ b/build/bundle/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
+
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]