[libsecret/wip/dueno/meson-pkgconfig: 2/2] meson: Use pkgconfig module instead of substitution



commit 0e4cfb6108c776ed6d231df8415542aff4242d03
Author: Daiki Ueno <dueno src gnome org>
Date:   Fri Oct 11 14:33:41 2019 +0200

    meson: Use pkgconfig module instead of substitution

 libsecret/meson.build | 42 +++++++++++++++++-------------------------
 meson.build           |  1 +
 2 files changed, 18 insertions(+), 25 deletions(-)
---
diff --git a/libsecret/meson.build b/libsecret/meson.build
index 0421ac9..6cbd88e 100644
--- a/libsecret/meson.build
+++ b/libsecret/meson.build
@@ -148,32 +148,24 @@ if with_vapi
 endif
 
 # pkg-config
-pc_conf = configuration_data({
-  'prefix': libsecret_prefix,
-  'exec_prefix': '${prefix}',
-  'libdir': '${prefix}' / get_option('libdir'),
-  'includedir': '${prefix}' / get_option('includedir'),
-  'datarootdir': '${prefix}' / get_option('datadir'),
-  'datadir': '${datarootdir}',
-  'sysconfdir': '${prefix}' / get_option('sysconfdir'),
-  'SECRET_MAJOR': api_version_major,
-  'VERSION': meson.project_version(),
-})
+libsecret_pc_variables = [
+  'exec_prefix=${prefix}',
+  'datarootdir=@0@'.format('${prefix}' / get_option('datadir')),
+  'datadir=${datarootdir}',
+  'sysconfdir=@0@'.format('${prefix}' / get_option('sysconfdir'))
+]
 
-configure_file(
-  input: 'libsecret.pc.in',
-  output: 'libsecret-@0@.pc'.format(api_version_major),
-  configuration: pc_conf,
-  install: true,
-  install_dir: libsecret_prefix / libdir / 'pkgconfig',
-)
-configure_file(
-  input: 'libsecret-unstable.pc.in',
-  output: '@BASENAME@',
-  configuration: pc_conf,
-  install: true,
-  install_dir: libsecret_prefix / libdir / 'pkgconfig',
-)
+pkg.generate(libsecret,
+            description: 'GObject bindings for Secret Service API',
+            name: 'libsecret-@0@'.format(api_version_major),
+            variables: libsecret_pc_variables,
+            requires_private: glib_deps + [gcrypt_dep])
+
+pkg.generate(description: 'GObject bindings for Secret Service API (Unstable)',
+            name: 'libsecret-unstable',
+            variables: libsecret_pc_variables,
+            extra_cflags: '-DSECRET_WITH_UNSTABLE',
+            requires: libsecret)
 
 # Tests
 mock_cflags = [
diff --git a/meson.build b/meson.build
index 2d2abd9..68e4253 100644
--- a/meson.build
+++ b/meson.build
@@ -6,6 +6,7 @@ project('libsecret', 'c',
 
 gnome = import('gnome')
 i18n = import('i18n')
+pkg = import('pkgconfig')
 
 # API version
 api_version = '1.0.0'


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