Use https by default
[gentoo.git] / sys-libs / pam / pam-1.2.1.ebuild
1 # Copyright 1999-2015 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Id$
4
5 EAPI=5
6
7 inherit libtool multilib multilib-minimal eutils pam toolchain-funcs flag-o-matic db-use
8
9 MY_PN="Linux-PAM"
10 MY_P="${MY_PN}-${PV}"
11
12 DESCRIPTION="Linux-PAM (Pluggable Authentication Modules)"
13 HOMEPAGE="http://www.linux-pam.org/ https://fedorahosted.org/linux-pam/"
14 SRC_URI="http://www.linux-pam.org/library/${MY_P}.tar.bz2
15         http://www.linux-pam.org/documentation/${MY_PN}-1.2.0-docs.tar.bz2"
16
17 LICENSE="|| ( BSD GPL-2 )"
18 SLOT="0"
19 KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~amd64-linux ~ia64-linux ~x86-linux"
20 IUSE="audit berkdb cracklib debug nis nls +pie selinux test vim-syntax"
21
22 RDEPEND="nls? ( >=virtual/libintl-0-r1[${MULTILIB_USEDEP}] )
23         cracklib? ( >=sys-libs/cracklib-2.9.1-r1[${MULTILIB_USEDEP}] )
24         audit? ( >=sys-process/audit-2.2.2[${MULTILIB_USEDEP}] )
25         selinux? ( >=sys-libs/libselinux-2.2.2-r4[${MULTILIB_USEDEP}] )
26         berkdb? ( >=sys-libs/db-4.8.30-r1[${MULTILIB_USEDEP}] )
27         nis? ( >=net-libs/libtirpc-0.2.4-r2[${MULTILIB_USEDEP}] )"
28 DEPEND="${RDEPEND}
29         >=sys-devel/libtool-2
30         >=sys-devel/flex-2.5.39-r1[${MULTILIB_USEDEP}]
31         nls? ( sys-devel/gettext )
32         nis? ( >=virtual/pkgconfig-0-r1[${MULTILIB_USEDEP}] )"
33 PDEPEND="sys-auth/pambase
34         vim-syntax? ( app-vim/pam-syntax )"
35 RDEPEND="${RDEPEND}
36         !<sys-apps/openrc-0.11.8
37         !sys-auth/openpam
38         !sys-auth/pam_userdb
39         abi_x86_32? (
40                 !<=app-emulation/emul-linux-x86-baselibs-20140508-r7
41                 !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
42         )"
43
44 S="${WORKDIR}/${MY_P}"
45
46 check_old_modules() {
47         local retval="0"
48
49         if sed -e 's:#.*::' "${EROOT}"/etc/pam.d/* 2>/dev/null | fgrep -q pam_stack.so; then
50                 eerror ""
51                 eerror "Your current setup is using the pam_stack module."
52                 eerror "This module is deprecated and no longer supported, and since version"
53                 eerror "0.99 is no longer installed, nor provided by any other package."
54                 eerror "The package will be built (to allow binary package builds), but will"
55                 eerror "not be installed."
56                 eerror "Please replace pam_stack usage with proper include directive usage,"
57                 eerror "following the PAM Upgrade guide at the following URL"
58                 eerror "  https://www.gentoo.org/proj/en/base/pam/upgrade-0.99.xml"
59                 eerror ""
60
61                 retval=1
62         fi
63
64         if sed -e 's:#.*::' "${EROOT}"/etc/pam.d/* 2>/dev/null | egrep -q 'pam_(pwdb|console)'; then
65                 eerror ""
66                 eerror "Your current setup is using one or more of the following modules,"
67                 eerror "that are not built or supported anymore:"
68                 eerror "pam_pwdb, pam_console"
69                 eerror "If you are in real need for these modules, please contact the maintainers"
70                 eerror "of PAM through http://bugs.gentoo.org/ providing information about its"
71                 eerror "use cases."
72                 eerror "Please also make sure to read the PAM Upgrade guide at the following URL:"
73                 eerror "  https://www.gentoo.org/proj/en/base/pam/upgrade-0.99.xml"
74                 eerror ""
75
76                 retval=1
77         fi
78
79         return ${retval}
80 }
81
82 pkg_pretend() {
83         # do not error out, this is just a warning, one could build a binpkg
84         # with old modules enabled.
85         check_old_modules
86 }
87
88 src_unpack() {
89         # Upstream didn't release a new doc tarball (since nothing changed?).
90         unpack ${MY_PN}-1.2.0-docs.tar.bz2
91         mv Linux-PAM-1.2.{0,1} || die
92         unpack ${MY_P}.tar.bz2
93 }
94
95 src_prepare() {
96         elibtoolize
97 }
98
99 multilib_src_configure() {
100         # Do not let user's BROWSER setting mess us up. #549684
101         unset BROWSER
102
103         # Disable automatic detection of libxcrypt; we _don't_ want the
104         # user to link libxcrypt in by default, since we won't track the
105         # dependency and allow to break PAM this way.
106         export ac_cv_header_xcrypt_h=no
107
108         local myconf=(
109                 --docdir='$(datarootdir)'/doc/${PF}
110                 --htmldir='$(docdir)/html'
111                 --libdir='$(prefix)'/$(get_libdir)
112                 --enable-securedir="${EPREFIX}"/$(get_libdir)/security
113                 --enable-isadir='.' #464016
114                 $(use_enable nls)
115                 $(use_enable selinux)
116                 $(use_enable cracklib)
117                 $(use_enable audit)
118                 $(use_enable debug)
119                 $(use_enable berkdb db)
120                 $(use_enable nis)
121                 $(use_enable pie)
122                 --with-db-uniquename=-$(db_findver sys-libs/db)
123                 --disable-prelude
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 }