commit:     1905d5242be1770a6c7fe2c3fca2397eebcfaef4
Author:     Christopher Byrne <salah.coronya <AT> gmail <DOT> com>
AuthorDate: Wed Jun 26 01:12:18 2024 +0000
Commit:     Matthew Thode <prometheanfire <AT> gentoo <DOT> org>
CommitDate: Mon Jul  8 17:16:46 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1905d524

sys-auth/nss-pam-ldapd: Fix build on clang

Upstream pull request: https://github.com/arthurdejong/nss-pam-ldapd/pull/68

Closes: https://bugs.gentoo.org/832002
Signed-off-by: Christopher Byrne <salah.coronya <AT> gmail.com>
Closes: https://github.com/gentoo/gentoo/pull/37304
Signed-off-by: Matthew Thode <prometheanfire <AT> gentoo.org>

 ...d-0.9.12-configure-CFLAGS-decontamination.patch | 55 ++++++++++++++++++++++
 .../nss-pam-ldapd/nss-pam-ldapd-0.9.12-r4.ebuild   |  5 ++
 2 files changed, 60 insertions(+)

diff --git 
a/sys-auth/nss-pam-ldapd/files/nss-pam-ldapd-0.9.12-configure-CFLAGS-decontamination.patch
 
b/sys-auth/nss-pam-ldapd/files/nss-pam-ldapd-0.9.12-configure-CFLAGS-decontamination.patch
new file mode 100644
index 000000000000..00687e2c7492
--- /dev/null
+++ 
b/sys-auth/nss-pam-ldapd/files/nss-pam-ldapd-0.9.12-configure-CFLAGS-decontamination.patch
@@ -0,0 +1,55 @@
+diff --git a/configure.ac b/configure.ac
+index 12bf35c..beb13bf 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -101,39 +101,25 @@ then
+ fi
+ 
+ # check for debugging options
++DEBUG_CFLAGS=""
+ AC_ARG_ENABLE(debug,
+               AS_HELP_STRING([--enable-debug],
+                              [enable extensive debugging and logging]),
+-              [if test "x$enableval" != "xno" ; then CFLAGS="-g -DDEBUG 
$CFLAGS" ; fi])
++              [AS_IF([test "x$enableval" != "xno"],
++                  [AX_APPEND_COMPILE_FLAGS([-g -DDEBUG],[DEBUG_CFLAGS])]
++              )])
++AC_SUBST([DEBUG_CFLAGS])
+ 
+ # check for extra compiler warnings
+-DESIRED_CFLAGS=""
++EXTRA_CFLAGS=""
+ AC_ARG_ENABLE(warnings,
+               AS_HELP_STRING([--enable-warnings],
+                              [enable extra compiler warnings (gcc)]),
+-              [if test "x$enableval" != "no"
+-               then
+-                 CFLAGS="$CFLAGS -pedantic -Wall -Wshadow -Wpointer-arith 
-Wcast-align -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs 
-Waggregate-return -Wmissing-declarations -Wunused -Wformat=2 -Wswitch-default 
-Wswitch-enum -Wfloat-equal -Wbad-function-cast -Wredundant-decls"
+-                 DESIRED_CFLAGS="$DESIRED_CFLAGS -Wextra 
-Wdeclaration-after-statement -Werror-implicit-function-declaration 
-Werror=implicit"
+-               fi])
+-test_gcc_flag() {
+-  AC_LANG_CONFTEST([AC_LANG_PROGRAM()])
+-  $CC -c conftest.c $CFLAGS $@ > /dev/null 2> /dev/null
+-  ret=$?
+-  rm -f conftest.o
+-  return $ret
+-}
+-for flag in $DESIRED_CFLAGS
+-do
+-  AC_MSG_CHECKING([whether $CC accepts $flag])
+-  if test_gcc_flag $flag
+-  then
+-    CFLAGS="$CFLAGS $flag"
+-    AC_MSG_RESULT([yes])
+-  else
+-    AC_MSG_RESULT([no])
+-  fi
+-done
++              [AS_IF([test "x$enableval" != "xno"],[
++                 AX_APPEND_COMPILE_FLAGS([-pedantic -Wall -Wshadow 
-Wpointer-arith -Wcast-align -Wstrict-prototypes -Wmissing-prototypes 
-Wnested-externs -Waggregate-return -Wmissing-declarations -Wunused -Wformat=2 
-Wswitch-default -Wswitch-enum -Wfloat-equal -Wbad-function-cast 
-Wredundant-decls],[EXTRA_CFLAGS],[-Werror])
++                 AX_APPEND_COMPILE_FLAGS([-Wextra 
-Wdeclaration-after-statement -Werror-implicit-function-declaration 
-Werror=implicit],[EXTRA_CFLAGS],[-Werror])
++               ])])
++AC_SUBST([EXTRA_CFLAGS])
+ 
+ # check for Position Independent Code compiler option
+ PIC_CFLAGS=""

diff --git a/sys-auth/nss-pam-ldapd/nss-pam-ldapd-0.9.12-r4.ebuild 
b/sys-auth/nss-pam-ldapd/nss-pam-ldapd-0.9.12-r4.ebuild
index 85c045be9ab5..1073dd8e15e7 100644
--- a/sys-auth/nss-pam-ldapd/nss-pam-ldapd-0.9.12-r4.ebuild
+++ b/sys-auth/nss-pam-ldapd/nss-pam-ldapd-0.9.12-r4.ebuild
@@ -52,6 +52,7 @@ PATCHES=(
        "${FILESDIR}"/nss-pam-ldapd-0.9.11-tests.patch
        "${FILESDIR}"/nss-pam-ldapd-0.9.11-tests-py39.patch
        "${FILESDIR}"/nss-pam-ldapd-0.9.12-netdb-defines.patch
+       
"${FILESDIR}"/nss-pam-ldapd-0.9.12-configure-CFLAGS-decontamination.patch
 )
 
 pkg_setup() {
@@ -64,6 +65,10 @@ src_prepare() {
        touch pynslcd/__init__.py || die "Could not create __init__.py for 
pynslcd"
        mv pynslcd/pynslcd.py pynslcd/main.py || die
 
+        find "${S}" -name Makefile.am -exec \
+        sed -e '/^AM_CFLAGS/ s/$/ \$(DEBUG_CFLAGS) \$(EXTRA_CFLAGS)/g' \
+        -i {} \; || die
+
        eautoreconf
 }
 

Reply via email to