build: Simplify file substitution

Since meson 0.50, configuration_data() can take a dictionary.
This commit is contained in:
Daiki Ueno 2019-07-24 06:29:36 +02:00
parent a4ea97d6e6
commit c06c9d2e26
2 changed files with 20 additions and 20 deletions

View File

@ -15,12 +15,10 @@ reference_ignore_headers = [
'secret-private.h', 'secret-private.h',
] ]
version_conf = configuration_data()
version_conf.set('VERSION', meson.project_version())
configure_file( configure_file(
input: 'version.xml.in', input: 'version.xml.in',
output: 'version.xml', output: '@BASENAME@',
configuration: version_conf, configuration: {'VERSION': meson.project_version()},
) )
gnome.gtkdoc('libsecret', gnome.gtkdoc('libsecret',

View File

@ -37,12 +37,13 @@ version_numbers = meson.project_version().split('.')
version_major = version_numbers[0].to_int() version_major = version_numbers[0].to_int()
version_minor = version_numbers[1].to_int() version_minor = version_numbers[1].to_int()
version_micro = version_numbers[2].to_int() version_micro = version_numbers[2].to_int()
version_h_conf = configuration_data() version_h_conf = configuration_data({
version_h_conf.set('SECRET_MAJOR_VERSION', version_major) 'SECRET_MAJOR_VERSION': version_major,
version_h_conf.set('SECRET_MINOR_VERSION', version_minor) 'SECRET_MINOR_VERSION': version_minor,
version_h_conf.set('SECRET_MICRO_VERSION', version_micro) 'SECRET_MICRO_VERSION': version_micro,
})
version_h = configure_file(input: 'secret-version.h.in', version_h = configure_file(input: 'secret-version.h.in',
output: 'secret-version.h', output: '@BASENAME@',
configuration: version_h_conf) configuration: version_h_conf)
libsecret_headers += version_h libsecret_headers += version_h
@ -143,16 +144,17 @@ if with_vapi
endif endif
# pkg-config # pkg-config
pc_conf = configuration_data() pc_conf = configuration_data({
pc_conf.set('prefix', libsecret_prefix) 'prefix': libsecret_prefix,
pc_conf.set('exec_prefix', '${prefix}') 'exec_prefix': '${prefix}',
pc_conf.set('libdir', '${prefix}' / get_option('libdir')) 'libdir': '${prefix}' / get_option('libdir'),
pc_conf.set('includedir', '${prefix}' / get_option('includedir')) 'includedir': '${prefix}' / get_option('includedir'),
pc_conf.set('datarootdir', '${prefix}' / get_option('datadir')) 'datarootdir': '${prefix}' / get_option('datadir'),
pc_conf.set('datadir', '${datarootdir}') 'datadir': '${datarootdir}',
pc_conf.set('sysconfdir', '${prefix}' / get_option('sysconfdir')) 'sysconfdir': '${prefix}' / get_option('sysconfdir'),
pc_conf.set('SECRET_MAJOR', api_version_major) 'SECRET_MAJOR': api_version_major,
pc_conf.set('VERSION', meson.project_version()) 'VERSION': meson.project_version(),
})
configure_file( configure_file(
input: 'libsecret.pc.in', input: 'libsecret.pc.in',
@ -163,7 +165,7 @@ configure_file(
) )
configure_file( configure_file(
input: 'libsecret-unstable.pc.in', input: 'libsecret-unstable.pc.in',
output: 'libsecret-unstable.pc', output: '@BASENAME@',
configuration: pc_conf, configuration: pc_conf,
install: true, install: true,
install_dir: libsecret_prefix / libdir / 'pkgconfig', install_dir: libsecret_prefix / libdir / 'pkgconfig',