1 # Copyright 1999-2019 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
5 AUTOTOOLS_AUTO_DEPEND=no
6 inherit autotools eutils libtool multilib toolchain-funcs multilib-minimal usr-ldscript
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"
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} )"
23 # fix interpreter to be a recent/good shell
24 sed -i -e "1s:/bin/sh:${BASH}:" conftools/get-version.sh || die
26 cp -R "${S}" "${S}"w || die
27 pushd "${S}"w >/dev/null
28 find -name Makefile.am \
30 -e 's,libexpat\.la,libexpatw.la,' \
31 -e 's,libexpat_la,libexpatw_la,' \
38 multilib_src_configure() {
39 local myconf="$(use_enable static-libs static) --without-docbook"
41 mkdir -p "${BUILD_DIR}"w || die
44 pushd "${BUILD_DIR}"w >/dev/null
45 CPPFLAGS="${CPPFLAGS} -DXML_UNICODE" ECONF_SOURCE="${S}"w econf ${myconf}
49 ECONF_SOURCE="${S}" econf ${myconf}
52 multilib_src_compile() {
56 pushd "${BUILD_DIR}"w >/dev/null
62 multilib_src_install() {
63 emake install DESTDIR="${D}"
66 pushd "${BUILD_DIR}"w >/dev/null
67 emake -C lib install DESTDIR="${D}"
70 pushd "${ED}"/usr/$(get_libdir)/pkgconfig >/dev/null
72 sed -i -e '/^Libs/s:-lexpat:&w:' expatw.pc || die
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
83 multilib_src_install_all() {
88 # Note: Use of HTML_DOCS would add unwanted "doc" subfolder
90 dodoc doc/*.{css,html,png}
93 insinto /usr/share/doc/${PF}/examples
97 find "${D}" -name '*.la' -type f -delete || die