commit:     f97eb250b55904388c542a546ec048f239f89b5c
Author:     Lars Wendler <polynomial-c <AT> gentoo <DOT> org>
AuthorDate: Sat Jul 10 21:24:33 2021 +0000
Commit:     Lars Wendler <polynomial-c <AT> gentoo <DOT> org>
CommitDate: Sat Jul 10 21:31:41 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f97eb250

sys-apps/util-linux: Attempt fix build with sys-libs/libxcrypt[-abi_x86_32]

Bug: https://bugs.gentoo.org/801403
Signed-off-by: Lars Wendler <polynomial-c <AT> gentoo.org>

 .../files/util-linux-2.37-avoid_autoreconf.patch   | 136 +++++++++++++++++++++
 .../files/util-linux-2.37-lcrypt_link_fix.patch    |  50 ++++++++
 .../files/util-linux-2.37-lcrypt_use_LIBS.patch    |  91 ++++++++++++++
 sys-apps/util-linux/util-linux-2.37.ebuild         |   4 +
 4 files changed, 281 insertions(+)

diff --git a/sys-apps/util-linux/files/util-linux-2.37-avoid_autoreconf.patch 
b/sys-apps/util-linux/files/util-linux-2.37-avoid_autoreconf.patch
new file mode 100644
index 00000000000..44ea6e5c2be
--- /dev/null
+++ b/sys-apps/util-linux/files/util-linux-2.37-avoid_autoreconf.patch
@@ -0,0 +1,136 @@
+--- util-linux-2.37/config.h.in
++++ util-linux-2.37/config.h.in
+@@ -216,9 +216,6 @@
+ /* Define to 1 if you have the `cap-ng' library (-lcap-ng). */
+ #undef HAVE_LIBCAP_NG
+ 
+-/* Do we need -lcrypt? */
+-#undef HAVE_LIBCRYPT
+-
+ /* Define if libeconf is available */
+ #undef HAVE_LIBECONF
+ 
+--- util-linux-2.37/configure
++++ util-linux-2.37/configure
+@@ -4965,12 +4965,7 @@
+ program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"`
+ 
+ if test x"${MISSING+set}" != xset; then
+-  case $am_aux_dir in
+-  *\ * | *\   *)
+-    MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
+-  *)
+-    MISSING="\${SHELL} $am_aux_dir/missing" ;;
+-  esac
++  MISSING="\${SHELL} '$am_aux_dir/missing'"
+ fi
+ # Use eval to expand $SHELL
+ if eval "$MISSING --is-lightweight"; then
+@@ -25591,7 +25586,10 @@
+ 
+ else
+ 
++
++  old_LIBS="$LIBS"
+   LIBS="$LIBS -lcrypt"
++
+   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ /* end confdefs.h.  */
+ 
+@@ -25612,10 +25610,7 @@
+   return 0;
+ }
+ _ACEOF
+-if ac_fn_c_try_compile "$LINENO"; then :
+-
+-
+-$as_echo "#define HAVE_LIBCRYPT 1" >>confdefs.h
++if ac_fn_c_try_link "$LINENO"; then :
+ 
+   have_libcrypt=yes
+   have_crypt=yes
+@@ -25626,7 +25621,11 @@
+ $as_echo "$as_me: WARNING: crypt() is not available" >&2;}
+ 
+ fi
+-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
++rm -f core conftest.err conftest.$ac_objext \
++    conftest$ac_exeext conftest.$ac_ext
++
++  LIBS="$old_LIBS"
++
+ 
+ fi
+ rm -f core conftest.err conftest.$ac_objext \
+@@ -25768,12 +25767,8 @@
+ 
+ 
+ 
+-  old_CFLAGS="$CFLAGS"
+-  old_CPPFLAGS="$CPPFLAGS"
+-  old_LDFLAGS="$LDFLAGS"
+-  CFLAGS="$CFLAGS "
+-  CPPFLAGS="$CPPFLAGS "
+-  LDFLAGS="$LDFLAGS $SELINUX_LIBS"
++  old_LIBS="$LIBS"
++  LIBS="$LIBS $SELINUX_LIBS"
+ 
+     # This function is missing in old libselinux 1.xx versions
+     for ac_func in security_get_initial_context
+@@ -25788,9 +25783,7 @@
+ done
+ 
+ 
+-  CFLAGS="$old_CFLAGS"
+-  CPPFLAGS="$old_CPPFLAGS"
+-  LDFLAGS="$old_LDFLAGS"
++  LIBS="$old_LIBS"
+ 
+ 
+ fi
+--- util-linux-2.37/Makefile.in
++++ util-linux-2.37/Makefile.in
+@@ -1,4 +1,4 @@
+-# Makefile.in generated by automake 1.16.2 from Makefile.am.
++# Makefile.in generated by automake 1.16.3 from Makefile.am.
+ # @configure_input@
+ 
+ # Copyright (C) 1994-2020 Free Software Foundation, Inc.
+@@ -4649,6 +4649,8 @@
+ GZIP_ENV = --best
+ DIST_ARCHIVES = $(distdir).tar.xz
+ DIST_TARGETS = dist-xz
++# Exists only to be overridden by the user if desired.
++AM_DISTCHECK_DVI_TARGET = dvi
+ distuninstallcheck_listfiles = find . -type f -print
+ am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \
+   | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$'
+@@ -14854,7 +14856,7 @@
+           $(DISTCHECK_CONFIGURE_FLAGS) \
+           --srcdir=../.. --prefix="$$dc_install_base" \
+         && $(MAKE) $(AM_MAKEFLAGS) \
+-        && $(MAKE) $(AM_MAKEFLAGS) dvi \
++        && $(MAKE) $(AM_MAKEFLAGS) $(AM_DISTCHECK_DVI_TARGET) \
+         && $(MAKE) $(AM_MAKEFLAGS) check \
+         && $(MAKE) $(AM_MAKEFLAGS) install \
+         && $(MAKE) $(AM_MAKEFLAGS) installcheck \
+@@ -14920,7 +14922,8 @@
+       done
+ install: $(BUILT_SOURCES)
+       $(MAKE) $(AM_MAKEFLAGS) install-recursive
+-install-exec: install-exec-recursive
++install-exec: $(BUILT_SOURCES)
++      $(MAKE) $(AM_MAKEFLAGS) install-exec-recursive
+ install-data: install-data-recursive
+ uninstall: uninstall-recursive
+ 
+@@ -16157,7 +16160,8 @@
+       uninstall-man8
+ 
+ .MAKE: $(am__recursive_targets) all check check-am install install-am \
+-      install-data-am install-exec-am install-strip uninstall-am
++      install-data-am install-exec install-exec-am install-strip \
++      uninstall-am
+ 
+ .PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am \
+       am--depfiles am--refresh check check-am check-local clean \

