*/*: Drop stable ia64 keywords
[gentoo.git] / sys-libs / cracklib / cracklib-2.9.6-r2.ebuild
1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=6
5
6 PYTHON_COMPAT=( python{2_7,3_6} )
7 DISTUTILS_OPTIONAL=1
8
9 inherit distutils-r1 libtool multilib-minimal toolchain-funcs usr-ldscript
10
11 MY_P=${P/_}
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"
17
18 LICENSE="LGPL-2.1"
19 SLOT="0"
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} )"
23
24 RDEPEND="python? ( ${PYTHON_DEPS} )
25         zlib? ( >=sys-libs/zlib-1.2.8-r1:=[${MULTILIB_USEDEP}] )"
26 DEPEND="${RDEPEND}
27         python? (
28                 dev-python/setuptools[${PYTHON_USEDEP}]
29         )"
30
31 S="${WORKDIR}/${MY_P}"
32
33 PATCHES=(
34         "${FILESDIR}"/cracklib-2.9.6-CVE-2016-6318.patch
35         "${FILESDIR}"/cracklib-2.9.6-fix-long-word-bufferoverflow.patch
36 )
37
38 do_python() {
39         multilib_is_native_abi || return 0
40         use python || return 0
41         pushd python > /dev/null || die
42         distutils-r1_src_${EBUILD_PHASE}
43         popd > /dev/null
44 }
45
46 pkg_setup() {
47         # workaround #195017
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"
52         fi
53 }
54
55 src_prepare() {
56         eapply -p2 "${PATCHES[@]}"
57         eapply_user
58         elibtoolize #269003
59         do_python
60 }
61
62 multilib_src_configure() {
63         local myeconfargs=(
64                 # use /usr/lib so that the dictionary is shared between ABIs
65                 --with-default-dict='/usr/lib/cracklib_dict'
66                 --without-python
67                 $(use_enable nls)
68                 $(use_enable static-libs static)
69         )
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[@]}"
73 }
74
75 multilib_src_compile() {
76         default
77         do_python
78 }
79
80 multilib_src_test() {
81         # Make sure we load the freshly built library
82         LD_LIBRARY_PATH="${BUILD_DIR}/lib/.libs" do_python
83 }
84
85 python_test() {
86         ${EPYTHON} -m unittest test_cracklib || die "Tests fail with ${EPYTHON}"
87 }
88
89 multilib_src_install() {
90         default
91         # move shared libs to /
92         gen_usr_ldscript -a crack
93
94         do_python
95 }
96
97 multilib_src_install_all() {
98         einstalldocs
99         find "${ED}" -name "*.la" -delete || die
100         rm -r "${ED%/}"/usr/share/cracklib || die
101
102         insinto /usr/share/dict
103         doins dicts/cracklib-small
104 }
105
106 pkg_postinst() {
107         if [[ ${ROOT} == "/" ]] ; then
108                 ebegin "Regenerating cracklib dictionary"
109                 create-cracklib-dict "${EPREFIX}"/usr/share/dict/* > /dev/null
110                 eend $?
111         fi
112 }