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 endif
# pkg-config # pkg-config
pc_conf = configuration_data({ libsecret_pc_variables = [
'prefix': libsecret_prefix, 'exec_prefix=${prefix}',
'exec_prefix': '${prefix}', 'datarootdir=@0@'.format('${prefix}' / get_option('datadir')),
'libdir': '${prefix}' / get_option('libdir'), 'datadir=${datarootdir}',
'includedir': '${prefix}' / get_option('includedir'), 'sysconfdir=@0@'.format('${prefix}' / get_option('sysconfdir'))
'datarootdir': '${prefix}' / get_option('datadir'), ]
'datadir': '${datarootdir}',
'sysconfdir': '${prefix}' / get_option('sysconfdir'),
'SECRET_MAJOR': api_version_major,
'VERSION': meson.project_version(),
})
configure_file( pkg.generate(libsecret,
input: 'libsecret.pc.in', description: 'GObject bindings for Secret Service API',
output: 'libsecret-@0@.pc'.format(api_version_major), name: 'libsecret-@0@'.format(api_version_major),
configuration: pc_conf, variables: libsecret_pc_variables,
install: true, requires_private: glib_deps + [gcrypt_dep])
install_dir: libsecret_prefix / libdir / 'pkgconfig',
) pkg.generate(description: 'GObject bindings for Secret Service API (Unstable)',
configure_file( name: 'libsecret-unstable',
input: 'libsecret-unstable.pc.in', variables: libsecret_pc_variables,
output: '@BASENAME@', extra_cflags: '-DSECRET_WITH_UNSTABLE',
configuration: pc_conf, requires: libsecret)
install: true,
install_dir: libsecret_prefix / libdir / 'pkgconfig',
)
# Tests # Tests
mock_cflags = [ mock_cflags = [

View File

@ -6,6 +6,7 @@ project('libsecret', 'c',
gnome = import('gnome') gnome = import('gnome')
i18n = import('i18n') i18n = import('i18n')
pkg = import('pkgconfig')
# API version # API version
api_version = '1.0.0' api_version = '1.0.0'
@ -46,7 +47,8 @@ glib_deps = [
] ]
min_libgcrypt_version = '1.2.2' 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 # Libraries
math = meson.get_compiler('c').find_library('m') math = meson.get_compiler('c').find_library('m')