kde-misc/kio-stash: Fix HOMEPAGE
[gentoo.git] / sys-libs / pam / pam-1.2.1.ebuild
1 # Copyright 1999-2017 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=5
5
6 inherit libtool multilib multilib-minimal eutils pam toolchain-funcs flag-o-matic db-use
7
8 MY_PN="Linux-PAM"
9 MY_P="${MY_PN}-${PV}"
10
11 DESCRIPTION="Linux-PAM (Pluggable Authentication Modules)"
12 HOMEPAGE="http://www.linux-pam.org/ https://fedorahosted.org/linux-pam/"
13 SRC_URI="http://www.linux-pam.org/library/${MY_P}.tar.bz2
14         http://www.linux-pam.org/documentation/${MY_PN}-1.2.0-docs.tar.bz2"
15
16 LICENSE="|| ( BSD GPL-2 )"
17 SLOT="0"
18 KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~amd64-linux ~x86-linux"
19 IUSE="audit berkdb cracklib debug nis nls +pie selinux test vim-syntax"
20
21 RDEPEND="nls? ( >=virtual/libintl-0-r1[${MULTILIB_USEDEP}] )
22         cracklib? ( >=sys-libs/cracklib-2.9.1-r1[${MULTILIB_USEDEP}] )
23         audit? ( >=sys-process/audit-2.2.2[${MULTILIB_USEDEP}] )
24         selinux? ( >=sys-libs/libselinux-2.2.2-r4[${MULTILIB_USEDEP}] )
25         berkdb? ( >=sys-libs/db-4.8.30-r1:=[${MULTILIB_USEDEP}] )
26         nis? ( >=net-libs/libtirpc-0.2.4-r2[${MULTILIB_USEDEP}] )"
27 DEPEND="${RDEPEND}
28         >=sys-devel/libtool-2
29         >=sys-devel/flex-2.5.39-r1[${MULTILIB_USEDEP}]
30         nls? ( sys-devel/gettext )
31         nis? ( >=virtual/pkgconfig-0-r1[${MULTILIB_USEDEP}] )"
32 PDEPEND="sys-auth/pambase
33         vim-syntax? ( app-vim/pam-syntax )"
34 RDEPEND="${RDEPEND}
35         !<sys-apps/openrc-0.11.8
36         !sys-auth/openpam
37         !sys-auth/pam_userdb
38         abi_x86_32? (
39                 !<=app-emulation/emul-linux-x86-baselibs-20140508-r7
40                 !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
41         )"
42
43 S="${WORKDIR}/${MY_P}"
44
45 check_old_modules() {
46         local retval="0"
47
48         if sed -e 's:#.*::' "${EROOT}"/etc/pam.d/* 2>/dev/null | fgrep -q pam_stack.so; then
49                 eerror ""
50                 eerror "Your current setup is using the pam_stack module."
51                 eerror "This module is deprecated and no longer supported, and since version"
52                 eerror "0.99 is no longer installed, nor provided by any other package."
53                 eerror "The package will be built (to allow binary package builds), but will"
54                 eerror "not be installed."
55                 eerror "Please replace pam_stack usage with proper include directive usage,"
56                 eerror "following the PAM Upgrade guide at the following URL"
57                 eerror "  https://wiki.gentoo.org/wiki/Project:PAM/Upgrade_to_0.99"
58                 eerror ""
59
60                 retval=1
61         fi
62
63         if sed -e 's:#.*::' "${EROOT}"/etc/pam.d/* 2>/dev/null | egrep -q 'pam_(pwdb|console)'; then
64                 eerror ""
65                 eerror "Your current setup is using one or more of the following modules,"
66                 eerror "that are not built or supported anymore:"
67                 eerror "pam_pwdb, pam_console"
68                 eerror "If you are in real need for these modules, please contact the maintainers"
69                 eerror "of PAM through https://bugs.gentoo.org/ providing information about its"
70                 eerror "use cases."
71                 eerror "Please also make sure to read the PAM Upgrade guide at the following URL:"
72                 eerror "  https://wiki.gentoo.org/wiki/Project:PAM/Upgrade_to_0.99"
73                 eerror ""
74
75                 retval=1
76         fi
77
78         return ${retval}
79 }
80
81 pkg_pretend() {
82         # do not error out, this is just a warning, one could build a binpkg
83         # with old modules enabled.
84         check_old_modules
85 }
86
87 src_unpack() {
88         # Upstream didn't release a new doc tarball (since nothing changed?).
89         unpack ${MY_PN}-1.2.0-docs.tar.bz2
90         mv Linux-PAM-1.2.{0,1} || die
91         unpack ${MY_P}.tar.bz2
92 }
93
94 src_prepare() {
95         elibtoolize
96 }
97
98 multilib_src_configure() {
99         # Do not let user's BROWSER setting mess us up. #549684
100         unset BROWSER
101
102         # Disable automatic detection of libxcrypt; we _don't_ want the
103         # user to link libxcrypt in by default, since we won't track the
104         # dependency and allow to break PAM this way.
105         export ac_cv_header_xcrypt_h=no
106
107         local myconf=(
108                 --docdir='$(datarootdir)'/doc/${PF}
109                 --htmldir='$(docdir)/html'
110                 --libdir='$(prefix)'/$(get_libdir)
111                 --enable-securedir="${EPREFIX}"/$(get_libdir)/security
112                 --enable-isadir='.' #464016
113                 $(use_enable nls)
114                 $(use_enable selinux)
115                 $(use_enable cracklib)
116                 $(use_enable audit)
117                 $(use_enable debug)
118                 $(use_enable berkdb db)
119                 $(use_enable nis)
120                 $(use_enable pie)
121                 --with-db-uniquename=-$(db_findver sys-libs/db)
122                 --disable-prelude
123                 --disable-regenerate-docu
124         )
125
126         ECONF_SOURCE=${S} \
127         econf "${myconf[@]}"
128 }
129
130 multilib_src_compile() {
131         emake sepermitlockdir="${EPREFIX}/run/sepermit"
132 }
133
134 multilib_src_install() {
135         emake DESTDIR="${D}" install \
136                 sepermitlockdir="${EPREFIX}/run/sepermit"
137
138         local prefix
139         if multilib_is_native_abi; then
140                 prefix=
141                 gen_usr_ldscript -a pam pamc pam_misc
142         else
143                 prefix=/usr
144         fi
145
146         # create extra symlinks just in case something depends on them...
147         local lib
148         for lib in pam pamc pam_misc; do
149                 if ! [[ -f "${ED}"${prefix}/$(get_libdir)/lib${lib}$(get_libname) ]]; then
150                         dosym lib${lib}$(get_libname 0) ${prefix}/$(get_libdir)/lib${lib}$(get_libname)
151                 fi
152         done
153 }
154
155 DOCS=( CHANGELOG ChangeLog README AUTHORS Copyright NEWS )
156
157 multilib_src_install_all() {
158         einstalldocs
159         prune_libtool_files --all
160
161         # Need to be suid
162         fperms 4711 /sbin/unix_chkpwd
163
164         docinto modules
165         local dir
166         for dir in modules/pam_*; do
167                 newdoc "${dir}"/README README."$(basename "${dir}")"
168         done
169
170         if use selinux; then
171                 dodir /usr/lib/tmpfiles.d
172                 cat - > "${D}"/usr/lib/tmpfiles.d/${CATEGORY}:${PN}:${SLOT}.conf <<EOF
173 d /run/sepermit 0755 root root
174 EOF
175         fi
176 }
177
178 pkg_preinst() {
179         check_old_modules || die "deprecated PAM modules still used"
180 }
181
182 pkg_postinst() {
183         ewarn "Some software with pre-loaded PAM libraries might experience"
184         ewarn "warnings or failures related to missing symbols and/or versions"
185         ewarn "after any update. While unfortunate this is a limit of the"
186         ewarn "implementation of PAM and the software, and it requires you to"
187         ewarn "restart the software manually after the update."
188         ewarn ""
189         ewarn "You can get a list of such software running a command like"
190         ewarn "  lsof / | egrep -i 'del.*libpam\\.so'"
191         ewarn ""
192         ewarn "Alternatively, simply reboot your system."
193         if [[ -x "${EROOT}"/var/log/tallylog ]] ; then
194                 elog ""
195                 elog "Because of a bug present up to version 1.1.1-r2, you have"
196                 elog "an executable /var/log/tallylog file. You can safely"
197                 elog "correct it by running the command"
198                 elog "  chmod -x /var/log/tallylog"
199                 elog ""
200         fi
201 }