commit:     c77e202de12022ab787403085c70c7b4c6801591
Author:     Mike Gilbert <floppym <AT> gentoo <DOT> org>
AuthorDate: Tue Mar  5 19:49:19 2024 +0000
Commit:     Mike Gilbert <floppym <AT> gentoo <DOT> org>
CommitDate: Tue Mar  5 19:49:19 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c77e202d

net-dialup/ppp: fix build with lld

Closes: https://bugs.gentoo.org/905442
Signed-off-by: Mike Gilbert <floppym <AT> gentoo.org>

 .../ppp/files/ppp-2.5.0-openssl-pkgconfig.patch    | 79 +++++++++++++++++++++
 net-dialup/ppp/files/ppp-2.5.0-pam-pkgconfig.patch | 81 ++++++++++++++++++++++
 net-dialup/ppp/ppp-2.5.0-r6.ebuild                 |  7 +-
 3 files changed, 165 insertions(+), 2 deletions(-)

diff --git a/net-dialup/ppp/files/ppp-2.5.0-openssl-pkgconfig.patch 
b/net-dialup/ppp/files/ppp-2.5.0-openssl-pkgconfig.patch
new file mode 100644
index 000000000000..893b623a4ea5
--- /dev/null
+++ b/net-dialup/ppp/files/ppp-2.5.0-openssl-pkgconfig.patch
@@ -0,0 +1,79 @@
+https://bugs.gentoo.org/905442
+https://github.com/ppp-project/ppp/pull/438
+
+From 9b4bdca70081abbad26277b009ef9c4ab7e276d0 Mon Sep 17 00:00:00 2001
+From: Brahmajit Das <[email protected]>
+Date: Thu, 2 Nov 2023 11:26:18 +0530
+Subject: [PATCH] Fix linking error with lld linkers (#438)
+
+When using lld linker, build fails with
+
+ld.lld: error: /usr/lib/gcc/x86_64-pc-linux-gnu/12/../../../../lib64/Scrt1.o 
is incompatible with elf32-i386
+ld.lld: error: /usr/lib/gcc/x86_64-pc-linux-gnu/12/../../../../lib64/crti.o is 
incompatible with elf32-i386
+ld.lld: error: /usr/lib/llvm/16/bin/../../../../lib/clang/16/lib/linux
+
+The fix is to check pkg-config first, and not force manual -L /usr/lib.
+If pkg-config succeeded, then we don't bother with -L /usr/lib
+
+Our guess is this what the actual intention was based upon the coments
+
+if pkg-config is installed and openssl has installed a .pc file,
+then use that information and don't search ssldirs
+
+First found on gentoo linux with llvm profile, please check out Bug:
+section of the commit for more info and a complete build log.
+
+Bug: https://bugs.gentoo.org/905442
+
+Signed-off-by: Brahmajit Das <[email protected]>
+Co-authored-by: Sam James <[email protected]>
+---
+ m4/ax_check_openssl.m4 | 28 ++++++++++++++--------------
+ 1 file changed, 14 insertions(+), 14 deletions(-)
+
+diff --git a/m4/ax_check_openssl.m4 b/m4/ax_check_openssl.m4
+index 8ae39cae6..39154c856 100644
+--- a/m4/ax_check_openssl.m4
++++ b/m4/ax_check_openssl.m4
+@@ -55,6 +55,20 @@ AC_DEFUN([AX_CHECK_OPENSSL], [
+         ])
+ 
+     AS_IF([test "${with_openssl}" != "no"], [
++        # if pkg-config is installed and openssl has installed a .pc file,
++        # then use that information and don't search ssldirs
++        AC_PATH_PROG([PKG_CONFIG], [pkg-config])
++        if test x"$PKG_CONFIG" != x""; then
++            OPENSSL_LDFLAGS=`$PKG_CONFIG openssl --libs-only-L 2>/dev/null`
++            if test $? = 0; then
++                OPENSSL_LIBS=`$PKG_CONFIG openssl --libs-only-l 2>/dev/null`
++                OPENSSL_INCLUDES=`$PKG_CONFIG openssl --cflags-only-I 
2>/dev/null`
++                found=true
++            fi
++        fi
++    ])
++
++    AS_IF([test "${with_openssl}" != "no" && test ! ${found}], [
+         OPENSSL_INCLUDES=
+         for ssldir in $ssldirs; do
+             AC_MSG_CHECKING([for openssl/ssl.h in $ssldir])
+@@ -69,20 +83,6 @@ AC_DEFUN([AX_CHECK_OPENSSL], [
+                 AC_MSG_RESULT([no])
+             ])
+         done])
+-     
+-    AS_IF([test "${with_openssl}" != "no" && test ! ${found}], [ 
+-        # if pkg-config is installed and openssl has installed a .pc file,
+-        # then use that information and don't search ssldirs
+-        AC_PATH_PROG([PKG_CONFIG], [pkg-config])
+-        if test x"$PKG_CONFIG" != x""; then
+-            OPENSSL_LDFLAGS=`$PKG_CONFIG openssl --libs-only-L 2>/dev/null`
+-            if test $? = 0; then
+-                OPENSSL_LIBS=`$PKG_CONFIG openssl --libs-only-l 2>/dev/null`
+-                OPENSSL_INCLUDES=`$PKG_CONFIG openssl --cflags-only-I 
2>/dev/null`
+-                found=true
+-            fi
+-        fi
+-    ])
+ 
+     AS_IF([test "${with_openssl}" != "no" && test ${found}], [
+ 

diff --git a/net-dialup/ppp/files/ppp-2.5.0-pam-pkgconfig.patch 
b/net-dialup/ppp/files/ppp-2.5.0-pam-pkgconfig.patch
new file mode 100644
index 000000000000..40488fee96b7
--- /dev/null
+++ b/net-dialup/ppp/files/ppp-2.5.0-pam-pkgconfig.patch
@@ -0,0 +1,81 @@
+https://github.com/ppp-project/ppp/pull/479
+
+From c73498fad415d99aa566b11256938272e62b22dd Mon Sep 17 00:00:00 2001
+From: Mike Gilbert <[email protected]>
+Date: Tue, 5 Mar 2024 14:41:10 -0500
+Subject: [PATCH] Use pkg-config to detect PAM when possible
+
+Signed-off-by: Mike Gilbert <[email protected]>
+---
+ m4/ax_check_pam.m4 | 50 ++++++++++++++++++++--------------------------
+ 1 file changed, 22 insertions(+), 28 deletions(-)
+
+diff --git a/m4/ax_check_pam.m4 b/m4/ax_check_pam.m4
+index b17a7573c..7ebd79b61 100644
+--- a/m4/ax_check_pam.m4
++++ b/m4/ax_check_pam.m4
+@@ -26,34 +26,28 @@
+ AC_DEFUN([AX_CHECK_PAM], [
+     AC_ARG_WITH([pam],
+         [AS_HELP_STRING([--with-pam=DIR],
+-            [With libpam support, see ftp.redhat.com:/pub/pam])],
+-        [
+-            case "$withval" in
+-            "" | y | ye | yes)
+-                pamdirs="/usr/local /usr/lib /usr"  
+-              ;;
+-            n | no)
+-                with_pam="no"
+-              ;;
+-            *)
+-                pamdirs="$withval"
+-              ;;
+-            esac
+-        ])
++            [With libpam support, see ftp.redhat.com:/pub/pam])])
+     
+-    if [ test "x${with_pam}" != "xno" ] ; then
+-        PAM_LIBS="-lpam"
+-        for pamdir in $pamdirs; do
+-            AC_MSG_CHECKING([for pam_appl.h in $pamdir])
+-            if test -f "$pamdir/include/security/pam_appl.h"; then
+-                PAM_CFLAGS="-I$pamdir/include"
+-                PAM_LDFLAGS="-L$pamdir/lib"
+-                AC_MSG_RESULT([yes])
+-                break
+-            else
+-                AC_MSG_RESULT([no])
+-            fi
+-        done
++    AS_IF([test "$with_pam" != "no"], [
++        AS_CASE(["$with_pam"],
++            [""|yes], [PKG_CHECK_MODULES([PAM], [pam], [pamdirs=],
++                        [pamdirs="/usr/local /usr/lib /usr"])],
++            [pamdirs="$with_pam"])
++
++        AS_IF([test -n "$pamdirs"], [
++            PAM_LIBS="-lpam"
++            for pamdir in $pamdirs; do
++                AC_MSG_CHECKING([for pam_appl.h in $pamdir])
++                if test -f "$pamdir/include/security/pam_appl.h"; then
++                    PAM_CFLAGS="-I$pamdir/include"
++                    PAM_LDFLAGS="-L$pamdir/lib"
++                    AC_MSG_RESULT([yes])
++                    break
++                else
++                    AC_MSG_RESULT([no])
++                fi
++            done
++        ])
+ 
+         # try the preprocessor and linker with our new flags,
+         # being careful not to pollute the global LIBS, LDFLAGS, and CPPFLAGS
+@@ -87,7 +81,7 @@ AC_DEFUN([AX_CHECK_PAM], [
+         AC_SUBST([PAM_CFLAGS])
+         AC_SUBST([PAM_LIBS])
+         AC_SUBST([PAM_LDFLAGS])
+-    fi
++    ])
+     AM_CONDITIONAL(WITH_LIBPAM, test "x${with_pam}" != "xno")
+ ])
+ 

