#2 Switch to meson
Merged 2 years ago by amigadave. Opened 2 years ago by amigadave.
rpms/ amigadave/cairo meson  into  rawhide

@@ -0,0 +1,233 @@ 

+ From 1c1bce40949492a6772470385aa76151500a4dac Mon Sep 17 00:00:00 2001

+ From: Emmanuele Bassi <ebassi@gnome.org>

+ Date: Tue, 27 Apr 2021 12:08:52 +0100

+ Subject: [PATCH] meson: Build the API reference

+ 

+ The Meson build system should build the API reference using gtk-doc,

+ like the Autotools build does.

+ 

+ The option is called `gtk_doc`, which matches the existing practices in

+ various projects using Meson and gtk-doc.

+ ---

+  doc/public/meson.build    | 157 ++++++++++++++++++++++++++++++++++++++

+  doc/public/version.xml.in |   1 +

+  meson.build               |   9 +++

+  meson_options.txt         |   4 +

+  4 files changed, 171 insertions(+)

+  create mode 100644 doc/public/meson.build

+  create mode 100644 doc/public/version.xml.in

+ 

+ diff --git a/doc/public/meson.build b/doc/public/meson.build

+ new file mode 100644

+ index 000000000..2c27105b4

+ --- /dev/null

+ +++ b/doc/public/meson.build

+ @@ -0,0 +1,157 @@

+ +gnome = import('gnome')

+ +

+ +ignore_headers = [

+ +  # Sub-directories

+ +  'drm',

+ +  'win32',

+ +

+ +  # Internal headers

+ +  'cairoint.h',

+ +  'cairo-features.h',

+ +  'cairo-features-win32.h',

+ +

+ +  # Inlined API

+ +  'cairo-box-inline.h',

+ +  'cairo-clip-inline.h',

+ +  'cairo-combsort-inline.h',

+ +  'cairo-contour-inline.h',

+ +  'cairo-error-inline.h',

+ +  'cairo-image-surface-inline.h',

+ +  'cairo-line-inline.h',

+ +  'cairo-list-inline.h',

+ +  'cairo-pattern-inline.h',

+ +  'cairo-recording-surface-inline.h',

+ +  'cairo-surface-inline.h',

+ +  'cairo-surface-observer-inline.h',

+ +  'cairo-surface-snapshot-inline.h',

+ +  'cairo-surface-subsurface-inline.h',

+ +

+ +  # Private headers

+ +  'cairo-analysis-surface-private.h',

+ +  'cairo-arc-private.h',

+ +  'cairo-array-private.h',

+ +  'cairo-atomic-private.h',

+ +  'cairo-backend-private.h',

+ +  'cairo-boxes-private.h',

+ +  'cairo-cache-private.h',

+ +  'cairo-clip-private.h',

+ +  'cairo-compiler-private.h',

+ +  'cairo-composite-rectangles-private.h',

+ +  'cairo-compositor-private.h',

+ +  'cairo-contour-private.h',

+ +  'cairo-damage-private.h',

+ +  'cairo-default-context-private.h',

+ +  'cairo-deprecated.h',

+ +  'cairo-device-private.h',

+ +  'cairo-error-private.h',

+ +  'cairo-fixed-private.h',

+ +  'cairo-fixed-type-private.h',

+ +  'cairo-fontconfig-private.h',

+ +  'cairo-freed-pool-private.h',

+ +  'cairo-freelist-private.h',

+ +  'cairo-freelist-type-private.h',

+ +  'cairo-ft-private.h',

+ +  'cairo-gstate-private.h',

+ +  'cairo-hash-private.h',

+ +  'cairo-image-info-private.h',

+ +  'cairo-image-surface-private.h',

+ +  'cairo-line-private.h',

+ +  'cairo-list-private.h',

+ +  'cairo-malloc-private.h',

+ +  'cairo-mempool-private.h',

+ +  'cairo-mutex-impl-private.h',

+ +  'cairo-mutex-list-private.h',

+ +  'cairo-mutex-private.h',

+ +  'cairo-mutex-type-private.h',

+ +  'cairo-output-stream-private.h',

+ +  'cairo-paginated-private.h',

+ +  'cairo-paginated-surface-private.h',

+ +  'cairo-path-fixed-private.h',

+ +  'cairo-path-private.h',

+ +  'cairo-pattern-private.h',

+ +  'cairo-pdf-operators-private.h',

+ +  'cairo-pdf-shading-private.h',

+ +  'cairo-pdf-surface-private.h',

+ +  'cairo-pixman-private.h',

+ +  'cairo-private.h',

+ +  'cairo-ps-surface-private.h',

+ +  'cairo-quartz-private.h',

+ +  'cairo-recording-surface-private.h',

+ +  'cairo-reference-count-private.h',

+ +  'cairo-region-private.h',

+ +  'cairo-rtree-private.h',

+ +  'cairo-scaled-font-private.h',

+ +  'cairo-scaled-font-subsets-private.h',

+ +  'cairo-script-private.h',

+ +  'cairo-slope-private.h',

+ +  'cairo-spans-compositor-private.h',

+ +  'cairo-spans-private.h',

+ +  'cairo-stroke-dash-private.h',

+ +  'cairo-surface-backend-private.h',

+ +  'cairo-surface-clipper-private.h',

+ +  'cairo-surface-fallback-private.h',

+ +  'cairo-surface-observer-private.h',

+ +  'cairo-surface-offset-private.h',

+ +  'cairo-surface-private.h',

+ +  'cairo-surface-snapshot-private.h',

+ +  'cairo-surface-subsurface-private.h',

+ +  'cairo-surface-wrapper-private.h',

+ +  'cairo-svg-surface-private.h',

+ +  'cairo-tag-attributes-private.h',

+ +  'cairo-tag-stack-private.h',

+ +  'cairo-tee-surface-private.h',

+ +  'cairo-time-private.h',

+ +  'cairo-traps-private.h',

+ +  'cairo-tristrip-private.h',

+ +  'cairo-truetype-subset-private.h',

+ +  'cairo-type1-private.h',

+ +  'cairo-type3-glyph-surface-private.h',

+ +  'cairo-types-private.h',

+ +  'cairo-user-font-private.h',

+ +  'cairo-wideint-private.h',

+ +  'cairo-wideint-type-private.h',

+ +  'cairo-xcb-private.h',

+ +  'cairo-xlib-private.h',

+ +  'cairo-xlib-surface-private.h',

+ +  'cairo-xlib-xrender-private.h',

+ +  'test-compositor-surface-private.h',

+ +]

