]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
meson: Use libmount as a dependency
authorJordan Williams <jordan@jwillikers.com>
Fri, 5 Apr 2024 15:33:22 +0000 (08:33 -0700)
committerJordan Williams <jordan@jwillikers.com>
Fri, 5 Apr 2024 15:33:22 +0000 (08:33 -0700)
Several utilities depend on libmount internally.
Currently, link_with and global include directories are used to
associate targets with libmount.
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 libmount library.
A couple of executables use this dependency explicitly.

Signed-off-by: Jordan Williams <jordan@jwillikers.com>
libmount/meson.build
libmount/python/meson.build
meson.build

index d1262e7f044039369958d6ead857782a7bdb436d..ea363a0d5235e5030b97e3c0eef40addc181bcc7 100644 (file)
@@ -80,6 +80,7 @@ lib_mount_static = static_library(
                lib_blkid.get_static_lib()],
   dependencies : [realtime_libs],
   install : false)
+mount_static_dep = declare_dependency(link_with: lib_mount_static, include_directories: '.')
 
 lib__mount_deps = [
   lib_selinux,
index e1a79d187d26ee961be73bce40e8bcb95f309478..702ca8f378ab9045138ade856ea2cd63c637dd90 100644 (file)
@@ -21,10 +21,9 @@ if build_python
   python.extension_module(
     'pylibmount',
     pylibmount_sources,
-    include_directories : [dir_include, dir_libmount],
+    include_directories : [dir_include],
     subdir : 'libmount',
-    link_with : lib_mount,
-    dependencies : python.dependency(),
+    dependencies : [mount_dep, python.dependency()],
     c_args : [
       '-Wno-cast-function-type',
 
index 688ea9120210286b9010ea8b15b39ebdb13aa6d5..0b0dc27c1221cd85ede4275085e9c10ec974f95a 100644 (file)
@@ -975,7 +975,6 @@ subdir('po')
 includes = [dir_include,
             dir_libblkid,
             dir_libsmartcols,
-            dir_libmount,
             dir_libfdisk,
             dir_libuuid,
             dir_liblastlog2,
@@ -1503,8 +1502,8 @@ exe = executable(
   'fstrim',
   fstrim_sources,
   include_directories : includes,
-  link_with : [lib_common,
-               lib_mount],
+  link_with : [lib_common],
+  dependencies : [mount_dep],
   install_dir : sbindir,
   install : true)
 if not is_disabler(exe)
@@ -1654,8 +1653,8 @@ exe = executable(
   'eject',
   eject_sources,
   include_directories : includes,
-  link_with : [lib_common,
-               lib_mount],
+  link_with : [lib_common],
+  dependencies : [mount_dep],
   install_dir : usrbin_exec_dir,
   install : opt,
   build_by_default : opt)
@@ -1731,8 +1730,8 @@ exe = executable(
   lsns_sources,
   include_directories : includes,
   link_with : [lib_common,
-               lib_smartcols,
-               lib_mount],
+               lib_smartcols],
+  dependencies : [mount_dep],
   install_dir : usrbin_exec_dir,
   install : true)
 if not is_disabler(exe)
@@ -1747,9 +1746,8 @@ exe = executable(
   mount_sources,
   include_directories : includes,
   link_with : [lib_common,
-               lib_smartcols,
-               lib_mount],
-  dependencies : lib_selinux,
+               lib_smartcols],
+  dependencies : [lib_selinux, mount_dep],
   install_mode : 'rwsr-xr-x',
   install : opt,
   build_by_default : opt)
@@ -1757,8 +1755,8 @@ exe2 = executable(
   'umount',
   umount_sources,
   include_directories : includes,
-  link_with : [lib_common,
-               lib_mount],
+  link_with : [lib_common],
+  dependencies : [mount_dep],
   install_mode : 'rwsr-xr-x',
   install : opt,
   build_by_default : opt)
@@ -1777,8 +1775,8 @@ exe = executable(
   include_directories : includes,
   link_args : ['--static'],
   link_with : [lib_common,
-               lib_smartcols_static,
-               lib_mount_static],
+               lib_smartcols_static],
+  dependencies : [mount_static_dep],
   install : opt2,
   build_by_default : opt2)
 if opt2 and not is_disabler(exe)
@@ -1791,8 +1789,8 @@ exe = executable(
   umount_sources,
   include_directories : includes,
   link_args : ['--static'],
-  link_with : [lib_common,
-               lib_mount_static],
+  link_with : [lib_common],
+  dependencies : [mount_static_dep],
   install : opt2,
   build_by_default : opt2)
 if opt2 and not is_disabler(exe)
@@ -1807,8 +1805,8 @@ exe = executable(
   include_directories : includes,
   link_with : [lib_common,
                lib_blkid,
-               lib_mount,
                lib_smartcols],
+  dependencies : [mount_dep],
   install_dir : sbindir,
   install : true)
 if not is_disabler(exe)
@@ -1822,8 +1820,8 @@ exe = executable(
   swapoff_sources,
   include_directories : includes,
   link_with : [lib_common,
-               lib_blkid,
-               lib_mount],
+               lib_blkid],
+  dependencies : [mount_dep],
   install_dir : sbindir,
   install : true)
 if not is_disabler(exe)
