]> 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>
Mon, 15 Apr 2024 12:57:33 +0000 (07:57 -0500)
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>
(cherry picked from commit c43b185a3feb8cd7261c94f42a566486ce2c0438)

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 bd8d0e394b4ab8b75cc885e7ffb1081e1116d8ba..d2c0d3d6bc496b1bf60ad502249e84ae41ab2274 100644 (file)
@@ -971,7 +971,6 @@ subdir('po')
 includes = [dir_include,
             dir_libblkid,
             dir_libsmartcols,
-            dir_libmount,
             dir_libfdisk,
             dir_libuuid,
             dir_liblastlog2,
@@ -1498,8 +1497,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)
@@ -1649,8 +1648,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)
@@ -1726,8 +1725,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)
@@ -1742,9 +1741,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)
@@ -1752,8 +1750,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)
@@ -1772,8 +1770,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)
@@ -1786,8 +1784,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)
@@ -1802,8 +1800,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)
@@ -1817,8 +1815,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)
@@ -1871,7 +1869,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)
@@ -1931,6 +1929,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)
@@ -1946,6 +1945,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)
@@ -2151,9 +2151,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)
@@ -2340,9 +2339,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)
@@ -2683,8 +2681,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)
@@ -2699,10 +2697,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
@@ -2896,9 +2893,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