meson: Convert fidsk to meson feature

By making this a disabler dependency, we can slightly simplify the code
and it als fixes the build for -Dfdisk=disabled as we failed to create a
fallback empty libshared_fdisk variable.
This commit is contained in:
Jan Janssen 2023-08-09 18:07:19 +02:00
parent 43abc59a27
commit 9ee80846f8
4 changed files with 15 additions and 23 deletions

View file

@ -1119,17 +1119,11 @@ endif
libmount = dependency('mount',
version : fuzzer_build ? '>= 0' : '>= 2.30')
want_libfdisk = get_option('fdisk')
if want_libfdisk != 'false' and not skip_deps
libfdisk = dependency('fdisk',
version : '>= 2.32',
required : want_libfdisk == 'true')
have = libfdisk.found()
else
have = false
libfdisk = []
endif
conf.set10('HAVE_LIBFDISK', have)
libfdisk = dependency('fdisk',
version : '>= 2.32',
disabler : true,
required : get_option('fdisk'))
conf.set10('HAVE_LIBFDISK', libfdisk.found())
want_passwdqc = get_option('passwdqc')
want_pwquality = get_option('pwquality')

View file

@ -373,7 +373,7 @@ option('audit', type : 'feature', deprecated : { 'true' : 'enabled', 'false' : '
description : 'libaudit support')
option('blkid', type : 'feature', deprecated : { 'true' : 'enabled', 'false' : 'disabled' },
description : 'libblkid support')
option('fdisk', type : 'combo', choices : ['auto', 'true', 'false'],
option('fdisk', type : 'feature', deprecated : { 'true' : 'enabled', 'false' : 'disabled' },
description : 'libfdisk support')
option('kmod', type : 'feature', deprecated : { 'true' : 'enabled', 'false' : 'disabled' },
description : 'support for loadable modules')

View file

@ -120,7 +120,7 @@ if [ ! -f "$BUILDDIR"/build.ninja ]; then
-D acl=enabled
-D audit=enabled
-D blkid=enabled
-D fdisk=true
-D fdisk=enabled
-D kmod=enabled
-D pam=true
-D pwquality=true

View file

@ -344,13 +344,11 @@ shared_fdisk_sources = files(
'fdisk-util.c',
)
if get_option('fdisk') != 'false'
libshared_fdisk = static_library(
'shared-fdisk',
shared_fdisk_sources,
include_directories : includes,
dependencies : [libfdisk,
userspace],
c_args : ['-fvisibility=default'],
build_by_default : false)
endif
libshared_fdisk = static_library(
'shared-fdisk',
shared_fdisk_sources,
include_directories : includes,
dependencies : [libfdisk,
userspace],
c_args : ['-fvisibility=default'],
build_by_default : false)