+ +

+ +ignore_decorators = [

+ +  'cairo_public',

+ +  'cairo_private',

+ +]

+ +

+ +docpath = get_option('prefix') / get_option('datadir') / 'gtk-doc/html'

+ +version_conf = configuration_data()

+ +version_conf.set('CAIRO_VERSION', meson.project_version())

+ +configure_file(

+ +  input: 'version.xml.in',

+ +  output: 'version.xml',

+ +  configuration: version_conf

+ +)

+ +

+ +gnome.gtkdoc('cairo',

+ +  main_xml: 'cairo-docs.xml',

+ +  namespace: 'cairo',

+ +  mode: 'sgml',

+ +  src_dir: doc_srcdir,

+ +  dependencies: libcairo_dep,

+ +  scan_args: [

+ +    '--ignore-decorators=' + '|'.join(ignore_decorators),

+ +    '--ignore-headers=' + ' '.join(ignore_headers),

+ +  ],

+ +  content_files: [

+ +    'language-bindings.xml',

+ +  ],

+ +  expand_content_files: [

+ +    'language-bindings.xml',

+ +  ],

+ +  html_assets: [

+ +  ],

+ +  fixxref_args: [

+ +    '--html-dir=' + docpath,

+ +  ],

+ +  install: true,

+ +  check: true,

+ +)

+ diff --git a/doc/public/version.xml.in b/doc/public/version.xml.in

+ new file mode 100644

+ index 000000000..6bd185791

+ --- /dev/null

+ +++ b/doc/public/version.xml.in

+ @@ -0,0 +1 @@

+ +@CAIRO_VERSION@

+ diff --git a/meson.build b/meson.build

