*/*: Clean PYTHON_COMPAT of obsolete impls
[gentoo.git] / dev-libs / libpwquality / libpwquality-1.4.2.ebuild
1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=7
5 PYTHON_COMPAT=( python3_{6,7,8} )
6
7 inherit pam python-r1 toolchain-funcs usr-ldscript
8
9 DESCRIPTION="Library for password quality checking and generating random passwords"
10 HOMEPAGE="https://github.com/libpwquality/libpwquality"
11 SRC_URI="https://github.com/${PN}/${PN}/releases/download/${P}/${P}.tar.bz2"
12
13 LICENSE="|| ( BSD GPL-2 )"
14 SLOT="0"
15 KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
16 IUSE="pam python static-libs"
17 REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
18
19 BDEPEND="
20         >=sys-devel/gettext-0.18.2
21         virtual/pkgconfig
22 "
23 RDEPEND="
24         >=sys-libs/cracklib-2.8:=[static-libs(+)?]
25         pam? ( sys-libs/pam )
26         python? ( ${PYTHON_DEPS} )
27 "
28 DEPEND="${RDEPEND}"
29
30 src_prepare() {
31         default
32         # ensure pkgconfig files go in /usr
33         sed -e 's:\(pkgconfigdir *=\).*:\1 '${EPREFIX}/usr/$(get_libdir)'/pkgconfig:' \
34                 -i src/Makefile.{am,in} || die "sed failed"
35         use python && python_copy_sources
36 }
37
38 src_configure() {
39         # Install library in /lib for pam
40         configuring() {
41                 local sitedir
42                 econf \
43                         --libdir="${EPREFIX}/$(get_libdir)" \
44                         $(use_enable pam) \
45                         --with-securedir="${EPREFIX}/$(getpam_mod_dir)" \
46                         $(use_enable python python-bindings) \
47                         $(usex python "--with-pythonsitedir=$(use python && python_get_sitedir)" "") \
48                         $(use_enable static-libs static)
49         }
50         if_use_python_python_foreach_impl configuring
51 }
52
53 src_compile() {
54         if_use_python_python_foreach_impl default
55 }
56
57 src_test() {
58         if_use_python_python_foreach_impl default
59 }
60
61 src_install() {
62         if_use_python_python_foreach_impl default
63         if use static-libs; then
64                 # Do not install static libs in /lib
65                 mkdir -p "${ED}/usr/$(get_libdir)"
66                 mv "${ED}/$(get_libdir)/libpwquality.a" "${ED}/usr/$(get_libdir)/" || die
67                 gen_usr_ldscript libpwquality.so
68         fi
69         find "${ED}" -name '*.la' -delete || die
70 }
71
72 if_use_python_python_foreach_impl() {
73         if use python; then
74                 python_foreach_impl run_in_build_dir "$@"
75         else
76                 "$@"
77         fi
78 }