669e205e8e8f144464b7ec2f60f9ac6e629c9eea
[gentoo.git] / sys-libs / pam / pam-1.3.1-r2.ebuild
1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=7
5
6 inherit autotools db-use fcaps multilib-minimal toolchain-funcs usr-ldscript
7
8 DESCRIPTION="Linux-PAM (Pluggable Authentication Modules)"
9 HOMEPAGE="https://github.com/linux-pam/linux-pam"
10 SRC_URI="https://github.com/linux-pam/linux-pam/archive/v${PV}.tar.gz -> ${P}.tar.gz"
11
12 LICENSE="|| ( BSD GPL-2 )"
13 SLOT="0"
14 KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 m68k ~mips ppc ppc64 ~riscv s390 sparc x86 ~amd64-linux ~x86-linux"
15 IUSE="audit berkdb +cracklib debug nis +pie selinux static-libs"
16
17 BDEPEND="app-text/docbook-xml-dtd:4.1.2
18         app-text/docbook-xml-dtd:4.3
19         app-text/docbook-xml-dtd:4.4
20         app-text/docbook-xml-dtd:4.5
21         dev-libs/libxslt
22         sys-devel/flex
23         sys-devel/gettext
24         virtual/pkgconfig[${MULTILIB_USEDEP}]"
25
26 DEPEND="
27         virtual/libcrypt:=[${MULTILIB_USEDEP}]
28         >=virtual/libintl-0-r1[${MULTILIB_USEDEP}]
29         audit? ( >=sys-process/audit-2.2.2[${MULTILIB_USEDEP}] )
30         berkdb? ( >=sys-libs/db-4.8.30-r1:=[${MULTILIB_USEDEP}] )
31         cracklib? ( >=sys-libs/cracklib-2.9.1-r1[${MULTILIB_USEDEP}] )
32         selinux? ( >=sys-libs/libselinux-2.2.2-r4[${MULTILIB_USEDEP}] )
33         nis? ( >=net-libs/libtirpc-0.2.4-r2[${MULTILIB_USEDEP}] )"
34
35 RDEPEND="${DEPEND}"
36
37 PDEPEND="sys-auth/pambase"
38
39 S="${WORKDIR}/linux-${P}"
40
41 src_prepare() {
42         default
43         eapply "${FILESDIR}/${PN}-remove-browsers.patch"
44         touch ChangeLog || die
45         eautoreconf
46 }
47
48 multilib_src_configure() {
49         # Do not let user's BROWSER setting mess us up. #549684
50         unset BROWSER
51
52         # Disable automatic detection of libxcrypt; we _don't_ want the
53         # user to link libxcrypt in by default, since we won't track the
54         # dependency and allow to break PAM this way.
55
56         export ac_cv_header_xcrypt_h=no
57
58         local myconf=(
59                 --with-db-uniquename=-$(db_findver sys-libs/db)
60                 --enable-securedir="${EPREFIX}"/$(get_libdir)/security
61                 --libdir=/usr/$(get_libdir)
62                 --disable-prelude
63                 $(use_enable audit)
64                 $(use_enable berkdb db)
65                 $(use_enable cracklib)
66                 $(use_enable debug)
67                 $(use_enable nis)
68                 $(use_enable pie)
69                 $(use_enable selinux)
70                 $(use_enable static-libs static)
71                 --enable-isadir='.' #464016
72                 )
73         ECONF_SOURCE="${S}" econf ${myconf[@]}
74 }
75
76 multilib_src_compile() {
77         emake sepermitlockdir="${EPREFIX}/run/sepermit"
78 }
79
80 multilib_src_install() {
81         emake DESTDIR="${D}" install \
82                 sepermitlockdir="${EPREFIX}/run/sepermit"
83
84         gen_usr_ldscript -a pam pam_misc pamc
85 }
86
87 multilib_src_install_all() {
88         find "${ED}" -type f -name '*.la' -delete || die
89
90         if use selinux; then
91                 dodir /usr/lib/tmpfiles.d
92                 cat - > "${D}"/usr/lib/tmpfiles.d/${CATEGORY}:${PN}:${SLOT}.conf <<EOF
93 d /run/sepermit 0755 root root
94 EOF
95         fi
96 }
97
98 pkg_postinst() {
99         ewarn "Some software with pre-loaded PAM libraries might experience"
100         ewarn "warnings or failures related to missing symbols and/or versions"
101         ewarn "after any update. While unfortunate this is a limit of the"
102         ewarn "implementation of PAM and the software, and it requires you to"
103         ewarn "restart the software manually after the update."
104         ewarn ""
105         ewarn "You can get a list of such software running a command like"
106         ewarn "  lsof / | egrep -i 'del.*libpam\\.so'"
107         ewarn ""
108         ewarn "Alternatively, simply reboot your system."
109
110         # The pam_unix module needs to check the password of the user which requires
111         # read access to /etc/shadow only.
112         fcaps cap_dac_override sbin/unix_chkpwd
113 }