summaryrefslogtreecommitdiff
path: root/meson.build
diff options
context:
space:
mode:
Diffstat (limited to 'meson.build')
-rw-r--r--meson.build90
1 files changed, 90 insertions, 0 deletions
diff --git a/meson.build b/meson.build
new file mode 100644
index 0000000..469fb28
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,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),
+ ],
+)