diff mbox series

[hardknott,2/2] nfs-utils: add krb5 PACKAGECONFIG to allow building with gss and svcgss

Message ID 20231120212436.27604-2-stefan.ghinea@windriver.com
State New
Headers show
Series [hardknott,1/2] libtirpc: add support for configuring and building with --enable-gssapi | expand

Commit Message

Stefan Ghinea Nov. 20, 2023, 9:24 p.m. UTC
When building nfs-utils with gss and svcgss if the Host OS has krb5
development package build works, but it looks like a host pollution.

Signed-off-by: Stefan Ghinea <stefan.ghinea@windriver.com>
---
 ...with-enable-gss-enable-svcgss-option.patch | 52 +++++++++++++++++++
 .../nfs-utils/nfs-utils_2.5.3.bb              |  5 +-
 2 files changed, 56 insertions(+), 1 deletion(-)
 create mode 100644 meta/recipes-connectivity/nfs-utils/nfs-utils/0001-Enable-building-with-enable-gss-enable-svcgss-option.patch
diff mbox series

Patch

diff --git a/meta/recipes-connectivity/nfs-utils/nfs-utils/0001-Enable-building-with-enable-gss-enable-svcgss-option.patch b/meta/recipes-connectivity/nfs-utils/nfs-utils/0001-Enable-building-with-enable-gss-enable-svcgss-option.patch
new file mode 100644
index 0000000000..23232ec099
--- /dev/null
+++ b/meta/recipes-connectivity/nfs-utils/nfs-utils/0001-Enable-building-with-enable-gss-enable-svcgss-option.patch
@@ -0,0 +1,52 @@ 
+From d4494617c98fdf4e956d74ce34b847a46ff36e0d Mon Sep 17 00:00:00 2001
+From: Stefan Ghinea <stefan.ghinea@windriver.com>
+Date: Wed, 11 Oct 2023 22:36:32 +0300
+Subject: [PATCH] Enable building with --enable-gss --enable-svcgss options in
+ Yocto
+
+With $dir being used as base search for both libgssapi and krb5-config, in
+Yocto krb5-config is found in $dir/bin/crossscripts instead of $dir/bin so
+add this to the search posibillities relative to $dir.
+Remove check for needing to set -rpath in KRBLDFLAGS.
+
+Upstream-Status: Inappropriate [oe-core specific]
+
+Signed-off-by: Stefan Ghinea <stefan.ghinea@windriver.com>
+---
+ aclocal/kerberos5.m4 | 13 ++-----------
+ 1 file changed, 2 insertions(+), 11 deletions(-)
+
+diff --git a/aclocal/kerberos5.m4 b/aclocal/kerberos5.m4
+index bf0e88b..ba683eb 100644
+--- a/aclocal/kerberos5.m4
++++ b/aclocal/kerberos5.m4
+@@ -24,6 +24,8 @@ AC_DEFUN([AC_KERBEROS_V5],[
+     K5CONFIG=""
+     if test -f $dir/bin/krb5-config; then
+       K5CONFIG=$dir/bin/krb5-config
++    elif test -f $dir/bin/crossscripts/krb5-config; then
++      K5CONFIG=$dir/bin/crossscripts/krb5-config
+     elif test -f "/usr/kerberos/bin/krb5-config"; then
+       K5CONFIG="/usr/kerberos/bin/krb5-config"
+     elif test -f "/usr/lib/mit/bin/krb5-config"; then
+@@ -71,17 +73,6 @@ AC_DEFUN([AC_KERBEROS_V5],[
+   fi
+   AC_MSG_RESULT($KRBDIR)
+ 
+-  dnl Check if -rpath=$(KRBDIR)/lib is needed
+-  echo "The current KRBDIR is $KRBDIR"
+-  if test "$KRBDIR/lib" = "/lib" -o "$KRBDIR/lib" = "/usr/lib" \
+-       -o "$KRBDIR/lib" = "//lib" -o "$KRBDIR/lib" = "/usr//lib" ; then
+-    KRBLDFLAGS="";
+-  elif /sbin/ldconfig -p | grep > /dev/null "=> $KRBDIR/lib/"; then
+-    KRBLDFLAGS="";
+-  else
+-    KRBLDFLAGS="-Wl,-rpath=$KRBDIR/lib"
+-  fi
+-
+   dnl Now check for functions within gssapi library
+   AC_CHECK_LIB($gssapi_lib, gss_krb5_export_lucid_sec_context,
+     AC_DEFINE(HAVE_LUCID_CONTEXT_SUPPORT, 1, [Define this if the Kerberos GSS library supports gss_krb5_export_lucid_sec_context]), ,$KRBLIBS)
+-- 
+2.42.0
+
diff --git a/meta/recipes-connectivity/nfs-utils/nfs-utils_2.5.3.bb b/meta/recipes-connectivity/nfs-utils/nfs-utils_2.5.3.bb
index d8c6391b3d..1b4f281175 100644
--- a/meta/recipes-connectivity/nfs-utils/nfs-utils_2.5.3.bb
+++ b/meta/recipes-connectivity/nfs-utils/nfs-utils_2.5.3.bb
@@ -30,6 +30,7 @@  SRC_URI = "${KERNELORG_MIRROR}/linux/utils/nfs-utils/${PV}/nfs-utils-${PV}.tar.x
            file://bugfix-adjust-statd-service-name.patch \
            file://0001-Makefile.am-fix-undefined-function-for-libnsm.a.patch \
            file://clang-warnings.patch \
+           file://0001-Enable-building-with-enable-gss-enable-svcgss-option.patch \
            "
 SRC_URI[sha256sum] = "b54d6d8ea2ee62d64111278301ba4631b7bb19174e7f717a724fe5d463900c80"
 
@@ -53,7 +54,6 @@  EXTRA_OECONF = "--with-statduser=rpcuser \
                 --enable-mountconfig \
                 --enable-libmount-mount \
                 --enable-uuid \
-                --disable-gss \
                 --disable-nfsdcltrack \
                 --with-statdpath=/var/lib/nfs/statd \
                 --with-rpcgen=${HOSTTOOLS_DIR}/rpcgen \
@@ -61,6 +61,7 @@  EXTRA_OECONF = "--with-statduser=rpcuser \
 
 PACKAGECONFIG ??= "tcp-wrappers \
     ${@bb.utils.filter('DISTRO_FEATURES', 'ipv6', d)} \
+    ${@bb.utils.contains('DISTRO_FEATURES', 'krb5', 'nfsv4 krb5', '', d)} \
 "
 PACKAGECONFIG_remove_libc-musl = "tcp-wrappers"
 PACKAGECONFIG[tcp-wrappers] = "--with-tcp-wrappers,--without-tcp-wrappers,tcp-wrappers"
@@ -69,6 +70,8 @@  PACKAGECONFIG[ipv6] = "--enable-ipv6,--disable-ipv6,"
 PACKAGECONFIG[nfsv41] = "--enable-nfsv41,--disable-nfsv41,libdevmapper,libdevmapper"
 # keyutils is available in meta-oe
 PACKAGECONFIG[nfsv4] = "--enable-nfsv4,--disable-nfsv4,keyutils,python3-core"
+# krb5 is available in meta-oe
+PACKAGECONFIG[krb5] = "--enable-gss --enable-svcgss --with-krb5=${STAGING_DIR_HOST}/usr,--disable-gss,krb5"
 
 PACKAGES =+ "${PN}-client ${PN}-mount ${PN}-stats"