From e15d5cf7522e1d921b42305447990cab6f3e809e Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Tue, 29 Jul 2025 13:46:18 -0700 Subject: [PATCH] tools/util-linux: build with meson Simplifies Makefile by quite a bit. Added an upstream backport fixing compilation with older OS. Added a curses patch so -Dauto_features=disabled can work properly. Signed-off-by: Rosen Penev Link: https://github.com/openwrt/openwrt/pull/19598 Signed-off-by: Nick Hainke --- tools/util-linux/Makefile | 44 ++++--------------- .../util-linux/patches/010-meson-curses.patch | 24 ++++++++++ ...a-bug-in-posixipc_libs-configuration.patch | 23 ++++++++++ .../patches/110-move-libpthread-to-libs.patch | 23 ---------- 4 files changed, 55 insertions(+), 59 deletions(-) create mode 100644 tools/util-linux/patches/010-meson-curses.patch create mode 100644 tools/util-linux/patches/110-meson-fix-a-bug-in-posixipc_libs-configuration.patch delete mode 100644 tools/util-linux/patches/110-move-libpthread-to-libs.patch diff --git a/tools/util-linux/Makefile b/tools/util-linux/Makefile index fd90f31b5f3..23c39103b1b 100644 --- a/tools/util-linux/Makefile +++ b/tools/util-linux/Makefile @@ -14,42 +14,14 @@ PKG_SOURCE_URL:=@KERNEL/linux/utils/$(PKG_NAME)/v2.41 PKG_HASH:=be9ad9a276f4305ab7dd2f5225c8be1ff54352f565ff4dede9628c1aaa7dec57 PKG_CPE_ID:=cpe:/a:kernel:util-linux -PKG_FIXUP:=autoreconf - -HOST_BUILD_PARALLEL:=1 - include $(INCLUDE_DIR)/host-build.mk - -HOST_CONFIGURE_ARGS += \ - --with-pic \ - --disable-shared \ - --disable-nls \ - --disable-all-programs \ - --enable-hexdump \ - --enable-libuuid \ - --without-util \ - --without-selinux \ - --without-audit \ - --without-udev \ - --without-ncursesw \ - --without-ncurses \ - --without-slang \ - --without-tinfo \ - --without-readline \ - --without-utempter \ - --without-cap-ng \ - --without-libz \ - --without-libmagic \ - --without-user \ - --without-btrfs \ - --without-systemd \ - --without-smack \ - --without-econf \ - --without-python \ - --without-cryptsetup - -define Host/Uninstall - -$(call Host/Compile/Default,uninstall) -endef +include $(INCLUDE_DIR)/meson.mk + +MESON_HOST_ARGS += \ + -Dauto_features=disabled \ + -Dbuild-hexdump=enabled \ + -Dbuild-libuuid=enabled \ + -Dncurses=enabled \ + -Dprogram-tests=false $(eval $(call HostBuild)) diff --git a/tools/util-linux/patches/010-meson-curses.patch b/tools/util-linux/patches/010-meson-curses.patch new file mode 100644 index 00000000000..80c28eedbd7 --- /dev/null +++ b/tools/util-linux/patches/010-meson-curses.patch @@ -0,0 +1,24 @@ +From c1ca5ec4a5c6a0e4acbdcc6ff4e4fa2109c1ec24 Mon Sep 17 00:00:00 2001 +From: Rosen Penev +Date: Wed, 30 Jul 2025 14:13:07 -0700 +Subject: [PATCH] meson: use curses for the non wide version + +The curses dependency in meson in special in that it uses a combination +of pkg-config, config-tool, and various system lookups to find it. + +Signed-off-by: Rosen Penev +--- + meson.build | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/meson.build ++++ b/meson.build +@@ -289,7 +289,7 @@ if lib_ncursesw.found() + lib_ncurses = disabler() + else + lib_ncurses = dependency( +- 'ncurses', ++ 'curses', + disabler : true, + required : get_option('ncurses')) + headers += ['ncurses.h', diff --git a/tools/util-linux/patches/110-meson-fix-a-bug-in-posixipc_libs-configuration.patch b/tools/util-linux/patches/110-meson-fix-a-bug-in-posixipc_libs-configuration.patch new file mode 100644 index 00000000000..a6ec1b83d09 --- /dev/null +++ b/tools/util-linux/patches/110-meson-fix-a-bug-in-posixipc_libs-configuration.patch @@ -0,0 +1,23 @@ +From 946c0b9c6f6481ed9370b8bd0f54a622a0c4a574 Mon Sep 17 00:00:00 2001 +From: Martin Valgur +Date: Tue, 15 Apr 2025 16:19:21 +0300 +Subject: [PATCH] meson: fix a bug in posixipc_libs configuration + +Should append instead of assigning. Otherwise fails with + +meson.build:1482:22: ERROR: Object <[ExternalLibraryHolder] holds [ExternalLibrary]: > of type ExternalLibrary does not support the `+` operator. +--- + meson.build | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/meson.build ++++ b/meson.build +@@ -1473,7 +1473,7 @@ has_seminfo_type = cc.has_type('struct s + + posixipc_libs = [] + if not cc.has_function('shm_open') and conf.get('HAVE_SYS_MMAN_H').to_string() == '1' +- posixipc_libs = cc.find_library('rt', required : true) ++ posixipc_libs += cc.find_library('rt', required : true) + endif + + if not cc.has_function('sem_close') and conf.get('HAVE_SEMAPHORE_H').to_string() == '1' diff --git a/tools/util-linux/patches/110-move-libpthread-to-libs.patch b/tools/util-linux/patches/110-move-libpthread-to-libs.patch deleted file mode 100644 index 996402d143d..00000000000 --- a/tools/util-linux/patches/110-move-libpthread-to-libs.patch +++ /dev/null @@ -1,23 +0,0 @@ -From 15bc69131a1e08019096251ea848104e57d99a12 Mon Sep 17 00:00:00 2001 -From: Rosen Penev -Date: Sun, 27 Jul 2025 11:55:56 -0700 -Subject: [PATCH] move libpthread to Libs - -OpewWrt uses static host libraries and as such dependant libraries must -be moved to public Libs. meson handles this automatically but Autotools -does not. - -Signed-off-by: Rosen Penev ---- - libuuid/uuid.pc.in | 3 +-- - 1 file changed, 1 insertion(+), 2 deletions(-) - ---- a/libuuid/uuid.pc.in -+++ b/libuuid/uuid.pc.in -@@ -7,5 +7,4 @@ Name: uuid - Description: Universally unique id library - Version: @LIBUUID_VERSION@ - Cflags: -I${includedir}/uuid --Libs.private: @SOCKET_LIBS@ -lpthread --Libs: -L${libdir} -luuid -+Libs: -L${libdir} -luuid @SOCKET_LIBS@ -lpthread -- 2.47.2