Re-renamed profile (now 'MacSDK') to remove hyphen which was prohibiting Python module importing
--- /dev/null
+GnomeXzPackage('atk', version_major='2.8', version_minor='0')
--- /dev/null
+class CairoPackage (CairoGraphicsXzPackage):
+
+ def __init__(self):
+ CairoGraphicsXzPackage.__init__(self, 'cairo', '1.12.14')
+ self.sources.extend([
+ 'patches/cairo-quartz-crash.patch',
+ 'patches/cairo-fix-color-bitmap-fonts.patch',
+ 'patches/cairo-fix-CGFontGetGlyphPath-deprecation.patch',
+ # 'patches/cairo-cglayer.patch',
+ ])
+
+ def prep(self):
+ Package.prep(self)
+
+ if Package.profile.name == 'darwin':
+ for p in range(1, len(self.local_sources)):
+ self.sh('patch -p1 < "%{local_sources[' + str(p) + ']}"')
+
+ def build(self):
+ self.configure_flags = [
+ '--enable-pdf',
+ ]
+
+ if Package.profile.name == 'darwin':
+ self.configure_flags.extend([
+ '--enable-quartz',
+ '--enable-quartz-font',
+ '--enable-quartz-image',
+ '--disable-xlib',
+ '--without-x'
+ ])
+ elif Package.profile.name == 'linux':
+ self.configure_flags.extend([
+ '--disable-quartz',
+ '--with-x'
+ ])
+
+ Package.build(self)
+
+CairoPackage()
--- /dev/null
+SourceForgePackage('expat', 'expat', '2.0.1')
--- /dev/null
+class FontConfigPackage (Package):
+
+ def __init__(self):
+ Package.__init__(self, 'fontconfig', '2.10.2',
+ configure_flags=['--disable-docs'],
+ sources=[
+ 'http://www.fontconfig.org/release/%{name}-%{version}.tar.gz'
+ ],
+ # note: a non-empty DESTDIR keeps fc-cache from running at
+ # install-time
+ )
+
+ def build(self):
+ if Package.profile.name == 'darwin':
+ self.configure_flags.extend([
+ '--with-cache-dir="~/Library/Caches/com.xamarin.fontconfig"',
+ '--with-default-fonts=/System/Library/Fonts',
+ '--with-add-fonts=/Library/Fonts,/Network/Library/Fonts,/System/Library/Fonts'
+ ])
+ Package.build(self)
+
+FontConfigPackage()
--- /dev/null
+SourceForgePackage('%{name}', 'freetype', '2.5.0.1')
--- /dev/null
+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()
--- /dev/null
+class GdkPixbufPackage (GnomeXzPackage):
+
+ def __init__(self):
+ GnomeXzPackage.__init__(
+ self,
+ 'gdk-pixbuf',
+ version_major='2.28',
+ version_minor='2')
+
+ if Package.profile.name == 'darwin':
+ self.sources.extend([
+ 'patches/gdk-pixbuf/0001-pixbuf-load-2x-variants-as-pixbuf-gobject-data.patch',
+ 'patches/gdk-pixbuf/0001-pixbuf-Add-getter-setter-for-the-2x-variants.patch',
+ ])
+
+ self.configure_flags.extend(['--enable-gtk-doc-html=no'])
+
+ def prep(self):
+ Package.prep(self)
+ if Package.profile.name == 'darwin':
+ for p in range(1, len(self.local_sources)):
+ self.sh(
+ 'patch -p1 --ignore-whitespace < "%{local_sources[' + str(p) + ']}"')
+
+ def deploy(self):
+ self.loaders_cache = 'lib/gdk-pixbuf-2.0/2.10.0/loaders.cache'
+ self.sh('gdk-pixbuf-query-loaders --update-cache ')
+
+ # mark the file for destaging
+ self.sh(
+ 'cp %{staged_profile}/%{loaders_cache} %{staged_profile}/%{loaders_cache}.release')
+ self.extra_stage_files = [self.loaders_cache]
+
+GdkPixbufPackage()
--- /dev/null
+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
--- /dev/null
+>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
--- /dev/null
+class GettextPackage (GnuPackage):
+
+ def __init__(self):
+ GnuPackage.__init__(self, 'gettext', '0.18.2',
+ configure_flags=[
+ '--disable-java',
+ '--disable-libasprintf',
+ '--disable-openmp',
+ '--with-included-glib'
+ ]
+ )
+
+ if Package.profile.name == 'darwin':
+ self.configure_flags.extend([
+ # only build the tools, osx has the lib
+ # https://github.com/mxcl/homebrew/blob/master/Library/Formula/gettext.rb
+ #'--without-included-gettext',
+ ])
+ self.sources.extend([
+ # Don't build samples
+ # https://trac.macports.org/export/79183/trunk/dports/devel/gettext/files/patch-gettext-tools-Makefile.in
+ 'patches/gettext-no-samples.patch',
+ ])
+
+ def prep(self):
+ Package.prep(self)
+ if Package.profile.name == 'darwin':
+ for p in range(1, len(self.local_sources)):
+ self.sh('patch -p1 < "%{local_sources[' + str(p) + ']}"')
+
+GettextPackage()
--- /dev/null
+class GlibPackage (GnomeXzPackage):
+
+ def __init__(self):
+ GnomeXzPackage.__init__(self,
+ 'glib',
+ version_major='2.36',
+ version_minor='4')
+
+ self.darwin = Package.profile.name == 'darwin'
+
+ if self.darwin:
+ # link to specific revisions for glib 2.30.x
+ self.sources.extend([
+ # https://trac.macports.org/export/91680/trunk/dports/devel/glib2/files/config.h.ed
+ 'patches/glib/config.h.ed',
+ # https://trac.macports.org/export/98985/trunk/dports/devel/glib2/files/patch-configure.diff
+ 'patches/glib/patch-configure.diff',
+ # https://trac.macports.org/export/42728/trunk/dports/devel/glib2/files/patch-gi18n.h.diff
+ 'patches/glib/patch-gi18n.h.diff',
+ # https://trac.macports.org/export/92608/trunk/dports/devel/glib2/files/patch-gio_gdbusprivate.c.diff
+ 'patches/glib/patch-gio_gdbusprivate.c.diff',
+ # https://trac.macports.org/export/49466/trunk/dports/devel/glib2/files/patch-gio_xdgmime_xdgmime.c.diff
+ 'patches/glib/patch-gio_xdgmime_xdgmime.c.diff',
+ # https://trac.macports.org/export/91680/trunk/dports/devel/glib2/files/patch-glib-2.0.pc.in.diff
+ 'patches/glib/patch-glib-2.0.pc.in.diff',
+ # https://trac.macports.org/export/64476/trunk/dports/devel/glib2/files/patch-glib_gunicollate.c.diff
+ 'patches/glib/patch-glib_gunicollate.c.diff',
+
+ # Bug 6156 - [gtk] Quitting the application with unsaved file and answering Cancel results in crash
+ # https://bugzilla.xamarin.com/attachment.cgi?id=2214
+ 'patches/glib-recursive-poll.patch',
+ ])
+
+ def prep(self):
+ Package.prep(self)
+ if self.darwin:
+ for p in range(2, 8):
+ self.sh('patch -p0 < %{local_sources[' + str(p) + ']}')
+ for p in range(8, len(self.local_sources)):
+ self.sh(
+ 'patch --ignore-whitespace -p1 < %{local_sources[' + str(p) + ']}')
+
+ def arch_build(self, arch):
+ if arch == 'darwin-universal': # multi-arch build pass
+ self.local_ld_flags = ['-arch i386', '-arch x86_64']
+ self.local_gcc_flags = ['-arch i386', '-arch x86_64', '-Os']
+ self.local_configure_flags = ['--disable-dependency-tracking']
+ else:
+ Package.arch_build(self, arch)
+
+ if self.darwin:
+ self.local_configure_flags.extend(['--disable-compile-warnings'])
+
+ def build(self):
+ # modified build for darwin
+ if self.darwin:
+ self.local_configure_flags.extend(['--disable-compile-warnings'])
+ Package.configure(self)
+ self.sh([
+ # 'autoconf',
+ #'%{configure} --disable-compile-warnings',
+ 'ed - config.h < %{local_sources[1]}',
+ # work around
+ # https://bugzilla.gnome.org/show_bug.cgi?id=700350
+ 'touch docs/reference/*/Makefile.in',
+ 'touch docs/reference/*/*/Makefile.in',
+ #'%{make}'
+ ])
+ Package.make(self)
+ else:
+ Package.build(self)
+
+ def install(self):
+ Package.install(self)
+ if self.darwin:
+ # FIXME: necessary?
+ self.sh('rm -f %{staged_prefix}/lib/charset.alias')
+
+GlibPackage()
--- /dev/null
+GnomePackage('gtk-engines', version_major='2.20', version_minor='2',
+ configure_flags=[''])
--- /dev/null
+class GtkQuartzEnginePackage (Package):
+
+ def __init__(self):
+ Package.__init__(self, 'gtk-quartz-engine',
+ sources=[
+ 'git://github.com/mono/gtk-quartz-engine.git'],
+ override_properties={
+ 'configure': './autogen.sh --prefix=%{package_prefix}',
+ 'needs_lipo': True
+ },
+ revision='9555a08f0c9c98d02153c9d77b54a2dd83ce5d6f')
+
+GtkQuartzEnginePackage()
--- /dev/null
+class GtkSharp212ReleasePackage (Package):
+
+ def __init__(self):
+ Package.__init__(self, 'gtk-sharp',
+ sources=['git://github.com/mono/gtk-sharp.git'],
+ git_branch='gtk-sharp-2-12-branch',
+ revision='f092864bce996c4ac51a13281069067d1e7e6d4b',
+ override_properties={
+ 'configure': './bootstrap-2.12 --prefix=%{package_prefix}',
+ }
+ )
+ self.make = 'make CSC=mcs'
+
+GtkSharp212ReleasePackage()
--- /dev/null
+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"
--- /dev/null
+FreeDesktopPackage('icon-theme', 'hicolor-icon-theme', '0.12')
--- /dev/null
+SourceForgePackage('gtk-osx', 'ige-mac-integration', '0.9.4', ['--without-compile-warnings'],
+ override_properties={'configure': './configure --prefix="%{staged_prefix}"',
+ 'makeinstall': 'make install'})
--- /dev/null
+class IntltoolPackage (Package):
+
+ def __init__(self):
+ Package.__init__(self, 'intltool', '0.50.2',
+ sources=[
+ 'https://launchpad.net/%{name}/trunk/%{version}/+download/%{name}-%{version}.tar.gz'
+ ]
+ )
+
+IntltoolPackage()
--- /dev/null
+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()
--- /dev/null
+GnomeXzPackage('libcroco', version_major='0.6', version_minor='8',
+ configure_flags=[
+ '--host=i386-apple-darwin',
+ '--disable-Bsymbolic',
+ '--enable-gtk-doc-html=no'
+ ])
--- /dev/null
+class LibFfiPackage (Package):
+
+ def __init__(self):
+ Package.__init__(self, 'libffi', '3.0.13', sources=[
+ 'ftp://sourceware.org/pub/%{name}/%{name}-%{version}.tar.gz'])
+
+LibFfiPackage()
--- /dev/null
+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'})
--- /dev/null
+SourceForgePackage('giflib', 'giflib', '4.1.6')
--- /dev/null
+GnomePackage('libglade', '2.6', '4')
--- /dev/null
+class LibJpegPackage (Package):
+
+ def __init__(self):
+ Package.__init__(self, 'libjpeg', '8', sources=[
+ 'http://www.ijg.org/files/jpegsrc.v8.tar.gz'])
+ self.source_dir_name = 'jpeg-8'
+
+LibJpegPackage()
--- /dev/null
+class LibPngPackage (Package):
+
+ def __init__(self):
+ Package.__init__(self, 'libpng', '1.4.12',
+ sources=[
+ 'http://downloads.sourceforge.net/project/libpng/libpng14/older-releases/1.4.12/libpng-1.4.12.tar.xz'],
+ configure_flags=['--enable-shared'])
+
+LibPngPackage()
--- /dev/null
+class LibrsvgPackage(GnomeXzPackage):
+
+ def __init__(self):
+ GnomeXzPackage.__init__(self, 'librsvg', version_major='2.37', version_minor='0',
+ configure_flags=['--disable-Bsymbolic', '--disable-introspection'])
+
+ make = 'make DESTDIR=%{stage_root}'
+
+ def install(self):
+ # handle some mislocation
+ misdir = '%s%s' % (self.stage_root, self.staged_profile)
+ unprotect_dir(self.stage_root)
+
+ Package.install(self)
+ # scoop up
+ if not os.path.exists(misdir):
+ error('Could not find mislocated libsrvg files')
+
+ self.sh(
+ 'rsync -a --ignore-existing %s/* %s' %
+ (misdir, self.staged_prefix))
+ self.sh('rm -rf %s/*' % misdir)
+
+ def deploy(self):
+ self.sh('gdk-pixbuf-query-loaders --update-cache')
+
+LibrsvgPackage()
--- /dev/null
+class LibTiffPackage (Package):
+
+ def __init__(self):
+ Package.__init__(self, 'tiff', '4.0.3',
+ configure_flags=[
+ ],
+ sources=[
+ 'http://download.osgeo.org/libtiff/tiff-%{version}.tar.gz',
+ ])
+
+ self.needs_lipo = True
+
+ if Package.profile.name == 'darwin':
+ self.sources.extend([
+ # Fix Snow Leopard build
+ # http://jira.freeswitch.org/secure/attachment/17487/tiff-4.0.2-macosx-2.patch
+ 'patches/tiff-4.0.2-macosx-2.patch'
+ ])
+
+ def prep(self):
+ Package.prep(self)
+ if Package.profile.name == 'darwin':
+ for p in range(1, len(self.local_sources)):
+ self.sh('patch -p1 < "%{local_sources[' + str(p) + ']}"')
+
+LibTiffPackage()
--- /dev/null
+class LibXmlPackage (Package):
+
+ def __init__(self):
+ Package.__init__(self,
+ 'libxml2',
+ '2.9.1',
+ configure_flags=['--with-python=no'],
+ sources=[
+ 'ftp://xmlsoft.org/%{name}/%{name}-%{version}.tar.gz',
+ ]
+ )
+
+ def prep(self):
+ Package.prep(self)
+ if Package.profile.name == 'darwin':
+ for p in range(1, len(self.local_sources)):
+ self.sh('patch -p1 < "%{local_sources[' + str(p) + ']}"')
+
+LibXmlPackage()
--- /dev/null
+
+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()
--- /dev/null
+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()
--- /dev/null
+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 self.profile.arch == 'darwin-universal':
+ os.symlink('mono-sgen64', '%s/bin/mono64' % self.staged_profile)
+ os.symlink('mono-sgen32', '%s/bin/mono32' % self.staged_profile)
+
+ text = " ".join(open('%s/bin/mcs' % self.staged_profile).readlines())
+ regex = os.path.join(
+ self.profile.MONO_ROOT,
+ "Versions",
+ r"(\d+\.\d+\.\d+)")
+ match = re.search(regex, text)
+ if match is None:
+ return
+ token = match.group(1)
+
+ trace(token)
+ trace(self.package_prefix)
+ if self.package_prefix not in match:
+ error("%s references Mono %s\n%s" % ('mcs', match, text))
+
+MonoMasterPackage()
--- /dev/null
+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()
--- /dev/null
+class MurrinePackage (GnomeXzPackage):
+
+ def __init__(self):
+ GnomePackage.__init__(self,
+ 'murrine',
+ version_major='0.98',
+ version_minor='2')
+
+ # FIXME: this may need porting
+ # self.sources.append ('patches/murrine-osx.patch')
+
+ def prep(self):
+ Package.prep(self)
+
+MurrinePackage()
--- /dev/null
+
+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()
--- /dev/null
+<?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>
--- /dev/null
+<?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>
--- /dev/null
+#!/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
--- /dev/null
+{\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.
+}
--- /dev/null
+{\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
--- /dev/null
+{\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
--- /dev/null
+<?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>
--- /dev/null
+#!/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}
+
+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}
--- /dev/null
+<?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>
--- /dev/null
+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
--- /dev/null
+#!/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
--- /dev/null
+class PangoPackage (GnomeXzPackage):
+
+ def __init__(self):
+ GnomePackage.__init__(self,
+ 'pango',
+ version_major='1.35',
+ version_minor='0',
+ configure_flags=[
+ '--without-x',
+ '--enable-gtk-doc-html=no'
+ ]
+ )
+
+ self.sources.extend([
+ # 1
+ # Bug 321419 - Allow environment var substitution in Pango config
+ # https://bugzilla.gnome.org/show_bug.cgi?id=321419
+ 'patches/pango-relative-config-file.patch',
+
+ # BXC 10257 - Characters outside the Basic Multilingual Plane don't render correctly
+ # https://bugzilla.xamarin.com/show_bug.cgi?id=10257
+ 'patches/pango-coretext-astral-plane-1.patch',
+ 'patches/pango-coretext-astral-plane-2.patch',
+
+ # Bug 15787 - Caret position is wrong when there are ligatures
+ # https://bugzilla.xamarin.com/show_bug.cgi?id=15787
+ 'patches/pango-disable-ligatures.patch',
+
+ # https://bugzilla.xamarin.com/show_bug.cgi?id=22199
+ 'patches/pango-fix-ct_font_descriptor_get_weight-crasher.patch',
+
+ # https://bugzilla.gnome.org/show_bug.cgi?id=734372
+ 'patches/pango-coretext-condensed-trait.patch',
+
+ # https://bugzilla.xamarin.com/show_bug.cgi?id=32938
+ 'patches/pango-coretext-fix-yosemite-crasher.patch',
+
+ 'patches/pango-system-font-single.patch',
+ 'patches/pango-system-font-check-version.patch'
+ ])
+
+ def prep(self):
+ GnomePackage.prep(self)
+ if Package.profile.name == 'darwin':
+ for p in range(1, len(self.local_sources)):
+ self.sh('patch -p1 < "%{local_sources[' + str(p) + ']}"')
+
+ def deploy(self):
+ self.sh('pango-querymodules --update-cache')
+
+PangoPackage()
--- /dev/null
+--- a/src/cairo-quartz-font.c 2012-11-13 18:20:00.000000000 -0800
++++ b/src/cairo-quartz-font.c 2012-11-13 18:06:56.000000000 -0800
+@@ -90,8 +90,9 @@ static int (*CGFontGetAscentPtr) (CGFont
+ static int (*CGFontGetDescentPtr) (CGFontRef fontRef) = NULL;
+ static int (*CGFontGetLeadingPtr) (CGFontRef fontRef) = NULL;
+
+-/* Not public anymore in 64-bits nor in 10.7 */
+-static ATSFontRef (*FMGetATSFontRefFromFontPtr) (FMFont iFont) = NULL;
++/* CTFontCreateWithGraphicsFont is not public until 10.5. */
++typedef const struct __CTFontDescriptor *CTFontDescriptorRef;
++static CTFontRef (*CTFontCreateWithGraphicsFontPtr) (CGFontRef, CGFloat, const CGAffineTransform *, CTFontDescriptorRef) = NULL;
+
+ static cairo_bool_t _cairo_quartz_font_symbol_lookup_done = FALSE;
+ static cairo_bool_t _cairo_quartz_font_symbols_present = FALSE;
+@@ -130,7 +131,7 @@ quartz_font_ensure_symbols(void)
+ CGContextGetAllowsFontSmoothingPtr = dlsym(RTLD_DEFAULT, "CGContextGetAllowsFontSmoothing");
+ CGContextSetAllowsFontSmoothingPtr = dlsym(RTLD_DEFAULT, "CGContextSetAllowsFontSmoothing");
+
+- FMGetATSFontRefFromFontPtr = dlsym(RTLD_DEFAULT, "FMGetATSFontRefFromFont");
++ CTFontCreateWithGraphicsFontPtr = dlsym(RTLD_DEFAULT, "CTFontCreateWithGraphicsFont");
+
+ if ((CGFontCreateWithFontNamePtr || CGFontCreateWithNamePtr) &&
+ CGFontGetGlyphBBoxesPtr &&
+@@ -155,6 +156,7 @@ struct _cairo_quartz_font_face {
+ cairo_font_face_t base;
+
+ CGFontRef cgFont;
++ CTFontRef ctFont;
+ };
+
+ /*
+@@ -239,6 +241,10 @@ _cairo_quartz_font_face_destroy (void *a
+ {
+ cairo_quartz_font_face_t *font_face = (cairo_quartz_font_face_t*) abstract_face;
+
++ if (font_face->ctFont) {
++ CFRelease (font_face->ctFont);
++ }
++
+ CGFontRelease (font_face->cgFont);
+ }
+
+@@ -363,6 +369,12 @@ cairo_quartz_font_face_create_for_cgfont
+
+ font_face->cgFont = CGFontRetain (font);
+
++ if (CTFontCreateWithGraphicsFontPtr) {
++ font_face->ctFont = CTFontCreateWithGraphicsFontPtr (font, 1.0, NULL, NULL);
++ } else {
++ font_face->ctFont = NULL;
++ }
++
+ _cairo_font_face_init (&font_face->base, &_cairo_quartz_font_face_backend);
+
+ return &font_face->base;
+@@ -782,49 +794,10 @@ _cairo_quartz_scaled_font_get_cg_font_re
+ return ffont->cgFont;
+ }
+
+-/*
+- * compat with old ATSUI backend
+- */
+-
+-/**
+- * cairo_quartz_font_face_create_for_atsu_font_id
+- * @font_id: an ATSUFontID for the font.
+- *
+- * Creates a new font for the Quartz font backend based on an
+- * #ATSUFontID. This font can then be used with
+- * cairo_set_font_face() or cairo_scaled_font_create().
+- *
+- * Return value: a newly created #cairo_font_face_t. Free with
+- * cairo_font_face_destroy() when you are done using it.
+- *
+- * Since: 1.6
+- **/
+-cairo_font_face_t *
+-cairo_quartz_font_face_create_for_atsu_font_id (ATSUFontID font_id)
++CTFontRef
++_cairo_quartz_scaled_font_get_ct_font_ref (cairo_scaled_font_t *abstract_font)
+ {
+- quartz_font_ensure_symbols();
+-
+- if (FMGetATSFontRefFromFontPtr != NULL) {
+- ATSFontRef atsFont = FMGetATSFontRefFromFontPtr (font_id);
+- CGFontRef cgFont = CGFontCreateWithPlatformFont (&atsFont);
+- cairo_font_face_t *ff;
+-
+- ff = cairo_quartz_font_face_create_for_cgfont (cgFont);
+-
+- CGFontRelease (cgFont);
+-
+- return ff;
+- } else {
+- _cairo_error_throw (CAIRO_STATUS_NO_MEMORY);
+- return (cairo_font_face_t *)&_cairo_font_face_nil;
+- }
+-}
+-
+-/* This is the old name for the above function, exported for compat purposes */
+-cairo_font_face_t *cairo_atsui_font_face_create_for_atsu_font_id (ATSUFontID font_id);
++ cairo_quartz_font_face_t *ffont = _cairo_quartz_scaled_to_face(abstract_font);
+
+-cairo_font_face_t *
+-cairo_atsui_font_face_create_for_atsu_font_id (ATSUFontID font_id)
+-{
+- return cairo_quartz_font_face_create_for_atsu_font_id (font_id);
++ return ffont->ctFont;
+ }
+--- a/src/cairo-quartz-image-surface.c 2010-06-18 04:47:13.000000000 -0700
++++ b/src/cairo-quartz-image-surface.c 2012-11-13 18:06:56.000000000 -0800
+@@ -148,6 +148,8 @@ _cairo_quartz_image_surface_flush (void
+ surface->image = newImage;
+ CGImageRelease (oldImage);
+
++ surface->base.is_clear = surface->imageSurface->base.is_clear;
++
+ return CAIRO_STATUS_SUCCESS;
+ }
+
+@@ -270,6 +272,8 @@ cairo_quartz_image_surface_create (cairo
+ qisurf->image = image;
+ qisurf->imageSurface = image_surface;
+
++ qisurf->base.is_clear = image_surface->base.is_clear;
++
+ return &qisurf->base;
+ }
+
+--- a/src/cairo-quartz-private.h 2010-12-25 06:21:34.000000000 -0800
++++ b/src/cairo-quartz-private.h 2012-11-13 18:06:56.000000000 -0800
+@@ -50,6 +50,9 @@ typedef CGFloat cairo_quartz_float_t;
+ typedef float cairo_quartz_float_t;
+ #endif
+
++/* define CTFontRef for pre-10.5 SDKs */
++typedef const struct __CTFont *CTFontRef;
++
+ typedef struct cairo_quartz_surface {
+ cairo_surface_t base;
+
+@@ -60,21 +63,22 @@ typedef struct cairo_quartz_surface {
+ cairo_surface_t *imageSurfaceEquiv;
+
+ cairo_surface_clipper_t clipper;
+- cairo_rectangle_int_t extents;
+
+- /* These are stored while drawing operations are in place, set up
+- * by quartz_setup_source() and quartz_finish_source()
++ /**
++ * If non-null, this is a CGImage representing the contents of the surface.
++ * We clear this out before any painting into the surface, so that we
++ * don't force a copy to be created.
+ */
+- CGAffineTransform sourceTransform;
++ CGImageRef bitmapContextImage;
+
+- CGImageRef sourceImage;
+- cairo_surface_t *sourceImageSurface;
+- CGRect sourceImageRect;
++ /**
++ * If non-null, this is the CGLayer for the surface.
++ */
++ CGLayerRef cgLayer;
+
+- CGShadingRef sourceShading;
+- CGPatternRef sourcePattern;
++ cairo_rectangle_int_t extents;
+
+- CGInterpolationQuality oldInterpolationQuality;
++ cairo_bool_t ownsData;
+ } cairo_quartz_surface_t;
+
+ typedef struct cairo_quartz_image_surface {
+@@ -103,6 +107,9 @@ _cairo_quartz_create_cgimage (cairo_form
+ CGFontRef
+ _cairo_quartz_scaled_font_get_cg_font_ref (cairo_scaled_font_t *sfont);
+
++CTFontRef
++_cairo_quartz_scaled_font_get_ct_font_ref (cairo_scaled_font_t *sfont);
++
+ #else
+
+ # error Cairo was not compiled with support for the quartz backend
+--- a/src/cairo-quartz-surface.c 2012-11-13 18:20:00.000000000 -0800
++++ b/src/cairo-quartz-surface.c 2012-11-13 18:06:56.000000000 -0800
+@@ -41,6 +41,8 @@
+
+ #include "cairo-error-private.h"
+ #include "cairo-surface-clipper-private.h"
++#include "cairo-gstate-private.h"
++#include "cairo-private.h"
+
+ #include <dlfcn.h>
+
+@@ -77,6 +79,11 @@
+ * This macro can be used to conditionally compile backend-specific code.
+ */
+
++/* Here are some of the differences between cairo and CoreGraphics
++ - cairo has only a single source active at once vs. CoreGraphics having
++ separate sources for stroke and fill
++*/
++
+ /* This method is private, but it exists. Its params are are exposed
+ * as args to the NS* method, but not as CG.
+ */
+@@ -126,6 +133,12 @@ static void (*CGContextSetShouldAntialia
+ static void (*CGContextSetAllowsFontSmoothingPtr) (CGContextRef, bool) = NULL;
+ static bool (*CGContextGetAllowsFontSmoothingPtr) (CGContextRef) = NULL;
+ static CGPathRef (*CGContextCopyPathPtr) (CGContextRef) = NULL;
++static CGFloat (*CGContextGetAlphaPtr) (CGContextRef) = NULL;
++
++/* CTFontDrawGlyphs is not available until 10.7 */
++static void (*CTFontDrawGlyphsPtr) (CTFontRef, const CGGlyph[], const CGPoint[], size_t, CGContextRef) = NULL;
++
++static SInt32 _cairo_quartz_osx_version = 0x0;
+
+ static cairo_bool_t _cairo_quartz_symbol_lookup_done = FALSE;
+
+@@ -160,6 +173,14 @@ static void quartz_ensure_symbols(void)
+ CGContextCopyPathPtr = dlsym(RTLD_DEFAULT, "CGContextCopyPath");
+ CGContextGetAllowsFontSmoothingPtr = dlsym(RTLD_DEFAULT, "CGContextGetAllowsFontSmoothing");
+ CGContextSetAllowsFontSmoothingPtr = dlsym(RTLD_DEFAULT, "CGContextSetAllowsFontSmoothing");
++ CGContextGetAlphaPtr = dlsym(RTLD_DEFAULT, "CGContextGetAlpha");
++
++ CTFontDrawGlyphsPtr = dlsym(RTLD_DEFAULT, "CTFontDrawGlyphs");
++
++ if (Gestalt(gestaltSystemVersion, &_cairo_quartz_osx_version) != noErr) {
++ // assume 10.5
++ _cairo_quartz_osx_version = 0x1050;
++ }
+
+ _cairo_quartz_symbol_lookup_done = TRUE;
+ }
+@@ -430,6 +446,7 @@ _cairo_quartz_cairo_operator_to_quartz_c
+ case CAIRO_OPERATOR_HSL_LUMINOSITY:
+ default:
+ assert (0);
++ return kPrivateCGCompositeClear;
+ }
+ }
+
+@@ -598,10 +615,13 @@ _cairo_quartz_cairo_matrix_to_quartz (co
+ typedef struct {
+ bool isClipping;
+ CGGlyph *cg_glyphs;
+- CGSize *cg_advances;
++ union {
++ CGSize *cg_advances;
++ CGPoint *cg_positions;
++ } u;
+ size_t nglyphs;
+ CGAffineTransform textTransform;
+- CGFontRef font;
++ cairo_scaled_font_t *scaled_font;
+ CGPoint origin;
+ } unbounded_show_glyphs_t;
+
+@@ -679,12 +699,6 @@ _cairo_quartz_fixup_unbounded_operation
+ else
+ CGContextEOFillPath (cgc);
+ } else if (op->op == UNBOUNDED_SHOW_GLYPHS) {
+- CGContextSetFont (cgc, op->u.show_glyphs.font);
+- CGContextSetFontSize (cgc, 1.0);
+- CGContextSetTextMatrix (cgc, CGAffineTransformIdentity);
+- CGContextTranslateCTM (cgc, op->u.show_glyphs.origin.x, op->u.show_glyphs.origin.y);
+- CGContextConcatCTM (cgc, op->u.show_glyphs.textTransform);
+-
+ if (op->u.show_glyphs.isClipping) {
+ /* Note that the comment in show_glyphs about kCGTextClip
+ * and the text transform still applies here; however, the
+@@ -693,12 +707,25 @@ _cairo_quartz_fixup_unbounded_operation
+ CGContextSetTextDrawingMode (cgc, kCGTextClip);
+ CGContextSaveGState (cgc);
+ }
++ CGContextTranslateCTM (cgc, op->u.show_glyphs.origin.x, op->u.show_glyphs.origin.y);
++ CGContextConcatCTM (cgc, op->u.show_glyphs.textTransform);
++ if (CTFontDrawGlyphsPtr) {
++ CTFontDrawGlyphsPtr (_cairo_quartz_scaled_font_get_ct_font_ref (op->u.show_glyphs.scaled_font),
++ op->u.show_glyphs.cg_glyphs,
++ op->u.show_glyphs.u.cg_positions,
++ op->u.show_glyphs.nglyphs,
++ cgc);
++ } else {
++ CGContextSetFont (cgc, _cairo_quartz_scaled_font_get_cg_font_ref (op->u.show_glyphs.scaled_font));
++ CGContextSetFontSize (cgc, 1.0);
++ CGContextSetTextMatrix (cgc, CGAffineTransformIdentity);
++
++ CGContextShowGlyphsWithAdvances (cgc,
++ op->u.show_glyphs.cg_glyphs,
++ op->u.show_glyphs.u.cg_advances,
++ op->u.show_glyphs.nglyphs);
+
+- CGContextShowGlyphsWithAdvances (cgc,
+- op->u.show_glyphs.cg_glyphs,
+- op->u.show_glyphs.cg_advances,
+- op->u.show_glyphs.nglyphs);
+-
++ }
+ if (op->u.show_glyphs.isClipping) {
+ CGContextClearRect (cgc, clipBoxRound);
+ CGContextRestoreGState (cgc);
+@@ -1102,12 +1129,12 @@ DataProviderReleaseCallback (void *info,
+ {
+ quartz_source_image_t *source_img = info;
+ _cairo_surface_release_source_image (source_img->surface, source_img->image_out, source_img->image_extra);
++ cairo_surface_destroy (source_img->surface);
+ free (source_img);
+ }
+
+ static cairo_status_t
+-_cairo_surface_to_cgimage (cairo_surface_t *target,
+- cairo_surface_t *source,
++_cairo_surface_to_cgimage (cairo_surface_t *source,
+ CGImageRef *image_out)
+ {
+ cairo_status_t status;
+@@ -1127,9 +1154,14 @@ _cairo_surface_to_cgimage (cairo_surface
+ }
+
+ if (_cairo_quartz_is_cgcontext_bitmap_context (surface->cgContext)) {
+- *image_out = CGBitmapContextCreateImage (surface->cgContext);
+- if (*image_out)
+- return CAIRO_STATUS_SUCCESS;
++ if (!surface->bitmapContextImage) {
++ surface->bitmapContextImage =
++ CGBitmapContextCreateImage (surface->cgContext);
++ }
++ if (surface->bitmapContextImage) {
++ *image_out = CGImageRetain (surface->bitmapContextImage);
++ return CAIRO_STATUS_SUCCESS;
++ }
+ }
+ }
+
+@@ -1137,10 +1169,11 @@ _cairo_surface_to_cgimage (cairo_surface
+ if (source_img == NULL)
+ return _cairo_error (CAIRO_STATUS_NO_MEMORY);
+
+- source_img->surface = source;
++ source_img->surface = cairo_surface_reference(source);
+
+ status = _cairo_surface_acquire_source_image (source_img->surface, &source_img->image_out, &source_img->image_extra);
+ if (status) {
++ cairo_surface_destroy (source_img->surface);
+ free (source_img);
+ return status;
+ }
+@@ -1251,7 +1284,7 @@ _cairo_quartz_cairo_repeating_surface_pa
+ is_bounded = _cairo_surface_get_extents (pat_surf, &extents);
+ assert (is_bounded);
+
+- status = _cairo_surface_to_cgimage ((cairo_surface_t*) dest, pat_surf, &image);
++ status = _cairo_surface_to_cgimage (pat_surf, &image);
+ if (status)
+ return status;
+ if (image == NULL)
+@@ -1322,16 +1355,43 @@ typedef enum {
+ DO_SHADING,
+ DO_PATTERN,
+ DO_IMAGE,
++ DO_TILED_IMAGE,
++ DO_LAYER,
+ DO_UNSUPPORTED,
+- DO_NOTHING,
+- DO_TILED_IMAGE
++ DO_NOTHING
+ } cairo_quartz_action_t;
+
+-static cairo_quartz_action_t
++/* State used during a drawing operation. */
++typedef struct {
++ CGContextRef context;
++ cairo_quartz_action_t action;
++
++ // Used with DO_SHADING, DO_IMAGE, DO_TILED_IMAGE and DO_LAYER
++ CGAffineTransform transform;
++
++ // Used with DO_IMAGE and DO_TILED_IMAGE
++ CGImageRef image;
++ cairo_surface_t *imageSurface;
++
++ // Used with DO_IMAGE, DO_TILED_IMAGE and DO_LAYER
++ CGRect imageRect;
++
++ // Used with DO_LAYER
++ CGLayerRef layer;
++
++ // Used with DO_SHADING
++ CGShadingRef shading;
++
++ // Used with DO_PATTERN
++ CGPatternRef pattern;
++} cairo_quartz_drawing_state_t;
++
++static void
+ _cairo_quartz_setup_fallback_source (cairo_quartz_surface_t *surface,
+- const cairo_pattern_t *source)
++ const cairo_pattern_t *source,
++ cairo_quartz_drawing_state_t *state)
+ {
+- CGRect clipBox = CGContextGetClipBoundingBox (surface->cgContext);
++ CGRect clipBox = CGContextGetClipBoundingBox (state->context);
+ double x0, y0, w, h;
+
+ cairo_surface_t *fallback;
+@@ -1340,8 +1400,10 @@ _cairo_quartz_setup_fallback_source (cai
+ cairo_status_t status;
+
+ if (clipBox.size.width == 0.0f ||
+- clipBox.size.height == 0.0f)
+- return DO_NOTHING;
++ clipBox.size.height == 0.0f) {
++ state->action = DO_NOTHING;
++ return;
++ }
+
+ x0 = floor(clipBox.origin.x);
+ y0 = floor(clipBox.origin.y);
+@@ -1384,18 +1446,21 @@ _cairo_quartz_setup_fallback_source (cai
+ }
+ #endif
+
+- status = _cairo_surface_to_cgimage (&surface->base, fallback, &img);
+- if (status)
+- return DO_UNSUPPORTED;
+- if (img == NULL)
+- return DO_NOTHING;
+-
+- surface->sourceImageRect = CGRectMake (0.0, 0.0, w, h);
+- surface->sourceImage = img;
+- surface->sourceImageSurface = fallback;
+- surface->sourceTransform = CGAffineTransformMakeTranslation (x0, y0);
++ status = _cairo_surface_to_cgimage (fallback, &img);
++ if (status) {
++ state->action = DO_UNSUPPORTED;
++ return;
++ }
++ if (img == NULL) {
++ state->action = DO_NOTHING;
++ return;
++ }
+
+- return DO_IMAGE;
++ state->imageRect = CGRectMake (0.0, 0.0, w, h);
++ state->image = img;
++ state->imageSurface = fallback;
++ state->transform = CGAffineTransformMakeTranslation (x0, y0);
++ state->action = DO_IMAGE;
+ }
+
+ /*
+@@ -1411,10 +1476,11 @@ based on the extents of the object (the
+ we don't want the rasterization of the entire gradient to depend on the
+ clip region).
+ */
+-static cairo_quartz_action_t
++static void
+ _cairo_quartz_setup_linear_source (cairo_quartz_surface_t *surface,
+ const cairo_linear_pattern_t *lpat,
+- cairo_rectangle_int_t *extents)
++ cairo_rectangle_int_t *extents,
++ cairo_quartz_drawing_state_t *state)
+ {
+ const cairo_pattern_t *abspat = &lpat->base.base;
+ cairo_matrix_t mat;
+@@ -1424,9 +1490,10 @@ _cairo_quartz_setup_linear_source (cairo
+ bool extend = abspat->extend == CAIRO_EXTEND_PAD;
+
+ if (lpat->base.n_stops == 0) {
+- CGContextSetRGBStrokeColor (surface->cgContext, 0., 0., 0., 0.);
+- CGContextSetRGBFillColor (surface->cgContext, 0., 0., 0., 0.);
+- return DO_SOLID;
++ CGContextSetRGBStrokeColor (state->context, 0., 0., 0., 0.);
++ CGContextSetRGBFillColor (state->context, 0., 0., 0., 0.);
++ state->action = DO_SOLID;
++ return;
+ }
+
+ if (lpat->p1.x == lpat->p2.x &&
+@@ -1436,12 +1503,13 @@ _cairo_quartz_setup_linear_source (cairo
+ * Whatever the correct behaviour is, let's at least have only pixman's
+ * implementation to worry about.
+ */
+- return _cairo_quartz_setup_fallback_source (surface, abspat);
++ _cairo_quartz_setup_fallback_source (surface, abspat, state);
++ return;
+ }
+
+ mat = abspat->matrix;
+ cairo_matrix_invert (&mat);
+- _cairo_quartz_cairo_matrix_to_quartz (&mat, &surface->sourceTransform);
++ _cairo_quartz_cairo_matrix_to_quartz (&mat, &state->transform);
+
+ rgb = CGColorSpaceCreateDeviceRGB();
+
+@@ -1461,21 +1529,22 @@ _cairo_quartz_setup_linear_source (cairo
+ extents);
+ }
+
+- surface->sourceShading = CGShadingCreateAxial (rgb,
+- start, end,
+- gradFunc,
+- extend, extend);
++ state->shading = CGShadingCreateAxial (rgb,
++ start, end,
++ gradFunc,
++ extend, extend);
+
+ CGColorSpaceRelease(rgb);
+ CGFunctionRelease(gradFunc);
+
+- return DO_SHADING;
++ state->action = DO_SHADING;
+ }
+
+-static cairo_quartz_action_t
++static void
+ _cairo_quartz_setup_radial_source (cairo_quartz_surface_t *surface,
+ const cairo_radial_pattern_t *rpat,
+- cairo_rectangle_int_t *extents)
++ cairo_rectangle_int_t *extents,
++ cairo_quartz_drawing_state_t *state)
+ {
+ const cairo_pattern_t *abspat = &rpat->base.base;
+ cairo_matrix_t mat;
+@@ -1494,9 +1563,10 @@ _cairo_quartz_setup_radial_source (cairo
+ double centerDistance = sqrt (dx*dx + dy*dy);
+
+ if (rpat->base.n_stops == 0) {
+- CGContextSetRGBStrokeColor (surface->cgContext, 0., 0., 0., 0.);
+- CGContextSetRGBFillColor (surface->cgContext, 0., 0., 0., 0.);
+- return DO_SOLID;
++ CGContextSetRGBStrokeColor (state->context, 0., 0., 0., 0.);
++ CGContextSetRGBFillColor (state->context, 0., 0., 0., 0.);
++ state->action = DO_SOLID;
++ return;
+ }
+
+ if (r2 <= centerDistance + r1 + 1e-6 && /* circle 2 doesn't contain circle 1 */
+@@ -1507,12 +1577,13 @@ _cairo_quartz_setup_radial_source (cairo
+ * implementation to worry about.
+ * Note that this also catches the cases where r1 == r2.
+ */
+- return _cairo_quartz_setup_fallback_source (surface, abspat);
++ _cairo_quartz_setup_fallback_source (surface, abspat, state);
++ return;
+ }
+
+ mat = abspat->matrix;
+ cairo_matrix_invert (&mat);
+- _cairo_quartz_cairo_matrix_to_quartz (&mat, &surface->sourceTransform);
++ _cairo_quartz_cairo_matrix_to_quartz (&mat, &state->transform);
+
+ rgb = CGColorSpaceCreateDeviceRGB();
+
+@@ -1531,90 +1602,79 @@ _cairo_quartz_setup_radial_source (cairo
+ extents);
+ }
+
+- surface->sourceShading = CGShadingCreateRadial (rgb,
+- start,
+- r1,
+- end,
+- r2,
+- gradFunc,
+- extend, extend);
++ state->shading = CGShadingCreateRadial (rgb,
++ start,
++ r1,
++ end,
++ r2,
++ gradFunc,
++ extend, extend);
+
+ CGColorSpaceRelease(rgb);
+ CGFunctionRelease(gradFunc);
+
+- return DO_SHADING;
++ state->action = DO_SHADING;
+ }
+
+-static cairo_quartz_action_t
+-_cairo_quartz_setup_source (cairo_quartz_surface_t *surface,
+- const cairo_pattern_t *source,
+- cairo_rectangle_int_t *extents)
++static void
++_cairo_quartz_setup_surface_source (cairo_quartz_surface_t *surface,
++ const cairo_surface_pattern_t *spat,
++ cairo_rectangle_int_t *extents,
++ cairo_quartz_drawing_state_t *state)
+ {
+- assert (!(surface->sourceImage || surface->sourceShading || surface->sourcePattern));
+-
+- surface->oldInterpolationQuality = CGContextGetInterpolationQuality (surface->cgContext);
+- CGContextSetInterpolationQuality (surface->cgContext, _cairo_quartz_filter_to_quartz (source->filter));
++ const cairo_pattern_t *source = &spat->base;
++ CGContextRef context = state->context;
+
+- if (source->type == CAIRO_PATTERN_TYPE_SOLID) {
+- cairo_solid_pattern_t *solid = (cairo_solid_pattern_t *) source;
+-
+- CGContextSetRGBStrokeColor (surface->cgContext,
+- solid->color.red,
+- solid->color.green,
+- solid->color.blue,
+- solid->color.alpha);
+- CGContextSetRGBFillColor (surface->cgContext,
+- solid->color.red,
+- solid->color.green,
+- solid->color.blue,
+- solid->color.alpha);
+-
+- return DO_SOLID;
+- }
+-
+- if (source->type == CAIRO_PATTERN_TYPE_LINEAR) {
+- const cairo_linear_pattern_t *lpat = (const cairo_linear_pattern_t *)source;
+- return _cairo_quartz_setup_linear_source (surface, lpat, extents);
+- }
+-
+- if (source->type == CAIRO_PATTERN_TYPE_RADIAL) {
+- const cairo_radial_pattern_t *rpat = (const cairo_radial_pattern_t *)source;
+- return _cairo_quartz_setup_radial_source (surface, rpat, extents);
+- }
+-
+- if (source->type == CAIRO_PATTERN_TYPE_SURFACE &&
+- (source->extend == CAIRO_EXTEND_NONE || (CGContextDrawTiledImagePtr && source->extend == CAIRO_EXTEND_REPEAT)))
++ if (source->extend == CAIRO_EXTEND_NONE || source->extend == CAIRO_EXTEND_PAD ||
++ (CGContextDrawTiledImagePtr && source->extend == CAIRO_EXTEND_REPEAT))
+ {
+- const cairo_surface_pattern_t *spat = (const cairo_surface_pattern_t *) source;
+ cairo_surface_t *pat_surf = spat->surface;
+ CGImageRef img;
+ cairo_matrix_t m = spat->base.matrix;
+ cairo_rectangle_int_t extents;
+- cairo_status_t status;
+ CGAffineTransform xform;
+ CGRect srcRect;
+ cairo_fixed_t fw, fh;
+ cairo_bool_t is_bounded;
++ cairo_bool_t repeat = source->extend == CAIRO_EXTEND_REPEAT;
++ cairo_status_t status;
+
+- status = _cairo_surface_to_cgimage ((cairo_surface_t *) surface, pat_surf, &img);
+- if (status)
+- return DO_UNSUPPORTED;
+- if (img == NULL)
+- return DO_NOTHING;
++ cairo_matrix_invert(&m);
++ _cairo_quartz_cairo_matrix_to_quartz (&m, &state->transform);
+
+- CGContextSetRGBFillColor (surface->cgContext, 0, 0, 0, 1);
++ /* Draw nonrepeating CGLayer surface using DO_LAYER */
++ if (!repeat && cairo_surface_get_type (pat_surf) == CAIRO_SURFACE_TYPE_QUARTZ) {
++ cairo_quartz_surface_t *quartz_surf = (cairo_quartz_surface_t *) pat_surf;
++ if (quartz_surf->cgLayer) {
++ state->imageRect = CGRectMake (0, 0, quartz_surf->extents.width, quartz_surf->extents.height);
++ state->layer = quartz_surf->cgLayer;
++ state->action = DO_LAYER;
++ return;
++ }
++ }
++
++ status = _cairo_surface_to_cgimage (pat_surf, &img);
++ if (status) {
++ state->action = DO_UNSUPPORTED;
++ return;
++ }
++ if (img == NULL) {
++ state->action = DO_NOTHING;
++ return;
++ }
+
+- surface->sourceImage = img;
++ /* XXXroc what is this for? */
++ CGContextSetRGBFillColor (surface->cgContext, 0, 0, 0, 1);
+
+- cairo_matrix_invert(&m);
+- _cairo_quartz_cairo_matrix_to_quartz (&m, &surface->sourceTransform);
++ state->image = img;
+
+ is_bounded = _cairo_surface_get_extents (pat_surf, &extents);
+ assert (is_bounded);
+
+- if (source->extend == CAIRO_EXTEND_NONE) {
+- surface->sourceImageRect = CGRectMake (0, 0, extents.width, extents.height);
+- return DO_IMAGE;
++ if (!repeat) {
++ state->imageRect = CGRectMake (0, 0, extents.width, extents.height);
++ state->action = DO_IMAGE;
++ return;
+ }
+
+ /* Quartz seems to tile images at pixel-aligned regions only -- this
+@@ -1624,8 +1684,8 @@ _cairo_quartz_setup_source (cairo_quartz
+ * epsilon), and if not, fall back to the CGPattern type.
+ */
+
+- xform = CGAffineTransformConcat (CGContextGetCTM (surface->cgContext),
+- surface->sourceTransform);
++ xform = CGAffineTransformConcat (CGContextGetCTM (context),
++ state->transform);
+
+ srcRect = CGRectMake (0, 0, extents.width, extents.height);
+ srcRect = CGRectApplyAffineTransform (srcRect, xform);
+@@ -1646,101 +1706,218 @@ _cairo_quartz_setup_source (cairo_quartz
+
+ srcRect = CGRectApplyAffineTransform (srcRect, xform);
+
+- surface->sourceImageRect = srcRect;
+-
+- return DO_TILED_IMAGE;
++ state->imageRect = srcRect;
++ state->action = DO_TILED_IMAGE;
++ return;
+ }
+
+ /* Fall through to generic SURFACE case */
+ }
+
+- if (source->type == CAIRO_PATTERN_TYPE_SURFACE) {
+- cairo_quartz_float_t patternAlpha = 1.0f;
+- CGColorSpaceRef patternSpace;
+- CGPatternRef pattern;
+- cairo_int_status_t status;
+-
+- status = _cairo_quartz_cairo_repeating_surface_pattern_to_quartz (surface, source, &pattern);
+- if (status == CAIRO_INT_STATUS_NOTHING_TO_DO)
+- return DO_NOTHING;
+- if (status)
+- return DO_UNSUPPORTED;
+-
+- // Save before we change the pattern, colorspace, etc. so that
+- // we can restore and make sure that quartz releases our
+- // pattern (which may be stack allocated)
+- CGContextSaveGState(surface->cgContext);
+-
+- patternSpace = CGColorSpaceCreatePattern(NULL);
+- CGContextSetFillColorSpace (surface->cgContext, patternSpace);
+- CGContextSetFillPattern (surface->cgContext, pattern, &patternAlpha);
+- CGContextSetStrokeColorSpace (surface->cgContext, patternSpace);
+- CGContextSetStrokePattern (surface->cgContext, pattern, &patternAlpha);
+- CGColorSpaceRelease (patternSpace);
+-
+- /* Quartz likes to munge the pattern phase (as yet unexplained
+- * why); force it to 0,0 as we've already baked in the correct
+- * pattern translation into the pattern matrix
+- */
+- CGContextSetPatternPhase (surface->cgContext, CGSizeMake(0,0));
+-
+- surface->sourcePattern = pattern;
++ CGFloat patternAlpha = 1.0f;
++ CGColorSpaceRef patternSpace;
++ CGPatternRef pattern;
++ cairo_int_status_t status;
+
+- return DO_PATTERN;
++ status = _cairo_quartz_cairo_repeating_surface_pattern_to_quartz (surface, source, &pattern);
++ if (status == CAIRO_INT_STATUS_NOTHING_TO_DO) {
++ state->action = DO_NOTHING;
++ return;
++ }
++ if (status) {
++ state->action = DO_UNSUPPORTED;
++ return;
+ }
+
+- return DO_UNSUPPORTED;
++ patternSpace = CGColorSpaceCreatePattern (NULL);
++ CGContextSetFillColorSpace (context, patternSpace);
++ CGContextSetFillPattern (context, pattern, &patternAlpha);
++ CGContextSetStrokeColorSpace (context, patternSpace);
++ CGContextSetStrokePattern (context, pattern, &patternAlpha);
++ CGColorSpaceRelease (patternSpace);
++
++ /* Quartz likes to munge the pattern phase (as yet unexplained
++ * why); force it to 0,0 as we've already baked in the correct
++ * pattern translation into the pattern matrix
++ */
++ CGContextSetPatternPhase (context, CGSizeMake(0,0));
++
++ state->pattern = pattern;
++ state->action = DO_PATTERN;
++ return;
+ }
+
++/**
++ * Call this before any operation that can modify the contents of a
++ * cairo_quartz_surface_t.
++ */
+ static void
+-_cairo_quartz_teardown_source (cairo_quartz_surface_t *surface,
+- const cairo_pattern_t *source)
++_cairo_quartz_surface_will_change (cairo_quartz_surface_t *surface)
+ {
+- CGContextSetInterpolationQuality (surface->cgContext, surface->oldInterpolationQuality);
++ if (surface->bitmapContextImage) {
++ CGImageRelease (surface->bitmapContextImage);
++ surface->bitmapContextImage = NULL;
++ }
++}
+
+- if (surface->sourceImage) {
+- CGImageRelease(surface->sourceImage);
+- surface->sourceImage = NULL;
++/**
++ * Sets up internal state to be used to draw the source mask, stored in
++ * cairo_quartz_state_t. Guarantees to call CGContextSaveGState on
++ * surface->cgContext.
++ */
++static cairo_quartz_drawing_state_t
++_cairo_quartz_setup_state (cairo_quartz_surface_t *surface,
++ const cairo_pattern_t *source,
++ cairo_operator_t op,
++ cairo_rectangle_int_t *extents)
++{
++ CGContextRef context = surface->cgContext;
++ cairo_quartz_drawing_state_t state;
++ cairo_status_t status;
+
+- cairo_surface_destroy(surface->sourceImageSurface);
+- surface->sourceImageSurface = NULL;
++ state.context = context;
++ state.image = NULL;
++ state.imageSurface = NULL;
++ state.layer = NULL;
++ state.shading = NULL;
++ state.pattern = NULL;
++
++ _cairo_quartz_surface_will_change (surface);
++
++ // Save before we change the pattern, colorspace, etc. so that
++ // we can restore and make sure that quartz releases our
++ // pattern (which may be stack allocated)
++ CGContextSaveGState(context);
++
++ CGContextSetInterpolationQuality (context, _cairo_quartz_filter_to_quartz (source->filter));
++
++ status = _cairo_quartz_surface_set_cairo_operator (surface, op);
++ if (status == CAIRO_INT_STATUS_NOTHING_TO_DO) {
++ state.action = DO_NOTHING;
++ return state;
++ }
++ if (status) {
++ state.action = DO_UNSUPPORTED;
++ return state;
+ }
+
+- if (surface->sourceShading) {
+- CGShadingRelease(surface->sourceShading);
+- surface->sourceShading = NULL;
++ if (source->type == CAIRO_PATTERN_TYPE_SOLID) {
++ cairo_solid_pattern_t *solid = (cairo_solid_pattern_t *) source;
++
++ CGContextSetRGBStrokeColor (context,
++ solid->color.red,
++ solid->color.green,
++ solid->color.blue,
++ solid->color.alpha);
++ CGContextSetRGBFillColor (context,
++ solid->color.red,
++ solid->color.green,
++ solid->color.blue,
++ solid->color.alpha);
++
++ state.action = DO_SOLID;
++ return state;
++ }
++
++ if (source->type == CAIRO_PATTERN_TYPE_LINEAR) {
++ const cairo_linear_pattern_t *lpat = (const cairo_linear_pattern_t *)source;
++ _cairo_quartz_setup_linear_source (surface, lpat, extents, &state);
++ return state;
++ }
++
++ if (source->type == CAIRO_PATTERN_TYPE_RADIAL) {
++ const cairo_radial_pattern_t *rpat = (const cairo_radial_pattern_t *)source;
++ _cairo_quartz_setup_radial_source (surface, rpat, extents, &state);
++ return state;
+ }
+
+- if (surface->sourcePattern) {
+- CGPatternRelease(surface->sourcePattern);
+- // To tear down the pattern and colorspace
+- CGContextRestoreGState(surface->cgContext);
++ if (source->type == CAIRO_PATTERN_TYPE_SURFACE) {
++ if (op == CAIRO_OPERATOR_OVER && _cairo_pattern_is_opaque (source, NULL) &&
++ CGContextGetAlphaPtr &&
++ CGContextGetAlphaPtr (surface->cgContext) == 1.0) {
++ // Quartz won't touch pixels outside the bounds of the
++ // source surface, so we can just go ahead and use Copy here
++ // to accelerate things.
++ // Quartz won't necessarily be able to do this optimization internally;
++ // for CGLayer surfaces, we can know all the pixels are opaque
++ // (because it's CONTENT_COLOR), but Quartz won't know.
++ CGContextSetCompositeOperation (context, kPrivateCGCompositeCopy);
++ }
+
+- surface->sourcePattern = NULL;
++ const cairo_surface_pattern_t *spat = (const cairo_surface_pattern_t *) source;
++ _cairo_quartz_setup_surface_source (surface, spat, extents, &state);
++ return state;
+ }
+-}
+
++ state.action = DO_UNSUPPORTED;
++ return state;
++}
+
++/**
++ * 1) Tears down internal state used to draw the source
++ * 2) Does CGContextRestoreGState(state->context)
++ */
+ static void
+-_cairo_quartz_draw_image (cairo_quartz_surface_t *surface, cairo_operator_t op, cairo_quartz_action_t action)
++_cairo_quartz_teardown_state (cairo_quartz_drawing_state_t *state)
+ {
+- assert (surface && surface->sourceImage && (action == DO_IMAGE || action == DO_TILED_IMAGE));
++ if (state->image) {
++ CGImageRelease(state->image);
++ }
+
+- CGContextConcatCTM (surface->cgContext, surface->sourceTransform);
+- CGContextTranslateCTM (surface->cgContext, 0, surface->sourceImageRect.size.height);
+- CGContextScaleCTM (surface->cgContext, 1, -1);
+-
+- if (action == DO_IMAGE) {
+- CGContextDrawImage (surface->cgContext, surface->sourceImageRect, surface->sourceImage);
+- if (!_cairo_operator_bounded_by_source(op)) {
+- CGContextBeginPath (surface->cgContext);
+- CGContextAddRect (surface->cgContext, surface->sourceImageRect);
+- CGContextAddRect (surface->cgContext, CGContextGetClipBoundingBox (surface->cgContext));
+- CGContextSetRGBFillColor (surface->cgContext, 0, 0, 0, 0);
+- CGContextEOFillPath (surface->cgContext);
++ if (state->imageSurface) {
++ cairo_surface_destroy(state->imageSurface);
++ }
++
++ if (state->shading) {
++ CGShadingRelease(state->shading);
++ }
++
++ if (state->pattern) {
++ CGPatternRelease(state->pattern);
++ }
++
++ CGContextRestoreGState(state->context);
++}
++
++
++static void
++_cairo_quartz_draw_image (cairo_quartz_drawing_state_t *state, cairo_operator_t op)
++{
++ assert (state &&
++ ((state->image && (state->action == DO_IMAGE || state->action == DO_TILED_IMAGE)) ||
++ (state->layer && state->action == DO_LAYER)));
++
++ CGContextConcatCTM (state->context, state->transform);
++ CGContextTranslateCTM (state->context, 0, state->imageRect.size.height);
++ CGContextScaleCTM (state->context, 1, -1);
++
++ if (state->action == DO_TILED_IMAGE) {
++ CGContextDrawTiledImagePtr (state->context, state->imageRect, state->image);
++ /* no need to worry about unbounded operators, since tiled images
++ fill the entire clip region */
++ } else {
++ if (state->action == DO_LAYER) {
++ /* Note that according to Apple docs it's completely legal
++ * to draw a CGLayer to any CGContext, even one it wasn't
++ * created for.
++ */
++ CGContextSetInterpolationQuality (state->context, kCGInterpolationNone);
++ CGContextDrawLayerAtPoint (state->context, state->imageRect.origin,
++ state->layer);
++ } else {
++ CGContextDrawImage (state->context, state->imageRect, state->image);
++ }
++
++ /* disable this EXTEND_NONE correctness code because we use this path
++ * for both EXTEND_NONE and EXTEND_PAD */
++ if (0 && !_cairo_operator_bounded_by_source (op)) {
++ CGContextBeginPath (state->context);
++ CGContextAddRect (state->context, state->imageRect);
++ CGContextAddRect (state->context, CGContextGetClipBoundingBox (state->context));
++ CGContextSetRGBFillColor (state->context, 0, 0, 0, 0);
++ CGContextEOFillPath (state->context);
+ }
+- } else
+- CGContextDrawTiledImagePtr (surface->cgContext, surface->sourceImageRect, surface->sourceImage);
++ }
+ }
+
+
+@@ -1762,6 +1939,7 @@ _cairo_quartz_get_image (cairo_quartz_su
+ }
+
+ if (surface->imageSurfaceEquiv) {
++ CGContextFlush(surface->cgContext);
+ *image_out = (cairo_image_surface_t*) cairo_surface_reference(surface->imageSurfaceEquiv);
+ return CAIRO_STATUS_SUCCESS;
+ }
+@@ -1773,6 +1951,7 @@ _cairo_quartz_get_image (cairo_quartz_su
+ CGColorSpaceRef colorspace;
+ unsigned int color_comps;
+
++ CGContextFlush(surface->cgContext);
+ imageData = (unsigned char *) CGBitmapContextGetData(surface->cgContext);
+
+ #ifdef USE_10_3_WORKAROUNDS
+@@ -1860,53 +2039,79 @@ _cairo_quartz_surface_finish (void *abst
+
+ surface->cgContext = NULL;
+
++ if (surface->bitmapContextImage) {
++ CGImageRelease (surface->bitmapContextImage);
++ surface->bitmapContextImage = NULL;
++ }
++
+ if (surface->imageSurfaceEquiv) {
++ if (surface->ownsData)
++ _cairo_image_surface_assume_ownership_of_data (surface->imageSurfaceEquiv);
+ cairo_surface_destroy (surface->imageSurfaceEquiv);
+ surface->imageSurfaceEquiv = NULL;
++ } else if (surface->imageData && surface->ownsData) {
++ free (surface->imageData);
+ }
+
+- if (surface->imageData) {
+- free (surface->imageData);
+- surface->imageData = NULL;
++ surface->imageData = NULL;
++
++ if (surface->cgLayer) {
++ CGLayerRelease (surface->cgLayer);
+ }
+
+ return CAIRO_STATUS_SUCCESS;
+ }
+
+ static cairo_status_t
+-_cairo_quartz_surface_acquire_source_image (void *abstract_surface,
+- cairo_image_surface_t **image_out,
+- void **image_extra)
++_cairo_quartz_surface_acquire_image (void *abstract_surface,
++ cairo_image_surface_t **image_out,
++ void **image_extra)
+ {
+ cairo_int_status_t status;
+ cairo_quartz_surface_t *surface = (cairo_quartz_surface_t *) abstract_surface;
+
+- //ND((stderr, "%p _cairo_quartz_surface_acquire_source_image\n", surface));
+-
+- status = _cairo_quartz_get_image (surface, image_out);
+- if (status)
+- return _cairo_error (CAIRO_STATUS_NO_MEMORY);
+-
+ *image_extra = NULL;
+
+- return CAIRO_STATUS_SUCCESS;
+-}
++ /* ND((stderr, "%p _cairo_quartz_surface_acquire_image\n", surface)); */
+
+-static cairo_surface_t *
+-_cairo_quartz_surface_snapshot (void *abstract_surface)
+-{
+- cairo_int_status_t status;
+- cairo_quartz_surface_t *surface = abstract_surface;
+- cairo_image_surface_t *image;
++ status = _cairo_quartz_get_image (surface, image_out);
+
+- if (surface->imageSurfaceEquiv)
+- return NULL;
++ if (status == CAIRO_INT_STATUS_UNSUPPORTED && surface->cgLayer) {
++ /* copy the layer into a Quartz bitmap context so we can get the data */
++ cairo_surface_t *tmp =
++ cairo_quartz_surface_create (CAIRO_FORMAT_ARGB32,
++ surface->extents.width,
++ surface->extents.height);
++ cairo_quartz_surface_t *tmp_surface = (cairo_quartz_surface_t *) tmp;
++
++ /* if surface creation failed, we won't have a Quartz surface here */
++ if (cairo_surface_get_type (tmp) == CAIRO_SURFACE_TYPE_QUARTZ &&
++ tmp_surface->imageSurfaceEquiv) {
++ CGContextSaveGState (tmp_surface->cgContext);
++ CGContextTranslateCTM (tmp_surface->cgContext, 0, surface->extents.height);
++ CGContextScaleCTM (tmp_surface->cgContext, 1, -1);
++ /* Note that according to Apple docs it's completely legal
++ * to draw a CGLayer to any CGContext, even one it wasn't
++ * created for.
++ */
++ CGContextDrawLayerAtPoint (tmp_surface->cgContext,
++ CGPointMake (0.0, 0.0),
++ surface->cgLayer);
++ CGContextRestoreGState (tmp_surface->cgContext);
++
++ *image_out = (cairo_image_surface_t*)
++ cairo_surface_reference(tmp_surface->imageSurfaceEquiv);
++ *image_extra = tmp;
++ status = CAIRO_STATUS_SUCCESS;
++ } else {
++ cairo_surface_destroy (tmp);
++ }
++ }
+
+- status = _cairo_quartz_get_image (surface, &image);
+- if (unlikely (status))
+- return _cairo_surface_create_in_error (CAIRO_STATUS_NO_MEMORY);
++ if (status)
++ return _cairo_error (CAIRO_STATUS_NO_MEMORY);
+
+- return &image->base;
++ return CAIRO_STATUS_SUCCESS;
+ }
+
+ static void
+@@ -1915,6 +2120,10 @@ _cairo_quartz_surface_release_source_ima
+ void *image_extra)
+ {
+ cairo_surface_destroy ((cairo_surface_t *) image);
++
++ if (image_extra) {
++ cairo_surface_destroy ((cairo_surface_t *) image_extra);
++ }
+ }
+
+
+@@ -1926,18 +2135,16 @@ _cairo_quartz_surface_acquire_dest_image
+ void **image_extra)
+ {
+ cairo_quartz_surface_t *surface = (cairo_quartz_surface_t *) abstract_surface;
+- cairo_int_status_t status;
+
+ ND((stderr, "%p _cairo_quartz_surface_acquire_dest_image\n", surface));
+
+- status = _cairo_quartz_get_image (surface, image_out);
+- if (status)
+- return _cairo_error (CAIRO_STATUS_NO_MEMORY);
+-
+ *image_rect = surface->extents;
+ *image_extra = NULL;
+
+- return CAIRO_STATUS_SUCCESS;
++ _cairo_quartz_surface_will_change (surface);
++
++ return _cairo_quartz_surface_acquire_image (abstract_surface,
++ image_out, image_extra);
+ }
+
+ static void
+@@ -1947,11 +2154,31 @@ _cairo_quartz_surface_release_dest_image
+ cairo_rectangle_int_t *image_rect,
+ void *image_extra)
+ {
+- //cairo_quartz_surface_t *surface = (cairo_quartz_surface_t *) abstract_surface;
+-
+- //ND((stderr, "%p _cairo_quartz_surface_release_dest_image\n", surface));
++ /* ND((stderr, "%p _cairo_quartz_surface_release_dest_image\n", surface)); */
+
+ cairo_surface_destroy ((cairo_surface_t *) image);
++
++ if (image_extra) {
++ /* we need to write the data from the temp surface back to the layer */
++ cairo_quartz_surface_t *surface = (cairo_quartz_surface_t *) abstract_surface;
++ cairo_quartz_surface_t *tmp_surface = (cairo_quartz_surface_t *) image_extra;
++ CGImageRef img;
++ cairo_status_t status = _cairo_surface_to_cgimage (&tmp_surface->base, &img);
++ if (status) {
++ cairo_surface_destroy (&tmp_surface->base);
++ return;
++ }
++
++ CGContextSaveGState (surface->cgContext);
++ CGContextTranslateCTM (surface->cgContext, 0, surface->extents.height);
++ CGContextScaleCTM (surface->cgContext, 1, -1);
++ CGContextDrawImage (surface->cgContext,
++ CGRectMake (0.0, 0.0, surface->extents.width, surface->extents.height),
++ img);
++ CGContextRestoreGState (surface->cgContext);
++
++ cairo_surface_destroy (&tmp_surface->base);
++ }
+ }
+
+ static cairo_surface_t *
+@@ -1960,10 +2187,13 @@ _cairo_quartz_surface_create_similar (vo
+ int width,
+ int height)
+ {
+- /*cairo_quartz_surface_t *surface = (cairo_quartz_surface_t *) abstract_surface;*/
+-
++ cairo_quartz_surface_t *surface = (cairo_quartz_surface_t *) abstract_surface;
+ cairo_format_t format;
+
++ if (surface->cgLayer)
++ return cairo_quartz_surface_create_cg_layer (abstract_surface, content,
++ width, height);
++
+ if (content == CAIRO_CONTENT_COLOR_ALPHA)
+ format = CAIRO_FORMAT_ARGB32;
+ else if (content == CAIRO_CONTENT_COLOR)
+@@ -2027,7 +2257,7 @@ _cairo_quartz_surface_clone_similar (voi
+ }
+ }
+
+- status = _cairo_surface_to_cgimage ((cairo_surface_t*) abstract_surface, src, &quartz_image);
++ status = _cairo_surface_to_cgimage (src, &quartz_image);
+ if (status)
+ return CAIRO_INT_STATUS_UNSUPPORTED;
+
+@@ -2087,7 +2317,7 @@ _cairo_quartz_surface_paint_cg (void *ab
+ {
+ cairo_quartz_surface_t *surface = (cairo_quartz_surface_t *) abstract_surface;
+ cairo_int_status_t rv = CAIRO_STATUS_SUCCESS;
+- cairo_quartz_action_t action;
++ cairo_quartz_drawing_state_t state;
+
+ ND((stderr, "%p _cairo_quartz_surface_paint op %d source->type %d\n", surface, op, source->type));
+
+@@ -2098,31 +2328,24 @@ _cairo_quartz_surface_paint_cg (void *ab
+ if (unlikely (rv))
+ return rv;
+
+- rv = _cairo_quartz_surface_set_cairo_operator (surface, op);
+- if (unlikely (rv))
+- return rv == CAIRO_INT_STATUS_NOTHING_TO_DO ? CAIRO_STATUS_SUCCESS : rv;
++ state = _cairo_quartz_setup_state (surface, source, op, NULL);
+
+- action = _cairo_quartz_setup_source (surface, source, NULL);
+-
+- if (action == DO_SOLID || action == DO_PATTERN) {
+- CGContextFillRect (surface->cgContext, CGRectMake(surface->extents.x,
+- surface->extents.y,
+- surface->extents.width,
+- surface->extents.height));
+- } else if (action == DO_SHADING) {
+- CGContextSaveGState (surface->cgContext);
+- CGContextConcatCTM (surface->cgContext, surface->sourceTransform);
+- CGContextDrawShading (surface->cgContext, surface->sourceShading);
+- CGContextRestoreGState (surface->cgContext);
+- } else if (action == DO_IMAGE || action == DO_TILED_IMAGE) {
+- CGContextSaveGState (surface->cgContext);
+- _cairo_quartz_draw_image (surface, op, action);
+- CGContextRestoreGState (surface->cgContext);
+- } else if (action != DO_NOTHING) {
++ if (state.action == DO_SOLID || state.action == DO_PATTERN) {
++ CGContextFillRect (state.context, CGRectMake(surface->extents.x,
++ surface->extents.y,
++ surface->extents.width,
++ surface->extents.height));
++ } else if (state.action == DO_SHADING) {
++ CGContextConcatCTM (state.context, state.transform);
++ CGContextDrawShading (state.context, state.shading);
++ } else if (state.action == DO_IMAGE || state.action == DO_TILED_IMAGE ||
++ state.action == DO_LAYER) {
++ _cairo_quartz_draw_image (&state, op);
++ } else if (state.action != DO_NOTHING) {
+ rv = CAIRO_INT_STATUS_UNSUPPORTED;
+ }
+
+- _cairo_quartz_teardown_source (surface, source);
++ _cairo_quartz_teardown_state (&state);
+
+ ND((stderr, "-- paint\n"));
+ return rv;
+@@ -2186,7 +2409,7 @@ _cairo_quartz_surface_fill_cg (void *abs
+ {
+ cairo_quartz_surface_t *surface = (cairo_quartz_surface_t *) abstract_surface;
+ cairo_int_status_t rv = CAIRO_STATUS_SUCCESS;
+- cairo_quartz_action_t action;
++ cairo_quartz_drawing_state_t state;
+ CGPathRef path_for_unbounded = NULL;
+
+ ND((stderr, "%p _cairo_quartz_surface_fill op %d source->type %d\n", surface, op, source->type));
+@@ -2198,14 +2421,6 @@ _cairo_quartz_surface_fill_cg (void *abs
+ if (unlikely (rv))
+ return rv;
+
+- rv = _cairo_quartz_surface_set_cairo_operator (surface, op);
+- if (unlikely (rv))
+- return rv == CAIRO_INT_STATUS_NOTHING_TO_DO ? CAIRO_STATUS_SUCCESS : rv;
+-
+- CGContextSaveGState (surface->cgContext);
+-
+- CGContextSetShouldAntialias (surface->cgContext, (antialias != CAIRO_ANTIALIAS_NONE));
+-
+ if (_cairo_quartz_source_needs_extents (source))
+ {
+ /* We don't need precise extents since these are only used to
+@@ -2213,46 +2428,47 @@ _cairo_quartz_surface_fill_cg (void *abs
+ object. */
+ cairo_rectangle_int_t path_extents;
+ _cairo_path_fixed_approximate_fill_extents (path, &path_extents);
+- action = _cairo_quartz_setup_source (surface, source, &path_extents);
++ state = _cairo_quartz_setup_state (surface, source, op, &path_extents);
+ } else {
+- action = _cairo_quartz_setup_source (surface, source, NULL);
++ state = _cairo_quartz_setup_state (surface, source, op, NULL);
+ }
+
+- _cairo_quartz_cairo_path_to_quartz_context (path, surface->cgContext);
++ CGContextSetShouldAntialias (state.context, (antialias != CAIRO_ANTIALIAS_NONE));
++
++ _cairo_quartz_cairo_path_to_quartz_context (path, state.context);
+
+ if (!_cairo_operator_bounded_by_mask(op) && CGContextCopyPathPtr)
+- path_for_unbounded = CGContextCopyPathPtr (surface->cgContext);
++ path_for_unbounded = CGContextCopyPathPtr (state.context);
+
+- if (action == DO_SOLID || action == DO_PATTERN) {
++ if (state.action == DO_SOLID || state.action == DO_PATTERN) {
+ if (fill_rule == CAIRO_FILL_RULE_WINDING)
+- CGContextFillPath (surface->cgContext);
++ CGContextFillPath (state.context);
+ else
+- CGContextEOFillPath (surface->cgContext);
+- } else if (action == DO_SHADING) {
++ CGContextEOFillPath (state.context);
++ } else if (state.action == DO_SHADING) {
+
+ // we have to clip and then paint the shading; we can't fill
+ // with the shading
+ if (fill_rule == CAIRO_FILL_RULE_WINDING)
+- CGContextClip (surface->cgContext);
++ CGContextClip (state.context);
+ else
+- CGContextEOClip (surface->cgContext);
++ CGContextEOClip (state.context);
+
+- CGContextConcatCTM (surface->cgContext, surface->sourceTransform);
+- CGContextDrawShading (surface->cgContext, surface->sourceShading);
+- } else if (action == DO_IMAGE || action == DO_TILED_IMAGE) {
++ CGContextConcatCTM (state.context, state.transform);
++ CGContextDrawShading (state.context, state.shading);
++ } else if (state.action == DO_IMAGE || state.action == DO_TILED_IMAGE ||
++ state.action == DO_LAYER) {
+ if (fill_rule == CAIRO_FILL_RULE_WINDING)
+- CGContextClip (surface->cgContext);
++ CGContextClip (state.context);
+ else
+- CGContextEOClip (surface->cgContext);
++ CGContextEOClip (state.context);
+
+- _cairo_quartz_draw_image (surface, op, action);
+- } else if (action != DO_NOTHING) {
++ _cairo_quartz_draw_image (&state, op);
++ } else if (state.action != DO_NOTHING) {
+ rv = CAIRO_INT_STATUS_UNSUPPORTED;
+ }
+
+- _cairo_quartz_teardown_source (surface, source);
+-
+- CGContextRestoreGState (surface->cgContext);
++ _cairo_quartz_teardown_state (&state);
+
+ if (path_for_unbounded) {
+ unbounded_op_data_t ub;
+@@ -2319,7 +2535,7 @@ _cairo_quartz_surface_stroke_cg (void *a
+ {
+ cairo_quartz_surface_t *surface = (cairo_quartz_surface_t *) abstract_surface;
+ cairo_int_status_t rv = CAIRO_STATUS_SUCCESS;
+- cairo_quartz_action_t action;
++ cairo_quartz_drawing_state_t state;
+ CGAffineTransform origCTM, strokeTransform;
+ CGPathRef path_for_unbounded = NULL;
+
+@@ -2336,16 +2552,25 @@ _cairo_quartz_surface_stroke_cg (void *a
+ if (unlikely (rv))
+ return rv == CAIRO_INT_STATUS_NOTHING_TO_DO ? CAIRO_STATUS_SUCCESS : rv;
+
++ if (_cairo_quartz_source_needs_extents (source))
++ {
++ cairo_rectangle_int_t path_extents;
++ _cairo_path_fixed_approximate_stroke_extents (path, style, ctm, &path_extents);
++ state = _cairo_quartz_setup_state (surface, source, op, &path_extents);
++ } else {
++ state = _cairo_quartz_setup_state (surface, source, op, NULL);
++ }
++
+ // Turning antialiasing off used to cause misrendering with
+ // single-pixel lines (e.g. 20,10.5 -> 21,10.5 end up being rendered as 2 pixels).
+ // That's been since fixed in at least 10.5, and in the latest 10.4 dot releases.
+- CGContextSetShouldAntialias (surface->cgContext, (antialias != CAIRO_ANTIALIAS_NONE));
+- CGContextSetLineWidth (surface->cgContext, style->line_width);
+- CGContextSetLineCap (surface->cgContext, _cairo_quartz_cairo_line_cap_to_quartz (style->line_cap));
+- CGContextSetLineJoin (surface->cgContext, _cairo_quartz_cairo_line_join_to_quartz (style->line_join));
+- CGContextSetMiterLimit (surface->cgContext, style->miter_limit);
++ CGContextSetShouldAntialias (state.context, (antialias != CAIRO_ANTIALIAS_NONE));
++ CGContextSetLineWidth (state.context, style->line_width);
++ CGContextSetLineCap (state.context, _cairo_quartz_cairo_line_cap_to_quartz (style->line_cap));
++ CGContextSetLineJoin (state.context, _cairo_quartz_cairo_line_join_to_quartz (style->line_join));
++ CGContextSetMiterLimit (state.context, style->miter_limit);
+
+- origCTM = CGContextGetCTM (surface->cgContext);
++ origCTM = CGContextGetCTM (state.context);
+
+ if (style->dash && style->num_dashes) {
+ #define STATIC_DASH 32
+@@ -2368,72 +2593,62 @@ _cairo_quartz_surface_stroke_cg (void *a
+ if (fdash != sdash)
+ free (fdash);
+ } else
+- CGContextSetLineDash (surface->cgContext, 0, NULL, 0);
++ CGContextSetLineDash (state.context, 0, NULL, 0);
+
+- CGContextSaveGState (surface->cgContext);
+
++ _cairo_quartz_cairo_path_to_quartz_context (path, state.context);
+
+- if (_cairo_quartz_source_needs_extents (source))
+- {
+- cairo_rectangle_int_t path_extents;
+- _cairo_path_fixed_approximate_stroke_extents (path, style, ctm, &path_extents);
+- action = _cairo_quartz_setup_source (surface, source, &path_extents);
+- } else {
+- action = _cairo_quartz_setup_source (surface, source, NULL);
+- }
+-
+- _cairo_quartz_cairo_path_to_quartz_context (path, surface->cgContext);
++ _cairo_quartz_cairo_matrix_to_quartz (ctm, &strokeTransform);
++ CGContextConcatCTM (state.context, strokeTransform);
+
+ if (!_cairo_operator_bounded_by_mask (op) && CGContextCopyPathPtr)
+- path_for_unbounded = CGContextCopyPathPtr (surface->cgContext);
+-
+- _cairo_quartz_cairo_matrix_to_quartz (ctm, &strokeTransform);
+- CGContextConcatCTM (surface->cgContext, strokeTransform);
++ path_for_unbounded = CGContextCopyPathPtr (state.context);
+
+- if (action == DO_SOLID || action == DO_PATTERN) {
+- CGContextStrokePath (surface->cgContext);
+- } else if (action == DO_IMAGE || action == DO_TILED_IMAGE) {
+- CGContextReplacePathWithStrokedPath (surface->cgContext);
+- CGContextClip (surface->cgContext);
+-
+- CGContextSetCTM (surface->cgContext, origCTM);
+- _cairo_quartz_draw_image (surface, op, action);
+- } else if (action == DO_SHADING) {
+- CGContextReplacePathWithStrokedPath (surface->cgContext);
+- CGContextClip (surface->cgContext);
+-
+- CGContextSetCTM (surface->cgContext, origCTM);
+-
+- CGContextConcatCTM (surface->cgContext, surface->sourceTransform);
+- CGContextDrawShading (surface->cgContext, surface->sourceShading);
+- } else if (action != DO_NOTHING) {
++ if (state.action == DO_SOLID || state.action == DO_PATTERN) {
++ CGContextStrokePath (state.context);
++ } else if (state.action == DO_IMAGE || state.action == DO_TILED_IMAGE ||
++ state.action == DO_LAYER) {
++ CGContextReplacePathWithStrokedPath (state.context);
++ CGContextClip (state.context);
++
++ CGContextSetCTM (state.context, origCTM);
++ _cairo_quartz_draw_image (&state, op);
++ } else if (state.action == DO_SHADING) {
++ CGContextReplacePathWithStrokedPath (state.context);
++ CGContextClip (state.context);
++
++ CGContextSetCTM (state.context, origCTM);
++
++ CGContextConcatCTM (state.context, state.transform);
++ CGContextDrawShading (state.context, state.shading);
++ } else if (state.action != DO_NOTHING) {
+ rv = CAIRO_INT_STATUS_UNSUPPORTED;
++ goto BAIL;
+ }
+
+- _cairo_quartz_teardown_source (surface, source);
+-
+- CGContextRestoreGState (surface->cgContext);
+-
+ if (path_for_unbounded) {
+ unbounded_op_data_t ub;
+ ub.op = UNBOUNDED_STROKE_FILL;
+ ub.u.stroke_fill.fill_rule = CAIRO_FILL_RULE_WINDING;
+
+- CGContextBeginPath (surface->cgContext);
+- CGContextAddPath (surface->cgContext, path_for_unbounded);
++ CGContextBeginPath (state.context);
++ CGContextAddPath (state.context, path_for_unbounded);
+ CGPathRelease (path_for_unbounded);
+
+- CGContextSaveGState (surface->cgContext);
+- CGContextConcatCTM (surface->cgContext, strokeTransform);
+- CGContextReplacePathWithStrokedPath (surface->cgContext);
+- CGContextRestoreGState (surface->cgContext);
++ CGContextSaveGState (state.context);
++ CGContextConcatCTM (state.context, strokeTransform);
++ CGContextReplacePathWithStrokedPath (state.context);
++ CGContextRestoreGState (state.context);
+
+- ub.u.stroke_fill.cgPath = CGContextCopyPathPtr (surface->cgContext);
++ ub.u.stroke_fill.cgPath = CGContextCopyPathPtr (state.context);
+
+ _cairo_quartz_fixup_unbounded_operation (surface, &ub, antialias);
+ CGPathRelease (ub.u.stroke_fill.cgPath);
+ }
+
++ BAIL:
++ _cairo_quartz_teardown_state (&state);
++
+ ND((stderr, "-- stroke\n"));
+ return rv;
+ }
+@@ -2490,18 +2705,22 @@ _cairo_quartz_surface_show_glyphs_cg (vo
+ CGGlyph glyphs_static[STATIC_BUF_SIZE];
+ CGSize cg_advances_static[STATIC_BUF_SIZE];
+ CGGlyph *cg_glyphs = &glyphs_static[0];
++ /* We'll use the cg_advances array for either advances or positions,
++ depending which API we're using to actually draw. The types involved
++ have the same size, so this is safe. */
+ CGSize *cg_advances = &cg_advances_static[0];
+
+ cairo_rectangle_int_t glyph_extents;
+ cairo_quartz_surface_t *surface = (cairo_quartz_surface_t *) abstract_surface;
+ cairo_int_status_t rv = CAIRO_STATUS_SUCCESS;
+- cairo_quartz_action_t action;
++ cairo_quartz_drawing_state_t state;
+ cairo_quartz_float_t xprev, yprev;
+ int i;
+ CGFontRef cgfref = NULL;
+
+ cairo_bool_t isClipping = FALSE;
+ cairo_bool_t didForceFontSmoothing = FALSE;
++ cairo_antialias_t effective_antialiasing;
+
+ if (IS_EMPTY(surface))
+ return CAIRO_STATUS_SUCCESS;
+@@ -2516,54 +2735,51 @@ _cairo_quartz_surface_show_glyphs_cg (vo
+ if (unlikely (rv))
+ return rv;
+
+- rv = _cairo_quartz_surface_set_cairo_operator (surface, op);
+- if (unlikely (rv))
+- return rv == CAIRO_INT_STATUS_NOTHING_TO_DO ? CAIRO_STATUS_SUCCESS : rv;
+-
+- CGContextSaveGState (surface->cgContext);
+-
+ if (_cairo_quartz_source_needs_extents (source) &&
+ !_cairo_scaled_font_glyph_device_extents (scaled_font, glyphs, num_glyphs,
+ &glyph_extents, NULL))
+ {
+- action = _cairo_quartz_setup_source (surface, source, &glyph_extents);
++ state = _cairo_quartz_setup_state (surface, source, op, &glyph_extents);
+ } else {
+- action = _cairo_quartz_setup_source (surface, source, NULL);
++ state = _cairo_quartz_setup_state (surface, source, op, NULL);
+ }
+
+- if (action == DO_SOLID || action == DO_PATTERN) {
+- CGContextSetTextDrawingMode (surface->cgContext, kCGTextFill);
+- } else if (action == DO_IMAGE || action == DO_TILED_IMAGE || action == DO_SHADING) {
+- CGContextSetTextDrawingMode (surface->cgContext, kCGTextClip);
++ if (state.action == DO_SOLID || state.action == DO_PATTERN) {
++ CGContextSetTextDrawingMode (state.context, kCGTextFill);
++ } else if (state.action == DO_IMAGE || state.action == DO_TILED_IMAGE ||
++ state.action == DO_SHADING || state.action == DO_LAYER) {
++ CGContextSetTextDrawingMode (state.context, kCGTextClip);
+ isClipping = TRUE;
+ } else {
+- if (action != DO_NOTHING)
++ if (state.action != DO_NOTHING)
+ rv = CAIRO_INT_STATUS_UNSUPPORTED;
+ goto BAIL;
+ }
+
+ /* this doesn't addref */
+ cgfref = _cairo_quartz_scaled_font_get_cg_font_ref (scaled_font);
+- CGContextSetFont (surface->cgContext, cgfref);
+- CGContextSetFontSize (surface->cgContext, 1.0);
++ CGContextSetFont (state.context, cgfref);
++ CGContextSetFontSize (state.context, 1.0);
++
++ effective_antialiasing = scaled_font->options.antialias;
+
+ switch (scaled_font->options.antialias) {
+ case CAIRO_ANTIALIAS_SUBPIXEL:
+- CGContextSetShouldAntialias (surface->cgContext, TRUE);
+- CGContextSetShouldSmoothFonts (surface->cgContext, TRUE);
++ CGContextSetShouldAntialias (state.context, TRUE);
++ CGContextSetShouldSmoothFonts (state.context, TRUE);
+ if (CGContextSetAllowsFontSmoothingPtr &&
+- !CGContextGetAllowsFontSmoothingPtr (surface->cgContext))
++ !CGContextGetAllowsFontSmoothingPtr (state.context))
+ {
+ didForceFontSmoothing = TRUE;
+- CGContextSetAllowsFontSmoothingPtr (surface->cgContext, TRUE);
++ CGContextSetAllowsFontSmoothingPtr (state.context, TRUE);
+ }
+ break;
+ case CAIRO_ANTIALIAS_NONE:
+- CGContextSetShouldAntialias (surface->cgContext, FALSE);
++ CGContextSetShouldAntialias (state.context, FALSE);
+ break;
+ case CAIRO_ANTIALIAS_GRAY:
+- CGContextSetShouldAntialias (surface->cgContext, TRUE);
+- CGContextSetShouldSmoothFonts (surface->cgContext, FALSE);
++ CGContextSetShouldAntialias (state.context, TRUE);
++ CGContextSetShouldSmoothFonts (state.context, FALSE);
+ break;
+ case CAIRO_ANTIALIAS_DEFAULT:
+ /* Don't do anything */
+@@ -2584,57 +2800,84 @@ _cairo_quartz_surface_show_glyphs_cg (vo
+ }
+ }
+
++ /* scale(1,-1) * scaled_font->scale */
+ textTransform = CGAffineTransformMake (scaled_font->scale.xx,
+ scaled_font->scale.yx,
+ -scaled_font->scale.xy,
+ -scaled_font->scale.yy,
+ 0, 0);
+- _cairo_quartz_cairo_matrix_to_quartz (&scaled_font->scale_inverse, &invTextTransform);
+
+- CGContextSetTextMatrix (surface->cgContext, CGAffineTransformIdentity);
++ /* scaled_font->scale_inverse * scale(1,-1) */
++ invTextTransform = CGAffineTransformMake (scaled_font->scale_inverse.xx,
++ -scaled_font->scale_inverse.yx,
++ scaled_font->scale_inverse.xy,
++ -scaled_font->scale_inverse.yy,
++ 0.0, 0.0);
+
+- /* Convert our glyph positions to glyph advances. We need n-1 advances,
+- * since the advance at index 0 is applied after glyph 0. */
+- xprev = glyphs[0].x;
+- yprev = glyphs[0].y;
+-
+- cg_glyphs[0] = glyphs[0].index;
+-
+- for (i = 1; i < num_glyphs; i++) {
+- cairo_quartz_float_t xf = glyphs[i].x;
+- cairo_quartz_float_t yf = glyphs[i].y;
+- cg_glyphs[i] = glyphs[i].index;
+- cg_advances[i - 1] = CGSizeApplyAffineTransform(CGSizeMake (xf - xprev, yf - yprev), invTextTransform);
+- xprev = xf;
+- yprev = yf;
+- }
++ CGContextSetTextMatrix (state.context, CGAffineTransformIdentity);
+
+ /* Translate to the first glyph's position before drawing */
+- ctm = CGContextGetCTM (surface->cgContext);
+- CGContextTranslateCTM (surface->cgContext, glyphs[0].x, glyphs[0].y);
+- CGContextConcatCTM (surface->cgContext, textTransform);
+-
+- CGContextShowGlyphsWithAdvances (surface->cgContext,
+- cg_glyphs,
+- cg_advances,
+- num_glyphs);
+-
+- CGContextSetCTM (surface->cgContext, ctm);
++ ctm = CGContextGetCTM (state.context);
++ CGContextTranslateCTM (state.context, glyphs[0].x, glyphs[0].y);
++ CGContextConcatCTM (state.context, textTransform);
++
++ if (CTFontDrawGlyphsPtr) {
++ /* If CTFontDrawGlyphs is available (i.e. OS X 10.7 or later), we want to use
++ * that in preference to CGContextShowGlyphsWithAdvances so that colored-bitmap
++ * fonts like Apple Color Emoji will render properly.
++ * For this, we need to convert our glyph positions to Core Graphics's CGPoint.
++ * We borrow the cg_advances array, as CGPoint and CGSize are the same size. */
++
++ CGPoint *cg_positions = (CGPoint*) cg_advances;
++ cairo_quartz_float_t origin_x = glyphs[0].x;
++ cairo_quartz_float_t origin_y = glyphs[0].y;
++
++ for (i = 0; i < num_glyphs; i++) {
++ CGPoint pt = CGPointMake (glyphs[i].x - origin_x, glyphs[i].y - origin_y);
++ cg_positions[i] = CGPointApplyAffineTransform (pt, invTextTransform);
++ cg_glyphs[i] = glyphs[i].index;
++ }
+
+- if (action == DO_IMAGE || action == DO_TILED_IMAGE) {
+- _cairo_quartz_draw_image (surface, op, action);
+- } else if (action == DO_SHADING) {
+- CGContextConcatCTM (surface->cgContext, surface->sourceTransform);
+- CGContextDrawShading (surface->cgContext, surface->sourceShading);
++ CTFontDrawGlyphsPtr (_cairo_quartz_scaled_font_get_ct_font_ref (scaled_font),
++ cg_glyphs, cg_positions, num_glyphs, state.context);
++ } else {
++ /* Convert our glyph positions to glyph advances. We need n-1 advances,
++ * since the advance at index 0 is applied after glyph 0. */
++ xprev = glyphs[0].x;
++ yprev = glyphs[0].y;
++
++ cg_glyphs[0] = glyphs[0].index;
++
++ for (i = 1; i < num_glyphs; i++) {
++ cairo_quartz_float_t xf = glyphs[i].x;
++ cairo_quartz_float_t yf = glyphs[i].y;
++ cg_glyphs[i] = glyphs[i].index;
++ cg_advances[i - 1] = CGSizeApplyAffineTransform(CGSizeMake (xf - xprev, yf - yprev), invTextTransform);
++ xprev = xf;
++ yprev = yf;
++ }
++
++ CGContextShowGlyphsWithAdvances (state.context,
++ cg_glyphs,
++ cg_advances,
++ num_glyphs);
++ }
++
++ CGContextSetCTM (state.context, ctm);
++
++ if (state.action == DO_IMAGE || state.action == DO_TILED_IMAGE ||
++ state.action == DO_LAYER) {
++ _cairo_quartz_draw_image (&state, op);
++ } else if (state.action == DO_SHADING) {
++ CGContextConcatCTM (state.context, state.transform);
++ CGContextDrawShading (state.context, state.shading);
+ }
+
+ BAIL:
+- _cairo_quartz_teardown_source (surface, source);
+-
+ if (didForceFontSmoothing)
+- CGContextSetAllowsFontSmoothingPtr (surface->cgContext, FALSE);
++ CGContextSetAllowsFontSmoothingPtr (state.context, FALSE);
+
+- CGContextRestoreGState (surface->cgContext);
++ _cairo_quartz_teardown_state (&state);
+
+ if (rv == CAIRO_STATUS_SUCCESS &&
+ cgfref &&
+@@ -2645,10 +2888,17 @@ BAIL:
+
+ ub.u.show_glyphs.isClipping = isClipping;
+ ub.u.show_glyphs.cg_glyphs = cg_glyphs;
+- ub.u.show_glyphs.cg_advances = cg_advances;
++ if (CTFontDrawGlyphsPtr) {
++ /* we're using Core Text API: the cg_advances array was
++ reused (above) for glyph positions */
++ CGPoint *cg_positions = (CGPoint*) cg_advances;
++ ub.u.show_glyphs.u.cg_positions = cg_positions;
++ } else {
++ ub.u.show_glyphs.u.cg_advances = cg_advances;
++ }
+ ub.u.show_glyphs.nglyphs = num_glyphs;
+ ub.u.show_glyphs.textTransform = textTransform;
+- ub.u.show_glyphs.font = cgfref;
++ ub.u.show_glyphs.scaled_font = scaled_font;
+ ub.u.show_glyphs.origin = CGPointMake (glyphs[0].x, glyphs[0].y);
+
+ _cairo_quartz_fixup_unbounded_operation (surface, &ub, scaled_font->options.antialias);
+@@ -2717,7 +2967,7 @@ _cairo_quartz_surface_mask_with_surface
+ cairo_status_t status = CAIRO_STATUS_SUCCESS;
+ CGAffineTransform ctm, mask_matrix;
+
+- status = _cairo_surface_to_cgimage ((cairo_surface_t *) surface, pat_surf, &img);
++ status = _cairo_surface_to_cgimage (pat_surf, &img);
+ if (status)
+ return status;
+ if (img == NULL) {
+@@ -2820,7 +3070,9 @@ _cairo_quartz_surface_mask_cg (void *abs
+ if (unlikely (rv))
+ return rv;
+
+- if (mask->type == CAIRO_PATTERN_TYPE_SOLID) {
++ /* Using CGContextSetAlpha to implement mask alpha doesn't work for all operators. */
++ if (mask->type == CAIRO_PATTERN_TYPE_SOLID &&
++ op == CAIRO_OPERATOR_OVER) {
+ /* This is easy; we just need to paint with the alpha. */
+ cairo_solid_pattern_t *solid_mask = (cairo_solid_pattern_t *) mask;
+
+@@ -2834,8 +3086,11 @@ _cairo_quartz_surface_mask_cg (void *abs
+ /* If we have CGContextClipToMask, we can do more complex masks */
+ if (CGContextClipToMaskPtr) {
+ /* For these, we can skip creating a temporary surface, since we already have one */
+- if (mask->type == CAIRO_PATTERN_TYPE_SURFACE && mask->extend == CAIRO_EXTEND_NONE)
++ /* For some reason this doesn't work reliably on OS X 10.5. See bug 721663. */
++ if (_cairo_quartz_osx_version >= 0x1060 && mask->type == CAIRO_PATTERN_TYPE_SURFACE &&
++ mask->extend == CAIRO_EXTEND_NONE) {
+ return _cairo_quartz_surface_mask_with_surface (surface, op, source, (cairo_surface_pattern_t *) mask, clip);
++ }
+
+ return _cairo_quartz_surface_mask_with_generic (surface, op, source, mask, clip);
+ }
+@@ -2920,13 +3175,24 @@ _cairo_quartz_surface_clipper_intersect_
+ return CAIRO_STATUS_SUCCESS;
+ }
+
++static cairo_status_t
++_cairo_quartz_surface_mark_dirty_rectangle (void *abstract_surface,
++ int x, int y,
++ int width, int height)
++{
++ cairo_quartz_surface_t *surface = (cairo_quartz_surface_t *) abstract_surface;
++ _cairo_quartz_surface_will_change (surface);
++ return CAIRO_STATUS_SUCCESS;
++}
++
++
+ // XXXtodo implement show_page; need to figure out how to handle begin/end
+
+ static const struct _cairo_surface_backend cairo_quartz_surface_backend = {
+ CAIRO_SURFACE_TYPE_QUARTZ,
+ _cairo_quartz_surface_create_similar,
+ _cairo_quartz_surface_finish,
+- _cairo_quartz_surface_acquire_source_image,
++ _cairo_quartz_surface_acquire_image,
+ _cairo_quartz_surface_release_source_image,
+ _cairo_quartz_surface_acquire_dest_image,
+ _cairo_quartz_surface_release_dest_image,
+@@ -2942,7 +3208,7 @@ static const struct _cairo_surface_backe
+ NULL, /* old_show_glyphs */
+ NULL, /* get_font_options */
+ NULL, /* flush */
+- NULL, /* mark_dirty_rectangle */
++ _cairo_quartz_surface_mark_dirty_rectangle,
+ NULL, /* scaled_font_fini */
+ NULL, /* scaled_glyph_fini */
+
+@@ -2952,7 +3218,7 @@ static const struct _cairo_surface_backe
+ _cairo_quartz_surface_fill,
+ _cairo_quartz_surface_show_glyphs,
+
+- _cairo_quartz_surface_snapshot,
++ NULL, /* snapshot */
+ NULL, /* is_similar */
+ NULL /* fill_stroke */
+ };
+@@ -3004,6 +3270,9 @@ _cairo_quartz_surface_create_internal (C
+
+ surface->imageData = NULL;
+ surface->imageSurfaceEquiv = NULL;
++ surface->bitmapContextImage = NULL;
++ surface->cgLayer = NULL;
++ surface->ownsData = TRUE;
+
+ return surface;
+ }
+@@ -3056,6 +3325,81 @@ cairo_quartz_surface_create_for_cg_conte
+ }
+
+ /**
++ * cairo_quartz_cglayer_surface_create_similar
++ * @surface: The returned surface can be efficiently drawn into this
++ * destination surface (if tiling is not used)."
++ * @content: the content type of the surface
++ * @width: width of the surface, in pixels
++ * @height: height of the surface, in pixels
++ *
++ * Creates a Quartz surface backed by a CGLayer, if the given surface
++ * is a Quartz surface; the CGLayer is created to match the surface's
++ * Quartz context. Otherwise just calls cairo_surface_create_similar.
++ * The returned surface can be efficiently blitted to the given surface,
++ * but tiling and 'extend' modes other than NONE are not so efficient.
++ *
++ * Return value: the newly created surface.
++ *
++ * Since: 1.10
++ **/
++cairo_surface_t *
++cairo_quartz_surface_create_cg_layer (cairo_surface_t *surface,
++ cairo_content_t content,
++ unsigned int width,
++ unsigned int height)
++{
++ cairo_quartz_surface_t *surf;
++ CGLayerRef layer;
++ CGContextRef ctx;
++ CGContextRef cgContext;
++
++ cgContext = cairo_quartz_surface_get_cg_context (surface);
++ if (!cgContext)
++ return cairo_surface_create_similar (surface, content,
++ width, height);
++
++
++ if (!_cairo_quartz_verify_surface_size(width, height))
++ return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_INVALID_SIZE));
++
++ /* If we pass zero width or height into CGLayerCreateWithContext below,
++ * it will fail.
++ */
++ if (width == 0 || height == 0) {
++ return (cairo_surface_t*)
++ _cairo_quartz_surface_create_internal (NULL, content,
++ width, height);
++ }
++
++ layer = CGLayerCreateWithContext (cgContext,
++ CGSizeMake (width, height),
++ NULL);
++ if (!layer)
++ return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_NO_MEMORY));
++
++ ctx = CGLayerGetContext (layer);
++ CGContextSetInterpolationQuality (ctx, kCGInterpolationNone);
++ /* Flip it when we draw into it, so that when we finally composite it
++ * to a flipped target, the directions match and Quartz will optimize
++ * the composition properly
++ */
++ CGContextTranslateCTM (ctx, 0, height);
++ CGContextScaleCTM (ctx, 1, -1);
++
++ CGContextRetain (ctx);
++ surf = _cairo_quartz_surface_create_internal (ctx, content,
++ width, height);
++ if (surf->base.status) {
++ CGLayerRelease (layer);
++ // create_internal will have set an error
++ return (cairo_surface_t*) surf;
++ }
++ surf->cgLayer = layer;
++
++ return (cairo_surface_t *) surf;
++}
++
++/**
+ * cairo_quartz_surface_create
+ * @format: format of pixels in the surface to create
+ * @width: width of the surface, in pixels
+@@ -3075,13 +3419,93 @@ cairo_quartz_surface_create (cairo_forma
+ unsigned int width,
+ unsigned int height)
+ {
++ int stride;
++ unsigned char *data;
++
++ if (!_cairo_quartz_verify_surface_size(width, height))
++ return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_INVALID_SIZE));
++
++ if (width == 0 || height == 0) {
++ return (cairo_surface_t*) _cairo_quartz_surface_create_internal (NULL, _cairo_content_from_format (format),
++ width, height);
++ }
++
++ if (format == CAIRO_FORMAT_ARGB32 ||
++ format == CAIRO_FORMAT_RGB24)
++ {
++ stride = width * 4;
++ } else if (format == CAIRO_FORMAT_A8) {
++ stride = width;
++ } else if (format == CAIRO_FORMAT_A1) {
++ /* I don't think we can usefully support this, as defined by
++ * cairo_format_t -- these are 1-bit pixels stored in 32-bit
++ * quantities.
++ */
++ return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_INVALID_FORMAT));
++ } else {
++ return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_INVALID_FORMAT));
++ }
++
++ /* The Apple docs say that for best performance, the stride and the data
++ * pointer should be 16-byte aligned. malloc already aligns to 16-bytes,
++ * so we don't have to anything special on allocation.
++ */
++ stride = (stride + 15) & ~15;
++
++ data = _cairo_malloc_ab (height, stride);
++ if (!data) {
++ return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_NO_MEMORY));
++ }
++
++ /* zero the memory to match the image surface behaviour */
++ memset (data, 0, height * stride);
++
++ cairo_quartz_surface_t *surf;
++ surf = (cairo_quartz_surface_t *) cairo_quartz_surface_create_for_data
++ (data, format, width, height, stride);
++ if (surf->base.status) {
++ free (data);
++ return (cairo_surface_t *) surf;
++ }
++
++ // We created this data, so we can delete it.
++ surf->ownsData = TRUE;
++
++ return (cairo_surface_t *) surf;
++}
++
++/**
++ * cairo_quartz_surface_create_for_data
++ * @data: a pointer to a buffer supplied by the application in which
++ * to write contents. This pointer must be suitably aligned for any
++ * kind of variable, (for example, a pointer returned by malloc).
++ * @format: format of pixels in the surface to create
++ * @width: width of the surface, in pixels
++ * @height: height of the surface, in pixels
++ *
++ * Creates a Quartz surface backed by a CGBitmap. The surface is
++ * created using the Device RGB (or Device Gray, for A8) color space.
++ * All Cairo operations, including those that require software
++ * rendering, will succeed on this surface.
++ *
++ * Return value: the newly created surface.
++ *
++ * Since: 1.12
++ **/
++cairo_surface_t *
++cairo_quartz_surface_create_for_data (unsigned char *data,
++ cairo_format_t format,
++ unsigned int width,
++ unsigned int height,
++ unsigned int stride)
++{
+ cairo_quartz_surface_t *surf;
+ CGContextRef cgc;
+ CGColorSpaceRef cgColorspace;
+ CGBitmapInfo bitinfo;
+- void *imageData;
+- int stride;
++ void *imageData = data;
+ int bitsPerComponent;
++ unsigned int i;
+
+ // verify width and height of surface
+ if (!_cairo_quartz_verify_surface_size(width, height))
+@@ -3102,10 +3526,8 @@ cairo_quartz_surface_create (cairo_forma
+ else
+ bitinfo |= kCGImageAlphaNoneSkipFirst;
+ bitsPerComponent = 8;
+- stride = width * 4;
+ } else if (format == CAIRO_FORMAT_A8) {
+ cgColorspace = NULL;
+- stride = width;
+ bitinfo = kCGImageAlphaOnly;
+ bitsPerComponent = 8;
+ } else if (format == CAIRO_FORMAT_A1) {
+@@ -3118,21 +3540,6 @@ cairo_quartz_surface_create (cairo_forma
+ return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_INVALID_FORMAT));
+ }
+
+- /* The Apple docs say that for best performance, the stride and the data
+- * pointer should be 16-byte aligned. malloc already aligns to 16-bytes,
+- * so we don't have to anything special on allocation.
+- */
+- stride = (stride + 15) & ~15;
+-
+- imageData = _cairo_malloc_ab (height, stride);
+- if (!imageData) {
+- CGColorSpaceRelease (cgColorspace);
+- return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_NO_MEMORY));
+- }
+-
+- /* zero the memory to match the image surface behaviour */
+- memset (imageData, 0, height * stride);
+-
+ cgc = CGBitmapContextCreate (imageData,
+ width,
+ height,
+@@ -3161,7 +3568,19 @@ cairo_quartz_surface_create (cairo_forma
+ }
+
+ surf->imageData = imageData;
+- surf->imageSurfaceEquiv = cairo_image_surface_create_for_data (imageData, format, width, height, stride);
++
++ cairo_surface_t* tmpImageSurfaceEquiv =
++ cairo_image_surface_create_for_data (imageData, format,
++ width, height, stride);
++
++ if (cairo_surface_status (tmpImageSurfaceEquiv)) {
++ // Tried & failed to create an imageSurfaceEquiv!
++ cairo_surface_destroy (tmpImageSurfaceEquiv);
++ surf->imageSurfaceEquiv = NULL;
++ } else {
++ surf->imageSurfaceEquiv = tmpImageSurfaceEquiv;
++ surf->ownsData = FALSE;
++ }
+
+ return (cairo_surface_t *) surf;
+ }
+@@ -3193,6 +3612,74 @@ _cairo_surface_is_quartz (const cairo_su
+ return surface->backend == &cairo_quartz_surface_backend;
+ }
+
++CGContextRef
++cairo_quartz_get_cg_context_with_clip (cairo_t *cr)
++{
++
++ cairo_surface_t *surface = cr->gstate->target;
++ cairo_clip_t *clip = &cr->gstate->clip;
++ cairo_status_t status;
++
++ cairo_quartz_surface_t *quartz = (cairo_quartz_surface_t*)surface;
++
++ if (cairo_surface_get_type(surface) != CAIRO_SURFACE_TYPE_QUARTZ)
++ return NULL;
++
++ if (!clip->path) {
++ if (clip->all_clipped) {
++ /* Save the state before we set an empty clip rect so that
++ * our previous clip will be restored */
++
++ /* _cairo_surface_clipper_set_clip doesn't deal with
++ * clip->all_clipped because drawing is normally discarded earlier */
++ CGRect empty = {{0,0}, {0,0}};
++ CGContextClipToRect (quartz->cgContext, empty);
++ CGContextSaveGState (quartz->cgContext);
++
++ return quartz->cgContext;
++ }
++
++ /* an empty clip is represented by NULL */
++ clip = NULL;
++ }
++
++ status = _cairo_surface_clipper_set_clip (&quartz->clipper, clip);
++
++ /* Save the state after we set the clip so that it persists
++ * after we restore */
++ CGContextSaveGState (quartz->cgContext);
++
++ if (unlikely (status))
++ return NULL;
++
++ return quartz->cgContext;
++}
++
++void
++cairo_quartz_finish_cg_context_with_clip (cairo_t *cr)
++{
++ cairo_surface_t *surface = cr->gstate->target;
++
++ cairo_quartz_surface_t *quartz = (cairo_quartz_surface_t*)surface;
++
++ if (cairo_surface_get_type(surface) != CAIRO_SURFACE_TYPE_QUARTZ)
++ return;
++
++ CGContextRestoreGState (quartz->cgContext);
++}
++
++cairo_surface_t *
++cairo_quartz_surface_get_image (cairo_surface_t *surface)
++{
++ cairo_quartz_surface_t *quartz = (cairo_quartz_surface_t *)surface;
++ cairo_image_surface_t *image;
++
++ if (_cairo_quartz_get_image(quartz, &image))
++ return NULL;
++
++ return (cairo_surface_t *)image;
++}
++
+ /* Debug stuff */
+
+ #ifdef QUARTZ_DEBUG
+--- a/src/cairo-quartz.h 2012-11-13 18:20:00.000000000 -0800
++++ b/src/cairo-quartz.h 2012-11-13 18:06:56.000000000 -0800
+@@ -50,6 +50,19 @@ cairo_quartz_surface_create (cairo_forma
+ unsigned int height);
+
+ cairo_public cairo_surface_t *
++cairo_quartz_surface_create_for_data (unsigned char *data,
++ cairo_format_t format,
++ unsigned int width,
++ unsigned int height,
++ unsigned int stride);
++
++cairo_public cairo_surface_t *
++cairo_quartz_surface_create_cg_layer (cairo_surface_t *surface,
++ cairo_content_t content,
++ unsigned int width,
++ unsigned int height);
++
++cairo_public cairo_surface_t *
+ cairo_quartz_surface_create_for_cg_context (CGContextRef cgContext,
+ unsigned int width,
+ unsigned int height);
+@@ -57,6 +70,15 @@ cairo_quartz_surface_create_for_cg_conte
+ cairo_public CGContextRef
+ cairo_quartz_surface_get_cg_context (cairo_surface_t *surface);
+
++cairo_public CGContextRef
++cairo_quartz_get_cg_context_with_clip (cairo_t *cr);
++
++cairo_public void
++cairo_quartz_finish_cg_context_with_clip (cairo_t *cr);
++
++cairo_public cairo_surface_t *
++cairo_quartz_surface_get_image (cairo_surface_t *surface);
++
+ #if CAIRO_HAS_QUARTZ_FONT
+
+ /*
+@@ -66,8 +88,10 @@ cairo_quartz_surface_get_cg_context (cai
+ cairo_public cairo_font_face_t *
+ cairo_quartz_font_face_create_for_cgfont (CGFontRef font);
+
++#ifndef __LP64__
+ cairo_public cairo_font_face_t *
+ cairo_quartz_font_face_create_for_atsu_font_id (ATSUFontID font_id);
++#endif
+
+ #endif /* CAIRO_HAS_QUARTZ_FONT */
\ No newline at end of file
--- /dev/null
+From 9d460070fca2c0a61aac60ba7cad6f9a6af82309 Mon Sep 17 00:00:00 2001
+From: Andrea Canciani <ranma42@gmail.com>
+Date: Tue, 9 Dec 2014 16:13:00 +0100
+Subject: [PATCH] quartz: Remove call to obsolete CGFontGetGlyphPath
+
+CGFontGetGlyphPath was not public and is not available anymore on
+modern OSX/iOS systems. The same functionality is available through
+the CoreText API since OSX 10.5.
+
+Based on a patch by Simon Cozens.
+
+Fixes https://bugs.freedesktop.org/show_bug.cgi?id=84324
+---
+ src/cairo-quartz-font.c | 10 ++++------
+ 1 file changed, 4 insertions(+), 6 deletions(-)
+
+diff --git a/src/cairo-quartz-font.c b/src/cairo-quartz-font.c
+index e6a379a..02f3426 100644
+--- a/src/cairo-quartz-font.c
++++ b/src/cairo-quartz-font.c
+@@ -81,9 +81,6 @@ static void (*CGFontGetGlyphsForUnicharsPtr) (CGFontRef, const UniChar[], const
+ static void (*CGContextSetAllowsFontSmoothingPtr) (CGContextRef, bool) = NULL;
+ static bool (*CGContextGetAllowsFontSmoothingPtr) (CGContextRef) = NULL;
+
+-/* Not public in the least bit */
+-static CGPathRef (*CGFontGetGlyphPathPtr) (CGFontRef fontRef, CGAffineTransform *textTransform, int unknown, CGGlyph glyph) = NULL;
+-
+ /* CGFontGetHMetrics isn't public, but the other functions are public/present in 10.5 */
+ typedef struct {
+ int ascent;
+@@ -127,7 +124,6 @@ quartz_font_ensure_symbols(void)
+ /* These have the same name in 10.4 and 10.5 */
+ CGFontGetUnitsPerEmPtr = dlsym(RTLD_DEFAULT, "CGFontGetUnitsPerEm");
+ CGFontGetGlyphAdvancesPtr = dlsym(RTLD_DEFAULT, "CGFontGetGlyphAdvances");
+- CGFontGetGlyphPathPtr = dlsym(RTLD_DEFAULT, "CGFontGetGlyphPath");
+
+ CGFontGetHMetricsPtr = dlsym(RTLD_DEFAULT, "CGFontGetHMetrics");
+ CGFontGetAscentPtr = dlsym(RTLD_DEFAULT, "CGFontGetAscent");
+@@ -144,7 +140,6 @@ quartz_font_ensure_symbols(void)
+ CGFontGetGlyphsForUnicharsPtr &&
+ CGFontGetUnitsPerEmPtr &&
+ CGFontGetGlyphAdvancesPtr &&
+- CGFontGetGlyphPathPtr &&
+ (CGFontGetHMetricsPtr || (CGFontGetAscentPtr && CGFontGetDescentPtr && CGFontGetLeadingPtr)))
+ _cairo_quartz_font_symbols_present = TRUE;
+
+@@ -550,6 +545,7 @@ _cairo_quartz_init_glyph_path (cairo_quartz_scaled_font_t *font,
+ CGGlyph glyph = _cairo_quartz_scaled_glyph_index (scaled_glyph);
+ CGAffineTransform textMatrix;
+ CGPathRef glyphPath;
++ CTFontRef ctFont;
+ cairo_path_fixed_t *path;
+
+ if (glyph == INVALID_GLYPH) {
+@@ -564,7 +560,9 @@ _cairo_quartz_init_glyph_path (cairo_quartz_scaled_font_t *font,
+ -font->base.scale.yy,
+ 0, 0);
+
+- glyphPath = CGFontGetGlyphPathPtr (font_face->cgFont, &textMatrix, 0, glyph);
++ ctFont = CTFontCreateWithGraphicsFont (font_face->cgFont, 1.0, NULL, NULL);
++ glyphPath = CTFontCreatePathForGlyph (ctFont, glyph, &textMatrix);
++ CFRelease (ctFont);
+ if (!glyphPath)
+ return CAIRO_INT_STATUS_UNSUPPORTED;
+
+--
+1.9.3 (Apple Git-50)
--- /dev/null
+diff --git a/src/cairo-quartz-font.c b/src/cairo-quartz-font.c
+index a9bbbdc..48eb071 100644
+--- a/src/cairo-quartz-font.c
++++ b/src/cairo-quartz-font.c
+@@ -95,6 +95,10 @@ static int (*CGFontGetAscentPtr) (CGFontRef fontRef) = NULL;
+ static int (*CGFontGetDescentPtr) (CGFontRef fontRef) = NULL;
+ static int (*CGFontGetLeadingPtr) (CGFontRef fontRef) = NULL;
+
++/* CTFontCreateWithGraphicsFont is not public until 10.5. */
++typedef const struct __CTFontDescriptor *CTFontDescriptorRef;
++static CTFontRef (*CTFontCreateWithGraphicsFontPtr) (CGFontRef, CGFloat, const CGAffineTransform *, CTFontDescriptorRef) = NULL;
++
+ /* Not public anymore in 64-bits nor in 10.7 */
+ static ATSFontRef (*FMGetATSFontRefFromFontPtr) (FMFont iFont) = NULL;
+
+@@ -137,6 +141,8 @@ quartz_font_ensure_symbols(void)
+ CGContextGetAllowsFontSmoothingPtr = dlsym(RTLD_DEFAULT, "CGContextGetAllowsFontSmoothing");
+ CGContextSetAllowsFontSmoothingPtr = dlsym(RTLD_DEFAULT, "CGContextSetAllowsFontSmoothing");
+
++ CTFontCreateWithGraphicsFontPtr = dlsym(RTLD_DEFAULT, "CTFontCreateWithGraphicsFont");
++
+ FMGetATSFontRefFromFontPtr = dlsym(RTLD_DEFAULT, "FMGetATSFontRefFromFont");
+
+ if ((CGFontCreateWithFontNamePtr || CGFontCreateWithNamePtr) &&
+@@ -162,6 +168,7 @@ struct _cairo_quartz_font_face {
+ cairo_font_face_t base;
+
+ CGFontRef cgFont;
++ CTFontRef ctFont;
+ };
+
+ /*
+@@ -246,6 +253,10 @@ _cairo_quartz_font_face_destroy (void *abstract_face)
+ {
+ cairo_quartz_font_face_t *font_face = (cairo_quartz_font_face_t*) abstract_face;
+
++ if (font_face->ctFont) {
++ CFRelease (font_face->ctFont);
++ }
++
+ CGFontRelease (font_face->cgFont);
+ }
+
+@@ -370,6 +381,12 @@ cairo_quartz_font_face_create_for_cgfont (CGFontRef font)
+
+ font_face->cgFont = CGFontRetain (font);
+
++ if (CTFontCreateWithGraphicsFontPtr) {
++ font_face->ctFont = CTFontCreateWithGraphicsFontPtr (font, 1.0, NULL, NULL);
++ } else {
++ font_face->ctFont = NULL;
++ }
++
+ _cairo_font_face_init (&font_face->base, &_cairo_quartz_font_face_backend);
+
+ return &font_face->base;
+@@ -812,6 +829,14 @@ _cairo_quartz_scaled_font_get_cg_font_ref (cairo_scaled_font_t *abstract_font)
+ return ffont->cgFont;
+ }
+
++CTFontRef
++_cairo_quartz_scaled_font_get_ct_font_ref (cairo_scaled_font_t *abstract_font)
++{
++ cairo_quartz_font_face_t *ffont = _cairo_quartz_scaled_to_face(abstract_font);
++
++ return ffont->ctFont;
++}
++
+ /*
+ * compat with old ATSUI backend
+ */
+diff --git a/src/cairo-quartz-private.h b/src/cairo-quartz-private.h
+index f841a49..3c1e5aa 100644
+--- a/src/cairo-quartz-private.h
++++ b/src/cairo-quartz-private.h
+@@ -57,6 +57,9 @@ typedef enum {
+ DO_TILED_IMAGE
+ } cairo_quartz_action_t;
+
++/* define CTFontRef for pre-10.5 SDKs */
++typedef const struct __CTFont *CTFontRef;
++
+ typedef struct cairo_quartz_surface {
+ cairo_surface_t base;
+
+@@ -97,6 +100,9 @@ CairoQuartzCreateCGImage (cairo_format_t format,
+ cairo_private CGFontRef
+ _cairo_quartz_scaled_font_get_cg_font_ref (cairo_scaled_font_t *sfont);
+
++CTFontRef
++_cairo_quartz_scaled_font_get_ct_font_ref (cairo_scaled_font_t *sfont);
++
+ #else
+
+ # error Cairo was not compiled with support for the quartz backend
+diff --git a/src/cairo-quartz-surface.c b/src/cairo-quartz-surface.c
+index 1e2bbec..417255c 100644
+--- a/src/cairo-quartz-surface.c
++++ b/src/cairo-quartz-surface.c
+@@ -123,6 +123,9 @@ static void (*CGContextSetAllowsFontSmoothingPtr) (CGContextRef, bool) = NULL;
+ static unsigned int (*CGContextGetTypePtr) (CGContextRef) = NULL;
+ static bool (*CGContextGetAllowsFontSmoothingPtr) (CGContextRef) = NULL;
+
++/* CTFontDrawGlyphs is not available until 10.7 */
++static void (*CTFontDrawGlyphsPtr) (CTFontRef, const CGGlyph[], const CGPoint[], size_t, CGContextRef) = NULL;
++
+ static cairo_bool_t _cairo_quartz_symbol_lookup_done = FALSE;
+
+ /*
+@@ -155,6 +158,8 @@ static void quartz_ensure_symbols (void)
+ CGContextGetAllowsFontSmoothingPtr = dlsym (RTLD_DEFAULT, "CGContextGetAllowsFontSmoothing");
+ CGContextSetAllowsFontSmoothingPtr = dlsym (RTLD_DEFAULT, "CGContextSetAllowsFontSmoothing");
+
++ CTFontDrawGlyphsPtr = dlsym(RTLD_DEFAULT, "CTFontDrawGlyphs");
++
+ _cairo_quartz_symbol_lookup_done = TRUE;
+ }
+
+@@ -2026,30 +2031,50 @@ _cairo_quartz_cg_glyphs (const cairo_compositor_t *compositor,
+ CGContextSetTextPosition (state.cgMaskContext, 0.0, 0.0);
+ CGContextSetTextMatrix (state.cgMaskContext, CGAffineTransformIdentity);
+
+- /* Convert our glyph positions to glyph advances. We need n-1 advances,
+- * since the advance at index 0 is applied after glyph 0. */
+- xprev = glyphs[0].x;
+- yprev = glyphs[0].y;
+-
+- cg_glyphs[0] = glyphs[0].index;
+-
+- for (i = 1; i < num_glyphs; i++) {
+- cairo_quartz_float_t xf = glyphs[i].x;
+- cairo_quartz_float_t yf = glyphs[i].y;
+- cg_glyphs[i] = glyphs[i].index;
+- cg_advances[i - 1] = CGSizeApplyAffineTransform (CGSizeMake (xf - xprev, yf - yprev), invTextTransform);
+- xprev = xf;
+- yprev = yf;
+- }
+-
+ /* Translate to the first glyph's position before drawing */
+ CGContextTranslateCTM (state.cgMaskContext, glyphs[0].x, glyphs[0].y);
+ CGContextConcatCTM (state.cgMaskContext, textTransform);
+
+- CGContextShowGlyphsWithAdvances (state.cgMaskContext,
+- cg_glyphs,
+- cg_advances,
+- num_glyphs);
++ if (CTFontDrawGlyphsPtr) {
++ /* If CTFontDrawGlyphs is available (i.e. OS X 10.7 or later), we want to use
++ * that in preference to CGContextShowGlyphsWithAdvances so that colored-bitmap
++ * fonts like Apple Color Emoji will render properly.
++ * For this, we need to convert our glyph positions to Core Graphics's CGPoint.
++ * We borrow the cg_advances array, as CGPoint and CGSize are the same size. */
++
++ CGPoint *cg_positions = (CGPoint*) cg_advances;
++ cairo_quartz_float_t origin_x = glyphs[0].x;
++ cairo_quartz_float_t origin_y = glyphs[0].y;
++
++ for (i = 0; i < num_glyphs; i++) {
++ CGPoint pt = CGPointMake (glyphs[i].x - origin_x, glyphs[i].y - origin_y);
++ cg_positions[i] = CGPointApplyAffineTransform (pt, invTextTransform);
++ cg_glyphs[i] = glyphs[i].index;
++ }
++
++ CTFontDrawGlyphsPtr (_cairo_quartz_scaled_font_get_ct_font_ref (scaled_font),
++ cg_glyphs, cg_positions, num_glyphs, state.cgMaskContext);
++ } else {
++ /* Convert our glyph positions to glyph advances. We need n-1 advances,
++ * since the advance at index 0 is applied after glyph 0. */
++ xprev = glyphs[0].x;
++ yprev = glyphs[0].y;
++
++ cg_glyphs[0] = glyphs[0].index;
++
++ for (i = 1; i < num_glyphs; i++) {
++ cairo_quartz_float_t xf = glyphs[i].x;
++ cairo_quartz_float_t yf = glyphs[i].y;
++ cg_glyphs[i] = glyphs[i].index;
++ cg_advances[i - 1] = CGSizeApplyAffineTransform (CGSizeMake (xf - xprev, yf - yprev), invTextTransform);
++ xprev = xf;
++ yprev = yf;
++ }
++ CGContextShowGlyphsWithAdvances (state.cgMaskContext,
++ cg_glyphs,
++ cg_advances,
++ num_glyphs);
++ }
+
+ CGContextConcatCTM (state.cgMaskContext, invTextTransform);
+ CGContextTranslateCTM (state.cgMaskContext, -glyphs[0].x, -glyphs[0].y);
--- /dev/null
+--- a/src/cairo-quartz-surface.c 2013-03-28 19:19:15.000000000 -0400
++++ b/src/cairo-quartz-surface.c 2013-03-28 19:19:28.000000000 -0400
+@@ -1379,7 +1379,6 @@
+ CGContextDrawLayerInRect (surface->cgContext,
+ state->clipRect,
+ state->layer);
+- CGContextRelease (state->cgDrawContext);
+ CGLayerRelease (state->layer);
+ }
--- /dev/null
+#!/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
--- /dev/null
+From b02965711a387b015a6af4b9d26bbdabf10fc5b4 Mon Sep 17 00:00:00 2001
+From: Mikayla Hutchinson <m.j.hutchinson@gmail.com>
+Date: Mon, 1 Aug 2016 13:47:41 -0400
+Subject: [PATCH 1/2] Remove xbuild workarounds
+
+They do not work Mono 4.6+ where the underlying bug is fixed
+---
+ src/FSharpSource.targets | 8 --------
+ 1 file changed, 8 deletions(-)
+
+diff --git a/src/FSharpSource.targets b/src/FSharpSource.targets
+index eb57269..ea3656f 100755
+--- a/src/FSharpSource.targets
++++ b/src/FSharpSource.targets
+@@ -306,8 +306,6 @@ Some other NuGET monikers to support in the future, see http://docs.nuget.org/do
+ <DefineConstants>$(DefineConstants);PUT_TYPE_PROVIDERS_IN_FSCORE</DefineConstants>
+ <DefineConstants>$(DefineConstants);QUERIES_IN_FSLIB</DefineConstants>
+
+- <!-- An explicit search path seems to be needed on Mono 3.4.0 otherwise the reference assemblies for the profile aren't found -->
+- <AssemblySearchPaths Condition="Exists('$(MSBuildExtensionsPath32)\..\xbuild-frameworks\.NETPortable\v4.0\mscorlib.dll')">$(MSBuildExtensionsPath32)\..\xbuild-frameworks\.NETPortable\v4.0</AssemblySearchPaths>
+ </PropertyGroup>
+
+ <!-- Target Portable -->
+@@ -348,8 +346,6 @@ Some other NuGET monikers to support in the future, see http://docs.nuget.org/do
+ <TargetProfile>netcore</TargetProfile>
+ <TargetFrameworkProfile>Profile7</TargetFrameworkProfile>
+ <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
+- <!-- An explicit search path seems to be needed on Mono 3.4.0 otherwise the reference assemblies for the profile aren't found -->
+- <AssemblySearchPaths Condition="Exists('$(MSBuildExtensionsPath32)\..\xbuild-frameworks\.NETPortable\v4.5\System.Runtime.dll')">$(MSBuildExtensionsPath32)\..\xbuild-frameworks\.NETPortable\v4.5</AssemblySearchPaths>
+ <OtherFlags>$(OtherFlags) --targetprofile:netcore</OtherFlags>
+ </PropertyGroup>
+
+@@ -389,8 +385,6 @@ Some other NuGET monikers to support in the future, see http://docs.nuget.org/do
+ <TargetProfile>netcore</TargetProfile>
+ <TargetFrameworkProfile>Profile78</TargetFrameworkProfile>
+ <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
+- <!-- An explicit search path seems to be needed on Mono 3.4.0 otherwise the reference assemblies for the profile aren't found -->
+- <AssemblySearchPaths Condition="Exists('$(MSBuildExtensionsPath32)\..\xbuild-frameworks\.NETPortable\v4.5\System.Runtime.dll')">$(MSBuildExtensionsPath32)\..\xbuild-frameworks\.NETPortable\v4.5</AssemblySearchPaths>
+ <OtherFlags>$(OtherFlags) --targetprofile:netcore</OtherFlags>
+ </PropertyGroup>
+
+@@ -430,8 +424,6 @@ Some other NuGET monikers to support in the future, see http://docs.nuget.org/do
+ <TargetProfile>netcore</TargetProfile>
+ <TargetFrameworkProfile>Profile259</TargetFrameworkProfile>
+ <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
+- <!-- An explicit search path seems to be needed on Mono 3.4.0 otherwise the reference assemblies for the profile aren't found -->
+- <AssemblySearchPaths Condition="Exists('$(MSBuildExtensionsPath32)\..\xbuild-frameworks\.NETPortable\v4.5\System.Runtime.dll')">$(MSBuildExtensionsPath32)\..\xbuild-frameworks\.NETPortable\v4.5</AssemblySearchPaths>
+ <OtherFlags>$(OtherFlags) --targetprofile:netcore</OtherFlags>
+ </PropertyGroup>
+
+--
+2.7.4 (Apple Git-66)
+
+
+From e57cb16ee7927bb31b2c9b63e1b2e394bf9f9932 Mon Sep 17 00:00:00 2001
+From: Mikayla Hutchinson <m.j.hutchinson@gmail.com>
+Date: Mon, 1 Aug 2016 13:48:23 -0400
+Subject: [PATCH 2/2] Remove dead code
+
+Remove Mono workarounds for missing files. Mono has been
+shipping the files for some time now.
+---
+ .../FSharp.Build/Microsoft.Portable.FSharp.Targets | 52 ----------------------
+ 1 file changed, 52 deletions(-)
+
+diff --git a/src/fsharp/FSharp.Build/Microsoft.Portable.FSharp.Targets b/src/fsharp/FSharp.Build/Microsoft.Portable.FSharp.Targets
+index 8c99ab6..ee5f9b1 100644
+--- a/src/fsharp/FSharp.Build/Microsoft.Portable.FSharp.Targets
++++ b/src/fsharp/FSharp.Build/Microsoft.Portable.FSharp.Targets
+@@ -24,60 +24,8 @@ Copyright (C) Microsoft Corporation. All rights reserved.
+ Condition="Exists('$(MSBuildExtensionsPath32)\Microsoft\Portable\v4.0\Microsoft.Portable.Common.targets') AND
+ !Exists('$(MSBuildExtensionsPath32)\Microsoft\Portable\Microsoft.Portable.Core.props')"/>
+
+-
+- <!-- Try to do it ourselves - Explicitly include contents of Microsoft.Portable.Core.props + Microsoft.FSharp.Targets + Microsoft.Portable.Core.targets -->
+- <!-- START MONO 3.2.7 WORKAROUND PART 1 -->
+- <PropertyGroup
+- Condition="(!Exists('$(MSBuildExtensionsPath32)\Microsoft\Portable\v4.0\Microsoft.Portable.Common.targets')) AND
+- (!Exists('$(MSBuildExtensionsPath32)\Microsoft\Portable\Microsoft.Portable.Core.props'))">
+- <AvailablePlatforms>Any CPU</AvailablePlatforms>
+-
+- <TargetPlatformIdentifier>Portable</TargetPlatformIdentifier>
+- <TargetFrameworkIdentifier>.NETPortable</TargetFrameworkIdentifier>
+- <TargetFrameworkMonikerDisplayName>.NET Portable Subset</TargetFrameworkMonikerDisplayName>
+-
+- <AddAdditionalExplicitAssemblyReferences>false</AddAdditionalExplicitAssemblyReferences>
+- <NoStdLib>true</NoStdLib>
+-
+- <ImplicitlyExpandTargetFramework Condition="'$(ImplicitlyExpandTargetFramework)' == '' ">true</ImplicitlyExpandTargetFramework>
+- </PropertyGroup>
+- <!-- END MONO 3.2.7 WORKAROUND PART 1 -->
+-
+-
+ <Import Project="$(MSBuildExtensionsPath32)\..\Microsoft SDKs\F#\3.1\Framework\v4.0\Microsoft.FSharp.Targets" />
+
+-
+- <!-- START MONO 3.2.7 WORKAROUND PART 2 -->
+- <PropertyGroup
+- Condition="(!Exists('$(MSBuildExtensionsPath32)\Microsoft\Portable\v4.0\Microsoft.Portable.Common.targets')) AND
+- (!Exists('$(MSBuildExtensionsPath32)\Microsoft\Portable\Microsoft.Portable.Core.props'))" >
+- <ResolveReferencesDependsOn>
+- $(ResolveReferencesDependsOn);
+- ImplicitlyExpandTargetFramework;
+- </ResolveReferencesDependsOn>
+-
+- <ImplicitlyExpandTargetFrameworkDependsOn>
+- $(ImplicitlyExpandTargetFrameworkDependsOn);
+- GetReferenceAssemblyPaths
+- </ImplicitlyExpandTargetFrameworkDependsOn>
+- </PropertyGroup>
+-
+- <Target Name="ImplicitlyExpandTargetFramework"
+- DependsOnTargets="$(ImplicitlyExpandTargetFrameworkDependsOn)"
+- Condition="(!Exists('$(MSBuildExtensionsPath32)\Microsoft\Portable\v4.0\Microsoft.Portable.Common.targets')) AND
+- (!Exists('$(MSBuildExtensionsPath32)\Microsoft\Portable\Microsoft.Portable.Core.props'))" >
+-
+- <ItemGroup>
+- <ReferenceAssemblyPaths Include="$(_TargetFrameworkDirectories)"/>
+- <ReferencePath Include="%(ReferenceAssemblyPaths.Identity)\*.dll">
+- <CopyLocal>false</CopyLocal>
+- <ResolvedFrom>ImplicitlyExpandTargetFramework</ResolvedFrom>
+- <IsSystemReference>True</IsSystemReference>
+- </ReferencePath>
+- </ItemGroup>
+- </Target>
+- <!-- END MONO 3.2.7 WORKAROUND PART 2 -->
+-
+ <Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\Microsoft.Portable.Core.targets"
+ Condition="Exists('$(MSBuildExtensionsPath32)\Microsoft\Portable\Microsoft.Portable.Core.props')"/>
+
+--
+2.7.4 (Apple Git-66)
--- /dev/null
+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
--- /dev/null
+>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
--- /dev/null
+diff --git a/gdk/quartz/gdkevents-quartz.c b/gdk/quartz/gdkevents-quartz.c
+index a8800f7..ec6a893 100644
+--- a/gdk/quartz/gdkevents-quartz.c
++++ b/gdk/quartz/gdkevents-quartz.c
+@@ -292,10 +292,19 @@ get_keyboard_modifiers_from_ns_flags (NSUInteger nsflags)
+ modifiers |= GDK_SHIFT_MASK;
+ if (nsflags & NSControlKeyMask)
+ modifiers |= GDK_CONTROL_MASK;
+- if (nsflags & NSAlternateKeyMask)
+- modifiers |= GDK_MOD1_MASK;
+- if (nsflags & NSCommandKeyMask)
+- modifiers |= GDK_MOD2_MASK;
++
++ if (gdk_quartz_get_fix_modifiers ())
++ {
++ if (nsflags & NSAlternateKeyMask)
++ modifiers |= GDK_MOD1_MASK;
++ if (nsflags & NSCommandKeyMask)
++ modifiers |= GDK_MOD2_MASK;
++ }
++ else
++ {
++ if (nsflags & NSCommandKeyMask)
++ modifiers |= GDK_MOD1_MASK;
++ }
+
+ return modifiers;
+ }
+@@ -930,7 +939,7 @@ fill_key_event (GdkWindow *window,
+ {
+ case GDK_Meta_R:
+ case GDK_Meta_L:
+- mask = GDK_MOD2_MASK;
++ mask = gdk_quartz_get_fix_modifiers () ? GDK_MOD2_MASK : GDK_MOD1_MASK;
+ break;
+ case GDK_Shift_R:
+ case GDK_Shift_L:
+@@ -941,7 +950,7 @@ fill_key_event (GdkWindow *window,
+ break;
+ case GDK_Alt_R:
+ case GDK_Alt_L:
+- mask = GDK_MOD1_MASK;
++ mask = gdk_quartz_get_fix_modifiers () ? GDK_MOD1_MASK : GDK_MOD2_MASK;
+ break;
+ case GDK_Control_R:
+ case GDK_Control_L:
+@@ -1089,9 +1098,9 @@ _gdk_quartz_events_get_current_keyboard_modifiers (void)
+ if (carbon_modifiers & controlKey)
+ modifiers |= GDK_CONTROL_MASK;
+ if (carbon_modifiers & optionKey)
+- modifiers |= GDK_MOD1_MASK;
++ modifiers |= (gdk_quartz_get_fix_modifiers () ? GDK_MOD1_MASK : GDK_MOD2_MASK);
+ if (carbon_modifiers & cmdKey)
+- modifiers |= GDK_MOD2_MASK;
++ modifiers |= (gdk_quartz_get_fix_modifiers () ? GDK_MOD2_MASK : GDK_MOD1_MASK);
+
+ return modifiers;
+ }
+diff --git a/gdk/quartz/gdkglobals-quartz.c b/gdk/quartz/gdkglobals-quartz.c
+index 53c6d5e..31dbab1 100644
+--- a/gdk/quartz/gdkglobals-quartz.c
++++ b/gdk/quartz/gdkglobals-quartz.c
+@@ -41,3 +41,17 @@ gdk_quartz_osx_version (void)
+ else
+ return minor;
+ }
++
++static gboolean fix_modifiers = FALSE;
++
++void
++gdk_quartz_set_fix_modifiers (gboolean fix)
++{
++ fix_modifiers = fix;
++}
++
++gboolean
++gdk_quartz_get_fix_modifiers (void)
++{
++ return fix_modifiers;
++}
+diff --git a/gdk/quartz/gdkkeys-quartz.c b/gdk/quartz/gdkkeys-quartz.c
+index 19a20f5..c7ceec6 100644
+--- a/gdk/quartz/gdkkeys-quartz.c
++++ b/gdk/quartz/gdkkeys-quartz.c
+@@ -693,11 +693,11 @@ gdk_keymap_translate_keyboard_state (GdkKeymap *keymap,
+ for (bit = GDK_SHIFT_MASK; bit < GDK_BUTTON1_MASK; bit <<= 1)
+ {
+ if (translate_keysym (hardware_keycode,
+- (bit == GDK_MOD1_MASK) ? 0 : group,
++ (bit == (gdk_quartz_get_fix_modifiers () ? GDK_MOD1_MASK : GDK_MOD2_MASK)) ? 0 : group,
+ state & ~bit,
+ NULL, NULL) !=
+ translate_keysym (hardware_keycode,
+- (bit == GDK_MOD1_MASK) ? 1 : group,
++ (bit == (gdk_quartz_get_fix_modifiers () ? GDK_MOD1_MASK : GDK_MOD2_MASK)) ? 1 : group,
+ state | bit,
+ NULL, NULL))
+ tmp_modifiers |= bit;
+@@ -718,16 +718,32 @@ void
+ gdk_keymap_add_virtual_modifiers (GdkKeymap *keymap,
+ GdkModifierType *state)
+ {
+- if (*state & GDK_MOD2_MASK)
+- *state |= GDK_META_MASK;
++ if (gdk_quartz_get_fix_modifiers ())
++ {
++ if (*state & GDK_MOD2_MASK)
++ *state |= GDK_META_MASK;
++ }
++ else
++ {
++ if (*state & GDK_MOD1_MASK)
++ *state |= GDK_META_MASK;
++ }
+ }
+
+ gboolean
+ gdk_keymap_map_virtual_modifiers (GdkKeymap *keymap,
+ GdkModifierType *state)
+ {
+- if (*state & GDK_META_MASK)
+- *state |= GDK_MOD2_MASK;
++ if (gdk_quartz_get_fix_modifiers ())
++ {
++ if (*state & GDK_META_MASK)
++ *state |= GDK_MOD2_MASK;
++ }
++ else
++ {
++ if (*state & GDK_META_MASK)
++ *state |= GDK_MOD1_MASK;
++ }
+
+ return TRUE;
+ }
+diff --git a/gdk/quartz/gdkquartz.h b/gdk/quartz/gdkquartz.h
+index 742d651..ed0ba35 100644
+--- a/gdk/quartz/gdkquartz.h
++++ b/gdk/quartz/gdkquartz.h
+@@ -58,6 +58,9 @@ id gdk_quartz_drag_context_get_dragging_info_libgtk_only (GdkDragContext
+ NSEvent *gdk_quartz_event_get_nsevent (GdkEvent *event);
+ GdkOSXVersion gdk_quartz_osx_version (void);
+
++void gdk_quartz_set_fix_modifiers (gboolean fix);
++gboolean gdk_quartz_get_fix_modifiers (void);
++
+ G_END_DECLS
+
+ #endif /* __GDK_QUARTZ_H__ */
+diff --git a/gtk/gtkprivate.h b/gtk/gtkprivate.h
+index 6386c32..aa1cc74 100644
+--- a/gtk/gtkprivate.h
++++ b/gtk/gtkprivate.h
+@@ -122,7 +122,7 @@ gboolean _gtk_fnmatch (const char *pattern,
+ #ifndef GDK_WINDOWING_QUARTZ
+ #define GTK_NO_TEXT_INPUT_MOD_MASK (GDK_MOD1_MASK | GDK_CONTROL_MASK)
+ #else
+-#define GTK_NO_TEXT_INPUT_MOD_MASK (GDK_MOD2_MASK | GDK_CONTROL_MASK)
++#define GTK_NO_TEXT_INPUT_MOD_MASK (gdk_quartz_get_fix_modifiers () ? (GDK_MOD2_MASK | GDK_CONTROL_MASK) : (GDK_MOD1_MASK | GDK_CONTROL_MASK))
+ #endif
+
+ #ifndef GDK_WINDOWING_QUARTZ
+@@ -130,13 +130,13 @@ gboolean _gtk_fnmatch (const char *pattern,
+ #define GTK_MODIFY_SELECTION_MOD_MASK GDK_CONTROL_MASK
+ #else
+ #define GTK_EXTEND_SELECTION_MOD_MASK GDK_SHIFT_MASK
+-#define GTK_MODIFY_SELECTION_MOD_MASK GDK_MOD2_MASK
++#define GTK_MODIFY_SELECTION_MOD_MASK (gdk_quartz_get_fix_modifiers () ? GDK_MOD2_MASK : GDK_MOD1_MASK)
+ #endif
+
+ #ifndef GDK_WINDOWING_QUARTZ
+ #define GTK_TOGGLE_GROUP_MOD_MASK 0
+ #else
+-#define GTK_TOGGLE_GROUP_MOD_MASK GDK_MOD1_MASK
++#define GTK_TOGGLE_GROUP_MOD_MASK (gdk_quartz_get_fix_modifiers () ? GDK_MOD1_MASK : 0)
+ #endif
+
+ gboolean _gtk_button_event_triggers_context_menu (GdkEventButton *event);
--- /dev/null
+--- a/gettext-tools/Makefile.in.orig 2010-06-03 16:38:55.000000000 -0500
++++ b/gettext-tools/Makefile.in 2010-06-04 01:16:07.000000000 -0500
+@@ -1248,7 +1248,7 @@
+ top_srcdir = @top_srcdir@
+ AUTOMAKE_OPTIONS = 1.5 gnu no-dependencies
+ ACLOCAL_AMFLAGS = -I m4 -I ../gettext-runtime/m4 -I ../m4 -I gnulib-m4 -I libgrep/gnulib-m4 -I libgettextpo/gnulib-m4
+-SUBDIRS = doc intl gnulib-lib libgrep src libgettextpo po projects styles misc man m4 tests gnulib-tests examples
++SUBDIRS = doc intl gnulib-lib libgrep src libgettextpo po projects styles misc man m4 tests gnulib-tests
+
+ # Allow users to use "gnulib-tool --update".
--- /dev/null
+From 5dfd206b09f91cba45fa8e2b66e1b57aafe30868 Mon Sep 17 00:00:00 2001
+From: Kristian Rietveld <kris@lanedo.com>
+Date: Mon, 8 Jul 2013 12:02:00 +0200
+Subject: [PATCH] Make g_main_context_iterate resilient to recursion in poll
+
+On OS X, main loop recursion may happen during the call the poll.
+As a result, the allocated poll array may be re-allocated (note that
+it is always enlarged, never shrunk). By always using cached_poll_array
+after the poll function, reads from bad memory are avoided.
+---
+ glib/gmain.c | 28 +++++++++++++++-------------
+ 1 file changed, 15 insertions(+), 13 deletions(-)
+
+diff --git a/glib/gmain.c b/glib/gmain.c
+index 077a935..529f2b6 100644
+--- a/glib/gmain.c
++++ b/glib/gmain.c
+@@ -3065,8 +3065,7 @@ g_main_context_iterate (GMainContext *context,
+ gint max_priority;
+ gint timeout;
+ gboolean some_ready;
+- gint nfds, allocated_nfds;
+- GPollFD *fds = NULL;
++ gint nfds;
+
+ UNLOCK_CONTEXT (context);
+
+@@ -3095,29 +3094,32 @@ g_main_context_iterate (GMainContext *context,
+ context->cached_poll_array = g_new (GPollFD, context->n_poll_records);
+ }
+
+- allocated_nfds = context->cached_poll_array_size;
+- fds = context->cached_poll_array;
+-
+ UNLOCK_CONTEXT (context);
+
+ g_main_context_prepare (context, &max_priority);
+
+- while ((nfds = g_main_context_query (context, max_priority, &timeout, fds,
+- allocated_nfds)) > allocated_nfds)
++ while ((nfds = g_main_context_query (context, max_priority, &timeout,
++ context->cached_poll_array,
++ context->cached_poll_array_size))
++ > context->cached_poll_array_size)
+ {
+ LOCK_CONTEXT (context);
+- g_free (fds);
+- context->cached_poll_array_size = allocated_nfds = nfds;
+- context->cached_poll_array = fds = g_new (GPollFD, nfds);
++ g_free (context->cached_poll_array);
++ context->cached_poll_array_size = nfds;
++ context->cached_poll_array = g_new (GPollFD, nfds);
+ UNLOCK_CONTEXT (context);
+ }
+
+ if (!block)
+ timeout = 0;
+
+- g_main_context_poll (context, timeout, max_priority, fds, nfds);
+-
+- some_ready = g_main_context_check (context, max_priority, fds, nfds);
++ g_main_context_poll (context, timeout, max_priority,
++ context->cached_poll_array,
++ nfds);
++
++ some_ready = g_main_context_check (context, max_priority,
++ context->cached_poll_array,
++ nfds);
+
+ if (dispatch)
+ g_main_context_dispatch (context);
+--
+1.7.10
--- /dev/null
+/ AC_APPLE_UNIVERSAL_BUILD /c
+/* #undef AC_APPLE_UNIVERSAL_BUILD */
+.
+/ G_VA_COPY_AS_ARRAY /c
+#ifdef __LP64__
+#define G_VA_COPY_AS_ARRAY 1
+#else
+/* #undef G_VA_COPY_AS_ARRAY */
+#endif
+.
+/ SIZEOF_LONG /c
+#ifdef __LP64__
+#define SIZEOF_LONG 8
+#else
+#define SIZEOF_LONG 4
+#endif
+.
+/ SIZEOF_SIZE_T /c
+#ifdef __LP64__
+#define SIZEOF_SIZE_T 8
+#else
+#define SIZEOF_SIZE_T 4
+#endif
+.
+/ SIZEOF_VOID_P /c
+#ifdef __LP64__
+#define SIZEOF_VOID_P 8
+#else
+#define SIZEOF_VOID_P 4
+#endif
+.
+w
--- /dev/null
+--- configure.orig 2012-10-15 19:29:14.000000000 -0500
++++ configure 2012-10-22 17:29:31.000000000 -0500
+@@ -5602,7 +5602,7 @@
+ fi
+
+ GLIB_RUNTIME_LIBDIR="$with_runtime_libdir"
+-ABS_GLIB_RUNTIME_LIBDIR="`readlink -f $libdir/$with_runtime_libdir`"
++ABS_GLIB_RUNTIME_LIBDIR="`readlink $libdir/$with_runtime_libdir`"
+
+
+ if test "x$with_runtime_libdir" != "x"; then
+@@ -30649,10 +30649,10 @@
+ *) glib_vacopy=''
+ esac
+
+-if test x$glib_cv_va_val_copy = xno; then
+ glib_vacopy="\$glib_vacopy
+-#define G_VA_COPY_AS_ARRAY 1"
+-fi
++#ifdef __LP64__
++#define G_VA_COPY_AS_ARRAY 1
++#endif"
+
+ if test x$glib_cv_hasinline = xyes; then
+ glib_inline='#define G_HAVE_INLINE 1'
+@@ -32411,18 +32411,32 @@
+ cat >>$outfile <<_______EOF
+ #define G_HAVE_GINT64 1 /* deprecated, always true */
+
+-${glib_extension}typedef signed $gint64 gint64;
+-${glib_extension}typedef unsigned $gint64 guint64;
++#ifdef __LP64__
++${glib_extension}typedef signed long gint64;
++${glib_extension}typedef unsigned long guint64;
+
+-#define G_GINT64_CONSTANT(val) $gint64_constant
+-#define G_GUINT64_CONSTANT(val) $guint64_constant
++#define G_GINT64_CONSTANT(val) (val##L)
++#define G_GUINT64_CONSTANT(val) (val##UL)
++#else
++${glib_extension}typedef signed long long gint64;
++${glib_extension}typedef unsigned long long guint64;
++
++#define G_GINT64_CONSTANT(val) (G_GNUC_EXTENSION (val##LL))
++#define G_GUINT64_CONSTANT(val) (G_GNUC_EXTENSION (val##ULL))
++#endif
+ _______EOF
+
+ if test x$gint64_format != x ; then
+ cat >>$outfile <<_______EOF
+-#define G_GINT64_MODIFIER $gint64_modifier
+-#define G_GINT64_FORMAT $gint64_format
+-#define G_GUINT64_FORMAT $guint64_format
++#ifdef __LP64__
++#define G_GINT64_MODIFIER "l"
++#define G_GINT64_FORMAT "li"
++#define G_GUINT64_FORMAT "lu"
++#else
++#define G_GINT64_MODIFIER "ll"
++#define G_GINT64_FORMAT "lli"
++#define G_GUINT64_FORMAT "llu"
++#endif
+ _______EOF
+ else
+ cat >>$outfile <<_______EOF
+@@ -32434,9 +32448,15 @@
+
+ cat >>$outfile <<_______EOF
+
+-#define GLIB_SIZEOF_VOID_P $glib_void_p
+-#define GLIB_SIZEOF_LONG $glib_long
+-#define GLIB_SIZEOF_SIZE_T $glib_size_t
++#ifdef __LP64__
++#define GLIB_SIZEOF_VOID_P 8
++#define GLIB_SIZEOF_LONG 8
++#define GLIB_SIZEOF_SIZE_T 8
++#else
++#define GLIB_SIZEOF_VOID_P 4
++#define GLIB_SIZEOF_LONG 4
++#define GLIB_SIZEOF_SIZE_T 4
++#endif
+
+ _______EOF
+
+@@ -32464,18 +32484,33 @@
+ if test -z "$glib_unknown_void_p"; then
+ cat >>$outfile <<_______EOF
+
+-#define GPOINTER_TO_INT(p) ((gint) ${glib_gpi_cast} (p))
+-#define GPOINTER_TO_UINT(p) ((guint) ${glib_gpui_cast} (p))
++#ifdef __LP64__
++#define GPOINTER_TO_INT(p) ((gint) (glong) (p))
++#define GPOINTER_TO_UINT(p) ((guint) (gulong) (p))
++
++#define GINT_TO_POINTER(i) ((gpointer) (glong) (i))
++#define GUINT_TO_POINTER(u) ((gpointer) (gulong) (u))
++
++typedef signed long gintptr;
++typedef unsigned long guintptr;
++
++#define G_GINTPTR_MODIFIER "l"
++#define G_GINTPTR_FORMAT "li"
++#define G_GUINTPTR_FORMAT "lu"
++#else
++#define GPOINTER_TO_INT(p) ((gint) (p))
++#define GPOINTER_TO_UINT(p) ((guint) (p))
+
+-#define GINT_TO_POINTER(i) ((gpointer) ${glib_gpi_cast} (i))
+-#define GUINT_TO_POINTER(u) ((gpointer) ${glib_gpui_cast} (u))
++#define GINT_TO_POINTER(i) ((gpointer) (i))
++#define GUINT_TO_POINTER(u) ((gpointer) (u))
+
+-typedef signed $glib_intptr_type_define gintptr;
+-typedef unsigned $glib_intptr_type_define guintptr;
++typedef signed int gintptr;
++typedef unsigned int guintptr;
+
+-#define G_GINTPTR_MODIFIER $gintptr_modifier
+-#define G_GINTPTR_FORMAT $gintptr_format
+-#define G_GUINTPTR_FORMAT $guintptr_format
++#define G_GINTPTR_MODIFIER ""
++#define G_GINTPTR_FORMAT "i"
++#define G_GUINTPTR_FORMAT "u"
++#endif
+ _______EOF
+ else
+ echo '#error SIZEOF_VOID_P unknown - This should never happen' >>$outfile
+@@ -32588,7 +32623,9 @@
+
+ if test x"$g_memory_barrier_needed" != xno; then
+ echo >>$outfile
++ echo "#ifdef __BIG_ENDIAN__" >>$outfile
+ echo "#define G_ATOMIC_OP_MEMORY_BARRIER_NEEDED 1" >>$outfile
++ echo "#endif" >>$outfile
+ fi
+ if test x"$g_atomic_lock_free" = xyes; then
+ echo >>$outfile
+@@ -32598,27 +32635,52 @@
+ g_bit_sizes="16 32 64"
+ for bits in $g_bit_sizes; do
+ cat >>$outfile <<_______EOF
+-#define GINT${bits}_TO_${g_bs_native}(val) ((gint${bits}) (val))
+-#define GUINT${bits}_TO_${g_bs_native}(val) ((guint${bits}) (val))
+-#define GINT${bits}_TO_${g_bs_alien}(val) ((gint${bits}) GUINT${bits}_SWAP_LE_BE (val))
+-#define GUINT${bits}_TO_${g_bs_alien}(val) (GUINT${bits}_SWAP_LE_BE (val))
++#ifdef __BIG_ENDIAN__
++#define GINT${bits}_TO_BE(val) ((gint${bits}) (val))
++#define GUINT${bits}_TO_BE(val) ((guint${bits}) (val))
++#define GINT${bits}_TO_LE(val) ((gint${bits}) GUINT${bits}_SWAP_LE_BE (val))
++#define GUINT${bits}_TO_LE(val) (GUINT${bits}_SWAP_LE_BE (val))
++#else
++#define GINT${bits}_TO_LE(val) ((gint${bits}) (val))
++#define GUINT${bits}_TO_LE(val) ((guint${bits}) (val))
++#define GINT${bits}_TO_BE(val) ((gint${bits}) GUINT${bits}_SWAP_LE_BE (val))
++#define GUINT${bits}_TO_BE(val) (GUINT${bits}_SWAP_LE_BE (val))
++#endif
+ _______EOF
+ done
+
+ cat >>$outfile <<_______EOF
+-#define GLONG_TO_LE(val) ((glong) GINT${glongbits}_TO_LE (val))
+-#define GULONG_TO_LE(val) ((gulong) GUINT${glongbits}_TO_LE (val))
+-#define GLONG_TO_BE(val) ((glong) GINT${glongbits}_TO_BE (val))
+-#define GULONG_TO_BE(val) ((gulong) GUINT${glongbits}_TO_BE (val))
++#ifdef __LP64__
++#define GLONG_TO_LE(val) ((glong) GINT64_TO_LE (val))
++#define GULONG_TO_LE(val) ((gulong) GUINT64_TO_LE (val))
++#define GLONG_TO_BE(val) ((glong) GINT64_TO_BE (val))
++#define GULONG_TO_BE(val) ((gulong) GUINT64_TO_BE (val))
++#else
++#define GLONG_TO_LE(val) ((glong) GINT32_TO_LE (val))
++#define GULONG_TO_LE(val) ((gulong) GUINT32_TO_LE (val))
++#define GLONG_TO_BE(val) ((glong) GINT32_TO_BE (val))
++#define GULONG_TO_BE(val) ((gulong) GUINT32_TO_BE (val))
++#endif
+ #define GINT_TO_LE(val) ((gint) GINT${gintbits}_TO_LE (val))
+ #define GUINT_TO_LE(val) ((guint) GUINT${gintbits}_TO_LE (val))
+ #define GINT_TO_BE(val) ((gint) GINT${gintbits}_TO_BE (val))
+ #define GUINT_TO_BE(val) ((guint) GUINT${gintbits}_TO_BE (val))
+-#define GSIZE_TO_LE(val) ((gsize) GUINT${gsizebits}_TO_LE (val))
+-#define GSSIZE_TO_LE(val) ((gssize) GINT${gsizebits}_TO_LE (val))
+-#define GSIZE_TO_BE(val) ((gsize) GUINT${gsizebits}_TO_BE (val))
+-#define GSSIZE_TO_BE(val) ((gssize) GINT${gsizebits}_TO_BE (val))
+-#define G_BYTE_ORDER $g_byte_order
++#ifdef __LP64__
++#define GSIZE_TO_LE(val) ((gsize) GUINT64_TO_LE (val))
++#define GSSIZE_TO_LE(val) ((gssize) GINT64_TO_LE (val))
++#define GSIZE_TO_BE(val) ((gsize) GUINT64_TO_BE (val))
++#define GSSIZE_TO_BE(val) ((gssize) GINT64_TO_BE (val))
++#else
++#define GSIZE_TO_LE(val) ((gsize) GUINT32_TO_LE (val))
++#define GSSIZE_TO_LE(val) ((gssize) GINT32_TO_LE (val))
++#define GSIZE_TO_BE(val) ((gsize) GUINT32_TO_BE (val))
++#define GSSIZE_TO_BE(val) ((gssize) GINT32_TO_BE (val))
++#endif
++#ifdef __BIG_ENDIAN__
++#define G_BYTE_ORDER G_BIG_ENDIAN
++#else
++#define G_BYTE_ORDER G_LITTLE_ENDIAN
++#endif
+
+ #define GLIB_SYSDEF_POLLIN =$g_pollin
+ #define GLIB_SYSDEF_POLLOUT =$g_pollout
--- /dev/null
+--- glib/gi18n.h.orig 2008-11-23 23:45:23.000000000 -0600
++++ glib/gi18n.h 2008-11-25 23:59:29.000000000 -0600
+@@ -27,7 +27,9 @@
+
+ #define _(String) gettext (String)
+ #define Q_(String) g_dpgettext (NULL, String, 0)
++#ifndef N_
+ #define N_(String) (String)
++#endif
+ #define C_(Context,String) g_dpgettext (NULL, Context "\004" String, strlen (Context) + 1)
+ #define NC_(Context, String) (String)
--- /dev/null
+--- gio/gdbusprivate.c.orig 2012-04-30 11:24:02.000000000 -0500
++++ gio/gdbusprivate.c 2012-05-02 01:57:47.000000000 -0500
+@@ -2094,7 +2094,7 @@
+ /* TODO: use PACKAGE_LOCALSTATEDIR ? */
+ ret = NULL;
+ first_error = NULL;
+- if (!g_file_get_contents ("/var/lib/dbus/machine-id",
++ if (!g_file_get_contents ("@@PREFIX@@/var/lib/dbus/machine-id",
+ &ret,
+ NULL,
+ &first_error) &&
+@@ -2104,7 +2104,7 @@
+ NULL))
+ {
+ g_propagate_prefixed_error (error, first_error,
+- _("Unable to load /var/lib/dbus/machine-id or /etc/machine-id: "));
++ _("Unable to load @@PREFIX@@/var/lib/dbus/machine-id or /etc/machine-id: "));
+ }
+ else
+ {
--- /dev/null
+--- gio/xdgmime/xdgmime.c.orig 2009-03-12 22:09:52.000000000 -0600
++++ gio/xdgmime/xdgmime.c 2009-04-09 23:41:01.000000000 -0600
+@@ -257,7 +257,7 @@
+
+ xdg_data_dirs = getenv ("XDG_DATA_DIRS");
+ if (xdg_data_dirs == NULL)
+- xdg_data_dirs = "/usr/local/share/:/usr/share/";
++ xdg_data_dirs = "@@PREFIX@@/share/:/usr/share/";
+
+ ptr = xdg_data_dirs;
--- /dev/null
+--- glib-2.0.pc.in.orig 2012-01-15 21:12:06.000000000 -0600
++++ glib-2.0.pc.in 2012-01-19 22:29:43.000000000 -0600
+@@ -13,4 +13,4 @@
+ Requires.private: @PCRE_REQUIRES@
+ Libs: -L${libdir} -lglib-2.0 @INTLLIBS@
+ Libs.private: @G_THREAD_LIBS@ @G_LIBS_EXTRA@ @PCRE_LIBS@ @INTLLIBS@ @ICONV_LIBS@
+-Cflags: -I${includedir}/glib-2.0 -I${libdir}/glib-2.0/include @GLIB_EXTRA_CFLAGS@
++Cflags: -I${includedir}/glib-2.0 -I${libdir}/glib-2.0/include -I${includedir} @GLIB_EXTRA_CFLAGS@
--- /dev/null
+--- glib/gunicollate.c.orig 2009-03-31 18:04:20.000000000 -0500
++++ glib/gunicollate.c 2010-03-06 17:59:08.000000000 -0600
+@@ -26,6 +26,9 @@
+ #include <wchar.h>
+ #endif
+
++/* Carbon is not available on 64-bit */
++#undef HAVE_CARBON
++
+ #ifdef HAVE_CARBON
+ #include <CoreServices/CoreServices.h>
+ #endif
--- /dev/null
+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 "$@"
--- /dev/null
+diff --git a/src/murrine_draw.c b/src/murrine_draw.c
+index 4cab20f..06ed9b1 100644
+--- a/src/murrine_draw.c
++++ b/src/murrine_draw.c
+@@ -1625,10 +1625,6 @@ murrine_draw_scrollbar_slider (cairo_t *cr,
+ }
+
+ cairo_restore (cr);
+-
+- murrine_set_color_rgb (cr, &border);
+- murrine_rounded_rectangle (cr, 0.5, 0.5, width-1, height-1, widget->roundness, widget->corners);
+- cairo_stroke (cr);
+ }
+
+ static void
+@@ -1791,21 +1787,15 @@ murrine_draw_normal_arrow (cairo_t *cr,
+ {
+ double arrow_width;
+ double arrow_height;
+- double line_width_2;
+
+- cairo_save (cr);
+-
+- arrow_width = MIN (height*2.0 + MAX (1.0, ceil (height*2.0/6.0*2.0)/2.0)/2.0, width);
+- line_width_2 = MAX (1.0, ceil (arrow_width/6.0*2.0)/2.0)/2.0;
+- arrow_height = arrow_width/2.0+line_width_2;
++ arrow_width = CLAMP (width, 3, 8);
++ arrow_height = CLAMP (height, 3, 8);
+
+- cairo_translate (cr, x, y-arrow_height/2.0);
++ cairo_save (cr);
+
+- cairo_move_to (cr, -arrow_width/2.0, line_width_2);
+- cairo_line_to (cr, -arrow_width/2.0 + line_width_2, 0);
+- cairo_arc_negative (cr, 0, arrow_height-2*line_width_2-2*line_width_2*sqrt(2), 2*line_width_2, M_PI_2+M_PI_4, M_PI_4);
+- cairo_line_to (cr, arrow_width/2.0-line_width_2, 0);
+- cairo_line_to (cr, arrow_width/2.0, line_width_2);
++ cairo_translate (cr, x, y - arrow_height / 2.0);
++ cairo_move_to (cr, -arrow_width / 2.0, 0);
++ cairo_line_to (cr, arrow_width / 2.0, 0);
+ cairo_line_to (cr, 0, arrow_height);
+ cairo_close_path (cr);
--- /dev/null
+From 3cab26a0468bab855ed2eb13e4f334176e109483 Mon Sep 17 00:00:00 2001
+From: Kristian Rietveld <kris@lanedo.com>
+Date: Tue, 19 Mar 2013 11:23:09 +0100
+Subject: [PATCH 1/2] Simply process entire bitmap obtained from the core text
+ font
+
+---
+ pango/pangocoretext.c | 3 +--
+ 1 files changed, 1 insertions(+), 2 deletions(-)
+
+diff --git a/pango/pangocoretext.c b/pango/pangocoretext.c
+index 36bcd82..1d46271 100644
+--- a/pango/pangocoretext.c
++++ b/pango/pangocoretext.c
+@@ -89,8 +89,7 @@ ct_font_descriptor_get_coverage (CTFontDescriptorRef desc)
+ bitmap = CFCharacterSetCreateBitmapRepresentation (kCFAllocatorDefault,
+ charset);
+
+- /* We only handle the BMP plane */
+- length = MIN (CFDataGetLength (bitmap), 8192);
++ length = CFDataGetLength (bitmap);
+ ptr = CFDataGetBytePtr (bitmap);
+
+ /* FIXME: can and should this be done more efficiently? */
+--
+1.7.4.4
--- /dev/null
+661f8c0b920f5da Mon Sep 17 00:00:00 2001
+From: Kristian Rietveld <kris@lanedo.com>
+Date: Tue, 19 Mar 2013 11:23:49 +0100
+Subject: [PATCH 2/2] Detect and handle characters encoded in two UTF16 code
+ points
+
+Another important change: gi->index should point at the current
+character, not the current into the string. Before this change,
+the current character equaled the current index into the string.
+---
+ modules/basic/basic-coretext.c | 55 ++++++++++++++++++++++++++++-----------
+ 1 files changed, 39 insertions(+), 16 deletions(-)
+
+diff --git a/modules/basic/basic-coretext.c b/modules/basic/basic-coretext.c
+index 33ce479..06b648e 100644
+--- a/modules/basic/basic-coretext.c
++++ b/modules/basic/basic-coretext.c
+@@ -166,7 +166,42 @@ run_iterator_run_is_non_monotonic (struct RunIterator *iter)
+ static gunichar
+ run_iterator_get_character (struct RunIterator *iter)
+ {
+- return CFStringGetCharacterAtIndex (iter->cstr, iter->current_indices[iter->ct_i]);
++ int lower, upper;
++
++ lower = iter->current_indices[iter->ct_i];
++ if (iter->ct_i + 1 < CTRunGetGlyphCount (iter->current_run))
++ upper = iter->current_indices[iter->ct_i + 1];
++ else
++ {
++ CFRange range = CTRunGetStringRange (iter->current_run);
++ upper = range.location + range.length;
++ }
++
++ if (upper - lower == 1)
++ return CFStringGetCharacterAtIndex (iter->cstr, lower);
++ if (upper - lower == 2)
++ {
++ /* Character is encoded in two UTF16 code points. */
++ gunichar *ch;
++ gunichar retval;
++ gunichar2 orig[2];
++
++ orig[0] = CFStringGetCharacterAtIndex (iter->cstr, lower);
++ orig[1] = CFStringGetCharacterAtIndex (iter->cstr, lower + 1);
++
++ ch = g_utf16_to_ucs4 (orig, 2, NULL, NULL, NULL);
++ retval = *ch;
++ g_free (ch);
++
++ return retval;
++ }
++
++ /* This should not be reached, because other cases cannot occur. Instead
++ * of crashing, return the first character which will likely be displayed
++ * as unknown glyph.
++ */
++
++ return CFStringGetCharacterAtIndex (iter->cstr, lower);
+ }
+
+ static CGGlyph
+@@ -175,12 +210,6 @@ run_iterator_get_cgglyph (struct RunIterator *iter)
+ return iter->current_cgglyphs[iter->ct_i];
+ }
+
+-static CFIndex
+-run_iterator_get_index (struct RunIterator *iter)
+-{
+- return iter->current_indices[iter->ct_i];
+-}
+-
+ static gboolean
+ run_iterator_create (struct RunIterator *iter,
+ const char *text,
+@@ -336,7 +365,7 @@ create_core_text_glyph_list (const char *text,
+ struct GlyphInfo *gi;
+
+ gi = g_slice_new (struct GlyphInfo);
+- gi->index = run_iterator_get_index (&riter);
++ gi->index = riter.total_ct_i;
+ gi->cgglyph = run_iterator_get_cgglyph (&riter);
+ gi->wc = run_iterator_get_character (&riter);
+
+@@ -376,9 +405,8 @@ basic_engine_shape (PangoEngineShape *engine,
+ * glyph sequence generated by the CoreText typesetter:
+ * # E.g. zero-width spaces do not end up in the CoreText glyph sequence. We have
+ * to manually account for the gap in the character indices.
+- * # Sometimes, CoreText generates two glyph for the same character index. We
+- * currently handle this "properly" as in we do not crash or corrupt memory,
+- * but that's about it.
++ * # Sometimes, CoreText generates two glyph for the same character index. These
++ * are properly composed into a single 32-bit gunichar.
+ * # Due to mismatches in size, the CoreText glyph sequence can either be longer or
+ * shorter than the PangoGlyphString. Note that the size of the PangoGlyphString
+ * should match the number of characters in "text".
+@@ -390,11 +418,6 @@ basic_engine_shape (PangoEngineShape *engine,
+ * increasing/decreasing.
+ *
+ * FIXME items for future fixing:
+- * # CoreText strings are UTF16, and the indices *often* refer to characters,
+- * but not *always*. Notable exception is when a character is encoded using
+- * two UTF16 code points. This are two characters in a CFString. At this point
+- * advancing a single character in the CFString and advancing a single character
+- * using g_utf8_next_char in the const char string goes out of sync.
+ * # We currently don't bother about LTR, Pango core appears to fix this up for us.
+ * (Even when we cared warnings were generated that strings were in the wrong
+ * order, this should be investigated).
+--
+1.7.4.4
--- /dev/null
+diff --git a/pango/pangocoretext-fontmap.c b/pango/pangocoretext-fontmap.c
+index 53b2676..2b30a07 100644
+--- a/pango/pangocoretext-fontmap.c
++++ b/pango/pangocoretext-fontmap.c
+@@ -411,6 +411,9 @@ _pango_core_text_font_description_from_ct_font_descriptor (CTFontDescriptorRef d
+ else
+ pango_font_description_set_style (font_desc, PANGO_STYLE_NORMAL);
+
++ if ((font_traits & kCTFontCondensedTrait) == kCTFontCondensedTrait)
++ pango_font_description_set_stretch (font_desc, PANGO_STRETCH_CONDENSED);
++
+ if (ct_font_descriptor_is_small_caps (desc))
+ pango_font_description_set_variant (font_desc, PANGO_VARIANT_SMALL_CAPS);
+ else
--- /dev/null
+diff --git a/modules/basic/.libs/basic-coretext.o b/modules/basic/.libs/basic-coretext.o
+index 13cce67..80c3268 100644
+Binary files a/modules/basic/.libs/basic-coretext.o and b/modules/basic/.libs/basic-coretext.o differ
+diff --git a/modules/basic/.libs/pango-basic-coretext.so b/modules/basic/.libs/pango-basic-coretext.so
+index 70bb117..d0940c4 100755
+Binary files a/modules/basic/.libs/pango-basic-coretext.so and b/modules/basic/.libs/pango-basic-coretext.so differ
+diff --git a/modules/basic/basic-coretext.c b/modules/basic/basic-coretext.c
+index c34460a..46d83ff 100644
+--- a/modules/basic/basic-coretext.c
++++ b/modules/basic/basic-coretext.c
+@@ -92,6 +92,7 @@ struct RunIterator
+ CTRunRef current_run;
+ CFIndex *current_indices;
+ const CGGlyph *current_cgglyphs;
++ CGGlyph *current_cgglyphs_buffer;
+ CTRunStatus current_run_status;
+ };
+
+@@ -101,6 +102,9 @@ run_iterator_free_current_run (struct RunIterator *iter)
+ iter->current_run_number = -1;
+ iter->current_run = NULL;
+ iter->current_cgglyphs = NULL;
++ if (iter->current_cgglyphs_buffer)
++ free (iter->current_cgglyphs_buffer);
++ iter->current_cgglyphs_buffer = NULL;
+ if (iter->current_indices)
+ free (iter->current_indices);
+ iter->current_indices = NULL;
+@@ -116,10 +120,18 @@ run_iterator_set_current_run (struct RunIterator *iter,
+
+ iter->current_run_number = run_number;
+ iter->current_run = CFArrayGetValueAtIndex (iter->runs, run_number);
++ ct_glyph_count = CTRunGetGlyphCount (iter->current_run);
++
+ iter->current_run_status = CTRunGetStatus (iter->current_run);
+ iter->current_cgglyphs = CTRunGetGlyphsPtr (iter->current_run);
++ if (!iter->current_cgglyphs)
++ {
++ iter->current_cgglyphs_buffer = (CGGlyph *)malloc (sizeof (CGGlyph) * ct_glyph_count);
++ CTRunGetGlyphs (iter->current_run, CFRangeMake (0, ct_glyph_count),
++ iter->current_cgglyphs_buffer);
++ iter->current_cgglyphs = iter->current_cgglyphs_buffer;
++ }
+
+- ct_glyph_count = CTRunGetGlyphCount (iter->current_run);
+ iter->current_indices = malloc (sizeof (CFIndex *) * ct_glyph_count);
+ CTRunGetStringIndices (iter->current_run, CFRangeMake (0, ct_glyph_count),
+ iter->current_indices);
+@@ -237,6 +249,7 @@ run_iterator_create (struct RunIterator *iter,
+ iter->current_run = NULL;
+ iter->current_indices = NULL;
+ iter->current_cgglyphs = NULL;
++ iter->current_cgglyphs_buffer = NULL;
+
+ /* Create CTLine */
+ attributes = CFDictionaryCreate (kCFAllocatorDefault,
+diff --git a/modules/basic/basic-coretext.c.orig b/modules/basic/basic-coretext.c.orig
+index 0a2c27f..c34460a 100644
+--- a/modules/basic/basic-coretext.c.orig
++++ b/modules/basic/basic-coretext.c.orig
+@@ -166,7 +166,42 @@ run_iterator_run_is_non_monotonic (struct RunIterator *iter)
+ static gunichar
+ run_iterator_get_character (struct RunIterator *iter)
+ {
+- return CFStringGetCharacterAtIndex (iter->cstr, iter->current_indices[iter->ct_i]);
++ int lower, upper;
++
++ lower = iter->current_indices[iter->ct_i];
++ if (iter->ct_i + 1 < CTRunGetGlyphCount (iter->current_run))
++ upper = iter->current_indices[iter->ct_i + 1];
++ else
++ {
++ CFRange range = CTRunGetStringRange (iter->current_run);
++ upper = range.location + range.length;
++ }
++
++ if (upper - lower == 1)
++ return CFStringGetCharacterAtIndex (iter->cstr, lower);
++ if (upper - lower == 2)
++ {
++ /* Character is encoded in two UTF16 code points. */
++ gunichar *ch;
++ gunichar retval;
++ gunichar2 orig[2];
++
++ orig[0] = CFStringGetCharacterAtIndex (iter->cstr, lower);
++ orig[1] = CFStringGetCharacterAtIndex (iter->cstr, lower + 1);
++
++ ch = g_utf16_to_ucs4 (orig, 2, NULL, NULL, NULL);
++ retval = *ch;
++ g_free (ch);
++
++ return retval;
++ }
++
++ /* This should not be reached, because other cases cannot occur. Instead
++ * of crashing, return the first character which will likely be displayed
++ * as unknown glyph.
++ */
++
++ return CFStringGetCharacterAtIndex (iter->cstr, lower);
+ }
+
+ static CGGlyph
+@@ -175,12 +210,6 @@ run_iterator_get_cgglyph (struct RunIterator *iter)
+ return iter->current_cgglyphs[iter->ct_i];
+ }
+
+-static CFIndex
+-run_iterator_get_index (struct RunIterator *iter)
+-{
+- return iter->current_indices[iter->ct_i];
+-}
+-
+ static gboolean
+ run_iterator_create (struct RunIterator *iter,
+ const char *text,
+@@ -190,13 +219,17 @@ run_iterator_create (struct RunIterator *iter,
+ char *copy;
+ CFDictionaryRef attributes;
+ CFAttributedStringRef attstr;
++ int val = 0;
++ CFNumberRef number = CFNumberCreate (kCFAllocatorDefault, kCFNumberIntType, &val);
+
+ CFTypeRef keys[] = {
+- (CFTypeRef) kCTFontAttributeName
++ (CFTypeRef) kCTFontAttributeName,
++ kCTLigatureAttributeName
+ };
+
+ CFTypeRef values[] = {
+- ctfont
++ ctfont,
++ number
+ };
+
+ /* Initialize RunIterator structure */
+@@ -209,7 +242,7 @@ run_iterator_create (struct RunIterator *iter,
+ attributes = CFDictionaryCreate (kCFAllocatorDefault,
+ (const void **)keys,
+ (const void **)values,
+- 1,
++ sizeof (keys) / sizeof (keys[0]),
+ &kCFCopyStringDictionaryKeyCallBacks,
+ &kCFTypeDictionaryValueCallBacks);
+
+@@ -233,6 +266,7 @@ run_iterator_create (struct RunIterator *iter,
+ iter->line = CTLineCreateWithAttributedString (attstr);
+ iter->runs = CTLineGetGlyphRuns (iter->line);
+
++ CFRelease (number);
+ CFRelease (attstr);
+ CFRelease (attributes);
+
+@@ -336,7 +370,7 @@ create_core_text_glyph_list (const char *text,
+ struct GlyphInfo *gi;
+
+ gi = g_slice_new (struct GlyphInfo);
+- gi->index = run_iterator_get_index (&riter);
++ gi->index = riter.total_ct_i;
+ gi->cgglyph = run_iterator_get_cgglyph (&riter);
+ gi->wc = run_iterator_get_character (&riter);
+
+@@ -378,9 +412,8 @@ basic_engine_shape (PangoEngineShape *engine,
+ * glyph sequence generated by the CoreText typesetter:
+ * # E.g. zero-width spaces do not end up in the CoreText glyph sequence. We have
+ * to manually account for the gap in the character indices.
+- * # Sometimes, CoreText generates two glyph for the same character index. We
+- * currently handle this "properly" as in we do not crash or corrupt memory,
+- * but that's about it.
++ * # Sometimes, CoreText generates two glyph for the same character index. These
++ * are properly composed into a single 32-bit gunichar.
+ * # Due to mismatches in size, the CoreText glyph sequence can either be longer or
+ * shorter than the PangoGlyphString. Note that the size of the PangoGlyphString
+ * should match the number of characters in "text".
+@@ -392,11 +425,6 @@ basic_engine_shape (PangoEngineShape *engine,
+ * increasing/decreasing.
+ *
+ * FIXME items for future fixing:
+- * # CoreText strings are UTF16, and the indices *often* refer to characters,
+- * but not *always*. Notable exception is when a character is encoded using
+- * two UTF16 code points. This are two characters in a CFString. At this point
+- * advancing a single character in the CFString and advancing a single character
+- * using g_utf8_next_char in the const char string goes out of sync.
+ * # We currently don't bother about LTR, Pango core appears to fix this up for us.
+ * (Even when we cared warnings were generated that strings were in the wrong
+ * order, this should be investigated).
--- /dev/null
+diff --git a/modules/basic/.libs/basic-coretext.o b/modules/basic/.libs/basic-coretext.o
+index f013cbc..270a4f4 100644
+Binary files a/modules/basic/.libs/basic-coretext.o and b/modules/basic/.libs/basic-coretext.o differ
+diff --git a/modules/basic/.libs/pango-basic-coretext.so b/modules/basic/.libs/pango-basic-coretext.so
+index 2cbf3ef..fec3e0f 100755
+Binary files a/modules/basic/.libs/pango-basic-coretext.so and b/modules/basic/.libs/pango-basic-coretext.so differ
+diff --git a/modules/basic/basic-coretext.c b/modules/basic/basic-coretext.c
+index 82c2b48..c34460a 100644
+--- a/modules/basic/basic-coretext.c
++++ b/modules/basic/basic-coretext.c
+@@ -219,13 +219,17 @@ run_iterator_create (struct RunIterator *iter,
+ char *copy;
+ CFDictionaryRef attributes;
+ CFAttributedStringRef attstr;
++ int val = 0;
++ CFNumberRef number = CFNumberCreate (kCFAllocatorDefault, kCFNumberIntType, &val);
+
+ CFTypeRef keys[] = {
+- (CFTypeRef) kCTFontAttributeName
++ (CFTypeRef) kCTFontAttributeName,
++ kCTLigatureAttributeName
+ };
+
+ CFTypeRef values[] = {
+- ctfont
++ ctfont,
++ number
+ };
+
+ /* Initialize RunIterator structure */
+@@ -238,7 +242,7 @@ run_iterator_create (struct RunIterator *iter,
+ attributes = CFDictionaryCreate (kCFAllocatorDefault,
+ (const void **)keys,
+ (const void **)values,
+- 1,
++ sizeof (keys) / sizeof (keys[0]),
+ &kCFCopyStringDictionaryKeyCallBacks,
+ &kCFTypeDictionaryValueCallBacks);
+
+@@ -262,6 +266,7 @@ run_iterator_create (struct RunIterator *iter,
+ iter->line = CTLineCreateWithAttributedString (attstr);
+ iter->runs = CTLineGetGlyphRuns (iter->line);
+
++ CFRelease (number);
+ CFRelease (attstr);
+ CFRelease (attributes);
--- /dev/null
+diff --git a/pango/pangocoretext-fontmap.c b/pango/pangocoretext-fontmap.c
+index bcbb173..53b2676 100644
+--- a/pango/pangocoretext-fontmap.c
++++ b/pango/pangocoretext-fontmap.c
+@@ -297,7 +297,7 @@ ct_font_descriptor_get_weight (CTFontDescriptorRef desc)
+ cf_number = (CFNumberRef)CFDictionaryGetValue (dict,
+ kCTFontWeightTrait);
+
+- if (CFNumberGetValue (cf_number, kCFNumberCGFloatType, &value))
++ if (cf_number != NULL && CFNumberGetValue (cf_number, kCFNumberCGFloatType, &value))
+ {
+ if (value < ct_weight_min || value > ct_weight_max)
+ {
--- /dev/null
+Index: pango/pango-utils.c
+===================================================================
+--- a/pango/pango-utils.c (revision 2425)
++++ b/pango/pango-utils.c (working copy)
+@@ -567,6 +567,20 @@ read_config_file (const char *filename,
+ gchar *value = g_key_file_get_value(key_file, group, key, &key_error);
+ if (value != NULL)
+ {
++ if (!g_path_is_absolute (value))
++ {
++ gchar *dirname;
++ gchar *absolute_path;
++
++ dirname = g_path_get_dirname (filename);
++ absolute_path = g_build_filename (dirname, value, NULL);
++
++ g_free (dirname);
++ g_free (value);
++
++ value = absolute_path;
++ }
++
+ g_hash_table_insert (ht,
+ g_strdup_printf ("%s/%s", group, key),
+ value);
--- /dev/null
+diff --git a/pango/pangocairo-coretextfontmap.c b/pango/pangocairo-coretextfontmap.c
+index 6cb3809..c75737c 100644
+--- a/pango/pangocairo-coretextfontmap.c
++++ b/pango/pangocairo-coretextfontmap.c
+@@ -185,9 +185,13 @@ pango_cairo_core_text_font_map_load_font (PangoCoreTextFontMap *fontmap,
+ PangoContext *context,
+ const PangoFontDescription *description)
+ {
+- char *descname = pango_font_description_get_family (description);
++ const char *descname = pango_font_description_get_family (description);
++ SInt32 major, minor;
+
+- if (strcmp (descname, "-apple-system-font") == 0)
++ Gestalt (gestaltSystemVersionMajor, &major);
++ Gestalt (gestaltSystemVersionMinor, &minor);
++
++ if (major == 10 && minor>= 11 && strcmp (descname, "-apple-system-font") == 0)
+ {
+ PangoCoreTextFont *cfont;
+ NSFont *sysfont;
+@@ -195,7 +199,6 @@ pango_cairo_core_text_font_map_load_font (PangoCoreTextFontMap *fontmap,
+ cairo_matrix_t font_matrix;
+ PangoCoreTextFontsetKey fontset_key;
+ PangoCoreTextFontKey key;
+- PangoLanguage *language;
+ PangoFontDescription *tmp_desc;
+ gboolean synthetic_italic = FALSE;
+ double abs_size = get_scaled_size (fontmap, context, description);
+@@ -207,7 +210,7 @@ pango_cairo_core_text_font_map_load_font (PangoCoreTextFontMap *fontmap,
+ PangoCairoCoreTextFont *cafont = g_object_new (PANGO_TYPE_CAIRO_CORE_TEXT_FONT, NULL);
+ cfont = PANGO_CORE_TEXT_FONT (cafont);
+ cafont->abs_size = abs_size;
+- _pango_core_text_font_set_ctfont (cfont, CFRetain (sysfont));
++ _pango_core_text_font_set_ctfont (cfont, (CTFontRef)CFRetain (sysfont));
+
+ tmp_desc = pango_font_description_copy_static (description);
+
+@@ -261,7 +264,7 @@ pango_cairo_core_text_font_map_load_font (PangoCoreTextFontMap *fontmap,
+ }
+ }
+
+- return PANGO_FONT_MAP_CLASS (pango_cairo_core_text_font_map_parent_class)->load_font (fontmap, context, description);
++ return (PangoCoreTextFont*) PANGO_FONT_MAP_CLASS (pango_cairo_core_text_font_map_parent_class)->load_font (PANGO_FONT_MAP (fontmap), context, description);
+ }
+
+ static void
+diff --git a/pango/pangocoretext-fontmap.c b/pango/pangocoretext-fontmap.c
+index 4234bf1..c395c91 100644
+--- a/pango/pangocoretext-fontmap.c
++++ b/pango/pangocoretext-fontmap.c
+@@ -1367,6 +1367,7 @@ pango_core_text_font_map_init (PangoCoreTextFontMap *ctfontmap)
+ CTFontCollectionRef collection;
+ CFArrayRef ctfaces;
+ CFIndex i, count;
++ SInt32 major, minor;
+
+ ctfontmap->serial = 1;
+ ctfontmap->families = g_hash_table_new_full (g_str_hash, g_str_equal,
+@@ -1430,7 +1431,10 @@ pango_core_text_font_map_init (PangoCoreTextFontMap *ctfontmap)
+ CFRelease (dict);
+ }
+
+- if (true)
++ Gestalt (gestaltSystemVersionMajor, &major);
++ Gestalt (gestaltSystemVersionMinor, &minor);
++
++ if (major == 10 && minor >= 11)
+ {
+ NSFont *sysfont = [NSFont systemFontOfSize: 0.0];
+ NSString *name = [[NSFont fontWithName: [[sysfont fontDescriptor] postscriptName] size: 0.0] familyName];
--- /dev/null
+diff --git a/configure.ac b/configure.ac
+index 42c04ef..1260b8a 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -185,7 +185,7 @@ changequote(,)dnl
+ if test "x$GCC" = "xyes"; then
+ case " $CFLAGS " in
+ *[\ \ ]-Wall[\ \ ]*) ;;
+- *) CFLAGS="$CFLAGS -Wall" ;;
++ *) CFLAGS="$CFLAGS -Wall -ObjC" ;;
+ esac
+ fi
+ changequote([,])dnl
+diff --git a/pango/pangocairo-coretext.h b/pango/pangocairo-coretext.h
+index 31faf9b..f562587 100644
+--- a/pango/pangocairo-coretext.h
++++ b/pango/pangocairo-coretext.h
+@@ -43,6 +43,19 @@ struct _PangoCairoCoreTextFontMap
+ gdouble dpi;
+ };
+
++struct _PangoCairoCoreTextFont
++{
++ PangoCoreTextFont font;
++ PangoCairoFontPrivate cf_priv;
++
++ int abs_size;
++};
++
++struct _PangoCairoCoreTextFontClass
++{
++ PangoCoreTextFontClass parent_class;
++};
++
+ GType pango_cairo_core_text_font_map_get_type (void) G_GNUC_CONST;
+
+ PangoCoreTextFont *
+diff --git a/pango/pangocairo-coretextfont.c b/pango/pangocairo-coretextfont.c
+index 0f2a9ef..463b6e2 100644
+--- a/pango/pangocairo-coretextfont.c
++++ b/pango/pangocairo-coretextfont.c
+@@ -23,6 +23,7 @@
+
+ #include "config.h"
+
++#import <AppKit/AppKit.h>
+ #include <Carbon/Carbon.h>
+
+ #include "pango-impl-utils.h"
+@@ -32,21 +33,6 @@
+ #include "pangocairo-coretext.h"
+ #include "pangocairo-coretextfont.h"
+
+-struct _PangoCairoCoreTextFont
+-{
+- PangoCoreTextFont font;
+- PangoCairoFontPrivate cf_priv;
+-
+- int abs_size;
+-};
+-
+-struct _PangoCairoCoreTextFontClass
+-{
+- PangoCoreTextFontClass parent_class;
+-};
+-
+-
+-
+ static cairo_font_face_t *pango_cairo_core_text_font_create_font_face (PangoCairoFont *font);
+ static PangoFontMetrics *pango_cairo_core_text_font_create_base_metrics_for_context (PangoCairoFont *font,
+ PangoContext *context);
+@@ -204,6 +190,75 @@ pango_cairo_core_text_font_init (PangoCairoCoreTextFont *cafont G_GNUC_UNUSED)
+ {
+ }
+
++static gchar *
++gchar_from_cf_string (CFStringRef str)
++{
++ CFIndex len;
++ gchar *buffer;
++
++ /* GetLength returns the number of UTF-16 pairs, so this number
++ * times 2 should definitely give us enough space for UTF8.
++ * We add one for the terminating zero.
++ */
++ len = CFStringGetLength (str) * 2 + 1;
++ buffer = g_new0 (char, len);
++ CFStringGetCString (str, buffer, len, kCFStringEncodingUTF8);
++
++ return buffer;
++}
++
++static gchar *
++ct_font_descriptor_get_family_name (CTFontDescriptorRef desc,
++ gboolean may_fail)
++{
++ CFStringRef cf_str;
++ char *buffer;
++
++ cf_str = CTFontDescriptorCopyAttribute (desc, kCTFontFamilyNameAttribute);
++ if (!cf_str)
++ {
++ int i;
++
++ /* No font family name is set, try to retrieve font name and deduce
++ * the family name from that instead.
++ */
++ cf_str = CTFontDescriptorCopyAttribute (desc, kCTFontNameAttribute);
++ if (!cf_str)
++ {
++ if (may_fail)
++ return NULL;
++
++ /* This font is likely broken, return a default family name ... */
++ return g_strdup ("Sans");
++ }
++
++ buffer = gchar_from_cf_string (cf_str);
++ CFRelease (cf_str);
++
++ for (i = 0; i < strlen (buffer); i++)
++ if (buffer[i] == '-')
++ break;
++
++ if (i < strlen (buffer))
++ {
++ char *ret;
++
++ ret = g_strndup (buffer, i);
++ g_free (buffer);
++
++ return ret;
++ }
++ else
++ return buffer;
++ }
++ /* else */
++
++ buffer = gchar_from_cf_string (cf_str);
++ CFRelease (cf_str);
++
++ return buffer;
++}
++
+ PangoCoreTextFont *
+ _pango_cairo_core_text_font_new (PangoCairoCoreTextFontMap *cafontmap,
+ PangoCoreTextFontKey *key)
+diff --git a/pango/pangocairo-coretextfontmap.c b/pango/pangocairo-coretextfontmap.c
+index ba5dcec..6cb3809 100644
+--- a/pango/pangocairo-coretextfontmap.c
++++ b/pango/pangocairo-coretextfontmap.c
+@@ -26,6 +26,9 @@
+ #include "pangocairo.h"
+ #include "pangocairo-private.h"
+ #include "pangocairo-coretext.h"
++#include "pangocairo-coretextfont.h"
++
++#import <AppKit/Appkit.h>
+
+ typedef struct _PangoCairoCoreTextFontMapClass PangoCairoCoreTextFontMapClass;
+
+@@ -161,6 +164,106 @@ pango_cairo_core_text_font_map_context_key_equal (PangoCoreTextFontMap *fontmap
+ return cairo_font_options_equal (key_a, key_b);
+ }
+
++static int
++get_scaled_size (PangoCoreTextFontMap *fontmap,
++ PangoContext *context,
++ const PangoFontDescription *desc)
++{
++ double size = pango_font_description_get_size (desc);
++
++ if (!pango_font_description_get_size_is_absolute (desc))
++ {
++ double dpi = pango_cairo_core_text_font_map_get_resolution_core_text (fontmap, context);
++ size = size * dpi / 72.;
++ }
++
++ return .5 + pango_matrix_get_font_scale_factor (pango_context_get_matrix (context)) * size;
++}
++
++static PangoCoreTextFont *
++pango_cairo_core_text_font_map_load_font (PangoCoreTextFontMap *fontmap,
++ PangoContext *context,
++ const PangoFontDescription *description)
++{
++ char *descname = pango_font_description_get_family (description);
++
++ if (strcmp (descname, "-apple-system-font") == 0)
++ {
++ PangoCoreTextFont *cfont;
++ NSFont *sysfont;
++ CTFontDescriptorRef ctfontdescriptor;
++ cairo_matrix_t font_matrix;
++ PangoCoreTextFontsetKey fontset_key;
++ PangoCoreTextFontKey key;
++ PangoLanguage *language;
++ PangoFontDescription *tmp_desc;
++ gboolean synthetic_italic = FALSE;
++ double abs_size = get_scaled_size (fontmap, context, description);
++ double size = pango_units_to_double (abs_size) / pango_matrix_get_font_scale_factor (pango_context_get_matrix (context));
++
++ sysfont = [NSFont systemFontOfSize: size];
++ ctfontdescriptor = (CTFontDescriptorRef)[sysfont fontDescriptor];
++
++ PangoCairoCoreTextFont *cafont = g_object_new (PANGO_TYPE_CAIRO_CORE_TEXT_FONT, NULL);
++ cfont = PANGO_CORE_TEXT_FONT (cafont);
++ cafont->abs_size = abs_size;
++ _pango_core_text_font_set_ctfont (cfont, CFRetain (sysfont));
++
++ tmp_desc = pango_font_description_copy_static (description);
++
++ _pango_core_text_fontset_key_init (&fontset_key,
++ fontmap,
++ context,
++ tmp_desc,
++ pango_context_get_language (context));
++ _pango_core_text_font_key_init (&key,
++ fontmap,
++ &fontset_key,
++ ctfontdescriptor,
++ synthetic_italic);
++
++ if (pango_core_text_font_key_get_synthetic_italic (&key))
++ synthetic_italic = TRUE;
++
++ if (synthetic_italic)
++ {
++ cairo_matrix_init (&font_matrix,
++ 1, 0,
++ -0.25, 1,
++ 0, 0);
++ }
++ else
++ {
++ cairo_matrix_init_identity (&font_matrix);
++ }
++
++ cairo_matrix_scale (&font_matrix, size, size);
++
++ _pango_cairo_font_private_initialize (&cafont->cf_priv,
++ (PangoCairoFont *)cafont,
++ pango_core_text_font_key_get_gravity (&key),
++ pango_core_text_font_key_get_context_key (&key),
++ pango_core_text_font_key_get_matrix (&key),
++ &font_matrix);
++
++ PangoCoreTextFont *tmp_font = _pango_core_text_font_map_lookup_font (fontmap, &key);
++ if (tmp_font)
++ {
++ g_object_ref (tmp_font);
++ return tmp_font;
++ }
++ else
++ {
++ g_object_ref (cfont);
++ _pango_core_text_font_map_add (PANGO_CORE_TEXT_FONT_MAP (fontmap), &key, cfont);
++
++ return cfont;
++ }
++ }
++
++ return PANGO_FONT_MAP_CLASS (pango_cairo_core_text_font_map_parent_class)->load_font (fontmap, context, description);
++}
++
+ static void
+ pango_cairo_core_text_font_map_class_init (PangoCairoCoreTextFontMapClass *class)
+ {
+@@ -170,6 +273,7 @@ pango_cairo_core_text_font_map_class_init (PangoCairoCoreTextFontMapClass *class
+
+ object_class->finalize = pango_cairo_core_text_font_map_finalize;
+
++ fontmap_class->load_font = pango_cairo_core_text_font_map_load_font;
+ fontmap_class->get_serial = pango_cairo_core_text_font_map_get_serial;
+ fontmap_class->changed = pango_cairo_core_text_font_map_changed;
+
+diff --git a/pango/pangocoretext-fontmap.c b/pango/pangocoretext-fontmap.c
+index bcbb173..4234bf1 100644
+--- a/pango/pangocoretext-fontmap.c
++++ b/pango/pangocoretext-fontmap.c
+@@ -28,6 +28,7 @@
+ #include "pango-impl-utils.h"
+ #include "modules.h"
+
++#import <AppKit/Appkit.h>
+ #include <Carbon/Carbon.h>
+
+ typedef struct _FontHashKey FontHashKey;
+@@ -826,28 +827,12 @@ get_scaled_size (PangoCoreTextFontMap *fontmap,
+ return .5 + pango_matrix_get_font_scale_factor (pango_context_get_matrix (context)) * size;
+ }
+
+-
+-/*
+- * PangoCoreTextFontsetKey
+- */
+-struct _PangoCoreTextFontsetKey
+-{
+- PangoCoreTextFontMap *fontmap;
+- PangoLanguage *language;
+- PangoFontDescription *desc;
+- PangoMatrix matrix;
+- int pixelsize;
+- double resolution;
+- PangoGravity gravity;
+- gpointer context_key;
+-};
+-
+-static void
+-pango_core_text_fontset_key_init (PangoCoreTextFontsetKey *key,
+- PangoCoreTextFontMap *fontmap,
+- PangoContext *context,
+- const PangoFontDescription *desc,
+- PangoLanguage *language)
++void
++_pango_core_text_fontset_key_init (PangoCoreTextFontsetKey *key,
++ PangoCoreTextFontMap *fontmap,
++ PangoContext *context,
++ const PangoFontDescription *desc,
++ PangoLanguage *language)
+ {
+ if (!language && context)
+ language = pango_context_get_language (context);
+@@ -960,27 +945,12 @@ pango_core_text_fontset_key_get_context_key (const PangoCoreTextFontsetKey *key)
+ return key->context_key;
+ }
+
+-/*
+- * PangoCoreTextFontKey
+- */
+-struct _PangoCoreTextFontKey
+-{
+- PangoCoreTextFontMap *fontmap;
+- CTFontDescriptorRef ctfontdescriptor;
+- PangoMatrix matrix;
+- PangoGravity gravity;
+- int pixelsize;
+- double resolution;
+- gboolean synthetic_italic;
+- gpointer context_key;
+-};
+-
+-static void
+-pango_core_text_font_key_init (PangoCoreTextFontKey *key,
+- PangoCoreTextFontMap *ctfontmap,
+- PangoCoreTextFontsetKey *fontset_key,
+- CTFontDescriptorRef ctdescriptor,
+- gboolean synthetic_italic)
++void
++_pango_core_text_font_key_init (PangoCoreTextFontKey *key,
++ PangoCoreTextFontMap *ctfontmap,
++ PangoCoreTextFontsetKey *fontset_key,
++ CTFontDescriptorRef ctdescriptor,
++ gboolean synthetic_italic)
+ {
+ key->fontmap = ctfontmap;
+ key->ctfontdescriptor = ctdescriptor;
+@@ -1104,14 +1074,24 @@ pango_core_text_font_key_get_ctfontdescriptor (const PangoCoreTextFontKey *key)
+ return key->ctfontdescriptor;
+ }
+
++PangoCoreTextFont *
++_pango_core_text_font_map_lookup_font (PangoCoreTextFontMap *fontmap,
++ PangoCoreTextFontKey *key)
++{
++ return g_hash_table_lookup (fontmap->font_hash, key);
++}
+
+-
+-static void
+-pango_core_text_font_map_add (PangoCoreTextFontMap *ctfontmap,
+- PangoCoreTextFontKey *key,
+- PangoCoreTextFont *ctfont)
++void
++_pango_core_text_font_map_add (PangoCoreTextFontMap *ctfontmap,
++ PangoCoreTextFontKey *key,
++ PangoCoreTextFont *ctfont)
+ {
+ PangoCoreTextFontKey *key_copy;
++ PangoCoreTextFont *tmp;
++
++ tmp = g_hash_table_lookup (ctfontmap->font_hash, key);
++ if (tmp)
++ return;
+
+ _pango_core_text_font_set_font_map (ctfont, ctfontmap);
+
+@@ -1130,8 +1110,8 @@ pango_core_text_font_map_new_font (PangoCoreTextFontMap *fontmap,
+ PangoCoreTextFont *font;
+ PangoCoreTextFontKey key;
+
+- pango_core_text_font_key_init (&key, fontmap, fontset_key, ctfontdescriptor,
+- synthetic_italic);
++ _pango_core_text_font_key_init (&key, fontmap, fontset_key, ctfontdescriptor,
++ synthetic_italic);
+
+ font = g_hash_table_lookup (fontmap->font_hash, &key);
+ if (font)
+@@ -1144,7 +1124,7 @@ pango_core_text_font_map_new_font (PangoCoreTextFontMap *fontmap,
+ if (!font)
+ return NULL;
+
+- pango_core_text_font_map_add (fontmap, &key, font);
++ _pango_core_text_font_map_add (fontmap, &key, font);
+
+ return font;
+ }
+@@ -1295,8 +1275,8 @@ pango_core_text_font_map_load_fontset (PangoFontMap *fontmap,
+ PangoCoreTextFontMap *ctfontmap = PANGO_CORE_TEXT_FONT_MAP (fontmap);
+ static gboolean warned_full_fallback = FALSE; /* MT-safe */
+
+- pango_core_text_fontset_key_init (&key, ctfontmap,
+- context, desc, language);
++ _pango_core_text_fontset_key_init (&key, ctfontmap,
++ context, desc, language);
+
+ fontset = g_hash_table_lookup (ctfontmap->fontset_hash, &key);
+
+@@ -1320,8 +1300,8 @@ pango_core_text_font_map_load_fontset (PangoFontMap *fontmap,
+ tmp_desc = pango_font_description_copy_static (desc);
+ pango_font_description_set_family_static (tmp_desc, "Sans");
+
+- pango_core_text_fontset_key_init (&key, ctfontmap, context, tmp_desc,
+- language);
++ _pango_core_text_fontset_key_init (&key, ctfontmap, context, tmp_desc,
++ language);
+
+ fontset = g_hash_table_lookup (ctfontmap->fontset_hash, &key);
+ if (G_LIKELY (fontset))
+@@ -1450,6 +1430,53 @@ pango_core_text_font_map_init (PangoCoreTextFontMap *ctfontmap)
+ CFRelease (dict);
+ }
+
++ if (true)
++ {
++ NSFont *sysfont = [NSFont systemFontOfSize: 0.0];
++ NSString *name = [[NSFont fontWithName: [[sysfont fontDescriptor] postscriptName] size: 0.0] familyName];
++
++ NSArray *fontfaces = [[NSFontManager sharedFontManager] availableMembersOfFontFamily: name];
++ int num_faces = [fontfaces count];
++ CFRelease (name);
++
++ for (int faceindex = 0; faceindex < num_faces; faceindex++)
++ {
++ SInt64 font_traits;
++ char *buffer;
++ char *family_name;
++ CFNumberRef number;
++ CFDictionaryRef dict;
++ CTFontDescriptorRef desc = [sysfont fontDescriptor];
++
++ buffer = ct_font_descriptor_get_family_name (desc, TRUE);
++ if (!buffer)
++ continue;
++
++ family_name = g_utf8_casefold (buffer, -1);
++ family = g_hash_table_lookup (ctfontmap->families, family_name);
++ if (!family)
++ {
++ family = g_object_new (PANGO_TYPE_CORE_TEXT_FAMILY, NULL);
++ g_hash_table_insert (ctfontmap->families, g_strdup ("-apple-system-font"), family);
++ family->family_name = g_strdup (buffer);
++ }
++
++ g_free (buffer);
++ g_free (family_name);
++
++ dict = CTFontDescriptorCopyAttribute (desc, kCTFontTraitsAttribute);
++ number = (CFNumberRef)CFDictionaryGetValue (dict, kCTFontSymbolicTrait);
++
++ if (CFNumberGetValue (number, kCFNumberSInt64Type, &font_traits))
++ {
++ if ((font_traits & kCTFontMonoSpaceTrait) == kCTFontMonoSpaceTrait)
++ family->is_monospace = TRUE;
++ }
++
++ CFRelease (dict);
++ }
++ }
++
+ /* Insert aliases */
+ family = g_object_new (PANGO_TYPE_CORE_TEXT_FAMILY, NULL);
+ family->family_name = g_strdup ("Sans");
+diff --git a/pango/pangocoretext-private.h b/pango/pangocoretext-private.h
+index 8076eae..5c6ce41 100644
+--- a/pango/pangocoretext-private.h
++++ b/pango/pangocoretext-private.h
+@@ -81,6 +81,30 @@ struct _PangoCoreTextFontMapClass
+ PangoContext *context);
+ };
+
++struct _PangoCoreTextFontKey
++{
++ PangoCoreTextFontMap *fontmap;
++ CTFontDescriptorRef ctfontdescriptor;
++ PangoMatrix matrix;
++ PangoGravity gravity;
++ int pixelsize;
++ double resolution;
++ gboolean synthetic_italic;
++ gpointer context_key;
++};
++
++struct _PangoCoreTextFontsetKey
++{
++ PangoCoreTextFontMap *fontmap;
++ PangoLanguage *language;
++ PangoFontDescription *desc;
++ PangoMatrix matrix;
++ int pixelsize;
++ double resolution;
++ PangoGravity gravity;
++ gpointer context_key;
++};
++
+
+ GType pango_core_text_font_map_get_type (void) G_GNUC_CONST;
+
+@@ -97,6 +121,24 @@ void _pango_core_text_font_set_font_key (PangoCoreTextF
+ void _pango_core_text_font_set_ctfont (PangoCoreTextFont *font,
+ CTFontRef font_ref);
+
++void _pango_core_text_fontset_key_init (PangoCoreTextFontsetKey *key,
++ PangoCoreTextFontMap *fontmap,
++ PangoContext *context,
++ const PangoFontDescription *desc,
++ PangoLanguage *language);
++void _pango_core_text_font_key_init (PangoCoreTextFontKey *key,
++ PangoCoreTextFontMap *ctfontmap,
++ PangoCoreTextFontsetKey *fontset_key,
++ CTFontDescriptorRef ctdescriptor,
++ gboolean synthetic_italic);
++
++void _pango_core_text_font_map_add (PangoCoreTextFontMap *ctfontmap,
++ PangoCoreTextFontKey *key,
++ PangoCoreTextFont *ctfont);
++
++PangoCoreTextFont *_pango_core_text_font_map_lookup_font (PangoCoreTextFontMap *fontmap,
++ PangoCoreTextFontKey *key);
++
+ PangoFontDescription *_pango_core_text_font_description_from_ct_font_descriptor (CTFontDescriptorRef desc);
+
+ int pango_core_text_font_key_get_absolute_size (const PangoCoreTextFontKey *key);
--- /dev/null
+diff --git a/libs/tiff-4.0.2/tools/tiffgt.c b/libs/tiff-4.0.2/tools/tiffgt.c
+index de42039..4c8e509 100644
+--- a/tools/tiffgt.c
++++ b/tools/tiffgt.c
+@@ -31,11 +31,16 @@
+ #include <string.h>
+ #include <unistd.h>
+
+-#if HAVE_APPLE_OPENGL_FRAMEWORK
++#if HAVE_OPENGL_GL_H
+ # include <OpenGL/gl.h>
++#endif
++#if HAVE_GLUT_GLUT_H
+ # include <GLUT/glut.h>
+-#else
++#endif
++#if HAVE_GL_GL_H
+ # include <GL/gl.h>
++#endif
++#if HAVE_GL_GLUT_H
+ # include <GL/glut.h>
+ #endif
--- /dev/null
+import glob
+import os
+import shutil
+
+
+class PCLReferenceAssembliesPackage(Package):
+
+ def __init__(self):
+ Package.__init__(self,
+ name='PortableReferenceAssemblies',
+ version='2014-04-14',
+ sources=['http://storage.bos.xamarin.com/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()
--- /dev/null
+class PixmanPackage (CairoGraphicsPackage):
+
+ def __init__(self):
+ CairoGraphicsPackage.__init__(self, 'pixman', '0.30.0')
+
+PixmanPackage()
--- /dev/null
+package = FreeDesktopPackage('%{name}', 'pkg-config', '0.27',
+ configure_flags=["--with-internal-glib"])
+
+package.needs_lipo = True
--- /dev/null
+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):
+
+ 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"
+
+ self.self_dir = os.path.realpath(os.path.dirname(sys.argv[0]))
+ self.packaging_dir = os.path.join(self.self_dir, "packaging")
+
+ 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
+ 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' % self.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"' %
+ (self.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.self_dir, 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(self.package_root, "lib", "mono", "gac")
+ confs = [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(self.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
--- /dev/null
+Package('sqlite-autoconf', '3090200', sources=[
+ 'http://www.sqlite.org/2015/%{name}-%{version}.tar.gz'
+])
--- /dev/null
+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()
--- /dev/null
+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()
from glob import glob
-from MonoReleaseProfile import MonoReleaseProfile
+from MacSDK import profile
from bockbuild.util.util import *
class MonoXamarinPackageProfile(MonoReleaseProfile):
+ description = 'Signed package'
- def __init__(self):
- MonoReleaseProfile.__init__(self)
-
- # add the private stuff
- self.packages_to_build.extend(['mono-extensions'])
-
- if self.cmd_options.release_build:
+ def attach (self, bockbuild):
+ print dir(bockbuild)
+ MonoReleaseProfile.attach(self, bockbuild)
+ 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!")
error("%s IS NOT SIGNED:" % pkg)
finally:
os.chdir(oldcwd)
+
+MonoXamarinPackageProfile()
\ No newline at end of file
+++ /dev/null
-GnomeXzPackage('atk', version_major='2.8', version_minor='0')
+++ /dev/null
-class CairoPackage (CairoGraphicsXzPackage):
-
- def __init__(self):
- CairoGraphicsXzPackage.__init__(self, 'cairo', '1.12.14')
- self.sources.extend([
- 'patches/cairo-quartz-crash.patch',
- 'patches/cairo-fix-color-bitmap-fonts.patch',
- 'patches/cairo-fix-CGFontGetGlyphPath-deprecation.patch',
- # 'patches/cairo-cglayer.patch',
- ])
-
- def prep(self):
- Package.prep(self)
-
- if Package.profile.name == 'darwin':
- for p in range(1, len(self.local_sources)):
- self.sh('patch -p1 < "%{local_sources[' + str(p) + ']}"')
-
- def build(self):
- self.configure_flags = [
- '--enable-pdf',
- ]
-
- if Package.profile.name == 'darwin':
- self.configure_flags.extend([
- '--enable-quartz',
- '--enable-quartz-font',
- '--enable-quartz-image',
- '--disable-xlib',
- '--without-x'
- ])
- elif Package.profile.name == 'linux':
- self.configure_flags.extend([
- '--disable-quartz',
- '--with-x'
- ])
-
- Package.build(self)
-
-CairoPackage()
+++ /dev/null
-SourceForgePackage('expat', 'expat', '2.0.1')
+++ /dev/null
-class FontConfigPackage (Package):
-
- def __init__(self):
- Package.__init__(self, 'fontconfig', '2.10.2',
- configure_flags=['--disable-docs'],
- sources=[
- 'http://www.fontconfig.org/release/%{name}-%{version}.tar.gz'
- ],
- # note: a non-empty DESTDIR keeps fc-cache from running at
- # install-time
- )
-
- def build(self):
- if Package.profile.name == 'darwin':
- self.configure_flags.extend([
- '--with-cache-dir="~/Library/Caches/com.xamarin.fontconfig"',
- '--with-default-fonts=/System/Library/Fonts',
- '--with-add-fonts=/Library/Fonts,/Network/Library/Fonts,/System/Library/Fonts'
- ])
- Package.build(self)
-
-FontConfigPackage()
+++ /dev/null
-SourceForgePackage('%{name}', 'freetype', '2.5.0.1')
+++ /dev/null
-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()
+++ /dev/null
-class GdkPixbufPackage (GnomeXzPackage):
-
- def __init__(self):
- GnomeXzPackage.__init__(
- self,
- 'gdk-pixbuf',
- version_major='2.28',
- version_minor='2')
-
- if Package.profile.name == 'darwin':
- self.sources.extend([
- 'patches/gdk-pixbuf/0001-pixbuf-load-2x-variants-as-pixbuf-gobject-data.patch',
- 'patches/gdk-pixbuf/0001-pixbuf-Add-getter-setter-for-the-2x-variants.patch',
- ])
-
- self.configure_flags.extend(['--enable-gtk-doc-html=no'])
-
- def prep(self):
- Package.prep(self)
- if Package.profile.name == 'darwin':
- for p in range(1, len(self.local_sources)):
- self.sh(
- 'patch -p1 --ignore-whitespace < "%{local_sources[' + str(p) + ']}"')
-
- def deploy(self):
- self.loaders_cache = 'lib/gdk-pixbuf-2.0/2.10.0/loaders.cache'
- self.sh('gdk-pixbuf-query-loaders --update-cache ')
-
- # mark the file for destaging
- self.sh(
- 'cp %{staged_profile}/%{loaders_cache} %{staged_profile}/%{loaders_cache}.release')
- self.extra_stage_files = [self.loaders_cache]
-
-GdkPixbufPackage()
+++ /dev/null
-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
+++ /dev/null
->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
+++ /dev/null
-class GettextPackage (GnuPackage):
-
- def __init__(self):
- GnuPackage.__init__(self, 'gettext', '0.18.2',
- configure_flags=[
- '--disable-java',
- '--disable-libasprintf',
- '--disable-openmp',
- '--with-included-glib'
- ]
- )
-
- if Package.profile.name == 'darwin':
- self.configure_flags.extend([
- # only build the tools, osx has the lib
- # https://github.com/mxcl/homebrew/blob/master/Library/Formula/gettext.rb
- #'--without-included-gettext',
- ])
- self.sources.extend([
- # Don't build samples
- # https://trac.macports.org/export/79183/trunk/dports/devel/gettext/files/patch-gettext-tools-Makefile.in
- 'patches/gettext-no-samples.patch',
- ])
-
- def prep(self):
- Package.prep(self)
- if Package.profile.name == 'darwin':
- for p in range(1, len(self.local_sources)):
- self.sh('patch -p1 < "%{local_sources[' + str(p) + ']}"')
-
-GettextPackage()
+++ /dev/null
-class GlibPackage (GnomeXzPackage):
-
- def __init__(self):
- GnomeXzPackage.__init__(self,
- 'glib',
- version_major='2.36',
- version_minor='4')
-
- self.darwin = Package.profile.name == 'darwin'
-
- if self.darwin:
- # link to specific revisions for glib 2.30.x
- self.sources.extend([
- # https://trac.macports.org/export/91680/trunk/dports/devel/glib2/files/config.h.ed
- 'patches/glib/config.h.ed',
- # https://trac.macports.org/export/98985/trunk/dports/devel/glib2/files/patch-configure.diff
- 'patches/glib/patch-configure.diff',
- # https://trac.macports.org/export/42728/trunk/dports/devel/glib2/files/patch-gi18n.h.diff
- 'patches/glib/patch-gi18n.h.diff',
- # https://trac.macports.org/export/92608/trunk/dports/devel/glib2/files/patch-gio_gdbusprivate.c.diff
- 'patches/glib/patch-gio_gdbusprivate.c.diff',
- # https://trac.macports.org/export/49466/trunk/dports/devel/glib2/files/patch-gio_xdgmime_xdgmime.c.diff
- 'patches/glib/patch-gio_xdgmime_xdgmime.c.diff',
- # https://trac.macports.org/export/91680/trunk/dports/devel/glib2/files/patch-glib-2.0.pc.in.diff
- 'patches/glib/patch-glib-2.0.pc.in.diff',
- # https://trac.macports.org/export/64476/trunk/dports/devel/glib2/files/patch-glib_gunicollate.c.diff
- 'patches/glib/patch-glib_gunicollate.c.diff',
-
- # Bug 6156 - [gtk] Quitting the application with unsaved file and answering Cancel results in crash
- # https://bugzilla.xamarin.com/attachment.cgi?id=2214
- 'patches/glib-recursive-poll.patch',
- ])
-
- def prep(self):
- Package.prep(self)
- if self.darwin:
- for p in range(2, 8):
- self.sh('patch -p0 < %{local_sources[' + str(p) + ']}')
- for p in range(8, len(self.local_sources)):
- self.sh(
- 'patch --ignore-whitespace -p1 < %{local_sources[' + str(p) + ']}')
-
- def arch_build(self, arch):
- if arch == 'darwin-universal': # multi-arch build pass
- self.local_ld_flags = ['-arch i386', '-arch x86_64']
- self.local_gcc_flags = ['-arch i386', '-arch x86_64', '-Os']
- self.local_configure_flags = ['--disable-dependency-tracking']
- else:
- Package.arch_build(self, arch)
-
- if self.darwin:
- self.local_configure_flags.extend(['--disable-compile-warnings'])
-
- def build(self):
- # modified build for darwin
- if self.darwin:
- self.local_configure_flags.extend(['--disable-compile-warnings'])
- Package.configure(self)
- self.sh([
- # 'autoconf',
- #'%{configure} --disable-compile-warnings',
- 'ed - config.h < %{local_sources[1]}',
- # work around
- # https://bugzilla.gnome.org/show_bug.cgi?id=700350
- 'touch docs/reference/*/Makefile.in',
- 'touch docs/reference/*/*/Makefile.in',
- #'%{make}'
- ])
- Package.make(self)
- else:
- Package.build(self)
-
- def install(self):
- Package.install(self)
- if self.darwin:
- # FIXME: necessary?
- self.sh('rm -f %{staged_prefix}/lib/charset.alias')
-
-GlibPackage()
+++ /dev/null
-GnomePackage('gtk-engines', version_major='2.20', version_minor='2',
- configure_flags=[''])
+++ /dev/null
-class GtkQuartzEnginePackage (Package):
-
- def __init__(self):
- Package.__init__(self, 'gtk-quartz-engine',
- sources=[
- 'git://github.com/mono/gtk-quartz-engine.git'],
- override_properties={
- 'configure': './autogen.sh --prefix=%{package_prefix}',
- 'needs_lipo': True
- },
- revision='9555a08f0c9c98d02153c9d77b54a2dd83ce5d6f')
-
-GtkQuartzEnginePackage()
+++ /dev/null
-class GtkSharp212ReleasePackage (Package):
-
- def __init__(self):
- Package.__init__(self, 'gtk-sharp',
- sources=['git://github.com/mono/gtk-sharp.git'],
- git_branch='gtk-sharp-2-12-branch',
- revision='f092864bce996c4ac51a13281069067d1e7e6d4b',
- override_properties={
- 'configure': './bootstrap-2.12 --prefix=%{package_prefix}',
- }
- )
- self.make = 'make CSC=mcs'
-
-GtkSharp212ReleasePackage()
+++ /dev/null
-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"
+++ /dev/null
-FreeDesktopPackage('icon-theme', 'hicolor-icon-theme', '0.12')
+++ /dev/null
-SourceForgePackage('gtk-osx', 'ige-mac-integration', '0.9.4', ['--without-compile-warnings'],
- override_properties={'configure': './configure --prefix="%{staged_prefix}"',
- 'makeinstall': 'make install'})
+++ /dev/null
-class IntltoolPackage (Package):
-
- def __init__(self):
- Package.__init__(self, 'intltool', '0.50.2',
- sources=[
- 'https://launchpad.net/%{name}/trunk/%{version}/+download/%{name}-%{version}.tar.gz'
- ]
- )
-
-IntltoolPackage()
+++ /dev/null
-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()
+++ /dev/null
-GnomeXzPackage('libcroco', version_major='0.6', version_minor='8',
- configure_flags=[
- '--host=i386-apple-darwin',
- '--disable-Bsymbolic',
- '--enable-gtk-doc-html=no'
- ])
+++ /dev/null
-class LibFfiPackage (Package):
-
- def __init__(self):
- Package.__init__(self, 'libffi', '3.0.13', sources=[
- 'ftp://sourceware.org/pub/%{name}/%{name}-%{version}.tar.gz'])
-
-LibFfiPackage()
+++ /dev/null
-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'})
+++ /dev/null
-SourceForgePackage('giflib', 'giflib', '4.1.6')
+++ /dev/null
-GnomePackage('libglade', '2.6', '4')
+++ /dev/null
-class LibJpegPackage (Package):
-
- def __init__(self):
- Package.__init__(self, 'libjpeg', '8', sources=[
- 'http://www.ijg.org/files/jpegsrc.v8.tar.gz'])
- self.source_dir_name = 'jpeg-8'
-
-LibJpegPackage()
+++ /dev/null
-class LibPngPackage (Package):
-
- def __init__(self):
- Package.__init__(self, 'libpng', '1.4.12',
- sources=[
- 'http://downloads.sourceforge.net/project/libpng/libpng14/older-releases/1.4.12/libpng-1.4.12.tar.xz'],
- configure_flags=['--enable-shared'])
-
-LibPngPackage()
+++ /dev/null
-class LibrsvgPackage(GnomeXzPackage):
-
- def __init__(self):
- GnomeXzPackage.__init__(self, 'librsvg', version_major='2.37', version_minor='0',
- configure_flags=['--disable-Bsymbolic', '--disable-introspection'])
-
- make = 'make DESTDIR=%{stage_root}'
-
- def install(self):
- # handle some mislocation
- misdir = '%s%s' % (self.stage_root, self.staged_profile)
- unprotect_dir(self.stage_root)
-
- Package.install(self)
- # scoop up
- if not os.path.exists(misdir):
- error('Could not find mislocated libsrvg files')
-
- self.sh(
- 'rsync -a --ignore-existing %s/* %s' %
- (misdir, self.staged_prefix))
- self.sh('rm -rf %s/*' % misdir)
-
- def deploy(self):
- self.sh('gdk-pixbuf-query-loaders --update-cache')
-
-LibrsvgPackage()
+++ /dev/null
-class LibTiffPackage (Package):
-
- def __init__(self):
- Package.__init__(self, 'tiff', '4.0.3',
- configure_flags=[
- ],
- sources=[
- 'http://download.osgeo.org/libtiff/tiff-%{version}.tar.gz',
- ])
-
- self.needs_lipo = True
-
- if Package.profile.name == 'darwin':
- self.sources.extend([
- # Fix Snow Leopard build
- # http://jira.freeswitch.org/secure/attachment/17487/tiff-4.0.2-macosx-2.patch
- 'patches/tiff-4.0.2-macosx-2.patch'
- ])
-
- def prep(self):
- Package.prep(self)
- if Package.profile.name == 'darwin':
- for p in range(1, len(self.local_sources)):
- self.sh('patch -p1 < "%{local_sources[' + str(p) + ']}"')
-
-LibTiffPackage()
+++ /dev/null
-class LibXmlPackage (Package):
-
- def __init__(self):
- Package.__init__(self,
- 'libxml2',
- '2.9.1',
- configure_flags=['--with-python=no'],
- sources=[
- 'ftp://xmlsoft.org/%{name}/%{name}-%{version}.tar.gz',
- ]
- )
-
- def prep(self):
- Package.prep(self)
- if Package.profile.name == 'darwin':
- for p in range(1, len(self.local_sources)):
- self.sh('patch -p1 < "%{local_sources[' + str(p) + ']}"')
-
-LibXmlPackage()
+++ /dev/null
-
-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()
+++ /dev/null
-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()
+++ /dev/null
-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 self.profile.arch == 'darwin-universal':
- os.symlink('mono-sgen64', '%s/bin/mono64' % self.staged_profile)
- os.symlink('mono-sgen32', '%s/bin/mono32' % self.staged_profile)
-
- text = " ".join(open('%s/bin/mcs' % self.staged_profile).readlines())
- regex = os.path.join(
- self.profile.MONO_ROOT,
- "Versions",
- r"(\d+\.\d+\.\d+)")
- match = re.search(regex, text)
- if match is None:
- return
- token = match.group(1)
-
- trace(token)
- trace(self.package_prefix)
- if self.package_prefix not in match:
- error("%s references Mono %s\n%s" % ('mcs', match, text))
-
-MonoMasterPackage()
+++ /dev/null
-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()
+++ /dev/null
-class MurrinePackage (GnomeXzPackage):
-
- def __init__(self):
- GnomePackage.__init__(self,
- 'murrine',
- version_major='0.98',
- version_minor='2')
-
- # FIXME: this may need porting
- # self.sources.append ('patches/murrine-osx.patch')
-
- def prep(self):
- Package.prep(self)
-
-MurrinePackage()
+++ /dev/null
-
-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()
+++ /dev/null
-<?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>
+++ /dev/null
-<?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>
+++ /dev/null
-#!/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
+++ /dev/null
-{\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.
-}
+++ /dev/null
-{\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
+++ /dev/null
-{\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
+++ /dev/null
-<?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>
+++ /dev/null
-#!/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}
-
-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}
+++ /dev/null
-<?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>
+++ /dev/null
-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
+++ /dev/null
-#!/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
+++ /dev/null
-class PangoPackage (GnomeXzPackage):
-
- def __init__(self):
- GnomePackage.__init__(self,
- 'pango',
- version_major='1.35',
- version_minor='0',
- configure_flags=[
- '--without-x',
- '--enable-gtk-doc-html=no'
- ]
- )
-
- self.sources.extend([
- # 1
- # Bug 321419 - Allow environment var substitution in Pango config
- # https://bugzilla.gnome.org/show_bug.cgi?id=321419
- 'patches/pango-relative-config-file.patch',
-
- # BXC 10257 - Characters outside the Basic Multilingual Plane don't render correctly
- # https://bugzilla.xamarin.com/show_bug.cgi?id=10257
- 'patches/pango-coretext-astral-plane-1.patch',
- 'patches/pango-coretext-astral-plane-2.patch',
-
- # Bug 15787 - Caret position is wrong when there are ligatures
- # https://bugzilla.xamarin.com/show_bug.cgi?id=15787
- 'patches/pango-disable-ligatures.patch',
-
- # https://bugzilla.xamarin.com/show_bug.cgi?id=22199
- 'patches/pango-fix-ct_font_descriptor_get_weight-crasher.patch',
-
- # https://bugzilla.gnome.org/show_bug.cgi?id=734372
- 'patches/pango-coretext-condensed-trait.patch',
-
- # https://bugzilla.xamarin.com/show_bug.cgi?id=32938
- 'patches/pango-coretext-fix-yosemite-crasher.patch',
-
- 'patches/pango-system-font-single.patch',
- 'patches/pango-system-font-check-version.patch'
- ])
-
- def prep(self):
- GnomePackage.prep(self)
- if Package.profile.name == 'darwin':
- for p in range(1, len(self.local_sources)):
- self.sh('patch -p1 < "%{local_sources[' + str(p) + ']}"')
-
- def deploy(self):
- self.sh('pango-querymodules --update-cache')
-
-PangoPackage()
+++ /dev/null
---- a/src/cairo-quartz-font.c 2012-11-13 18:20:00.000000000 -0800
-+++ b/src/cairo-quartz-font.c 2012-11-13 18:06:56.000000000 -0800
-@@ -90,8 +90,9 @@ static int (*CGFontGetAscentPtr) (CGFont
- static int (*CGFontGetDescentPtr) (CGFontRef fontRef) = NULL;
- static int (*CGFontGetLeadingPtr) (CGFontRef fontRef) = NULL;
-
--/* Not public anymore in 64-bits nor in 10.7 */
--static ATSFontRef (*FMGetATSFontRefFromFontPtr) (FMFont iFont) = NULL;
-+/* CTFontCreateWithGraphicsFont is not public until 10.5. */
-+typedef const struct __CTFontDescriptor *CTFontDescriptorRef;
-+static CTFontRef (*CTFontCreateWithGraphicsFontPtr) (CGFontRef, CGFloat, const CGAffineTransform *, CTFontDescriptorRef) = NULL;
-
- static cairo_bool_t _cairo_quartz_font_symbol_lookup_done = FALSE;
- static cairo_bool_t _cairo_quartz_font_symbols_present = FALSE;
-@@ -130,7 +131,7 @@ quartz_font_ensure_symbols(void)
- CGContextGetAllowsFontSmoothingPtr = dlsym(RTLD_DEFAULT, "CGContextGetAllowsFontSmoothing");
- CGContextSetAllowsFontSmoothingPtr = dlsym(RTLD_DEFAULT, "CGContextSetAllowsFontSmoothing");
-
-- FMGetATSFontRefFromFontPtr = dlsym(RTLD_DEFAULT, "FMGetATSFontRefFromFont");
-+ CTFontCreateWithGraphicsFontPtr = dlsym(RTLD_DEFAULT, "CTFontCreateWithGraphicsFont");
-
- if ((CGFontCreateWithFontNamePtr || CGFontCreateWithNamePtr) &&
- CGFontGetGlyphBBoxesPtr &&
-@@ -155,6 +156,7 @@ struct _cairo_quartz_font_face {
- cairo_font_face_t base;
-
- CGFontRef cgFont;
-+ CTFontRef ctFont;
- };
-
- /*
-@@ -239,6 +241,10 @@ _cairo_quartz_font_face_destroy (void *a
- {
- cairo_quartz_font_face_t *font_face = (cairo_quartz_font_face_t*) abstract_face;
-
-+ if (font_face->ctFont) {
-+ CFRelease (font_face->ctFont);
-+ }
-+
- CGFontRelease (font_face->cgFont);
- }
-
-@@ -363,6 +369,12 @@ cairo_quartz_font_face_create_for_cgfont
-
- font_face->cgFont = CGFontRetain (font);
-
-+ if (CTFontCreateWithGraphicsFontPtr) {
-+ font_face->ctFont = CTFontCreateWithGraphicsFontPtr (font, 1.0, NULL, NULL);
-+ } else {
-+ font_face->ctFont = NULL;
-+ }
-+
- _cairo_font_face_init (&font_face->base, &_cairo_quartz_font_face_backend);
-
- return &font_face->base;
-@@ -782,49 +794,10 @@ _cairo_quartz_scaled_font_get_cg_font_re
- return ffont->cgFont;
- }
-
--/*
-- * compat with old ATSUI backend
-- */
--
--/**
-- * cairo_quartz_font_face_create_for_atsu_font_id
-- * @font_id: an ATSUFontID for the font.
-- *
-- * Creates a new font for the Quartz font backend based on an
-- * #ATSUFontID. This font can then be used with
-- * cairo_set_font_face() or cairo_scaled_font_create().
-- *
-- * Return value: a newly created #cairo_font_face_t. Free with
-- * cairo_font_face_destroy() when you are done using it.
-- *
-- * Since: 1.6
-- **/
--cairo_font_face_t *
--cairo_quartz_font_face_create_for_atsu_font_id (ATSUFontID font_id)
-+CTFontRef
-+_cairo_quartz_scaled_font_get_ct_font_ref (cairo_scaled_font_t *abstract_font)
- {
-- quartz_font_ensure_symbols();
--
-- if (FMGetATSFontRefFromFontPtr != NULL) {
-- ATSFontRef atsFont = FMGetATSFontRefFromFontPtr (font_id);
-- CGFontRef cgFont = CGFontCreateWithPlatformFont (&atsFont);
-- cairo_font_face_t *ff;
--
-- ff = cairo_quartz_font_face_create_for_cgfont (cgFont);
--
-- CGFontRelease (cgFont);
--
-- return ff;
-- } else {
-- _cairo_error_throw (CAIRO_STATUS_NO_MEMORY);
-- return (cairo_font_face_t *)&_cairo_font_face_nil;
-- }
--}
--
--/* This is the old name for the above function, exported for compat purposes */
--cairo_font_face_t *cairo_atsui_font_face_create_for_atsu_font_id (ATSUFontID font_id);
-+ cairo_quartz_font_face_t *ffont = _cairo_quartz_scaled_to_face(abstract_font);
-
--cairo_font_face_t *
--cairo_atsui_font_face_create_for_atsu_font_id (ATSUFontID font_id)
--{
-- return cairo_quartz_font_face_create_for_atsu_font_id (font_id);
-+ return ffont->ctFont;
- }
---- a/src/cairo-quartz-image-surface.c 2010-06-18 04:47:13.000000000 -0700
-+++ b/src/cairo-quartz-image-surface.c 2012-11-13 18:06:56.000000000 -0800
-@@ -148,6 +148,8 @@ _cairo_quartz_image_surface_flush (void
- surface->image = newImage;
- CGImageRelease (oldImage);
-
-+ surface->base.is_clear = surface->imageSurface->base.is_clear;
-+
- return CAIRO_STATUS_SUCCESS;
- }
-
-@@ -270,6 +272,8 @@ cairo_quartz_image_surface_create (cairo
- qisurf->image = image;
- qisurf->imageSurface = image_surface;
-
-+ qisurf->base.is_clear = image_surface->base.is_clear;
-+
- return &qisurf->base;
- }
-
---- a/src/cairo-quartz-private.h 2010-12-25 06:21:34.000000000 -0800
-+++ b/src/cairo-quartz-private.h 2012-11-13 18:06:56.000000000 -0800
-@@ -50,6 +50,9 @@ typedef CGFloat cairo_quartz_float_t;
- typedef float cairo_quartz_float_t;
- #endif
-
-+/* define CTFontRef for pre-10.5 SDKs */
-+typedef const struct __CTFont *CTFontRef;
-+
- typedef struct cairo_quartz_surface {
- cairo_surface_t base;
-
-@@ -60,21 +63,22 @@ typedef struct cairo_quartz_surface {
- cairo_surface_t *imageSurfaceEquiv;
-
- cairo_surface_clipper_t clipper;
-- cairo_rectangle_int_t extents;
-
-- /* These are stored while drawing operations are in place, set up
-- * by quartz_setup_source() and quartz_finish_source()
-+ /**
-+ * If non-null, this is a CGImage representing the contents of the surface.
-+ * We clear this out before any painting into the surface, so that we
-+ * don't force a copy to be created.
- */
-- CGAffineTransform sourceTransform;
-+ CGImageRef bitmapContextImage;
-
-- CGImageRef sourceImage;
-- cairo_surface_t *sourceImageSurface;
-- CGRect sourceImageRect;
-+ /**
-+ * If non-null, this is the CGLayer for the surface.
-+ */
-+ CGLayerRef cgLayer;
-
-- CGShadingRef sourceShading;
-- CGPatternRef sourcePattern;
-+ cairo_rectangle_int_t extents;
-
-- CGInterpolationQuality oldInterpolationQuality;
-+ cairo_bool_t ownsData;
- } cairo_quartz_surface_t;
-
- typedef struct cairo_quartz_image_surface {
-@@ -103,6 +107,9 @@ _cairo_quartz_create_cgimage (cairo_form
- CGFontRef
- _cairo_quartz_scaled_font_get_cg_font_ref (cairo_scaled_font_t *sfont);
-
-+CTFontRef
-+_cairo_quartz_scaled_font_get_ct_font_ref (cairo_scaled_font_t *sfont);
-+
- #else
-
- # error Cairo was not compiled with support for the quartz backend
---- a/src/cairo-quartz-surface.c 2012-11-13 18:20:00.000000000 -0800
-+++ b/src/cairo-quartz-surface.c 2012-11-13 18:06:56.000000000 -0800
-@@ -41,6 +41,8 @@
-
- #include "cairo-error-private.h"
- #include "cairo-surface-clipper-private.h"
-+#include "cairo-gstate-private.h"
-+#include "cairo-private.h"
-
- #include <dlfcn.h>
-
-@@ -77,6 +79,11 @@
- * This macro can be used to conditionally compile backend-specific code.
- */
-
-+/* Here are some of the differences between cairo and CoreGraphics
-+ - cairo has only a single source active at once vs. CoreGraphics having
-+ separate sources for stroke and fill
-+*/
-+
- /* This method is private, but it exists. Its params are are exposed
- * as args to the NS* method, but not as CG.
- */
-@@ -126,6 +133,12 @@ static void (*CGContextSetShouldAntialia
- static void (*CGContextSetAllowsFontSmoothingPtr) (CGContextRef, bool) = NULL;
- static bool (*CGContextGetAllowsFontSmoothingPtr) (CGContextRef) = NULL;
- static CGPathRef (*CGContextCopyPathPtr) (CGContextRef) = NULL;
-+static CGFloat (*CGContextGetAlphaPtr) (CGContextRef) = NULL;
-+
-+/* CTFontDrawGlyphs is not available until 10.7 */
-+static void (*CTFontDrawGlyphsPtr) (CTFontRef, const CGGlyph[], const CGPoint[], size_t, CGContextRef) = NULL;
-+
-+static SInt32 _cairo_quartz_osx_version = 0x0;
-
- static cairo_bool_t _cairo_quartz_symbol_lookup_done = FALSE;
-
-@@ -160,6 +173,14 @@ static void quartz_ensure_symbols(void)
- CGContextCopyPathPtr = dlsym(RTLD_DEFAULT, "CGContextCopyPath");
- CGContextGetAllowsFontSmoothingPtr = dlsym(RTLD_DEFAULT, "CGContextGetAllowsFontSmoothing");
- CGContextSetAllowsFontSmoothingPtr = dlsym(RTLD_DEFAULT, "CGContextSetAllowsFontSmoothing");
-+ CGContextGetAlphaPtr = dlsym(RTLD_DEFAULT, "CGContextGetAlpha");
-+
-+ CTFontDrawGlyphsPtr = dlsym(RTLD_DEFAULT, "CTFontDrawGlyphs");
-+
-+ if (Gestalt(gestaltSystemVersion, &_cairo_quartz_osx_version) != noErr) {
-+ // assume 10.5
-+ _cairo_quartz_osx_version = 0x1050;
-+ }
-
- _cairo_quartz_symbol_lookup_done = TRUE;
- }
-@@ -430,6 +446,7 @@ _cairo_quartz_cairo_operator_to_quartz_c
- case CAIRO_OPERATOR_HSL_LUMINOSITY:
- default:
- assert (0);
-+ return kPrivateCGCompositeClear;
- }
- }
-
-@@ -598,10 +615,13 @@ _cairo_quartz_cairo_matrix_to_quartz (co
- typedef struct {
- bool isClipping;
- CGGlyph *cg_glyphs;
-- CGSize *cg_advances;
-+ union {
-+ CGSize *cg_advances;
-+ CGPoint *cg_positions;
-+ } u;
- size_t nglyphs;
- CGAffineTransform textTransform;
-- CGFontRef font;
-+ cairo_scaled_font_t *scaled_font;
- CGPoint origin;
- } unbounded_show_glyphs_t;
-
-@@ -679,12 +699,6 @@ _cairo_quartz_fixup_unbounded_operation
- else
- CGContextEOFillPath (cgc);
- } else if (op->op == UNBOUNDED_SHOW_GLYPHS) {
-- CGContextSetFont (cgc, op->u.show_glyphs.font);
-- CGContextSetFontSize (cgc, 1.0);
-- CGContextSetTextMatrix (cgc, CGAffineTransformIdentity);
-- CGContextTranslateCTM (cgc, op->u.show_glyphs.origin.x, op->u.show_glyphs.origin.y);
-- CGContextConcatCTM (cgc, op->u.show_glyphs.textTransform);
--
- if (op->u.show_glyphs.isClipping) {
- /* Note that the comment in show_glyphs about kCGTextClip
- * and the text transform still applies here; however, the
-@@ -693,12 +707,25 @@ _cairo_quartz_fixup_unbounded_operation
- CGContextSetTextDrawingMode (cgc, kCGTextClip);
- CGContextSaveGState (cgc);
- }
-+ CGContextTranslateCTM (cgc, op->u.show_glyphs.origin.x, op->u.show_glyphs.origin.y);
-+ CGContextConcatCTM (cgc, op->u.show_glyphs.textTransform);
-+ if (CTFontDrawGlyphsPtr) {
-+ CTFontDrawGlyphsPtr (_cairo_quartz_scaled_font_get_ct_font_ref (op->u.show_glyphs.scaled_font),
-+ op->u.show_glyphs.cg_glyphs,
-+ op->u.show_glyphs.u.cg_positions,
-+ op->u.show_glyphs.nglyphs,
-+ cgc);
-+ } else {
-+ CGContextSetFont (cgc, _cairo_quartz_scaled_font_get_cg_font_ref (op->u.show_glyphs.scaled_font));
-+ CGContextSetFontSize (cgc, 1.0);
-+ CGContextSetTextMatrix (cgc, CGAffineTransformIdentity);
-+
-+ CGContextShowGlyphsWithAdvances (cgc,
-+ op->u.show_glyphs.cg_glyphs,
-+ op->u.show_glyphs.u.cg_advances,
-+ op->u.show_glyphs.nglyphs);
-
-- CGContextShowGlyphsWithAdvances (cgc,
-- op->u.show_glyphs.cg_glyphs,
-- op->u.show_glyphs.cg_advances,
-- op->u.show_glyphs.nglyphs);
--
-+ }
- if (op->u.show_glyphs.isClipping) {
- CGContextClearRect (cgc, clipBoxRound);
- CGContextRestoreGState (cgc);
-@@ -1102,12 +1129,12 @@ DataProviderReleaseCallback (void *info,
- {
- quartz_source_image_t *source_img = info;
- _cairo_surface_release_source_image (source_img->surface, source_img->image_out, source_img->image_extra);
-+ cairo_surface_destroy (source_img->surface);
- free (source_img);
- }
-
- static cairo_status_t
--_cairo_surface_to_cgimage (cairo_surface_t *target,
-- cairo_surface_t *source,
-+_cairo_surface_to_cgimage (cairo_surface_t *source,
- CGImageRef *image_out)
- {
- cairo_status_t status;
-@@ -1127,9 +1154,14 @@ _cairo_surface_to_cgimage (cairo_surface
- }
-
- if (_cairo_quartz_is_cgcontext_bitmap_context (surface->cgContext)) {
-- *image_out = CGBitmapContextCreateImage (surface->cgContext);
-- if (*image_out)
-- return CAIRO_STATUS_SUCCESS;
-+ if (!surface->bitmapContextImage) {
-+ surface->bitmapContextImage =
-+ CGBitmapContextCreateImage (surface->cgContext);
-+ }
-+ if (surface->bitmapContextImage) {
-+ *image_out = CGImageRetain (surface->bitmapContextImage);
-+ return CAIRO_STATUS_SUCCESS;
-+ }
- }
- }
-
-@@ -1137,10 +1169,11 @@ _cairo_surface_to_cgimage (cairo_surface
- if (source_img == NULL)
- return _cairo_error (CAIRO_STATUS_NO_MEMORY);
-
-- source_img->surface = source;
-+ source_img->surface = cairo_surface_reference(source);
-
- status = _cairo_surface_acquire_source_image (source_img->surface, &source_img->image_out, &source_img->image_extra);
- if (status) {
-+ cairo_surface_destroy (source_img->surface);
- free (source_img);
- return status;
- }
-@@ -1251,7 +1284,7 @@ _cairo_quartz_cairo_repeating_surface_pa
- is_bounded = _cairo_surface_get_extents (pat_surf, &extents);
- assert (is_bounded);
-
-- status = _cairo_surface_to_cgimage ((cairo_surface_t*) dest, pat_surf, &image);
-+ status = _cairo_surface_to_cgimage (pat_surf, &image);
- if (status)
- return status;
- if (image == NULL)
-@@ -1322,16 +1355,43 @@ typedef enum {
- DO_SHADING,
- DO_PATTERN,
- DO_IMAGE,
-+ DO_TILED_IMAGE,
-+ DO_LAYER,
- DO_UNSUPPORTED,
-- DO_NOTHING,
-- DO_TILED_IMAGE
-+ DO_NOTHING
- } cairo_quartz_action_t;
-
--static cairo_quartz_action_t
-+/* State used during a drawing operation. */
-+typedef struct {
-+ CGContextRef context;
-+ cairo_quartz_action_t action;
-+
-+ // Used with DO_SHADING, DO_IMAGE, DO_TILED_IMAGE and DO_LAYER
-+ CGAffineTransform transform;
-+
-+ // Used with DO_IMAGE and DO_TILED_IMAGE
-+ CGImageRef image;
-+ cairo_surface_t *imageSurface;
-+
-+ // Used with DO_IMAGE, DO_TILED_IMAGE and DO_LAYER
-+ CGRect imageRect;
-+
-+ // Used with DO_LAYER
-+ CGLayerRef layer;
-+
-+ // Used with DO_SHADING
-+ CGShadingRef shading;
-+
-+ // Used with DO_PATTERN
-+ CGPatternRef pattern;
-+} cairo_quartz_drawing_state_t;
-+
-+static void
- _cairo_quartz_setup_fallback_source (cairo_quartz_surface_t *surface,
-- const cairo_pattern_t *source)
-+ const cairo_pattern_t *source,
-+ cairo_quartz_drawing_state_t *state)
- {
-- CGRect clipBox = CGContextGetClipBoundingBox (surface->cgContext);
-+ CGRect clipBox = CGContextGetClipBoundingBox (state->context);
- double x0, y0, w, h;
-
- cairo_surface_t *fallback;
-@@ -1340,8 +1400,10 @@ _cairo_quartz_setup_fallback_source (cai
- cairo_status_t status;
-
- if (clipBox.size.width == 0.0f ||
-- clipBox.size.height == 0.0f)
-- return DO_NOTHING;
-+ clipBox.size.height == 0.0f) {
-+ state->action = DO_NOTHING;
-+ return;
-+ }
-
- x0 = floor(clipBox.origin.x);
- y0 = floor(clipBox.origin.y);
-@@ -1384,18 +1446,21 @@ _cairo_quartz_setup_fallback_source (cai
- }
- #endif
-
-- status = _cairo_surface_to_cgimage (&surface->base, fallback, &img);
-- if (status)
-- return DO_UNSUPPORTED;
-- if (img == NULL)
-- return DO_NOTHING;
--
-- surface->sourceImageRect = CGRectMake (0.0, 0.0, w, h);
-- surface->sourceImage = img;
-- surface->sourceImageSurface = fallback;
-- surface->sourceTransform = CGAffineTransformMakeTranslation (x0, y0);
-+ status = _cairo_surface_to_cgimage (fallback, &img);
-+ if (status) {
-+ state->action = DO_UNSUPPORTED;
-+ return;
-+ }
-+ if (img == NULL) {
-+ state->action = DO_NOTHING;
-+ return;
-+ }
-
-- return DO_IMAGE;
-+ state->imageRect = CGRectMake (0.0, 0.0, w, h);
-+ state->image = img;
-+ state->imageSurface = fallback;
-+ state->transform = CGAffineTransformMakeTranslation (x0, y0);
-+ state->action = DO_IMAGE;
- }
-
- /*
-@@ -1411,10 +1476,11 @@ based on the extents of the object (the
- we don't want the rasterization of the entire gradient to depend on the
- clip region).
- */
--static cairo_quartz_action_t
-+static void
- _cairo_quartz_setup_linear_source (cairo_quartz_surface_t *surface,
- const cairo_linear_pattern_t *lpat,
-- cairo_rectangle_int_t *extents)
-+ cairo_rectangle_int_t *extents,
-+ cairo_quartz_drawing_state_t *state)
- {
- const cairo_pattern_t *abspat = &lpat->base.base;
- cairo_matrix_t mat;
-@@ -1424,9 +1490,10 @@ _cairo_quartz_setup_linear_source (cairo
- bool extend = abspat->extend == CAIRO_EXTEND_PAD;
-
- if (lpat->base.n_stops == 0) {
-- CGContextSetRGBStrokeColor (surface->cgContext, 0., 0., 0., 0.);
-- CGContextSetRGBFillColor (surface->cgContext, 0., 0., 0., 0.);
-- return DO_SOLID;
-+ CGContextSetRGBStrokeColor (state->context, 0., 0., 0., 0.);
-+ CGContextSetRGBFillColor (state->context, 0., 0., 0., 0.);
-+ state->action = DO_SOLID;
-+ return;
- }
-
- if (lpat->p1.x == lpat->p2.x &&
-@@ -1436,12 +1503,13 @@ _cairo_quartz_setup_linear_source (cairo
- * Whatever the correct behaviour is, let's at least have only pixman's
- * implementation to worry about.
- */
-- return _cairo_quartz_setup_fallback_source (surface, abspat);
-+ _cairo_quartz_setup_fallback_source (surface, abspat, state);
-+ return;
- }
-
- mat = abspat->matrix;
- cairo_matrix_invert (&mat);
-- _cairo_quartz_cairo_matrix_to_quartz (&mat, &surface->sourceTransform);
-+ _cairo_quartz_cairo_matrix_to_quartz (&mat, &state->transform);
-
- rgb = CGColorSpaceCreateDeviceRGB();
-
-@@ -1461,21 +1529,22 @@ _cairo_quartz_setup_linear_source (cairo
- extents);
- }
-
-- surface->sourceShading = CGShadingCreateAxial (rgb,
-- start, end,
-- gradFunc,
-- extend, extend);
-+ state->shading = CGShadingCreateAxial (rgb,
-+ start, end,
-+ gradFunc,
-+ extend, extend);
-
- CGColorSpaceRelease(rgb);
- CGFunctionRelease(gradFunc);
-
-- return DO_SHADING;
-+ state->action = DO_SHADING;
- }
-
--static cairo_quartz_action_t
-+static void
- _cairo_quartz_setup_radial_source (cairo_quartz_surface_t *surface,
- const cairo_radial_pattern_t *rpat,
-- cairo_rectangle_int_t *extents)
-+ cairo_rectangle_int_t *extents,
-+ cairo_quartz_drawing_state_t *state)
- {
- const cairo_pattern_t *abspat = &rpat->base.base;
- cairo_matrix_t mat;
-@@ -1494,9 +1563,10 @@ _cairo_quartz_setup_radial_source (cairo
- double centerDistance = sqrt (dx*dx + dy*dy);
-
- if (rpat->base.n_stops == 0) {
-- CGContextSetRGBStrokeColor (surface->cgContext, 0., 0., 0., 0.);
-- CGContextSetRGBFillColor (surface->cgContext, 0., 0., 0., 0.);
-- return DO_SOLID;
-+ CGContextSetRGBStrokeColor (state->context, 0., 0., 0., 0.);
-+ CGContextSetRGBFillColor (state->context, 0., 0., 0., 0.);
-+ state->action = DO_SOLID;
-+ return;
- }
-
- if (r2 <= centerDistance + r1 + 1e-6 && /* circle 2 doesn't contain circle 1 */
-@@ -1507,12 +1577,13 @@ _cairo_quartz_setup_radial_source (cairo
- * implementation to worry about.
- * Note that this also catches the cases where r1 == r2.
- */
-- return _cairo_quartz_setup_fallback_source (surface, abspat);
-+ _cairo_quartz_setup_fallback_source (surface, abspat, state);
-+ return;
- }
-
- mat = abspat->matrix;
- cairo_matrix_invert (&mat);
-- _cairo_quartz_cairo_matrix_to_quartz (&mat, &surface->sourceTransform);
-+ _cairo_quartz_cairo_matrix_to_quartz (&mat, &state->transform);
-
- rgb = CGColorSpaceCreateDeviceRGB();
-
-@@ -1531,90 +1602,79 @@ _cairo_quartz_setup_radial_source (cairo
- extents);
- }
-
-- surface->sourceShading = CGShadingCreateRadial (rgb,
-- start,
-- r1,
-- end,
-- r2,
-- gradFunc,
-- extend, extend);
-+ state->shading = CGShadingCreateRadial (rgb,
-+ start,
-+ r1,
-+ end,
-+ r2,
-+ gradFunc,
-+ extend, extend);
-
- CGColorSpaceRelease(rgb);
- CGFunctionRelease(gradFunc);
-
-- return DO_SHADING;
-+ state->action = DO_SHADING;
- }
-
--static cairo_quartz_action_t
--_cairo_quartz_setup_source (cairo_quartz_surface_t *surface,
-- const cairo_pattern_t *source,
-- cairo_rectangle_int_t *extents)
-+static void
-+_cairo_quartz_setup_surface_source (cairo_quartz_surface_t *surface,
-+ const cairo_surface_pattern_t *spat,
-+ cairo_rectangle_int_t *extents,
-+ cairo_quartz_drawing_state_t *state)
- {
-- assert (!(surface->sourceImage || surface->sourceShading || surface->sourcePattern));
--
-- surface->oldInterpolationQuality = CGContextGetInterpolationQuality (surface->cgContext);
-- CGContextSetInterpolationQuality (surface->cgContext, _cairo_quartz_filter_to_quartz (source->filter));
-+ const cairo_pattern_t *source = &spat->base;
-+ CGContextRef context = state->context;
-
-- if (source->type == CAIRO_PATTERN_TYPE_SOLID) {
-- cairo_solid_pattern_t *solid = (cairo_solid_pattern_t *) source;
--
-- CGContextSetRGBStrokeColor (surface->cgContext,
-- solid->color.red,
-- solid->color.green,
-- solid->color.blue,
-- solid->color.alpha);
-- CGContextSetRGBFillColor (surface->cgContext,
-- solid->color.red,
-- solid->color.green,
-- solid->color.blue,
-- solid->color.alpha);
--
-- return DO_SOLID;
-- }
--
-- if (source->type == CAIRO_PATTERN_TYPE_LINEAR) {
-- const cairo_linear_pattern_t *lpat = (const cairo_linear_pattern_t *)source;
-- return _cairo_quartz_setup_linear_source (surface, lpat, extents);
-- }
--
-- if (source->type == CAIRO_PATTERN_TYPE_RADIAL) {
-- const cairo_radial_pattern_t *rpat = (const cairo_radial_pattern_t *)source;
-- return _cairo_quartz_setup_radial_source (surface, rpat, extents);
-- }
--
-- if (source->type == CAIRO_PATTERN_TYPE_SURFACE &&
-- (source->extend == CAIRO_EXTEND_NONE || (CGContextDrawTiledImagePtr && source->extend == CAIRO_EXTEND_REPEAT)))
-+ if (source->extend == CAIRO_EXTEND_NONE || source->extend == CAIRO_EXTEND_PAD ||
-+ (CGContextDrawTiledImagePtr && source->extend == CAIRO_EXTEND_REPEAT))
- {
-- const cairo_surface_pattern_t *spat = (const cairo_surface_pattern_t *) source;
- cairo_surface_t *pat_surf = spat->surface;
- CGImageRef img;
- cairo_matrix_t m = spat->base.matrix;
- cairo_rectangle_int_t extents;
-- cairo_status_t status;
- CGAffineTransform xform;
- CGRect srcRect;
- cairo_fixed_t fw, fh;
- cairo_bool_t is_bounded;
-+ cairo_bool_t repeat = source->extend == CAIRO_EXTEND_REPEAT;
-+ cairo_status_t status;
-
-- status = _cairo_surface_to_cgimage ((cairo_surface_t *) surface, pat_surf, &img);
-- if (status)
-- return DO_UNSUPPORTED;
-- if (img == NULL)
-- return DO_NOTHING;
-+ cairo_matrix_invert(&m);
-+ _cairo_quartz_cairo_matrix_to_quartz (&m, &state->transform);
-
-- CGContextSetRGBFillColor (surface->cgContext, 0, 0, 0, 1);
-+ /* Draw nonrepeating CGLayer surface using DO_LAYER */
-+ if (!repeat && cairo_surface_get_type (pat_surf) == CAIRO_SURFACE_TYPE_QUARTZ) {
-+ cairo_quartz_surface_t *quartz_surf = (cairo_quartz_surface_t *) pat_surf;
-+ if (quartz_surf->cgLayer) {
-+ state->imageRect = CGRectMake (0, 0, quartz_surf->extents.width, quartz_surf->extents.height);
-+ state->layer = quartz_surf->cgLayer;
-+ state->action = DO_LAYER;
-+ return;
-+ }
-+ }
-+
-+ status = _cairo_surface_to_cgimage (pat_surf, &img);
-+ if (status) {
-+ state->action = DO_UNSUPPORTED;
-+ return;
-+ }
-+ if (img == NULL) {
-+ state->action = DO_NOTHING;
-+ return;
-+ }
-
-- surface->sourceImage = img;
-+ /* XXXroc what is this for? */
-+ CGContextSetRGBFillColor (surface->cgContext, 0, 0, 0, 1);
-
-- cairo_matrix_invert(&m);
-- _cairo_quartz_cairo_matrix_to_quartz (&m, &surface->sourceTransform);
-+ state->image = img;
-
- is_bounded = _cairo_surface_get_extents (pat_surf, &extents);
- assert (is_bounded);
-
-- if (source->extend == CAIRO_EXTEND_NONE) {
-- surface->sourceImageRect = CGRectMake (0, 0, extents.width, extents.height);
-- return DO_IMAGE;
-+ if (!repeat) {
-+ state->imageRect = CGRectMake (0, 0, extents.width, extents.height);
-+ state->action = DO_IMAGE;
-+ return;
- }
-
- /* Quartz seems to tile images at pixel-aligned regions only -- this
-@@ -1624,8 +1684,8 @@ _cairo_quartz_setup_source (cairo_quartz
- * epsilon), and if not, fall back to the CGPattern type.
- */
-
-- xform = CGAffineTransformConcat (CGContextGetCTM (surface->cgContext),
-- surface->sourceTransform);
-+ xform = CGAffineTransformConcat (CGContextGetCTM (context),
-+ state->transform);
-
- srcRect = CGRectMake (0, 0, extents.width, extents.height);
- srcRect = CGRectApplyAffineTransform (srcRect, xform);
-@@ -1646,101 +1706,218 @@ _cairo_quartz_setup_source (cairo_quartz
-
- srcRect = CGRectApplyAffineTransform (srcRect, xform);
-
-- surface->sourceImageRect = srcRect;
--
-- return DO_TILED_IMAGE;
-+ state->imageRect = srcRect;
-+ state->action = DO_TILED_IMAGE;
-+ return;
- }
-
- /* Fall through to generic SURFACE case */
- }
-
-- if (source->type == CAIRO_PATTERN_TYPE_SURFACE) {
-- cairo_quartz_float_t patternAlpha = 1.0f;
-- CGColorSpaceRef patternSpace;
-- CGPatternRef pattern;
-- cairo_int_status_t status;
--
-- status = _cairo_quartz_cairo_repeating_surface_pattern_to_quartz (surface, source, &pattern);
-- if (status == CAIRO_INT_STATUS_NOTHING_TO_DO)
-- return DO_NOTHING;
-- if (status)
-- return DO_UNSUPPORTED;
--
-- // Save before we change the pattern, colorspace, etc. so that
-- // we can restore and make sure that quartz releases our
-- // pattern (which may be stack allocated)
-- CGContextSaveGState(surface->cgContext);
--
-- patternSpace = CGColorSpaceCreatePattern(NULL);
-- CGContextSetFillColorSpace (surface->cgContext, patternSpace);
-- CGContextSetFillPattern (surface->cgContext, pattern, &patternAlpha);
-- CGContextSetStrokeColorSpace (surface->cgContext, patternSpace);
-- CGContextSetStrokePattern (surface->cgContext, pattern, &patternAlpha);
-- CGColorSpaceRelease (patternSpace);
--
-- /* Quartz likes to munge the pattern phase (as yet unexplained
-- * why); force it to 0,0 as we've already baked in the correct
-- * pattern translation into the pattern matrix
-- */
-- CGContextSetPatternPhase (surface->cgContext, CGSizeMake(0,0));
--
-- surface->sourcePattern = pattern;
-+ CGFloat patternAlpha = 1.0f;
-+ CGColorSpaceRef patternSpace;
-+ CGPatternRef pattern;
-+ cairo_int_status_t status;
-
-- return DO_PATTERN;
-+ status = _cairo_quartz_cairo_repeating_surface_pattern_to_quartz (surface, source, &pattern);
-+ if (status == CAIRO_INT_STATUS_NOTHING_TO_DO) {
-+ state->action = DO_NOTHING;
-+ return;
-+ }
-+ if (status) {
-+ state->action = DO_UNSUPPORTED;
-+ return;
- }
-
-- return DO_UNSUPPORTED;
-+ patternSpace = CGColorSpaceCreatePattern (NULL);
-+ CGContextSetFillColorSpace (context, patternSpace);
-+ CGContextSetFillPattern (context, pattern, &patternAlpha);
-+ CGContextSetStrokeColorSpace (context, patternSpace);
-+ CGContextSetStrokePattern (context, pattern, &patternAlpha);
-+ CGColorSpaceRelease (patternSpace);
-+
-+ /* Quartz likes to munge the pattern phase (as yet unexplained
-+ * why); force it to 0,0 as we've already baked in the correct
-+ * pattern translation into the pattern matrix
-+ */
-+ CGContextSetPatternPhase (context, CGSizeMake(0,0));
-+
-+ state->pattern = pattern;
-+ state->action = DO_PATTERN;
-+ return;
- }
-
-+/**
-+ * Call this before any operation that can modify the contents of a
-+ * cairo_quartz_surface_t.
-+ */
- static void
--_cairo_quartz_teardown_source (cairo_quartz_surface_t *surface,
-- const cairo_pattern_t *source)
-+_cairo_quartz_surface_will_change (cairo_quartz_surface_t *surface)
- {
-- CGContextSetInterpolationQuality (surface->cgContext, surface->oldInterpolationQuality);
-+ if (surface->bitmapContextImage) {
-+ CGImageRelease (surface->bitmapContextImage);
-+ surface->bitmapContextImage = NULL;
-+ }
-+}
-
-- if (surface->sourceImage) {
-- CGImageRelease(surface->sourceImage);
-- surface->sourceImage = NULL;
-+/**
-+ * Sets up internal state to be used to draw the source mask, stored in
-+ * cairo_quartz_state_t. Guarantees to call CGContextSaveGState on
-+ * surface->cgContext.
-+ */
-+static cairo_quartz_drawing_state_t
-+_cairo_quartz_setup_state (cairo_quartz_surface_t *surface,
-+ const cairo_pattern_t *source,
-+ cairo_operator_t op,
-+ cairo_rectangle_int_t *extents)
-+{
-+ CGContextRef context = surface->cgContext;
-+ cairo_quartz_drawing_state_t state;
-+ cairo_status_t status;
-
-- cairo_surface_destroy(surface->sourceImageSurface);
-- surface->sourceImageSurface = NULL;
-+ state.context = context;
-+ state.image = NULL;
-+ state.imageSurface = NULL;
-+ state.layer = NULL;
-+ state.shading = NULL;
-+ state.pattern = NULL;
-+
-+ _cairo_quartz_surface_will_change (surface);
-+
-+ // Save before we change the pattern, colorspace, etc. so that
-+ // we can restore and make sure that quartz releases our
-+ // pattern (which may be stack allocated)
-+ CGContextSaveGState(context);
-+
-+ CGContextSetInterpolationQuality (context, _cairo_quartz_filter_to_quartz (source->filter));
-+
-+ status = _cairo_quartz_surface_set_cairo_operator (surface, op);
-+ if (status == CAIRO_INT_STATUS_NOTHING_TO_DO) {
-+ state.action = DO_NOTHING;
-+ return state;
-+ }
-+ if (status) {
-+ state.action = DO_UNSUPPORTED;
-+ return state;
- }
-
-- if (surface->sourceShading) {
-- CGShadingRelease(surface->sourceShading);
-- surface->sourceShading = NULL;
-+ if (source->type == CAIRO_PATTERN_TYPE_SOLID) {
-+ cairo_solid_pattern_t *solid = (cairo_solid_pattern_t *) source;
-+
-+ CGContextSetRGBStrokeColor (context,
-+ solid->color.red,
-+ solid->color.green,
-+ solid->color.blue,
-+ solid->color.alpha);
-+ CGContextSetRGBFillColor (context,
-+ solid->color.red,
-+ solid->color.green,
-+ solid->color.blue,
-+ solid->color.alpha);
-+
-+ state.action = DO_SOLID;
-+ return state;
-+ }
-+
-+ if (source->type == CAIRO_PATTERN_TYPE_LINEAR) {
-+ const cairo_linear_pattern_t *lpat = (const cairo_linear_pattern_t *)source;
-+ _cairo_quartz_setup_linear_source (surface, lpat, extents, &state);
-+ return state;
-+ }
-+
-+ if (source->type == CAIRO_PATTERN_TYPE_RADIAL) {
-+ const cairo_radial_pattern_t *rpat = (const cairo_radial_pattern_t *)source;
-+ _cairo_quartz_setup_radial_source (surface, rpat, extents, &state);
-+ return state;
- }
-
-- if (surface->sourcePattern) {
-- CGPatternRelease(surface->sourcePattern);
-- // To tear down the pattern and colorspace
-- CGContextRestoreGState(surface->cgContext);
-+ if (source->type == CAIRO_PATTERN_TYPE_SURFACE) {
-+ if (op == CAIRO_OPERATOR_OVER && _cairo_pattern_is_opaque (source, NULL) &&
-+ CGContextGetAlphaPtr &&
-+ CGContextGetAlphaPtr (surface->cgContext) == 1.0) {
-+ // Quartz won't touch pixels outside the bounds of the
-+ // source surface, so we can just go ahead and use Copy here
-+ // to accelerate things.
-+ // Quartz won't necessarily be able to do this optimization internally;
-+ // for CGLayer surfaces, we can know all the pixels are opaque
-+ // (because it's CONTENT_COLOR), but Quartz won't know.
-+ CGContextSetCompositeOperation (context, kPrivateCGCompositeCopy);
-+ }
-
-- surface->sourcePattern = NULL;
-+ const cairo_surface_pattern_t *spat = (const cairo_surface_pattern_t *) source;
-+ _cairo_quartz_setup_surface_source (surface, spat, extents, &state);
-+ return state;
- }
--}
-
-+ state.action = DO_UNSUPPORTED;
-+ return state;
-+}
-
-+/**
-+ * 1) Tears down internal state used to draw the source
-+ * 2) Does CGContextRestoreGState(state->context)
-+ */
- static void
--_cairo_quartz_draw_image (cairo_quartz_surface_t *surface, cairo_operator_t op, cairo_quartz_action_t action)
-+_cairo_quartz_teardown_state (cairo_quartz_drawing_state_t *state)
- {
-- assert (surface && surface->sourceImage && (action == DO_IMAGE || action == DO_TILED_IMAGE));
-+ if (state->image) {
-+ CGImageRelease(state->image);
-+ }
-
-- CGContextConcatCTM (surface->cgContext, surface->sourceTransform);
-- CGContextTranslateCTM (surface->cgContext, 0, surface->sourceImageRect.size.height);
-- CGContextScaleCTM (surface->cgContext, 1, -1);
--
-- if (action == DO_IMAGE) {
-- CGContextDrawImage (surface->cgContext, surface->sourceImageRect, surface->sourceImage);
-- if (!_cairo_operator_bounded_by_source(op)) {
-- CGContextBeginPath (surface->cgContext);
-- CGContextAddRect (surface->cgContext, surface->sourceImageRect);
-- CGContextAddRect (surface->cgContext, CGContextGetClipBoundingBox (surface->cgContext));
-- CGContextSetRGBFillColor (surface->cgContext, 0, 0, 0, 0);
-- CGContextEOFillPath (surface->cgContext);
-+ if (state->imageSurface) {
-+ cairo_surface_destroy(state->imageSurface);
-+ }
-+
-+ if (state->shading) {
-+ CGShadingRelease(state->shading);
-+ }
-+
-+ if (state->pattern) {
-+ CGPatternRelease(state->pattern);
-+ }
-+
-+ CGContextRestoreGState(state->context);
-+}
-+
-+
-+static void
-+_cairo_quartz_draw_image (cairo_quartz_drawing_state_t *state, cairo_operator_t op)
-+{
-+ assert (state &&
-+ ((state->image && (state->action == DO_IMAGE || state->action == DO_TILED_IMAGE)) ||
-+ (state->layer && state->action == DO_LAYER)));
-+
-+ CGContextConcatCTM (state->context, state->transform);
-+ CGContextTranslateCTM (state->context, 0, state->imageRect.size.height);
-+ CGContextScaleCTM (state->context, 1, -1);
-+
-+ if (state->action == DO_TILED_IMAGE) {
-+ CGContextDrawTiledImagePtr (state->context, state->imageRect, state->image);
-+ /* no need to worry about unbounded operators, since tiled images
-+ fill the entire clip region */
-+ } else {
-+ if (state->action == DO_LAYER) {
-+ /* Note that according to Apple docs it's completely legal
-+ * to draw a CGLayer to any CGContext, even one it wasn't
-+ * created for.
-+ */
-+ CGContextSetInterpolationQuality (state->context, kCGInterpolationNone);
-+ CGContextDrawLayerAtPoint (state->context, state->imageRect.origin,
-+ state->layer);
-+ } else {
-+ CGContextDrawImage (state->context, state->imageRect, state->image);
-+ }
-+
-+ /* disable this EXTEND_NONE correctness code because we use this path
-+ * for both EXTEND_NONE and EXTEND_PAD */
-+ if (0 && !_cairo_operator_bounded_by_source (op)) {
-+ CGContextBeginPath (state->context);
-+ CGContextAddRect (state->context, state->imageRect);
-+ CGContextAddRect (state->context, CGContextGetClipBoundingBox (state->context));
-+ CGContextSetRGBFillColor (state->context, 0, 0, 0, 0);
-+ CGContextEOFillPath (state->context);
- }
-- } else
-- CGContextDrawTiledImagePtr (surface->cgContext, surface->sourceImageRect, surface->sourceImage);
-+ }
- }
-
-
-@@ -1762,6 +1939,7 @@ _cairo_quartz_get_image (cairo_quartz_su
- }
-
- if (surface->imageSurfaceEquiv) {
-+ CGContextFlush(surface->cgContext);
- *image_out = (cairo_image_surface_t*) cairo_surface_reference(surface->imageSurfaceEquiv);
- return CAIRO_STATUS_SUCCESS;
- }
-@@ -1773,6 +1951,7 @@ _cairo_quartz_get_image (cairo_quartz_su
- CGColorSpaceRef colorspace;
- unsigned int color_comps;
-
-+ CGContextFlush(surface->cgContext);
- imageData = (unsigned char *) CGBitmapContextGetData(surface->cgContext);
-
- #ifdef USE_10_3_WORKAROUNDS
-@@ -1860,53 +2039,79 @@ _cairo_quartz_surface_finish (void *abst
-
- surface->cgContext = NULL;
-
-+ if (surface->bitmapContextImage) {
-+ CGImageRelease (surface->bitmapContextImage);
-+ surface->bitmapContextImage = NULL;
-+ }
-+
- if (surface->imageSurfaceEquiv) {
-+ if (surface->ownsData)
-+ _cairo_image_surface_assume_ownership_of_data (surface->imageSurfaceEquiv);
- cairo_surface_destroy (surface->imageSurfaceEquiv);
- surface->imageSurfaceEquiv = NULL;
-+ } else if (surface->imageData && surface->ownsData) {
-+ free (surface->imageData);
- }
-
-- if (surface->imageData) {
-- free (surface->imageData);
-- surface->imageData = NULL;
-+ surface->imageData = NULL;
-+
-+ if (surface->cgLayer) {
-+ CGLayerRelease (surface->cgLayer);
- }
-
- return CAIRO_STATUS_SUCCESS;
- }
-
- static cairo_status_t
--_cairo_quartz_surface_acquire_source_image (void *abstract_surface,
-- cairo_image_surface_t **image_out,
-- void **image_extra)
-+_cairo_quartz_surface_acquire_image (void *abstract_surface,
-+ cairo_image_surface_t **image_out,
-+ void **image_extra)
- {
- cairo_int_status_t status;
- cairo_quartz_surface_t *surface = (cairo_quartz_surface_t *) abstract_surface;
-
-- //ND((stderr, "%p _cairo_quartz_surface_acquire_source_image\n", surface));
--
-- status = _cairo_quartz_get_image (surface, image_out);
-- if (status)
-- return _cairo_error (CAIRO_STATUS_NO_MEMORY);
--
- *image_extra = NULL;
-
-- return CAIRO_STATUS_SUCCESS;
--}
-+ /* ND((stderr, "%p _cairo_quartz_surface_acquire_image\n", surface)); */
-
--static cairo_surface_t *
--_cairo_quartz_surface_snapshot (void *abstract_surface)
--{
-- cairo_int_status_t status;
-- cairo_quartz_surface_t *surface = abstract_surface;
-- cairo_image_surface_t *image;
-+ status = _cairo_quartz_get_image (surface, image_out);
-
-- if (surface->imageSurfaceEquiv)
-- return NULL;
-+ if (status == CAIRO_INT_STATUS_UNSUPPORTED && surface->cgLayer) {
-+ /* copy the layer into a Quartz bitmap context so we can get the data */
-+ cairo_surface_t *tmp =
-+ cairo_quartz_surface_create (CAIRO_FORMAT_ARGB32,
-+ surface->extents.width,
-+ surface->extents.height);
-+ cairo_quartz_surface_t *tmp_surface = (cairo_quartz_surface_t *) tmp;
-+
-+ /* if surface creation failed, we won't have a Quartz surface here */
-+ if (cairo_surface_get_type (tmp) == CAIRO_SURFACE_TYPE_QUARTZ &&
-+ tmp_surface->imageSurfaceEquiv) {
-+ CGContextSaveGState (tmp_surface->cgContext);
-+ CGContextTranslateCTM (tmp_surface->cgContext, 0, surface->extents.height);
-+ CGContextScaleCTM (tmp_surface->cgContext, 1, -1);
-+ /* Note that according to Apple docs it's completely legal
-+ * to draw a CGLayer to any CGContext, even one it wasn't
-+ * created for.
-+ */
-+ CGContextDrawLayerAtPoint (tmp_surface->cgContext,
-+ CGPointMake (0.0, 0.0),
-+ surface->cgLayer);
-+ CGContextRestoreGState (tmp_surface->cgContext);
-+
-+ *image_out = (cairo_image_surface_t*)
-+ cairo_surface_reference(tmp_surface->imageSurfaceEquiv);
-+ *image_extra = tmp;
-+ status = CAIRO_STATUS_SUCCESS;
-+ } else {
-+ cairo_surface_destroy (tmp);
-+ }
-+ }
-
-- status = _cairo_quartz_get_image (surface, &image);
-- if (unlikely (status))
-- return _cairo_surface_create_in_error (CAIRO_STATUS_NO_MEMORY);
-+ if (status)
-+ return _cairo_error (CAIRO_STATUS_NO_MEMORY);
-
-- return &image->base;
-+ return CAIRO_STATUS_SUCCESS;
- }
-
- static void
-@@ -1915,6 +2120,10 @@ _cairo_quartz_surface_release_source_ima
- void *image_extra)
- {
- cairo_surface_destroy ((cairo_surface_t *) image);
-+
-+ if (image_extra) {
-+ cairo_surface_destroy ((cairo_surface_t *) image_extra);
-+ }
- }
-
-
-@@ -1926,18 +2135,16 @@ _cairo_quartz_surface_acquire_dest_image
- void **image_extra)
- {
- cairo_quartz_surface_t *surface = (cairo_quartz_surface_t *) abstract_surface;
-- cairo_int_status_t status;
-
- ND((stderr, "%p _cairo_quartz_surface_acquire_dest_image\n", surface));
-
-- status = _cairo_quartz_get_image (surface, image_out);
-- if (status)
-- return _cairo_error (CAIRO_STATUS_NO_MEMORY);
--
- *image_rect = surface->extents;
- *image_extra = NULL;
-
-- return CAIRO_STATUS_SUCCESS;
-+ _cairo_quartz_surface_will_change (surface);
-+
-+ return _cairo_quartz_surface_acquire_image (abstract_surface,
-+ image_out, image_extra);
- }
-
- static void
-@@ -1947,11 +2154,31 @@ _cairo_quartz_surface_release_dest_image
- cairo_rectangle_int_t *image_rect,
- void *image_extra)
- {
-- //cairo_quartz_surface_t *surface = (cairo_quartz_surface_t *) abstract_surface;
--
-- //ND((stderr, "%p _cairo_quartz_surface_release_dest_image\n", surface));
-+ /* ND((stderr, "%p _cairo_quartz_surface_release_dest_image\n", surface)); */
-
- cairo_surface_destroy ((cairo_surface_t *) image);
-+
-+ if (image_extra) {
-+ /* we need to write the data from the temp surface back to the layer */
-+ cairo_quartz_surface_t *surface = (cairo_quartz_surface_t *) abstract_surface;
-+ cairo_quartz_surface_t *tmp_surface = (cairo_quartz_surface_t *) image_extra;
-+ CGImageRef img;
-+ cairo_status_t status = _cairo_surface_to_cgimage (&tmp_surface->base, &img);
-+ if (status) {
-+ cairo_surface_destroy (&tmp_surface->base);
-+ return;
-+ }
-+
-+ CGContextSaveGState (surface->cgContext);
-+ CGContextTranslateCTM (surface->cgContext, 0, surface->extents.height);
-+ CGContextScaleCTM (surface->cgContext, 1, -1);
-+ CGContextDrawImage (surface->cgContext,
-+ CGRectMake (0.0, 0.0, surface->extents.width, surface->extents.height),
-+ img);
-+ CGContextRestoreGState (surface->cgContext);
-+
-+ cairo_surface_destroy (&tmp_surface->base);
-+ }
- }
-
- static cairo_surface_t *
-@@ -1960,10 +2187,13 @@ _cairo_quartz_surface_create_similar (vo
- int width,
- int height)
- {
-- /*cairo_quartz_surface_t *surface = (cairo_quartz_surface_t *) abstract_surface;*/
--
-+ cairo_quartz_surface_t *surface = (cairo_quartz_surface_t *) abstract_surface;
- cairo_format_t format;
-
-+ if (surface->cgLayer)
-+ return cairo_quartz_surface_create_cg_layer (abstract_surface, content,
-+ width, height);
-+
- if (content == CAIRO_CONTENT_COLOR_ALPHA)
- format = CAIRO_FORMAT_ARGB32;
- else if (content == CAIRO_CONTENT_COLOR)
-@@ -2027,7 +2257,7 @@ _cairo_quartz_surface_clone_similar (voi
- }
- }
-
-- status = _cairo_surface_to_cgimage ((cairo_surface_t*) abstract_surface, src, &quartz_image);
-+ status = _cairo_surface_to_cgimage (src, &quartz_image);
- if (status)
- return CAIRO_INT_STATUS_UNSUPPORTED;
-
-@@ -2087,7 +2317,7 @@ _cairo_quartz_surface_paint_cg (void *ab
- {
- cairo_quartz_surface_t *surface = (cairo_quartz_surface_t *) abstract_surface;
- cairo_int_status_t rv = CAIRO_STATUS_SUCCESS;
-- cairo_quartz_action_t action;
-+ cairo_quartz_drawing_state_t state;
-
- ND((stderr, "%p _cairo_quartz_surface_paint op %d source->type %d\n", surface, op, source->type));
-
-@@ -2098,31 +2328,24 @@ _cairo_quartz_surface_paint_cg (void *ab
- if (unlikely (rv))
- return rv;
-
-- rv = _cairo_quartz_surface_set_cairo_operator (surface, op);
-- if (unlikely (rv))
-- return rv == CAIRO_INT_STATUS_NOTHING_TO_DO ? CAIRO_STATUS_SUCCESS : rv;
-+ state = _cairo_quartz_setup_state (surface, source, op, NULL);
-
-- action = _cairo_quartz_setup_source (surface, source, NULL);
--
-- if (action == DO_SOLID || action == DO_PATTERN) {
-- CGContextFillRect (surface->cgContext, CGRectMake(surface->extents.x,
-- surface->extents.y,
-- surface->extents.width,
-- surface->extents.height));
-- } else if (action == DO_SHADING) {
-- CGContextSaveGState (surface->cgContext);
-- CGContextConcatCTM (surface->cgContext, surface->sourceTransform);
-- CGContextDrawShading (surface->cgContext, surface->sourceShading);
-- CGContextRestoreGState (surface->cgContext);
-- } else if (action == DO_IMAGE || action == DO_TILED_IMAGE) {
-- CGContextSaveGState (surface->cgContext);
-- _cairo_quartz_draw_image (surface, op, action);
-- CGContextRestoreGState (surface->cgContext);
-- } else if (action != DO_NOTHING) {
-+ if (state.action == DO_SOLID || state.action == DO_PATTERN) {
-+ CGContextFillRect (state.context, CGRectMake(surface->extents.x,
-+ surface->extents.y,
-+ surface->extents.width,
-+ surface->extents.height));
-+ } else if (state.action == DO_SHADING) {
-+ CGContextConcatCTM (state.context, state.transform);
-+ CGContextDrawShading (state.context, state.shading);
-+ } else if (state.action == DO_IMAGE || state.action == DO_TILED_IMAGE ||
-+ state.action == DO_LAYER) {
-+ _cairo_quartz_draw_image (&state, op);
-+ } else if (state.action != DO_NOTHING) {
- rv = CAIRO_INT_STATUS_UNSUPPORTED;
- }
-
-- _cairo_quartz_teardown_source (surface, source);
-+ _cairo_quartz_teardown_state (&state);
-
- ND((stderr, "-- paint\n"));
- return rv;
-@@ -2186,7 +2409,7 @@ _cairo_quartz_surface_fill_cg (void *abs
- {
- cairo_quartz_surface_t *surface = (cairo_quartz_surface_t *) abstract_surface;
- cairo_int_status_t rv = CAIRO_STATUS_SUCCESS;
-- cairo_quartz_action_t action;
-+ cairo_quartz_drawing_state_t state;
- CGPathRef path_for_unbounded = NULL;
-
- ND((stderr, "%p _cairo_quartz_surface_fill op %d source->type %d\n", surface, op, source->type));
-@@ -2198,14 +2421,6 @@ _cairo_quartz_surface_fill_cg (void *abs
- if (unlikely (rv))
- return rv;
-
-- rv = _cairo_quartz_surface_set_cairo_operator (surface, op);
-- if (unlikely (rv))
-- return rv == CAIRO_INT_STATUS_NOTHING_TO_DO ? CAIRO_STATUS_SUCCESS : rv;
--
-- CGContextSaveGState (surface->cgContext);
--
-- CGContextSetShouldAntialias (surface->cgContext, (antialias != CAIRO_ANTIALIAS_NONE));
--
- if (_cairo_quartz_source_needs_extents (source))
- {
- /* We don't need precise extents since these are only used to
-@@ -2213,46 +2428,47 @@ _cairo_quartz_surface_fill_cg (void *abs
- object. */
- cairo_rectangle_int_t path_extents;
- _cairo_path_fixed_approximate_fill_extents (path, &path_extents);
-- action = _cairo_quartz_setup_source (surface, source, &path_extents);
-+ state = _cairo_quartz_setup_state (surface, source, op, &path_extents);
- } else {
-- action = _cairo_quartz_setup_source (surface, source, NULL);
-+ state = _cairo_quartz_setup_state (surface, source, op, NULL);
- }
-
-- _cairo_quartz_cairo_path_to_quartz_context (path, surface->cgContext);
-+ CGContextSetShouldAntialias (state.context, (antialias != CAIRO_ANTIALIAS_NONE));
-+
-+ _cairo_quartz_cairo_path_to_quartz_context (path, state.context);
-
- if (!_cairo_operator_bounded_by_mask(op) && CGContextCopyPathPtr)
-- path_for_unbounded = CGContextCopyPathPtr (surface->cgContext);
-+ path_for_unbounded = CGContextCopyPathPtr (state.context);
-
-- if (action == DO_SOLID || action == DO_PATTERN) {
-+ if (state.action == DO_SOLID || state.action == DO_PATTERN) {
- if (fill_rule == CAIRO_FILL_RULE_WINDING)
-- CGContextFillPath (surface->cgContext);
-+ CGContextFillPath (state.context);
- else
-- CGContextEOFillPath (surface->cgContext);
-- } else if (action == DO_SHADING) {
-+ CGContextEOFillPath (state.context);
-+ } else if (state.action == DO_SHADING) {
-
- // we have to clip and then paint the shading; we can't fill
- // with the shading
- if (fill_rule == CAIRO_FILL_RULE_WINDING)
-- CGContextClip (surface->cgContext);
-+ CGContextClip (state.context);
- else
-- CGContextEOClip (surface->cgContext);
-+ CGContextEOClip (state.context);
-
-- CGContextConcatCTM (surface->cgContext, surface->sourceTransform);
-- CGContextDrawShading (surface->cgContext, surface->sourceShading);
-- } else if (action == DO_IMAGE || action == DO_TILED_IMAGE) {
-+ CGContextConcatCTM (state.context, state.transform);
-+ CGContextDrawShading (state.context, state.shading);
-+ } else if (state.action == DO_IMAGE || state.action == DO_TILED_IMAGE ||
-+ state.action == DO_LAYER) {
- if (fill_rule == CAIRO_FILL_RULE_WINDING)
-- CGContextClip (surface->cgContext);
-+ CGContextClip (state.context);
- else
-- CGContextEOClip (surface->cgContext);
-+ CGContextEOClip (state.context);
-
-- _cairo_quartz_draw_image (surface, op, action);
-- } else if (action != DO_NOTHING) {
-+ _cairo_quartz_draw_image (&state, op);
-+ } else if (state.action != DO_NOTHING) {
- rv = CAIRO_INT_STATUS_UNSUPPORTED;
- }
-
-- _cairo_quartz_teardown_source (surface, source);
--
-- CGContextRestoreGState (surface->cgContext);
-+ _cairo_quartz_teardown_state (&state);
-
- if (path_for_unbounded) {
- unbounded_op_data_t ub;
-@@ -2319,7 +2535,7 @@ _cairo_quartz_surface_stroke_cg (void *a
- {
- cairo_quartz_surface_t *surface = (cairo_quartz_surface_t *) abstract_surface;
- cairo_int_status_t rv = CAIRO_STATUS_SUCCESS;
-- cairo_quartz_action_t action;
-+ cairo_quartz_drawing_state_t state;
- CGAffineTransform origCTM, strokeTransform;
- CGPathRef path_for_unbounded = NULL;
-
-@@ -2336,16 +2552,25 @@ _cairo_quartz_surface_stroke_cg (void *a
- if (unlikely (rv))
- return rv == CAIRO_INT_STATUS_NOTHING_TO_DO ? CAIRO_STATUS_SUCCESS : rv;
-
-+ if (_cairo_quartz_source_needs_extents (source))
-+ {
-+ cairo_rectangle_int_t path_extents;
-+ _cairo_path_fixed_approximate_stroke_extents (path, style, ctm, &path_extents);
-+ state = _cairo_quartz_setup_state (surface, source, op, &path_extents);
-+ } else {
-+ state = _cairo_quartz_setup_state (surface, source, op, NULL);
-+ }
-+
- // Turning antialiasing off used to cause misrendering with
- // single-pixel lines (e.g. 20,10.5 -> 21,10.5 end up being rendered as 2 pixels).
- // That's been since fixed in at least 10.5, and in the latest 10.4 dot releases.
-- CGContextSetShouldAntialias (surface->cgContext, (antialias != CAIRO_ANTIALIAS_NONE));
-- CGContextSetLineWidth (surface->cgContext, style->line_width);
-- CGContextSetLineCap (surface->cgContext, _cairo_quartz_cairo_line_cap_to_quartz (style->line_cap));
-- CGContextSetLineJoin (surface->cgContext, _cairo_quartz_cairo_line_join_to_quartz (style->line_join));
-- CGContextSetMiterLimit (surface->cgContext, style->miter_limit);
-+ CGContextSetShouldAntialias (state.context, (antialias != CAIRO_ANTIALIAS_NONE));
-+ CGContextSetLineWidth (state.context, style->line_width);
-+ CGContextSetLineCap (state.context, _cairo_quartz_cairo_line_cap_to_quartz (style->line_cap));
-+ CGContextSetLineJoin (state.context, _cairo_quartz_cairo_line_join_to_quartz (style->line_join));
-+ CGContextSetMiterLimit (state.context, style->miter_limit);
-
-- origCTM = CGContextGetCTM (surface->cgContext);
-+ origCTM = CGContextGetCTM (state.context);
-
- if (style->dash && style->num_dashes) {
- #define STATIC_DASH 32
-@@ -2368,72 +2593,62 @@ _cairo_quartz_surface_stroke_cg (void *a
- if (fdash != sdash)
- free (fdash);
- } else
-- CGContextSetLineDash (surface->cgContext, 0, NULL, 0);
-+ CGContextSetLineDash (state.context, 0, NULL, 0);
-
-- CGContextSaveGState (surface->cgContext);
-
-+ _cairo_quartz_cairo_path_to_quartz_context (path, state.context);
-
-- if (_cairo_quartz_source_needs_extents (source))
-- {
-- cairo_rectangle_int_t path_extents;
-- _cairo_path_fixed_approximate_stroke_extents (path, style, ctm, &path_extents);
-- action = _cairo_quartz_setup_source (surface, source, &path_extents);
-- } else {
-- action = _cairo_quartz_setup_source (surface, source, NULL);
-- }
--
-- _cairo_quartz_cairo_path_to_quartz_context (path, surface->cgContext);
-+ _cairo_quartz_cairo_matrix_to_quartz (ctm, &strokeTransform);
-+ CGContextConcatCTM (state.context, strokeTransform);
-
- if (!_cairo_operator_bounded_by_mask (op) && CGContextCopyPathPtr)
-- path_for_unbounded = CGContextCopyPathPtr (surface->cgContext);
--
-- _cairo_quartz_cairo_matrix_to_quartz (ctm, &strokeTransform);
-- CGContextConcatCTM (surface->cgContext, strokeTransform);
-+ path_for_unbounded = CGContextCopyPathPtr (state.context);
-
-- if (action == DO_SOLID || action == DO_PATTERN) {
-- CGContextStrokePath (surface->cgContext);
-- } else if (action == DO_IMAGE || action == DO_TILED_IMAGE) {
-- CGContextReplacePathWithStrokedPath (surface->cgContext);
-- CGContextClip (surface->cgContext);
--
-- CGContextSetCTM (surface->cgContext, origCTM);
-- _cairo_quartz_draw_image (surface, op, action);
-- } else if (action == DO_SHADING) {
-- CGContextReplacePathWithStrokedPath (surface->cgContext);
-- CGContextClip (surface->cgContext);
--
-- CGContextSetCTM (surface->cgContext, origCTM);
--
-- CGContextConcatCTM (surface->cgContext, surface->sourceTransform);
-- CGContextDrawShading (surface->cgContext, surface->sourceShading);
-- } else if (action != DO_NOTHING) {
-+ if (state.action == DO_SOLID || state.action == DO_PATTERN) {
-+ CGContextStrokePath (state.context);
-+ } else if (state.action == DO_IMAGE || state.action == DO_TILED_IMAGE ||
-+ state.action == DO_LAYER) {
-+ CGContextReplacePathWithStrokedPath (state.context);
-+ CGContextClip (state.context);
-+
-+ CGContextSetCTM (state.context, origCTM);
-+ _cairo_quartz_draw_image (&state, op);
-+ } else if (state.action == DO_SHADING) {
-+ CGContextReplacePathWithStrokedPath (state.context);
-+ CGContextClip (state.context);
-+
-+ CGContextSetCTM (state.context, origCTM);
-+
-+ CGContextConcatCTM (state.context, state.transform);
-+ CGContextDrawShading (state.context, state.shading);
-+ } else if (state.action != DO_NOTHING) {
- rv = CAIRO_INT_STATUS_UNSUPPORTED;
-+ goto BAIL;
- }
-
-- _cairo_quartz_teardown_source (surface, source);
--
-- CGContextRestoreGState (surface->cgContext);
--
- if (path_for_unbounded) {
- unbounded_op_data_t ub;
- ub.op = UNBOUNDED_STROKE_FILL;
- ub.u.stroke_fill.fill_rule = CAIRO_FILL_RULE_WINDING;
-
-- CGContextBeginPath (surface->cgContext);
-- CGContextAddPath (surface->cgContext, path_for_unbounded);
-+ CGContextBeginPath (state.context);
-+ CGContextAddPath (state.context, path_for_unbounded);
- CGPathRelease (path_for_unbounded);
-
-- CGContextSaveGState (surface->cgContext);
-- CGContextConcatCTM (surface->cgContext, strokeTransform);
-- CGContextReplacePathWithStrokedPath (surface->cgContext);
-- CGContextRestoreGState (surface->cgContext);
-+ CGContextSaveGState (state.context);
-+ CGContextConcatCTM (state.context, strokeTransform);
-+ CGContextReplacePathWithStrokedPath (state.context);
-+ CGContextRestoreGState (state.context);
-
-- ub.u.stroke_fill.cgPath = CGContextCopyPathPtr (surface->cgContext);
-+ ub.u.stroke_fill.cgPath = CGContextCopyPathPtr (state.context);
-
- _cairo_quartz_fixup_unbounded_operation (surface, &ub, antialias);
- CGPathRelease (ub.u.stroke_fill.cgPath);
- }
-
-+ BAIL:
-+ _cairo_quartz_teardown_state (&state);
-+
- ND((stderr, "-- stroke\n"));
- return rv;
- }
-@@ -2490,18 +2705,22 @@ _cairo_quartz_surface_show_glyphs_cg (vo
- CGGlyph glyphs_static[STATIC_BUF_SIZE];
- CGSize cg_advances_static[STATIC_BUF_SIZE];
- CGGlyph *cg_glyphs = &glyphs_static[0];
-+ /* We'll use the cg_advances array for either advances or positions,
-+ depending which API we're using to actually draw. The types involved
-+ have the same size, so this is safe. */
- CGSize *cg_advances = &cg_advances_static[0];
-
- cairo_rectangle_int_t glyph_extents;
- cairo_quartz_surface_t *surface = (cairo_quartz_surface_t *) abstract_surface;
- cairo_int_status_t rv = CAIRO_STATUS_SUCCESS;
-- cairo_quartz_action_t action;
-+ cairo_quartz_drawing_state_t state;
- cairo_quartz_float_t xprev, yprev;
- int i;
- CGFontRef cgfref = NULL;
-
- cairo_bool_t isClipping = FALSE;
- cairo_bool_t didForceFontSmoothing = FALSE;
-+ cairo_antialias_t effective_antialiasing;
-
- if (IS_EMPTY(surface))
- return CAIRO_STATUS_SUCCESS;
-@@ -2516,54 +2735,51 @@ _cairo_quartz_surface_show_glyphs_cg (vo
- if (unlikely (rv))
- return rv;
-
-- rv = _cairo_quartz_surface_set_cairo_operator (surface, op);
-- if (unlikely (rv))
-- return rv == CAIRO_INT_STATUS_NOTHING_TO_DO ? CAIRO_STATUS_SUCCESS : rv;
--
-- CGContextSaveGState (surface->cgContext);
--
- if (_cairo_quartz_source_needs_extents (source) &&
- !_cairo_scaled_font_glyph_device_extents (scaled_font, glyphs, num_glyphs,
- &glyph_extents, NULL))
- {
-- action = _cairo_quartz_setup_source (surface, source, &glyph_extents);
-+ state = _cairo_quartz_setup_state (surface, source, op, &glyph_extents);
- } else {
-- action = _cairo_quartz_setup_source (surface, source, NULL);
-+ state = _cairo_quartz_setup_state (surface, source, op, NULL);
- }
-
-- if (action == DO_SOLID || action == DO_PATTERN) {
-- CGContextSetTextDrawingMode (surface->cgContext, kCGTextFill);
-- } else if (action == DO_IMAGE || action == DO_TILED_IMAGE || action == DO_SHADING) {
-- CGContextSetTextDrawingMode (surface->cgContext, kCGTextClip);
-+ if (state.action == DO_SOLID || state.action == DO_PATTERN) {
-+ CGContextSetTextDrawingMode (state.context, kCGTextFill);
-+ } else if (state.action == DO_IMAGE || state.action == DO_TILED_IMAGE ||
-+ state.action == DO_SHADING || state.action == DO_LAYER) {
-+ CGContextSetTextDrawingMode (state.context, kCGTextClip);
- isClipping = TRUE;
- } else {
-- if (action != DO_NOTHING)
-+ if (state.action != DO_NOTHING)
- rv = CAIRO_INT_STATUS_UNSUPPORTED;
- goto BAIL;
- }
-
- /* this doesn't addref */
- cgfref = _cairo_quartz_scaled_font_get_cg_font_ref (scaled_font);
-- CGContextSetFont (surface->cgContext, cgfref);
-- CGContextSetFontSize (surface->cgContext, 1.0);
-+ CGContextSetFont (state.context, cgfref);
-+ CGContextSetFontSize (state.context, 1.0);
-+
-+ effective_antialiasing = scaled_font->options.antialias;
-
- switch (scaled_font->options.antialias) {
- case CAIRO_ANTIALIAS_SUBPIXEL:
-- CGContextSetShouldAntialias (surface->cgContext, TRUE);
-- CGContextSetShouldSmoothFonts (surface->cgContext, TRUE);
-+ CGContextSetShouldAntialias (state.context, TRUE);
-+ CGContextSetShouldSmoothFonts (state.context, TRUE);
- if (CGContextSetAllowsFontSmoothingPtr &&
-- !CGContextGetAllowsFontSmoothingPtr (surface->cgContext))
-+ !CGContextGetAllowsFontSmoothingPtr (state.context))
- {
- didForceFontSmoothing = TRUE;
-- CGContextSetAllowsFontSmoothingPtr (surface->cgContext, TRUE);
-+ CGContextSetAllowsFontSmoothingPtr (state.context, TRUE);
- }
- break;
- case CAIRO_ANTIALIAS_NONE:
-- CGContextSetShouldAntialias (surface->cgContext, FALSE);
-+ CGContextSetShouldAntialias (state.context, FALSE);
- break;
- case CAIRO_ANTIALIAS_GRAY:
-- CGContextSetShouldAntialias (surface->cgContext, TRUE);
-- CGContextSetShouldSmoothFonts (surface->cgContext, FALSE);
-+ CGContextSetShouldAntialias (state.context, TRUE);
-+ CGContextSetShouldSmoothFonts (state.context, FALSE);
- break;
- case CAIRO_ANTIALIAS_DEFAULT:
- /* Don't do anything */
-@@ -2584,57 +2800,84 @@ _cairo_quartz_surface_show_glyphs_cg (vo
- }
- }
-
-+ /* scale(1,-1) * scaled_font->scale */
- textTransform = CGAffineTransformMake (scaled_font->scale.xx,
- scaled_font->scale.yx,
- -scaled_font->scale.xy,
- -scaled_font->scale.yy,
- 0, 0);
-- _cairo_quartz_cairo_matrix_to_quartz (&scaled_font->scale_inverse, &invTextTransform);
-
-- CGContextSetTextMatrix (surface->cgContext, CGAffineTransformIdentity);
-+ /* scaled_font->scale_inverse * scale(1,-1) */
-+ invTextTransform = CGAffineTransformMake (scaled_font->scale_inverse.xx,
-+ -scaled_font->scale_inverse.yx,
-+ scaled_font->scale_inverse.xy,
-+ -scaled_font->scale_inverse.yy,
-+ 0.0, 0.0);
-
-- /* Convert our glyph positions to glyph advances. We need n-1 advances,
-- * since the advance at index 0 is applied after glyph 0. */
-- xprev = glyphs[0].x;
-- yprev = glyphs[0].y;
--
-- cg_glyphs[0] = glyphs[0].index;
--
-- for (i = 1; i < num_glyphs; i++) {
-- cairo_quartz_float_t xf = glyphs[i].x;
-- cairo_quartz_float_t yf = glyphs[i].y;
-- cg_glyphs[i] = glyphs[i].index;
-- cg_advances[i - 1] = CGSizeApplyAffineTransform(CGSizeMake (xf - xprev, yf - yprev), invTextTransform);
-- xprev = xf;
-- yprev = yf;
-- }
-+ CGContextSetTextMatrix (state.context, CGAffineTransformIdentity);
-
- /* Translate to the first glyph's position before drawing */
-- ctm = CGContextGetCTM (surface->cgContext);
-- CGContextTranslateCTM (surface->cgContext, glyphs[0].x, glyphs[0].y);
-- CGContextConcatCTM (surface->cgContext, textTransform);
--
-- CGContextShowGlyphsWithAdvances (surface->cgContext,
-- cg_glyphs,
-- cg_advances,
-- num_glyphs);
--
-- CGContextSetCTM (surface->cgContext, ctm);
-+ ctm = CGContextGetCTM (state.context);
-+ CGContextTranslateCTM (state.context, glyphs[0].x, glyphs[0].y);
-+ CGContextConcatCTM (state.context, textTransform);
-+
-+ if (CTFontDrawGlyphsPtr) {
-+ /* If CTFontDrawGlyphs is available (i.e. OS X 10.7 or later), we want to use
-+ * that in preference to CGContextShowGlyphsWithAdvances so that colored-bitmap
-+ * fonts like Apple Color Emoji will render properly.
-+ * For this, we need to convert our glyph positions to Core Graphics's CGPoint.
-+ * We borrow the cg_advances array, as CGPoint and CGSize are the same size. */
-+
-+ CGPoint *cg_positions = (CGPoint*) cg_advances;
-+ cairo_quartz_float_t origin_x = glyphs[0].x;
-+ cairo_quartz_float_t origin_y = glyphs[0].y;
-+
-+ for (i = 0; i < num_glyphs; i++) {
-+ CGPoint pt = CGPointMake (glyphs[i].x - origin_x, glyphs[i].y - origin_y);
-+ cg_positions[i] = CGPointApplyAffineTransform (pt, invTextTransform);
-+ cg_glyphs[i] = glyphs[i].index;
-+ }
-
-- if (action == DO_IMAGE || action == DO_TILED_IMAGE) {
-- _cairo_quartz_draw_image (surface, op, action);
-- } else if (action == DO_SHADING) {
-- CGContextConcatCTM (surface->cgContext, surface->sourceTransform);
-- CGContextDrawShading (surface->cgContext, surface->sourceShading);
-+ CTFontDrawGlyphsPtr (_cairo_quartz_scaled_font_get_ct_font_ref (scaled_font),
-+ cg_glyphs, cg_positions, num_glyphs, state.context);
-+ } else {
-+ /* Convert our glyph positions to glyph advances. We need n-1 advances,
-+ * since the advance at index 0 is applied after glyph 0. */
-+ xprev = glyphs[0].x;
-+ yprev = glyphs[0].y;
-+
-+ cg_glyphs[0] = glyphs[0].index;
-+
-+ for (i = 1; i < num_glyphs; i++) {
-+ cairo_quartz_float_t xf = glyphs[i].x;
-+ cairo_quartz_float_t yf = glyphs[i].y;
-+ cg_glyphs[i] = glyphs[i].index;
-+ cg_advances[i - 1] = CGSizeApplyAffineTransform(CGSizeMake (xf - xprev, yf - yprev), invTextTransform);
-+ xprev = xf;
-+ yprev = yf;
-+ }
-+
-+ CGContextShowGlyphsWithAdvances (state.context,
-+ cg_glyphs,
-+ cg_advances,
-+ num_glyphs);
-+ }
-+
-+ CGContextSetCTM (state.context, ctm);
-+
-+ if (state.action == DO_IMAGE || state.action == DO_TILED_IMAGE ||
-+ state.action == DO_LAYER) {
-+ _cairo_quartz_draw_image (&state, op);
-+ } else if (state.action == DO_SHADING) {
-+ CGContextConcatCTM (state.context, state.transform);
-+ CGContextDrawShading (state.context, state.shading);
- }
-
- BAIL:
-- _cairo_quartz_teardown_source (surface, source);
--
- if (didForceFontSmoothing)
-- CGContextSetAllowsFontSmoothingPtr (surface->cgContext, FALSE);
-+ CGContextSetAllowsFontSmoothingPtr (state.context, FALSE);
-
-- CGContextRestoreGState (surface->cgContext);
-+ _cairo_quartz_teardown_state (&state);
-
- if (rv == CAIRO_STATUS_SUCCESS &&
- cgfref &&
-@@ -2645,10 +2888,17 @@ BAIL:
-
- ub.u.show_glyphs.isClipping = isClipping;
- ub.u.show_glyphs.cg_glyphs = cg_glyphs;
-- ub.u.show_glyphs.cg_advances = cg_advances;
-+ if (CTFontDrawGlyphsPtr) {
-+ /* we're using Core Text API: the cg_advances array was
-+ reused (above) for glyph positions */
-+ CGPoint *cg_positions = (CGPoint*) cg_advances;
-+ ub.u.show_glyphs.u.cg_positions = cg_positions;
-+ } else {
-+ ub.u.show_glyphs.u.cg_advances = cg_advances;
-+ }
- ub.u.show_glyphs.nglyphs = num_glyphs;
- ub.u.show_glyphs.textTransform = textTransform;
-- ub.u.show_glyphs.font = cgfref;
-+ ub.u.show_glyphs.scaled_font = scaled_font;
- ub.u.show_glyphs.origin = CGPointMake (glyphs[0].x, glyphs[0].y);
-
- _cairo_quartz_fixup_unbounded_operation (surface, &ub, scaled_font->options.antialias);
-@@ -2717,7 +2967,7 @@ _cairo_quartz_surface_mask_with_surface
- cairo_status_t status = CAIRO_STATUS_SUCCESS;
- CGAffineTransform ctm, mask_matrix;
-
-- status = _cairo_surface_to_cgimage ((cairo_surface_t *) surface, pat_surf, &img);
-+ status = _cairo_surface_to_cgimage (pat_surf, &img);
- if (status)
- return status;
- if (img == NULL) {
-@@ -2820,7 +3070,9 @@ _cairo_quartz_surface_mask_cg (void *abs
- if (unlikely (rv))
- return rv;
-
-- if (mask->type == CAIRO_PATTERN_TYPE_SOLID) {
-+ /* Using CGContextSetAlpha to implement mask alpha doesn't work for all operators. */
-+ if (mask->type == CAIRO_PATTERN_TYPE_SOLID &&
-+ op == CAIRO_OPERATOR_OVER) {
- /* This is easy; we just need to paint with the alpha. */
- cairo_solid_pattern_t *solid_mask = (cairo_solid_pattern_t *) mask;
-
-@@ -2834,8 +3086,11 @@ _cairo_quartz_surface_mask_cg (void *abs
- /* If we have CGContextClipToMask, we can do more complex masks */
- if (CGContextClipToMaskPtr) {
- /* For these, we can skip creating a temporary surface, since we already have one */
-- if (mask->type == CAIRO_PATTERN_TYPE_SURFACE && mask->extend == CAIRO_EXTEND_NONE)
-+ /* For some reason this doesn't work reliably on OS X 10.5. See bug 721663. */
-+ if (_cairo_quartz_osx_version >= 0x1060 && mask->type == CAIRO_PATTERN_TYPE_SURFACE &&
-+ mask->extend == CAIRO_EXTEND_NONE) {
- return _cairo_quartz_surface_mask_with_surface (surface, op, source, (cairo_surface_pattern_t *) mask, clip);
-+ }
-
- return _cairo_quartz_surface_mask_with_generic (surface, op, source, mask, clip);
- }
-@@ -2920,13 +3175,24 @@ _cairo_quartz_surface_clipper_intersect_
- return CAIRO_STATUS_SUCCESS;
- }
-
-+static cairo_status_t
-+_cairo_quartz_surface_mark_dirty_rectangle (void *abstract_surface,
-+ int x, int y,
-+ int width, int height)
-+{
-+ cairo_quartz_surface_t *surface = (cairo_quartz_surface_t *) abstract_surface;
-+ _cairo_quartz_surface_will_change (surface);
-+ return CAIRO_STATUS_SUCCESS;
-+}
-+
-+
- // XXXtodo implement show_page; need to figure out how to handle begin/end
-
- static const struct _cairo_surface_backend cairo_quartz_surface_backend = {
- CAIRO_SURFACE_TYPE_QUARTZ,
- _cairo_quartz_surface_create_similar,
- _cairo_quartz_surface_finish,
-- _cairo_quartz_surface_acquire_source_image,
-+ _cairo_quartz_surface_acquire_image,
- _cairo_quartz_surface_release_source_image,
- _cairo_quartz_surface_acquire_dest_image,
- _cairo_quartz_surface_release_dest_image,
-@@ -2942,7 +3208,7 @@ static const struct _cairo_surface_backe
- NULL, /* old_show_glyphs */
- NULL, /* get_font_options */
- NULL, /* flush */
-- NULL, /* mark_dirty_rectangle */
-+ _cairo_quartz_surface_mark_dirty_rectangle,
- NULL, /* scaled_font_fini */
- NULL, /* scaled_glyph_fini */
-
-@@ -2952,7 +3218,7 @@ static const struct _cairo_surface_backe
- _cairo_quartz_surface_fill,
- _cairo_quartz_surface_show_glyphs,
-
-- _cairo_quartz_surface_snapshot,
-+ NULL, /* snapshot */
- NULL, /* is_similar */
- NULL /* fill_stroke */
- };
-@@ -3004,6 +3270,9 @@ _cairo_quartz_surface_create_internal (C
-
- surface->imageData = NULL;
- surface->imageSurfaceEquiv = NULL;
-+ surface->bitmapContextImage = NULL;
-+ surface->cgLayer = NULL;
-+ surface->ownsData = TRUE;
-
- return surface;
- }
-@@ -3056,6 +3325,81 @@ cairo_quartz_surface_create_for_cg_conte
- }
-
- /**
-+ * cairo_quartz_cglayer_surface_create_similar
-+ * @surface: The returned surface can be efficiently drawn into this
-+ * destination surface (if tiling is not used)."
-+ * @content: the content type of the surface
-+ * @width: width of the surface, in pixels
-+ * @height: height of the surface, in pixels
-+ *
-+ * Creates a Quartz surface backed by a CGLayer, if the given surface
-+ * is a Quartz surface; the CGLayer is created to match the surface's
-+ * Quartz context. Otherwise just calls cairo_surface_create_similar.
-+ * The returned surface can be efficiently blitted to the given surface,
-+ * but tiling and 'extend' modes other than NONE are not so efficient.
-+ *
-+ * Return value: the newly created surface.
-+ *
-+ * Since: 1.10
-+ **/
-+cairo_surface_t *
-+cairo_quartz_surface_create_cg_layer (cairo_surface_t *surface,
-+ cairo_content_t content,
-+ unsigned int width,
-+ unsigned int height)
-+{
-+ cairo_quartz_surface_t *surf;
-+ CGLayerRef layer;
-+ CGContextRef ctx;
-+ CGContextRef cgContext;
-+
-+ cgContext = cairo_quartz_surface_get_cg_context (surface);
-+ if (!cgContext)
-+ return cairo_surface_create_similar (surface, content,
-+ width, height);
-+
-+
-+ if (!_cairo_quartz_verify_surface_size(width, height))
-+ return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_INVALID_SIZE));
-+
-+ /* If we pass zero width or height into CGLayerCreateWithContext below,
-+ * it will fail.
-+ */
-+ if (width == 0 || height == 0) {
-+ return (cairo_surface_t*)
-+ _cairo_quartz_surface_create_internal (NULL, content,
-+ width, height);
-+ }
-+
-+ layer = CGLayerCreateWithContext (cgContext,
-+ CGSizeMake (width, height),
-+ NULL);
-+ if (!layer)
-+ return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_NO_MEMORY));
-+
-+ ctx = CGLayerGetContext (layer);
-+ CGContextSetInterpolationQuality (ctx, kCGInterpolationNone);
-+ /* Flip it when we draw into it, so that when we finally composite it
-+ * to a flipped target, the directions match and Quartz will optimize
-+ * the composition properly
-+ */
-+ CGContextTranslateCTM (ctx, 0, height);
-+ CGContextScaleCTM (ctx, 1, -1);
-+
-+ CGContextRetain (ctx);
-+ surf = _cairo_quartz_surface_create_internal (ctx, content,
-+ width, height);
-+ if (surf->base.status) {
-+ CGLayerRelease (layer);
-+ // create_internal will have set an error
-+ return (cairo_surface_t*) surf;
-+ }
-+ surf->cgLayer = layer;
-+
-+ return (cairo_surface_t *) surf;
-+}
-+
-+/**
- * cairo_quartz_surface_create
- * @format: format of pixels in the surface to create
- * @width: width of the surface, in pixels
-@@ -3075,13 +3419,93 @@ cairo_quartz_surface_create (cairo_forma
- unsigned int width,
- unsigned int height)
- {
-+ int stride;
-+ unsigned char *data;
-+
-+ if (!_cairo_quartz_verify_surface_size(width, height))
-+ return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_INVALID_SIZE));
-+
-+ if (width == 0 || height == 0) {
-+ return (cairo_surface_t*) _cairo_quartz_surface_create_internal (NULL, _cairo_content_from_format (format),
-+ width, height);
-+ }
-+
-+ if (format == CAIRO_FORMAT_ARGB32 ||
-+ format == CAIRO_FORMAT_RGB24)
-+ {
-+ stride = width * 4;
-+ } else if (format == CAIRO_FORMAT_A8) {
-+ stride = width;
-+ } else if (format == CAIRO_FORMAT_A1) {
-+ /* I don't think we can usefully support this, as defined by
-+ * cairo_format_t -- these are 1-bit pixels stored in 32-bit
-+ * quantities.
-+ */
-+ return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_INVALID_FORMAT));
-+ } else {
-+ return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_INVALID_FORMAT));
-+ }
-+
-+ /* The Apple docs say that for best performance, the stride and the data
-+ * pointer should be 16-byte aligned. malloc already aligns to 16-bytes,
-+ * so we don't have to anything special on allocation.
-+ */
-+ stride = (stride + 15) & ~15;
-+
-+ data = _cairo_malloc_ab (height, stride);
-+ if (!data) {
-+ return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_NO_MEMORY));
-+ }
-+
-+ /* zero the memory to match the image surface behaviour */
-+ memset (data, 0, height * stride);
-+
-+ cairo_quartz_surface_t *surf;
-+ surf = (cairo_quartz_surface_t *) cairo_quartz_surface_create_for_data
-+ (data, format, width, height, stride);
-+ if (surf->base.status) {
-+ free (data);
-+ return (cairo_surface_t *) surf;
-+ }
-+
-+ // We created this data, so we can delete it.
-+ surf->ownsData = TRUE;
-+
-+ return (cairo_surface_t *) surf;
-+}
-+
-+/**
-+ * cairo_quartz_surface_create_for_data
-+ * @data: a pointer to a buffer supplied by the application in which
-+ * to write contents. This pointer must be suitably aligned for any
-+ * kind of variable, (for example, a pointer returned by malloc).
-+ * @format: format of pixels in the surface to create
-+ * @width: width of the surface, in pixels
-+ * @height: height of the surface, in pixels
-+ *
-+ * Creates a Quartz surface backed by a CGBitmap. The surface is
-+ * created using the Device RGB (or Device Gray, for A8) color space.
-+ * All Cairo operations, including those that require software
-+ * rendering, will succeed on this surface.
-+ *
-+ * Return value: the newly created surface.
-+ *
-+ * Since: 1.12
-+ **/
-+cairo_surface_t *
-+cairo_quartz_surface_create_for_data (unsigned char *data,
-+ cairo_format_t format,
-+ unsigned int width,
-+ unsigned int height,
-+ unsigned int stride)
-+{
- cairo_quartz_surface_t *surf;
- CGContextRef cgc;
- CGColorSpaceRef cgColorspace;
- CGBitmapInfo bitinfo;
-- void *imageData;
-- int stride;
-+ void *imageData = data;
- int bitsPerComponent;
-+ unsigned int i;
-
- // verify width and height of surface
- if (!_cairo_quartz_verify_surface_size(width, height))
-@@ -3102,10 +3526,8 @@ cairo_quartz_surface_create (cairo_forma
- else
- bitinfo |= kCGImageAlphaNoneSkipFirst;
- bitsPerComponent = 8;
-- stride = width * 4;
- } else if (format == CAIRO_FORMAT_A8) {
- cgColorspace = NULL;
-- stride = width;
- bitinfo = kCGImageAlphaOnly;
- bitsPerComponent = 8;
- } else if (format == CAIRO_FORMAT_A1) {
-@@ -3118,21 +3540,6 @@ cairo_quartz_surface_create (cairo_forma
- return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_INVALID_FORMAT));
- }
-
-- /* The Apple docs say that for best performance, the stride and the data
-- * pointer should be 16-byte aligned. malloc already aligns to 16-bytes,
-- * so we don't have to anything special on allocation.
-- */
-- stride = (stride + 15) & ~15;
--
-- imageData = _cairo_malloc_ab (height, stride);
-- if (!imageData) {
-- CGColorSpaceRelease (cgColorspace);
-- return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_NO_MEMORY));
-- }
--
-- /* zero the memory to match the image surface behaviour */
-- memset (imageData, 0, height * stride);
--
- cgc = CGBitmapContextCreate (imageData,
- width,
- height,
-@@ -3161,7 +3568,19 @@ cairo_quartz_surface_create (cairo_forma
- }
-
- surf->imageData = imageData;
-- surf->imageSurfaceEquiv = cairo_image_surface_create_for_data (imageData, format, width, height, stride);
-+
-+ cairo_surface_t* tmpImageSurfaceEquiv =
-+ cairo_image_surface_create_for_data (imageData, format,
-+ width, height, stride);
-+
-+ if (cairo_surface_status (tmpImageSurfaceEquiv)) {
-+ // Tried & failed to create an imageSurfaceEquiv!
-+ cairo_surface_destroy (tmpImageSurfaceEquiv);
-+ surf->imageSurfaceEquiv = NULL;
-+ } else {
-+ surf->imageSurfaceEquiv = tmpImageSurfaceEquiv;
-+ surf->ownsData = FALSE;
-+ }
-
- return (cairo_surface_t *) surf;
- }
-@@ -3193,6 +3612,74 @@ _cairo_surface_is_quartz (const cairo_su
- return surface->backend == &cairo_quartz_surface_backend;
- }
-
-+CGContextRef
-+cairo_quartz_get_cg_context_with_clip (cairo_t *cr)
-+{
-+
-+ cairo_surface_t *surface = cr->gstate->target;
-+ cairo_clip_t *clip = &cr->gstate->clip;
-+ cairo_status_t status;
-+
-+ cairo_quartz_surface_t *quartz = (cairo_quartz_surface_t*)surface;
-+
-+ if (cairo_surface_get_type(surface) != CAIRO_SURFACE_TYPE_QUARTZ)
-+ return NULL;
-+
-+ if (!clip->path) {
-+ if (clip->all_clipped) {
-+ /* Save the state before we set an empty clip rect so that
-+ * our previous clip will be restored */
-+
-+ /* _cairo_surface_clipper_set_clip doesn't deal with
-+ * clip->all_clipped because drawing is normally discarded earlier */
-+ CGRect empty = {{0,0}, {0,0}};
-+ CGContextClipToRect (quartz->cgContext, empty);
-+ CGContextSaveGState (quartz->cgContext);
-+
-+ return quartz->cgContext;
-+ }
-+
-+ /* an empty clip is represented by NULL */
-+ clip = NULL;
-+ }
-+
-+ status = _cairo_surface_clipper_set_clip (&quartz->clipper, clip);
-+
-+ /* Save the state after we set the clip so that it persists
-+ * after we restore */
-+ CGContextSaveGState (quartz->cgContext);
-+
-+ if (unlikely (status))
-+ return NULL;
-+
-+ return quartz->cgContext;
-+}
-+
-+void
-+cairo_quartz_finish_cg_context_with_clip (cairo_t *cr)
-+{
-+ cairo_surface_t *surface = cr->gstate->target;
-+
-+ cairo_quartz_surface_t *quartz = (cairo_quartz_surface_t*)surface;
-+
-+ if (cairo_surface_get_type(surface) != CAIRO_SURFACE_TYPE_QUARTZ)
-+ return;
-+
-+ CGContextRestoreGState (quartz->cgContext);
-+}
-+
-+cairo_surface_t *
-+cairo_quartz_surface_get_image (cairo_surface_t *surface)
-+{
-+ cairo_quartz_surface_t *quartz = (cairo_quartz_surface_t *)surface;
-+ cairo_image_surface_t *image;
-+
-+ if (_cairo_quartz_get_image(quartz, &image))
-+ return NULL;
-+
-+ return (cairo_surface_t *)image;
-+}
-+
- /* Debug stuff */
-
- #ifdef QUARTZ_DEBUG
---- a/src/cairo-quartz.h 2012-11-13 18:20:00.000000000 -0800
-+++ b/src/cairo-quartz.h 2012-11-13 18:06:56.000000000 -0800
-@@ -50,6 +50,19 @@ cairo_quartz_surface_create (cairo_forma
- unsigned int height);
-
- cairo_public cairo_surface_t *
-+cairo_quartz_surface_create_for_data (unsigned char *data,
-+ cairo_format_t format,
-+ unsigned int width,
-+ unsigned int height,
-+ unsigned int stride);
-+
-+cairo_public cairo_surface_t *
-+cairo_quartz_surface_create_cg_layer (cairo_surface_t *surface,
-+ cairo_content_t content,
-+ unsigned int width,
-+ unsigned int height);
-+
-+cairo_public cairo_surface_t *
- cairo_quartz_surface_create_for_cg_context (CGContextRef cgContext,
- unsigned int width,
- unsigned int height);
-@@ -57,6 +70,15 @@ cairo_quartz_surface_create_for_cg_conte
- cairo_public CGContextRef
- cairo_quartz_surface_get_cg_context (cairo_surface_t *surface);
-
-+cairo_public CGContextRef
-+cairo_quartz_get_cg_context_with_clip (cairo_t *cr);
-+
-+cairo_public void
-+cairo_quartz_finish_cg_context_with_clip (cairo_t *cr);
-+
-+cairo_public cairo_surface_t *
-+cairo_quartz_surface_get_image (cairo_surface_t *surface);
-+
- #if CAIRO_HAS_QUARTZ_FONT
-
- /*
-@@ -66,8 +88,10 @@ cairo_quartz_surface_get_cg_context (cai
- cairo_public cairo_font_face_t *
- cairo_quartz_font_face_create_for_cgfont (CGFontRef font);
-
-+#ifndef __LP64__
- cairo_public cairo_font_face_t *
- cairo_quartz_font_face_create_for_atsu_font_id (ATSUFontID font_id);
-+#endif
-
- #endif /* CAIRO_HAS_QUARTZ_FONT */
\ No newline at end of file
+++ /dev/null
-From 9d460070fca2c0a61aac60ba7cad6f9a6af82309 Mon Sep 17 00:00:00 2001
-From: Andrea Canciani <ranma42@gmail.com>
-Date: Tue, 9 Dec 2014 16:13:00 +0100
-Subject: [PATCH] quartz: Remove call to obsolete CGFontGetGlyphPath
-
-CGFontGetGlyphPath was not public and is not available anymore on
-modern OSX/iOS systems. The same functionality is available through
-the CoreText API since OSX 10.5.
-
-Based on a patch by Simon Cozens.
-
-Fixes https://bugs.freedesktop.org/show_bug.cgi?id=84324
----
- src/cairo-quartz-font.c | 10 ++++------
- 1 file changed, 4 insertions(+), 6 deletions(-)
-
-diff --git a/src/cairo-quartz-font.c b/src/cairo-quartz-font.c
-index e6a379a..02f3426 100644
---- a/src/cairo-quartz-font.c
-+++ b/src/cairo-quartz-font.c
-@@ -81,9 +81,6 @@ static void (*CGFontGetGlyphsForUnicharsPtr) (CGFontRef, const UniChar[], const
- static void (*CGContextSetAllowsFontSmoothingPtr) (CGContextRef, bool) = NULL;
- static bool (*CGContextGetAllowsFontSmoothingPtr) (CGContextRef) = NULL;
-
--/* Not public in the least bit */
--static CGPathRef (*CGFontGetGlyphPathPtr) (CGFontRef fontRef, CGAffineTransform *textTransform, int unknown, CGGlyph glyph) = NULL;
--
- /* CGFontGetHMetrics isn't public, but the other functions are public/present in 10.5 */
- typedef struct {
- int ascent;
-@@ -127,7 +124,6 @@ quartz_font_ensure_symbols(void)
- /* These have the same name in 10.4 and 10.5 */
- CGFontGetUnitsPerEmPtr = dlsym(RTLD_DEFAULT, "CGFontGetUnitsPerEm");
- CGFontGetGlyphAdvancesPtr = dlsym(RTLD_DEFAULT, "CGFontGetGlyphAdvances");
-- CGFontGetGlyphPathPtr = dlsym(RTLD_DEFAULT, "CGFontGetGlyphPath");
-
- CGFontGetHMetricsPtr = dlsym(RTLD_DEFAULT, "CGFontGetHMetrics");
- CGFontGetAscentPtr = dlsym(RTLD_DEFAULT, "CGFontGetAscent");
-@@ -144,7 +140,6 @@ quartz_font_ensure_symbols(void)
- CGFontGetGlyphsForUnicharsPtr &&
- CGFontGetUnitsPerEmPtr &&
- CGFontGetGlyphAdvancesPtr &&
-- CGFontGetGlyphPathPtr &&
- (CGFontGetHMetricsPtr || (CGFontGetAscentPtr && CGFontGetDescentPtr && CGFontGetLeadingPtr)))
- _cairo_quartz_font_symbols_present = TRUE;
-
-@@ -550,6 +545,7 @@ _cairo_quartz_init_glyph_path (cairo_quartz_scaled_font_t *font,
- CGGlyph glyph = _cairo_quartz_scaled_glyph_index (scaled_glyph);
- CGAffineTransform textMatrix;
- CGPathRef glyphPath;
-+ CTFontRef ctFont;
- cairo_path_fixed_t *path;
-
- if (glyph == INVALID_GLYPH) {
-@@ -564,7 +560,9 @@ _cairo_quartz_init_glyph_path (cairo_quartz_scaled_font_t *font,
- -font->base.scale.yy,
- 0, 0);
-
-- glyphPath = CGFontGetGlyphPathPtr (font_face->cgFont, &textMatrix, 0, glyph);
-+ ctFont = CTFontCreateWithGraphicsFont (font_face->cgFont, 1.0, NULL, NULL);
-+ glyphPath = CTFontCreatePathForGlyph (ctFont, glyph, &textMatrix);
-+ CFRelease (ctFont);
- if (!glyphPath)
- return CAIRO_INT_STATUS_UNSUPPORTED;
-
---
-1.9.3 (Apple Git-50)
+++ /dev/null
-diff --git a/src/cairo-quartz-font.c b/src/cairo-quartz-font.c
-index a9bbbdc..48eb071 100644
---- a/src/cairo-quartz-font.c
-+++ b/src/cairo-quartz-font.c
-@@ -95,6 +95,10 @@ static int (*CGFontGetAscentPtr) (CGFontRef fontRef) = NULL;
- static int (*CGFontGetDescentPtr) (CGFontRef fontRef) = NULL;
- static int (*CGFontGetLeadingPtr) (CGFontRef fontRef) = NULL;
-
-+/* CTFontCreateWithGraphicsFont is not public until 10.5. */
-+typedef const struct __CTFontDescriptor *CTFontDescriptorRef;
-+static CTFontRef (*CTFontCreateWithGraphicsFontPtr) (CGFontRef, CGFloat, const CGAffineTransform *, CTFontDescriptorRef) = NULL;
-+
- /* Not public anymore in 64-bits nor in 10.7 */
- static ATSFontRef (*FMGetATSFontRefFromFontPtr) (FMFont iFont) = NULL;
-
-@@ -137,6 +141,8 @@ quartz_font_ensure_symbols(void)
- CGContextGetAllowsFontSmoothingPtr = dlsym(RTLD_DEFAULT, "CGContextGetAllowsFontSmoothing");
- CGContextSetAllowsFontSmoothingPtr = dlsym(RTLD_DEFAULT, "CGContextSetAllowsFontSmoothing");
-
-+ CTFontCreateWithGraphicsFontPtr = dlsym(RTLD_DEFAULT, "CTFontCreateWithGraphicsFont");
-+
- FMGetATSFontRefFromFontPtr = dlsym(RTLD_DEFAULT, "FMGetATSFontRefFromFont");
-
- if ((CGFontCreateWithFontNamePtr || CGFontCreateWithNamePtr) &&
-@@ -162,6 +168,7 @@ struct _cairo_quartz_font_face {
- cairo_font_face_t base;
-
- CGFontRef cgFont;
-+ CTFontRef ctFont;
- };
-
- /*
-@@ -246,6 +253,10 @@ _cairo_quartz_font_face_destroy (void *abstract_face)
- {
- cairo_quartz_font_face_t *font_face = (cairo_quartz_font_face_t*) abstract_face;
-
-+ if (font_face->ctFont) {
-+ CFRelease (font_face->ctFont);
-+ }
-+
- CGFontRelease (font_face->cgFont);
- }
-
-@@ -370,6 +381,12 @@ cairo_quartz_font_face_create_for_cgfont (CGFontRef font)
-
- font_face->cgFont = CGFontRetain (font);
-
-+ if (CTFontCreateWithGraphicsFontPtr) {
-+ font_face->ctFont = CTFontCreateWithGraphicsFontPtr (font, 1.0, NULL, NULL);
-+ } else {
-+ font_face->ctFont = NULL;
-+ }
-+
- _cairo_font_face_init (&font_face->base, &_cairo_quartz_font_face_backend);
-
- return &font_face->base;
-@@ -812,6 +829,14 @@ _cairo_quartz_scaled_font_get_cg_font_ref (cairo_scaled_font_t *abstract_font)
- return ffont->cgFont;
- }
-
-+CTFontRef
-+_cairo_quartz_scaled_font_get_ct_font_ref (cairo_scaled_font_t *abstract_font)
-+{
-+ cairo_quartz_font_face_t *ffont = _cairo_quartz_scaled_to_face(abstract_font);
-+
-+ return ffont->ctFont;
-+}
-+
- /*
- * compat with old ATSUI backend
- */
-diff --git a/src/cairo-quartz-private.h b/src/cairo-quartz-private.h
-index f841a49..3c1e5aa 100644
---- a/src/cairo-quartz-private.h
-+++ b/src/cairo-quartz-private.h
-@@ -57,6 +57,9 @@ typedef enum {
- DO_TILED_IMAGE
- } cairo_quartz_action_t;
-
-+/* define CTFontRef for pre-10.5 SDKs */
-+typedef const struct __CTFont *CTFontRef;
-+
- typedef struct cairo_quartz_surface {
- cairo_surface_t base;
-
-@@ -97,6 +100,9 @@ CairoQuartzCreateCGImage (cairo_format_t format,
- cairo_private CGFontRef
- _cairo_quartz_scaled_font_get_cg_font_ref (cairo_scaled_font_t *sfont);
-
-+CTFontRef
-+_cairo_quartz_scaled_font_get_ct_font_ref (cairo_scaled_font_t *sfont);
-+
- #else
-
- # error Cairo was not compiled with support for the quartz backend
-diff --git a/src/cairo-quartz-surface.c b/src/cairo-quartz-surface.c
-index 1e2bbec..417255c 100644
---- a/src/cairo-quartz-surface.c
-+++ b/src/cairo-quartz-surface.c
-@@ -123,6 +123,9 @@ static void (*CGContextSetAllowsFontSmoothingPtr) (CGContextRef, bool) = NULL;
- static unsigned int (*CGContextGetTypePtr) (CGContextRef) = NULL;
- static bool (*CGContextGetAllowsFontSmoothingPtr) (CGContextRef) = NULL;
-
-+/* CTFontDrawGlyphs is not available until 10.7 */
-+static void (*CTFontDrawGlyphsPtr) (CTFontRef, const CGGlyph[], const CGPoint[], size_t, CGContextRef) = NULL;
-+
- static cairo_bool_t _cairo_quartz_symbol_lookup_done = FALSE;
-
- /*
-@@ -155,6 +158,8 @@ static void quartz_ensure_symbols (void)
- CGContextGetAllowsFontSmoothingPtr = dlsym (RTLD_DEFAULT, "CGContextGetAllowsFontSmoothing");
- CGContextSetAllowsFontSmoothingPtr = dlsym (RTLD_DEFAULT, "CGContextSetAllowsFontSmoothing");
-
-+ CTFontDrawGlyphsPtr = dlsym(RTLD_DEFAULT, "CTFontDrawGlyphs");
-+
- _cairo_quartz_symbol_lookup_done = TRUE;
- }
-
-@@ -2026,30 +2031,50 @@ _cairo_quartz_cg_glyphs (const cairo_compositor_t *compositor,
- CGContextSetTextPosition (state.cgMaskContext, 0.0, 0.0);
- CGContextSetTextMatrix (state.cgMaskContext, CGAffineTransformIdentity);
-
-- /* Convert our glyph positions to glyph advances. We need n-1 advances,
-- * since the advance at index 0 is applied after glyph 0. */
-- xprev = glyphs[0].x;
-- yprev = glyphs[0].y;
--
-- cg_glyphs[0] = glyphs[0].index;
--
-- for (i = 1; i < num_glyphs; i++) {
-- cairo_quartz_float_t xf = glyphs[i].x;
-- cairo_quartz_float_t yf = glyphs[i].y;
-- cg_glyphs[i] = glyphs[i].index;
-- cg_advances[i - 1] = CGSizeApplyAffineTransform (CGSizeMake (xf - xprev, yf - yprev), invTextTransform);
-- xprev = xf;
-- yprev = yf;
-- }
--
- /* Translate to the first glyph's position before drawing */
- CGContextTranslateCTM (state.cgMaskContext, glyphs[0].x, glyphs[0].y);
- CGContextConcatCTM (state.cgMaskContext, textTransform);
-
-- CGContextShowGlyphsWithAdvances (state.cgMaskContext,
-- cg_glyphs,
-- cg_advances,
-- num_glyphs);
-+ if (CTFontDrawGlyphsPtr) {
-+ /* If CTFontDrawGlyphs is available (i.e. OS X 10.7 or later), we want to use
-+ * that in preference to CGContextShowGlyphsWithAdvances so that colored-bitmap
-+ * fonts like Apple Color Emoji will render properly.
-+ * For this, we need to convert our glyph positions to Core Graphics's CGPoint.
-+ * We borrow the cg_advances array, as CGPoint and CGSize are the same size. */
-+
-+ CGPoint *cg_positions = (CGPoint*) cg_advances;
-+ cairo_quartz_float_t origin_x = glyphs[0].x;
-+ cairo_quartz_float_t origin_y = glyphs[0].y;
-+
-+ for (i = 0; i < num_glyphs; i++) {
-+ CGPoint pt = CGPointMake (glyphs[i].x - origin_x, glyphs[i].y - origin_y);
-+ cg_positions[i] = CGPointApplyAffineTransform (pt, invTextTransform);
-+ cg_glyphs[i] = glyphs[i].index;
-+ }
-+
-+ CTFontDrawGlyphsPtr (_cairo_quartz_scaled_font_get_ct_font_ref (scaled_font),
-+ cg_glyphs, cg_positions, num_glyphs, state.cgMaskContext);
-+ } else {
-+ /* Convert our glyph positions to glyph advances. We need n-1 advances,
-+ * since the advance at index 0 is applied after glyph 0. */
-+ xprev = glyphs[0].x;
-+ yprev = glyphs[0].y;
-+
-+ cg_glyphs[0] = glyphs[0].index;
-+
-+ for (i = 1; i < num_glyphs; i++) {
-+ cairo_quartz_float_t xf = glyphs[i].x;
-+ cairo_quartz_float_t yf = glyphs[i].y;
-+ cg_glyphs[i] = glyphs[i].index;
-+ cg_advances[i - 1] = CGSizeApplyAffineTransform (CGSizeMake (xf - xprev, yf - yprev), invTextTransform);
-+ xprev = xf;
-+ yprev = yf;
-+ }
-+ CGContextShowGlyphsWithAdvances (state.cgMaskContext,
-+ cg_glyphs,
-+ cg_advances,
-+ num_glyphs);
-+ }
-
- CGContextConcatCTM (state.cgMaskContext, invTextTransform);
- CGContextTranslateCTM (state.cgMaskContext, -glyphs[0].x, -glyphs[0].y);
+++ /dev/null
---- a/src/cairo-quartz-surface.c 2013-03-28 19:19:15.000000000 -0400
-+++ b/src/cairo-quartz-surface.c 2013-03-28 19:19:28.000000000 -0400
-@@ -1379,7 +1379,6 @@
- CGContextDrawLayerInRect (surface->cgContext,
- state->clipRect,
- state->layer);
-- CGContextRelease (state->cgDrawContext);
- CGLayerRelease (state->layer);
- }
+++ /dev/null
-#!/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
+++ /dev/null
-From b02965711a387b015a6af4b9d26bbdabf10fc5b4 Mon Sep 17 00:00:00 2001
-From: Mikayla Hutchinson <m.j.hutchinson@gmail.com>
-Date: Mon, 1 Aug 2016 13:47:41 -0400
-Subject: [PATCH 1/2] Remove xbuild workarounds
-
-They do not work Mono 4.6+ where the underlying bug is fixed
----
- src/FSharpSource.targets | 8 --------
- 1 file changed, 8 deletions(-)
-
-diff --git a/src/FSharpSource.targets b/src/FSharpSource.targets
-index eb57269..ea3656f 100755
---- a/src/FSharpSource.targets
-+++ b/src/FSharpSource.targets
-@@ -306,8 +306,6 @@ Some other NuGET monikers to support in the future, see http://docs.nuget.org/do
- <DefineConstants>$(DefineConstants);PUT_TYPE_PROVIDERS_IN_FSCORE</DefineConstants>
- <DefineConstants>$(DefineConstants);QUERIES_IN_FSLIB</DefineConstants>
-
-- <!-- An explicit search path seems to be needed on Mono 3.4.0 otherwise the reference assemblies for the profile aren't found -->
-- <AssemblySearchPaths Condition="Exists('$(MSBuildExtensionsPath32)\..\xbuild-frameworks\.NETPortable\v4.0\mscorlib.dll')">$(MSBuildExtensionsPath32)\..\xbuild-frameworks\.NETPortable\v4.0</AssemblySearchPaths>
- </PropertyGroup>
-
- <!-- Target Portable -->
-@@ -348,8 +346,6 @@ Some other NuGET monikers to support in the future, see http://docs.nuget.org/do
- <TargetProfile>netcore</TargetProfile>
- <TargetFrameworkProfile>Profile7</TargetFrameworkProfile>
- <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
-- <!-- An explicit search path seems to be needed on Mono 3.4.0 otherwise the reference assemblies for the profile aren't found -->
-- <AssemblySearchPaths Condition="Exists('$(MSBuildExtensionsPath32)\..\xbuild-frameworks\.NETPortable\v4.5\System.Runtime.dll')">$(MSBuildExtensionsPath32)\..\xbuild-frameworks\.NETPortable\v4.5</AssemblySearchPaths>
- <OtherFlags>$(OtherFlags) --targetprofile:netcore</OtherFlags>
- </PropertyGroup>
-
-@@ -389,8 +385,6 @@ Some other NuGET monikers to support in the future, see http://docs.nuget.org/do
- <TargetProfile>netcore</TargetProfile>
- <TargetFrameworkProfile>Profile78</TargetFrameworkProfile>
- <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
-- <!-- An explicit search path seems to be needed on Mono 3.4.0 otherwise the reference assemblies for the profile aren't found -->
-- <AssemblySearchPaths Condition="Exists('$(MSBuildExtensionsPath32)\..\xbuild-frameworks\.NETPortable\v4.5\System.Runtime.dll')">$(MSBuildExtensionsPath32)\..\xbuild-frameworks\.NETPortable\v4.5</AssemblySearchPaths>
- <OtherFlags>$(OtherFlags) --targetprofile:netcore</OtherFlags>
- </PropertyGroup>
-
-@@ -430,8 +424,6 @@ Some other NuGET monikers to support in the future, see http://docs.nuget.org/do
- <TargetProfile>netcore</TargetProfile>
- <TargetFrameworkProfile>Profile259</TargetFrameworkProfile>
- <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
-- <!-- An explicit search path seems to be needed on Mono 3.4.0 otherwise the reference assemblies for the profile aren't found -->
-- <AssemblySearchPaths Condition="Exists('$(MSBuildExtensionsPath32)\..\xbuild-frameworks\.NETPortable\v4.5\System.Runtime.dll')">$(MSBuildExtensionsPath32)\..\xbuild-frameworks\.NETPortable\v4.5</AssemblySearchPaths>
- <OtherFlags>$(OtherFlags) --targetprofile:netcore</OtherFlags>
- </PropertyGroup>
-
---
-2.7.4 (Apple Git-66)
-
-
-From e57cb16ee7927bb31b2c9b63e1b2e394bf9f9932 Mon Sep 17 00:00:00 2001
-From: Mikayla Hutchinson <m.j.hutchinson@gmail.com>
-Date: Mon, 1 Aug 2016 13:48:23 -0400
-Subject: [PATCH 2/2] Remove dead code
-
-Remove Mono workarounds for missing files. Mono has been
-shipping the files for some time now.
----
- .../FSharp.Build/Microsoft.Portable.FSharp.Targets | 52 ----------------------
- 1 file changed, 52 deletions(-)
-
-diff --git a/src/fsharp/FSharp.Build/Microsoft.Portable.FSharp.Targets b/src/fsharp/FSharp.Build/Microsoft.Portable.FSharp.Targets
-index 8c99ab6..ee5f9b1 100644
---- a/src/fsharp/FSharp.Build/Microsoft.Portable.FSharp.Targets
-+++ b/src/fsharp/FSharp.Build/Microsoft.Portable.FSharp.Targets
-@@ -24,60 +24,8 @@ Copyright (C) Microsoft Corporation. All rights reserved.
- Condition="Exists('$(MSBuildExtensionsPath32)\Microsoft\Portable\v4.0\Microsoft.Portable.Common.targets') AND
- !Exists('$(MSBuildExtensionsPath32)\Microsoft\Portable\Microsoft.Portable.Core.props')"/>
-
--
-- <!-- Try to do it ourselves - Explicitly include contents of Microsoft.Portable.Core.props + Microsoft.FSharp.Targets + Microsoft.Portable.Core.targets -->
-- <!-- START MONO 3.2.7 WORKAROUND PART 1 -->
-- <PropertyGroup
-- Condition="(!Exists('$(MSBuildExtensionsPath32)\Microsoft\Portable\v4.0\Microsoft.Portable.Common.targets')) AND
-- (!Exists('$(MSBuildExtensionsPath32)\Microsoft\Portable\Microsoft.Portable.Core.props'))">
-- <AvailablePlatforms>Any CPU</AvailablePlatforms>
--
-- <TargetPlatformIdentifier>Portable</TargetPlatformIdentifier>
-- <TargetFrameworkIdentifier>.NETPortable</TargetFrameworkIdentifier>
-- <TargetFrameworkMonikerDisplayName>.NET Portable Subset</TargetFrameworkMonikerDisplayName>
--
-- <AddAdditionalExplicitAssemblyReferences>false</AddAdditionalExplicitAssemblyReferences>
-- <NoStdLib>true</NoStdLib>
--
-- <ImplicitlyExpandTargetFramework Condition="'$(ImplicitlyExpandTargetFramework)' == '' ">true</ImplicitlyExpandTargetFramework>
-- </PropertyGroup>
-- <!-- END MONO 3.2.7 WORKAROUND PART 1 -->
--
--
- <Import Project="$(MSBuildExtensionsPath32)\..\Microsoft SDKs\F#\3.1\Framework\v4.0\Microsoft.FSharp.Targets" />
-
--
-- <!-- START MONO 3.2.7 WORKAROUND PART 2 -->
-- <PropertyGroup
-- Condition="(!Exists('$(MSBuildExtensionsPath32)\Microsoft\Portable\v4.0\Microsoft.Portable.Common.targets')) AND
-- (!Exists('$(MSBuildExtensionsPath32)\Microsoft\Portable\Microsoft.Portable.Core.props'))" >
-- <ResolveReferencesDependsOn>
-- $(ResolveReferencesDependsOn);
-- ImplicitlyExpandTargetFramework;
-- </ResolveReferencesDependsOn>
--
-- <ImplicitlyExpandTargetFrameworkDependsOn>
-- $(ImplicitlyExpandTargetFrameworkDependsOn);
-- GetReferenceAssemblyPaths
-- </ImplicitlyExpandTargetFrameworkDependsOn>
-- </PropertyGroup>
--
-- <Target Name="ImplicitlyExpandTargetFramework"
-- DependsOnTargets="$(ImplicitlyExpandTargetFrameworkDependsOn)"
-- Condition="(!Exists('$(MSBuildExtensionsPath32)\Microsoft\Portable\v4.0\Microsoft.Portable.Common.targets')) AND
-- (!Exists('$(MSBuildExtensionsPath32)\Microsoft\Portable\Microsoft.Portable.Core.props'))" >
--
-- <ItemGroup>
-- <ReferenceAssemblyPaths Include="$(_TargetFrameworkDirectories)"/>
-- <ReferencePath Include="%(ReferenceAssemblyPaths.Identity)\*.dll">
-- <CopyLocal>false</CopyLocal>
-- <ResolvedFrom>ImplicitlyExpandTargetFramework</ResolvedFrom>
-- <IsSystemReference>True</IsSystemReference>
-- </ReferencePath>
-- </ItemGroup>
-- </Target>
-- <!-- END MONO 3.2.7 WORKAROUND PART 2 -->
--
- <Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\Microsoft.Portable.Core.targets"
- Condition="Exists('$(MSBuildExtensionsPath32)\Microsoft\Portable\Microsoft.Portable.Core.props')"/>
-
---
-2.7.4 (Apple Git-66)
+++ /dev/null
-From f6d2db5a0c105785ee6f03717966ef0dbb1421f6 Mon Sep 17 00:00:00 2001\r
-From: Carlos Garnacho <carlosg@gnome.org>\r
-Date: Tue, 16 Jul 2013 10:32:11 +0200\r
-Subject: [PATCH] pixbuf: Add getter/setter for the 2x variants\r
-\r
----\r
- gdk-pixbuf/gdk-pixbuf-core.h | 3 +++\r
- gdk-pixbuf/gdk-pixbuf.c | 22 ++++++++++++++++++++++\r
- 2 files changed, 25 insertions(+)\r
-\r
-diff --git a/gdk-pixbuf/gdk-pixbuf-core.h b/gdk-pixbuf/gdk-pixbuf-core.h\r
-index eb4d0a1..60c4ea3 100644\r
---- a/gdk-pixbuf/gdk-pixbuf-core.h\r
-+++ b/gdk-pixbuf/gdk-pixbuf-core.h\r
-@@ -474,6 +474,9 @@ GdkPixbuf *gdk_pixbuf_apply_embedded_orientation (GdkPixbuf *src);\r
- const gchar * gdk_pixbuf_get_option (GdkPixbuf *pixbuf,\r
- const gchar *key);\r
- \r
-+GdkPixbuf * gdk_pixbuf_get_hires_variant (GdkPixbuf *pixbuf);\r
-+void gdk_pixbuf_set_hires_variant (GdkPixbuf *pixbuf,\r
-+ GdkPixbuf *hires);\r
- \r
- G_END_DECLS\r
- \r
-diff --git a/gdk-pixbuf/gdk-pixbuf.c b/gdk-pixbuf/gdk-pixbuf.c\r
-index 0e13f27..d61f2c7 100644\r
---- a/gdk-pixbuf/gdk-pixbuf.c\r
-+++ b/gdk-pixbuf/gdk-pixbuf.c\r
-@@ -990,3 +990,25 @@ gdk_pixbuf_get_property (GObject *object,\r
- break;\r
- }\r
- }\r
-+\r
-+GdkPixbuf *\r
-+gdk_pixbuf_get_hires_variant (GdkPixbuf *pixbuf)\r
-+{\r
-+ g_return_val_if_fail (GDK_IS_PIXBUF (pixbuf), NULL);\r
-+\r
-+ return g_object_get_data (G_OBJECT (pixbuf),\r
-+ "gdk-pixbuf-2x-variant");\r
-+}\r
-+\r
-+void\r
-+gdk_pixbuf_set_hires_variant (GdkPixbuf *pixbuf,\r
-+ GdkPixbuf *hires)\r
-+{\r
-+ g_return_if_fail (GDK_IS_PIXBUF (pixbuf));\r
-+ g_return_if_fail (GDK_IS_PIXBUF (hires));\r
-+\r
-+ g_object_set_data_full (G_OBJECT (pixbuf),\r
-+ "gdk-pixbuf-2x-variant",\r
-+ g_object_ref (hires),\r
-+ (GDestroyNotify) g_object_unref);\r
-+}\r
--- \r
-1.8.3.2\r
-\r
+++ /dev/null
->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
+++ /dev/null
-diff --git a/gdk/quartz/gdkevents-quartz.c b/gdk/quartz/gdkevents-quartz.c
-index a8800f7..ec6a893 100644
---- a/gdk/quartz/gdkevents-quartz.c
-+++ b/gdk/quartz/gdkevents-quartz.c
-@@ -292,10 +292,19 @@ get_keyboard_modifiers_from_ns_flags (NSUInteger nsflags)
- modifiers |= GDK_SHIFT_MASK;
- if (nsflags & NSControlKeyMask)
- modifiers |= GDK_CONTROL_MASK;
-- if (nsflags & NSAlternateKeyMask)
-- modifiers |= GDK_MOD1_MASK;
-- if (nsflags & NSCommandKeyMask)
-- modifiers |= GDK_MOD2_MASK;
-+
-+ if (gdk_quartz_get_fix_modifiers ())
-+ {
-+ if (nsflags & NSAlternateKeyMask)
-+ modifiers |= GDK_MOD1_MASK;
-+ if (nsflags & NSCommandKeyMask)
-+ modifiers |= GDK_MOD2_MASK;
-+ }
-+ else
-+ {
-+ if (nsflags & NSCommandKeyMask)
-+ modifiers |= GDK_MOD1_MASK;
-+ }
-
- return modifiers;
- }
-@@ -930,7 +939,7 @@ fill_key_event (GdkWindow *window,
- {
- case GDK_Meta_R:
- case GDK_Meta_L:
-- mask = GDK_MOD2_MASK;
-+ mask = gdk_quartz_get_fix_modifiers () ? GDK_MOD2_MASK : GDK_MOD1_MASK;
- break;
- case GDK_Shift_R:
- case GDK_Shift_L:
-@@ -941,7 +950,7 @@ fill_key_event (GdkWindow *window,
- break;
- case GDK_Alt_R:
- case GDK_Alt_L:
-- mask = GDK_MOD1_MASK;
-+ mask = gdk_quartz_get_fix_modifiers () ? GDK_MOD1_MASK : GDK_MOD2_MASK;
- break;
- case GDK_Control_R:
- case GDK_Control_L:
-@@ -1089,9 +1098,9 @@ _gdk_quartz_events_get_current_keyboard_modifiers (void)
- if (carbon_modifiers & controlKey)
- modifiers |= GDK_CONTROL_MASK;
- if (carbon_modifiers & optionKey)
-- modifiers |= GDK_MOD1_MASK;
-+ modifiers |= (gdk_quartz_get_fix_modifiers () ? GDK_MOD1_MASK : GDK_MOD2_MASK);
- if (carbon_modifiers & cmdKey)
-- modifiers |= GDK_MOD2_MASK;
-+ modifiers |= (gdk_quartz_get_fix_modifiers () ? GDK_MOD2_MASK : GDK_MOD1_MASK);
-
- return modifiers;
- }
-diff --git a/gdk/quartz/gdkglobals-quartz.c b/gdk/quartz/gdkglobals-quartz.c
-index 53c6d5e..31dbab1 100644
---- a/gdk/quartz/gdkglobals-quartz.c
-+++ b/gdk/quartz/gdkglobals-quartz.c
-@@ -41,3 +41,17 @@ gdk_quartz_osx_version (void)
- else
- return minor;
- }
-+
-+static gboolean fix_modifiers = FALSE;
-+
-+void
-+gdk_quartz_set_fix_modifiers (gboolean fix)
-+{
-+ fix_modifiers = fix;
-+}
-+
-+gboolean
-+gdk_quartz_get_fix_modifiers (void)
-+{
-+ return fix_modifiers;
-+}
-diff --git a/gdk/quartz/gdkkeys-quartz.c b/gdk/quartz/gdkkeys-quartz.c
-index 19a20f5..c7ceec6 100644
---- a/gdk/quartz/gdkkeys-quartz.c
-+++ b/gdk/quartz/gdkkeys-quartz.c
-@@ -693,11 +693,11 @@ gdk_keymap_translate_keyboard_state (GdkKeymap *keymap,
- for (bit = GDK_SHIFT_MASK; bit < GDK_BUTTON1_MASK; bit <<= 1)
- {
- if (translate_keysym (hardware_keycode,
-- (bit == GDK_MOD1_MASK) ? 0 : group,
-+ (bit == (gdk_quartz_get_fix_modifiers () ? GDK_MOD1_MASK : GDK_MOD2_MASK)) ? 0 : group,
- state & ~bit,
- NULL, NULL) !=
- translate_keysym (hardware_keycode,
-- (bit == GDK_MOD1_MASK) ? 1 : group,
-+ (bit == (gdk_quartz_get_fix_modifiers () ? GDK_MOD1_MASK : GDK_MOD2_MASK)) ? 1 : group,
- state | bit,
- NULL, NULL))
- tmp_modifiers |= bit;
-@@ -718,16 +718,32 @@ void
- gdk_keymap_add_virtual_modifiers (GdkKeymap *keymap,
- GdkModifierType *state)
- {
-- if (*state & GDK_MOD2_MASK)
-- *state |= GDK_META_MASK;
-+ if (gdk_quartz_get_fix_modifiers ())
-+ {
-+ if (*state & GDK_MOD2_MASK)
-+ *state |= GDK_META_MASK;
-+ }
-+ else
-+ {
-+ if (*state & GDK_MOD1_MASK)
-+ *state |= GDK_META_MASK;
-+ }
- }
-
- gboolean
- gdk_keymap_map_virtual_modifiers (GdkKeymap *keymap,
- GdkModifierType *state)
- {
-- if (*state & GDK_META_MASK)
-- *state |= GDK_MOD2_MASK;
-+ if (gdk_quartz_get_fix_modifiers ())
-+ {
-+ if (*state & GDK_META_MASK)
-+ *state |= GDK_MOD2_MASK;
-+ }
-+ else
-+ {
-+ if (*state & GDK_META_MASK)
-+ *state |= GDK_MOD1_MASK;
-+ }
-
- return TRUE;
- }
-diff --git a/gdk/quartz/gdkquartz.h b/gdk/quartz/gdkquartz.h
-index 742d651..ed0ba35 100644
---- a/gdk/quartz/gdkquartz.h
-+++ b/gdk/quartz/gdkquartz.h
-@@ -58,6 +58,9 @@ id gdk_quartz_drag_context_get_dragging_info_libgtk_only (GdkDragContext
- NSEvent *gdk_quartz_event_get_nsevent (GdkEvent *event);
- GdkOSXVersion gdk_quartz_osx_version (void);
-
-+void gdk_quartz_set_fix_modifiers (gboolean fix);
-+gboolean gdk_quartz_get_fix_modifiers (void);
-+
- G_END_DECLS
-
- #endif /* __GDK_QUARTZ_H__ */
-diff --git a/gtk/gtkprivate.h b/gtk/gtkprivate.h
-index 6386c32..aa1cc74 100644
---- a/gtk/gtkprivate.h
-+++ b/gtk/gtkprivate.h
-@@ -122,7 +122,7 @@ gboolean _gtk_fnmatch (const char *pattern,
- #ifndef GDK_WINDOWING_QUARTZ
- #define GTK_NO_TEXT_INPUT_MOD_MASK (GDK_MOD1_MASK | GDK_CONTROL_MASK)
- #else
--#define GTK_NO_TEXT_INPUT_MOD_MASK (GDK_MOD2_MASK | GDK_CONTROL_MASK)
-+#define GTK_NO_TEXT_INPUT_MOD_MASK (gdk_quartz_get_fix_modifiers () ? (GDK_MOD2_MASK | GDK_CONTROL_MASK) : (GDK_MOD1_MASK | GDK_CONTROL_MASK))
- #endif
-
- #ifndef GDK_WINDOWING_QUARTZ
-@@ -130,13 +130,13 @@ gboolean _gtk_fnmatch (const char *pattern,
- #define GTK_MODIFY_SELECTION_MOD_MASK GDK_CONTROL_MASK
- #else
- #define GTK_EXTEND_SELECTION_MOD_MASK GDK_SHIFT_MASK
--#define GTK_MODIFY_SELECTION_MOD_MASK GDK_MOD2_MASK
-+#define GTK_MODIFY_SELECTION_MOD_MASK (gdk_quartz_get_fix_modifiers () ? GDK_MOD2_MASK : GDK_MOD1_MASK)
- #endif
-
- #ifndef GDK_WINDOWING_QUARTZ
- #define GTK_TOGGLE_GROUP_MOD_MASK 0
- #else
--#define GTK_TOGGLE_GROUP_MOD_MASK GDK_MOD1_MASK
-+#define GTK_TOGGLE_GROUP_MOD_MASK (gdk_quartz_get_fix_modifiers () ? GDK_MOD1_MASK : 0)
- #endif
-
- gboolean _gtk_button_event_triggers_context_menu (GdkEventButton *event);
+++ /dev/null
---- a/gettext-tools/Makefile.in.orig 2010-06-03 16:38:55.000000000 -0500
-+++ b/gettext-tools/Makefile.in 2010-06-04 01:16:07.000000000 -0500
-@@ -1248,7 +1248,7 @@
- top_srcdir = @top_srcdir@
- AUTOMAKE_OPTIONS = 1.5 gnu no-dependencies
- ACLOCAL_AMFLAGS = -I m4 -I ../gettext-runtime/m4 -I ../m4 -I gnulib-m4 -I libgrep/gnulib-m4 -I libgettextpo/gnulib-m4
--SUBDIRS = doc intl gnulib-lib libgrep src libgettextpo po projects styles misc man m4 tests gnulib-tests examples
-+SUBDIRS = doc intl gnulib-lib libgrep src libgettextpo po projects styles misc man m4 tests gnulib-tests
-
- # Allow users to use "gnulib-tool --update".
+++ /dev/null
-From 5dfd206b09f91cba45fa8e2b66e1b57aafe30868 Mon Sep 17 00:00:00 2001
-From: Kristian Rietveld <kris@lanedo.com>
-Date: Mon, 8 Jul 2013 12:02:00 +0200
-Subject: [PATCH] Make g_main_context_iterate resilient to recursion in poll
-
-On OS X, main loop recursion may happen during the call the poll.
-As a result, the allocated poll array may be re-allocated (note that
-it is always enlarged, never shrunk). By always using cached_poll_array
-after the poll function, reads from bad memory are avoided.
----
- glib/gmain.c | 28 +++++++++++++++-------------
- 1 file changed, 15 insertions(+), 13 deletions(-)
-
-diff --git a/glib/gmain.c b/glib/gmain.c
-index 077a935..529f2b6 100644
---- a/glib/gmain.c
-+++ b/glib/gmain.c
-@@ -3065,8 +3065,7 @@ g_main_context_iterate (GMainContext *context,
- gint max_priority;
- gint timeout;
- gboolean some_ready;
-- gint nfds, allocated_nfds;
-- GPollFD *fds = NULL;
-+ gint nfds;
-
- UNLOCK_CONTEXT (context);
-
-@@ -3095,29 +3094,32 @@ g_main_context_iterate (GMainContext *context,
- context->cached_poll_array = g_new (GPollFD, context->n_poll_records);
- }
-
-- allocated_nfds = context->cached_poll_array_size;
-- fds = context->cached_poll_array;
--
- UNLOCK_CONTEXT (context);
-
- g_main_context_prepare (context, &max_priority);
-
-- while ((nfds = g_main_context_query (context, max_priority, &timeout, fds,
-- allocated_nfds)) > allocated_nfds)
-+ while ((nfds = g_main_context_query (context, max_priority, &timeout,
-+ context->cached_poll_array,
-+ context->cached_poll_array_size))
-+ > context->cached_poll_array_size)
- {
- LOCK_CONTEXT (context);
-- g_free (fds);
-- context->cached_poll_array_size = allocated_nfds = nfds;
-- context->cached_poll_array = fds = g_new (GPollFD, nfds);
-+ g_free (context->cached_poll_array);
-+ context->cached_poll_array_size = nfds;
-+ context->cached_poll_array = g_new (GPollFD, nfds);
- UNLOCK_CONTEXT (context);
- }
-
- if (!block)
- timeout = 0;
-
-- g_main_context_poll (context, timeout, max_priority, fds, nfds);
--
-- some_ready = g_main_context_check (context, max_priority, fds, nfds);
-+ g_main_context_poll (context, timeout, max_priority,
-+ context->cached_poll_array,
-+ nfds);
-+
-+ some_ready = g_main_context_check (context, max_priority,
-+ context->cached_poll_array,
-+ nfds);
-
- if (dispatch)
- g_main_context_dispatch (context);
---
-1.7.10
+++ /dev/null
-/ AC_APPLE_UNIVERSAL_BUILD /c
-/* #undef AC_APPLE_UNIVERSAL_BUILD */
-.
-/ G_VA_COPY_AS_ARRAY /c
-#ifdef __LP64__
-#define G_VA_COPY_AS_ARRAY 1
-#else
-/* #undef G_VA_COPY_AS_ARRAY */
-#endif
-.
-/ SIZEOF_LONG /c
-#ifdef __LP64__
-#define SIZEOF_LONG 8
-#else
-#define SIZEOF_LONG 4
-#endif
-.
-/ SIZEOF_SIZE_T /c
-#ifdef __LP64__
-#define SIZEOF_SIZE_T 8
-#else
-#define SIZEOF_SIZE_T 4
-#endif
-.
-/ SIZEOF_VOID_P /c
-#ifdef __LP64__
-#define SIZEOF_VOID_P 8
-#else
-#define SIZEOF_VOID_P 4
-#endif
-.
-w
+++ /dev/null
---- configure.orig 2012-10-15 19:29:14.000000000 -0500
-+++ configure 2012-10-22 17:29:31.000000000 -0500
-@@ -5602,7 +5602,7 @@
- fi
-
- GLIB_RUNTIME_LIBDIR="$with_runtime_libdir"
--ABS_GLIB_RUNTIME_LIBDIR="`readlink -f $libdir/$with_runtime_libdir`"
-+ABS_GLIB_RUNTIME_LIBDIR="`readlink $libdir/$with_runtime_libdir`"
-
-
- if test "x$with_runtime_libdir" != "x"; then
-@@ -30649,10 +30649,10 @@
- *) glib_vacopy=''
- esac
-
--if test x$glib_cv_va_val_copy = xno; then
- glib_vacopy="\$glib_vacopy
--#define G_VA_COPY_AS_ARRAY 1"
--fi
-+#ifdef __LP64__
-+#define G_VA_COPY_AS_ARRAY 1
-+#endif"
-
- if test x$glib_cv_hasinline = xyes; then
- glib_inline='#define G_HAVE_INLINE 1'
-@@ -32411,18 +32411,32 @@
- cat >>$outfile <<_______EOF
- #define G_HAVE_GINT64 1 /* deprecated, always true */
-
--${glib_extension}typedef signed $gint64 gint64;
--${glib_extension}typedef unsigned $gint64 guint64;
-+#ifdef __LP64__
-+${glib_extension}typedef signed long gint64;
-+${glib_extension}typedef unsigned long guint64;
-
--#define G_GINT64_CONSTANT(val) $gint64_constant
--#define G_GUINT64_CONSTANT(val) $guint64_constant
-+#define G_GINT64_CONSTANT(val) (val##L)
-+#define G_GUINT64_CONSTANT(val) (val##UL)
-+#else
-+${glib_extension}typedef signed long long gint64;
-+${glib_extension}typedef unsigned long long guint64;
-+
-+#define G_GINT64_CONSTANT(val) (G_GNUC_EXTENSION (val##LL))
-+#define G_GUINT64_CONSTANT(val) (G_GNUC_EXTENSION (val##ULL))
-+#endif
- _______EOF
-
- if test x$gint64_format != x ; then
- cat >>$outfile <<_______EOF
--#define G_GINT64_MODIFIER $gint64_modifier
--#define G_GINT64_FORMAT $gint64_format
--#define G_GUINT64_FORMAT $guint64_format
-+#ifdef __LP64__
-+#define G_GINT64_MODIFIER "l"
-+#define G_GINT64_FORMAT "li"
-+#define G_GUINT64_FORMAT "lu"
-+#else
-+#define G_GINT64_MODIFIER "ll"
-+#define G_GINT64_FORMAT "lli"
-+#define G_GUINT64_FORMAT "llu"
-+#endif
- _______EOF
- else
- cat >>$outfile <<_______EOF
-@@ -32434,9 +32448,15 @@
-
- cat >>$outfile <<_______EOF
-
--#define GLIB_SIZEOF_VOID_P $glib_void_p
--#define GLIB_SIZEOF_LONG $glib_long
--#define GLIB_SIZEOF_SIZE_T $glib_size_t
-+#ifdef __LP64__
-+#define GLIB_SIZEOF_VOID_P 8
-+#define GLIB_SIZEOF_LONG 8
-+#define GLIB_SIZEOF_SIZE_T 8
-+#else
-+#define GLIB_SIZEOF_VOID_P 4
-+#define GLIB_SIZEOF_LONG 4
-+#define GLIB_SIZEOF_SIZE_T 4
-+#endif
-
- _______EOF
-
-@@ -32464,18 +32484,33 @@
- if test -z "$glib_unknown_void_p"; then
- cat >>$outfile <<_______EOF
-
--#define GPOINTER_TO_INT(p) ((gint) ${glib_gpi_cast} (p))
--#define GPOINTER_TO_UINT(p) ((guint) ${glib_gpui_cast} (p))
-+#ifdef __LP64__
-+#define GPOINTER_TO_INT(p) ((gint) (glong) (p))
-+#define GPOINTER_TO_UINT(p) ((guint) (gulong) (p))
-+
-+#define GINT_TO_POINTER(i) ((gpointer) (glong) (i))
-+#define GUINT_TO_POINTER(u) ((gpointer) (gulong) (u))
-+
-+typedef signed long gintptr;
-+typedef unsigned long guintptr;
-+
-+#define G_GINTPTR_MODIFIER "l"
-+#define G_GINTPTR_FORMAT "li"
-+#define G_GUINTPTR_FORMAT "lu"
-+#else
-+#define GPOINTER_TO_INT(p) ((gint) (p))
-+#define GPOINTER_TO_UINT(p) ((guint) (p))
-
--#define GINT_TO_POINTER(i) ((gpointer) ${glib_gpi_cast} (i))
--#define GUINT_TO_POINTER(u) ((gpointer) ${glib_gpui_cast} (u))
-+#define GINT_TO_POINTER(i) ((gpointer) (i))
-+#define GUINT_TO_POINTER(u) ((gpointer) (u))
-
--typedef signed $glib_intptr_type_define gintptr;
--typedef unsigned $glib_intptr_type_define guintptr;
-+typedef signed int gintptr;
-+typedef unsigned int guintptr;
-
--#define G_GINTPTR_MODIFIER $gintptr_modifier
--#define G_GINTPTR_FORMAT $gintptr_format
--#define G_GUINTPTR_FORMAT $guintptr_format
-+#define G_GINTPTR_MODIFIER ""
-+#define G_GINTPTR_FORMAT "i"
-+#define G_GUINTPTR_FORMAT "u"
-+#endif
- _______EOF
- else
- echo '#error SIZEOF_VOID_P unknown - This should never happen' >>$outfile
-@@ -32588,7 +32623,9 @@
-
- if test x"$g_memory_barrier_needed" != xno; then
- echo >>$outfile
-+ echo "#ifdef __BIG_ENDIAN__" >>$outfile
- echo "#define G_ATOMIC_OP_MEMORY_BARRIER_NEEDED 1" >>$outfile
-+ echo "#endif" >>$outfile
- fi
- if test x"$g_atomic_lock_free" = xyes; then
- echo >>$outfile
-@@ -32598,27 +32635,52 @@
- g_bit_sizes="16 32 64"
- for bits in $g_bit_sizes; do
- cat >>$outfile <<_______EOF
--#define GINT${bits}_TO_${g_bs_native}(val) ((gint${bits}) (val))
--#define GUINT${bits}_TO_${g_bs_native}(val) ((guint${bits}) (val))
--#define GINT${bits}_TO_${g_bs_alien}(val) ((gint${bits}) GUINT${bits}_SWAP_LE_BE (val))
--#define GUINT${bits}_TO_${g_bs_alien}(val) (GUINT${bits}_SWAP_LE_BE (val))
-+#ifdef __BIG_ENDIAN__
-+#define GINT${bits}_TO_BE(val) ((gint${bits}) (val))
-+#define GUINT${bits}_TO_BE(val) ((guint${bits}) (val))
-+#define GINT${bits}_TO_LE(val) ((gint${bits}) GUINT${bits}_SWAP_LE_BE (val))
-+#define GUINT${bits}_TO_LE(val) (GUINT${bits}_SWAP_LE_BE (val))
-+#else
-+#define GINT${bits}_TO_LE(val) ((gint${bits}) (val))
-+#define GUINT${bits}_TO_LE(val) ((guint${bits}) (val))
-+#define GINT${bits}_TO_BE(val) ((gint${bits}) GUINT${bits}_SWAP_LE_BE (val))
-+#define GUINT${bits}_TO_BE(val) (GUINT${bits}_SWAP_LE_BE (val))
-+#endif
- _______EOF
- done
-
- cat >>$outfile <<_______EOF
--#define GLONG_TO_LE(val) ((glong) GINT${glongbits}_TO_LE (val))
--#define GULONG_TO_LE(val) ((gulong) GUINT${glongbits}_TO_LE (val))
--#define GLONG_TO_BE(val) ((glong) GINT${glongbits}_TO_BE (val))
--#define GULONG_TO_BE(val) ((gulong) GUINT${glongbits}_TO_BE (val))
-+#ifdef __LP64__
-+#define GLONG_TO_LE(val) ((glong) GINT64_TO_LE (val))
-+#define GULONG_TO_LE(val) ((gulong) GUINT64_TO_LE (val))
-+#define GLONG_TO_BE(val) ((glong) GINT64_TO_BE (val))
-+#define GULONG_TO_BE(val) ((gulong) GUINT64_TO_BE (val))
-+#else
-+#define GLONG_TO_LE(val) ((glong) GINT32_TO_LE (val))
-+#define GULONG_TO_LE(val) ((gulong) GUINT32_TO_LE (val))
-+#define GLONG_TO_BE(val) ((glong) GINT32_TO_BE (val))
-+#define GULONG_TO_BE(val) ((gulong) GUINT32_TO_BE (val))
-+#endif
- #define GINT_TO_LE(val) ((gint) GINT${gintbits}_TO_LE (val))
- #define GUINT_TO_LE(val) ((guint) GUINT${gintbits}_TO_LE (val))
- #define GINT_TO_BE(val) ((gint) GINT${gintbits}_TO_BE (val))
- #define GUINT_TO_BE(val) ((guint) GUINT${gintbits}_TO_BE (val))
--#define GSIZE_TO_LE(val) ((gsize) GUINT${gsizebits}_TO_LE (val))
--#define GSSIZE_TO_LE(val) ((gssize) GINT${gsizebits}_TO_LE (val))
--#define GSIZE_TO_BE(val) ((gsize) GUINT${gsizebits}_TO_BE (val))
--#define GSSIZE_TO_BE(val) ((gssize) GINT${gsizebits}_TO_BE (val))
--#define G_BYTE_ORDER $g_byte_order
-+#ifdef __LP64__
-+#define GSIZE_TO_LE(val) ((gsize) GUINT64_TO_LE (val))
-+#define GSSIZE_TO_LE(val) ((gssize) GINT64_TO_LE (val))
-+#define GSIZE_TO_BE(val) ((gsize) GUINT64_TO_BE (val))
-+#define GSSIZE_TO_BE(val) ((gssize) GINT64_TO_BE (val))
-+#else
-+#define GSIZE_TO_LE(val) ((gsize) GUINT32_TO_LE (val))
-+#define GSSIZE_TO_LE(val) ((gssize) GINT32_TO_LE (val))
-+#define GSIZE_TO_BE(val) ((gsize) GUINT32_TO_BE (val))
-+#define GSSIZE_TO_BE(val) ((gssize) GINT32_TO_BE (val))
-+#endif
-+#ifdef __BIG_ENDIAN__
-+#define G_BYTE_ORDER G_BIG_ENDIAN
-+#else
-+#define G_BYTE_ORDER G_LITTLE_ENDIAN
-+#endif
-
- #define GLIB_SYSDEF_POLLIN =$g_pollin
- #define GLIB_SYSDEF_POLLOUT =$g_pollout
+++ /dev/null
---- glib/gi18n.h.orig 2008-11-23 23:45:23.000000000 -0600
-+++ glib/gi18n.h 2008-11-25 23:59:29.000000000 -0600
-@@ -27,7 +27,9 @@
-
- #define _(String) gettext (String)
- #define Q_(String) g_dpgettext (NULL, String, 0)
-+#ifndef N_
- #define N_(String) (String)
-+#endif
- #define C_(Context,String) g_dpgettext (NULL, Context "\004" String, strlen (Context) + 1)
- #define NC_(Context, String) (String)
+++ /dev/null
---- gio/gdbusprivate.c.orig 2012-04-30 11:24:02.000000000 -0500
-+++ gio/gdbusprivate.c 2012-05-02 01:57:47.000000000 -0500
-@@ -2094,7 +2094,7 @@
- /* TODO: use PACKAGE_LOCALSTATEDIR ? */
- ret = NULL;
- first_error = NULL;
-- if (!g_file_get_contents ("/var/lib/dbus/machine-id",
-+ if (!g_file_get_contents ("@@PREFIX@@/var/lib/dbus/machine-id",
- &ret,
- NULL,
- &first_error) &&
-@@ -2104,7 +2104,7 @@
- NULL))
- {
- g_propagate_prefixed_error (error, first_error,
-- _("Unable to load /var/lib/dbus/machine-id or /etc/machine-id: "));
-+ _("Unable to load @@PREFIX@@/var/lib/dbus/machine-id or /etc/machine-id: "));
- }
- else
- {
+++ /dev/null
---- gio/xdgmime/xdgmime.c.orig 2009-03-12 22:09:52.000000000 -0600
-+++ gio/xdgmime/xdgmime.c 2009-04-09 23:41:01.000000000 -0600
-@@ -257,7 +257,7 @@
-
- xdg_data_dirs = getenv ("XDG_DATA_DIRS");
- if (xdg_data_dirs == NULL)
-- xdg_data_dirs = "/usr/local/share/:/usr/share/";
-+ xdg_data_dirs = "@@PREFIX@@/share/:/usr/share/";
-
- ptr = xdg_data_dirs;
+++ /dev/null
---- glib-2.0.pc.in.orig 2012-01-15 21:12:06.000000000 -0600
-+++ glib-2.0.pc.in 2012-01-19 22:29:43.000000000 -0600
-@@ -13,4 +13,4 @@
- Requires.private: @PCRE_REQUIRES@
- Libs: -L${libdir} -lglib-2.0 @INTLLIBS@
- Libs.private: @G_THREAD_LIBS@ @G_LIBS_EXTRA@ @PCRE_LIBS@ @INTLLIBS@ @ICONV_LIBS@
--Cflags: -I${includedir}/glib-2.0 -I${libdir}/glib-2.0/include @GLIB_EXTRA_CFLAGS@
-+Cflags: -I${includedir}/glib-2.0 -I${libdir}/glib-2.0/include -I${includedir} @GLIB_EXTRA_CFLAGS@
+++ /dev/null
---- glib/gunicollate.c.orig 2009-03-31 18:04:20.000000000 -0500
-+++ glib/gunicollate.c 2010-03-06 17:59:08.000000000 -0600
-@@ -26,6 +26,9 @@
- #include <wchar.h>
- #endif
-
-+/* Carbon is not available on 64-bit */
-+#undef HAVE_CARBON
-+
- #ifdef HAVE_CARBON
- #include <CoreServices/CoreServices.h>
- #endif
+++ /dev/null
-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 "$@"
+++ /dev/null
-diff --git a/src/murrine_draw.c b/src/murrine_draw.c
-index 4cab20f..06ed9b1 100644
---- a/src/murrine_draw.c
-+++ b/src/murrine_draw.c
-@@ -1625,10 +1625,6 @@ murrine_draw_scrollbar_slider (cairo_t *cr,
- }
-
- cairo_restore (cr);
--
-- murrine_set_color_rgb (cr, &border);
-- murrine_rounded_rectangle (cr, 0.5, 0.5, width-1, height-1, widget->roundness, widget->corners);
-- cairo_stroke (cr);
- }
-
- static void
-@@ -1791,21 +1787,15 @@ murrine_draw_normal_arrow (cairo_t *cr,
- {
- double arrow_width;
- double arrow_height;
-- double line_width_2;
-
-- cairo_save (cr);
--
-- arrow_width = MIN (height*2.0 + MAX (1.0, ceil (height*2.0/6.0*2.0)/2.0)/2.0, width);
-- line_width_2 = MAX (1.0, ceil (arrow_width/6.0*2.0)/2.0)/2.0;
-- arrow_height = arrow_width/2.0+line_width_2;
-+ arrow_width = CLAMP (width, 3, 8);
-+ arrow_height = CLAMP (height, 3, 8);
-
-- cairo_translate (cr, x, y-arrow_height/2.0);
-+ cairo_save (cr);
-
-- cairo_move_to (cr, -arrow_width/2.0, line_width_2);
-- cairo_line_to (cr, -arrow_width/2.0 + line_width_2, 0);
-- cairo_arc_negative (cr, 0, arrow_height-2*line_width_2-2*line_width_2*sqrt(2), 2*line_width_2, M_PI_2+M_PI_4, M_PI_4);
-- cairo_line_to (cr, arrow_width/2.0-line_width_2, 0);
-- cairo_line_to (cr, arrow_width/2.0, line_width_2);
-+ cairo_translate (cr, x, y - arrow_height / 2.0);
-+ cairo_move_to (cr, -arrow_width / 2.0, 0);
-+ cairo_line_to (cr, arrow_width / 2.0, 0);
- cairo_line_to (cr, 0, arrow_height);
- cairo_close_path (cr);
+++ /dev/null
-From 3cab26a0468bab855ed2eb13e4f334176e109483 Mon Sep 17 00:00:00 2001
-From: Kristian Rietveld <kris@lanedo.com>
-Date: Tue, 19 Mar 2013 11:23:09 +0100
-Subject: [PATCH 1/2] Simply process entire bitmap obtained from the core text
- font
-
----
- pango/pangocoretext.c | 3 +--
- 1 files changed, 1 insertions(+), 2 deletions(-)
-
-diff --git a/pango/pangocoretext.c b/pango/pangocoretext.c
-index 36bcd82..1d46271 100644
---- a/pango/pangocoretext.c
-+++ b/pango/pangocoretext.c
-@@ -89,8 +89,7 @@ ct_font_descriptor_get_coverage (CTFontDescriptorRef desc)
- bitmap = CFCharacterSetCreateBitmapRepresentation (kCFAllocatorDefault,
- charset);
-
-- /* We only handle the BMP plane */
-- length = MIN (CFDataGetLength (bitmap), 8192);
-+ length = CFDataGetLength (bitmap);
- ptr = CFDataGetBytePtr (bitmap);
-
- /* FIXME: can and should this be done more efficiently? */
---
-1.7.4.4
+++ /dev/null
-661f8c0b920f5da Mon Sep 17 00:00:00 2001
-From: Kristian Rietveld <kris@lanedo.com>
-Date: Tue, 19 Mar 2013 11:23:49 +0100
-Subject: [PATCH 2/2] Detect and handle characters encoded in two UTF16 code
- points
-
-Another important change: gi->index should point at the current
-character, not the current into the string. Before this change,
-the current character equaled the current index into the string.
----
- modules/basic/basic-coretext.c | 55 ++++++++++++++++++++++++++++-----------
- 1 files changed, 39 insertions(+), 16 deletions(-)
-
-diff --git a/modules/basic/basic-coretext.c b/modules/basic/basic-coretext.c
-index 33ce479..06b648e 100644
---- a/modules/basic/basic-coretext.c
-+++ b/modules/basic/basic-coretext.c
-@@ -166,7 +166,42 @@ run_iterator_run_is_non_monotonic (struct RunIterator *iter)
- static gunichar
- run_iterator_get_character (struct RunIterator *iter)
- {
-- return CFStringGetCharacterAtIndex (iter->cstr, iter->current_indices[iter->ct_i]);
-+ int lower, upper;
-+
-+ lower = iter->current_indices[iter->ct_i];
-+ if (iter->ct_i + 1 < CTRunGetGlyphCount (iter->current_run))
-+ upper = iter->current_indices[iter->ct_i + 1];
-+ else
-+ {
-+ CFRange range = CTRunGetStringRange (iter->current_run);
-+ upper = range.location + range.length;
-+ }
-+
-+ if (upper - lower == 1)
-+ return CFStringGetCharacterAtIndex (iter->cstr, lower);
-+ if (upper - lower == 2)
-+ {
-+ /* Character is encoded in two UTF16 code points. */
-+ gunichar *ch;
-+ gunichar retval;
-+ gunichar2 orig[2];
-+
-+ orig[0] = CFStringGetCharacterAtIndex (iter->cstr, lower);
-+ orig[1] = CFStringGetCharacterAtIndex (iter->cstr, lower + 1);
-+
-+ ch = g_utf16_to_ucs4 (orig, 2, NULL, NULL, NULL);
-+ retval = *ch;
-+ g_free (ch);
-+
-+ return retval;
-+ }
-+
-+ /* This should not be reached, because other cases cannot occur. Instead
-+ * of crashing, return the first character which will likely be displayed
-+ * as unknown glyph.
-+ */
-+
-+ return CFStringGetCharacterAtIndex (iter->cstr, lower);
- }
-
- static CGGlyph
-@@ -175,12 +210,6 @@ run_iterator_get_cgglyph (struct RunIterator *iter)
- return iter->current_cgglyphs[iter->ct_i];
- }
-
--static CFIndex
--run_iterator_get_index (struct RunIterator *iter)
--{
-- return iter->current_indices[iter->ct_i];
--}
--
- static gboolean
- run_iterator_create (struct RunIterator *iter,
- const char *text,
-@@ -336,7 +365,7 @@ create_core_text_glyph_list (const char *text,
- struct GlyphInfo *gi;
-
- gi = g_slice_new (struct GlyphInfo);
-- gi->index = run_iterator_get_index (&riter);
-+ gi->index = riter.total_ct_i;
- gi->cgglyph = run_iterator_get_cgglyph (&riter);
- gi->wc = run_iterator_get_character (&riter);
-
-@@ -376,9 +405,8 @@ basic_engine_shape (PangoEngineShape *engine,
- * glyph sequence generated by the CoreText typesetter:
- * # E.g. zero-width spaces do not end up in the CoreText glyph sequence. We have
- * to manually account for the gap in the character indices.
-- * # Sometimes, CoreText generates two glyph for the same character index. We
-- * currently handle this "properly" as in we do not crash or corrupt memory,
-- * but that's about it.
-+ * # Sometimes, CoreText generates two glyph for the same character index. These
-+ * are properly composed into a single 32-bit gunichar.
- * # Due to mismatches in size, the CoreText glyph sequence can either be longer or
- * shorter than the PangoGlyphString. Note that the size of the PangoGlyphString
- * should match the number of characters in "text".
-@@ -390,11 +418,6 @@ basic_engine_shape (PangoEngineShape *engine,
- * increasing/decreasing.
- *
- * FIXME items for future fixing:
-- * # CoreText strings are UTF16, and the indices *often* refer to characters,
-- * but not *always*. Notable exception is when a character is encoded using
-- * two UTF16 code points. This are two characters in a CFString. At this point
-- * advancing a single character in the CFString and advancing a single character
-- * using g_utf8_next_char in the const char string goes out of sync.
- * # We currently don't bother about LTR, Pango core appears to fix this up for us.
- * (Even when we cared warnings were generated that strings were in the wrong
- * order, this should be investigated).
---
-1.7.4.4
+++ /dev/null
-diff --git a/pango/pangocoretext-fontmap.c b/pango/pangocoretext-fontmap.c
-index 53b2676..2b30a07 100644
---- a/pango/pangocoretext-fontmap.c
-+++ b/pango/pangocoretext-fontmap.c
-@@ -411,6 +411,9 @@ _pango_core_text_font_description_from_ct_font_descriptor (CTFontDescriptorRef d
- else
- pango_font_description_set_style (font_desc, PANGO_STYLE_NORMAL);
-
-+ if ((font_traits & kCTFontCondensedTrait) == kCTFontCondensedTrait)
-+ pango_font_description_set_stretch (font_desc, PANGO_STRETCH_CONDENSED);
-+
- if (ct_font_descriptor_is_small_caps (desc))
- pango_font_description_set_variant (font_desc, PANGO_VARIANT_SMALL_CAPS);
- else
+++ /dev/null
-diff --git a/modules/basic/.libs/basic-coretext.o b/modules/basic/.libs/basic-coretext.o
-index 13cce67..80c3268 100644
-Binary files a/modules/basic/.libs/basic-coretext.o and b/modules/basic/.libs/basic-coretext.o differ
-diff --git a/modules/basic/.libs/pango-basic-coretext.so b/modules/basic/.libs/pango-basic-coretext.so
-index 70bb117..d0940c4 100755
-Binary files a/modules/basic/.libs/pango-basic-coretext.so and b/modules/basic/.libs/pango-basic-coretext.so differ
-diff --git a/modules/basic/basic-coretext.c b/modules/basic/basic-coretext.c
-index c34460a..46d83ff 100644
---- a/modules/basic/basic-coretext.c
-+++ b/modules/basic/basic-coretext.c
-@@ -92,6 +92,7 @@ struct RunIterator
- CTRunRef current_run;
- CFIndex *current_indices;
- const CGGlyph *current_cgglyphs;
-+ CGGlyph *current_cgglyphs_buffer;
- CTRunStatus current_run_status;
- };
-
-@@ -101,6 +102,9 @@ run_iterator_free_current_run (struct RunIterator *iter)
- iter->current_run_number = -1;
- iter->current_run = NULL;
- iter->current_cgglyphs = NULL;
-+ if (iter->current_cgglyphs_buffer)
-+ free (iter->current_cgglyphs_buffer);
-+ iter->current_cgglyphs_buffer = NULL;
- if (iter->current_indices)
- free (iter->current_indices);
- iter->current_indices = NULL;
-@@ -116,10 +120,18 @@ run_iterator_set_current_run (struct RunIterator *iter,
-
- iter->current_run_number = run_number;
- iter->current_run = CFArrayGetValueAtIndex (iter->runs, run_number);
-+ ct_glyph_count = CTRunGetGlyphCount (iter->current_run);
-+
- iter->current_run_status = CTRunGetStatus (iter->current_run);
- iter->current_cgglyphs = CTRunGetGlyphsPtr (iter->current_run);
-+ if (!iter->current_cgglyphs)
-+ {
-+ iter->current_cgglyphs_buffer = (CGGlyph *)malloc (sizeof (CGGlyph) * ct_glyph_count);
-+ CTRunGetGlyphs (iter->current_run, CFRangeMake (0, ct_glyph_count),
-+ iter->current_cgglyphs_buffer);
-+ iter->current_cgglyphs = iter->current_cgglyphs_buffer;
-+ }
-
-- ct_glyph_count = CTRunGetGlyphCount (iter->current_run);
- iter->current_indices = malloc (sizeof (CFIndex *) * ct_glyph_count);
- CTRunGetStringIndices (iter->current_run, CFRangeMake (0, ct_glyph_count),
- iter->current_indices);
-@@ -237,6 +249,7 @@ run_iterator_create (struct RunIterator *iter,
- iter->current_run = NULL;
- iter->current_indices = NULL;
- iter->current_cgglyphs = NULL;
-+ iter->current_cgglyphs_buffer = NULL;
-
- /* Create CTLine */
- attributes = CFDictionaryCreate (kCFAllocatorDefault,
-diff --git a/modules/basic/basic-coretext.c.orig b/modules/basic/basic-coretext.c.orig
-index 0a2c27f..c34460a 100644
---- a/modules/basic/basic-coretext.c.orig
-+++ b/modules/basic/basic-coretext.c.orig
-@@ -166,7 +166,42 @@ run_iterator_run_is_non_monotonic (struct RunIterator *iter)
- static gunichar
- run_iterator_get_character (struct RunIterator *iter)
- {
-- return CFStringGetCharacterAtIndex (iter->cstr, iter->current_indices[iter->ct_i]);
-+ int lower, upper;
-+
-+ lower = iter->current_indices[iter->ct_i];
-+ if (iter->ct_i + 1 < CTRunGetGlyphCount (iter->current_run))
-+ upper = iter->current_indices[iter->ct_i + 1];
-+ else
-+ {
-+ CFRange range = CTRunGetStringRange (iter->current_run);
-+ upper = range.location + range.length;
-+ }
-+
-+ if (upper - lower == 1)
-+ return CFStringGetCharacterAtIndex (iter->cstr, lower);
-+ if (upper - lower == 2)
-+ {
-+ /* Character is encoded in two UTF16 code points. */
-+ gunichar *ch;
-+ gunichar retval;
-+ gunichar2 orig[2];
-+
-+ orig[0] = CFStringGetCharacterAtIndex (iter->cstr, lower);
-+ orig[1] = CFStringGetCharacterAtIndex (iter->cstr, lower + 1);
-+
-+ ch = g_utf16_to_ucs4 (orig, 2, NULL, NULL, NULL);
-+ retval = *ch;
-+ g_free (ch);
-+
-+ return retval;
-+ }
-+
-+ /* This should not be reached, because other cases cannot occur. Instead
-+ * of crashing, return the first character which will likely be displayed
-+ * as unknown glyph.
-+ */
-+
-+ return CFStringGetCharacterAtIndex (iter->cstr, lower);
- }
-
- static CGGlyph
-@@ -175,12 +210,6 @@ run_iterator_get_cgglyph (struct RunIterator *iter)
- return iter->current_cgglyphs[iter->ct_i];
- }
-
--static CFIndex
--run_iterator_get_index (struct RunIterator *iter)
--{
-- return iter->current_indices[iter->ct_i];
--}
--
- static gboolean
- run_iterator_create (struct RunIterator *iter,
- const char *text,
-@@ -190,13 +219,17 @@ run_iterator_create (struct RunIterator *iter,
- char *copy;
- CFDictionaryRef attributes;
- CFAttributedStringRef attstr;
-+ int val = 0;
-+ CFNumberRef number = CFNumberCreate (kCFAllocatorDefault, kCFNumberIntType, &val);
-
- CFTypeRef keys[] = {
-- (CFTypeRef) kCTFontAttributeName
-+ (CFTypeRef) kCTFontAttributeName,
-+ kCTLigatureAttributeName
- };
-
- CFTypeRef values[] = {
-- ctfont
-+ ctfont,
-+ number
- };
-
- /* Initialize RunIterator structure */
-@@ -209,7 +242,7 @@ run_iterator_create (struct RunIterator *iter,
- attributes = CFDictionaryCreate (kCFAllocatorDefault,
- (const void **)keys,
- (const void **)values,
-- 1,
-+ sizeof (keys) / sizeof (keys[0]),
- &kCFCopyStringDictionaryKeyCallBacks,
- &kCFTypeDictionaryValueCallBacks);
-
-@@ -233,6 +266,7 @@ run_iterator_create (struct RunIterator *iter,
- iter->line = CTLineCreateWithAttributedString (attstr);
- iter->runs = CTLineGetGlyphRuns (iter->line);
-
-+ CFRelease (number);
- CFRelease (attstr);
- CFRelease (attributes);
-
-@@ -336,7 +370,7 @@ create_core_text_glyph_list (const char *text,
- struct GlyphInfo *gi;
-
- gi = g_slice_new (struct GlyphInfo);
-- gi->index = run_iterator_get_index (&riter);
-+ gi->index = riter.total_ct_i;
- gi->cgglyph = run_iterator_get_cgglyph (&riter);
- gi->wc = run_iterator_get_character (&riter);
-
-@@ -378,9 +412,8 @@ basic_engine_shape (PangoEngineShape *engine,
- * glyph sequence generated by the CoreText typesetter:
- * # E.g. zero-width spaces do not end up in the CoreText glyph sequence. We have
- * to manually account for the gap in the character indices.
-- * # Sometimes, CoreText generates two glyph for the same character index. We
-- * currently handle this "properly" as in we do not crash or corrupt memory,
-- * but that's about it.
-+ * # Sometimes, CoreText generates two glyph for the same character index. These
-+ * are properly composed into a single 32-bit gunichar.
- * # Due to mismatches in size, the CoreText glyph sequence can either be longer or
- * shorter than the PangoGlyphString. Note that the size of the PangoGlyphString
- * should match the number of characters in "text".
-@@ -392,11 +425,6 @@ basic_engine_shape (PangoEngineShape *engine,
- * increasing/decreasing.
- *
- * FIXME items for future fixing:
-- * # CoreText strings are UTF16, and the indices *often* refer to characters,
-- * but not *always*. Notable exception is when a character is encoded using
-- * two UTF16 code points. This are two characters in a CFString. At this point
-- * advancing a single character in the CFString and advancing a single character
-- * using g_utf8_next_char in the const char string goes out of sync.
- * # We currently don't bother about LTR, Pango core appears to fix this up for us.
- * (Even when we cared warnings were generated that strings were in the wrong
- * order, this should be investigated).
+++ /dev/null
-diff --git a/modules/basic/.libs/basic-coretext.o b/modules/basic/.libs/basic-coretext.o
-index f013cbc..270a4f4 100644
-Binary files a/modules/basic/.libs/basic-coretext.o and b/modules/basic/.libs/basic-coretext.o differ
-diff --git a/modules/basic/.libs/pango-basic-coretext.so b/modules/basic/.libs/pango-basic-coretext.so
-index 2cbf3ef..fec3e0f 100755
-Binary files a/modules/basic/.libs/pango-basic-coretext.so and b/modules/basic/.libs/pango-basic-coretext.so differ
-diff --git a/modules/basic/basic-coretext.c b/modules/basic/basic-coretext.c
-index 82c2b48..c34460a 100644
---- a/modules/basic/basic-coretext.c
-+++ b/modules/basic/basic-coretext.c
-@@ -219,13 +219,17 @@ run_iterator_create (struct RunIterator *iter,
- char *copy;
- CFDictionaryRef attributes;
- CFAttributedStringRef attstr;
-+ int val = 0;
-+ CFNumberRef number = CFNumberCreate (kCFAllocatorDefault, kCFNumberIntType, &val);
-
- CFTypeRef keys[] = {
-- (CFTypeRef) kCTFontAttributeName
-+ (CFTypeRef) kCTFontAttributeName,
-+ kCTLigatureAttributeName
- };
-
- CFTypeRef values[] = {
-- ctfont
-+ ctfont,
-+ number
- };
-
- /* Initialize RunIterator structure */
-@@ -238,7 +242,7 @@ run_iterator_create (struct RunIterator *iter,
- attributes = CFDictionaryCreate (kCFAllocatorDefault,
- (const void **)keys,
- (const void **)values,
-- 1,
-+ sizeof (keys) / sizeof (keys[0]),
- &kCFCopyStringDictionaryKeyCallBacks,
- &kCFTypeDictionaryValueCallBacks);
-
-@@ -262,6 +266,7 @@ run_iterator_create (struct RunIterator *iter,
- iter->line = CTLineCreateWithAttributedString (attstr);
- iter->runs = CTLineGetGlyphRuns (iter->line);
-
-+ CFRelease (number);
- CFRelease (attstr);
- CFRelease (attributes);
+++ /dev/null
-diff --git a/pango/pangocoretext-fontmap.c b/pango/pangocoretext-fontmap.c
-index bcbb173..53b2676 100644
---- a/pango/pangocoretext-fontmap.c
-+++ b/pango/pangocoretext-fontmap.c
-@@ -297,7 +297,7 @@ ct_font_descriptor_get_weight (CTFontDescriptorRef desc)
- cf_number = (CFNumberRef)CFDictionaryGetValue (dict,
- kCTFontWeightTrait);
-
-- if (CFNumberGetValue (cf_number, kCFNumberCGFloatType, &value))
-+ if (cf_number != NULL && CFNumberGetValue (cf_number, kCFNumberCGFloatType, &value))
- {
- if (value < ct_weight_min || value > ct_weight_max)
- {
+++ /dev/null
-Index: pango/pango-utils.c
-===================================================================
---- a/pango/pango-utils.c (revision 2425)
-+++ b/pango/pango-utils.c (working copy)
-@@ -567,6 +567,20 @@ read_config_file (const char *filename,
- gchar *value = g_key_file_get_value(key_file, group, key, &key_error);
- if (value != NULL)
- {
-+ if (!g_path_is_absolute (value))
-+ {
-+ gchar *dirname;
-+ gchar *absolute_path;
-+
-+ dirname = g_path_get_dirname (filename);
-+ absolute_path = g_build_filename (dirname, value, NULL);
-+
-+ g_free (dirname);
-+ g_free (value);
-+
-+ value = absolute_path;
-+ }
-+
- g_hash_table_insert (ht,
- g_strdup_printf ("%s/%s", group, key),
- value);
+++ /dev/null
-diff --git a/pango/pangocairo-coretextfontmap.c b/pango/pangocairo-coretextfontmap.c
-index 6cb3809..c75737c 100644
---- a/pango/pangocairo-coretextfontmap.c
-+++ b/pango/pangocairo-coretextfontmap.c
-@@ -185,9 +185,13 @@ pango_cairo_core_text_font_map_load_font (PangoCoreTextFontMap *fontmap,
- PangoContext *context,
- const PangoFontDescription *description)
- {
-- char *descname = pango_font_description_get_family (description);
-+ const char *descname = pango_font_description_get_family (description);
-+ SInt32 major, minor;
-
-- if (strcmp (descname, "-apple-system-font") == 0)
-+ Gestalt (gestaltSystemVersionMajor, &major);
-+ Gestalt (gestaltSystemVersionMinor, &minor);
-+
-+ if (major == 10 && minor>= 11 && strcmp (descname, "-apple-system-font") == 0)
- {
- PangoCoreTextFont *cfont;
- NSFont *sysfont;
-@@ -195,7 +199,6 @@ pango_cairo_core_text_font_map_load_font (PangoCoreTextFontMap *fontmap,
- cairo_matrix_t font_matrix;
- PangoCoreTextFontsetKey fontset_key;
- PangoCoreTextFontKey key;
-- PangoLanguage *language;
- PangoFontDescription *tmp_desc;
- gboolean synthetic_italic = FALSE;
- double abs_size = get_scaled_size (fontmap, context, description);
-@@ -207,7 +210,7 @@ pango_cairo_core_text_font_map_load_font (PangoCoreTextFontMap *fontmap,
- PangoCairoCoreTextFont *cafont = g_object_new (PANGO_TYPE_CAIRO_CORE_TEXT_FONT, NULL);
- cfont = PANGO_CORE_TEXT_FONT (cafont);
- cafont->abs_size = abs_size;
-- _pango_core_text_font_set_ctfont (cfont, CFRetain (sysfont));
-+ _pango_core_text_font_set_ctfont (cfont, (CTFontRef)CFRetain (sysfont));
-
- tmp_desc = pango_font_description_copy_static (description);
-
-@@ -261,7 +264,7 @@ pango_cairo_core_text_font_map_load_font (PangoCoreTextFontMap *fontmap,
- }
- }
-
-- return PANGO_FONT_MAP_CLASS (pango_cairo_core_text_font_map_parent_class)->load_font (fontmap, context, description);
-+ return (PangoCoreTextFont*) PANGO_FONT_MAP_CLASS (pango_cairo_core_text_font_map_parent_class)->load_font (PANGO_FONT_MAP (fontmap), context, description);
- }
-
- static void
-diff --git a/pango/pangocoretext-fontmap.c b/pango/pangocoretext-fontmap.c
-index 4234bf1..c395c91 100644
---- a/pango/pangocoretext-fontmap.c
-+++ b/pango/pangocoretext-fontmap.c
-@@ -1367,6 +1367,7 @@ pango_core_text_font_map_init (PangoCoreTextFontMap *ctfontmap)
- CTFontCollectionRef collection;
- CFArrayRef ctfaces;
- CFIndex i, count;
-+ SInt32 major, minor;
-
- ctfontmap->serial = 1;
- ctfontmap->families = g_hash_table_new_full (g_str_hash, g_str_equal,
-@@ -1430,7 +1431,10 @@ pango_core_text_font_map_init (PangoCoreTextFontMap *ctfontmap)
- CFRelease (dict);
- }
-
-- if (true)
-+ Gestalt (gestaltSystemVersionMajor, &major);
-+ Gestalt (gestaltSystemVersionMinor, &minor);
-+
-+ if (major == 10 && minor >= 11)
- {
- NSFont *sysfont = [NSFont systemFontOfSize: 0.0];
- NSString *name = [[NSFont fontWithName: [[sysfont fontDescriptor] postscriptName] size: 0.0] familyName];
+++ /dev/null
-diff --git a/configure.ac b/configure.ac
-index 42c04ef..1260b8a 100644
---- a/configure.ac
-+++ b/configure.ac
-@@ -185,7 +185,7 @@ changequote(,)dnl
- if test "x$GCC" = "xyes"; then
- case " $CFLAGS " in
- *[\ \ ]-Wall[\ \ ]*) ;;
-- *) CFLAGS="$CFLAGS -Wall" ;;
-+ *) CFLAGS="$CFLAGS -Wall -ObjC" ;;
- esac
- fi
- changequote([,])dnl
-diff --git a/pango/pangocairo-coretext.h b/pango/pangocairo-coretext.h
-index 31faf9b..f562587 100644
---- a/pango/pangocairo-coretext.h
-+++ b/pango/pangocairo-coretext.h
-@@ -43,6 +43,19 @@ struct _PangoCairoCoreTextFontMap
- gdouble dpi;
- };
-
-+struct _PangoCairoCoreTextFont
-+{
-+ PangoCoreTextFont font;
-+ PangoCairoFontPrivate cf_priv;
-+
-+ int abs_size;
-+};
-+
-+struct _PangoCairoCoreTextFontClass
-+{
-+ PangoCoreTextFontClass parent_class;
-+};
-+
- GType pango_cairo_core_text_font_map_get_type (void) G_GNUC_CONST;
-
- PangoCoreTextFont *
-diff --git a/pango/pangocairo-coretextfont.c b/pango/pangocairo-coretextfont.c
-index 0f2a9ef..463b6e2 100644
---- a/pango/pangocairo-coretextfont.c
-+++ b/pango/pangocairo-coretextfont.c
-@@ -23,6 +23,7 @@
-
- #include "config.h"
-
-+#import <AppKit/AppKit.h>
- #include <Carbon/Carbon.h>
-
- #include "pango-impl-utils.h"
-@@ -32,21 +33,6 @@
- #include "pangocairo-coretext.h"
- #include "pangocairo-coretextfont.h"
-
--struct _PangoCairoCoreTextFont
--{
-- PangoCoreTextFont font;
-- PangoCairoFontPrivate cf_priv;
--
-- int abs_size;
--};
--
--struct _PangoCairoCoreTextFontClass
--{
-- PangoCoreTextFontClass parent_class;
--};
--
--
--
- static cairo_font_face_t *pango_cairo_core_text_font_create_font_face (PangoCairoFont *font);
- static PangoFontMetrics *pango_cairo_core_text_font_create_base_metrics_for_context (PangoCairoFont *font,
- PangoContext *context);
-@@ -204,6 +190,75 @@ pango_cairo_core_text_font_init (PangoCairoCoreTextFont *cafont G_GNUC_UNUSED)
- {
- }
-
-+static gchar *
-+gchar_from_cf_string (CFStringRef str)
-+{
-+ CFIndex len;
-+ gchar *buffer;
-+
-+ /* GetLength returns the number of UTF-16 pairs, so this number
-+ * times 2 should definitely give us enough space for UTF8.
-+ * We add one for the terminating zero.
-+ */
-+ len = CFStringGetLength (str) * 2 + 1;
-+ buffer = g_new0 (char, len);
-+ CFStringGetCString (str, buffer, len, kCFStringEncodingUTF8);
-+
-+ return buffer;
-+}
-+
-+static gchar *
-+ct_font_descriptor_get_family_name (CTFontDescriptorRef desc,
-+ gboolean may_fail)
-+{
-+ CFStringRef cf_str;
-+ char *buffer;
-+
-+ cf_str = CTFontDescriptorCopyAttribute (desc, kCTFontFamilyNameAttribute);
-+ if (!cf_str)
-+ {
-+ int i;
-+
-+ /* No font family name is set, try to retrieve font name and deduce
-+ * the family name from that instead.
-+ */
-+ cf_str = CTFontDescriptorCopyAttribute (desc, kCTFontNameAttribute);
-+ if (!cf_str)
-+ {
-+ if (may_fail)
-+ return NULL;
-+
-+ /* This font is likely broken, return a default family name ... */
-+ return g_strdup ("Sans");
-+ }
-+
-+ buffer = gchar_from_cf_string (cf_str);
-+ CFRelease (cf_str);
-+
-+ for (i = 0; i < strlen (buffer); i++)
-+ if (buffer[i] == '-')
-+ break;
-+
-+ if (i < strlen (buffer))
-+ {
-+ char *ret;
-+
-+ ret = g_strndup (buffer, i);
-+ g_free (buffer);
-+
-+ return ret;
-+ }
-+ else
-+ return buffer;
-+ }
-+ /* else */
-+
-+ buffer = gchar_from_cf_string (cf_str);
-+ CFRelease (cf_str);
-+
-+ return buffer;
-+}
-+
- PangoCoreTextFont *
- _pango_cairo_core_text_font_new (PangoCairoCoreTextFontMap *cafontmap,
- PangoCoreTextFontKey *key)
-diff --git a/pango/pangocairo-coretextfontmap.c b/pango/pangocairo-coretextfontmap.c
-index ba5dcec..6cb3809 100644
---- a/pango/pangocairo-coretextfontmap.c
-+++ b/pango/pangocairo-coretextfontmap.c
-@@ -26,6 +26,9 @@
- #include "pangocairo.h"
- #include "pangocairo-private.h"
- #include "pangocairo-coretext.h"
-+#include "pangocairo-coretextfont.h"
-+
-+#import <AppKit/Appkit.h>
-
- typedef struct _PangoCairoCoreTextFontMapClass PangoCairoCoreTextFontMapClass;
-
-@@ -161,6 +164,106 @@ pango_cairo_core_text_font_map_context_key_equal (PangoCoreTextFontMap *fontmap
- return cairo_font_options_equal (key_a, key_b);
- }
-
-+static int
-+get_scaled_size (PangoCoreTextFontMap *fontmap,
-+ PangoContext *context,
-+ const PangoFontDescription *desc)
-+{
-+ double size = pango_font_description_get_size (desc);
-+
-+ if (!pango_font_description_get_size_is_absolute (desc))
-+ {
-+ double dpi = pango_cairo_core_text_font_map_get_resolution_core_text (fontmap, context);
-+ size = size * dpi / 72.;
-+ }
-+
-+ return .5 + pango_matrix_get_font_scale_factor (pango_context_get_matrix (context)) * size;
-+}
-+
-+static PangoCoreTextFont *
-+pango_cairo_core_text_font_map_load_font (PangoCoreTextFontMap *fontmap,
-+ PangoContext *context,
-+ const PangoFontDescription *description)
-+{
-+ char *descname = pango_font_description_get_family (description);
-+
-+ if (strcmp (descname, "-apple-system-font") == 0)
-+ {
-+ PangoCoreTextFont *cfont;
-+ NSFont *sysfont;
-+ CTFontDescriptorRef ctfontdescriptor;
-+ cairo_matrix_t font_matrix;
-+ PangoCoreTextFontsetKey fontset_key;
-+ PangoCoreTextFontKey key;
-+ PangoLanguage *language;
-+ PangoFontDescription *tmp_desc;
-+ gboolean synthetic_italic = FALSE;
-+ double abs_size = get_scaled_size (fontmap, context, description);
-+ double size = pango_units_to_double (abs_size) / pango_matrix_get_font_scale_factor (pango_context_get_matrix (context));
-+
-+ sysfont = [NSFont systemFontOfSize: size];
-+ ctfontdescriptor = (CTFontDescriptorRef)[sysfont fontDescriptor];
-+
-+ PangoCairoCoreTextFont *cafont = g_object_new (PANGO_TYPE_CAIRO_CORE_TEXT_FONT, NULL);
-+ cfont = PANGO_CORE_TEXT_FONT (cafont);
-+ cafont->abs_size = abs_size;
-+ _pango_core_text_font_set_ctfont (cfont, CFRetain (sysfont));
-+
-+ tmp_desc = pango_font_description_copy_static (description);
-+
-+ _pango_core_text_fontset_key_init (&fontset_key,
-+ fontmap,
-+ context,
-+ tmp_desc,
-+ pango_context_get_language (context));
-+ _pango_core_text_font_key_init (&key,
-+ fontmap,
-+ &fontset_key,
-+ ctfontdescriptor,
-+ synthetic_italic);
-+
-+ if (pango_core_text_font_key_get_synthetic_italic (&key))
-+ synthetic_italic = TRUE;
-+
-+ if (synthetic_italic)
-+ {
-+ cairo_matrix_init (&font_matrix,
-+ 1, 0,
-+ -0.25, 1,
-+ 0, 0);
-+ }
-+ else
-+ {
-+ cairo_matrix_init_identity (&font_matrix);
-+ }
-+
-+ cairo_matrix_scale (&font_matrix, size, size);
-+
-+ _pango_cairo_font_private_initialize (&cafont->cf_priv,
-+ (PangoCairoFont *)cafont,
-+ pango_core_text_font_key_get_gravity (&key),
-+ pango_core_text_font_key_get_context_key (&key),
-+ pango_core_text_font_key_get_matrix (&key),
-+ &font_matrix);
-+
-+ PangoCoreTextFont *tmp_font = _pango_core_text_font_map_lookup_font (fontmap, &key);
-+ if (tmp_font)
-+ {
-+ g_object_ref (tmp_font);
-+ return tmp_font;
-+ }
-+ else
-+ {
-+ g_object_ref (cfont);
-+ _pango_core_text_font_map_add (PANGO_CORE_TEXT_FONT_MAP (fontmap), &key, cfont);
-+
-+ return cfont;
-+ }
-+ }
-+
-+ return PANGO_FONT_MAP_CLASS (pango_cairo_core_text_font_map_parent_class)->load_font (fontmap, context, description);
-+}
-+
- static void
- pango_cairo_core_text_font_map_class_init (PangoCairoCoreTextFontMapClass *class)
- {
-@@ -170,6 +273,7 @@ pango_cairo_core_text_font_map_class_init (PangoCairoCoreTextFontMapClass *class
-
- object_class->finalize = pango_cairo_core_text_font_map_finalize;
-
-+ fontmap_class->load_font = pango_cairo_core_text_font_map_load_font;
- fontmap_class->get_serial = pango_cairo_core_text_font_map_get_serial;
- fontmap_class->changed = pango_cairo_core_text_font_map_changed;
-
-diff --git a/pango/pangocoretext-fontmap.c b/pango/pangocoretext-fontmap.c
-index bcbb173..4234bf1 100644
---- a/pango/pangocoretext-fontmap.c
-+++ b/pango/pangocoretext-fontmap.c
-@@ -28,6 +28,7 @@
- #include "pango-impl-utils.h"
- #include "modules.h"
-
-+#import <AppKit/Appkit.h>
- #include <Carbon/Carbon.h>
-
- typedef struct _FontHashKey FontHashKey;
-@@ -826,28 +827,12 @@ get_scaled_size (PangoCoreTextFontMap *fontmap,
- return .5 + pango_matrix_get_font_scale_factor (pango_context_get_matrix (context)) * size;
- }
-
--
--/*
-- * PangoCoreTextFontsetKey
-- */
--struct _PangoCoreTextFontsetKey
--{
-- PangoCoreTextFontMap *fontmap;
-- PangoLanguage *language;
-- PangoFontDescription *desc;
-- PangoMatrix matrix;
-- int pixelsize;
-- double resolution;
-- PangoGravity gravity;
-- gpointer context_key;
--};
--
--static void
--pango_core_text_fontset_key_init (PangoCoreTextFontsetKey *key,
-- PangoCoreTextFontMap *fontmap,
-- PangoContext *context,
-- const PangoFontDescription *desc,
-- PangoLanguage *language)
-+void
-+_pango_core_text_fontset_key_init (PangoCoreTextFontsetKey *key,
-+ PangoCoreTextFontMap *fontmap,
-+ PangoContext *context,
-+ const PangoFontDescription *desc,
-+ PangoLanguage *language)
- {
- if (!language && context)
- language = pango_context_get_language (context);
-@@ -960,27 +945,12 @@ pango_core_text_fontset_key_get_context_key (const PangoCoreTextFontsetKey *key)
- return key->context_key;
- }
-
--/*
-- * PangoCoreTextFontKey
-- */
--struct _PangoCoreTextFontKey
--{
-- PangoCoreTextFontMap *fontmap;
-- CTFontDescriptorRef ctfontdescriptor;
-- PangoMatrix matrix;
-- PangoGravity gravity;
-- int pixelsize;
-- double resolution;
-- gboolean synthetic_italic;
-- gpointer context_key;
--};
--
--static void
--pango_core_text_font_key_init (PangoCoreTextFontKey *key,
-- PangoCoreTextFontMap *ctfontmap,
-- PangoCoreTextFontsetKey *fontset_key,
-- CTFontDescriptorRef ctdescriptor,
-- gboolean synthetic_italic)
-+void
-+_pango_core_text_font_key_init (PangoCoreTextFontKey *key,
-+ PangoCoreTextFontMap *ctfontmap,
-+ PangoCoreTextFontsetKey *fontset_key,
-+ CTFontDescriptorRef ctdescriptor,
-+ gboolean synthetic_italic)
- {
- key->fontmap = ctfontmap;
- key->ctfontdescriptor = ctdescriptor;
-@@ -1104,14 +1074,24 @@ pango_core_text_font_key_get_ctfontdescriptor (const PangoCoreTextFontKey *key)
- return key->ctfontdescriptor;
- }
-
-+PangoCoreTextFont *
-+_pango_core_text_font_map_lookup_font (PangoCoreTextFontMap *fontmap,
-+ PangoCoreTextFontKey *key)
-+{
-+ return g_hash_table_lookup (fontmap->font_hash, key);
-+}
-
--
--static void
--pango_core_text_font_map_add (PangoCoreTextFontMap *ctfontmap,
-- PangoCoreTextFontKey *key,
-- PangoCoreTextFont *ctfont)
-+void
-+_pango_core_text_font_map_add (PangoCoreTextFontMap *ctfontmap,
-+ PangoCoreTextFontKey *key,
-+ PangoCoreTextFont *ctfont)
- {
- PangoCoreTextFontKey *key_copy;
-+ PangoCoreTextFont *tmp;
-+
-+ tmp = g_hash_table_lookup (ctfontmap->font_hash, key);
-+ if (tmp)
-+ return;
-
- _pango_core_text_font_set_font_map (ctfont, ctfontmap);
-
-@@ -1130,8 +1110,8 @@ pango_core_text_font_map_new_font (PangoCoreTextFontMap *fontmap,
- PangoCoreTextFont *font;
- PangoCoreTextFontKey key;
-
-- pango_core_text_font_key_init (&key, fontmap, fontset_key, ctfontdescriptor,
-- synthetic_italic);
-+ _pango_core_text_font_key_init (&key, fontmap, fontset_key, ctfontdescriptor,
-+ synthetic_italic);
-
- font = g_hash_table_lookup (fontmap->font_hash, &key);
- if (font)
-@@ -1144,7 +1124,7 @@ pango_core_text_font_map_new_font (PangoCoreTextFontMap *fontmap,
- if (!font)
- return NULL;
-
-- pango_core_text_font_map_add (fontmap, &key, font);
-+ _pango_core_text_font_map_add (fontmap, &key, font);
-
- return font;
- }
-@@ -1295,8 +1275,8 @@ pango_core_text_font_map_load_fontset (PangoFontMap *fontmap,
- PangoCoreTextFontMap *ctfontmap = PANGO_CORE_TEXT_FONT_MAP (fontmap);
- static gboolean warned_full_fallback = FALSE; /* MT-safe */
-
-- pango_core_text_fontset_key_init (&key, ctfontmap,
-- context, desc, language);
-+ _pango_core_text_fontset_key_init (&key, ctfontmap,
-+ context, desc, language);
-
- fontset = g_hash_table_lookup (ctfontmap->fontset_hash, &key);
-
-@@ -1320,8 +1300,8 @@ pango_core_text_font_map_load_fontset (PangoFontMap *fontmap,
- tmp_desc = pango_font_description_copy_static (desc);
- pango_font_description_set_family_static (tmp_desc, "Sans");
-
-- pango_core_text_fontset_key_init (&key, ctfontmap, context, tmp_desc,
-- language);
-+ _pango_core_text_fontset_key_init (&key, ctfontmap, context, tmp_desc,
-+ language);
-
- fontset = g_hash_table_lookup (ctfontmap->fontset_hash, &key);
- if (G_LIKELY (fontset))
-@@ -1450,6 +1430,53 @@ pango_core_text_font_map_init (PangoCoreTextFontMap *ctfontmap)
- CFRelease (dict);
- }
-
-+ if (true)
-+ {
-+ NSFont *sysfont = [NSFont systemFontOfSize: 0.0];
-+ NSString *name = [[NSFont fontWithName: [[sysfont fontDescriptor] postscriptName] size: 0.0] familyName];
-+
-+ NSArray *fontfaces = [[NSFontManager sharedFontManager] availableMembersOfFontFamily: name];
-+ int num_faces = [fontfaces count];
-+ CFRelease (name);
-+
-+ for (int faceindex = 0; faceindex < num_faces; faceindex++)
-+ {
-+ SInt64 font_traits;
-+ char *buffer;
-+ char *family_name;
-+ CFNumberRef number;
-+ CFDictionaryRef dict;
-+ CTFontDescriptorRef desc = [sysfont fontDescriptor];
-+
-+ buffer = ct_font_descriptor_get_family_name (desc, TRUE);
-+ if (!buffer)
-+ continue;
-+
-+ family_name = g_utf8_casefold (buffer, -1);
-+ family = g_hash_table_lookup (ctfontmap->families, family_name);
-+ if (!family)
-+ {
-+ family = g_object_new (PANGO_TYPE_CORE_TEXT_FAMILY, NULL);
-+ g_hash_table_insert (ctfontmap->families, g_strdup ("-apple-system-font"), family);
-+ family->family_name = g_strdup (buffer);
-+ }
-+
-+ g_free (buffer);
-+ g_free (family_name);
-+
-+ dict = CTFontDescriptorCopyAttribute (desc, kCTFontTraitsAttribute);
-+ number = (CFNumberRef)CFDictionaryGetValue (dict, kCTFontSymbolicTrait);
-+
-+ if (CFNumberGetValue (number, kCFNumberSInt64Type, &font_traits))
-+ {
-+ if ((font_traits & kCTFontMonoSpaceTrait) == kCTFontMonoSpaceTrait)
-+ family->is_monospace = TRUE;
-+ }
-+
-+ CFRelease (dict);
-+ }
-+ }
-+
- /* Insert aliases */
- family = g_object_new (PANGO_TYPE_CORE_TEXT_FAMILY, NULL);
- family->family_name = g_strdup ("Sans");
-diff --git a/pango/pangocoretext-private.h b/pango/pangocoretext-private.h
-index 8076eae..5c6ce41 100644
---- a/pango/pangocoretext-private.h
-+++ b/pango/pangocoretext-private.h
-@@ -81,6 +81,30 @@ struct _PangoCoreTextFontMapClass
- PangoContext *context);
- };
-
-+struct _PangoCoreTextFontKey
-+{
-+ PangoCoreTextFontMap *fontmap;
-+ CTFontDescriptorRef ctfontdescriptor;
-+ PangoMatrix matrix;
-+ PangoGravity gravity;
-+ int pixelsize;
-+ double resolution;
-+ gboolean synthetic_italic;
-+ gpointer context_key;
-+};
-+
-+struct _PangoCoreTextFontsetKey
-+{
-+ PangoCoreTextFontMap *fontmap;
-+ PangoLanguage *language;
-+ PangoFontDescription *desc;
-+ PangoMatrix matrix;
-+ int pixelsize;
-+ double resolution;
-+ PangoGravity gravity;
-+ gpointer context_key;
-+};
-+
-
- GType pango_core_text_font_map_get_type (void) G_GNUC_CONST;
-
-@@ -97,6 +121,24 @@ void _pango_core_text_font_set_font_key (PangoCoreTextF
- void _pango_core_text_font_set_ctfont (PangoCoreTextFont *font,
- CTFontRef font_ref);
-
-+void _pango_core_text_fontset_key_init (PangoCoreTextFontsetKey *key,
-+ PangoCoreTextFontMap *fontmap,
-+ PangoContext *context,
-+ const PangoFontDescription *desc,
-+ PangoLanguage *language);
-+void _pango_core_text_font_key_init (PangoCoreTextFontKey *key,
-+ PangoCoreTextFontMap *ctfontmap,
-+ PangoCoreTextFontsetKey *fontset_key,
-+ CTFontDescriptorRef ctdescriptor,
-+ gboolean synthetic_italic);
-+
-+void _pango_core_text_font_map_add (PangoCoreTextFontMap *ctfontmap,
-+ PangoCoreTextFontKey *key,
-+ PangoCoreTextFont *ctfont);
-+
-+PangoCoreTextFont *_pango_core_text_font_map_lookup_font (PangoCoreTextFontMap *fontmap,
-+ PangoCoreTextFontKey *key);
-+
- PangoFontDescription *_pango_core_text_font_description_from_ct_font_descriptor (CTFontDescriptorRef desc);
-
- int pango_core_text_font_key_get_absolute_size (const PangoCoreTextFontKey *key);
+++ /dev/null
-diff --git a/libs/tiff-4.0.2/tools/tiffgt.c b/libs/tiff-4.0.2/tools/tiffgt.c
-index de42039..4c8e509 100644
---- a/tools/tiffgt.c
-+++ b/tools/tiffgt.c
-@@ -31,11 +31,16 @@
- #include <string.h>
- #include <unistd.h>
-
--#if HAVE_APPLE_OPENGL_FRAMEWORK
-+#if HAVE_OPENGL_GL_H
- # include <OpenGL/gl.h>
-+#endif
-+#if HAVE_GLUT_GLUT_H
- # include <GLUT/glut.h>
--#else
-+#endif
-+#if HAVE_GL_GL_H
- # include <GL/gl.h>
-+#endif
-+#if HAVE_GL_GLUT_H
- # include <GL/glut.h>
- #endif
+++ /dev/null
-import glob
-import os
-import shutil
-
-
-class PCLReferenceAssembliesPackage(Package):
-
- def __init__(self):
- Package.__init__(self,
- name='PortableReferenceAssemblies',
- version='2014-04-14',
- sources=['http://storage.bos.xamarin.com/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()
+++ /dev/null
-class PixmanPackage (CairoGraphicsPackage):
-
- def __init__(self):
- CairoGraphicsPackage.__init__(self, 'pixman', '0.30.0')
-
-PixmanPackage()
+++ /dev/null
-package = FreeDesktopPackage('%{name}', 'pkg-config', '0.27',
- configure_flags=["--with-internal-glib"])
-
-package.needs_lipo = True
+++ /dev/null
-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):
-
- 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"
-
- self.self_dir = os.path.realpath(os.path.dirname(sys.argv[0]))
- self.packaging_dir = os.path.join(self.self_dir, "packaging")
-
- 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
- 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' % self.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"' %
- (self.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.self_dir, 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(self.package_root, "lib", "mono", "gac")
- confs = [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(self.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
+++ /dev/null
-Package('sqlite-autoconf', '3090200', sources=[
- 'http://www.sqlite.org/2015/%{name}-%{version}.tar.gz'
-])
+++ /dev/null
-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()
+++ /dev/null
-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()
-Subproject commit 8b7481ea2e0d95ba6f7d6e15b9fbcc53888beca2
+Subproject commit b5c030d45898d3420f4a74eb0c3d04b9343a1a04