0c90a39cdc66050628e333e743dc3663fc657bef
[gentoo.git] / sys-libs / talloc / talloc-2.1.5.ebuild
1 # Copyright 1999-2017 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=5
5
6 PYTHON_COMPAT=( python2_7 )
7 PYTHON_REQ_USE="threads"
8
9 inherit waf-utils python-single-r1 multilib multilib-minimal
10
11 DESCRIPTION="Samba talloc library"
12 HOMEPAGE="https://talloc.samba.org/"
13 SRC_URI="https://www.samba.org/ftp/${PN}/${P}.tar.gz"
14
15 LICENSE="GPL-3 LGPL-3+ LGPL-2"
16 SLOT="0"
17 KEYWORDS="alpha amd64 arm ~arm64 hppa ia64 ~m68k ~mips ppc ppc64 ~s390 ~sh sparc x86 ~amd64-fbsd ~x86-fbsd ~amd64-linux ~arm-linux ~x86-linux ~x64-macos ~sparc-solaris"
18 IUSE="compat +python"
19
20 REQUIRED_USE="${PYTHON_REQUIRED_USE}"
21
22 RDEPEND="python? ( ${PYTHON_DEPS} )
23         !!<sys-libs/talloc-2.0.5"
24 DEPEND="${RDEPEND}
25         sys-devel/gettext
26         dev-libs/libxslt
27         ${PYTHON_DEPS}"
28
29 WAF_BINARY="${S}/buildtools/bin/waf"
30
31 RESTRICT="test"
32
33 MULTILIB_WRAPPED_HEADERS=(
34         # python goes only for native
35         /usr/include/pytalloc.h
36 )
37
38 src_prepare() {
39         # what would you expect of waf? i won't even waste time trying.
40         multilib_copy_sources
41 }
42
43 multilib_src_configure() {
44         local extra_opts=()
45
46         use compat && extra_opts+=( --enable-talloc-compat1 )
47         if ! multilib_is_native_abi || ! use python; then
48                 extra_opts+=( --disable-python )
49         fi
50
51         waf-utils_src_configure \
52                 "${extra_opts[@]}"
53 }
54
55 multilib_src_compile() {
56         waf-utils_src_compile
57 }
58
59 multilib_src_install() {
60         waf-utils_src_install
61
62         # waf is stupid, and no, we can't fix the build-system, since it's provided
63         # as a brilliant binary blob thats decompressed on the fly
64         if [[ ${CHOST} == *-darwin* ]] ; then
65                 install_name_tool \
66                         -id "${EPREFIX}"/usr/$(get_libdir)/libtalloc.2.dylib \
67                         "${ED}"/usr/$(get_libdir)/libtalloc.2.0.5.dylib || die
68                 if use python ; then
69                         install_name_tool \
70                                 -id "${EPREFIX}"/usr/$(get_libdir)/libpytalloc-util.2.dylib \
71                                 "${ED}"/usr/$(get_libdir)/libpytalloc-util.2.0.5.dylib || die
72                         install_name_tool \
73                                 -change "${S}/bin/default/libtalloc.dylib" \
74                                         "${EPREFIX}"/usr/$(get_libdir)/libtalloc.2.dylib \
75                                 "${ED}"/usr/$(get_libdir)/libpytalloc-util.2.0.5.dylib || die
76                         install_name_tool \
77                                 -change "${S}/bin/default/libtalloc.dylib" \
78                                         "${EPREFIX}"/usr/$(get_libdir)/libtalloc.2.dylib \
79                                 "${D}"$(python_get_sitedir)/talloc.bundle || die
80                 fi
81         fi
82 }