Skip to content

Commit

Permalink
[cairo] fixes cross compilation problems (microsoft#17846)
Browse files Browse the repository at this point in the history
  • Loading branch information
abique authored May 13, 2021
1 parent 5568f11 commit d850857
Show file tree
Hide file tree
Showing 5 changed files with 130 additions and 10 deletions.
112 changes: 112 additions & 0 deletions ports/cairo/0001-meson-fix-macOS-build-and-add-macOS-ci.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
From d8d16562ec094593eba4446432e918704590ab20 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tim-Philipp=20M=C3=BCller?= <[email protected]>
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

19 changes: 10 additions & 9 deletions ports/cairo/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ vcpkg_from_gitlab(
REF 156cd3eaaebfd8635517c2baf61fcf3627ff7ec2 #v1.17.4
SHA512 2c516ad3ffe56cf646b2435d6ef3cf25e8c05aeb13d95dd18a7d0510d134d9990cba1b376063352ff99483cfc4e5d2af849afd2f9538f9136f22d44d34be362c
HEAD_REF master
PATCHES 0001-meson-fix-macOS-build-and-add-macOS-ci.patch
)

if("fontconfig" IN_LIST FEATURES)
Expand Down Expand Up @@ -49,12 +50,12 @@ endif()
vcpkg_configure_meson(
SOURCE_PATH ${SOURCE_PATH}
OPTIONS ${OPTIONS}
-Dtests=disabled
-Dzlib=enabled
-Dpng=enabled
-Dspectre=auto
-Dsymbol-lookup=disabled
-Dgtk2-utils=disabled
-Dtests=disabled
-Dzlib=enabled
-Dpng=enabled
-Dspectre=auto
-Dsymbol-lookup=disabled
-Dgtk2-utils=disabled
)
vcpkg_install_meson()

Expand All @@ -75,13 +76,13 @@ file(INSTALL "${SOURCE_PATH}/COPYING" DESTINATION "${CURRENT_PACKAGES_DIR}/share
vcpkg_copy_pdbs()
vcpkg_fixup_pkgconfig()

#TODO: Fix script
#TODO: Fix script
#set(TOOLS)
#if(EXISTS "${CURRENT_PACKAGES_DIR}/bin/cairo-trace${VCPKG_TARGET_EXECUTABLE_SUFFIX}")
# list(APPEND TOOLS cairo-trace) # sh script which needs to be fixed due to absolute paths in it.
# list(APPEND TOOLS cairo-trace) # sh script which needs to be fixed due to absolute paths in it.
#endif()
#vcpkg_copy_tools(TOOL_NAMES ${TOOLS} AUTO_CLEAN)

if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/bin" "${CURRENT_PACKAGES_DIR}/debug/bin")
endif()
endif()
2 changes: 2 additions & 0 deletions ports/cairo/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
{
"name": "cairo",
"version": "1.17.4",
"port-version": 1,
"description": "Cairo is a 2D graphics library with support for multiple output devices. Currently supported output targets include the X Window System (via both Xlib and XCB), Quartz, Win32, image buffers, PostScript, PDF, and SVG file output. Experimental backends include OpenGL, BeOS, OS/2, and DirectFB.",
"homepage": "https://cairographics.org",
"dependencies": [
"dirent",
"expat",
"libpng",
"lzo",
"pixman",
Expand Down
2 changes: 1 addition & 1 deletion versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -1086,7 +1086,7 @@
},
"cairo": {
"baseline": "1.17.4",
"port-version": 0
"port-version": 1
},
"cairomm": {
"baseline": "1.16.0",
Expand Down
5 changes: 5 additions & 0 deletions versions/c-/cairo.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "a2fa5a9972a7b796f56fdda01f644b5c40d93580",
"version": "1.17.4",
"port-version": 1
},
{
"git-tree": "c80532bb0f4abd6b3bba09e48ddab1724bdc0ec1",
"version": "1.17.4",
Expand Down

0 comments on commit d850857

Please sign in to comment.