]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
meson: Add build-blkdiscard option
authorJordan Williams <jordan@jwillikers.com>
Wed, 24 Apr 2024 20:30:26 +0000 (15:30 -0500)
committerJordan Williams <jordan@jwillikers.com>
Thu, 25 Apr 2024 12:30:54 +0000 (07:30 -0500)
Signed-off-by: Jordan Williams <jordan@jwillikers.com>
(cherry picked from commit 9c4ef6f71169c48cee60523d851ff0b453a1d52f)

meson.build
meson_options.txt

index 60cdc40cde36a7a95fef511350f6e808de4be088..0fb11089327829fb4910e105c9495caf344f68b9 100644 (file)
@@ -1564,7 +1564,9 @@ exes += exe
 manadocs += ['sys-utils/ctrlaltdel.8.adoc']
 bashcompletions += ['ctrlaltdel']
 
-opt = get_option('build-fsfreeze').require(conf.get('HAVE_LINUX_FS_H').to_string() == '1').allowed()
+have_linux_fs_h = conf.get('HAVE_LINUX_FS_H').to_string() == '1'
+
+opt = get_option('build-fsfreeze').require(have_linux_fs_h).allowed()
 exe = executable(
   'fsfreeze',
   fsfreeze_sources,
@@ -1578,6 +1580,7 @@ if opt and not is_disabler(exe)
   bashcompletions += ['fsfreeze']
 endif
 
+opt = get_option('build-blkdiscard').require(have_linux_fs_h).allowed()
 exe = executable(
   'blkdiscard',
   blkdiscard_sources,
@@ -1585,12 +1588,15 @@ exe = executable(
   link_with : [lib_common],
   dependencies : [blkid_dep],
   install_dir : sbindir,
-  install : true)
-exes += exe
-manadocs += ['sys-utils/blkdiscard.8.adoc']
-bashcompletions += ['blkdiscard']
+  install : opt,
+  build_by_default : opt)
+if opt and not is_disabler(exe)
+  exes += exe
+  manadocs += ['sys-utils/blkdiscard.8.adoc']
+  bashcompletions += ['blkdiscard']
+endif
 
-opt = get_option('build-blkzone').require(cc.has_header('linux/blkzoned.h')).allowed()
+opt = get_option('build-blkzone').require(have_linux_fs_h).allowed()
 exe = executable(
   'blkzone',
   blkzone_sources,
index 930e96bd3a13d3ddac1ffde575974949e900a4e3..c91a1cbfde75a09167d7450457038d263085d80b 100644 (file)
@@ -143,6 +143,8 @@ option('build-dmesg', type : 'feature',
        description : 'build dmesg')
 option('build-fsfreeze', type : 'feature',
        description : 'build fsfreeze')
+option('build-blkdiscard', type : 'feature',
+       description : 'build blkdiscard')
 option('build-blkzone', type : 'feature',
        description : 'build blkzone')
 option('build-blkpr', type : 'feature',