meson: Use pkgconfig module instead of substitution

This commit is contained in:
Daiki Ueno 2019-10-11 14:33:41 +02:00
parent 1b1a7d1e48
commit 300ddc702e
2 changed files with 20 additions and 26 deletions

View File

@ -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 = [

View File

@ -6,6 +6,7 @@ project('libsecret', 'c',
gnome = import('gnome')
i18n = import('i18n')
pkg = import('pkgconfig')
# API version
api_version = '1.0.0'
@ -46,7 +47,8 @@ glib_deps = [
]
min_libgcrypt_version = '1.2.2'
gcrypt_dep = dependency('libgcrypt', version: '>=1.2.2', required: with_gcrypt)
gcrypt_dep = dependency('libgcrypt', version: '>=' + min_libgcrypt_version,
required: with_gcrypt)
# Libraries
math = meson.get_compiler('c').find_library('m')