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} )
9 inherit distutils-r1 libtool multilib-minimal toolchain-funcs usr-ldscript
12 DESCRIPTION="Password Checking Library"
13 HOMEPAGE="https://github.com/cracklib/cracklib/"
14 # source tarballs on GitHub lack pre-generated configure script.
15 #SRC_URI="https://github.com/${PN}/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz"
16 SRC_URI="https://dev.gentoo.org/~polynomial-c/dist/${P}.tar.gz"
20 KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 m68k ~mips ppc ppc64 s390 sparc x86 ~amd64-linux ~x86-linux ~ppc-macos ~x86-macos ~m68k-mint"
21 IUSE="nls python static-libs zlib"
22 REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
24 RDEPEND="python? ( ${PYTHON_DEPS} )
25 zlib? ( >=sys-libs/zlib-1.2.8-r1:=[${MULTILIB_USEDEP}] )"
28 dev-python/setuptools[${PYTHON_USEDEP}]
31 S="${WORKDIR}/${MY_P}"
34 "${FILESDIR}"/cracklib-2.9.6-CVE-2016-6318.patch
35 "${FILESDIR}"/cracklib-2.9.6-fix-long-word-bufferoverflow.patch
39 multilib_is_native_abi || return 0
40 use python || return 0
41 pushd python > /dev/null || die
42 distutils-r1_src_${EBUILD_PHASE}
48 if has unmerge-orphans ${FEATURES} && has_version "<${CATEGORY}/${PN}-2.8.10" ; then
49 eerror "Upgrade path is broken with FEATURES=unmerge-orphans"
50 eerror "Please run: FEATURES=-unmerge-orphans emerge cracklib"
51 die "Please run: FEATURES=-unmerge-orphans emerge cracklib"
56 eapply -p2 "${PATCHES[@]}"
62 multilib_src_configure() {
64 # use /usr/lib so that the dictionary is shared between ABIs
65 --with-default-dict='/usr/lib/cracklib_dict'
68 $(use_enable static-libs static)
70 export ac_cv_header_zlib_h=$(usex zlib)
71 export ac_cv_search_gzopen=$(usex zlib -lz no)
72 ECONF_SOURCE="${S}" econf "${myeconfargs[@]}"
75 multilib_src_compile() {
81 # Make sure we load the freshly built library
82 LD_LIBRARY_PATH="${BUILD_DIR}/lib/.libs" do_python
86 ${EPYTHON} -m unittest test_cracklib || die "Tests fail with ${EPYTHON}"
89 multilib_src_install() {
91 # move shared libs to /
92 gen_usr_ldscript -a crack
97 multilib_src_install_all() {
99 find "${ED}" -name "*.la" -delete || die
100 rm -r "${ED%/}"/usr/share/cracklib || die
102 insinto /usr/share/dict
103 doins dicts/cracklib-small
107 if [[ ${ROOT} == "/" ]] ; then
108 ebegin "Regenerating cracklib dictionary"
109 create-cracklib-dict "${EPREFIX}"/usr/share/dict/* > /dev/null