util-linux: use meson to build
authorRosen Penev <rosenp@gmail.com>
Sat, 30 Apr 2022 01:41:45 +0000 (18:41 -0700)
committerChristian Lamparter <chunkeey@gmail.com>
Sun, 15 May 2022 14:32:40 +0000 (16:32 +0200)
Compiles faster, is PIC by default, and does not have pkgconfig files
with wrong paths.

Add various fixes to it as it seems cross compilation was never tested.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
17 files changed:
package/utils/util-linux/Makefile
package/utils/util-linux/patches/010-meson-typo.patch [new file with mode: 0644]
package/utils/util-linux/patches/020-meson-fix-compilation-without-systemd.patch [new file with mode: 0644]
package/utils/util-linux/patches/030-meson-don-t-use-run.patch [new file with mode: 0644]
package/utils/util-linux/patches/040-meson-fix-cpu_set_t-test.patch [new file with mode: 0644]
package/utils/util-linux/patches/050-meson-fix-environ-search.patch [new file with mode: 0644]
package/utils/util-linux/patches/060-meson-add-_GNU_SOURCE-for-sighandler_t.patch [new file with mode: 0644]
package/utils/util-linux/patches/070-meson-fix-isnan-check.patch [new file with mode: 0644]
package/utils/util-linux/patches/080-meson-fix-tzname-check.patch [new file with mode: 0644]
package/utils/util-linux/patches/090-meson-libpam.patch [new file with mode: 0644]
package/utils/util-linux/patches/100-meson-make-libcap-ng-dependent-on-setpriv.patch [new file with mode: 0644]
package/utils/util-linux/patches/100-use_urandom.patch [deleted file]
package/utils/util-linux/patches/110-meson-fix-when-HAVE_CLOCK_GETTIME-is-set.patch [new file with mode: 0644]
package/utils/util-linux/patches/120-meson-get-the-project-version-from-the-version-gen-s.patch [new file with mode: 0644]
package/utils/util-linux/patches/130-meson-fix-error-in-processing-version-for-pc-files.patch [new file with mode: 0644]
package/utils/util-linux/patches/200-meson-no-po.patch [new file with mode: 0644]
package/utils/util-linux/patches/210-use-urandom.patch [new file with mode: 0644]

index a93c9f6fdc6f075a1f883970d3c2ed689f8b9459..706c3194b19db3c5a74aebb1dd294651c7bf2c75 100644 (file)
@@ -25,14 +25,10 @@ PKG_LICENSE_FILES:= COPYING                                 \
                        libuuid/COPYING                         \
                        Documentation/licenses/COPYING.BSD-3
 
-PKG_BUILD_PARALLEL:=1
-
-PKG_FIXUP:=autoreconf
 PKG_INSTALL:=1
 
-DISABLE_NLS:=--disable-nls
-
 include $(INCLUDE_DIR)/package.mk
+include $(INCLUDE_DIR)/meson.mk
 
 define Package/util-linux/Default
   SECTION:=utils
@@ -552,44 +548,69 @@ define Package/wipefs/description
  libblkid.
 endef
 
