Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/monodevelop.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRolf Bjarne Kvinge <rolf@xamarin.com>2014-10-28 20:34:32 +0300
committerAlan McGovern <alan@xamarin.com>2015-01-15 18:36:10 +0300
commitb951df9fd4e98f8dcd512ae7a482906a325224ab (patch)
treeae1ab382dfe05404cbc0872df5a5f2156ebc40e0 /main/build
parentaf2ecb3305d213b204c229856b6000e45ffc2ffe (diff)
[MacOSX] Update MonoDevelop launch code according to latest Xamarin.Mac API.
The required launch code is now a lot smaller, since Xamarin.Mac handles most of what we previously did manually.
Diffstat (limited to 'main/build')
-rw-r--r--main/build/MacOSX/.gitignore2
-rw-r--r--main/build/MacOSX/Makefile.am21
-rw-r--r--main/build/MacOSX/native-init.m89
3 files changed, 109 insertions, 3 deletions
diff --git a/main/build/MacOSX/.gitignore b/main/build/MacOSX/.gitignore
new file mode 100644
index 0000000000..9eca6c88cf
--- /dev/null
+++ b/main/build/MacOSX/.gitignore
@@ -0,0 +1,2 @@
+*.a
+*.o
diff --git a/main/build/MacOSX/Makefile.am b/main/build/MacOSX/Makefile.am
index e0a97da23d..3a4bc94574 100644
--- a/main/build/MacOSX/Makefile.am
+++ b/main/build/MacOSX/Makefile.am
@@ -11,6 +11,7 @@ SDK_PATH=$(shell xcrun --sdk macosx10.8 --show-sdk-path)
PACKAGE_UPDATE_ID=$(shell $(MD_CONFIGURE) get-releaseid)
BUNDLE_VERSION=$(shell $(MD_CONFIGURE) get-version)
+XAMARIN_MAC=/Library/Frameworks/Xamarin.Mac.framework/Versions/Current/
CLEANFILES = render.exe
#DISTCLEANFILES =
@@ -24,14 +25,20 @@ render.exe: render.cs
dmg: render.exe app
./make-dmg-bundle.sh
-monostub: monostub.m $(MONOSTUB_EXTRA_SOURCES)
+monostub: monostub.m
gcc -Wall -mmacosx-version-min=10.6 -m32 -o $@ $^ -framework AppKit -isysroot $(SDK_PATH)
+native-init.o: native-init.m
+ clang -Wall -c -mmacosx-version-min=10.6 -m32 -o $@ $^ -isysroot $(SDK_PATH) -I$(XAMARIN_MAC)/include
+
+native-init.a: native-init.o
+ xcrun libtool -static -o $@ $^
+
clean-local:
rm -rf MonoDevelop.app
rm -f MonoDevelop*.dmg
-app: monostub
+app: monostub native-init.a
@echo ""
@echo "Creating directories in app bundle"
@echo ""
@@ -39,6 +46,12 @@ app: monostub
mkdir -p $(MAC_APP_DIR)/Contents/MacOS/share
mkdir -p $(MAC_APP_LIB_DIR)
+ @echo ""
+ @echo "Building the native executable"
+ @echo ""
+
+ $(XAMARIN_MAC)/bin/mmp --output $(abspath $(MAC_APP_DIR)/../) --name $(APP_NAME) --no-root-assembly --profile=xammac --link_flags="-force_load native-init.a" --use-system-mono --arch i386
+
# @echo ""
# @echo "Copying install prefix into app bundle"
# @echo ""
@@ -77,7 +90,6 @@ app: monostub
@echo ""
@echo "Copying launch scripts into app bundle"
@echo ""
- cp monostub $(MACOS)/MonoDevelop
cp monostub $(MACOS)/mdtool
# Remove addins that don't work on OSX
@@ -101,6 +113,9 @@ app: monostub
$(MAC_APP_LIB_DIR)/bin/addins-setup.config \
$(MAC_APP_LIB_DIR)/AddIns/MonoDevelop.TextTemplating/Mono.TextTemplating.Tests*
+ @# Do not include libxammac.dylib since we're using mmp
+ rm $(MAC_APP_DIR)/Contents/Resources/lib/monodevelop/bin/libxammac.dylib
+
# add extras known to work on Mac, if they exist
@echo ""
@echo "Copying supported extras into app bundle"
diff --git a/main/build/MacOSX/native-init.m b/main/build/MacOSX/native-init.m
new file mode 100644
index 0000000000..79b7aca401
--- /dev/null
+++ b/main/build/MacOSX/native-init.m
@@ -0,0 +1,89 @@
+#import <Cocoa/Cocoa.h>
+
+#include <xamarin/xamarin.h>
+#include <xamarin/launch.h>
+
+static int
+push_env (const char *variable, const char *value)
+{
+ size_t len = strlen (value);
+ const char *current;
+ int rv;
+
+ if ((current = getenv (variable)) && *current) {
+ char *buf = malloc (len + strlen (current) + 2);
+ memcpy (buf, value, len);
+ buf[len] = ':';
+ strcpy (buf + len + 1, current);
+ rv = setenv (variable, buf, 1);
+ free (buf);
+ } else {
+ rv = setenv (variable, value, 1);
+ }
+
+ return rv;
+}
+
+static bool
+env2bool (const char *env, bool defaultValue)
+{
+ const char *value;
+ bool nz = NO;
+ int i;
+
+ if (!(value = getenv (env)))
+ return defaultValue;
+
+ if (!strcasecmp (value, "true"))
+ return YES;
+
+ if (!strcasecmp (value, "yes"))
+ return YES;
+
+ /* check to see if the value is numeric. All numeric values evaluate to true *except* zero */
+ for (i = 0; value[i]; i++) {
+ if (!isdigit ((int) ((unsigned char) value[i])))
+ return NO;
+
+ if (value[i] != '0')
+ nz = YES;
+ }
+
+ return nz;
+}
+
+void
+xamarin_app_initialize (xamarin_initialize_data *data)
+{
+ if (data->size != sizeof (xamarin_initialize_data)) {
+ fprintf (stderr, "Failed size initialization check.\n");
+ data->exit_code = 1;
+ data->exit = true;
+ return;
+ }
+
+ if (!data->is_relaunch) {
+ push_env ("DYLD_FALLBACK_LIBRARY_PATH", "/lib:/usr/lib:/Library/Developer/CommandLineTools/usr/lib:/usr/local/lib");
+ /* CommandLineTools are needed for OSX 10.9+ */
+ push_env ("DYLD_FALLBACK_LIBRARY_PATH", [[data->app_dir stringByAppendingPathComponent:@"Contents/MacOS/lib/monodevelop/bin/"] UTF8String]);
+ data->requires_relaunch = true;
+ return;
+ }
+
+ // Use SGen or Boehm?
+ // can be overridden with either plist bool MonoUseSGen or MONODEVELOP_USE_SGEN env
+ bool use_sgen = YES;
+ NSDictionary *plist = [[NSBundle mainBundle] infoDictionary];
+ if (plist) {
+ NSNumber *sgen_obj = (NSNumber *) [plist objectForKey:@"MonoUseSGen"];
+ if (sgen_obj)
+ use_sgen = [sgen_obj boolValue];
+ }
+ // allow the MONODEVELOP_USE_SGEN environment variable to override the plist value
+ use_sgen = env2bool ("MONODEVELOP_USE_SGEN", use_sgen);
+
+ xamarin_set_use_sgen (use_sgen);
+ xamarin_set_is_unified (true);
+
+ xamarin_set_bundle_path ([[data->app_dir stringByAppendingPathComponent: @"Contents/Resources/lib/monodevelop/bin"] UTF8String]);
+}