diff options
Diffstat (limited to '')
-rw-r--r-- | meson.build | 50 |
1 files changed, 33 insertions, 17 deletions
diff --git a/meson.build b/meson.build index 6a7678d..e296c39 100644 --- a/meson.build +++ b/meson.build @@ -1,9 +1,10 @@ +# SPDX-License-Identifier: GPL-2.0-or-later ################################################################################ project( 'nvme-cli', ['c', 'cpp'], meson_version: '>= 0.47.0', - license: 'LGPLv2+', - version: '2.0', + license: 'GPL-2.0-only', + version: '2.1', default_options: [ 'c_std=gnu99', 'buildtype=release', @@ -29,27 +30,43 @@ systemddir = join_paths(prefixdir, get_option('systemddir')) conf = configuration_data() requires = '' +version_tag = get_option('version-tag') +if version_tag != '' + conf.set('GIT_VERSION', '"@0@"'.format(version_tag)) +else + r = run_command('meson-vcs-tag.sh', + meson.current_source_dir(), + meson.project_version(), + check: true) + conf.set('GIT_VERSION', '"@0@"'.format(r.stdout().strip())) +endif + conf.set('SYSCONFDIR', '"@0@"'.format(sysconfdir)) -libnvme_dep = dependency('libnvme', fallback : ['libnvme', 'libnvme_dep']) +# Check for libnvme availability +libnvme_dep = dependency('libnvme', required: true, + fallback : ['libnvme', 'libnvme_dep']) # Check for libuuid availability -libuuid_dep = dependency('uuid', required: true) +libuuid_dep = dependency('uuid', required: true, + fallback : ['uuid', 'uuid_dep']) conf.set('CONFIG_LIBUUID', libuuid_dep.found(), description: 'Is libuuid available?') # Check for libjson-c availability -json_c_dep = dependency('json-c', version: '>=0.13', fallback : ['json-c', 'json_c_dep']) -if json_c_dep.found() - conf.set('CONFIG_JSONC', true, description: 'Is json-c available?') - if json_c_dep.version().version_compare('>=0.14') - conf.set('CONFIG_JSONC_14', true, description: 'Is json-c at least 0.14?') - requires = 'Requires: json-c >= 0.14' - else - requires = 'Requires: json-c >= 0.13' - endif +json_c_dep = dependency('json-c', required: true, version: '>=0.13', + fallback : ['json-c', 'json_c_dep']) +if json_c_dep.version().version_compare('>=0.14') + conf.set('CONFIG_JSONC_14', true, description: 'Is json-c at least 0.14?') + requires = 'Requires: json-c >= 0.14' +else + requires = 'Requires: json-c >= 0.13' endif -# Check for libhugetlbfs availability +# Check for zlib availability +libz_dep = dependency('zlib', required: true, + fallback : ['zlib', 'zlib_dep']) + +# Check for libhugetlbfs availability (optional) if cc.has_header('hugetlbfs.h') libhugetlbfs_dep = cc.find_library('hugetlbfs', required : false) @@ -60,9 +77,6 @@ else endif conf.set('CONFIG_LIBHUGETLBFS', have_libhugetlbfs, description: 'Is libhugetlbfs available?') -# Check for zlib availability -libz_dep = dependency('zlib', fallback : ['zlib', 'zlib_dep']) - # Set the nvme-cli version conf.set('NVME_VERSION', '"' + meson.project_version() + '"') @@ -232,6 +246,7 @@ sources = [ 'nvme-print.c', 'nvme-rpmb.c', 'plugin.c', + 'wrapper.c', ] subdir('ccan') @@ -245,6 +260,7 @@ executable( sources, dependencies: [ libnvme_dep, libuuid_dep, json_c_dep, libz_dep, libhugetlbfs_dep ], + link_args: '-ldl', include_directories: incdir, install: true, install_dir: sbindir |