-CONFIGURE_ARGS += \
-       --disable-use-tty-group         \
-       --disable-rpath                 \
-       --disable-tls                   \
-       --disable-su                    \
-       --disable-sulogin               \
-       --disable-makeinstall-chown     \
-       --disable-login                 \
-       --disable-nologin               \
-       --disable-lslogins              \
-       --disable-runuser               \
-       --disable-chfn-chsh             \
-       --disable-raw                   \
-       --without-python                \
-       --without-udev                  \
-       --without-readline              \
-       --without-libmagic              \
-       --with-ncursesw
-
-TARGET_CFLAGS += $(FPIC) -std=gnu99
+MESON_ARGS += \
+       -Dsystemd=disabled \
+       -Dtinfo=disabled \
+       -Dcryptsetup=disabled \
+       -Dlibutil=disabled \
+       -Dlibutempter=disabled \
+       -Dlibpcre2-posix=disabled \
+       -Dlibuser=disabled \
+       -Duse-tty-group=false \
+       -Duse-tls=false \
+       -Dbuild-python=disabled \
+       -Dbuild-zramctl=disabled \
+       -Dbuild-fsck=disabled \
+       -Dbuild-wipefs=disabled \
+       -Dbuild-fallocate=disabled \
+       -Dbuild-setpriv=disabled \
+       -Dbuild-hardlink=disabled \
+       -Dbuild-cramfs=disabled \
+       -Dbuild-bfs=disabled \
+       -Dbuild-minix=disabled \
+       -Dbuild-fdformat=disabled \
+       -Dbuild-lslogins=disabled \
+       -Dbuild-wdctl=disabled \
+       -Dbuild-cal=disabled \
+       -Dbuild-switch_root=disabled \
+       -Dbuild-pivot_root=disabled \
+       -Dbuild-lsmem=disabled \
+       -Dbuild-lsirq=disabled \
+       -Dbuild-irqtop=disabled \
+       -Dbuild-chmem=disabled \
+       -Dbuild-ipcrm=disabled \
+       -Dbuild-rfkill=disabled \
+       -Dbuild-tunelp=disabled \
+       -Dbuild-kill=disabled \
+       -Dbuild-last=disabled \
+       -Dbuild-utmpdump=disabled \
+       -Dbuild-line=disabled \
+       -Dbuild-mesg=disabled \
+       -Dbuild-raw=disabled \
+       -Dbuild-vipw=disabled \
+       -Dbuild-newgrp=disabled \
+       -Dbuild-chfn-chsh=disabled \
+       -Dbuild-login=disabled \
+       -Dbuild-nologin=disabled \
+       -Dbuild-sulogin=disabled \
+       -Dbuild-su=disabled \
+       -Dbuild-runuser=disabled \
+       -Dbuild-ul=disabled \
+       -Dbuild-pg=disabled \
+       -Dbuild-write=disabled \
+       -Dbuild-bash-completion=disabled \
+       -Dbuild-pylibmount=disabled \
+       -Dreadline=disabled \
+       -Dmagic=disabled \
+       -Dncursesw=enabled
 
 define Build/InstallDev
        $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
        $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/blkid.pc $(1)/usr/lib/pkgconfig
-       $(SED) 's,/usr/include,$$$${prefix}/include,g' $(1)/usr/lib/pkgconfig/blkid.pc
-       $(SED) 's,/usr/lib,$$$${exec_prefix}/lib,g' $(1)/usr/lib/pkgconfig/blkid.pc
        $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/fdisk.pc $(1)/usr/lib/pkgconfig
-       $(SED) 's,/usr/include,$$$${prefix}/include,g' $(1)/usr/lib/pkgconfig/fdisk.pc
-       $(SED) 's,/usr/lib,$$$${exec_prefix}/lib,g' $(1)/usr/lib/pkgconfig/fdisk.pc
        $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/mount.pc $(1)/usr/lib/pkgconfig
-       $(SED) 's,/usr/include,$$$${prefix}/include,g' $(1)/usr/lib/pkgconfig/mount.pc
-       $(SED) 's,/usr/lib,$$$${exec_prefix}/lib,g' $(1)/usr/lib/pkgconfig/mount.pc
        $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/smartcols.pc $(1)/usr/lib/pkgconfig
-       $(SED) 's,/usr/include,$$$${prefix}/include,g' $(1)/usr/lib/pkgconfig/smartcols.pc
-       $(SED) 's,/usr/lib,$$$${exec_prefix}/lib,g' $(1)/usr/lib/pkgconfig/smartcols.pc
        $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/uuid.pc $(1)/usr/lib/pkgconfig
-       $(SED) 's,/usr/include,$$$${prefix}/include,g' $(1)/usr/lib/pkgconfig/uuid.pc
-       $(SED) 's,/usr/lib,$$$${exec_prefix}/lib,g' $(1)/usr/lib/pkgconfig/uuid.pc
 
        $(INSTALL_DIR) $(1)/usr/include/blkid
        $(CP) $(PKG_INSTALL_DIR)/usr/include/blkid/blkid.h $(1)/usr/include/blkid
@@ -603,43 +624,37 @@ define Build/InstallDev
        $(CP) $(PKG_INSTALL_DIR)/usr/include/libsmartcols/libsmartcols.h $(1)/usr/include/libsmartcols
 
        $(INSTALL_DIR) $(1)/usr/lib
