*/*: Clean PYTHON_COMPAT of obsolete impls
[gentoo.git] / sys-libs / ldb / ldb-2.0.7.ebuild
1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=6
5 PYTHON_COMPAT=( python3_{6,7} )
6 PYTHON_REQ_USE="threads(+)"
7
8 inherit python-single-r1 waf-utils multilib-minimal eutils
9
10 DESCRIPTION="An LDAP-like embedded database"
11 HOMEPAGE="https://ldb.samba.org"
12 SRC_URI="https://www.samba.org/ftp/pub/${PN}/${P}.tar.gz"
13
14 LICENSE="LGPL-3"
15 SLOT="0/${PV}"
16 KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
17 IUSE="doc +ldap +lmdb python"
18
19 RDEPEND="
20         !elibc_FreeBSD? ( dev-libs/libbsd[${MULTILIB_USEDEP}] )
21         dev-libs/popt[${MULTILIB_USEDEP}]
22         >=dev-util/cmocka-1.1.3[${MULTILIB_USEDEP}]
23         >=sys-libs/talloc-2.2.0[python?,${MULTILIB_USEDEP}]
24         >=sys-libs/tdb-1.4.2[python?,${MULTILIB_USEDEP}]
25         >=sys-libs/tevent-0.10.0[python(+)?,${MULTILIB_USEDEP}]
26         ldap? ( net-nds/openldap )
27         lmdb? ( >=dev-db/lmdb-0.9.16[${MULTILIB_USEDEP}] )
28         python? ( ${PYTHON_DEPS} )
29 "
30
31 DEPEND="dev-libs/libxslt
32         doc? ( app-doc/doxygen )
33         virtual/pkgconfig
34         ${PYTHON_DEPS}
35         ${RDEPEND}
36 "
37
38 REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
39
40 WAF_BINARY="${S}/buildtools/bin/waf"
41
42 MULTILIB_WRAPPED_HEADERS=( /usr/include/pyldb.h )
43
44 PATCHES=(
45         "${FILESDIR}"/${PN}-1.5.2-optional_packages.patch
46         "${FILESDIR}"/${PN}-1.1.31-fix_PKGCONFIGDIR-when-python-disabled.patch
47 )
48
49 pkg_setup() {
50         python-single-r1_pkg_setup
51 }
52
53 src_prepare() {
54         default
55         multilib_copy_sources
56 }
57
58 multilib_src_configure() {
59         local myconf=(
60                 $(usex ldap '' --disable-ldap)
61                 $(usex lmdb '' --without-ldb-lmdb)
62                 --disable-rpath
63                 --disable-rpath-install --bundled-libraries=NONE
64                 --with-modulesdir="${EPREFIX}"/usr/$(get_libdir)/samba
65                 --builtin-libraries=NONE
66         )
67         if ! multilib_is_native_abi; then
68                 myconf+=( --disable-python )
69         else
70                 use python || myconf+=( --disable-python )
71         fi
72         waf-utils_src_configure "${myconf[@]}"
73 }
74
75 multilib_src_compile(){
76         waf-utils_src_compile
77         multilib_is_native_abi && use doc && doxygen Doxyfile
78 }
79
80 multilib_src_test() {
81         if multilib_is_native_abi; then
82                 WAF_MAKE=1 \
83                 PATH=buildtools/bin:../../../buildtools/bin:$PATH:"${BUILD_DIR}"/bin/shared/private/ \
84                 LD_LIBRARY_PATH=$LD_LIBRARY_PATH:"${BUILD_DIR}"/bin/shared/private/:"${BUILD_DIR}"/bin/shared \
85                 waf test || die
86         fi
87 }
88
89 multilib_src_install() {
90         waf-utils_src_install
91
92         if multilib_is_native_abi && use doc; then
93                 doman  apidocs/man/man3/*.3
94                 docinto html
95                 dodoc -r apidocs/html/*
96         fi
97 }
98
99 pkg_postinst() {
100         if has_version sys-auth/sssd; then
101                 ewarn "You have sssd installed. It is known to break after ldb upgrades,"
102                 ewarn "so please try to rebuild it before reporting bugs."
103                 ewarn "See https://bugs.gentoo.org/404281"
104         fi
105 }