From 9959be81fd9c3e2f33a75ea3b682b395e499b4f2 Mon Sep 17 00:00:00 2001 From: Niels De Graef Date: Mon, 1 Jun 2020 09:05:58 +0200 Subject: [PATCH] meson: Clean up unused variables --- docs/meson.build | 4 ++-- egg/meson.build | 2 +- libsecret/meson.build | 28 ++++++++++++++-------------- meson.build | 33 +++++++++------------------------ tool/meson.build | 2 +- 5 files changed, 27 insertions(+), 42 deletions(-) diff --git a/docs/meson.build b/docs/meson.build index 06db370..fa89a31 100644 --- a/docs/meson.build +++ b/docs/meson.build @@ -1,6 +1,6 @@ -if with_manpage +if get_option('manpage') subdir('man') endif -if with_gtkdoc +if get_option('gtk_doc') subdir('reference/libsecret') endif diff --git a/egg/meson.build b/egg/meson.build index 7de614c..1b8a626 100644 --- a/egg/meson.build +++ b/egg/meson.build @@ -8,7 +8,7 @@ libegg_deps = [ glib_deps, ] -if with_gcrypt +if get_option('gcrypt') libegg_sources += [ 'egg-dh.c', 'egg-hkdf.c', diff --git a/libsecret/meson.build b/libsecret/meson.build index 2ee8850..69e1a0b 100644 --- a/libsecret/meson.build +++ b/libsecret/meson.build @@ -36,7 +36,7 @@ libsecret_headers = [ 'secret-value.h', ] -if with_gcrypt +if get_option('gcrypt') libsecret_sources += [ 'secret-file-backend.c', 'secret-file-collection.c', @@ -69,14 +69,14 @@ _enums_generated = gnome.mkenums('secret-enum-types', c_template: 'secret-enum-types.c.template', h_template: 'secret-enum-types.h.template', install_header: true, - install_dir: libsecret_prefix / includedir / installed_headers_subdir, + install_dir: get_option('includedir') / installed_headers_subdir, ) libsecret_dependencies = [ glib_deps, ] -if with_gcrypt +if get_option('gcrypt') libsecret_dependencies += gcrypt_dep endif @@ -104,7 +104,7 @@ libsecret_dep = declare_dependency( ) # GObject Introspection -if with_gir +if get_option('introspection') libsecret_gir_sources = [ 'secret-attributes.c', 'secret-attributes.h', @@ -146,16 +146,16 @@ if with_gir extra_args: [ '-D SECRET_COMPILATION'], install: true, ) -endif -# Vapi -if with_vapi and with_gir - libsecret_vapi = gnome.generate_vapi('libsecret-@0@'.format(api_version_major), - sources: libsecret_gir[0], - metadata_dirs: meson.source_root() / 'libsecret', - packages: [ 'gobject-2.0', 'gio-2.0' ], - install: true, - ) + # Vapi + if get_option('vapi') + libsecret_vapi = gnome.generate_vapi('libsecret-@0@'.format(api_version_major), + sources: libsecret_gir[0], + metadata_dirs: meson.source_root() / 'libsecret', + packages: [ 'gobject-2.0', 'gio-2.0' ], + install: true, + ) + endif endif # pkg-config @@ -205,7 +205,7 @@ test_names = [ 'test-collection', ] -if with_gcrypt +if get_option('gcrypt') test_names += [ 'test-file-collection', ] diff --git a/meson.build b/meson.build index d22e008..4ddc548 100644 --- a/meson.build +++ b/meson.build @@ -16,27 +16,10 @@ api_version_micro = api_version.split('.')[2] libtool_version = '0.0.0' -# Options -with_manpage = get_option('manpage') -with_gcrypt = get_option('gcrypt') -enable_debug = get_option('debugging') -with_vapi = get_option('vapi') -with_gtkdoc = get_option('gtk_doc') -with_gir = get_option('introspection') - # Some variables config_h_dir = include_directories('.') build_dir = include_directories('build') libsecret_prefix = get_option('prefix') -datadir = get_option('datadir') -includedir = get_option('includedir') -bindir = get_option('bindir') -libdir = get_option('libdir') -libexecdir = get_option('libexecdir') -locale_dir = get_option('localedir') -pkgdatadir = datadir / meson.project_name() -pkglibdir = libdir / meson.project_name() -sysconfdir = get_option('sysconfdir') po_dir = meson.source_root() / 'po' # Dependencies @@ -48,8 +31,10 @@ glib_deps = [ ] min_libgcrypt_version = '1.2.2' -gcrypt_dep = dependency('libgcrypt', version: '>=' + min_libgcrypt_version, - required: with_gcrypt) +gcrypt_dep = dependency('libgcrypt', + version: '>=' + min_libgcrypt_version, + required: get_option('gcrypt'), +) # Libraries math = meson.get_compiler('c').find_library('m') @@ -58,16 +43,16 @@ math = meson.get_compiler('c').find_library('m') conf = configuration_data() conf.set_quoted('GETTEXT_PACKAGE', meson.project_name()) conf.set_quoted('G_LOG_DOMAIN', meson.project_name()) -conf.set_quoted('LOCALEDIR', libsecret_prefix / locale_dir) +conf.set_quoted('LOCALEDIR', libsecret_prefix / get_option('localedir')) conf.set_quoted('PACKAGE_NAME', meson.project_name()) conf.set_quoted('PACKAGE_STRING', meson.project_name()) conf.set_quoted('PACKAGE_VERSION', meson.project_version()) -conf.set('WITH_GCRYPT', with_gcrypt) -if with_gcrypt +conf.set('WITH_GCRYPT', get_option('gcrypt')) +if get_option('gcrypt') conf.set_quoted('LIBGCRYPT_VERSION', min_libgcrypt_version) endif -conf.set('WITH_DEBUG', enable_debug) -conf.set('_DEBUG', enable_debug) +conf.set('WITH_DEBUG', get_option('debugging')) +conf.set('_DEBUG', get_option('debugging')) conf.set('HAVE_MLOCK', meson.get_compiler('c').has_function('mlock')) configure_file(output: 'config.h', configuration: conf) diff --git a/tool/meson.build b/tool/meson.build index 1bf9a84..8abd247 100644 --- a/tool/meson.build +++ b/tool/meson.build @@ -10,7 +10,7 @@ secret_tool = executable('secret-tool', install: true, ) -if with_gcrypt and host_machine.system() != 'windows' +if get_option('gcrypt') and host_machine.system() != 'windows' test('test-secret-tool.sh', find_program('test-secret-tool.sh'), env: test_env)