aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJordan Williams <jordan@jwillikers.com>2024-04-05 08:30:02 -0700
committerJordan Williams <jordan@jwillikers.com>2024-04-05 08:33:25 -0700
commita764efb5fb14b9a66bff8807c04ddcebc51939ea (patch)
tree9b8495ed3166ebad84e542dfef2d27f5feb691d1
parentc43b185a3feb8cd7261c94f42a566486ce2c0438 (diff)
downloadutil-linux-a764efb5fb14b9a66bff8807c04ddcebc51939ea.tar.gz
meson: Use libblkid as a dependency
Several utilities depend on libblkid internally. Currently, link_with and global include directories are used to associate targets with libblkid. This PR uses Meson's dependencies argument for targets to define this relationship instead. This carries include directories along with the library to link. An additional dependency is declared for the static libblkid library. A couple of executables use this dependency explicitly. Signed-off-by: Jordan Williams <jordan@jwillikers.com>
-rw-r--r--libblkid/meson.build1
-rw-r--r--libfdisk/meson.build4
-rw-r--r--libmount/meson.build23
-rw-r--r--meson.build64
4 files changed, 45 insertions, 47 deletions
diff --git a/libblkid/meson.build b/libblkid/meson.build
index 5a28bdfcb8..b2161c6214 100644
--- a/libblkid/meson.build
+++ b/libblkid/meson.build
@@ -145,6 +145,7 @@ lib_blkid = both_libraries(
blkid_dep = declare_dependency(link_with: lib_blkid, include_directories: '.')
lib_blkid_static = lib_blkid.get_static_lib()
+blkid_static_dep = declare_dependency(link_with: lib_blkid_static, include_directories: '.')
if build_libblkid
pkgconfig.generate(lib_blkid,
diff --git a/libfdisk/meson.build b/libfdisk/meson.build
index eaab9e1389..57dda5cfa9 100644
--- a/libfdisk/meson.build
+++ b/libfdisk/meson.build
@@ -60,8 +60,8 @@ lib_fdisk_static = static_library(
'fdisk_static',
link_whole : lib__fdisk,
link_with : [lib_common,
- lib_blkid.get_static_lib(),
lib_uuid.get_static_lib()],
+ dependencies : [blkid_static_dep],
install : false)
lib_fdisk = library(
@@ -71,8 +71,8 @@ lib_fdisk = library(
version : libfdisk_version,
link_args : ['-Wl,--version-script=@0@'.format(libfdisk_sym_path)],
link_with : [lib_common,
- lib_blkid,
lib_uuid],
+ dependencies : [blkid_dep],
install : build_libfdisk)
fdisk_dep = declare_dependency(link_with: lib_fdisk, include_directories: '.')
diff --git a/libmount/meson.build b/libmount/meson.build
index ea363a0d52..2534191faf 100644
--- a/libmount/meson.build
+++ b/libmount/meson.build
@@ -70,15 +70,14 @@ lib__mount = static_library(
'_mount',
lib_mount_sources,
include_directories : [dir_include,
- dir_libmount,
- dir_libblkid])
+ dir_libmount],
+ dependencies : [blkid_dep])
lib_mount_static = static_library(
'mount_static',
link_whole : lib__mount,
- link_with : [lib_common,
- lib_blkid.get_static_lib()],
- dependencies : [realtime_libs],
+ link_with : [lib_common],
+ dependencies : [blkid_static_dep, realtime_libs],
install : false)
mount_static_dep = declare_dependency(link_with: lib_mount_static, include_directories: '.')
@@ -91,14 +90,12 @@ lib_mount = library(
'mount',
link_whole : lib__mount,
include_directories : [dir_include,
- dir_libmount,
- dir_libblkid],
+ dir_libmount],
link_depends : libmount_sym,
version : libmount_version,
link_args : ['-Wl,--version-script=@0@'.format(libmount_sym_path)],
- link_with : [lib_common,
- lib_blkid],
- dependencies : lib__mount_deps,
+ link_with : [lib_common],
+ dependencies : lib__mount_deps + blkid_dep,
install : build_libmount)
mount_dep = declare_dependency(link_with: lib_mount, include_directories: '.')
@@ -137,9 +134,9 @@ if program_tests
exe = executable(
test_name,
'src/' + libmount_test_src_override.get(libmount_test, libmount_test) + '.c',
- include_directories : [dir_include, dir_libblkid],
- link_with : [lib__mount, lib_common, lib_blkid_static],
- dependencies : lib__mount_deps,
+ include_directories : [dir_include],
+ link_with : [lib__mount, lib_common],
+ dependencies : lib__mount_deps + blkid_static_dep,
c_args : ['-DTEST_PROGRAM'],
)
# the test-setup expects the helpers in the toplevel build-directory
diff --git a/meson.build b/meson.build
index 0b0dc27c12..6c45947308 100644
--- a/meson.build
+++ b/meson.build
@@ -973,7 +973,6 @@ subdir('term-utils')
subdir('po')
includes = [dir_include,
- dir_libblkid,
dir_libsmartcols,
dir_libfdisk,
dir_libuuid,
@@ -1562,8 +1561,8 @@ exe = executable(
'blkdiscard',
blkdiscard_sources,
include_directories : includes,
- link_with : [lib_common,
- lib_blkid],
+ link_with : [lib_common],
+ dependencies : [blkid_dep],
install_dir : sbindir,
install : true)
exes += exe
@@ -1804,9 +1803,8 @@ exe = executable(
swapon_sources,
include_directories : includes,
link_with : [lib_common,
- lib_blkid,
lib_smartcols],
- dependencies : [mount_dep],
+ dependencies : [blkid_dep, mount_dep],
install_dir : sbindir,
install : true)
if not is_disabler(exe)
@@ -1819,9 +1817,8 @@ exe = executable(
'swapoff',
swapoff_sources,
include_directories : includes,
- link_with : [lib_common,
- lib_blkid],
- dependencies : [mount_dep],
+ link_with : [lib_common],
+ dependencies : [blkid_dep, mount_dep],
install_dir : sbindir,
install : true)
if not is_disabler(exe)
@@ -2124,9 +2121,8 @@ exe = executable(
mkswap_sources,
include_directories : includes,
link_with : [lib_common,
- lib_blkid,
lib_uuid],
- dependencies: [lib_selinux],
+ dependencies: [blkid_dep, lib_selinux],
install_dir : sbindir,
install : true)
if not is_disabler(exe)
@@ -2140,8 +2136,8 @@ exe = executable(
swaplabel_sources,
include_directories : includes,
link_with : [lib_common,
- lib_blkid,
lib_uuid],
+ dependencies : [blkid_dep],
install_dir : sbindir,
install : true)
if not is_disabler(exe)
@@ -2155,9 +2151,8 @@ exe = executable(
'fsck',
fsck_sources,
include_directories : includes,
- link_with : [lib_common,
- lib_blkid],
- dependencies : [realtime_libs, mount_dep],
+ link_with : [lib_common],
+ dependencies : [blkid_dep, mount_dep, realtime_libs],
install_dir : sbindir,
install : opt,
build_by_default : opt)
@@ -2387,8 +2382,8 @@ exe4 = executable(
partx_sources,
include_directories : includes,
link_with : [lib_common,
- lib_blkid,
lib_smartcols],
+ dependencies : [blkid_dep],
install_dir : usrsbin_exec_dir,
install : opt,
build_by_default : opt)
@@ -2434,8 +2429,8 @@ exe4 = executable(
include_directories : includes,
link_args : ['--static'],
link_with : [lib_common,
- lib_blkid.get_static_lib(),
lib_smartcols.get_static_lib()],
+ dependencies : [blkid_static_dep],
install_dir : usrsbin_exec_dir,
install : opt,
build_by_default : opt)
@@ -2744,10 +2739,9 @@ exe = executable(
lsblk_sources,
include_directories : includes,
link_with : [lib_common,
- lib_blkid,
lib_tcolors,
lib_smartcols],
- dependencies : [lib_udev, mount_dep],
+ dependencies : [blkid_dep, lib_udev, mount_dep],
install : true)
if not is_disabler(exe)
exes += exe
@@ -2837,8 +2831,8 @@ exe = executable(
'blkid',
blkid_sources,
include_directories : includes,
- link_with : [lib_common,
- lib_blkid],
+ link_with : [lib_common],
+ dependencies : [blkid_dep],
install_dir : sbindir,
install : opt,
build_by_default : opt)
@@ -2853,8 +2847,8 @@ exe = executable(
'blkid.static',
blkid_sources,
include_directories : includes,
- link_with : [lib_common,
- lib_blkid_static],
+ link_with : [lib_common],
+ dependencies : [blkid_static_dep],
install_dir : sbindir,
install : opt,
build_by_default : opt)
@@ -2866,7 +2860,7 @@ exe = executable(
'sample-mkfs',
'libblkid/samples/mkfs.c',
include_directories : includes,
- link_with : lib_blkid)
+ dependencies : [blkid_dep])
if not is_disabler(exe)
exes += exe
endif
@@ -2875,7 +2869,7 @@ exe = executable(
'sample-partitions',
'libblkid/samples/partitions.c',
include_directories : includes,
- link_with : lib_blkid)
+ dependencies : [blkid_dep])
if not is_disabler(exe)
exes += exe
endif
@@ -2884,7 +2878,7 @@ exe = executable(
'sample-superblocks',
'libblkid/samples/superblocks.c',
include_directories : includes,
- link_with : lib_blkid)
+ dependencies : [blkid_dep])
if not is_disabler(exe)
exes += exe
endif
@@ -2893,7 +2887,7 @@ exe = executable(
'sample-topology',
'libblkid/samples/topology.c',
include_directories : includes,
- link_with : lib_blkid)
+ dependencies : [blkid_dep])
if not is_disabler(exe)
exes += exe
endif
@@ -2902,7 +2896,7 @@ exe = executable(
'test_blkid_fuzz_sample',
'libblkid/src/fuzz.c',
include_directories: includes,
- link_with: lib_blkid,
+ dependencies : [blkid_dep],
build_by_default: program_tests)
if not is_disabler(exe)
exes += exe
@@ -2914,7 +2908,7 @@ exe = executable(
'findfs',
findfs_sources,
include_directories : includes,
- link_with : [lib_blkid],
+ dependencies : [blkid_dep],
install_dir : sbindir,
install : true)
if not is_disabler(exe)
@@ -2928,8 +2922,8 @@ exe = executable(
wipefs_sources,
include_directories : includes,
link_with : [lib_common,
- lib_blkid,
lib_smartcols],
+ dependencies : [blkid_dep],
install_dir : sbindir,
install : true)
if not is_disabler(exe)
@@ -2943,9 +2937,8 @@ exe = executable(
findmnt_sources,
include_directories : includes,
link_with : [lib_common,
- lib_blkid,
lib_smartcols],
- dependencies : [lib_udev, mount_dep],
+ dependencies : [blkid_dep, lib_udev, mount_dep],
install : true)
if not is_disabler(exe)
exes += exe
@@ -3370,7 +3363,8 @@ endif
############################################################
libfdisk_tests_cflags = ['-DTEST_PROGRAM']
-libfdisk_tests_ldadd = [lib_fdisk_static, lib_uuid, lib_blkid]
+libfdisk_tests_ldadd = [lib_fdisk_static, lib_uuid]
+libfdisk_tests_ldadd_deps = [blkid_dep]
exe = executable(
'test_fdisk_ask',
@@ -3378,6 +3372,7 @@ exe = executable(
c_args : libfdisk_tests_cflags,
include_directories : lib_fdisk_includes,
link_with : libfdisk_tests_ldadd,
+ dependencies : libfdisk_tests_ldadd_deps,
build_by_default: program_tests)
if not is_disabler(exe)
exes += exe
@@ -3389,6 +3384,7 @@ exe = executable(
c_args : libfdisk_tests_cflags,
include_directories : lib_fdisk_includes,
link_with : libfdisk_tests_ldadd,
+ dependencies : libfdisk_tests_ldadd_deps,
build_by_default: program_tests)
if not is_disabler(exe)
exes += exe
@@ -3400,6 +3396,7 @@ exe = executable(
c_args : libfdisk_tests_cflags,
include_directories : lib_fdisk_includes,
link_with : libfdisk_tests_ldadd,
+ dependencies : libfdisk_tests_ldadd_deps,
build_by_default: program_tests)
if not is_disabler(exe)
exes += exe
@@ -3411,6 +3408,7 @@ exe = executable(
c_args : libfdisk_tests_cflags,
include_directories : lib_fdisk_includes,
link_with : libfdisk_tests_ldadd,
+ dependencies : libfdisk_tests_ldadd_deps,
build_by_default: program_tests)
if not is_disabler(exe)
exes += exe
@@ -3422,6 +3420,7 @@ exe = executable(
c_args : libfdisk_tests_cflags,
include_directories : lib_fdisk_includes,
link_with : libfdisk_tests_ldadd,
+ dependencies : libfdisk_tests_ldadd_deps,
build_by_default: program_tests)
if not is_disabler(exe)
exes += exe
@@ -3433,6 +3432,7 @@ exe = executable(
c_args : libfdisk_tests_cflags,
include_directories : lib_fdisk_includes,
link_with : libfdisk_tests_ldadd,
+ dependencies : libfdisk_tests_ldadd_deps,
build_by_default: program_tests)
if not is_disabler(exe)
exes += exe