+ index b159b4071..8098261ff 100644

+ --- a/meson.build

+ +++ b/meson.build

+ @@ -862,6 +862,14 @@ if not get_option('tests').disabled() and feature_conf.get('CAIRO_HAS_PNG_FUNCTI

+    subdir('test')

+  endif

+  

+ +if get_option('gtk_doc')

+ +  if not meson.version().version_compare('>=0.52.0')

+ +    error('Building documentation requires Meson >= 0.52.0.')

+ +  endif

+ +  doc_srcdir = include_directories('src')

+ +  subdir('doc/public')

+ +endif

+ +

+  configure_file(output: 'config.h', configuration: conf)

+  

+  foreach feature: built_features

+ @@ -931,5 +939,6 @@ if meson.version().version_compare('>= 0.53')

+    summary({

+            'cairo-trace:': conf.get('CAIRO_HAS_TRACE', 0) == 1,

+            'cairo-script-interpreter': feature_conf.get('CAIRO_HAS_INTERPRETER', 0) == 1,

+ +          'API reference': get_option('gtk_doc'),

+            }, section: 'Features and Utilities', bool_yn: true)

+  endif

+ diff --git a/meson_options.txt b/meson_options.txt

+ index ff11fe7ed..30f6e1df8 100644

+ --- a/meson_options.txt

+ +++ b/meson_options.txt

+ @@ -30,6 +30,10 @@ option('gtk2-utils', type : 'feature', value : 'disabled')

+  option('glib', type : 'feature', value : 'auto')

+  option('spectre', type : 'feature', value : 'auto')

+  

+ +# Documentation

+ +option('gtk_doc', type : 'boolean', value : false,

+ +       description: 'Build the Cairo API reference (depends on gtk-doc)')

+ +

+  # FIXME: implement these to avoid automagic

+  #option('egl', type : 'feature', value : 'auto')

+  #option('glx', type : 'feature', value : 'auto')

+ -- 

+ 2.34.1

+ 

@@ -0,0 +1,42 @@ 

+ From 3468c67fe91f0c37e0ec5d335082653a6fa609b6 Mon Sep 17 00:00:00 2001

+ From: "Jan Alexander Steffens (heftig)" <jan.steffens@gmail.com>

+ Date: Thu, 25 Feb 2021 01:27:10 +0000

+ Subject: [PATCH] meson: add xlib-xcb option and disable by default

+ 

+ Just like autotools does.

+ 

+ Closes #438.

+ ---

+  meson.build       | 3 +--

+  meson_options.txt | 1 +

+  2 files changed, 2 insertions(+), 2 deletions(-)

+ 

+ diff --git a/meson.build b/meson.build

+ index 96dd1abd4..b1759b5f3 100644

+ --- a/meson.build

+ +++ b/meson.build

+ @@ -331,8 +331,7 @@ if xcb_dep.found() and xcb_render_dep.found()

+  endif

+  

+  if feature_conf.get('CAIRO_HAS_XCB_SURFACE', 0) == 1 and feature_conf.get('CAIRO_HAS_XLIB_SURFACE', 0) == 1

+ -  # FIXME: automagic

+ -  x11xcb_dep = dependency('x11-xcb', required: false)

+ +  x11xcb_dep = dependency('x11-xcb', required: get_option('xlib-xcb'))

+    if x11xcb_dep.found()

+      deps += [x11xcb_dep]

+      feature_conf.set('CAIRO_HAS_XLIB_XCB_FUNCTIONS', 1)

+ diff --git a/meson_options.txt b/meson_options.txt

+ index 2b4b46f7b..7ec0dc92a 100644

+ --- a/meson_options.txt

+ +++ b/meson_options.txt

+ @@ -18,6 +18,7 @@ option('qt', type : 'feature', value : 'disabled')

+  option('tee', type : 'feature', value : 'disabled')

+  option('xcb', type : 'feature', value : 'auto')

+  option('xlib', type : 'feature', value : 'auto')

+ +option('xlib-xcb', type : 'feature', value : 'disabled')

+  #option('xml', type : 'feature', value : 'disabled')

+  option('zlib', type : 'feature', value : 'auto') # script, ps, pdf, xml surfaces

+  

+ -- 

+ GitLab

+ 

@@ -0,0 +1,41 @@ 

+ From b5f8d00a20e8f2876e23dc5627df3502eb8e0f90 Mon Sep 17 00:00:00 2001

+ From: David King <amigadave@amigadave.com>

+ Date: Tue, 15 Feb 2022 13:31:48 +0000

+ Subject: [PATCH] meson: Add xml option and disable by default

+ 

+ Just like autotools does.

+ ---

+  meson.build       | 3 +--

+  meson_options.txt | 2 +-

+  2 files changed, 2 insertions(+), 3 deletions(-)

+ 

+ diff --git a/meson.build b/meson.build

+ index 109020bdb..4c642ede6 100644

+ --- a/meson.build

+ +++ b/meson.build

+ @@ -646,8 +646,7 @@ if zlib_dep.found()

+    feature_conf.set('CAIRO_HAS_INTERPRETER', 1)

+  endif

+  

+ -# TODO: add xml option and disable by default

+ -if zlib_dep.found() and png_dep.found()

+ +if zlib_dep.found() and png_dep.found() and get_option('xml').enabled()

+    feature_conf.set('CAIRO_HAS_XML_SURFACE', 1)

+    built_features += [{

+      'name': 'cairo-xml',

+ diff --git a/meson_options.txt b/meson_options.txt

+ index f7361a9df..0ccbdc1ca 100644

+ --- a/meson_options.txt

+ +++ b/meson_options.txt

+ @@ -18,7 +18,7 @@ option('tee', type : 'feature', value : 'disabled')

+  option('xcb', type : 'feature', value : 'auto')

+  option('xlib', type : 'feature', value : 'auto')

+  option('xlib-xcb', type : 'feature', value : 'disabled')

+ -#option('xml', type : 'feature', value : 'disabled')

+ +option('xml', type : 'feature', value : 'disabled')

+  option('zlib', type : 'feature', value : 'auto') # script, ps, pdf, xml surfaces

+  

+  # Tests

+ -- 

+ 2.34.1

+ 

file modified
+51 -59
@@ -1,48 +1,43 @@ 

- %define pixman_version 0.30.0

- %define freetype_version 2.1.9

+ %define pixman_version 0.36.0

+ %define freetype_version 9.7.3

  %define fontconfig_version 2.2.95

  

- %if 0%{?fedora} > 26 || 0%{?rhel} > 7

- %global cairogl --disable-gl

- %else

- %global cairogl --enable-gl

- %global with_gl 1

- %endif

+ Name:    cairo

+ Version: 1.17.4

+ Release: 6%{?dist}

+ Summary: A 2D graphics library

  

- Name:		cairo

- Version:	1.17.4

- Release:	5%{?dist}

- Summary:	A 2D graphics library

- 

- License:	LGPLv2 or MPLv1.1

- URL:		http://cairographics.org

- Source0:	http://cairographics.org/snapshots/%{name}-%{version}.tar.xz

- 

- Patch3:         cairo-multilib.patch

+ License: LGPLv2 or MPLv1.1

+ URL:     https://cairographics.org

+ Source0: https://cairographics.org/snapshots/%{name}-%{version}.tar.xz

  

+ Patch0: cairo-multilib.patch

  # https://gitlab.freedesktop.org/cairo/cairo/merge_requests/1

- Patch4:         0001-Set-default-LCD-filter-to-FreeType-s-default.patch

- 

+ Patch1: 0001-Set-default-LCD-filter-to-FreeType-s-default.patch

  # Fix generating PDF font names

  # https://gitlab.freedesktop.org/cairo/cairo/-/merge_requests/125

- Patch5:         125.patch

- 

- BuildRequires:  gcc

- BuildRequires: pkgconfig

- BuildRequires: libXrender-devel

- BuildRequires: libX11-devel

- BuildRequires: libpng-devel

- BuildRequires: libxml2-devel

- BuildRequires: pixman-devel >= %{pixman_version}

- BuildRequires: freetype-devel >= %{freetype_version}

- BuildRequires: fontconfig-devel >= %{fontconfig_version}

- BuildRequires: glib2-devel

- BuildRequires: librsvg2-devel

- %if 0%{?with_gl}

- BuildRequires: mesa-libGL-devel

- BuildRequires: mesa-libEGL-devel

- %endif

- BuildRequires: make

+ Patch2: 125.patch

+ # https://gitlab.freedesktop.org/cairo/cairo/-/merge_requests/168

+ Patch3: cairo-1.17.4-meson-gtkdoc.patch

+ # https://gitlab.freedesktop.org/cairo/cairo/-/merge_requests/132

+ Patch4: cairo-1.17.4-meson-xcb.patch

+ # https://gitlab.freedesktop.org/cairo/cairo/-/merge_requests/275

+ Patch5: cairo-1.17.4-meson-xml.patch

+ 

+ BuildRequires: gcc

+ BuildRequires: gcc-c++

+ BuildRequires: gtk-doc

+ BuildRequires: meson

+ BuildRequires: pkgconfig(expat)

+ BuildRequires: pkgconfig(pixman-1) >= %{pixman_version}

+ BuildRequires: pkgconfig(freetype2) >= %{freetype_version}

+ BuildRequires: pkgconfig(fontconfig) >= %{fontconfig_version}

+ BuildRequires: pkgconfig(gobject-2.0)

+ BuildRequires: pkgconfig(libpng)

+ BuildRequires: pkgconfig(librsvg-2.0)

+ BuildRequires: pkgconfig(xext)

+ BuildRequires: pkgconfig(xcb-render)

+ BuildRequires: pkgconfig(xrender)

  

  %description

  Cairo is a 2D graphics library designed to provide high-quality display
@@ -100,23 +95,21 @@ 

  %autosetup -p1

  

  %build

- %configure --disable-static	\

- 	--enable-xlib		\

- 	--enable-ft		\

- 	--enable-ps		\

- 	--enable-pdf		\

- 	--enable-svg		\

- 	--enable-tee		\

- 	--enable-gobject	\

- 	%{cairogl}		\

- 	--disable-gtk-doc

- sed -i 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' libtool

- sed -i 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' libtool

- make V=1 %{?_smp_mflags}

+ %meson \

+   -Dfreetype=enabled \

+   -Dfontconfig=enabled \

+   -Dglib=enabled \

+   -Dgtk_doc=true \

+   -Dspectre=disabled \

+   -Dtee=enabled \

+   -Dtests=disabled \

+   -Dxcb=enabled \

+   -Dxlib=enabled \

+   -Dxml=disabled

+ %meson_build

  

  %install

- %make_install

- find $RPM_BUILD_ROOT -name '*.la' -delete

+ %meson_install

  

  %files

  %license COPYING COPYING-LGPL-2.1 COPYING-MPL-1.1
@@ -157,12 +150,6 @@ 

  %{_libdir}/pkgconfig/cairo-xcb-shm.pc

  %{_libdir}/pkgconfig/cairo-xcb.pc

  %{_datadir}/gtk-doc/html/cairo

- %if 0%{?with_gl}

- %{_includedir}/cairo/cairo-gl.h

- %{_libdir}/pkgconfig/cairo-egl.pc

- %{_libdir}/pkgconfig/cairo-gl.pc

- %{_libdir}/pkgconfig/cairo-glx.pc

- %endif

  

  %files gobject

  %{_libdir}/libcairo-gobject.so.2*
@@ -173,10 +160,15 @@ 

  %{_libdir}/pkgconfig/cairo-gobject.pc

  

  %files tools

+ %{_bindir}/cairo-sphinx

  %{_bindir}/cairo-trace

  %{_libdir}/cairo/

  

  %changelog

+ * Tue Feb 15 2022 David King <amigadave@amigadave.com> - 1.17.4-6

+ - Switch to meson

+ - Use pkgconfig for BuildRequires

+ 

  * Wed Jan 19 2022 Fedora Release Engineering <releng@fedoraproject.org> - 1.17.4-5

  - Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild

  

Additionally, use pkgconfig for BuildRequires.

Pull-Request has been merged by amigadave

2 years ago