diff options
author | Jeffrey Stedfast <jeff@xamarin.com> | 2012-05-24 00:40:04 +0400 |
---|---|---|
committer | Jeffrey Stedfast <jeff@xamarin.com> | 2012-05-24 00:41:14 +0400 |
commit | 58f6bf11d76933f2818c94c139f42ab4ff419569 (patch) | |
tree | b54f6bb5565aea0659fbccd9a13bf6f2ee9c1bb8 | |
parent | 858c8bf084e67f488a078b3465714bd72a94ea0d (diff) |
[Mac] Use mhutch's monostub launcher on Mac OS X
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | main/build/MacOSX/Makefile.am | 10 | ||||
-rw-r--r-- | main/build/MacOSX/monostub.c | 26 |
3 files changed, 36 insertions, 1 deletions
diff --git a/.gitignore b/.gitignore index 1e8fe687b2..4d716baa38 100644 --- a/.gitignore +++ b/.gitignore @@ -13,6 +13,7 @@ obj/ /main/tests/tmp /main/tests/config /main/tests/UnitTests/test-results +/main/build/MacOSX/monostub /main/contrib/bin/ /main/contrib/*/*/bin/ /local-libs diff --git a/main/build/MacOSX/Makefile.am b/main/build/MacOSX/Makefile.am index 13034aa6cf..7402b65b7e 100644 --- a/main/build/MacOSX/Makefile.am +++ b/main/build/MacOSX/Makefile.am @@ -18,11 +18,14 @@ render.exe: render.cs dmg: render.exe app ./make-dmg-bundle.sh +monostub: monostub.c + gcc -Wall -m32 monostub.c -o monostub -framework CoreFoundation + clean-local: rm -rf MonoDevelop.app rm -f MonoDevelop*.dmg -app: +app: monostub @echo "" @echo "Creating directories in app bundle" @echo "" @@ -122,6 +125,11 @@ app: cp -r MDMonitor.app $(MACOS) +# Mono stubs to make the process name and bundle location correct + mkdir -p "$(MACOS)/bin" + cp -f monostub "$(MACOS)/bin/monodevelop" + cp -f monostub "$(MACOS)/bin/mdtool" + # update revision in updateinfo @echo "" @echo "Updating build information" diff --git a/main/build/MacOSX/monostub.c b/main/build/MacOSX/monostub.c new file mode 100644 index 0000000000..ec19f43156 --- /dev/null +++ b/main/build/MacOSX/monostub.c @@ -0,0 +1,26 @@ +#include <stdlib.h> +#include <stdio.h> +#include <dlfcn.h> + +typedef int (* MonoMain) (int argc, char **argv); + +int main (int argc, char **argv) +{ + void *libmono = dlopen ("libmono-2.0.dylib", RTLD_LAZY); + + if (libmono == NULL) { + libmono = dlopen ("libmono-0.dylib", RTLD_LAZY); + if (libmono == NULL) { + printf ("Could not load libmono\n"); + exit (1); + } + } + + MonoMain mono_main = (MonoMain) dlsym (libmono, "mono_main"); + if (mono_main == NULL) { + printf ("Could not load mono_main\n"); + exit (2); + } + + return mono_main (argc, argv); +} |