Merge pull request #3773 from mono/bockbuild-integration
authorAlexis Christoforides <alexis@thenull.net>
Tue, 8 Nov 2016 16:10:26 +0000 (11:10 -0500)
committerGitHub <noreply@github.com>
Tue, 8 Nov 2016 16:10:26 +0000 (11:10 -0500)
Integration of Bockbuild's Mac SDK profile

36 files changed:
.gitmodules
Makefile.am
external/bockbuild [new submodule]
packaging/MacSDK/__init__.py [new file with mode: 0644]
packaging/MacSDK/fsharp.py [new file with mode: 0644]
packaging/MacSDK/gdk-pixbuf/0001-pixbuf-Add-getter-setter-for-the-2x-variants.patch [new file with mode: 0644]
packaging/MacSDK/gdk-pixbuf/0001-pixbuf-load-2x-variants-as-pixbuf-gobject-data.patch [new file with mode: 0644]
packaging/MacSDK/gtkrc [new file with mode: 0644]
packaging/MacSDK/ironlangs.py [new file with mode: 0644]
packaging/MacSDK/libgdiplus.py [new file with mode: 0644]
packaging/MacSDK/mono-basic.py [new file with mode: 0644]
packaging/MacSDK/mono-llvm.py [new file with mode: 0644]
packaging/MacSDK/mono.py [new file with mode: 0644]
packaging/MacSDK/msbuild.py [new file with mode: 0644]
packaging/MacSDK/nuget.py [new file with mode: 0644]
packaging/MacSDK/packaging/Info.plist [new file with mode: 0644]
packaging/MacSDK/packaging/Info_sdk.plist [new file with mode: 0644]
packaging/MacSDK/packaging/mdk_blacklist.sh [new file with mode: 0755]
packaging/MacSDK/packaging/resources/License.rtf [new file with mode: 0644]
packaging/MacSDK/packaging/resources/ReadMe.rtf [new file with mode: 0644]
packaging/MacSDK/packaging/resources/Welcome.rtf [new file with mode: 0644]
packaging/MacSDK/packaging/resources/distribution.xml [new file with mode: 0644]
packaging/MacSDK/packaging/resources/postinstall [new file with mode: 0755]
packaging/MacSDK/packaging/resources/version.plist [new file with mode: 0644]
packaging/MacSDK/packaging/resources/whitelist.txt [new file with mode: 0644]
packaging/MacSDK/packaging/uninstallMono.sh [new file with mode: 0755]
packaging/MacSDK/patches/find-unused-patches.sh [new file with mode: 0755]
packaging/MacSDK/patches/mcs-pkgconfig.patch [new file with mode: 0644]
packaging/MacSDK/pcl-reference-assemblies.py [new file with mode: 0644]
packaging/MacSDK/profile.py [new file with mode: 0755]
packaging/MacSDK/sqlite.py [new file with mode: 0644]
packaging/MacSDK/xamarin-gtk-theme.py [new file with mode: 0644]
packaging/MacSDK/xsp.py [new file with mode: 0644]
packaging/MacSDKRelease/mono-extensions.py [new file with mode: 0644]
packaging/MacSDKRelease/packaging [new symlink]
packaging/MacSDKRelease/profile.py [new file with mode: 0755]

index 1c8f76e0107dae1e948de7280f293bcd110ef7b1..337fbe06c0b3ca4df54eaf18e0818d83c718667b 100644 (file)
@@ -46,3 +46,6 @@
 [submodule "external/corefx"]
        path = external/corefx
        url = git://github.com/mono/corefx.git
+[submodule "external/bockbuild"]
+       path = external/bockbuild
+       url = git://github.com/mono/bockbuild.git
index aaffb9842ba9dbe36090cead00afe0d1ebe1232d..74707da14109c704302a1f7eab547e79082b812e 100644 (file)
@@ -49,6 +49,9 @@ dist-hook:
 # Disable this for now because it is very slow and causes wrench to timeout:
 #      test ! -d $(GIT_DIR) || ./scripts/commits-to-changelog.py --root=$(distdir) last-commit-with-compulsory-changelog-entry
 
+mac-sdk-package:
+       external/bockbuild/bb MacSDK --package
+
 pkgconfigdir = $(libdir)/pkgconfig
 noinst_DATA = mono-uninstalled.pc
 DISTCLEANFILES= mono-uninstalled.pc
