--- libxml2-2.7.7.ebuild +++ libxml2-2.7.7.ebuild @@ -3,6 +3,7 @@ # $Header: /var/cvsroot/gentoo-x86/dev-libs/libxml2/libxml2-2.7.7.ebuild,v 1.1 2010/03/18 12:59:10 ssuominen Exp $ EAPI="2" +SUPPORT_PYTHON_ABIS="1" inherit libtool flag-o-matic eutils python @@ -32,6 +33,8 @@ DEPEND="${RDEPEND} hppa? ( >=sys-devel/binutils-2.15.92.0.2 )" +RESTRICT_PYTHON_ABIS="3.*" + src_unpack() { # ${A} isn't used to avoid unpacking of test tarballs into $WORKDIR, # as they are needed as tarballs in ${S}/xstc instead and not unpacked @@ -52,6 +55,9 @@ # Please do not remove, as else we get references to PORTAGE_TMPDIR # in /usr/lib/python?.?/site-packages/libxml2mod.la among things. elibtoolize + + # Python bindings are built/tested/installed manually. + sed -e "s/@PYTHON_SUBDIR@//" -i Makefile.in || die "sed failed" } src_configure() { @@ -71,22 +77,56 @@ $(use_with python) $(use_with readline) $(use_with readline history) - $(use_enable ipv6) - PYTHON_SITE_PACKAGES=$(python_get_sitedir)" + $(use_enable ipv6)" # filter seemingly problematic CFLAGS (#26320) filter-flags -fprefetch-loop-arrays -funroll-loops - econf ${myconf} + python_execute_function -f -q econf ${myconf} +} + +src_compile() { + default + + if use python; then + python_copy_sources python + building() { + emake PYTHON_INCLUDES="$(python_get_includedir)" \ + PYTHON_SITE_PACKAGES="$(python_get_sitedir)" + } + python_execute_function -s --source-dir python building + fi +} + +src_test() { + default + + if use python; then + testing() { + emake test + } + python_execute_function -s --source-dir python testing + fi } src_install() { emake DESTDIR="${D}" \ EXAMPLES_DIR=/usr/share/doc/${PF}/examples \ - docsdir=/usr/share/doc/${PF}/python \ - exampledir=/usr/share/doc/${PF}/python/examples \ install || die "Installation failed" + if use python; then + installation() { + emake DESTDIR="${D}" \ + PYTHON_SITE_PACKAGES="$(python_get_sitedir)" \ + docsdir=/usr/share/doc/${PF}/python \ + exampledir=/usr/share/doc/${PF}/python/examples \ + install + } + python_execute_function -s --source-dir python installation + + python_clean_sitedirs + fi + rm -rf "${D}"/usr/share/doc/${P} dodoc AUTHORS ChangeLog Copyright NEWS README* TODO* || die "dodoc failed" @@ -108,8 +148,7 @@ pkg_postinst() { if use python; then - python_need_rebuild - python_mod_optimize $(python_get_sitedir) + python_mod_optimize drv_libxml2.py libxml2.py fi # We don't want to do the xmlcatalog during stage1, as xmlcatalog will not @@ -133,5 +172,7 @@ } pkg_postrm() { - python_mod_cleanup /usr/$(get_libdir)/python*/site-packages + if use python; then + python_mod_cleanup drv_libxml2.py libxml2.py + fi }