commit:     698929c9089de3995cd31c0a3a22866f3e5b7cba
Author:     Violet Purcell <vimproved <AT> inventati <DOT> org>
AuthorDate: Thu May 11 17:02:43 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu May 11 19:50:52 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=698929c9

sys-libs/pam: fix build on musl

[sam: Note that the examples aren't installed anyway.]

Closes: https://bugs.gentoo.org/906137
Signed-off-by: Violet Purcell <vimproved <AT> inventati.org>
Closes: https://github.com/gentoo/gentoo/pull/31000
Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/pam/files/pam-1.5.3-termios.patch | 34 ++++++++++++++++++++++++++++++
 sys-libs/pam/pam-1.5.3.ebuild              |  4 ++++
 2 files changed, 38 insertions(+)

diff --git a/sys-libs/pam/files/pam-1.5.3-termios.patch 
b/sys-libs/pam/files/pam-1.5.3-termios.patch
new file mode 100644
index 000000000000..8f7baf76fee4
--- /dev/null
+++ b/sys-libs/pam/files/pam-1.5.3-termios.patch
@@ -0,0 +1,34 @@
+Replace System V termio.h with POSIX termios.h for musl
+Upstream: https://github.com/linux-pam/linux-pam/pull/576
+Bug: https://bugs.gentoo.org/906137
+
+From 5658105b04ad4df212baf302898ee2cca99516a6 Mon Sep 17 00:00:00 2001
+From: Violet Purcell <[email protected]>
+Date: Thu, 11 May 2023 10:27:53 -0400
+Subject: [PATCH] fix build on musl
+
+--- a/examples/tty_conv.c
++++ b/examples/tty_conv.c
+@@ -6,8 +6,9 @@
+ #include <string.h>
+ #include <errno.h>
+ #include <unistd.h>
+-#include <termio.h>
++#include <termios.h>
+ #include <security/pam_appl.h>
++#include <sys/ioctl.h>
+ 
+ /***************************************
+  * @brief echo off/on
+@@ -16,7 +17,7 @@
+  ***************************************/
+ static void echoOff(int fd, int off)
+ {
+-    struct termio tty;
++    struct termios tty;
+     if (ioctl(fd, TCGETA, &tty) < 0)
+     {
+         fprintf(stderr, "TCGETA failed: %s\n", strerror(errno));
+-- 
+2.40.1
+

diff --git a/sys-libs/pam/pam-1.5.3.ebuild b/sys-libs/pam/pam-1.5.3.ebuild
index 6ac576c5eb0b..3f5a98a6d7df 100644
--- a/sys-libs/pam/pam-1.5.3.ebuild
+++ b/sys-libs/pam/pam-1.5.3.ebuild
@@ -45,6 +45,10 @@ DEPEND="
 RDEPEND="${DEPEND}"
 PDEPEND=">=sys-auth/pambase-20200616"
 
+PATCHES=(
+       "${FILESDIR}/${P}-termios.patch"
+)
+
 src_prepare() {
        default
        touch ChangeLog || die

Reply via email to