Skip to contentSkip to conversation

man-db: Add missing rdep for col utility

PATCH Superseded Khem Raj 1 participant 2 messages Mar 20, 2025

v5 of 6 Superseded Latest is v6 →

lore
Share & tools
lore

Khem Raj

author
#0 lore raw

PATCH v5 1/2 man-db: Add missing rdep for col utility

man utility calls col utility internally when formatting is asked for therefore it expects col to be in rootfs otherwise silently errors with retcode 3 meaning 'file not found' in this case its due to col not being found, other distros eg. gets this via bsdextrautils dependency

Add it via packageconfig and explicitly remove it for musl targets

libssh2 ptest mansyntax.sh fails due to this error, which now works

---
v5: Turn col into a packageconfig and drop zlib from deps

 meta/recipes-extended/man-db/man-db_2.13.0.bb | 5 +++++
 1 file changed, 5 insertions(+)
meta/recipes-extended/man-db/man-db_2.13.0.bb +5 -0
index 2178239bb60..f28bd4a9265 100644
@@ -25,7 +25,12 @@ inherit gettext pkgconfig autotools systemd
 EXTRA_OECONF = "--with-pager=less --with-systemdsystemunitdir=${systemd_system_unitdir}"
 EXTRA_AUTORECONF += "-I ${S}/gl/m4"
 
+PACKAGECONFIG ??= "col"
+# util-linux col is deprecated and only builds for glibc
+PACKAGECONFIG:remove:libc-musl = "col"
+
 PACKAGECONFIG[bzip2] = "--with-bzip2=bzip2,ac_cv_prog_have_bzip2='',bzip2"
+PACKAGECONFIG[col] = "--with-col=col,--with-col=,,util-linux-col"
 PACKAGECONFIG[gzip] = "--with-gzip=gzip,ac_cv_prog_have_gzip='',gzip"
 PACKAGECONFIG[lzip] = "--with-lzip=lzip,ac_cv_prog_have_lzip='',lzip"
 PACKAGECONFIG[lzma] = "--with-lzma=lzma,ac_cv_prog_have_lzma='',xz"
author
#1 lore raw

PATCH v5 2/2 man-db: Fix musl build with NLS

_nl_msg_cat_cntr is not defined in libintl on musl systems therefore add configure time check for it and use it to guard the use of _nl_msg_cat_cntr

---
v5: Change status of patch to Backport as its in upstream now

 ...ck-for-_nl_msg_cat_cntr-in-configure.patch | 61 +++++++++++++++++++
 meta/recipes-extended/man-db/man-db_2.13.0.bb |  4 +-
 2 files changed, 62 insertions(+), 3 deletions(-)
 create mode 100644 meta/recipes-extended/man-db/files/0001-check-for-_nl_msg_cat_cntr-in-configure.patch
meta/recipes-extended/man-db/files/0001-check-for-_nl_msg_cat_cntr-in-configure.patch new file +61 -0
new file mode 100644
index 00000000000..feef52b11c8
@@ -0,0 +1,61 @@
+From ea00e32a87cc733dd5aa05cef407a5bee3e6db29 Mon Sep 17 00:00:00 2001
+From: Khem Raj <[email protected]>
+Date: Tue, 18 Mar 2025 22:42:45 -0700
+Subject: [PATCH] check for _nl_msg_cat_cntr in configure
+
+_nl_msg_cat_cntr is not available in all implementations e.g. musl libintl
+does not have it, therefore add a check to detect it and use it only if
+it is found.
+
+Upstream-Status: Backport [https://gitlab.com/man-db/man-db/-/commit/7430ca617b5cee3d4420da3158382c5ffbc3e77d]
+Signed-off-by: Khem Raj <[email protected]>
+---
+ configure.ac        | 9 +++++++++
+ include/manconfig.h | 6 ++++--
+ 2 files changed, 13 insertions(+), 2 deletions(-)
+
+--- a/configure.ac
++++ b/configure.ac
+@@ -404,6 +404,15 @@ AC_TYPE_PID_T
+ AC_TYPE_UID_T
+ AC_TYPE_SIZE_T
+ 
++dnl _nl_msg_cat_cntr is required for GNU gettext
++AC_MSG_CHECKING([for _nl_msg_cat_cntr])
++AC_LINK_IFELSE([AC_LANG_PROGRAM(
++	[[#include <libintl.h>
++	extern int _nl_msg_cat_cntr;]],
++	[[++_nl_msg_cat_cntr;]])],
++	AC_MSG_RESULT([yes]); AC_DEFINE([HAVE_NL_MSG_CAT_CNTR], [], [_nl_msg_cat_cntr from GNU Gettext]),
++	AC_MSG_RESULT([no]))
++
+ # Check for pipeline library.
+ PKG_CHECK_MODULES([libpipeline], [libpipeline >= 1.5.0])
+ 
+--- a/include/manconfig.h
++++ b/include/manconfig.h
+@@ -24,6 +24,8 @@
+ #ifndef MANCONFIG_H
+ #define MANCONFIG_H
+ 
++#include "config.h"
++
+ /* STD_SECTIONS must contain all of your man hierarchy subdirectories. The
+    order is important. Manual pages will be displayed in this order. Ie
+    if "1" comes before "2", then a kill(1) will be displayed in preference to
+@@ -138,13 +140,13 @@
+ #define UNLIKELY(cond) __builtin_expect ((cond), 0)
+ 
+ /* GNU gettext needs to know when the locale changes. This macro tells it. */
+-#ifdef ENABLE_NLS
++#ifdef HAVE_NL_MSG_CAT_CNTR
+ extern int _nl_msg_cat_cntr;
+ #  define locale_changed()                                                    \
+ 	  do {                                                                \
+ 		  ++_nl_msg_cat_cntr;                                         \
+ 	  } while (0)
+-#else /* !ENABLE_NLS */
++#else /* !HAVE_NL_MSG_CAT_CNTR */
+ #  define locale_changed()
+ #endif /* ENABLE_NLS */
+ 
meta/recipes-extended/man-db/man-db_2.13.0.bb +1 -3
index f28bd4a9265..2bc36a9aca0 100644
@@ -9,6 +9,7 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=1ebbd3e34237af26da5dc08a4e440464 \
 
 SRC_URI = "${SAVANNAH_NONGNU_MIRROR}/man-db/man-db-${PV}.tar.xz \
            file://flex.patch \
+           file://0001-check-for-_nl_msg_cat_cntr-in-configure.patch \
            file://99_mandb \
           "
 SRC_URI[sha256sum] = "82f0739f4f61aab5eb937d234de3b014e777b5538a28cbd31433c45ae09aefb9"
@@ -17,9 +18,6 @@ DEPENDS = "libpipeline gdbm groff-native base-passwd"
 RDEPENDS:${PN} += "base-passwd"
 PACKAGE_WRITE_DEPS += "base-passwd"
 
-# | /usr/src/debug/man-db/2.8.0-r0/man-db-2.8.0/src/whatis.c:939: undefined reference to `_nl_msg_cat_cntr'
-USE_NLS:libc-musl = "no"
-
 inherit gettext pkgconfig autotools systemd
 
 EXTRA_OECONF = "--with-pager=less --with-systemdsystemunitdir=${systemd_system_unitdir}"