1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
5 PYTHON_COMPAT=( python3_{6,7,8} )
7 inherit pam python-r1 toolchain-funcs usr-ldscript
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"
13 LICENSE="|| ( BSD GPL-2 )"
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} )"
20 >=sys-devel/gettext-0.18.2
24 >=sys-libs/cracklib-2.8:=[static-libs(+)?]
26 python? ( ${PYTHON_DEPS} )
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
39 # Install library in /lib for pam
43 --libdir="${EPREFIX}/$(get_libdir)" \
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)
50 if_use_python_python_foreach_impl configuring
54 if_use_python_python_foreach_impl default
58 if_use_python_python_foreach_impl default
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
69 find "${ED}" -name '*.la' -delete || die
72 if_use_python_python_foreach_impl() {
74 python_foreach_impl run_in_build_dir "$@"