aboutsummaryrefslogtreecommitdiff
path: root/ports/cairo/0001-meson-fix-macOS-build-and-add-macOS-ci.patch
blob: 5bc6ca8855267a1478f426a5380c4a0c98bc6b4a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
From d8d16562ec094593eba4446432e918704590ab20 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tim-Philipp=20M=C3=BCller?= <tim@centricular.com>
Date: Sat, 26 Sep 2020 19:25:21 +0100
Subject: [PATCH] meson: fix macOS build and add macOS ci

Fixes #441
---
 .gitlab-ci.yml    | 26 ++++++++++++++++++++
 meson.build       | 61 ++++++++++++++++++++++-------------------------
 meson_options.txt |  1 +
 3 files changed, 56 insertions(+), 32 deletions(-)

diff --git a/meson.build b/meson.build
index 53a9af343..fe7757b1f 100644
--- a/meson.build
+++ b/meson.build
@@ -371,37 +371,34 @@ if qtgui_dep.found() and false
   deps += [qtgui_dep]
 endif
 
-# Untested
-if cc.has_header('ApplicationServices/ApplicationServices.h')
-  if cc.has_header('CoreGraphics/CoreGraphics.h')
-    quartz_extra_libs = ['-Xlinker', '-framework', '-Xlinker', 'CoreGraphics']
-  else
-    quartz_extra_libs = ['-Xlinker', '-framework', '-Xlinker', 'ApplicationServices']
+if host_machine.system() == 'darwin' and not get_option('quartz').disabled()
+  quartz_deps = dependency('appleframeworks', modules : ['CoreFoundation', 'ApplicationServices'], required: get_option('quartz'))
+
+  if quartz_deps.found()
+    deps += [quartz_deps]
+
+    feature_conf.set('CAIRO_HAS_QUARTZ_SURFACE', 1)
+    feature_conf.set('CAIRO_HAS_QUARTZ_FONT', 1)
+    feature_conf.set('CAIRO_HAS_QUARTZ_IMAGE_SURFACE', 1)
+
+    built_features += [
+      {
+        'name': 'cairo-quartz',
+        'description': 'Quartz surface backend',
+        'deps': quartz_deps,
+      },
+      {
+        'name': 'cairo-quartz-image',
+        'description': 'Quartz Image surface backend',
+        'deps': quartz_deps,
+      },
+      {
+        'name': 'cairo-quartz-font',
+        'description': 'Quartz font backend',
+        'deps': quartz_deps,
+      },
+    ]
   endif
-
-  extra_link_args += quartz_extra_libs
-
-  feature_conf.set('CAIRO_HAS_QUARTZ_SURFACE', 1)
-  feature_conf.set('CAIRO_HAS_QUARTZ_FONT', 1)
-  feature_conf.set('CAIRO_HAS_QUARTZ_IMAGE_SURFACE', 1)
-
-  built_features += [
-    {
-      'name': 'cairo-quartz',
-      'description': 'Quartz surface backend',
-      'libs': quartz_extra_libs,
-    },
-    {
-      'name': 'cairo-quartz-image',
-      'description': 'Quartz Image surface backend',
-      'libs': quartz_extra_libs,
-    },
-    {
-      'name': 'cairo-quartz-font',
-      'description': 'Quartz font backend',
-      'libs': quartz_extra_libs,
-    },
-  ]
 endif
 
 if host_machine.system() == 'windows'
@@ -887,13 +884,13 @@ foreach feature: built_features
   feature_deps = feature.get('deps', [])
   feature_libs = feature.get('libs', [])
   feature_compile_deps = feature.get('compile-deps', [])
-  pkgmod.generate(libraries: [libcairo] + feature_deps + feature_libs,
+  pkgmod.generate(libraries: [libcairo, feature_deps, feature_libs],
     name: feature['name'],
     description: feature['description'] + ' for cairo graphics library',
   )
   meson.override_dependency(feature['name'],
     declare_dependency(link_with: libcairo,
-      dependencies: feature_deps + feature_compile_deps,
+      dependencies: [feature_deps, feature_compile_deps],
       link_args: feature_libs,
     )
   )
diff --git a/meson_options.txt b/meson_options.txt
index ff11fe7ed..5cafe8bda 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -13,6 +13,7 @@ option('glesv3', type : 'feature', value : 'disabled')
 option('drm', type : 'feature', value : 'disabled')
 option('openvg', type : 'feature', value : 'disabled')
 option('png', type : 'feature', value : 'auto') # png and svg surfaces
+option('quartz', type : 'feature', value : 'auto')
 option('qt', type : 'feature', value : 'disabled')
 option('tee', type : 'feature', value : 'disabled')
 option('xcb', type : 'feature', value : 'auto')
-- 
2.29.2