On 02/24/2013 11:39 PM, Samuli Suominen wrote:
> On 24/02/13 02:34, hasufell wrote:
>> 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.
> 
> looks good, seems exactly what I wanted
> 
>> Feel free to propose a different eclass name.
> 
> whatever it will be, please make it shorter, like 'multiabi' maybe
> 

I cleaned up some things.

1) eclass renamed to multilib-minimal.eclass
prepabisources() renamed to multilib_copy_sources()

2) if someone wants out-of-source builds he gotta handle that manually,
as in: not calling multilib_copy_sources and making sure that stuff like
ECONF_SOURCE is set correctly
(${BUILD_DIR} will be created unconditionally in src_configure anyway)

3) all autotools related code removed

4) Introduced a DISABLE_MULTILIB variable for use of portage-multilib,
which will disable all multilib related stuff. I am not sure if that's
what they want, but I heard something like that.
Tommy should comment on this.

In case this eclass will be deprecated at some point, conversion back to
normal will be trivial anyway.
# Copyright 1999-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

# @ECLASS: multilib-minimal.eclass
# @MAINTAINER:
# Julian Ospald <[email protected]>
# @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
# multilib-minimal should _always_ go last in inherit order!!
#
# If you are using in-source builds, then you must run multilib_copy_sources
# at the end of src_prepare!!
#
# If you need generic install rules, use multilib_src_install_all function.

# @ECLASS-VARIABLE: DISABLE_MULTILIB
# @DESCRIPTION:
# set to ON to disable multilib entirely
# this is not meant to be set in the ebuild
: ${DISABLE_MULTILIB:=OFF}


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

_multilib_inherit=
if [[ ${DISABLE_MULTILIB} == "OFF" ]] ; then
        _multilib_inherit="multilib-build"
fi

inherit ${_multilib_inherit}

EXPORT_FUNCTIONS src_configure src_compile src_test src_install

multilib_copy_sources() {
        _abi_copy_sources() {
                einfo "${ABI}: copying to ${BUILD_DIR}"
                cp -pR "${S}" "${BUILD_DIR}" || die "failed to copy sources"
        }

        if [[ ${DISABLE_MULTILIB} == "OFF" ]] ; then
                einfo "Will copy sources to abi-specific dirs"
                multilib_foreach_abi _abi_copy_sources
        fi
}

multilib-minimal_src_configure() {
        _common_src_configure() {
                if declare -f multilib_src_configure >/dev/null ; then
                        multilib_src_configure
                else
                        default_src_configure
                fi
        }

        _abi_src_configure() {
                einfo "${ABI}: Configuring"

                mkdir -p "${BUILD_DIR}" || die
                pushd "${BUILD_DIR}" >/dev/null || die
                _common_src_configure
                popd >/dev/null || die
        }

        if [[ ${DISABLE_MULTILIB} == "OFF" ]] ; then
                multilib_foreach_abi _abi_src_configure
        else
                _common_src_configure
        fi      
}

multilib-minimal_src_compile() {
        _common_src_compile() {
                if declare -f multilib_src_compile >/dev/null ; then
                        multilib_src_compile
                else
                        default_src_compile
                fi
        }

        _abi_src_compile() {
                einfo "${ABI}: Compiling"

                pushd "${BUILD_DIR}" >/dev/null || die
                _common_src_compile
                popd >/dev/null || die
        }

        if [[ ${DISABLE_MULTILIB} == "OFF" ]] ; then
                multilib_foreach_abi _abi_src_compile
        else
                _common_src_compile
        fi
}

multilib-minimal_src_test() {
        _common_src_test() {
                if declare -f multilib_src_test >/dev/null ; then
                        multilib_src_test
                else
                        default_src_test
                fi
        }

        _abi_src_test() {
                einfo "${ABI}: Testing"

                pushd "${BUILD_DIR}" >/dev/null || die
                _common_src_test
                popd >/dev/null || die
        }

        if [[ ${DISABLE_MULTILIB} == "OFF" ]] ; then
                multilib_foreach_abi _abi_src_test
        else
                _common_src_test
        fi
}

multilib-minimal_src_install() {
        _common_src_install() {
                if declare -f multilib_src_install >/dev/null ; then
                        multilib_src_install
                else
                        default_src_install     
                fi
        }

        _abi_src_install() {
                einfo "${ABI}: Installing"

                pushd "${BUILD_DIR}" >/dev/null || die
                _common_src_install
                multilib_check_headers
                popd >/dev/null || die
        }

        if [[ ${DISABLE_MULTILIB} == "OFF" ]] ; then
                multilib_foreach_abi _abi_src_install
        else
                _common_src_install
        fi

        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 eutils libtool multilib-minimal
 
 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 )"
@@ -24,9 +24,10 @@
        epatch "${FILESDIR}"/${PN}-0.6.13-pkgconfig.patch
        sed -i -e '/FLAGS=/s:-g::' configure || die #390249
        elibtoolize # For *-bsd
+       multilib_copy_sources
 }
 
-src_configure() {
+multilib_src_configure() {
        econf \
                $(use_enable static-libs static) \
                $(use_enable nls) \
@@ -34,8 +35,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