-       $(CP) $(PKG_INSTALL_DIR)/lib/libblkid.so* $(1)/usr/lib
-       $(CP) $(PKG_INSTALL_DIR)/lib/libfdisk.so* $(1)/usr/lib
-       $(CP) $(PKG_INSTALL_DIR)/lib/libmount.so* $(1)/usr/lib
-       $(CP) $(PKG_INSTALL_DIR)/lib/libuuid.so* $(1)/usr/lib
-       $(CP) $(PKG_INSTALL_DIR)/lib/libsmartcols.so* $(1)/usr/lib
-
-       $(LN) libblkid.so.1 $(1)/usr/lib/libblkid.so
-       $(LN) libfdisk.so.1 $(1)/usr/lib/libfdisk.so
-       $(LN) libmount.so.1 $(1)/usr/lib/libmount.so
-       $(LN) libuuid.so.1 $(1)/usr/lib/libuuid.so
-       $(LN) libsmartcols.so.1 $(1)/usr/lib/libsmartcols.so
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libblkid.so* $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libfdisk.so* $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libmount.so* $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libuuid.so* $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libsmartcols.so* $(1)/usr/lib
 endef
 
 
 define Package/libfdisk/install
        $(INSTALL_DIR) $(1)/usr/lib
-       $(CP) $(PKG_INSTALL_DIR)/lib/libfdisk.so.* $(1)/usr/lib/
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libfdisk.so.* $(1)/usr/lib/
 endef
 
 define Package/libblkid/install
        $(INSTALL_DIR) $(1)/usr/lib
-       $(CP) $(PKG_INSTALL_DIR)/lib/libblkid.so.* $(1)/usr/lib/
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libblkid.so.* $(1)/usr/lib/
 endef
 
 define Package/libmount/install
        $(INSTALL_DIR) $(1)/usr/lib
-       $(CP) $(PKG_INSTALL_DIR)/lib/libmount.so.* $(1)/usr/lib/
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libmount.so.* $(1)/usr/lib/
 endef
 
 define Package/libsmartcols/install
        $(INSTALL_DIR) $(1)/usr/lib
-       $(CP) $(PKG_INSTALL_DIR)/lib/libsmartcols.so.* $(1)/usr/lib/
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libsmartcols.so.* $(1)/usr/lib/
 endef
 
 define Package/libuuid/install
        $(INSTALL_DIR) $(1)/usr/lib
-       $(CP) $(PKG_INSTALL_DIR)/lib/libuuid.so.* $(1)/usr/lib/
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libuuid.so.* $(1)/usr/lib/
 endef
 
 define Package/agetty/install
