Some people seem to feel uncomfortable with autotools-multilib, because
it depends on autotools-utils.

Instead of arguing whether it makes sense or not I'd propose a similar
autotools related eclass.

I also attach an example conversion of media-libs/libexif (the
maintainer wants to keep the changes minimal).
Effectively I am only (almost) changing the function names and not the
ebuild code.

Feel free to propose a different eclass name.
# Copyright 1999-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

# @ECLASS: autotools-multilib-minimal.eclass
# @MAINTAINER:
# Julian Ospald <hasuf...@gentoo.org>
# @BLURB: wrapper for multilib builds providing convenient multilib_src_* 
functions
# @DESCRIPTION:
#
# src_configure, src_compile, src_test and src_install are exported
# use multilib_src_* instead of src_* which runs this phase for
# all enabled ABIs
#
# if you need generic install rules, use multilib_src_install_all function

# @ECLASS-VARIABLE: AUTOTOOLS_IN_SOURCE_BUILD
# @DEFAULT_UNSET
# @DESCRIPTION:
# Set to enable in-source build.
# If you enable this, ensure that prepabisources is called
# at the END of src_prepare!


# EAPI=5 is required for meaningful MULTILIB_USEDEP.
case ${EAPI:-0} in
        5) ;;
        *) die "EAPI=${EAPI} is not supported" ;;
esac

inherit multilib-build

EXPORT_FUNCTIONS src_configure src_compile src_test src_install

prepabisources() {
        if [[ $AUTOTOOLS_IN_SOURCE_BUILD ]] ; then
                einfo "Copying sources to abi-specific dirs"

                prepabisources() {
                        cp -pR "${S}" "${BUILD_DIR}" || die "failed to copy 
sources"
                }
                multilib_foreach_abi prepabisources
        fi
}

autotools-multilib-minimal_src_configure() {
        local myeconfsource
        if [[ $AUTOTOOLS_IN_SOURCE_BUILD ]] ; then
                myeconfsource=.
        else
                myeconfsource="${S}"
        fi

        _autotools-multilib-minimal_src_configure() {
                einfo "Configuring for ${ABI}"

                mkdir -p "${BUILD_DIR}" || die
                pushd "${BUILD_DIR}" >/dev/null || die
                if declare -f multilib_src_configure >/dev/null ; then
                        ECONF_SOURCE="${myeconfsource}" multilib_src_configure
                else
                        ECONF_SOURCE="${myeconfsource}" default_src_configure
                fi
                popd >/dev/null || die
        }
        multilib_foreach_abi _autotools-multilib-minimal_src_configure
}

autotools-multilib-minimal_src_compile() {
        _autotools-multilib-minimal_src_compile() {
                einfo "Compiling for ${ABI}"

                pushd "${BUILD_DIR}" >/dev/null || die
                if declare -f multilib_src_compile >/dev/null ; then
                        multilib_src_compile
                else
                        default_src_compile
                fi
                popd >/dev/null || die
        }
        multilib_foreach_abi _autotools-multilib-minimal_src_compile
}

autotools-multilib-minimal_src_test() {
        _autotools-multilib-minimal_src_test() {
                einfo "Testing for ${ABI}"

                pushd "${BUILD_DIR}" >/dev/null || die
                if declare -f multilib_src_test >/dev/null ; then
                        multilib_src_test
                else
                        default_src_test
                fi
                popd >/dev/null || die
        }
        multilib_foreach_abi _autotools-multilib-minimal_src_test
}

autotools-multilib-minimal_src_install() {
        _autotools-multilib-minimal_src_install() {
                einfo "Installing for ${ABI}"

                pushd "${BUILD_DIR}" >/dev/null || die
                if declare -f multilib_src_install >/dev/null ; then
                        multilib_src_install
                else
                        default_src_install     
                fi
                multilib_check_headers
                popd >/dev/null || die
        }
        multilib_foreach_abi _autotools-multilib-minimal_src_install

        if declare -f multilib_src_install_all >/dev/null ; then
                multilib_src_install_all
        fi
}
--- media-libs/libexif/libexif-0.6.21.ebuild
+++ media-libs/libexif/libexif-0.6.21-r1.ebuild
@@ -2,8 +2,8 @@
 # Distributed under the terms of the GNU General Public License v2
 # $Header: /var/cvsroot/gentoo-x86/media-libs/libexif/libexif-0.6.21.ebuild,v 
1.8 2012/11/07 19:03:58 grobian Exp $
 
-EAPI=4
-inherit eutils libtool
+EAPI=5
+inherit autotools-multilib-minimal eutils libtool
 
 DESCRIPTION="Library for parsing, editing, and saving EXIF data"
 HOMEPAGE="http://libexif.sourceforge.net/";
@@ -11,7 +11,7 @@
 
 LICENSE="LGPL-2.1"
 SLOT="0"
-KEYWORDS="alpha amd64 arm hppa ia64 ~mips ppc ppc64 s390 sh sparc x86 
~amd64-fbsd ~x86-fbsd ~x86-interix ~amd64-linux ~x86-linux ~ppc-macos 
~x64-macos ~x86-macos ~x64-solaris ~x86-solaris"
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc 
~x86 ~amd64-fbsd ~x86-fbsd ~x86-interix ~amd64-linux ~x86-linux ~ppc-macos 
~x64-macos ~x86-macos ~x64-solaris ~x86-solaris"
 IUSE="doc nls static-libs"
 
 RDEPEND="nls? ( virtual/libintl )"
@@ -26,7 +26,7 @@
        elibtoolize # For *-bsd
 }
 
-src_configure() {
+multilib_src_configure() {
        econf \
                $(use_enable static-libs static) \
                $(use_enable nls) \
@@ -34,8 +34,11 @@
                --with-doc-dir="${EPREFIX}"/usr/share/doc/${PF}
 }
 
-src_install() {
+multilib_src_install() {
        emake DESTDIR="${D}" install
+}
+
+multilib_src_install_all() {
        prune_libtool_files
        rm -f "${ED}"/usr/share/doc/${PF}/{ABOUT-NLS,COPYING}
 }

Reply via email to