summaryrefslogtreecommitdiff
path: root/data/meson.build
blob: 5d9567c292310de9249c3b75efd4a999d04a2aae (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
# data

# Input: install_prefix, install_libdir, install_datadir, install_includedir,
#        install_pkgconfigdir, cairomm_pcname, cairomm_api_version,
#        cairomm_requires
# Output: -

pkg_conf_data = configuration_data()
pkg_conf_data.set('prefix', install_prefix)
pkg_conf_data.set('exec_prefix', '${prefix}')
pkg_conf_data.set('libdir', '${exec_prefix}' / install_libdir)
pkg_conf_data.set('datarootdir', '${prefix}' / install_datadir)
pkg_conf_data.set('datadir', '${datarootdir}')
pkg_conf_data.set('includedir', '${prefix}' / install_includedir)
pkg_conf_data.set('PACKAGE_VERSION', meson.project_version())
pkg_conf_data.set('CAIROMM_MODULE_NAME', cairomm_pcname)
pkg_conf_data.set('CAIROMM_API_VERSION', cairomm_api_version)
pkg_conf_data.set('CAIROMM_MODULES', cairomm_requires)
pkg_conf_data.set('CAIROMM_EXTRA_LIBS', cairomm_extra_libs)

configure_file(
  input: 'cairomm.pc.in',
  output: cairomm_pcname + '.pc',
  configuration: pkg_conf_data,
  install_dir: install_pkgconfigdir,
  install: true,
)

foreach cairomm_mod : ['ft', 'pdf', 'png', 'ps', 'quartz', 'quartz-font',
    'quartz-image', 'svg', 'win32', 'win32-font', 'xlib', 'xlib-xrender']

  # Install the module only if there is a corresponding cairo module.
  if cairo_dep.type_name() == 'pkgconfig'
    do_install = dependency('cairo-' + cairomm_mod, required: false).found()
  else
    if cairomm_mod == 'png'
      do_install = cpp_compiler.has_function('cairo_surface_write_to_png',
                                             prefix: '#include <cairo.h>',
                                             dependencies: cairo_dep)
    elif cairomm_mod == 'quartz-font'
      do_install = cpp_compiler.has_function('cairo_quartz_font_face_create_for_cgfont',
                                             prefix: '#include <cairo-quartz.h>',
                                             dependencies: cairo_dep)
    elif cairomm_mod == 'win32-font'
      do_install = cpp_compiler.has_function('cairo_win32_font_face_create_for_hfont',
                                             prefix: '#include <cairo-win32.h>',
                                             dependencies: cairo_dep)
    else
      do_install = cpp_compiler.has_header('cairo-@0@.h'.format(cairomm_mod))
    endif
  endif
  pc_file = 'cairomm-' + cairomm_mod
  configure_file(
    input: pc_file + '.pc.in',
    output: pc_file + '-' + cairomm_api_version + '.pc',
    configuration: pkg_conf_data,
    install_dir: install_pkgconfigdir,
    install: do_install,
  )
endforeach