diff --git a/sys-apps/util-linux/files/util-linux-2.37-lcrypt_link_fix.patch 
b/sys-apps/util-linux/files/util-linux-2.37-lcrypt_link_fix.patch
new file mode 100644
index 00000000000..2da99b2841d
--- /dev/null
+++ b/sys-apps/util-linux/files/util-linux-2.37-lcrypt_link_fix.patch
@@ -0,0 +1,50 @@
+From 637cc045ee464909c261d6fa16c71ed15cd455e3 Mon Sep 17 00:00:00 2001
+From: Alex Xu <[email protected]>
+Date: Wed, 16 Jun 2021 13:58:25 +0000
+Subject: [PATCH] build-sys: Update configure.ac
+
+1. the test incorrectly used AC_COMPILE_IFELSE instead of
+   AC_LINK_IFELSE, defeating the purpose of checking -lcrypt.
+2. the test did not properly restore LIBS, causing later checks to all
+   fail if libcrypt wasn't found.
+3. HAVE_LIBCRYPT only controls whether to use -lcrypt, it is not
+   needed or used in any source files.
+
+[[email protected]: - improve commit message
+                  - use UL_{SET,RESTORE}_FLAGS() rather than directly
+                   modify $LIBS]
+
+Signed-off-by: Karel Zak <[email protected]>
+---
+ configure.ac | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index 5181d524c..939c6d2d3 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -845,8 +845,8 @@ char *c = crypt("abc","pw");
+   have_libcrypt=no
+   have_crypt=yes
+ ],[
+-  LIBS="$LIBS -lcrypt"
+-  AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
++  UL_SET_FLAGS([], [], [-lcrypt])
++  AC_LINK_IFELSE([AC_LANG_PROGRAM([[
+   #ifdef HAVE_CRYPT_H
+   #include <crypt.h>
+   #else
+@@ -856,12 +856,12 @@ char *c = crypt("abc","pw");
+   ]], [[
+   char *c = crypt("abc","pw");
+   ]])],[
+-  AC_DEFINE([HAVE_LIBCRYPT], [1], [Do we need -lcrypt?])
+   have_libcrypt=yes
+   have_crypt=yes
+   ],[
+   AC_MSG_WARN([crypt() is not available])
+   ])
++  UL_RESTORE_FLAGS
+ ])
+ AM_CONDITIONAL([HAVE_LIBCRYPT], [test "x$have_libcrypt" = xyes])
+ 

