]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
meson: Use libblkid as a dependency
authorJordan Williams <jordan@jwillikers.com>
Fri, 5 Apr 2024 15:30:02 +0000 (08:30 -0700)
committerJordan Williams <jordan@jwillikers.com>
Fri, 5 Apr 2024 15:33:25 +0000 (08:33 -0700)
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>
libblkid/meson.build
libfdisk/meson.build
libmount/meson.build
meson.build

index 5a28bdfcb84e1fc6befc145dc9fafaa17e570270..b2161c6214144ada86fad0bc1007bafc34663b0c 100644 (file)
@@ -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,
index eaab9e13895fcf8d4f9dbb95ee5841fb72f80163..57dda5cfa9906f3022f89a65cf53d911390af7ab 100644 (file)
@@ -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: '.')
 
index ea363a0d5235e5030b97e3c0eef40addc181bcc7..2534191faf90c25299e19f07aba6992435493cd8 100644 (file)
@@ -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
index 0b0dc27c1221cd85ede4275085e9c10ec974f95a..6c459473086d592bc6d8d0f5574dc24b75d0101b 100644 (file)
@@ -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