@@ -1876,7 +1874,7 @@ exe = executable(
   'mountpoint',
   mountpoint_sources,
   include_directories : includes,
-  link_with : [lib_mount],
+  dependencies : [mount_dep],
   install : opt,
   build_by_default : opt)
 if opt and not is_disabler(exe)
@@ -1936,6 +1934,7 @@ exe = executable(
   unshare_sources,
   include_directories : includes,
   link_with : [lib_common],
+  dependencies : [mount_dep],
   install_dir : usrbin_exec_dir,
   install : opt,
   build_by_default : opt)
@@ -1951,6 +1950,7 @@ exe = executable(
   unshare_sources,
   include_directories : includes,
   link_with : [lib_common],
+  dependencies : [mount_dep],
   install_dir : usrbin_exec_dir,
   install : opt,
   build_by_default : opt)
@@ -2156,9 +2156,8 @@ exe = executable(
   fsck_sources,
   include_directories : includes,
   link_with : [lib_common,
-               lib_blkid,
-               lib_mount],
-  dependencies : realtime_libs,
+               lib_blkid],
+  dependencies : [realtime_libs, mount_dep],
   install_dir : sbindir,
   install : opt,
   build_by_default : opt)
@@ -2345,9 +2344,8 @@ exe = executable(
   link_with : [lib_common,
                lib_fdisk,
                lib_smartcols,
-               lib_tcolors,
-               lib_mount],
-  dependencies : [curses_libs],
+               lib_tcolors],
+  dependencies : [curses_libs, mount_dep],
   install_dir : sbindir,
   install : opt,
   build_by_default : opt)
@@ -2731,8 +2729,8 @@ exe = executable(
   lslocks_sources,
   include_directories : includes,
   link_with : [lib_common,
-               lib_mount,
                lib_smartcols],
+  dependencies : [mount_dep],
   install_dir : usrbin_exec_dir,
   install : true)
 if not is_disabler(exe)
@@ -2747,10 +2745,9 @@ exe = executable(
   include_directories : includes,
   link_with : [lib_common,
                lib_blkid,
-               lib_mount,
                lib_tcolors,
                lib_smartcols],
-  dependencies : lib_udev,
+  dependencies : [lib_udev, mount_dep],
   install : true)
 if not is_disabler(exe)
   exes += exe
@@ -2947,9 +2944,8 @@ exe = executable(
   include_directories : includes,
   link_with : [lib_common,
                lib_blkid,
-               lib_mount,
                lib_smartcols],
-  dependencies : [lib_udev],
+  dependencies : [lib_udev, mount_dep],
   install : true)
 if not is_disabler(exe)
   exes += exe