diff --git a/package/utils/util-linux/patches/010-meson-typo.patch b/package/utils/util-linux/patches/010-meson-typo.patch
new file mode 100644 (file)
index 0000000..466d942
--- /dev/null
@@ -0,0 +1,20 @@
+From c387d4fe7a1435a762a5b7d8b75feb13ad613315 Mon Sep 17 00:00:00 2001
+From: Anatoly Pugachev <matorola@gmail.com>
+Date: Fri, 8 Apr 2022 15:34:16 +0300
+Subject: [PATCH] libfdisk: meson.build fix typo
+
+---
+ libfdisk/meson.build | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/libfdisk/meson.build
++++ b/libfdisk/meson.build
+@@ -11,7 +11,7 @@ libfdisk_h = configure_file(
+   output : 'libfdisk.h',
+   configuration : defs,
+   install : build_libfdisk,
+-  install_dir : join_paths(get_option('includedir'), 'libfisk'),
++  install_dir : join_paths(get_option('includedir'), 'libfdisk'),
+ )
+ lib_fdisk_sources = '''
diff --git a/package/utils/util-linux/patches/020-meson-fix-compilation-without-systemd.patch b/package/utils/util-linux/patches/020-meson-fix-compilation-without-systemd.patch
new file mode 100644 (file)
index 0000000..aa20999
--- /dev/null
@@ -0,0 +1,22 @@
+From 38b15ca2dc4ca32bbe4a2449e1c7b645e4577840 Mon Sep 17 00:00:00 2001
+From: Rosen Penev <rosenp@gmail.com>
+Date: Fri, 29 Apr 2022 16:53:43 -0700
+Subject: [PATCH 1/7] meson: fix compilation without systemd
+
+systemdsystemunitdir is used elsewhere.
+
+Signed-off-by: Rosen Penev <rosenp@gmail.com>
+---
+ meson.build | 1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/meson.build
++++ b/meson.build
+@@ -720,6 +720,7 @@ if fs_search_path_extra != ''
+ endif
+ conf.set_quoted('FS_SEARCH_PATH', fs_search_path)
++systemdsystemunitdir = ''
+ if systemd.found()
+   systemdsystemunitdir = systemd.get_pkgconfig_variable('systemdsystemunitdir')
+ endif
diff --git a/package/utils/util-linux/patches/030-meson-don-t-use-run.patch b/package/utils/util-linux/patches/030-meson-don-t-use-run.patch
new file mode 100644 (file)
index 0000000..7803dd7
--- /dev/null
@@ -0,0 +1,34 @@
+From e25db9169450d3d5fb43656a2eae5c08999310f4 Mon Sep 17 00:00:00 2001
+From: Rosen Penev <rosenp@gmail.com>
+Date: Fri, 29 Apr 2022 16:56:54 -0700
+Subject: [PATCH 2/7] meson: don't use run
+
+Fixes cross compilation. run is not needed anyway.
+
+Signed-off-by: Rosen Penev <rosenp@gmail.com>
+---
+ meson.build | 6 ++----
+ 1 file changed, 2 insertions(+), 4 deletions(-)
+
+--- a/meson.build
++++ b/meson.build
+@@ -577,8 +577,7 @@ int main(void) {
+   return tzname ? 0 : 1;
+ }
+ '''.format(have ? 1 : 0)
+-result = cc.run(code, name : 'using tzname[]')
+-have = result.compiled() and result.returncode() == 0
++have = cc.compiles(code, name : 'using tzname[]')
+ conf.set('HAVE_TZNAME', have ? 1 : false)
+ socket_libs = []
+@@ -641,8 +640,7 @@ int main(void) {
+     return (*__progname != 0);
+ }
+ '''
+-result = cc.run(code, name : 'using __progname')
+-have = result.compiled() and result.returncode() == 0
++have = cc.compiles(code, name : 'using __progname')
+ conf.set('HAVE___PROGNAME', have ? 1 : false)
+ build_plymouth_support = get_option('build-plymouth-support')
diff --git a/package/utils/util-linux/patches/040-meson-fix-cpu_set_t-test.patch b/package/utils/util-linux/patches/040-meson-fix-cpu_set_t-test.patch
new file mode 100644 (file)
index 0000000..bdbfc4b
--- /dev/null
@@ -0,0 +1,23 @@
+From 4194bb5b35e9b5f3296bf17b7cabcc5cb1632ba3 Mon Sep 17 00:00:00 2001
+From: Rosen Penev <rosenp@gmail.com>
+Date: Fri, 29 Apr 2022 16:55:15 -0700
+Subject: [PATCH 3/7] meson: fix cpu_set_t test
+
+_GNU_SOURCE is needed here.
+
+Signed-off-by: Rosen Penev <rosenp@gmail.com>
+---
+ meson.build | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/meson.build
++++ b/meson.build
+@@ -379,7 +379,7 @@ endforeach
+ have = cc.has_header('sched.h')
+ conf.set10('HAVE_DECL_CPU_ALLOC', have)
+ # We get -1 if the size cannot be determined
+-have_cpu_set_t = cc.sizeof('cpu_set_t', prefix : '#include <sched.h>') > 0
++have_cpu_set_t = cc.sizeof('cpu_set_t', prefix : '#define _GNU_SOURCE\n#include <sched.h>') > 0
+ conf.set('HAVE_CPU_SET_T', have_cpu_set_t ? 1 : false)
+ have = cc.has_header_symbol('stdlib.h', 'environ')
diff --git a/package/utils/util-linux/patches/050-meson-fix-environ-search.patch b/package/utils/util-linux/patches/050-meson-fix-environ-search.patch
new file mode 100644 (file)
index 0000000..2cd02e5
--- /dev/null
@@ -0,0 +1,23 @@
+From 1e9e2b9fe365cc4a0025d44dc0a9c54bfffe9058 Mon Sep 17 00:00:00 2001
+From: Rosen Penev <rosenp@gmail.com>
+Date: Fri, 29 Apr 2022 18:16:17 -0700
+Subject: [PATCH 4/7] meson: fix environ search
+
+musl has it defined in unistd.h and hidden behind _GNU_SOURCE.
+
+Signed-off-by: Rosen Penev <rosenp@gmail.com>
+---
+ meson.build | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/meson.build
++++ b/meson.build
+@@ -382,7 +382,7 @@ conf.set10('HAVE_DECL_CPU_ALLOC', have)
+ have_cpu_set_t = cc.sizeof('cpu_set_t', prefix : '#define _GNU_SOURCE\n#include <sched.h>') > 0
+ conf.set('HAVE_CPU_SET_T', have_cpu_set_t ? 1 : false)
+-have = cc.has_header_symbol('stdlib.h', 'environ')
++have = cc.has_header_symbol('unistd.h', 'environ', prefix : '#define _GNU_SOURCE')
+ conf.set10('HAVE_ENVIRON_DECL', have)
+ have = cc.has_header_symbol('signal.h', 'sighandler_t')
diff --git a/package/utils/util-linux/patches/060-meson-add-_GNU_SOURCE-for-sighandler_t.patch b/package/utils/util-linux/patches/060-meson-add-_GNU_SOURCE-for-sighandler_t.patch
new file mode 100644 (file)
index 0000000..7f9137f
--- /dev/null
@@ -0,0 +1,23 @@
+From 5d7557eb3827664b2b78145373907f2a6994bdf9 Mon Sep 17 00:00:00 2001
+From: Rosen Penev <rosenp@gmail.com>
+Date: Fri, 29 Apr 2022 18:17:52 -0700
+Subject: [PATCH 5/7] meson: add _GNU_SOURCE for sighandler_t
+
+musl requires 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
+@@ -385,7 +385,7 @@ conf.set('HAVE_CPU_SET_T', have_cpu_set_
+ have = cc.has_header_symbol('unistd.h', 'environ', prefix : '#define _GNU_SOURCE')
+ conf.set10('HAVE_ENVIRON_DECL', have)
+-have = cc.has_header_symbol('signal.h', 'sighandler_t')
++have = cc.has_header_symbol('signal.h', 'sighandler_t', prefix : '#define _GNU_SOURCE')
+ conf.set('HAVE_SIGHANDLER_T', have ? 1 : false)
+ have = cc.has_header_symbol('string.h', 'strsignal')
diff --git a/package/utils/util-linux/patches/070-meson-fix-isnan-check.patch b/package/utils/util-linux/patches/070-meson-fix-isnan-check.patch
new file mode 100644 (file)
index 0000000..a0b104f
--- /dev/null
@@ -0,0 +1,24 @@
+From 777652585924034deeba98ae3192f26bc32bb661 Mon Sep 17 00:00:00 2001
+From: Rosen Penev <rosenp@gmail.com>
+Date: Fri, 29 Apr 2022 18:19:53 -0700
+Subject: [PATCH 6/7] meson: fix isnan check
+
+musl only has isnan as a macro, not as a function. Handle the former
+case.
+
+Signed-off-by: Rosen Penev <rosenp@gmail.com>
+---
+ meson.build | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/meson.build
++++ b/meson.build
+@@ -622,7 +622,7 @@ rtas_libs = cc.find_library('rtas', requ
+ conf.set('HAVE_LIBRTAS', rtas_libs.found() ? 1 : false)
+ math_libs = []
+-if not cc.has_function('isnan')
++if not cc.has_header_symbol('math.h', 'isnan')
+   lib = cc.find_library('m', required : true)
+   if (cc.has_function('isnan', dependencies : lib) and
+       cc.has_function('__isnan', dependencies : lib))
diff --git a/package/utils/util-linux/patches/080-meson-fix-tzname-check.patch b/package/utils/util-linux/patches/080-meson-fix-tzname-check.patch
new file mode 100644 (file)
index 0000000..f5d53c4
--- /dev/null
@@ -0,0 +1,23 @@
+From 9a6b2618b46a859388139d1eb18f876886786659 Mon Sep 17 00:00:00 2001
+From: Rosen Penev <rosenp@gmail.com>
+Date: Fri, 29 Apr 2022 19:00:53 -0700
+Subject: [PATCH] meson: fix tzname check
+
+tzname is not a type but a variable. sizeof only works on types.
+
+Signed-off-by: Rosen Penev <rosenp@gmail.com>
+---
+ meson.build | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/meson.build
++++ b/meson.build
+@@ -565,7 +565,7 @@ have = cc.has_member('struct tm', 'tm_zo
+                      prefix : '#include <time.h>')
+ conf.set('HAVE_STRUCT_TM_TM_ZONE', have ? 1 : false)
+-have = cc.sizeof('tzname', prefix : '#include <time.h>') > 0
++have = cc.has_header_symbol('time.h', 'tzname')
+ conf.set('HAVE_DECL_TZNAME', have ? 1 : false)
+ code = '''
diff --git a/package/utils/util-linux/patches/090-meson-libpam.patch b/package/utils/util-linux/patches/090-meson-libpam.patch
new file mode 100644 (file)
index 0000000..c9a91b9
--- /dev/null
@@ -0,0 +1,18 @@
+--- a/meson.build
++++ b/meson.build
+@@ -299,10 +299,14 @@ conf.set('HAVE_LIBUDEV', lib_udev.found(
+ lib_crypt = cc.find_library('crypt')
+-lib_pam = cc.find_library('pam')
++req_libpam = not (get_option('build-login').disabled() or get_option('build-chfn-chsh').disabled()
++  or get_option('build-su').disabled() or get_option('build-runuser').disabled())
++lib_pam = cc.find_library('pam', required : req_libpam)
+ if lib_pam.found()
+   lib_pam_misc = cc.find_library('pam_misc')
+   lib_pam = [lib_pam, lib_pam_misc]
++else
++  lib_pam_misc = declare_dependency()
+ endif
+ lib_cryptsetup = dependency(
diff --git a/package/utils/util-linux/patches/100-meson-make-libcap-ng-dependent-on-setpriv.patch b/package/utils/util-linux/patches/100-meson-make-libcap-ng-dependent-on-setpriv.patch
new file mode 100644 (file)
index 0000000..d8b1199
--- /dev/null
@@ -0,0 +1,31 @@
+From cd23a4336f49ba6a12ade557a09589f2a7c966f4 Mon Sep 17 00:00:00 2001
+From: Rosen Penev <rosenp@gmail.com>
+Date: Mon, 2 May 2022 16:18:33 -0700
+Subject: [PATCH] meson: make libcap-ng dependent on setpriv
+
+Signed-off-by: Rosen Penev <rosenp@gmail.com>
+---
+ meson.build | 5 +++--
+ 1 file changed, 3 insertions(+), 2 deletions(-)
+
+--- a/meson.build
++++ b/meson.build
+@@ -334,7 +334,8 @@ have = cc.has_function(
+ conf.set('HAVE_CRYPT_ACTIVATE_BY_SIGNED_KEY', have ? 1 : false)
+ lib_cap_ng = dependency(
+-  'libcap-ng')
++  'libcap-ng',
++  required : get_option('build-setpriv'))
+ lib_selinux = dependency(
+   'libselinux',
+@@ -1754,7 +1755,7 @@ if opt and not is_disabler(exe)
+   exes += exe
+ endif
+-opt = not get_option('build-setpriv').disabled()
++opt = not get_option('build-setpriv').disabled() and lib_cap_ng.found()
+ exe = executable(
+   'setpriv',
+   setpriv_sources,
diff --git a/package/utils/util-linux/patches/100-use_urandom.patch b/package/utils/util-linux/patches/100-use_urandom.patch
deleted file mode 100644 (file)
index 5817209..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
---- a/lib/randutils.c
-+++ b/lib/randutils.c
-@@ -26,6 +26,11 @@
- #define THREAD_LOCAL static
- #endif
-+/* force /dev/urandom to avoid hanging on early boot */
-+#undef HAVE_GETRANDOM
-+#undef SYS_getrandom
-+#undef __NR_getrandom
-+
- #ifdef HAVE_GETRANDOM
- # include <sys/random.h>
- #elif defined (__linux__)
diff --git a/package/utils/util-linux/patches/110-meson-fix-when-HAVE_CLOCK_GETTIME-is-set.patch b/package/utils/util-linux/patches/110-meson-fix-when-HAVE_CLOCK_GETTIME-is-set.patch
new file mode 100644 (file)
index 0000000..bba8baf
--- /dev/null
@@ -0,0 +1,21 @@
+From e51565b653cf09985df57cb7254b16d5af5df223 Mon Sep 17 00:00:00 2001
+From: Nicolas Caramelli <caramelli.devel@gmail.com>
+Date: Fri, 29 Apr 2022 18:16:36 +0200
+Subject: [PATCH] meson: fix when HAVE_CLOCK_GETTIME is set
+
+Signed-off-by: Nicolas Caramelli <caramelli.devel@gmail.com>
+---
+ meson.build | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/meson.build
++++ b/meson.build
+@@ -602,7 +602,7 @@ if not have
+   have = cc.has_function('clock_gettime',
+                          dependencies : realtime_libs)
+ endif
+-conf.set('HAVE_CLOCK_GETTIME', have_dirfd ? 1 : false)
++conf.set('HAVE_CLOCK_GETTIME', have ? 1 : false)
+ thread_libs = dependency('threads')
diff --git a/package/utils/util-linux/patches/120-meson-get-the-project-version-from-the-version-gen-s.patch b/package/utils/util-linux/patches/120-meson-get-the-project-version-from-the-version-gen-s.patch
new file mode 100644 (file)
index 0000000..8529c82
--- /dev/null
@@ -0,0 +1,20 @@
+From e0c1a86bf88b568a7afe8ebaea1b9f84afb892c2 Mon Sep 17 00:00:00 2001
+From: Eli Schwartz <eschwartz@archlinux.org>
+Date: Wed, 4 May 2022 23:52:31 -0400
+Subject: [PATCH] meson: get the project version from the version-gen script
+
+This matches autotools and ensures that the version number is actually
+reliable.
+---
+ meson.build | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/meson.build
++++ b/meson.build
+@@ -1,5 +1,5 @@
+ project('util-linux', 'c',
+-        version : '2.37',
++        version : run_command('tools/git-version-gen', check: true).stdout(),
+         license : 'GPLv2+')
+ pkgconfig = import('pkgconfig')
diff --git a/package/utils/util-linux/patches/130-meson-fix-error-in-processing-version-for-pc-files.patch b/package/utils/util-linux/patches/130-meson-fix-error-in-processing-version-for-pc-files.patch
new file mode 100644 (file)
index 0000000..75e8868
--- /dev/null
@@ -0,0 +1,26 @@
+From dc307e1cbf73f6dbf72bb049c19d332774cdb4e7 Mon Sep 17 00:00:00 2001
+From: Eli Schwartz <eschwartz@archlinux.org>
+Date: Thu, 5 May 2022 00:16:15 -0400
+Subject: [PATCH] meson: fix error in processing version for pc files
+
+This awk command was copied verbatim from configure.ac, which included
+non-awk syntax because configure.ac cannot contain [ literals.
+
+Rewrite these autoconf quadrigraphs as their actual values, for meson.
+
+Fixes always setting the micro version to "0".
+---
+ meson.build | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/meson.build
++++ b/meson.build
+@@ -41,7 +41,7 @@ conf.set_quoted('PACKAGE_VERSION', meson
+ codes = [''' {print $1}  ''',
+          ''' {sub("-.*","",$2); print $2} ''',
+-         ''' {sub("-.*","",$3); print $3 ~ /^@<:@0-9@:>@+$/ ? $3 : 0} ''']
++         ''' {sub("-.*","",$3); print $3 ~ /^[0-9]+$/ ? $3 : 0} ''']
+ pc_version = []
+ foreach code : codes
+   res = run_command('bash', '-c',
diff --git a/package/utils/util-linux/patches/200-meson-no-po.patch b/package/utils/util-linux/patches/200-meson-no-po.patch
new file mode 100644 (file)
index 0000000..d626036
--- /dev/null
@@ -0,0 +1,10 @@
+--- a/meson.build
++++ b/meson.build
+@@ -774,7 +774,6 @@ subdir('disk-utils')
+ subdir('misc-utils')
+ subdir('text-utils')
+ subdir('term-utils')
+-subdir('po')
+ includes = [dir_include,
+             dir_libblkid,
diff --git a/package/utils/util-linux/patches/210-use-urandom.patch b/package/utils/util-linux/patches/210-use-urandom.patch
new file mode 100644 (file)
index 0000000..5817209
--- /dev/null
@@ -0,0 +1,14 @@
+--- a/lib/randutils.c
++++ b/lib/randutils.c
+@@ -26,6 +26,11 @@
+ #define THREAD_LOCAL static
+ #endif
++/* force /dev/urandom to avoid hanging on early boot */
++#undef HAVE_GETRANDOM
++#undef SYS_getrandom
++#undef __NR_getrandom
++
+ #ifdef HAVE_GETRANDOM
+ # include <sys/random.h>
+ #elif defined (__linux__)