dev-libs/expat: stable 2.2.8 for ppc64, bug #694362
[gentoo.git] / dev-libs / expat / expat-2.2.8.ebuild
1 # Copyright 1999-2019 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=7
5 AUTOTOOLS_AUTO_DEPEND=no
6 inherit autotools eutils libtool multilib toolchain-funcs multilib-minimal usr-ldscript
7
8 DESCRIPTION="Stream-oriented XML parser library"
9 HOMEPAGE="https://libexpat.github.io/"
10 SRC_URI="https://github.com/libexpat/libexpat/releases/download/R_${PV//\./_}/expat-${PV}.tar.xz"
11
12 LICENSE="MIT"
13 SLOT="0"
14 KEYWORDS="~alpha amd64 ~arm arm64 hppa ia64 ~m68k ~mips ppc ppc64 ~riscv ~s390 ~sh sparc x86 ~ppc-aix ~x64-cygwin ~amd64-fbsd ~x86-fbsd ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris ~x86-winnt"
15 IUSE="elibc_FreeBSD examples static-libs unicode"
16 BDEPEND="unicode? ( ${AUTOTOOLS_DEPEND} )"
17
18 DOCS=( README.md )
19
20 src_prepare() {
21         default
22
23         # fix interpreter to be a recent/good shell
24         sed -i -e "1s:/bin/sh:${BASH}:" conftools/get-version.sh || die
25         if use unicode; then
26                 cp -R "${S}" "${S}"w || die
27                 pushd "${S}"w >/dev/null
28                 find -name Makefile.am \
29                         -exec sed \
30                         -e 's,libexpat\.la,libexpatw.la,' \
31                         -e 's,libexpat_la,libexpatw_la,' \
32                         -i {} + || die
33                 eautoreconf
34                 popd >/dev/null
35         fi
36 }
37
38 multilib_src_configure() {
39         local myconf="$(use_enable static-libs static) --without-docbook"
40
41         mkdir -p "${BUILD_DIR}"w || die
42
43         if use unicode; then
44                 pushd "${BUILD_DIR}"w >/dev/null
45                 CPPFLAGS="${CPPFLAGS} -DXML_UNICODE" ECONF_SOURCE="${S}"w econf ${myconf}
46                 popd >/dev/null
47         fi
48
49         ECONF_SOURCE="${S}" econf ${myconf}
50 }
51
52 multilib_src_compile() {
53         emake
54
55         if use unicode; then
56                 pushd "${BUILD_DIR}"w >/dev/null
57                 emake -C lib
58                 popd >/dev/null
59         fi
60 }
61
62 multilib_src_install() {
63         emake install DESTDIR="${D}"
64
65         if use unicode; then
66                 pushd "${BUILD_DIR}"w >/dev/null
67                 emake -C lib install DESTDIR="${D}"
68                 popd >/dev/null
69
70                 pushd "${ED}"/usr/$(get_libdir)/pkgconfig >/dev/null
71                 cp expat.pc expatw.pc
72                 sed -i -e '/^Libs/s:-lexpat:&w:' expatw.pc || die
73                 popd >/dev/null
74         fi
75
76         if multilib_is_native_abi ; then
77                 # libgeom in /lib and ifconfig in /sbin require libexpat on FreeBSD since
78                 # we stripped the libbsdxml copy starting from freebsd-lib-8.2-r1
79                 use elibc_FreeBSD && gen_usr_ldscript -a expat
80         fi
81 }
82
83 multilib_src_install_all() {
84         einstalldocs
85
86         doman doc/xmlwf.1
87
88         # Note: Use of HTML_DOCS would add unwanted "doc" subfolder
89         docinto html
90         dodoc doc/*.{css,html,png}
91
92         if use examples; then
93                 insinto /usr/share/doc/${PF}/examples
94                 doins examples/*.c
95         fi
96
97         find "${D}" -name '*.la' -type f -delete || die
98 }