diff --git a/external/bockbuild b/external/bockbuild
new file mode 160000 (submodule)
index 0000000..6c65a24
--- /dev/null
@@ -0,0 +1 @@
+Subproject commit 6c65a24a5663422c44eb7850cde25b4fd76294b0
diff --git a/packaging/MacSDK/__init__.py b/packaging/MacSDK/__init__.py
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/packaging/MacSDK/fsharp.py b/packaging/MacSDK/fsharp.py
new file mode 100644 (file)
index 0000000..9e53489
--- /dev/null
@@ -0,0 +1,24 @@
+class FsharpPackage(GitHubTarballPackage):
+
+    def __init__(self):
+        GitHubTarballPackage.__init__(self,
+                                      'fsharp', 'fsharp',
+                                      '4.0.1.9',
+                                      '0a6c66a8f18eb8a5c4d0bfac61d883b6994a918a',
+                                      configure='./configure --prefix="%{package_prefix}"')
+
+        self.extra_stage_files = [
+            'lib/mono/xbuild/Microsoft/VisualStudio/v/FSharp/Microsoft.FSharp.Targets']
+
+    def prep(self):
+        Package.prep(self)
+
+        for p in range(1, len(self.sources)):
+            self.sh('patch -p1 < "%{local_sources[' + str(p) + ']}"')
+
+    def build(self):
+        self.sh('autoreconf')
+        Package.configure(self)
+        Package.make(self)
+
+FsharpPackage()
diff --git a/packaging/MacSDK/gdk-pixbuf/0001-pixbuf-Add-getter-setter-for-the-2x-variants.patch b/packaging/MacSDK/gdk-pixbuf/0001-pixbuf-Add-getter-setter-for-the-2x-variants.patch
new file mode 100644 (file)
index 0000000..2ca1c6a
--- /dev/null
@@ -0,0 +1,56 @@
+From f6d2db5a0c105785ee6f03717966ef0dbb1421f6 Mon Sep 17 00:00:00 2001
+From: Carlos Garnacho <carlosg@gnome.org>
+Date: Tue, 16 Jul 2013 10:32:11 +0200
+Subject: [PATCH] pixbuf: Add getter/setter for the 2x variants
+
+---
+ gdk-pixbuf/gdk-pixbuf-core.h |  3 +++
+ gdk-pixbuf/gdk-pixbuf.c      | 22 ++++++++++++++++++++++
+ 2 files changed, 25 insertions(+)
+
+diff --git a/gdk-pixbuf/gdk-pixbuf-core.h b/gdk-pixbuf/gdk-pixbuf-core.h
+index eb4d0a1..60c4ea3 100644
+--- a/gdk-pixbuf/gdk-pixbuf-core.h
++++ b/gdk-pixbuf/gdk-pixbuf-core.h
+@@ -474,6 +474,9 @@ GdkPixbuf *gdk_pixbuf_apply_embedded_orientation (GdkPixbuf *src);
+ const gchar * gdk_pixbuf_get_option (GdkPixbuf   *pixbuf,
+                                               const gchar *key);
+
++GdkPixbuf * gdk_pixbuf_get_hires_variant (GdkPixbuf *pixbuf);
++void        gdk_pixbuf_set_hires_variant (GdkPixbuf *pixbuf,
++                                          GdkPixbuf *hires);
+
+ G_END_DECLS
+
+diff --git a/gdk-pixbuf/gdk-pixbuf.c b/gdk-pixbuf/gdk-pixbuf.c
+index 0e13f27..d61f2c7 100644
+--- a/gdk-pixbuf/gdk-pixbuf.c
++++ b/gdk-pixbuf/gdk-pixbuf.c
+@@ -990,3 +990,25 @@ gdk_pixbuf_get_property (GObject         *object,
+                   break;
+           }
+ }
++
++GdkPixbuf *
++gdk_pixbuf_get_hires_variant (GdkPixbuf *pixbuf)
++{
++        g_return_val_if_fail (GDK_IS_PIXBUF (pixbuf), NULL);
++
++        return g_object_get_data (G_OBJECT (pixbuf),
++                                  "gdk-pixbuf-2x-variant");
++}
++
++void
++gdk_pixbuf_set_hires_variant (GdkPixbuf *pixbuf,
++                              GdkPixbuf *hires)
++{
++        g_return_if_fail (GDK_IS_PIXBUF (pixbuf));
++        g_return_if_fail (GDK_IS_PIXBUF (hires));
++
++        g_object_set_data_full (G_OBJECT (pixbuf),
++                                "gdk-pixbuf-2x-variant",
++                                g_object_ref (hires),
++                                (GDestroyNotify) g_object_unref);
++}
+--
+1.8.3.2
diff --git a/packaging/MacSDK/gdk-pixbuf/0001-pixbuf-load-2x-variants-as-pixbuf-gobject-data.patch b/packaging/MacSDK/gdk-pixbuf/0001-pixbuf-load-2x-variants-as-pixbuf-gobject-data.patch
new file mode 100644 (file)
index 0000000..80d3d39
--- /dev/null
@@ -0,0 +1,99 @@
+>From de5d91aa15cc98795a68c8e553eb4baadaa0e501 Mon Sep 17 00:00:00 2001
+From: Carlos Garnacho <carlosg@gnome.org>
+Date: Fri, 17 May 2013 15:56:28 +0200
+Subject: [PATCH] pixbuf: load "@2x" variants as pixbuf gobject data
+
+if a variant of the filename is found that has a "@2x" appended
+to the file name (before the extension), such file is loaded
+and added as GObject data to the pixbuf
+---
+ gdk-pixbuf/gdk-pixbuf-io.c | 55 ++++++++++++++++++++++++++++++++++++++++++++++
+ 1 file changed, 55 insertions(+)
+
+diff --git a/gdk-pixbuf/gdk-pixbuf-io.c b/gdk-pixbuf/gdk-pixbuf-io.c
+index dac21b8..ed98cd3 100644
+--- a/gdk-pixbuf/gdk-pixbuf-io.c
++++ b/gdk-pixbuf/gdk-pixbuf-io.c
+@@ -1025,6 +1025,40 @@ _gdk_pixbuf_generic_image_load (GdkPixbufModule *module,
+         return pixbuf;
+ }
+
++static gboolean
++_gdk_pixbuf_file_is_scaled (const gchar *filename)
++{
++      gchar *basename, *ext;
++
++      basename = g_path_get_basename (filename);
++      ext = strrchr (basename, '.');
++
++      if (!ext)
++              ext = &basename[strlen(basename)];
++
++      if (ext > basename + 3 && strncmp (ext - 3, "@2x", 3) == 0)
++              return TRUE;
++
++      return FALSE;
++}
++
++static gchar *
++_gdk_pixbuf_compose_scaled_filename (const gchar *filename)
++{
++      gchar *ext, *first, *composed;
++
++      ext = strrchr (filename, '.');
++
++      if (!ext)
++              return NULL;
++
++      first = g_strndup (filename, ext - filename);
++      composed = g_strdup_printf ("%s@2x%s", first, ext);
++      g_free (first);
++
++      return composed;
++}
++
+ /**
+  * gdk_pixbuf_new_from_file:
+  * @filename: Name of file to load, in the GLib file name encoding
+@@ -1049,11 +1083,13 @@ gdk_pixbuf_new_from_file (const char *filename,
+         guchar buffer[SNIFF_BUFFER_SIZE];
+         GdkPixbufModule *image_module;
+         gchar *display_name;
++      gboolean filename_is_scaled;
+
+         g_return_val_if_fail (filename != NULL, NULL);
+         g_return_val_if_fail (error == NULL || *error == NULL, NULL);
+
+         display_name = g_filename_display_name (filename);
++      filename_is_scaled = _gdk_pixbuf_file_is_scaled (filename);
+
+         f = g_fopen (filename, "rb");
+         if (!f) {
+@@ -1097,6 +1133,25 @@ gdk_pixbuf_new_from_file (const char *filename,
+         pixbuf = _gdk_pixbuf_generic_image_load (image_module, f, error);
+         fclose (f);
+
++      if (pixbuf && !filename_is_scaled) {
++              GdkPixbuf *scaled_pixbuf = NULL;
++              gchar *scaled_filename;
++
++              scaled_filename = _gdk_pixbuf_compose_scaled_filename (filename);
++
++              if (scaled_filename) {
++                      scaled_pixbuf = gdk_pixbuf_new_from_file (scaled_filename, NULL);
++                      g_free (scaled_filename);
++              }
++
++              if (scaled_pixbuf) {
++                      g_object_set_data_full (G_OBJECT (pixbuf),
++                                                "gdk-pixbuf-2x-variant",
++                                                scaled_pixbuf,
++                                                (GDestroyNotify) g_object_unref);
++              }
++      }
++
+         if (pixbuf == NULL && error != NULL && *error == NULL) {
+
+                 /* I don't trust these crufty longjmp()'ing image libs
+--
+1.8.3.rc1
diff --git a/packaging/MacSDK/gtkrc b/packaging/MacSDK/gtkrc
new file mode 100644 (file)
index 0000000..b1168d6
--- /dev/null
@@ -0,0 +1,216 @@
+include "/Library/Frameworks/Mono.framework/Versions/Current/share/themes/Clearlooks/gtk-2.0/gtkrc"
+#gtk-icon-theme-name = "OSX"
+gtk-icon-theme-name = "Tango"
+gtk_color_scheme = "fg_color:#222\nbg_color:#e6e6e6\nbase_color:#f9f9f9\ntext_color:#222\nselected_bg_color:#788ab0\nselected_fg_color:#fff"
+gtk-menu-popup-delay = 1
+gtk-button-images = 0
+gtk-menu-images = 0
+gtk-enable-mnemonics = 0
+
+style "theme-default"
+{
+    GtkButton      ::default_border    = { 0, 0, 0, 0 }
+    GtkRange       ::trough_border     = 0
+    GtkPaned       ::handle_size       = 8
+    GtkRange       ::slider_width      = 15
+    GtkRange       ::stepper_size      = 15
+    GtkScrollbar   ::min_slider_length = 30
+    GtkCheckButton ::indicator_size    = 14
+    GtkMenuBar     ::internal-padding  = 0
+    GtkTreeView    ::expander_size     = 12
+    GtkExpander    ::expander_size     = 14
+
+    xthickness = 2
+    ythickness = 2
+
+    fg[NORMAL]        = @fg_color #"#000000" # black
+    fg[PRELIGHT]      = @fg_color #"#000000" # black
+    fg[SELECTED]      = @selected_fg_color #"#ffffff" # white
+    fg[ACTIVE]        = @fg_color #"#000000" # black
+    fg[INSENSITIVE]   = darker (@bg_color) #"#b5b3ac" # dark beige
+
+    bg[NORMAL]        = @bg_color # "#ede9e3"
+    bg[PRELIGHT]      = shade (1.02, @bg_color) #"#f9f7f3" # very light beige
+    bg[SELECTED]      = @selected_bg_color # "#5598d7" # deepsky
+    bg[INSENSITIVE]   = @bg_color # "#efebe5" # beige
+    bg[ACTIVE]        = shade (0.9, @bg_color) #"#dcd4c9" #"#d7d3ca" # dark beige
+
+    base[NORMAL]      = @base_color # "#ffffff" # white
+    base[PRELIGHT]    = shade (0.95, @bg_color) # "#5f8ec4" # dark beige
+    base[ACTIVE]      = shade (0.9, @selected_bg_color) # "#a69f91" # darker deepsky
+    base[SELECTED]    = @selected_bg_color # "#5598d7" # deepsky
+    base[INSENSITIVE] = @bg_color # "#e8e5de" # beige
+
+    text[NORMAL]      = @text_color # "#000000" # black
+    text[PRELIGHT]    = @text_color # "#000000" # black
+    text[ACTIVE]      = @selected_fg_color # "#ffffff" # white
+    text[SELECTED]    = @selected_fg_color # "#ffffff" # white
+    text[INSENSITIVE] = darker (@bg_color) # "#b5b3ac" # dark beige
+
+    engine "clearlooks"  {
+      style               = GUMMY   # gummy look
+      toolbarstyle        = 0       # flat toolbars
+      animation           = TRUE    # animated progressbars
+      menubarstyle        = 2       # rounded menus
+      colorize_scrollbar  = TRUE    # colored slider
+    }
+
+    font              = "Lucida Grande 14"
+}
+
+style "theme-wide" = "theme-default"
+{
+    xthickness = 3
+    ythickness = 3
+}
+
+style "theme-text" = "theme-default"
+{
+    #base[SELECTED]     = "#fc9747"  # Outline?
+}
+
+style "theme-toolbar" = "theme-default"
+{
+    #top and bottom border
+    bg[NORMAL] = @bg_color
+}
+
+style "theme-scrollbar" = "theme-default"
+{
+    bg[SELECTED] = shade (1.1, @selected_bg_color)
+}
+
+style "theme-tasklist" = "theme-default"
+{
+    xthickness = 5
+    ythickness = 3
+}
+
+style "theme-menu" = "theme-default"
+{
+    xthickness = 3
+    ythickness = 3
+    bg[NORMAL] = shade (1.1,@bg_color)
+}
+
+style "theme-menu-item" = "theme-default"
+{
+    xthickness = 2
+    ythickness = 4
+    fg[PRELIGHT] = @selected_fg_color
+    text[PRELIGHT] = @selected_fg_color
+    base[PRELIGHT] = @selected_bg_color # Selection color
+}
+
+style "theme-menu-itembar" = "theme-default"
+{
+    xthickness = 0
+    ythickness = 0
+}
+
+style "theme-tree" = "theme-default"
+{
+    xthickness = 2
+    ythickness = 2
+    GtkTreeView::odd-row-color = shade(0.9, @base_color)
+    GtkTreeView::even-row-color = @base_color
+}
+
+style "theme-frame-title" = "theme-default"
+{
+    #fg[NORMAL] = "#f00" #button frames
+}
+
+style "theme-tooltips" = "theme-default"
+{
+    xthickness = 4
+    ythickness = 4
+    bg[NORMAL] = { 1.0,1.0,0.75 }
+}
+
+style "theme-progressbar" = "theme-default"
+{
+    xthickness = 1
+    ythickness = 1
+    fg[PRELIGHT]  = @base_color
+}
+
+style "theme-combo" = "theme-default"
+{
+    xthickness = 2
+    ythickness = 4
+}
+
+style "theme-button" = "theme-wide"
+{
+    bg[NORMAL] = @bg_color
+    bg[PRELIGHT] = shade (1.1, @bg_color)
+    bg[ACTIVE] = shade (0.9, @bg_color)
+    #xthickness = 4
+    #ythickness = 2
+}
+
+style "theme-check" = "theme-button"
+{
+}
+
+style "theme-panel" = "theme-default"
+{
+    xthickness = 3
+    ythickness = 3
+    bg[ACTIVE] = shade (1.1, @selected_bg_color)
+    fg[ACTIVE] = @selected_fg_color
+}
+
+style "theme-notebook" = "theme-wide"
+{
+    base[SELECTED]    = @selected_bg_color  # Tab selection color
+    bg[ACTIVE]        = shade(0.9, @bg_color)  # Unselected tabs
+
+#    engine "clearlooks" {
+#        style = CLASSIC
+#    }
+}
+
+# widget styles
+class "GtkWidget" style "theme-default"
+class "GtkButton" style "theme-button"
+class "GtkCombo"  style "theme-button"
+class "GtkRange"  style "theme-wide"
+class "GtkFrame"  style "theme-wide"
+class "GtkMenu"   style "theme-menu"
+class "GtkEntry"  style "theme-button"
+class "GtkMenuItem"    style "theme-menu-item"
+class "GtkStatusbar"   style "theme-wide"
+class "GtkNotebook"    style "theme-notebook"
+class "GtkProgressBar" style "theme-progressbar"
+class "GtkCheckButton" style "theme-check"
+class "GtkRadioButton" style "theme-check"
+class "GtkToolbar" style "theme-toolbar"
+
+widget_class "*MenuItem.*" style "theme-menu-item"
+
+# combobox stuff
+widget_class "*.GtkComboBox.GtkButton" style "theme-combo"
+widget_class "*.GtkCombo.GtkButton"    style "theme-combo"
+
+# tooltips stuff
+widget_class "*.tooltips.*.GtkToggleButton" style "theme-tasklist"
+widget "gtk-tooltips" style "theme-tooltips"
+
+# treeview stuff
+widget "*GtkTreeView*" style "theme-tree"
+widget_class "*.GtkTreeView.GtkButton" style "theme-tree"
+widget_class "*.GtkCTree.GtkButton" style "theme-tree"
+widget_class "*.GtkList.GtkButton" style "theme-tree"
+widget_class "*.GtkCList.GtkButton" style "theme-tree"
+widget_class "*.GtkFrame.GtkLabel" style "theme-frame-title"
+
+# notebook stuff
+widget_class "*.GtkNotebook.*.GtkEventBox" style "theme-notebook"
+widget_class "*.GtkNotebook.*.GtkViewport" style "theme-notebook"
+
+# scrollbar stuff
+class "GtkScrollbar" style "theme-scrollbar"
+
+gtk-font-name = "Lucida Grande 12"
diff --git a/packaging/MacSDK/ironlangs.py b/packaging/MacSDK/ironlangs.py
new file mode 100644 (file)
index 0000000..0d4e336
--- /dev/null
@@ -0,0 +1,66 @@
+import os
+import string
+
+
+class IronLanguagesPackage(GitHubTarballPackage):
+
+    def __init__(self):
+        GitHubTarballPackage.__init__(self,
+                                      'IronLanguages', 'iron-languages',
+                                      '2.11',
+                                      'de63773744ccf9873c1826470730ae0446fd64d7',
+                                      configure='')
+
+        # override: avoid naming the package 'main' because of the repo name
+        self.sources = [
+            'https://github.com/%{organization}/main/tarball/%{revision}']
+        self.source_dir_name = '%s-%s-%s' % (
+            self.organization, 'main', self.revision[:7])
+
+    def build(self):
+        self.ironruby = os.path.join(
+            self.workspace, 'ironruby', 'bin') + os.sep
+        self.ironpython = os.path.join(
+            self.workspace, 'ironpython', 'bin') + os.sep
+        self.sh(
+            'xbuild /p:Configuration=Release /p:OutDir="%{ironruby}" Solutions/Ruby.sln')
+        self.sh(
+            'xbuild /p:Configuration=Release /p:OutDir="%{ironpython}" Solutions/IronPython.Mono.sln')
+
+    def install_ruby_scripts(self, path, installdir):
+        for cmd, ext in map(os.path.splitext, os.listdir(path)):
+            if ext != '.exe':
+                continue
+            wrapper = os.path.join(self.staged_prefix, "bin", cmd)
+            with open(wrapper, "w") as output:
+                output.write("#!/bin/sh\n")
+                output.write(
+                    "exec {0}/bin/mono {0}/lib/{1}/{2}.exe \"$@\"\n".format(
+                        self.staged_prefix, installdir, cmd))
+            os.chmod(wrapper, 0o755)
+
+    def install_python_scripts(self, path, installdir):
+        for cmd, ext in map(os.path.splitext, os.listdir(path)):
+            if ext != '.exe':
+                continue
+            wrapper = os.path.join(self.staged_prefix, "bin", cmd)
+            with open(wrapper, "w") as output:
+                output.write("#!/bin/sh\n")
+                output.write(
+                    'export IRONPYTHONPATH=/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/\n')
+                output.write(
+                    "exec {0}/bin/mono {0}/lib/{1}/{2}.exe \"$@\"\n".format(
+                        self.staged_prefix, installdir, cmd))
+            os.chmod(wrapper, 0o755)
+
+    def install(self):
+        self.sh("mkdir -p %{staged_prefix}/lib/ironruby/")
+        self.sh("mkdir -p %{staged_prefix}/bin/")
+        self.sh("cp -R %{ironruby} %{staged_prefix}/lib/ironruby/")
+        self.install_ruby_scripts(self.ironruby, 'ironruby')
+
+        self.sh("mkdir -p %{staged_prefix}/lib/ironpython/")
+        self.sh("cp -R %{ironpython} %{staged_prefix}/lib/ironpython/")
+        self.install_python_scripts(self.ironpython, 'ironpython')
+
+IronLanguagesPackage()
diff --git a/packaging/MacSDK/libgdiplus.py b/packaging/MacSDK/libgdiplus.py
new file mode 100644 (file)
index 0000000..e40baac
--- /dev/null
@@ -0,0 +1,8 @@
+GitHubTarballPackage(
+    'mono',
+    'libgdiplus',
+    '2.11',
+    '4e7ab0f555a13a6b2f954c714c4ee5213954ff79',
+    configure='CFLAGS="%{gcc_flags} %{local_gcc_flags} -I/opt/X11/include" ./autogen.sh --prefix="%{package_prefix}"',
+    override_properties={
+        'make': 'C_INCLUDE_PATH="" make'})
diff --git a/packaging/MacSDK/mono-basic.py b/packaging/MacSDK/mono-basic.py
new file mode 100644 (file)
index 0000000..ffdbde0
--- /dev/null
@@ -0,0 +1,12 @@
+
+class MonoBasicPackage (GitHubTarballPackage):
+
+    def __init__(self):
+        GitHubTarballPackage.__init__(self, 'mono', 'mono-basic', '4.6', 'c93133db1d511f994918391f429fee29b9250004',
+                                      configure='./configure --prefix="%{staged_profile}"')
+
+    def install(self):
+        self.sh('./configure --prefix="%{staged_prefix}"')
+        self.sh('make install')
+
+MonoBasicPackage()
diff --git a/packaging/MacSDK/mono-llvm.py b/packaging/MacSDK/mono-llvm.py
new file mode 100644 (file)
index 0000000..cf9e89b
--- /dev/null
@@ -0,0 +1,35 @@
+import os
+
+
+class MonoLlvmPackage (GitHubPackage):
+
+    def __init__(self):
+        GitHubPackage.__init__(self, 'mono', 'llvm', '3.0',
+                               revision='8b1520c8aae53e219cf80cdc0f02ad96600887d6',
+                               configure_flags=[
+                                   '--enable-optimized',
+                                   '--enable-assertions=no',
+                                   '--enable-targets="x86,x86_64"']
+                               )
+
+        # This package would like to be lipoed.
+        self.needs_lipo = True
+
+        # TODO: find out which flags are causing issues. reset ld_flags for the
+        # package
+        self.ld_flags = []
+        self.cpp_flags = []
+
+    def arch_build(self, arch):
+        if arch == 'darwin-64':  # 64-bit  build pass
+            self.local_configure_flags = ['--build=x86_64-apple-darwin11.2.0']
+
+        if arch == 'darwin-32':
+            self.local_configure_flags = ['--build=i386-apple-darwin11.2.0']
+
+        # LLVM says that libstdc++4.6 is broken and we should use libstdc++4.7.
+        # This switches it to the right libstdc++.
+        if Package.profile.name == 'darwin':
+            self.local_configure_flags.extend(['--enable-libcpp=yes'])
+
+MonoLlvmPackage()
diff --git a/packaging/MacSDK/mono.py b/packaging/MacSDK/mono.py
new file mode 100644 (file)
index 0000000..8b9f6b3
--- /dev/null
@@ -0,0 +1,99 @@
+import os
+import re
+
+from bockbuild.package import Package
+from bockbuild.util.util import *
+
+
+class MonoMasterPackage(Package):
+
+    def __init__(self):
+        Package.__init__(self, 'mono', None,
+                         sources=[
+                             Package.profile.git_root],
+                         git_branch=os.getenv('MONO_BRANCH') or None,
+                         revision=os.getenv('MONO_BUILD_REVISION'),
+                         configure_flags=[
+                             '--enable-nls=no',
+                             '--with-ikvm=yes'
+                         ]
+                         )
+        self.source_dir_name = 'mono'
+        # This package would like to be lipoed.
+        self.needs_lipo = True
+
+        # Don't clean the workspace, so we can run 'make check' afterwards
+        self.dont_clean = True
+
+        if Package.profile.name == 'darwin':
+            self.configure_flags.extend([
+                '--with-libgdiplus=%s/lib/libgdiplus.dylib' % Package.profile.staged_prefix,
+                '--enable-loadedllvm',
+                'CXXFLAGS=-stdlib=libc++'
+            ])
+
+            self.sources.extend([
+                # Fixes up pkg-config usage on the Mac
+                'patches/mcs-pkgconfig.patch'
+            ])
+        else:
+            self.configure_flags.extend([
+                '--with-libgdiplus=%s/lib/libgdiplus.so' % Package.profile.staged_prefix
+            ])
+
+        self.gcc_flags.extend(['-O2'])
+
+        self.configure = './autogen.sh --prefix="%{package_prefix}"'
+
+        self.extra_stage_files = ['etc/mono/config']
+
+    def build(self):
+        self.make = '%s EXTERNAL_MCS=%s EXTERNAL_RUNTIME=%s' % (
+            self.make, self.profile.env.system_mcs, self.profile.env.system_mono)
+        Package.build(self)
+
+    def prep(self):
+        Package.prep(self)
+        for p in range(1, len(self.local_sources)):
+            self.sh('patch -p1 < "%{local_sources[' + str(p) + ']}"')
+
+    def arch_build(self, arch):
+        if arch == 'darwin-64':  # 64-bit build pass
+            self.local_gcc_flags = ['-m64']
+            self.local_configure_flags = ['--build=x86_64-apple-darwin11.2.0']
+
+        if arch == 'darwin-32':  # 32-bit build pass
+            self.local_gcc_flags = ['-m32']
+            self.local_configure_flags = ['--build=i386-apple-darwin11.2.0']
+
+        self.local_configure_flags.extend(
+            ['--cache-file=%s/%s-%s.cache' % (self.profile.bockbuild.build_root, self.name, arch)])
+
+    def install(self):
+        Package.install(self)
+
+        registry_dir = os.path.join(
+            self.staged_prefix,
+            "etc",
+            "mono",
+            "registry",
+            "LocalMachine")
+        ensure_dir(registry_dir)
+
+        # Add ImportBefore/ImportAfter files from xbuild to the msbuild
+        # directories
+        xbuild_dir = os.path.join(self.staged_prefix, 'lib/mono/xbuild')
+        new_xbuild_tv_dir = os.path.join(xbuild_dir, self.version)
+        os.makedirs(new_xbuild_tv_dir)
+
+        self.sh('cp -R %s/14.0/Imports %s' % (xbuild_dir, new_xbuild_tv_dir))
+        self.sh(
+            'cp -R %s/14.0/Microsoft.Common.targets %s' %
+            (xbuild_dir, new_xbuild_tv_dir))
+
+    def deploy(self):
+        if bockbuild.cmd_options.arch == 'darwin-universal':
+            os.symlink('mono-sgen64', '%s/bin/mono64' % self.staged_profile)
+            os.symlink('mono-sgen32', '%s/bin/mono32' % self.staged_profile)
+
+MonoMasterPackage()
diff --git a/packaging/MacSDK/msbuild.py b/packaging/MacSDK/msbuild.py
new file mode 100644 (file)
index 0000000..0e16af1
--- /dev/null
@@ -0,0 +1,44 @@
+import fileinput
+
+
+class MSBuild (GitHubPackage):
+
+    def __init__(self):
+        GitHubPackage.__init__(self, 'mono', 'msbuild', '15.0',
+                               git_branch='xplat-c8p')
+
+    def build(self):
+        self.sh('./cibuild.sh --scope Compile --target Mono --host Mono')
+
+    def install(self):
+        # adjusted from 'install-mono-prefix.sh'
+
+        build_output = 'bin/Debug-MONO/OSX_Deployment'
+        new_location = os.path.join(
+            self.staged_prefix,
+            'lib/mono/msbuild/%s/bin' %
+            self.version)
+        bindir = os.path.join(self.staged_prefix, 'bin')
+
+        os.makedirs(new_location)
+        self.sh('cp -R %s/* %s' % (build_output, new_location))
+
+        os.makedirs(bindir)
+
+        self.sh('cp msbuild-mono-deploy.in %s/msbuild' % bindir)
+
+        for line in fileinput.input('%s/msbuild' % bindir, inplace=True):
+            line = line.replace('@bindir@', '%s/bin' % self.staged_prefix)
+            line = line.replace(
+                '@mono_instdir@',
+                '%s/lib/mono' %
+                self.staged_prefix)
+            print line
+
+        for excluded in glob.glob("%s/*UnitTests*" % new_location):
+            self.rm(excluded)
+
+        for excluded in glob.glob("%s/*xunit*" % new_location):
+            self.rm(excluded)
+
+MSBuild()
diff --git a/packaging/MacSDK/nuget.py b/packaging/MacSDK/nuget.py
new file mode 100644 (file)
index 0000000..321bedf
--- /dev/null
@@ -0,0 +1,18 @@
+
+class NuGetPackage(GitHubPackage):
+
+    def __init__(self):
+        GitHubPackage.__init__(self,
+                               'mono', 'nuget',
+                               '2.12.0',
+                               '9e2d2c1cc09d2a40eeb72e8c5db789e3b9bf2586',
+                               configure='')
+
+    def build(self):
+        self.sh('%{make} update_submodules')
+        self.sh('%{make} PREFIX=%{package_prefix}')
+
+    def install(self):
+        self.sh('%{makeinstall} PREFIX=%{staged_prefix}')
+
+NuGetPackage()
diff --git a/packaging/MacSDK/packaging/Info.plist b/packaging/MacSDK/packaging/Info.plist
new file mode 100644 (file)
index 0000000..8c3799d
--- /dev/null
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+        <key>CFBundleGetInfoString</key>
+        <string>@@MONO_VERSION_RELEASE@@</string>
+        <key>CFBundleIdentifier</key>
+        <string>com.ximian.mono-@@MONO_VERSION@@</string>
+        <key>CFBundleName</key>
+        <string>Mono.framework</string>
+        <key>CFBundleShortVersionString</key>
+        <string>@@MONO_VERSION@@</string>
+        <key>IFPkgFlagAllowBackRev</key>
+        <true/>
+        <key>IFPkgFlagAuthorizationAction</key>
+        <string>AdminAuthorization</string>
+        <key>IFPkgFlagDefaultLocation</key>
+        <string>/</string>
+        <key>IFPkgFlagInstallFat</key>
+        <false/>
+        <key>IFPkgFlagIsRequired</key>
+        <false/>
+        <key>IFPkgFlagRelocatable</key>
+        <false/>
+        <key>IFPkgFlagRestartAction</key>
+        <string>NoRestart</string>
+        <key>IFPkgFlagRootVolumeOnly</key>
+        <true/>
+        <key>IFPkgFlagUpdateInstalledLanguages</key>
+        <false/>
+        <key>IFPkgFormatVersion</key>
+        <real>0.10000000149011612</real>
+</dict>
+</plist>
diff --git a/packaging/MacSDK/packaging/Info_sdk.plist b/packaging/MacSDK/packaging/Info_sdk.plist
new file mode 100644 (file)
index 0000000..7d75b1a
--- /dev/null
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+        <key>CFBundleGetInfoString</key>
+        <string>@@MONO_VERSION_RELEASE@@</string>
+        <key>CFBundleIdentifier</key>
+        <string>com.ximian.mono-@@MONO_VERSION@@-csdk</string>
+        <key>CFBundleName</key>
+        <string>Mono.framework</string>
+        <key>CFBundleShortVersionString</key>
+        <string>@@MONO_VERSION@@</string>
+        <key>IFPkgFlagAllowBackRev</key>
+        <true/>
+        <key>IFPkgFlagAuthorizationAction</key>
+        <string>AdminAuthorization</string>
+        <key>IFPkgFlagDefaultLocation</key>
+        <string>/</string>
+        <key>IFPkgFlagInstallFat</key>
+        <false/>
+        <key>IFPkgFlagIsRequired</key>
+        <false/>
+        <key>IFPkgFlagRelocatable</key>
+        <false/>
+        <key>IFPkgFlagRestartAction</key>
+        <string>NoRestart</string>
+        <key>IFPkgFlagRootVolumeOnly</key>
+        <true/>
+        <key>IFPkgFlagUpdateInstalledLanguages</key>
+        <false/>
+        <key>IFPkgFormatVersion</key>
+        <real>0.10000000149011612</real>
+</dict>
+</plist>
diff --git a/packaging/MacSDK/packaging/mdk_blacklist.sh b/packaging/MacSDK/packaging/mdk_blacklist.sh
new file mode 100755 (executable)
index 0000000..ab426a7
--- /dev/null
@@ -0,0 +1,135 @@
+#!/bin/bash
+
+if test x$1 = x; then
+   echo usage is cleanup MONODIR
+   exit 1
+fi
+
+MONODIR=$1
+
+cd $MONODIR
+rm -rf lib/gtk-2.0/2.10.0/engines/libcrux-engine.so
+rm -rf lib/gtk-2.0/2.10.0/engines/libglide.so
+rm -rf lib/gtk-2.0/2.10.0/engines/libhcengine.so
+rm -rf lib/gtk-2.0/2.10.0/engines/libindustrial.so
+rm -rf lib/gtk-2.0/2.10.0/engines/libmist.so
+rm -rf lib/gtk-2.0/2.10.0/engines/libpixmap.so
+rm -rf lib/gtk-2.0/2.10.0/engines/libredmond95.so
+rm -rf lib/gtk-2.0/2.10.0/engines/libthinice.so
+rm -rf gtk-2.0/modules/libferret.*
+rm -rf gtk-2.0/modules/libgail.*
+rm -rf share/gtk-2.0/demo/*
+rm -rf share/man/man1/oldmono.1
+rm -rf share/themes/Crux
+rm -rf share/themes/Default
+rm -rf share/themes/Emacs
+rm -rf share/themes/Industrial
+rm -rf share/themes/Mist
+rm -rf share/themes/Raleigh
+rm -rf share/themes/Redmond
+rm -rf share/themes/ThinIce
+rm -rf share/info
+rm -rf share/icons/gnome
+rm -rf share/icons/hicolor
+rm -rf share/gtk-doc
+rm -rf share/gettext/*.class
+rm -rf share/doc
+rm -rf share/emacs
+rm -rf share/strings
+rm -rf share/pixmaps
+rm -rf share/intltool
+rm -rf var/cache/fontconfig
+
+# delete most of the *.a files
+rm -rf lib/cairo/libcairo-trace.a
+rm -rf lib/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-svg.a
+rm -rf lib/gtk-2.0/2.10.0/engines/libsvg.a
+rm -rf lib/libCompilerDriver.a
+rm -rf lib/libEnhancedDisassembly.a
+rm -rf lib/libLLVMAnalysis.a
+rm -rf lib/libLLVMArchive.a
+rm -rf lib/libLLVMAsmParser.a
+rm -rf lib/libLLVMAsmPrinter.a
+rm -rf lib/libLLVMBitReader.a
+rm -rf lib/libLLVMBitWriter.a
+rm -rf lib/libLLVMCodeGen.a
+rm -rf lib/libLLVMCore.a
+rm -rf lib/libLLVMExecutionEngine.a
+rm -rf lib/libLLVMInstCombine.a
+rm -rf lib/libLLVMInstrumentation.a
+rm -rf lib/libLLVMInterpreter.a
+rm -rf lib/libLLVMJIT.a
+rm -rf lib/libLLVMLinker.a
+rm -rf lib/libLLVMMC.a
+rm -rf lib/libLLVMMCDisassembler.a
+rm -rf lib/libLLVMMCJIT.a
+rm -rf lib/libLLVMMCParser.a
+rm -rf lib/libLLVMObject.a
+rm -rf lib/libLLVMScalarOpts.a
+rm -rf lib/libLLVMSelectionDAG.a
+rm -rf lib/libLLVMSupport.a
+rm -rf lib/libLLVMTarget.a
+rm -rf lib/libLLVMTransformUtils.a
+rm -rf lib/libLLVMX86AsmParser.a
+rm -rf lib/libLLVMX86AsmPrinter.a
+rm -rf lib/libLLVMX86CodeGen.a
+rm -rf lib/libLLVMX86Disassembler.a
+rm -rf lib/libLLVMX86Info.a
+rm -rf lib/libLLVMipa.a
+rm -rf lib/libLLVMipo.a
+rm -rf lib/libLTO.a
+# rm -rf lib/libMonoPosixHelper.a
+# rm -rf lib/libMonoSupportW.a
+rm -rf lib/libUnitTestMain.a
+rm -rf lib/libatksharpglue-2.a
+rm -rf lib/libcairo-gobject.a
+rm -rf lib/libcairo-script-interpreter.a
+rm -rf lib/libcairo.a
+rm -rf lib/libcroco-0.6.a
+rm -rf lib/libexpat.a
+rm -rf lib/libffi.a
+rm -rf lib/libfontconfig.a
+rm -rf lib/libfreetype.a
+rm -rf lib/libgdiplus.a
+rm -rf lib/libgdksharpglue-2.a
+rm -rf lib/libgettextpo.a
+rm -rf lib/libgif.a
+rm -rf lib/libglade-2.0.a
+rm -rf lib/libgladesharpglue-2.a
+rm -rf lib/libglibsharpglue-2.a
+rm -rf lib/libgtksharpglue-2.a
+rm -rf lib/libikvm-native.a
+rm -rf lib/libintl.a
+rm -rf lib/libjpeg.a
+rm -rf lib/liblzma.a
+# rm -rf lib/libmono-2.0.a
+# rm -rf lib/libmono-llvm.a
+# rm -rf lib/libmono-profiler-aot.a
+# rm -rf lib/libmono-profiler-cov.a
+# rm -rf lib/libmono-profiler-iomap.a
+# rm -rf lib/libmono-profiler-log.a
+# rm -rf lib/libmonosgen-2.0.a
+rm -rf lib/libpangosharpglue-2.a
+rm -rf lib/libpixman-1.a
+rm -rf lib/libpng.a
+rm -rf lib/libpng14.a
+rm -rf lib/librsvg-2.a
+rm -rf lib/libsqlite3.a
+rm -rf lib/libtiff.a
+rm -rf lib/libtiffxx.a
+rm -rf lib/libxml2.a
+
+# we don't need any of the llvm executables except llc and opt
+rm -rf bin/bugpoint
+rm -rf bin/lli
+rm -rf bin/llvm-*
+rm -rf bin/macho-dump
+rm -rf bin/ccache
+
+#
+# 14:39 <baulig> the install script needs to be modified not to
+#                install .mdb's for these
+# 14:39 <baulig> System.Windows.dll, System.Xml.Serialization.dll and
+#                everything in Facades
+
+find ./lib/mono/4.5/Facades -name "*.mdb" -delete
diff --git a/packaging/MacSDK/packaging/resources/License.rtf b/packaging/MacSDK/packaging/resources/License.rtf
new file mode 100644 (file)
index 0000000..ab13fe4
--- /dev/null
@@ -0,0 +1,26 @@
+{\rtf1\mac\ansicpg10000\cocoartf102
+{\fonttbl\f0\fswiss\fcharset77 Helvetica;}
+{\colortbl;\red255\green255\blue255;}
+\margl1440\margr1440\vieww9000\viewh9000\viewkind0
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural
+
+\f0\fs24 \cf0 The software included in the package is licensed under several different agreements.\
+\
+MIT License:\
+\
+http://www.opensource.org/licenses/mit-license.php\
+\
+LGPL:\
+\
+http://www.opensource.org/licenses/lgpl-2.1.php\
+\
+GPL:\
+\
+http://www.opensource.org/licenses/gpl-2.0.php\
+\
+You can develop commercial applications and redistribute the code in this package.
+You only need to obtain a commercial license if you wish to make changes to Mono or
+if you are using Mono as an embedded runtime into your application.\
+\
+Contact contact@xamarin.com if you think you need a license.
+}
diff --git a/packaging/MacSDK/packaging/resources/ReadMe.rtf b/packaging/MacSDK/packaging/resources/ReadMe.rtf
new file mode 100644 (file)
index 0000000..704571f
--- /dev/null
@@ -0,0 +1,41 @@
+{\rtf1\ansi\ansicpg1252\cocoartf1138\cocoasubrtf320
+{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
+{\colortbl;\red255\green255\blue255;}
+\margl1440\margr1440\vieww15940\viewh15760\viewkind0
+\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640
+
+\f0\fs24 \cf0 This README is for
+\b  Mono.framework @@MONO_VERSION_RELEASE@@
+\b0 .\
+\
+This is the Mono Runtime and Development Platform (http://www.mono-project.com/).\
+\
+This package installs Mono and all of its dependencies inside of /Library/Frameworks/Mono.framework.  This behavior is likely to change with a future release so that dependancies will get their own frameworks.\
+\
+The following components are included inside Mono.framework:\
+@@PACKAGES@@\
+\
+Other packages used to build Mono.framework:\
+@@DEP_PACKAGES@@\
+If you want to build native Mac applications with Mono, you can use the MonoMac bindings, an add-on to this product available from http://www.mono-project.com/MonoMac\
+\
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720
+\cf0 \
+\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640
+\cf0 \
+\
+A simple uninstallMono.sh script is included in the disk image.  This is shell script that must be run as root, and it will remove the Mono.framework and the links in /usr/bin.\
+\
+This package was created by the Mono team.  Major contributors to this team include (in alphabetical order): \
+\
+Wade Berrier\
+Adhamh Findlay\
+Miguel de Icaza\
+Urs Muff\
+Geoff Norton\
+Andy Satori\
+\
+Questions or problems related directly to the Mono.framework should be addressed to mono-osx@lists.xamarin.com.\
+\
+Questions about Mono should be directed to an appropriate resource that can be found on http://www.mono-project.com/about. \
+}
\ No newline at end of file
diff --git a/packaging/MacSDK/packaging/resources/Welcome.rtf b/packaging/MacSDK/packaging/resources/Welcome.rtf
new file mode 100644 (file)
index 0000000..200bc99
--- /dev/null
@@ -0,0 +1,12 @@
+{\rtf1\ansi\ansicpg1252\cocoartf1038\cocoasubrtf360
+{\fonttbl\f0\fnil\fcharset0 HelveticaNeue;}
+{\colortbl;\red255\green255\blue255;}
+\margl1440\margr1440\vieww9000\viewh9000\viewkind0
+\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural
+
+\f0\fs32 \cf0 Welcome to
+\b Mono.framework @@MONO_VERSION_RELEASE@@
+\b0  for OS X.
+\fs36 \
+\
+}
\ No newline at end of file
diff --git a/packaging/MacSDK/packaging/resources/distribution.xml b/packaging/MacSDK/packaging/resources/distribution.xml
new file mode 100644 (file)
index 0000000..39926f9
--- /dev/null
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8" standalone="no"?>
+<installer-gui-script minSpecVersion="1">
+    <title>Mono Framework</title>
+    <license file="License.rtf" mime-type="application/rtf" />
+    <readme file="ReadMe.rtf" mime-type="application/rtf" />
+    <pkg-ref id="mono">
+        <bundle-version/>
+    </pkg-ref>
+    <choices-outline>
+        <line choice="default">
+            <line choice="mono"/>
+        </line>
+    </choices-outline>
+    <choice id="default"/>
+    <choice id="mono" visible="false">
+        <pkg-ref id="mono"/>
+    </choice>
+    <pkg-ref id="mono">#mono.pkg</pkg-ref>
+</installer-gui-script>
diff --git a/packaging/MacSDK/packaging/resources/postinstall b/packaging/MacSDK/packaging/resources/postinstall
new file mode 100755 (executable)
index 0000000..5ad19ad
--- /dev/null
@@ -0,0 +1,107 @@
+#!/bin/sh -x
+
+FW=/Library/Frameworks/Mono.framework
+FW_CURRENT=${FW}/Versions/Current
+CURRENT=`basename $(readlink ${FW_CURRENT})`
+
+# Remove PCL assemblies that we installed from Mono 3.1.1
+LICENSE="Portable Class Library Reference Assemblies License-07JUN2013.docx"
+if [ -f "$FW/External/xbuild-frameworks/.NETPortable/$LICENSE" ]; then
+    echo "Removing PCL because we're upgrading from 3.1.1" >> /tmp/mono-installation
+    rm -rf $FW/External/xbuild-frameworks/.NETPortable
+fi
+
+# Remove /usr/local/bin/pkg-config if it's a symlink to the Mono-installed one
+PKG_CONFIG_LINK="/usr/local/bin/pkg-config"
+if [ -L $PKG_CONFIG_LINK ]; then
+    location=`readlink $PKG_CONFIG_LINK`
+    case "$location" in
+    *Mono.framework*) rm $PKG_CONFIG_LINK;;
+    esac
+fi
+
+WHITELIST=$(cat "$(dirname "$0")/whitelist.txt")
+MONO_COMMANDS_FILE=/etc/paths.d/mono-commands
+FW_WHITELISTED_COMMANDS=${FW_CURRENT}/Commands
+
+mkdir ${FW_WHITELISTED_COMMANDS}
+mkdir /etc/paths.d
+
+if test -e ${MONO_COMMANDS_FILE}; then
+    rm "${MONO_COMMANDS_FILE}"
+fi
+
+echo "${FW_WHITELISTED_COMMANDS}" >> "${MONO_COMMANDS_FILE}"
+
+if [ -d "${FW}"/Commands ]; then
+    for i in ${WHITELIST}; do
+        if test -e "${FW}/Commands/${i}"; then
+            ln -s "${FW}/Commands/${i}" "${FW_WHITELISTED_COMMANDS}/${i}"
+        fi
+    done;
+else
+    echo "${FW}/Commands does not exist"
+    echo "Can not add command links to $PATH."
+fi
+
+if [ -d ${FW_CURRENT} ]; then
+    cd ${FW_CURRENT}/share/man
+    for i in ${WHITELIST}; do
+        for j in $(ls man*/${i}.*); do
+            if test ! -e "/usr/local/share/man/${j}"; then
+                ln -sf "${FW_CURRENT}/share/man/${j}" "/usr/local/share/man/${j}"
+            fi
+        done
+    done
+
+    cd ${FW_CURRENT}/etc
+    # Make sure we run the files we lay down, and not other stuff installed on the system
+    export PATH=${FW_CURRENT}/bin:$PATH
+    # gtk+ setup
+    gdk-pixbuf-query-loaders --update-cache
+    # pango setup
+    mkdir -p pango
+    pango-querymodules >  pango/pango.modules
+    pango-querymodules --update-cache
+    fc-cache
+
+    cd ${FW_CURRENT}/lib/gtk-2.0/2.10.0
+    gtk-query-immodules-2.0 > immodules.cache
+fi
+
+# Delete older Monos
+#
+# - keep if the major version is different
+# - keep if 'Versions/x.y.z/keep' exists
+# - Keep if it is greater than $CURRENT
+#
+echo "Current:" $CURRENT >> /tmp/mono-installation
+
+pushd ${FW}/Versions
+for i in `ls -d *`; do
+    result=`echo "${i:0:1} == ${CURRENT:0:1}" | bc`
+    if [ $result -ne 1 ]; then
+        echo "keeping" $i "because it has a different major version" >> /tmp/mono-installation
+        continue
+    fi
+
+    if [ -f $i/keep ]; then
+        echo "Keeping" $i "because of keep file" >> /tmp/mono-installation
+        continue
+    fi
+
+    # A magical bit of Perl: http://stackoverflow.com/a/7366753/494990
+    result=$(perl -e '($a,$b)=@ARGV; for ($a,$b) {s/(\d+)/sprintf "%5d", $1/ge}; print $a cmp $b;' $i $CURRENT)
+    if [ $result -ge 0 ]; then
+        echo "Skipping" $i "because $i >= $CURRENT" >> /tmp/mono-installation
+        continue
+
+    else
+        echo "rm -rf" $i >> /tmp/mono-installation
+        rm -rf $i
+    fi
+done
+popd
+
+# Mono framework should be owned by root
+chown -R root:admin ${FW}
diff --git a/packaging/MacSDK/packaging/resources/version.plist b/packaging/MacSDK/packaging/resources/version.plist
new file mode 100644 (file)
index 0000000..df2e67c
--- /dev/null
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+        <key>BuildVersion</key>
+        <string>@@MONO_VERSION_RELEASE@@</string>
+        <key>CFBundleShortVersionString</key>
+        <string>@@MONO_VERSION_RELEASE@@</string>
+        <key>CFBundleVersion</key>
+        <string>@@MONO_VERSION_RELEASE@@</string>
+        <key>ProjectName</key>
+        <string>Mono</string>
+        <key>SourceVersion</key>
+        <string>@@MONO_VERSION_RELEASE@@</string>
+</dict>
+</plist>
diff --git a/packaging/MacSDK/packaging/resources/whitelist.txt b/packaging/MacSDK/packaging/resources/whitelist.txt
new file mode 100644 (file)
index 0000000..7d329a9
--- /dev/null
@@ -0,0 +1,129 @@
+al
+al2
+asp-state
+asp-state2
+asp-state4
+booc
+booi
+booish
+caspol
+ccrewrite
+cccheck
+cert2spc
+certmgr
+chktrust
+ClassInitGenerator
+csharp
+csharp2
+dbsessmgr
+dbsessmgr2
+dbsessmgr4
+disco
+dmcs
+dtd2rng
+dtd2xsd
+fastcgi-mono-server
+fastcgi-mono-server2
+fastcgi-mono-server4
+fsharpc
+fsharpc2
+fsharpi
+fsharpi2
+gacutil
+gacutil2
+gapi2-codegen
+gapi2-fixup
+gapi2-parser
+genxs
+gmcs
+httpcfg
+ikdasm
+ilasm
+installvst
+ipy
+ipy64
+ipyw
+ipyw64
+ir
+ir64
+IronRuby.Tests
+irw
+irw64
+lc
+macpack
+makecert
+mautil
+mconfig
+mcs
+mdassembler
+mdoc
+mdoc-assemble
+mdoc-export-html
+mdoc-export-msxdoc
+mdoc-update
+mdoc-validate
+mdvalidater
+mkbundle
+mod
+mod-mono-server
+mod-mono-server2
+mod-mono-server4
+mono
+mono64
+mono-boehm
+mono-api-info
+mono-api-html
+mono-cil-strip
+mono-configuration-crypto
+monodis
+monodocer
+monodocs2html
+monodocs2slashdoc
+mono-find-provides
+mono-find-requires
+mono-gdb.py
+monograph
+mono-heapviz
+monolinker
+monop
+monop2
+mono-service
+mono-service2
+mono-sgen
+mono-shlib-cop
+mono-symbolicate
+mono-test-install
+mono-xmltool
+mozroots
+mprof-report
+msbuild
+nant
+nuget
+nunit-console
+nunit-console2
+nunit-console4
+pdb2mdb
+pedump
+permview
+peverify
+prj2make
+resgen
+resgen2
+secutil
+setreg
+sgen
+signcode
+sn
+soapsuds
+sqlmetal
+sqlsharp
+svcutil
+vbnc
+vbnc2
+wsdl
+wsdl2
+xbuild
+xsd
+xsp
+xsp2
+xsp4
diff --git a/packaging/MacSDK/packaging/uninstallMono.sh b/packaging/MacSDK/packaging/uninstallMono.sh
new file mode 100755 (executable)
index 0000000..9e88ad1
--- /dev/null
@@ -0,0 +1,15 @@
+#!/bin/sh -x
+
+#This script removes Mono from an OS X System.  It must be run as root
+
+rm -r /Library/Frameworks/Mono.framework
+
+# In 10.6+ the receipts are stored here
+rm /var/db/receipts/com.ximian.mono*
+
+for dir in /usr/local/bin; do
+   (cd ${dir};
+    for i in `ls -al | grep /Library/Frameworks/Mono.framework/ | awk '{print $9}'`; do
+      rm ${i}
+    done);
+done
diff --git a/packaging/MacSDK/patches/find-unused-patches.sh b/packaging/MacSDK/patches/find-unused-patches.sh
new file mode 100755 (executable)
index 0000000..b758c97
--- /dev/null
@@ -0,0 +1,3 @@
+#!/bin/sh
+for f in *.patch; do grep $f ../*.py > /dev/null || echo $f; done
+for f in */*.patch; do grep $f ../*.py > /dev/null || echo $f; done
diff --git a/packaging/MacSDK/patches/mcs-pkgconfig.patch b/packaging/MacSDK/patches/mcs-pkgconfig.patch
new file mode 100644 (file)
index 0000000..eeefebc
--- /dev/null
@@ -0,0 +1,23 @@
+diff --git a/scripts/Makefile.am b/scripts/Makefile.am
+index 73b9cea..98b8cfb 100644
+--- a/scripts/Makefile.am
++++ b/scripts/Makefile.am
+@@ -179,7 +179,8 @@ REWRITE_COMMON = sed \
+       -e 's,@''bindir@,$(bindir),g'                           \
+       -e 's,@''plat_bindir@,$(plat_bindir),g'                 \
+       -e 's,@''mono_instdir@,$(mono_instdir),g'               \
+-      -e 's,@''gtkdir@,$(gtkdir),g'
++      -e 's,@''gtkdir@,$(gtkdir),g'                           \
++      -e 's,@''mono_version@,$(VERSION),g'
+
+ REWRITE = $(REWRITE_COMMON) -e 's,@''mono_interp@,$(mono_interp),g'
+ REWRITE_DEBUG = $(REWRITE_COMMON) -e 's,@''mono_interp@,$(mono_interp) --debug,g'
+diff --git a/scripts/mcs.in b/scripts/mcs.in
+index 32498fa..c15087e 100644
+--- a/scripts/mcs.in
++++ b/scripts/mcs.in
+@@ -1,2 +1,4 @@
+ #!/bin/sh
++export PATH=$PATH:/Library/Frameworks/Mono.framework/Versions/@mono_version@/bin
++export PKG_CONFIG_PATH=/Library/Frameworks/Mono.framework/External/pkgconfig:/Library/Frameworks/Mono.framework/Versions/@mono_version@/lib/pkgconfig:/Library/Frameworks/Mono.framework/Versions/@mono_version@/share/pkgconfig:$PKG_CONFIG_PATH
+ exec @bindir@/mono $MONO_OPTIONS @mono_instdir@/2.0/mcs.exe -lib:@mono_instdir@/2.0 -lib:@mono_instdir@/3.5 "$@"
diff --git a/packaging/MacSDK/pcl-reference-assemblies.py b/packaging/MacSDK/pcl-reference-assemblies.py
new file mode 100644 (file)
index 0000000..216e9f7
--- /dev/null
@@ -0,0 +1,57 @@
+import glob
+import os
+import shutil
+
+
+class PCLReferenceAssembliesPackage(Package):
+
+    def __init__(self):
+        Package.__init__(self,
+                         name='PortableReferenceAssemblies',
+                         version='2014-04-14',
+                         sources=['http://xamarin-storage/bot-provisioning/PortableReferenceAssemblies-2014-04-14.zip'])
+
+    def build(self):
+        pass
+
+    # A bunch of shell script written inside python literals ;(
+    def install(self):
+        dest = os.path.join(
+            self.staged_prefix,
+            "lib",
+            "mono",
+            "xbuild-frameworks",
+            ".NETPortable")
+        if not os.path.exists(dest):
+            os.makedirs(dest)
+
+        shutil.rmtree(dest, ignore_errors=True)
+
+        self.sh("rsync -abv -q %s/* %s" % (self.workspace, dest))
+
+        for f in glob.glob("%s/*/Profile/*/SupportedFrameworks" % dest):
+            self.write_xml(f)
+
+    def write_xml(self, directory):
+        # print "Writing iOS/Android/Mac listings for " + directory
+        data = {
+            os.path.join(directory, "MonoTouch.xml"):
+            """<Framework Identifier="MonoTouch" MinimumVersion="1.0" Profile="*" DisplayName="Xamarin.iOS Classic"/>""",
+            os.path.join(directory, "Xamarin.iOS.xml"):
+            """<Framework Identifier="Xamarin.iOS" MinimumVersion="1.0" Profile="*" DisplayName="Xamarin.iOS Unified"/>""",
+            os.path.join(directory, "Xamarin.Android.xml"):
+            """<Framework Identifier="MonoAndroid" MinimumVersion="1.0" Profile="*" DisplayName="Xamarin.Android"/>""",
+            os.path.join(directory, "Xamarin.Mac.xml"):
+            """<Framework Identifier="Xamarin.Mac" MinimumVersion="2.0" Profile="*" DisplayName="Xamarin.Mac Unified"/>""",
+            os.path.join(directory, "Xamarin.TVOS.xml"):
+            """<Framework Identifier="Xamarin.TVOS" MinimumVersion="1.0" Profile="*" DisplayName="Xamarin.TVOS"/>""",
+            os.path.join(directory, "Xamarin.WatchOS.xml"):
+            """<Framework Identifier="Xamarin.WatchOS" MinimumVersion="1.0" Profile="*" DisplayName="Xamarin.WatchOS"/>""",
+        }
+        for filename, content in data.iteritems():
+            f = open(filename, "w")
+            f.write(content + "\n")
+            f.close()
+
+
+PCLReferenceAssembliesPackage()
diff --git a/packaging/MacSDK/profile.py b/packaging/MacSDK/profile.py
new file mode 100755 (executable)
index 0000000..1a7827d
--- /dev/null
@@ -0,0 +1,394 @@
+import itertools
+import os
+import re
+import shutil
+import string
+import sys
+import tempfile
+import subprocess
+import stat
+
+from bockbuild.darwinprofile import DarwinProfile
+from bockbuild.util.util import *
+from glob import glob
+
+class MonoReleaseProfile(DarwinProfile):
+    description = 'The Mono Framework for MacOS'
+    packages = [
+        'gettext',
+        'pkg-config',
+
+        # Base Libraries
+        'libpng',
+        'libjpeg',
+        'libtiff',
+        'libgif',
+        'libxml2',
+        'freetype',
+        'fontconfig',
+        'pixman',
+        'cairo',
+        'libffi',
+        'glib',
+        'pango',
+        'atk',
+        'intltool',
+        'gdk-pixbuf',
+        'gtk+',
+        'libglade',
+        'sqlite',
+        'expat',
+        'ige-mac-integration',
+
+        # Theme
+        'libcroco',
+        'librsvg',
+        'hicolor-icon-theme',
+        'gtk-engines',
+        'murrine',
+        'xamarin-gtk-theme',
+        'gtk-quartz-engine',
+
+        # Mono
+        'mono-llvm',
+        'mono',
+        'msbuild',
+        'pcl-reference-assemblies',
+        'libgdiplus',
+        'xsp',
+        'gtk-sharp',
+        'ironlangs',
+        'fsharp',
+        'mono-basic',
+        'nuget'
+    ]
+
+    def attach (self, bockbuild):
+        self.min_version = 7
+        DarwinProfile.attach (self, bockbuild)
+
+        # quick disk space check (http://stackoverflow.com/questions/787776/)
+        s = os.statvfs(bockbuild.root)
+        free_space = (s.f_bavail * s.f_frsize) / (1024 * 1024 * 1024)  # in GB
+
+        if free_space < 10:
+            error('Low disk space (less than 10GB), aborting')
+
+        # check for XQuartz installation (needed for libgdiplus)
+        if not os.path.exists('/opt/X11/include/X11/Xlib.h'):
+            error(
+                'XQuartz is required to be installed (download from http://xquartz.macosforge.org/) ')
+
+        self.MONO_ROOT = "/Library/Frameworks/Mono.framework"
+        self.BUILD_NUMBER = "0"
+        self.MDK_GUID = "964ebddd-1ffe-47e7-8128-5ce17ffffb05"
+
+        system_mono_dir = '/Library/Frameworks/Mono.framework/Versions/Current'
+        self.env.set('system_mono', os.path.join(
+            system_mono_dir, 'bin', 'mono'))
+        self.env.set('system_mcs', os.path.join(system_mono_dir, 'bin', 'mcs'))
+
+        self.env.set('system_mono_version', backtick(
+            '%s --version' % self.env.system_mono)[0])
+
+        # config overrides for some programs to be functional while staged
+
+        self.env.set('GDK_PIXBUF_MODULE_FILE',
+                     '%{staged_prefix}/lib/gdk-pixbuf-2.0/2.10.0/loaders.cache')
+        self.env.set('GDK_PIXBUF_MODULEDIR',
+                     '%{staged_prefix}/lib/gdk-pixbuf-2.0/2.10.0/loaders')
+        self.env.set('PANGO_SYSCONFDIR', '%{staged_prefix}/etc')
+        self.env.set('PANGO_LIBDIR', '%{staged_prefix}/lib')
+        # self.env.set ('MONO_PATH', '%{staged_prefix}/lib/mono/4.0')
+        self.debug_info = ['gtk+', 'cairo',
+                           'pango', 'mono', 'llvm', 'libgdiplus']
+        self.cache_host = None
+
+    def setup_release(self):
+        self.mono_package = self.release_packages['mono']
+        self.mono_package.fetch()
+
+        verbose('Mono version: %s' % self.mono_package.version)
+        self.RELEASE_VERSION = self.mono_package.version
+        self.prefix = os.path.join(
+            self.MONO_ROOT, "Versions", self.RELEASE_VERSION)
+
+        if os.path.exists(self.prefix):
+            error('Prefix %s exists, and may interfere with the staged build. Please remove and try again.' % self.prefix)
+
+        self.calculate_updateid()
+        trace(self.package_info('MDK'))
+
+        self.dont_optimize = ['pixman']
+
+        for p in self.release_packages.values():
+            if p.name in self.dont_optimize:
+                continue
+            self.gcc_flags.extend(['-O2'])
+
+    # THIS IS THE MAIN METHOD FOR MAKING A PACKAGE
+    def package(self):
+        self.fix_gtksharp_configs()
+        self.verify_binaries()
+
+        working = self.setup_working_dir()
+        uninstall_script = os.path.join(working, "uninstallMono.sh")
+
+        # make the MDK
+        self.apply_blacklist(working, 'mdk_blacklist.sh')
+        self.make_updateinfo(working, self.MDK_GUID)
+        mdk_pkg = self.run_pkgbuild(working, "MDK")
+        title(mdk_pkg)
+        # self.make_dmg(mdk_dmg, title, mdk_pkg, uninstall_script)
+
+        shutil.rmtree(working)
+
+    def calculate_updateid(self):
+        # Create the updateid
+        pwd = os.getcwd()
+        git_bin = self.bockbuild.git_bin
+        trace("cur path is %s and git is %s" % (pwd, git_bin))
+        blame_rev_str = 'cd %s; %s blame configure.ac HEAD | grep AC_INIT | sed \'s/ .*//\' ' % (
+            self.mono_package.workspace, git_bin)
+        blame_rev = backtick(blame_rev_str)[0]
+        trace("Last commit to the version string %s" % (blame_rev))
+        version_number_str = 'cd %s; %s log %s..HEAD --oneline | wc -l | sed \'s/ //g\'' % (
+            self.mono_package.workspace, git_bin, blame_rev)
+        self.BUILD_NUMBER = backtick(version_number_str)[0]
+        trace("Calculating commit distance, %s" % (self.BUILD_NUMBER))
+        self.FULL_VERSION = self.RELEASE_VERSION + "." + self.BUILD_NUMBER
+        os.chdir(pwd)
+
+        parts = self.RELEASE_VERSION.split(".")
+        version_list = (parts + ["0"] * (3 - len(parts)))[:4]
+        for i in range(1, 3):
+            version_list[i] = version_list[i].zfill(2)
+            self.updateid = "".join(version_list)
+            self.updateid += self.BUILD_NUMBER.replace(
+                ".", "").zfill(9 - len(self.updateid))
+        trace(self.updateid)
+
+    # creates and returns the path to a working directory containing:
+    #   PKGROOT/ - this root will be bundled into the .pkg and extracted at /
+    #   uninstallMono.sh - copied onto the DMG
+    #   Info{_sdk}.plist - used by packagemaker to make the installer
+    #   resources/ - other resources used by packagemaker for the installer
+    def setup_working_dir(self):
+        def make_package_symlinks(root):
+            os.symlink(self.prefix, os.path.join(root, "Versions", "Current"))
+            currentlink = os.path.join(self.MONO_ROOT, "Versions", "Current")
+            links = [
+                ("bin", "Commands"),
+                ("include", "Headers"),
+                ("lib", "Libraries"),
+                ("", "Home"),
+                (os.path.join("lib", "libmono-2.0.dylib"), "Mono")
+            ]
+            for srcname, destname in links:
+                src = os.path.join(currentlink, srcname)
+                dest = os.path.join(root, destname)
+                # If the symlink exists, we remove it so we can create a fresh
+                # one
+                if os.path.exists(dest):
+                    os.unlink(dest)
+                os.symlink(src, dest)
+
+        tmpdir = tempfile.mkdtemp()
+        monoroot = os.path.join(tmpdir, "PKGROOT", self.MONO_ROOT[1:])
+        versions = os.path.join(monoroot, "Versions")
+        os.makedirs(versions)
+
+        print "Setting up temporary package directory:", tmpdir
+
+        # setup metadata
+        self.packaging_dir = os.path.join(self.resource_path, "packaging")
+        run_shell('rsync -aPq %s/* %s' % (self.packaging_dir, tmpdir), False)
+
+        packages_list = string.join(
+            [pkg.desc for pkg in self.release_packages.values()], "\\\n")
+        deps_list = 'bockbuild (rev. %s)\\\n' % bockbuild.bockbuild_rev + string.join(
+            [pkg.desc for pkg in self.toolchain_packages.values()], "\\\n")
+
+        parameter_map = {
+            '@@MONO_VERSION@@': self.RELEASE_VERSION,
+            '@@MONO_RELEASE@@': self.BUILD_NUMBER,
+            '@@MONO_VERSION_RELEASE@@': self.RELEASE_VERSION + '_' + self.BUILD_NUMBER,
+            '@@MONO_CSDK_GUID@@': self.MDK_GUID,
+            '@@MONO_VERSION_RELEASE_INT@@': self.updateid,
+            '@@PACKAGES@@': packages_list,
+            '@@DEP_PACKAGES@@': deps_list
+        }
+        for dirpath, d, files in os.walk(tmpdir):
+            for name in files:
+                if not name.startswith('.'):
+                    replace_in_file(os.path.join(dirpath, name), parameter_map)
+
+        make_package_symlinks(monoroot)
+
+        # copy to package root
+        run_shell('rsync -aPq "%s"/* "%s/%s"' %
+                  (bockbuild.package_root, versions, self.RELEASE_VERSION), False)
+
+        return tmpdir
+
+    def apply_blacklist(self, working_dir, blacklist_name):
+        print "Applying blacklist script:", blacklist_name
+        blacklist = os.path.join(self.packaging_dir, blacklist_name)
+        root = os.path.join(working_dir, "PKGROOT", self.prefix[1:])
+        run_shell('%s "%s" > /dev/null' % (blacklist, root), print_cmd=False)
+
+    def run_pkgbuild(self, working_dir, package_type):
+        print 'Running pkgbuild & productbuild...',
+        info = self.package_info(package_type)
+        output = os.path.join(self.resource_path, info["filename"])
+        identifier = "com.xamarin.mono-" + info["type"] + ".pkg"
+        resources_dir = os.path.join(working_dir, "resources")
+        distribution_xml = os.path.join(resources_dir, "distribution.xml")
+
+        old_cwd = os.getcwd()
+        os.chdir(working_dir)
+        pkgbuild = "/usr/bin/pkgbuild"
+        pkgbuild_cmd = ' '.join([pkgbuild,
+                                 "--identifier " + identifier,
+                                 "--root '%s/PKGROOT'" % working_dir,
+                                 "--version '%s'" % self.RELEASE_VERSION,
+                                 "--install-location '/'",
+                                 "--scripts '%s'" % resources_dir,
+                                 "--quiet",
+                                 os.path.join(working_dir, "mono.pkg")])
+
+        run_shell(pkgbuild_cmd)
+
+        productbuild = "/usr/bin/productbuild"
+        productbuild_cmd = ' '.join([productbuild,
+                                     "--resources %s" % resources_dir,
+                                     "--distribution %s" % distribution_xml,
+                                     "--package-path %s" % working_dir,
+                                     "--quiet",
+                                     output])
+
+        run_shell(productbuild_cmd)
+
+        assert_exists(output)
+        os.chdir(old_cwd)
+        print output
+        return output
+
+    def make_updateinfo(self, working_dir, guid):
+        updateinfo = os.path.join(
+            working_dir, "PKGROOT", self.prefix[1:], "updateinfo")
+        with open(updateinfo, "w") as updateinfo:
+            updateinfo.write(guid + ' ' + self.updateid + "\n")
+
+    def package_info(self, pkg_type):
+        arch = self.bockbuild.cmd_options.arch
+        arch_str = None
+        if  arch == "darwin-32":
+            arch_str = "x86"
+        elif arch == "darwin-64":
+            arch_str = "x64"
+        elif arch == "darwin-universal":
+            arch_str = "universal"
+        else:
+            error ("Unknown architecture")
+
+        if self.bockbuild.cmd_options.release_build:
+            info = (pkg_type, self.FULL_VERSION, arch_str)
+        else:
+            info = (pkg_type, '%s-%s' % (git_shortid(self.bockbuild,
+                                                     self.mono_package.workspace), self.FULL_VERSION), arch_str)
+
+        filename = "MonoFramework-%s-%s.macos10.xamarin.%s.pkg" % info
+        return {
+            "type": pkg_type,
+            "filename": filename
+        }
+
+    def fix_line(self, line, matcher):
+        def insert_install_root(matches):
+            root = self.prefix
+            captures = matches.groupdict()
+            return 'target="%s"' % os.path.join(root, "lib", captures["lib"])
+
+        if matcher(line):
+            pattern = r'target="(?P<lib>.+\.dylib)"'
+            result = re.sub(pattern, insert_install_root, line)
+            return result
+        else:
+            return line
+
+    def fix_dllmap(self, config, matcher):
+        handle, temp = tempfile.mkstemp()
+        with open(config) as c:
+            with open(temp, "w") as output:
+                for line in c:
+                    output.write(self.fix_line(line, matcher))
+        os.rename(temp, config)
+        os.system('chmod a+r %s' % config)
+
+    def fix_gtksharp_configs(self):
+        print 'Fixing GTK# configuration files...',
+        count = 0
+        libs = [
+            'atk-sharp',
+            'gdk-sharp',
+            'glade-sharp',
+            'glib-sharp',
+            'gtk-dotnet',
+            'gtk-sharp',
+            'pango-sharp'
+        ]
+        gac = os.path.join(bockbuild.package_root, "lib", "mono", "gac")
+        confs = [glob.glob(os.path.join(gac, x, "*", "*.dll.config")) for x in libs]
+        for c in itertools.chain(*confs):
+            count = count + 1
+            self.fix_dllmap(c, lambda line: "dllmap" in line)
+        print count
+
+    def verify(self, f):
+        result = " ".join(backtick("otool -L " + f))
+        regex = os.path.join(self.MONO_ROOT, "Versions", r"(\d+\.\d+\.\d+)")
+
+        match = re.search(regex, result)
+        if match is None:
+            return
+        token = match.group(1)
+        trace(token)
+        if self.RELEASE_VERSION not in token:
+            raise Exception("%s references Mono %s\n%s" % (f, token, text))
+
+    def verify_binaries(self):
+        bindir = os.path.join(bockbuild.package_root, "bin")
+        for path, dirs, files in os.walk(bindir):
+            for name in files:
+                f = os.path.join(path, name)
+                file_type = backtick('file "%s"' % f)
+                if "Mach-O executable" in "".join(file_type):
+                    self.verify(f)
+
+    def shell(self):
+        envscript = '''#!/bin/sh
+        PROFNAME="%s"
+        INSTALLDIR="%s"
+        ROOT="%s"
+        export DYLD_FALLBACK_LIBRARY_PATH="$INSTALLDIR/lib:/lib:/usr/lib"
+        export ACLOCAL_PATH="$INSTALLDIR/share/aclocal"
+        export CONFIG_SITE="$INSTALLDIR/$PROFNAME-config.site"
+        export MONO_GAC_PREFIX="$INSTALLDIR"
+        export MONO_ADDINS_REGISTRY="$ROOT/addinreg"
+        export MONO_INSTALL_PREFIX="$INSTALLDIR"
+
+        export PS1="\[\e[1;3m\][$PROFNAME] \w @ "
+        bash -i
+        ''' % (self.profile_name, self.staged_prefix, self.root)
+
+        path = os.path.join(self.root, self.profile_name + '.sh')
+
+        with open(path, 'w') as f:
+            f.write(envscript)
+
+        os.chmod(path, os.stat(path).st_mode | stat.S_IEXEC)
+
+        subprocess.call(['bash', '-c', path])
+
+MonoReleaseProfile()
\ No newline at end of file
diff --git a/packaging/MacSDK/sqlite.py b/packaging/MacSDK/sqlite.py
new file mode 100644 (file)
index 0000000..f0f5082
--- /dev/null
@@ -0,0 +1,3 @@
+Package('sqlite-autoconf', '3090200', sources=[
+    'http://www.sqlite.org/2015/%{name}-%{version}.tar.gz'
+])
diff --git a/packaging/MacSDK/xamarin-gtk-theme.py b/packaging/MacSDK/xamarin-gtk-theme.py
new file mode 100644 (file)
index 0000000..34d3ae0
--- /dev/null
@@ -0,0 +1,20 @@
+class XamarinGtkThemePackage (Package):
+
+    def __init__(self):
+        Package.__init__(self, 'xamarin-gtk-theme',
+                         sources=[
+                             'git://github.com/mono/xamarin-gtk-theme.git'],
+                         revision='cc3fb66e56d494e968be3a529a0737a60e31c1f3')
+
+    def build(self):
+        try:
+            self.sh('./autogen.sh --prefix=%{staged_prefix}')
+        except:
+            pass
+        finally:
+            #self.sh ('intltoolize --force --copy --debug')
+            #self.sh ('./configure --prefix="%{package_prefix}"')
+            Package.build(self)
+
+
+XamarinGtkThemePackage()
diff --git a/packaging/MacSDK/xsp.py b/packaging/MacSDK/xsp.py
new file mode 100644 (file)
index 0000000..8180001
--- /dev/null
@@ -0,0 +1,23 @@
+class XspPackage (GitHubTarballPackage):
+
+    def __init__(self):
+        GitHubTarballPackage.__init__(self, 'mono', 'xsp', '4.4',
+                                      'c98e068f5647fb06ff2fbef7cd5f1b35417362b1',
+                                      configure='./autogen.sh --prefix="%{package_prefix}"')
+
+    def install(self):
+        # scoop up some mislocated files
+        misdir = '%s%s' % (self.stage_root, self.staged_profile)
+        unprotect_dir(self.stage_root)
+        Package.install(self)
+        if not os.path.exists(misdir):
+            for path in iterate_dir(self.stage_root):
+                print path
+            error('Could not find mislocated files')
+
+        self.sh('rsync -a --ignore-existing %s/* %s' %
+                (misdir, self.profile.staged_prefix))
+        self.sh('rm -rf %s/*' % misdir)
+
+
+XspPackage()
diff --git a/packaging/MacSDKRelease/mono-extensions.py b/packaging/MacSDKRelease/mono-extensions.py
new file mode 100644 (file)
index 0000000..2d52fda
--- /dev/null
@@ -0,0 +1,25 @@
+from bockbuild.package import Package
+
+
+class MonoExtensionsPackage(Package):
+
+    def __init__(self):
+        Package.__init__(self, 'mono-extensions', None,
+                         sources=['git@github.com:xamarin/mono-extensions.git'],
+                         git_branch=self.profile.release_packages[
+                             'mono'].git_branch
+                         )
+        self.source_dir_name = 'mono-extensions'
+
+        # Mono pull requests won't have mono-extensions branches
+        if not self.git_branch or 'pull/' in self.git_branch:
+            warn('Using master branch for mono_extensions')
+            self.git_branch = 'master'
+
+    def build(self):
+        pass
+
+    def install(self):
+        pass
+
+MonoExtensionsPackage()
diff --git a/packaging/MacSDKRelease/packaging b/packaging/MacSDKRelease/packaging
new file mode 120000 (symlink)
index 0000000..714bc29
--- /dev/null
@@ -0,0 +1 @@
+../MacSDK/packaging
\ No newline at end of file
diff --git a/packaging/MacSDKRelease/profile.py b/packaging/MacSDKRelease/profile.py
new file mode 100755 (executable)
index 0000000..2b0d99a
--- /dev/null
@@ -0,0 +1,89 @@
+import itertools
+import os
+import re
+import shutil
+import string
+import sys
+import tempfile
+import traceback
+
+from glob import glob
+
+from MacSDK import profile
+from bockbuild.util.util import *
+
+
+class MonoXamarinPackageProfile(MonoReleaseProfile):
+    description = 'The Mono Framework for MacOS (official release)'
+
+    def setup (self):
+        MonoReleaseProfile.setup (self)
+        bockbuild.packages_to_build.extend(['mono-extensions'])
+        if bockbuild.cmd_options.release_build:
+            self.setup_codesign()
+        else:
+            info("'--release' option not set, will not attempt to sign package!")
+
+        self.cache_host = 'http://xamarin-storage/bockbuild_cache/'
+
+    def setup_codesign(self):
+        self.identity = "Developer ID Installer: Xamarin Inc"
+
+        output = backtick("security -v find-identity")
+        if self.identity not in " ".join(output):
+            error("Identity '%s' was not found. You can create an unsigned package by removing '--release' to your command line." % self.identity)
+
+        password = os.getenv("CODESIGN_KEYCHAIN_PASSWORD")
+        if password:
+            print "Unlocking the keychain"
+            run_shell("security unlock-keychain -p %s" % password)
+        else:
+            error("CODESIGN_KEYCHAIN_PASSWORD needs to be defined.")
+
+    def setup_release(self):
+        MonoReleaseProfile.setup_release(self)
+        self.release_packages['mono'].configure_flags.extend(
+            ['--enable-extension-module=xamarin --enable-native-types --enable-pecrypt'])
+        info('Xamarin extensions enabled')
+
+    def run_pkgbuild(self, working_dir, package_type):
+        output = MonoReleaseProfile.run_pkgbuild(
+            self, working_dir, package_type)
+
+        output_unsigned = os.path.join(os.path.dirname(
+            output), os.path.basename(output).replace('.pkg', '.UNSIGNED.pkg'))
+        shutil.move(output, output_unsigned)
+
+        if not bockbuild.cmd_options.release_build:
+            return output_unsigned
+
+        productsign = "/usr/bin/productsign"
+        productsign_cmd = ' '.join([productsign,
+                                    "-s '%s'" % self.identity,
+                                    "'%s'" % output_unsigned,
+                                    "'%s'" % output])
+        run_shell(productsign_cmd)
+        os.remove(output_unsigned)
+        self.verify_codesign(output)
+
+        return output
+
+    def verify_codesign(self, pkg):
+        oldcwd = os.getcwd()
+        try:
+            name = os.path.basename(pkg)
+            pkgdir = os.path.dirname(pkg)
+            os.chdir(pkgdir)
+            spctl = "/usr/sbin/spctl"
+            spctl_cmd = ' '.join(
+                [spctl, "-vvv", "--assess", "--type install", name, "2>&1"])
+            output = backtick(spctl_cmd)
+
+            if "accepted" in " ".join(output):
+                warn("%s IS SIGNED" % pkg)
+            else:
+                error("%s IS NOT SIGNED:" % pkg)
+        finally:
+            os.chdir(oldcwd)
+
+MonoXamarinPackageProfile()
\ No newline at end of file