diff --git a/net-dialup/ppp/ppp-2.5.0-r6.ebuild 
b/net-dialup/ppp/ppp-2.5.0-r6.ebuild
index 17550d021c06..b324ff383605 100644
--- a/net-dialup/ppp/ppp-2.5.0-r6.ebuild
+++ b/net-dialup/ppp/ppp-2.5.0-r6.ebuild
@@ -1,9 +1,9 @@
-# Copyright 1999-2023 Gentoo Authors
+# Copyright 1999-2024 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=8
 
-inherit linux-info pam tmpfiles
+inherit autotools linux-info pam tmpfiles
 
 DESCRIPTION="Point-to-Point Protocol (PPP)"
 HOMEPAGE="https://ppp.samba.org/";
@@ -38,6 +38,8 @@ PATCHES=(
        "${FILESDIR}"/ppp-2.5.0-passwordfd-read-early.patch
        "${FILESDIR}"/ppp-2.5.0-pidfile.patch
        "${FILESDIR}"/${P}-radiusclient.conf-parsing.patch
+       "${FILESDIR}"/ppp-2.5.0-openssl-pkgconfig.patch
+       "${FILESDIR}"/ppp-2.5.0-pam-pkgconfig.patch
 )
 
 pkg_setup() {
@@ -68,6 +70,7 @@ pkg_setup() {
 
 src_prepare() {
        default
+       eautoreconf
 
        # Set the right paths in radiusclient.conf
        sed -e "s:/usr/local/etc:/etc:" \

Reply via email to