summaryrefslogtreecommitdiff
path: root/meson.build
blob: 469fb28fafac43edda7cf440334fac6d07545f45 (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
project('rest', 'c',
  version: '0.9.0',
  license: 'LGPL2.1+',
  meson_version: '>= 0.49',
)

# Versioning
librest_module_version = '0.0.0'
librest_soversion = '0'
librest_api_version = '1.0'
librest_pkg_string = 'rest-@0@'.format(librest_api_version)

# Modules
gnome = import('gnome')
pkgconfig = import('pkgconfig')

# CA certificates
if get_option('ca_certificates')
  ca_certificates_path = get_option('ca_certificates_path')

  if ca_certificates_path == ''
    default_certificate_paths = [
      '/etc/ssl/ca-bundle.pem',
      '/etc/ssl/certs/ca-certificates.crt',
      '/etc/pki/tls/certs/ca-bundle.crt',
    ]

    foreach location : default_certificate_paths
      if file_exists(location)
        ca_certificates_path = location
        break
      endif
    endforeach
  endif

  if ca_certificates_path == ''
    error('Did not specify system CA list and could not find any in the default locations.')
  endif
endif

# Dependencies
glib_dep = dependency('glib-2.0', version: '>= 2.44')
gobject_dep = dependency('gobject-2.0', version: '>= 2.44')
libsoup_dep = dependency('libsoup-2.4', version: '>= 2.42')
libxml_dep = dependency('libxml-2.0')

# config.h
conf = configuration_data()
conf.set_quoted('PACKAGE_NAME', meson.project_name())
conf.set_quoted('PACKAGE_STRING', '@0@ - @1@'.format(meson.project_name(), meson.project_version()))
conf.set_quoted('PACKAGE_VERSION', meson.project_version())
if get_option('ca_certificates')
  con.set_quoted('REST_SYSTEM_CA_FILE', ca_certificates_path)
endif
configure_file(output: 'config.h', configuration: conf)
config_h_inc = include_directories('.')

# Subdirectories
subdir('rest')
subdir('rest-extras')
subdir('tests')
if get_option('examples')
  subdir('examples')
endif
if get_option('gtk_doc')
  subdir('docs')
endif

# pkg-config
pkgconfig.generate(librest_lib,
  name: meson.project_name(),
  filebase: librest_pkg_string,
  description: 'RESTful web api query library',
  subdirs: librest_pkg_string,
  requires: [ glib_dep, libsoup_dep, libxml_dep, ],
  variables: [
    'apiversion=@0@'.format(librest_api_version),
  ],
)

pkgconfig.generate(librest_extras_lib,
  name: meson.project_name(),
  filebase: librest_extras_pkg_string,
  description: 'RESTful web api query library',
  subdirs: librest_pkg_string,
  requires: [ glib_dep, libsoup_dep, libxml_dep, ],
  variables: [
    'apiversion=@0@'.format(librest_api_version),
  ],
)