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 <rosenp@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/19598
Signed-off-by: Nick Hainke <vincent@systemli.org>
This commit is contained in:
Rosen Penev 2025-07-29 13:46:18 -07:00 committed by Nick Hainke
parent fd123d6d13
commit e15d5cf752
4 changed files with 54 additions and 58 deletions

View File

@ -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
include $(INCLUDE_DIR)/meson.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
MESON_HOST_ARGS += \
-Dauto_features=disabled \
-Dbuild-hexdump=enabled \
-Dbuild-libuuid=enabled \
-Dncurses=enabled \
-Dprogram-tests=false
$(eval $(call HostBuild))

View File

@ -0,0 +1,24 @@
From c1ca5ec4a5c6a0e4acbdcc6ff4e4fa2109c1ec24 Mon Sep 17 00:00:00 2001
From: Rosen Penev <rosenp@gmail.com>
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 <rosenp@gmail.com>
---
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',

View File

@ -0,0 +1,23 @@
From 946c0b9c6f6481ed9370b8bd0f54a622a0c4a574 Mon Sep 17 00:00:00 2001
From: Martin Valgur <martin.valgur@gmail.com>
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]: <ExternalLibrary rt: True>> 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'

View File

@ -1,23 +0,0 @@
From 15bc69131a1e08019096251ea848104e57d99a12 Mon Sep 17 00:00:00 2001
From: Rosen Penev <rosenp@gmail.com>
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 <rosenp@gmail.com>
---
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