]> 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>
Wed, 24 Apr 2024 20:30:26 +0000 (15:30 -0500)
Signed-off-by: Jordan Williams <jordan@jwillikers.com>
meson.build
meson_options.txt

index 466689fd8713f6372995253261bd7283ef5026ae..5fb7e8a0ff259a4ec2053a38c238e9db6332fefb 100644 (file)
@@ -1575,7 +1575,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,
@@ -1589,6 +1591,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,
@@ -1596,12 +1599,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 b057d8426d1576cdbc3f19fab44974d542c4e73b..f14c9352223ebbc4dd2065215b9177d8fd329b65 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',