summaryrefslogtreecommitdiff
path: root/meson.build
diff options
context:
space:
mode:
authorNiels De Graef <nielsdegraef@gmail.com>2019-05-08 08:27:38 +0200
committerGünther Wagner <info@gunibert.de>2021-10-21 12:52:27 +0200
commitafcf2ed34ca0b47aaee6f81625d4deec2c3d6bb9 (patch)
tree43bad38eb62e220408b4cc053c54ced78db8ae28 /meson.build
parent409dec8b596bb6cc3b8e25d0572bf5cd38130968 (diff)
downloadlibrest-afcf2ed34ca0b47aaee6f81625d4deec2c3d6bb9.tar.gz
Port to the Meson build system
See the [Meson website] for a full reference. To build, test and/or install the librest library, you essentially need the following commands: ``` $ meson build $ ninja -C build $ meson test -C build $ ninja -C build install ``` For the GNOME initiative, see https://wiki.gnome.org/Initiatives/GnomeGoals/MesonPorting [Meson website]: http://mesonbuild.com/ https://gitlab.gnome.org/GNOME/librest/merge_requests/1
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),
+ ],
+)