[pango/wip/meson: 2/2] build: Add Meson build system



commit f4fc076485864b6e2a1371615fd995d9908d3b91
Author: Emmanuele Bassi <ebassi gnome org>
Date:   Tue May 16 12:08:25 2017 +0100

    build: Add Meson build system
    
    Meson is a meta build system that is:
    
      - fast
      - simpler to understand and use
      - portable to multiple platforms through different backends
      - well integrated with the GNOME platform
      - well maintained
    
    Using Meson allows us to build Pango much more quickly, and on all the
    platforms we currently target, without any loss of functionality,
    compared to Autotools.

 examples/meson.build           |   22 +++
 meson.build                    |  304 ++++++++++++++++++++++++++++++++
 pango-view/meson.build         |   40 +++++
 pango/meson.build              |  372 ++++++++++++++++++++++++++++++++++++++++
 pango/mini-fribidi/meson.build |   19 ++
 pango/pango-features.h.meson   |   10 +
 tests/meson.build              |   54 ++++++
 7 files changed, 821 insertions(+), 0 deletions(-)
---
diff --git a/examples/meson.build b/examples/meson.build
new file mode 100644
index 0000000..ebcec9b
--- /dev/null
+++ b/examples/meson.build
@@ -0,0 +1,22 @@
+examples = []
+
+if pango_cairo_backends.contains('png')
+  examples += [
+    'cairoshape',
+    'cairosimple',
+    'cairotwisted',
+  ]
+endif
+
+examples_deps = [ libpango_dep, libpangocairo_dep, ]
+
+if pango_font_backends.contains('freetype')
+  examples_deps += libpangoft2_dep
+endif
+
+foreach e: examples
+  executable(e, '@0@.c'.format(e),
+             dependencies: examples_deps + pango_deps,
+             include_directories: root_inc,
+             install: false)
+endforeach
diff --git a/meson.build b/meson.build
new file mode 100644
index 0000000..80b9950
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,304 @@
+project('pango', 'c', version: '1.40.5',
+        license: 'LGPLv2.1+',
+        default_options: [
+          'buildtype=debugoptimized',
+          'warning_level=1',
+          'c_std=c99',
+        ],
+        meson_version : '>= 0.40.0')
+
+add_project_arguments([ '-D_POSIX_C_SOURCE', '-D_POSIX_THREAD_SAFE_FUNCTIONS', '-D_GNU_SOURCE', ], language: 
'c')
+
+pango_prefix = get_option('prefix')
+pango_libdir = join_paths(pango_prefix, get_option('libdir'))
+pango_sysconfdir = join_paths(pango_prefix, get_option('sysconfdir'))
+pango_includedir = join_paths(pango_prefix, get_option('includedir'))
+
+version = meson.project_version().split('.')
+pango_major_version = version[0].to_int()
+pango_minor_version = version[1].to_int()
+pango_micro_version = version[2].to_int()
+
+pango_interface_age = pango_minor_version.is_odd() ? 0 : pango_micro_version
+pango_binary_age = pango_minor_version * 100 + pango_minor_version
+
+pango_api_version = '@0@.0'.format(pango_major_version)
+pango_api_path = 'pango-@0@/pango'.format(pango_api_version)
+
+pango_conf = configuration_data()
+
+pango_conf.set('PANGO_BINARY_AGE', pango_binary_age)
+pango_conf.set('PANGO_INTERFACE_AGE', pango_interface_age)
+pango_conf.set('PANGO_VERSION_MAJOR', pango_major_version)
+pango_conf.set('PANGO_VERSION_MINOR', pango_minor_version)
+pango_conf.set('PANGO_VERSION_MICRO', pango_micro_version)
+
+# Maintain version scheme with libtool
+pango_soversion = '0.@0@.@1@'.format((pango_binary_age - pango_interface_age), pango_interface_age)
+
+cc = meson.get_compiler('c')
+host_system = host_machine.system()
+
+# Compiler and linker flags
+common_cflags = []
+common_ldflags = []
+
+# Add more compiler warnings to the default set
+if cc.get_id() == 'msvc'
+  # Compiler options taken from msvc_recommended_pragmas.h
+  # in GLib, based on _Win32_Programming_ by Rector and Newcomer
+  test_cflags = [
+    '-we4002', # too many actual parameters for macro
+    '-we4003', # not enough actual parameters for macro
+    '-w14010', # single-line comment contains line-continuation character
+    '-we4013', # 'function' undefined; assuming extern returning int
+    '-w14016', # no function return type; using int as default
+    '-we4020', # too many actual parameters
+    '-we4021', # too few actual parameters
+    '-we4027', # function declared without formal parameter list
+    '-we4029', # declared formal parameter list different from definition
+    '-we4033', # 'function' must return a value
+    '-we4035', # 'function' : no return value
+    '-we4045', # array bounds overflow
+    '-we4047', # different levels of indirection
+    '-we4049', # terminating line number emission
+    '-we4053', # an expression of type void was used as an operand
+    '-we4071', # no function prototype given
+    '-we4819', # the file contains a character that cannot be represented in the current code page
+  ]
+elif cc.get_id() == 'gcc' or cc.get_id() == 'clang'
+  test_cflags = [
+    '-fno-strict-aliasing',
+    '-Wpointer-arith',
+    '-Wmissing-declarations',
+    '-Wimplicit-function-declaration',
+    '-Wformat=2',
+    '-Wformat-nonliteral',
+    '-Wformat-security',
+    '-Wstrict-prototypes',
+    '-Wmissing-prototypes',
+    '-Wnested-externs',
+    '-Wold-style-definition',
+    '-Wunused',
+    '-Wcast-align',
+    '-Wmissing-noreturn',
+    '-Wmissing-format-attribute',
+    '-Wmissing-include-dirs',
+    '-Wlogical-op',
+    '-Wno-uninitialized',
+    '-Wno-shadow',
+    '-Wno-int-conversion',
+    '-Wno-discarded-qualifiers',
+    '-Werror=redundant-decls',
+    '-Werror=implicit',
+    '-Werror=nonnull',
+    '-Werror=init-self',
+    '-Werror=main',
+    '-Werror=missing-braces',
+    '-Werror=sequence-point',
+    '-Werror=return-type',
+    '-Werror=trigraphs',
+    '-Werror=array-bounds',
+    '-Werror=write-strings',
+    '-Werror=address',
+    '-Werror=int-to-pointer-cast',
+    '-Werror=pointer-to-int-cast',
+    '-Werror=empty-body',
+    '-Werror=write-strings',
+    '-Werror=undef',
+  ]
+else
+  test_cflags = []
+endif
+
+foreach cflag: test_cflags
+  if cc.has_argument(cflag)
+    common_cflags += [ cflag ]
+  endif
+endforeach
+
+# Symbol visibility
+if get_option('default_library') != 'static'
+  if host_machine.system() == 'windows'
+    pango_conf.set('DLL_EXPORT', true)
+    if cc.get_id() == 'msvc'
+      pango_conf.set('_PANGO_EXTERN', '__declspec(dllexport) extern')
+    else
+      pango_conf.set('_PANGO_EXTERN', '__attribute__((visibility("default"))) __declspec(dllexport) extern')
+      common_cflags += ['-fvisibility=hidden']
+    endif
+  else
+    pango_conf.set('_PANGO_EXTERN', '__attribute__((visibility("default"))) extern')
+    common_cflags += ['-fvisibility=hidden']
+  endif
+endif
+
+# Linker flags
+if host_machine.system() == 'linux'
+  foreach ldflag: [ '-Wl,-Bsymbolic', '-Wl,-z,relro', '-Wl,-z,now', ]
+    if cc.has_argument(ldflag)
+      common_ldflags += [ ldflag ]
+    endif
+  endforeach
+endif
+
+# Maintain compatibility with autotools on macOS
+if host_machine.system() == 'darwin'
+  common_ldflags += [ '-compatibility_version=1', '-current_version=1.0', ]
+endif
+
+# Functions
+checked_funcs = [
+  'sysconf',
+  'getpagesize',
+  'flockfile',
+  'strtok_r',
+]
+
+foreach f: checked_funcs
+  if cc.has_function(f)
+    pango_conf.set('HAVE_' + f.underscorify().to_upper(), 1)
+  endif
+endforeach
+
+# Headers
+checked_headers = [
+  'unistd.h',
+  'sys/mman.h',
+  'dirent.h',
+]
+
+foreach h: checked_headers
+  if cc.has_header(h)
+    pango_conf.set('HAVE_' + h.underscorify().to_upper(), 1)
+  endif
+endforeach
+
+buildtype = get_option('buildtype')
+if buildtype == 'debug' or buildtype == 'debugoptimized'
+  pango_debug_cflags = [ '-DPANGO_ENABLE_DEBUG', ]
+else
+  pango_debug_cflags = [ '-DG_DISABLE_CAST_CHECKS', '-DG_DISABLE_ASSERT', '-DG_DISABLE_CHECKS', ]
+endif
+
+# Dependencies
+pango_deps = []
+
+glib_req_version = '>= 2.33.12'
+libthai_req_version = '>= 0.1.9'
+harfbuzz_req_version = '>= 1.2.3'
+fontconfig_req_version = '>= 2.10.91'
+xft_req_version = '>= 2.0.0'
+cairo_req_version = '>= 1.12.10'
+
+# libm
+mathlib_dep = cc.find_library('m', required: false)
+pango_deps += mathlib_dep
+
+# gobject
+gobject_dep = dependency('gobject-2.0', version: glib_req_version)
+pango_deps += gobject_dep
+
+thai_dep = dependency('libthai', version: libthai_req_version, required: false)
+if thai_dep.found()
+  pango_conf.set('HAVE_LIBTHAI', 1)
+  pango_deps += thai_dep
+endif
+
+harfbuzz_dep = dependency('harfbuzz', version: harfbuzz_req_version, required: false)
+if harfbuzz_dep.found()
+  pango_deps += harfbuzz_dep
+endif
+
+fontconfig_dep = dependency('fontconfig', version: fontconfig_req_version, required: false)
+if fontconfig_dep.found()
+  pango_deps += fontconfig_dep
+
+  if cc.has_function('FcWeightFromOpenType', dependencies: fontconfig_dep)
+    pango_conf.set('HAVE_FCWEIGHTFROMOPENTYPE', 1)
+  endif
+endif
+
+# The first version of freetype with a pkg-config file is 2.1.5
+freetype_dep = dependency('freetype2', required: false)
+if freetype_dep.found()
+  pango_conf.set('HAVE_FREETYPE', 1)
+  pango_deps += freetype_dep
+endif
+
+xft_dep = dependency('xft', version: xft_req_version, required: false)
+if xft_dep.found()
+  pango_conf.set('HAVE_XFT', 1)
+  pango_deps += dependency('xrender', required: false)
+  pango_deps += xft_dep
+endif
+
+cairo_dep = dependency('cairo', version: cairo_req_version, required: false)
+if cairo_dep.found()
+  # Check the following Cairo font backends
+  # - dependency
+  # - version
+  # - define
+  # - backend name
+  cairo_font_backends = [
+    [ 'cairo-ft', cairo_req_version, 'HAVE_CAIRO_FREETYPE', 'freetype', ],
+    [ 'cairo-win32', cairo_req_version, 'HAVE_CAIRO_WIN32', 'win32', ],
+    [ 'cairo-quartz', cairo_req_version, 'HAVE_CAIRO_QUARTZ', 'quartz', ],
+  ]
+
+  pango_font_backends = []
+
+  foreach b: cairo_font_backends
+    dep = dependency(b[0], version: b[1], required: false)
+    if dep.found()
+      pango_conf.set(b[2], 1)
+      pango_font_backends += b[3]
+    endif
+  endforeach
+
+  if pango_font_backends.length() == 0
+    error('No Cairo font backends found')
+  endif
+
+  # Check the following Cairo surface backends
+  # - dependency
+  # - version
+  # - define
+  # - backend name
+  cairo_surface_backends = [
+    [ 'cairo-png', cairo_req_version, 'HAVE_CAIRO_PNG', 'png', ],
+    [ 'cairo-ps', cairo_req_version, 'HAVE_CAIRO_PS', 'ps', ],
+    [ 'cairo-pdf', cairo_req_version, 'HAVE_CAIRO_PDF', 'pdf', ],
+    [ 'cairo-xlib', cairo_req_version, 'HAVE_CAIRO_XLIB', 'xlib', ],
+  ]
+
+  pango_cairo_backends = []
+
+  foreach b: cairo_surface_backends
+    dep = dependency(b[0], version: b[1], required: false)
+    if dep.found()
+      pango_conf.set(b[2], 1)
+      pango_cairo_backends += b[3]
+    endif
+  endforeach
+
+  pango_conf.set('HAVE_CAIRO', 1)
+  pango_deps += cairo_dep
+endif
+
+# Compat variables for pkgconfig
+pkgconf = configuration_data()
+pkgconf.set('prefix', pango_prefix)
+pkgconf.set('exec_prefix', pango_prefix)
+
+gnome = import('gnome')
+
+# Internal configuration header
+configure_file(output: 'config.h', configuration: pango_conf)
+
+root_inc = include_directories('.')
+
+subdir('pango')
+subdir('examples')
+subdir('pango-view')
+subdir('tests')
diff --git a/pango-view/meson.build b/pango-view/meson.build
new file mode 100644
index 0000000..12c2a43
--- /dev/null
+++ b/pango-view/meson.build
@@ -0,0 +1,40 @@
+pango_view_sources = [
+  'pango-view.c',
+  'viewer-main.c',
+  'viewer-render.c',
+]
+
+pango_view_deps = [
+  pango_deps,
+  libpango_dep,
+]
+
+if freetype_dep.found()
+  pango_view_sources += 'viewer-pangoft2.c'
+  pango_view_deps += libpangoft2_dep
+endif
+
+if xft_dep.found()
+  pango_view_sources += [
+    'viewer-pangoxft.c',
+    'viewer-x.c',
+  ]
+  pango_view_deps += [ libpangoft2_dep, libpangoxft_dep, ]
+endif
+
+if cairo_dep.found()
+  pango_view_sources += [
+    'viewer-cairo.c',
+    'viewer-pangocairo.c',
+  ]
+  pango_view_deps += libpangocairo_dep
+endif
+
+executable('pango-view', pango_view_sources,
+           dependencies: pango_view_deps,
+           include_directories: [ root_inc ],
+           install: true,
+           c_args: [
+             '-DPACKAGE_NAME="@0@"'.format(meson.project_name()),
+             '-DPACKAGE_VERSION="@0@"'.format(meson.project_version()),
+           ])
diff --git a/pango/meson.build b/pango/meson.build
new file mode 100644
index 0000000..5b9bb10
--- /dev/null
+++ b/pango/meson.build
@@ -0,0 +1,372 @@
+subdir('mini-fribidi')
+
+pango_sources = [
+  'break.c',
+  'ellipsize.c',
+  'fonts.c',
+  'glyphstring.c',
+  'modules.c',
+  'pango-attributes.c',
+  'pango-bidi-type.c',
+  'pango-color.c',
+  'pango-context.c',
+  'pango-coverage.c',
+  'pango-engine.c',
+  'pango-fontmap.c',
+  'pango-fontset.c',
+  'pango-glyph-item.c',
+  'pango-gravity.c',
+  'pango-item.c',
+  'pango-language.c',
+  'pango-layout.c',
+  'pango-markup.c',
+  'pango-matrix.c',
+  'pango-renderer.c',
+  'pango-script.c',
+  'pango-tabs.c',
+  'pango-utils.c',
+  'reorder-items.c',
+  'shape.c',
+]
+
+pango_headers = [
+  'pango.h',
+  'pango-attributes.h',
+  'pango-bidi-type.h',
+  'pango-break.h',
+  'pango-context.h',
+  'pango-coverage.h',
+  'pango-engine.h',
+  'pango-font.h',
+  'pango-fontmap.h',
+  'pango-fontset.h',
+  'pango-glyph.h',
+  'pango-glyph-item.h',
+  'pango-gravity.h',
+  'pango-item.h',
+  'pango-language.h',
+  'pango-layout.h',
+  'pango-matrix.h',
+  'pango-modules.h',
+  'pango-renderer.h',
+  'pango-script.h',
+  'pango-tabs.h',
+  'pango-types.h',
+  'pango-utils.h',
+  'pango-version-macros.h',
+]
+
+install_headers(pango_headers, subdir: pango_api_path)
+
+# Features header
+pango_features_conf = configuration_data()
+pango_features_conf.set('PANGO_VERSION_MAJOR', pango_major_version)
+pango_features_conf.set('PANGO_VERSION_MINOR', pango_minor_version)
+pango_features_conf.set('PANGO_VERSION_MICRO', pango_micro_version)
+
+configure_file(input: 'pango-features.h.meson',
+               output: 'pango-features.h',
+               configuration: pango_features_conf,
+              install: true,
+              install_dir: join_paths(pango_includedir, pango_api_path))
+
+# Enumerations for GType
+pango_enums = gnome.mkenums('pango-enum-types',
+                            sources: pango_headers,
+                            c_template: 'pango-enum-types.c.template',
+                            h_template: 'pango-enum-types.h.template',
+                            install_dir: join_paths(pango_includedir, pango_api_path),
+                            install_header: true)
+pango_enum_h = pango_enums[1]
+
+pango_cflags = [
+  '-DG_LOG_DOMAIN="Pango"',
+  '-DG_LOG_USE_STRUCTURED=1',
+  '-DPANGO_ENABLE_BACKEND',
+  '-DPANGO_ENABLE_ENGINE',
+  '-DSYSCONFDIR="@0@"'.format(pango_sysconfdir),
+  '-DLIBDIR="@0@"'.format(pango_libdir),
+]
+
+pango_inc = include_directories('.')
+
+libpango = shared_library('pango-@0@'.format(pango_api_version),
+                         sources: pango_sources + pango_enums,
+                         version: meson.project_version(),
+                         soversion: pango_soversion,
+                         install: true,
+                         dependencies: [ gobject_dep, mathlib_dep, thai_dep, mini_fribidi_dep ],
+                          include_directories: [ root_inc, pango_inc ],
+                         c_args: common_cflags + pango_debug_cflags + pango_cflags,
+                         link_args: common_ldflags)
+
+libpango_dep = declare_dependency(link_with: libpango,
+                                  include_directories: pango_inc,
+                                  dependencies: pango_deps,
+                                  sources: pango_enums)
+
+if not meson.is_cross_build()
+  gir_args = [
+    '--quiet',
+    '-DPANGO_ENABLE_BACKEND',
+    '-DPANGO_ENABLE_ENGINE',
+  ]
+
+  pango_gir = gnome.generate_gir(libpango,
+                                 sources: pango_sources + pango_headers + [ pango_enum_h ],
+                                 namespace: 'Pango',
+                                 nsversion: pango_api_version,
+                                 identifier_prefix: 'Pango',
+                                 symbol_prefix: 'pango',
+                                 export_packages: 'pango',
+                                 includes: [ 'GObject-2.0', 'cairo-1.0', ],
+                                 install: true,
+                                 extra_args: gir_args + [
+                                   '--c-include=pango/pango.h',
+                                 ])
+  pango_gir_dep = declare_dependency(sources: pango_gir)
+endif
+
+# FreeType
+if freetype_dep.found()
+  pangoft2_headers = [
+    'pango-ot.h',
+    'pangofc-font.h',
+    'pangofc-fontmap.h',
+    'pangofc-decoder.h',
+    'pangoft2.h',
+  ]
+
+  pangoft2_public_sources = [
+    'pangofc-font.c',
+    'pangofc-fontmap.c',
+    'pangofc-decoder.c',
+    'pangofc-shape.c',
+    'pangoft2.c',
+  ]
+
+  pangoft2_sources = pangoft2_public_sources + [
+    'pangoft2-fontmap.c',
+    'pangoft2-render.c',
+    'pango-ot-buffer.c',
+    'pango-ot-info.c',
+    'pango-ot-ruleset.c',
+    'pango-ot-tag.c',
+  ]
+
+  install_headers(pangoft2_headers, subdir: pango_api_path)
+
+  libpangoft2 = shared_library('libpangoft2-@0@'.format(pango_api_version),
+                               sources: pangoft2_sources + [ pango_enum_h ],
+                               version: meson.project_version(),
+                               soversion: pango_soversion,
+                               install: true,
+                               dependencies: pango_deps + [ libpango_dep ],
+                               include_directories: [ root_inc, pango_inc ],
+                               c_args: common_cflags + pango_debug_cflags + pango_cflags + [
+                                 '-DPANGO_DISABLE_DEPRECATION_WARNINGS',
+                               ],
+                               link_args: common_ldflags)
+
+  libpangoft2_dep = declare_dependency(link_with: libpangoft2,
+                                       include_directories: pango_inc,
+                                       dependencies: pango_deps + [ libpango_dep ])
+
+  if not meson.is_cross_build()
+    pangoft2_gir = gnome.generate_gir(libpangoft2,
+                                      sources: pangoft2_headers + pangoft2_public_sources,
+                                      dependencies: pango_gir_dep,
+                                      namespace: 'PangoFT2',
+                                      nsversion: pango_api_version,
+                                      identifier_prefix: 'PangoFT2',
+                                      symbol_prefix: 'pango_ft2',
+                                      export_packages: 'pangoft2',
+                                      includes: [ 'GObject-2.0', 'cairo-1.0', 'freetype2-2.0', 
'fontconfig-2.0', ],
+                                      install: true,
+                                      extra_args: gir_args + [
+                                        '--c-include=pango/pangoft2.h',
+                                        '--include-uninstalled=pango/Pango-1.0.gir',
+                                      ])
+
+    pangoft2_gir_dep = declare_dependency(sources: pangoft2_gir)
+  endif
+endif
+
+# Xft
+if xft_dep.found()
+  pangoxft_headers = [
+    'pangoxft.h',
+    'pangoxft-render.h',
+  ]
+
+  pangoxft_sources = [
+    'pangoxft-font.c',
+    'pangoxft-fontmap.c',
+    'pangoxft-render.c',
+  ]
+
+  install_headers(pangoxft_headers, subdir: pango_api_path)
+
+  libpangoxft = shared_library('libpangoxft-@0@'.format(pango_api_version),
+                               sources: pangoxft_sources + [ pango_enum_h ],
+                               version: meson.project_version(),
+                               soversion: pango_soversion,
+                               install: true,
+                               dependencies: pango_deps + [ libpango_dep, libpangoft2_dep ],
+                               include_directories: [ root_inc, pango_inc ],
+                               c_args: common_cflags + pango_debug_cflags + pango_cflags + [
+                                 '-DPANGO_DISABLE_DEPRECATION_WARNINGS',
+                               ],
+                               link_args: common_ldflags)
+
+  libpangoxft_dep = declare_dependency(link_with: libpangoxft,
+                                       include_directories: root_inc,
+                                       dependencies: pango_deps + [ libpango_dep, libpangoft2_dep ])
+
+  if not meson.is_cross_build()
+    pangoxft_gir = gnome.generate_gir(libpangoxft,
+                                      sources: pangoxft_headers + pangoxft_sources,
+                                      dependencies: [ pango_gir_dep, pangoft2_gir_dep ],
+                                      namespace: 'PangoXft',
+                                      nsversion: pango_api_version,
+                                      identifier_prefix: 'PangoXft',
+                                      symbols_prefix: 'pango_xft',
+                                      export_packages: 'pangoxft',
+                                      includes: [ 'GObject-2.0', 'xft-2.0', 'xlib-2.0' ],
+                                      install: true,
+                                      extra_args: gir_args + [
+                                        '--c-include=pango/pangoxft.h',
+                                        
'--include-uninstalled=pango/Pango-@0@.gir'.format(pango_api_version),
+                                        
'--include-uninstalled=pango/PangoFT2-@0@.gir'.format(pango_api_version),
+                                      ])
+
+    pangoxft_gir_dep = declare_dependency(sources: pangoxft_gir)
+  endif
+endif
+
+# Win32
+if host_system.contains('windows')
+  pangowin32_headers = [
+    'pangowin32.h',
+  ]
+
+  pangowin32_sources = [
+    'pangowin32.c',
+    'pangowin32-fontcache.c',
+    'pangowin32-fontmap.c',
+    'pangowin32-shape.c',
+  ]
+
+  pangowin32_deps = pango_deps + [
+    libpango_dep,
+    cc.find_library('gdi32'),
+    cc.find_library('usp10'),
+  ]
+
+  install_headers(pangowin32_headers, subdir: pango_api_path)
+
+  libpangowin32 = shared_library('libpangowin32-@0@'.format(pango_api_version),
+                                 sources: pangowin32_sources + [ pango_enum_h ],
+                                 version: meson.project_version(),
+                                 soversion: pango_soversion,
+                                 install: true,
+                                 dependencies: pangowin32_deps,
+                                 include_directories: [ root_inc, pango_inc ],
+                                 c_args: common_cflags + pango_debug_cflags + pango_cflags + [
+                                   '-DPANGO_DISABLE_DEPRECATION_WARNINGS',
+                                 ],
+                                 link_args: common_ldflags)
+
+  libpangowin32_dep = declare_dependency(link_with: libpangowin32,
+                                         include_directories: root_inc,
+                                         dependencies: pango_deps + [ libpango_dep ])
+endif
+
+# CoreText
+if host_system.contains('darwin')
+endif
+
+# Cairo
+if cairo_dep.found()
+  pangocairo_headers = [
+    'pangocairo.h',
+  ]
+
+  pangocairo_sources = [
+    'pangocairo-context.c',
+    'pangocairo-font.c',
+    'pangocairo-fontmap.c',
+    'pangocairo-render.c',
+  ]
+
+  pangocairo_deps = pango_deps + [ libpango_dep ]
+  pangocairo_gir_deps = [ pango_gir_dep, ]
+  pangocairo_gir_args = []
+
+  if pango_font_backends.contains('freetype')
+    pangocairo_sources += [
+      'pangocairo-fcfont.c',
+      'pangocairo-fcfontmap.c',
+    ]
+
+    pangocairo_deps += libpangoft2_dep
+    pangocairo_gir_args += '--include-uninstalled=pango/PangoFT2-@0@.gir'.format(pango_api_version)
+    pangocairo_gir_deps += pangoft2_gir_dep
+  endif
+
+  if host_system.contains('windows') and pango_font_backends.contains('win32')
+    pangocairo_sources += [
+      'pangocairo-win32font.c',
+      'pangocairo-win32fontmap.c',
+    ]
+    pangocairo_deps += cc.find_library('gdi32')
+    pangocairo_deps += libpangowin32_dep
+  endif
+
+  if host_system.contains('darwin') and pango_font_backends.contains('quartz')
+    pangocairo_sources += [
+      'pangocoretext.c',
+      'pangocoretext-fontmap.c',
+      'pangocoretext-shape.c',
+      'pangocairo-coretextfont.c',
+      'pangocairo-coretextfontmap.c',
+    ]
+    pangocairo_deps += dependency('appleframeworks', modules: [ 'CoreFoundation', 'ApplicationServices' ])
+  endif
+
+  install_headers(pangocairo_headers, subdir: pango_api_path)
+
+  libpangocairo = shared_library('libpangocairo-@0@'.format(pango_api_version),
+                                 sources: pangocairo_sources + [ pango_enum_h ],
+                                 version: meson.project_version(),
+                                 soversion: pango_soversion,
+                                 install: true,
+                                 dependencies: pango_deps + pangocairo_deps,
+                                 include_directories: [ root_inc, pango_inc ],
+                                 c_args: common_cflags + pango_debug_cflags + pango_cflags + [
+                                   '-DPANGO_DISABLE_DEPRECATION_WARNINGS',
+                                 ],
+                                 link_args: common_ldflags)
+
+  libpangocairo_dep = declare_dependency(link_with: libpangocairo,
+                                         include_directories: root_inc,
+                                         dependencies: pango_deps + [ libpango_dep ])
+
+  if not meson.is_cross_build()
+    pangocairo_gir = gnome.generate_gir(libpangocairo,
+                                        sources: pangocairo_headers + pangocairo_sources,
+                                        dependencies: pangocairo_gir_deps,
+                                        namespace: 'PangoCairo',
+                                        nsversion: pango_api_version,
+                                        identifier_prefix: 'PangoCairo',
+                                        symbols_prefix: 'pango_cairo',
+                                        export_packages: 'pangocairo',
+                                        includes: [ 'GObject-2.0', 'cairo-1.0' ],
+                                        install: true,
+                                        extra_args: gir_args + pangocairo_gir_args + [
+                                          '--c-include=pango/pangocairo.h',
+                                        ])
+
+    pangocairo_gir_dep = declare_dependency(sources: pangocairo_gir)
+  endif
+endif
diff --git a/pango/mini-fribidi/meson.build b/pango/mini-fribidi/meson.build
new file mode 100644
index 0000000..e9dab25
--- /dev/null
+++ b/pango/mini-fribidi/meson.build
@@ -0,0 +1,19 @@
+mini_fribidi_sources = [
+  'fribidi.c',
+  'fribidi_char_type.c',
+  'fribidi_types.c',
+]
+
+mini_fribidi_lib = static_library('libmini-fribidi', sources: mini_fribidi_sources,
+                                  dependencies: [ mathlib_dep, gobject_dep ],
+                                  include_directories: root_inc,
+                                  c_args: common_cflags + [
+                                    '-DSYSCONFDIR="@0@"'.format(pango_sysconfdir),
+                                    '-DLIBDIR="@0@"'.format(pango_libdir),
+                                  ])
+
+mini_fribidi_dep = declare_dependency(link_with: mini_fribidi_lib,
+                                      dependencies: [ mathlib_dep, gobject_dep ],
+                                      include_directories: [
+                                        include_directories('.'),
+                                      ])
diff --git a/pango/pango-features.h.meson b/pango/pango-features.h.meson
new file mode 100644
index 0000000..af50695
--- /dev/null
+++ b/pango/pango-features.h.meson
@@ -0,0 +1,10 @@
+#ifndef PANGO_FEATURES_H
+#define PANGO_FEATURES_H
+
+#mesondefine PANGO_VERSION_MAJOR
+#mesondefine PANGO_VERSION_MINOR
+#mesondefine PANGO_VERSION_MICRO
+
+#define PANGO_VERSION_STRING "PANGO_VERSION_MAJOR.PANGO_VERSION_MINOR.PANGO_VERSION_MICRO"
+
+#endif /* PANGO_FEATURES_H */
diff --git a/tests/meson.build b/tests/meson.build
new file mode 100644
index 0000000..f2e233e
--- /dev/null
+++ b/tests/meson.build
@@ -0,0 +1,54 @@
+test_cflags = [
+  '-DSRCDIR=@0@'.format(meson.current_source_dir()),
+]
+
+if xft_dep.found()
+  test_cflags += [ '-DHAVE_X', '-DHAVE_XFT' ]
+endif
+
+if freetype_dep.found()
+  test_cflags += '-DHAVE_FREETYPE'
+endif
+
+if host_system.contains('windows')
+  test_cflags += '-DHAVE_WIN32'
+endif
+
+test_env = [
+  'srcdir=@0@'.format(meson.current_source_dir()),
+  'G_TEST_SRCDIR=@0@'.format(meson.current_source_dir()),
+  'G_TEST_BUILDDIR=@0@'.format(meson.current_build_dir()),
+]
+
+tests = [
+  [ 'testboundaries' ],
+  [ 'testboundaries_ucd' ],
+  [ 'testcolor' ],
+  [ 'testscript' ],
+]
+
+if freetype_dep.found()
+  tests += [
+    [ 'test-ot-tags', [ 'test-ot-tags.c' ], [ libpangoft2_dep ] ],
+  ]
+endif
+
+if cairo_dep.found()
+  tests += [
+    [ 'testiter', [ 'testiter.c' ], [ libpangocairo_dep ] ],
+    [ 'test-pangocairo-threads', [ 'test-pangocairo-threads.c' ], [ libpangocairo_dep, cairo_dep ] ],
+    [ 'markup-parse', [ 'markup-parse.c' ], [ libpangocairo_dep ] ],
+    [ 'test-layout', [ 'test-layout.c', 'test-common.c' ], [ libpangocairo_dep ] ],
+    [ 'test-font', [ 'test-font.c' ], [ libpangocairo_dep ] ],
+    [ 'testattributes', [ 'testattributes.c', 'test-common.c' ], [ libpangocairo_dep ] ],
+  ]
+endif
+
+foreach t: tests
+  name = t[0]
+  src = t.get(1, [ '@0@.c'.format(name) ])
+  deps = t.get(2, [ libpango_dep ])
+
+  bin = executable(name, src, dependencies: deps, include_directories: root_inc)
+  test(name, bin, env: test_env)
+endforeach


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]