From: Jordan Williams Date: Mon, 15 Apr 2024 13:02:05 +0000 (-0500) Subject: meson: Use libblkid as a dependency X-Git-Tag: v2.40.1-rc1~32^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1443a1852472181c2c1f6e6dd7085b88805b9e0d;p=thirdparty%2Futil-linux.git 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 (cherry picked from commit a764efb5fb14b9a66bff8807c04ddcebc51939ea) --- diff --git a/libblkid/meson.build b/libblkid/meson.build index 5a28bdfcb..b2161c621 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 eaab9e138..57dda5cfa 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 ea363a0d5..2534191fa 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 d2c0d3d6b..00d0d3290 100644 --- a/meson.build +++ b/meson.build @@ -969,7 +969,6 @@ subdir('term-utils') subdir('po') includes = [dir_include, - dir_libblkid, dir_libsmartcols, dir_libfdisk, dir_libuuid, @@ -1557,8 +1556,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 @@ -1799,9 +1798,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) @@ -1814,9 +1812,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) @@ -2119,9 +2116,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) @@ -2135,8 +2131,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) @@ -2150,9 +2146,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) @@ -2382,8 +2377,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) @@ -2696,10 +2691,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 @@ -2786,8 +2780,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) @@ -2802,8 +2796,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) @@ -2815,7 +2809,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 @@ -2824,7 +2818,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 @@ -2833,7 +2827,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 @@ -2842,7 +2836,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 @@ -2851,7 +2845,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 @@ -2863,7 +2857,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) @@ -2877,8 +2871,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) @@ -2892,9 +2886,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 @@ -3319,7 +3312,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', @@ -3327,6 +3321,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 @@ -3338,6 +3333,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 @@ -3349,6 +3345,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 @@ -3360,6 +3357,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 @@ -3371,6 +3369,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 @@ -3382,6 +3381,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