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
# 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'
@ -44,23 +45,10 @@ glib_deps = [
dependency('gio-2.0', version: '>=' + min_glib_version),
dependency('gio-unix-2.0', version: '>=' + min_glib_version),
]
if with_gcrypt
min_libgcrypt_version = '1.2.2'
gcrypt_dep = dependency('libgcrypt', version: '>=' + min_libgcrypt_version, required: false)
if not gcrypt_dep.found()
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
min_libgcrypt_version = '1.2.2'
gcrypt_dep = dependency('libgcrypt', version: '>=' + min_libgcrypt_version,
required: with_gcrypt)
# Libraries
math = meson.get_compiler('c').find_library('m')