1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
6 PYTHON_COMPAT=( python{2_7,3_{6,7,8}} )
9 inherit distutils-r1 libtool multilib-minimal toolchain-funcs usr-ldscript
12 DESCRIPTION="Password Checking Library"
13 HOMEPAGE="https://github.com/cracklib/cracklib/"
14 SRC_URI="https://github.com/${PN}/${PN}/releases/download/v${PV}/${P}.tar.bz2"
18 KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 m68k ~mips ppc ppc64 ~riscv s390 sparc x86 ~amd64-linux ~x86-linux ~ppc-macos ~x86-macos ~m68k-mint"
19 IUSE="nls python static-libs zlib"
20 REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
22 RDEPEND="python? ( ${PYTHON_DEPS} )
23 zlib? ( >=sys-libs/zlib-1.2.8-r1:=[${MULTILIB_USEDEP}] )"
26 dev-python/setuptools[${PYTHON_USEDEP}]
29 S="${WORKDIR}/${MY_P}"
32 multilib_is_native_abi || return 0
33 use python || return 0
34 pushd python > /dev/null || die
35 distutils-r1_src_${EBUILD_PHASE}
41 if has unmerge-orphans ${FEATURES} && has_version "<${CATEGORY}/${PN}-2.8.10" ; then
42 eerror "Upgrade path is broken with FEATURES=unmerge-orphans"
43 eerror "Please run: FEATURES=-unmerge-orphans emerge cracklib"
44 die "Please run: FEATURES=-unmerge-orphans emerge cracklib"
54 multilib_src_configure() {
56 # use /usr/lib so that the dictionary is shared between ABIs
57 --with-default-dict='/usr/lib/cracklib_dict'
60 $(use_enable static-libs static)
62 export ac_cv_header_zlib_h=$(usex zlib)
63 export ac_cv_search_gzopen=$(usex zlib -lz no)
64 ECONF_SOURCE="${S}" econf "${myeconfargs[@]}"
67 multilib_src_compile() {
73 # Make sure we load the freshly built library
74 LD_LIBRARY_PATH="${BUILD_DIR}/lib/.libs" do_python
78 ${EPYTHON} -m unittest test_cracklib || die "Tests fail with ${EPYTHON}"
81 multilib_src_install() {
83 # move shared libs to /
84 gen_usr_ldscript -a crack
89 multilib_src_install_all() {
91 find "${ED}" -name "*.la" -delete || die
92 rm -r "${ED%/}"/usr/share/cracklib || die
94 insinto /usr/share/dict
95 doins dicts/cracklib-small
99 if [[ ${ROOT} == "/" ]] ; then
100 ebegin "Regenerating cracklib dictionary"
101 create-cracklib-dict "${EPREFIX}"/usr/share/dict/* > /dev/null