diff --git a/sys-apps/util-linux/files/util-linux-2.37-lcrypt_use_LIBS.patch 
b/sys-apps/util-linux/files/util-linux-2.37-lcrypt_use_LIBS.patch
new file mode 100644
index 00000000000..2173195be61
--- /dev/null
+++ b/sys-apps/util-linux/files/util-linux-2.37-lcrypt_use_LIBS.patch
@@ -0,0 +1,91 @@
+From 75cba8d5cdb2a0e84c23de26007feac977837a6f Mon Sep 17 00:00:00 2001
+From: Karel Zak <[email protected]>
+Date: Fri, 18 Jun 2021 17:21:13 +0200
+Subject: [PATCH] build-sys: use $LIBS rather than LDFLAGS
+
+Fixes: https://github.com/karelzak/util-linux/pull/1349
+Signed-off-by: Karel Zak <[email protected]>
+---
+ configure.ac |  8 ++++----
+ m4/ul.m4     | 29 +++++++++++------------------
+ 2 files changed, 15 insertions(+), 22 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index 939c6d2d3..234cebc68 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -845,7 +845,7 @@ char *c = crypt("abc","pw");
+   have_libcrypt=no
+   have_crypt=yes
+ ],[
+-  UL_SET_FLAGS([], [], [-lcrypt])
++  UL_SET_LIBS([-lcrypt])
+   AC_LINK_IFELSE([AC_LANG_PROGRAM([[
+   #ifdef HAVE_CRYPT_H
+   #include <crypt.h>
+@@ -861,7 +861,7 @@ char *c = crypt("abc","pw");
+   ],[
+   AC_MSG_WARN([crypt() is not available])
+   ])
+-  UL_RESTORE_FLAGS
++  UL_RESTORE_LIBS
+ ])
+ AM_CONDITIONAL([HAVE_LIBCRYPT], [test "x$have_libcrypt" = xyes])
+ 
+@@ -883,10 +883,10 @@ AS_IF([test "x$with_selinux" = xno], [
+     UL_PKG_STATIC([SELINUX_LIBS_STATIC], [libselinux])
+     AM_CONDITIONAL([HAVE_SELINUX], [true])
+ 
+-    UL_SET_FLAGS([], [], [$SELINUX_LIBS])
++    UL_SET_LIBS([$SELINUX_LIBS])
+     # This function is missing in old libselinux 1.xx versions
+     AC_CHECK_FUNCS([security_get_initial_context])
+-    UL_RESTORE_FLAGS
++    UL_RESTORE_LIBS
+   ])
+ ])
+ AC_SUBST([SELINUX_LIBS])
+diff --git a/m4/ul.m4 b/m4/ul.m4
+index 951db7371..724579462 100644
+--- a/m4/ul.m4
++++ b/m4/ul.m4
+@@ -67,28 +67,21 @@ AC_DEFUN([UL_SET_ARCH], [
+ ])
+ 
+ 
+-dnl UL_SET_FLAGS(CFLAGS, CPPFLAGS, LDFLAGS)
+-dnl
+-dnl Sets new global CFLAGS, CPPFLAGS and LDFLAG, the original
+-dnl setting could be restored by UL_RESTORE_FLAGS()
+-dnl
+-AC_DEFUN([UL_SET_FLAGS], [
+-  old_CFLAGS="$CFLAGS"
+-  old_CPPFLAGS="$CPPFLAGS"
+-  old_LDFLAGS="$LDFLAGS"
+-  CFLAGS="$CFLAGS $1"
+-  CPPFLAGS="$CPPFLAGS $2"
+-  LDFLAGS="$LDFLAGS $3"
++dnl UL_SET_LIBS(LIBS)
++dnl
++dnl Sets new global LIBS, the original setting could be restored by 
UL_RESTORE_LIBS()
++dnl
++AC_DEFUN([UL_SET_LIBS], [
++  old_LIBS="$LIBS"
++  LIBS="$LIBS $1"
+ ])
+ 
+-dnl UL_RESTORE_FLAGS()
++dnl UL_RESTORE_LIBS()
+ dnl
+-dnl Restores CFLAGS, CPPFLAGS and LDFLAG previously saved by UL_SET_FLAGS()
++dnl Restores LIBS previously saved by UL_SET_LIBS()
+ dnl
+-AC_DEFUN([UL_RESTORE_FLAGS], [
+-  CFLAGS="$old_CFLAGS"
+-  CPPFLAGS="$old_CPPFLAGS"
+-  LDFLAGS="$old_LDFLAGS"
++AC_DEFUN([UL_RESTORE_LIBS], [
++  LIBS="$old_LIBS"
+ ])
+ 
+ 

diff --git a/sys-apps/util-linux/util-linux-2.37.ebuild 
b/sys-apps/util-linux/util-linux-2.37.ebuild
index 2b3ff76f988..e12e9483062 100644
--- a/sys-apps/util-linux/util-linux-2.37.ebuild
+++ b/sys-apps/util-linux/util-linux-2.37.ebuild
@@ -90,6 +90,10 @@ S="${WORKDIR}/${MY_P}"
 PATCHES=(
        # https://github.com/karelzak/util-linux/pull/1329
        "${FILESDIR}/${P}-ppc-nortas.patch"
+
+       "${FILESDIR}/${P}-lcrypt_link_fix.patch" # 801403
+       "${FILESDIR}/${P}-lcrypt_use_LIBS.patch" # 801403
+       "${FILESDIR}/${P}-avoid_autoreconf.patch" # 801403
 )
 
 rm_man() {

Reply via email to