Update autotools-multilib.eclass to r1.20

A new version of this eclass is necessary because the old
version does not support EAPI=5 and freetype 2.5.0.x depends
on this eclass.

BUG=chromium:324184
TEST=`cbuildbot chromiumos-sdk` still works

Change-Id: Ifd77398356f9926d1dfb7c84743e601bf8e6a567
Reviewed-on: https://chromium-review.googlesource.com/188218
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Tested-by: Jungshik Shin <jshin@chromium.org>
Commit-Queue: Mike Frysinger <vapier@chromium.org>
diff --git a/eclass/autotools-multilib.eclass b/eclass/autotools-multilib.eclass
index f6d1feb..a7c6479 100644
--- a/eclass/autotools-multilib.eclass
+++ b/eclass/autotools-multilib.eclass
@@ -1,6 +1,6 @@
-# Copyright 1999-2012 Gentoo Foundation
+# Copyright 1999-2014 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/autotools-multilib.eclass,v 1.1 2012/10/08 18:44:30 mgorny Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/autotools-multilib.eclass,v 1.20 2014/01/15 12:12:41 mgorny Exp $
 
 # @ECLASS: autotools-multilib.eclass
 # @MAINTAINER:
@@ -10,63 +10,93 @@
 # The autotools-multilib.eclass is an autotools-utils.eclass(5) wrapper
 # introducing support for building for more than one ABI (multilib).
 #
-# Inheriting this eclass sets IUSE=multilib and exports autotools-utils
+# Inheriting this eclass sets the USE flags and exports autotools-utils
 # phase function wrappers which build the package for each supported ABI
-# if the flag is enabled. Otherwise, it works like regular
-# autotools-utils.
+# when the relevant flag is enabled. Other than that, it works like
+# regular autotools-utils.
+#
+# The multilib phase functions can be overriden via defining multilib_*
+# phase functions as in multilib-minimal.eclass. In some cases you may
+# need to call the underlying autotools-utils_* phase though.
 #
 # Note that the multilib support requires out-of-source builds to be
 # enabled. Thus, it is impossible to use AUTOTOOLS_IN_SOURCE_BUILD with
 # it.
 
+# EAPI=4 is required for meaningful MULTILIB_USEDEP.
 case ${EAPI:-0} in
-	2|3|4) ;;
+	4|5) ;;
 	*) die "EAPI=${EAPI} is not supported" ;;
 esac
 
-if [[ ${AUTOTOOLS_IN_SOURCE_BUILD} ]]; then
-	die "${ECLASS}: multilib support requires out-of-source builds."
-fi
+inherit autotools-utils eutils multilib-build multilib-minimal
 
-inherit autotools-utils multilib
+EXPORT_FUNCTIONS src_prepare src_configure src_compile src_test src_install
 
-EXPORT_FUNCTIONS src_configure src_compile src_test src_install
+# bug #485046
+_autotools-multilib_fix_multilib_minimal() {
+	src_conf=$(declare -f multilib-minimal_src_configure)
+	src_conf=${src_conf/multilib_foreach_abi/multilib_parallel_foreach_abi}
+	eval "${src_conf}"
+}
+_autotools-multilib_fix_multilib_minimal
 
-IUSE=multilib
+# Note: _at_args[@] passing is a backwards compatibility measure.
+# Don't use it in new packages.
 
-# @FUNCTION: autotools-multilib_foreach_abi
-# @USAGE: argv...
-# @DESCRIPTION:
-# If multilib support is enabled, sets the toolchain up for each
-# supported ABI along with the ABI variable and correct
-# AUTOTOOLS_BUILD_DIR, and runs the given commands with them.
-#
-# If multilib support is disabled, it just runs the commands. No setup
-# is done.
-autotools-multilib_foreach_abi() {
-	if use multilib; then
-		local ABI
-		for ABI in $(get_all_abis); do
-			multilib_toolchain_setup "${ABI}"
-			AUTOTOOLS_BUILD_DIR=${S%%/}-${ABI} "${@}"
-		done
-	else
-		"${@}"
-	fi
+autotools-multilib_src_prepare() {
+	autotools-utils_src_prepare "${@}"
+
+	[[ ${AUTOTOOLS_IN_SOURCE_BUILD} ]] && multilib_copy_sources
+}
+
+multilib_src_configure() {
+	[[ ${AUTOTOOLS_IN_SOURCE_BUILD} ]] && local ECONF_SOURCE=${BUILD_DIR}
+	autotools-utils_src_configure "${_at_args[@]}"
 }
 
 autotools-multilib_src_configure() {
-	autotools-multilib_foreach_abi autotools-utils_src_configure
+	local _at_args=( "${@}" )
+
+	multilib-minimal_src_configure
+}
+
+multilib_src_compile() {
+	emake "${_at_args[@]}"
 }
 
 autotools-multilib_src_compile() {
-	autotools-multilib_foreach_abi autotools-utils_src_compile
+	local _at_args=( "${@}" )
+
+	multilib-minimal_src_compile
+}
+
+multilib_src_test() {
+	autotools-utils_src_test "${_at_args[@]}"
 }
 
 autotools-multilib_src_test() {
-	autotools-multilib_foreach_abi autotools-utils_src_test
+	local _at_args=( "${@}" )
+
+	multilib-minimal_src_test
+}
+
+multilib_src_install() {
+	emake DESTDIR="${D}" "${_at_args[@]}" install
+}
+
+multilib_src_install_all() {
+	einstalldocs
+
+	# Remove libtool files and unnecessary static libs
+	local prune_ltfiles=${AUTOTOOLS_PRUNE_LIBTOOL_FILES}
+	if [[ ${prune_ltfiles} != none ]]; then
+		prune_libtool_files ${prune_ltfiles:+--${prune_ltfiles}}
+	fi
 }
 
 autotools-multilib_src_install() {
-	autotools-multilib_foreach_abi autotools-utils_src_install
+	local _at_args=( "${@}" )
+
+	multilib-minimal_src_install
 }