Merge branch 'wip/dueno/meson-pkgconfig' into 'master'

meson: Use pkgconfig module instead of substitution

See merge request GNOME/libsecret!40
This commit is contained in:
Daiki Ueno 2019-10-12 15:31:23 +00:00
commit 79e89b2cb2
2 changed files with 22 additions and 42 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'
@ -44,23 +45,10 @@ glib_deps = [
dependency('gio-2.0', version: '>=' + min_glib_version), dependency('gio-2.0', version: '>=' + min_glib_version),
dependency('gio-unix-2.0', version: '>=' + min_glib_version), dependency('gio-unix-2.0', version: '>=' + min_glib_version),
] ]
if with_gcrypt
min_libgcrypt_version = '1.2.2' min_libgcrypt_version = '1.2.2'
gcrypt_dep = dependency('libgcrypt', version: '>=' + min_libgcrypt_version, required: false) gcrypt_dep = dependency('libgcrypt', version: '>=' + min_libgcrypt_version,
if not gcrypt_dep.found() required: with_gcrypt)
libgcrypt_config = find_program('libgcrypt-config')
libgcrypt_version = run_command(libgcrypt_config, '--version').stdout().strip()
if (libgcrypt_version.version_compare('>' + libgcrypt_version))
error('@0@ requires at least gcrypt version @1@, but version found is @2@'
.format(meson.project_name(), min_libgcrypt_version, libgcrypt_version))
endif
message('gcrypt version: @0@'.format(libgcrypt_version))
gcrypt_dep = declare_dependency(
link_args: run_command(libgcrypt_config, '--libs').stdout().strip().split(),
compile_args: run_command(libgcrypt_config, '--cflags').stdout().strip().split(),
)
endif
endif
# Libraries # Libraries
math = meson.get_compiler('c').find_library('m') math = meson.get_compiler('c').find_library('m')