From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 196571386BE for ; Sat, 26 Jan 2013 22:09:36 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 115A921C058; Sat, 26 Jan 2013 22:08:25 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id B0E4A21C054 for ; Sat, 26 Jan 2013 22:08:18 +0000 (UTC) Received: from pomiocik.lan (159-205-85-177.adsl.inetia.pl [159.205.85.177]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: mgorny) by smtp.gentoo.org (Postfix) with ESMTPSA id 64BBF33DBB5; Sat, 26 Jan 2013 22:08:16 +0000 (UTC) From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= To: gentoo-dev@lists.gentoo.org Cc: amd64@gentoo.org, releng@gentoo.org, x11@gentoo.org, =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= Subject: [gentoo-dev] [PATCH 1/5] Introduce a common function to obtain enabled ABIs. Date: Sat, 26 Jan 2013 23:08:12 +0100 Message-Id: <1359238096-13232-2-git-send-email-mgorny@gentoo.org> X-Mailer: git-send-email 1.8.1.1 In-Reply-To: <1359238096-13232-1-git-send-email-mgorny@gentoo.org> References: <1359238096-13232-1-git-send-email-mgorny@gentoo.org> Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-dev@lists.gentoo.org Reply-to: gentoo-dev@lists.gentoo.org X-Archives-Salt: 52fc37af-502b-4b22-a1be-dc2b857c10e0 X-Archives-Hash: 99e27d93dc5b0b033610269d47ef34e0 It will become especially useful when more ABI flags are introduced. --- gx86/eclass/multilib-build.eclass | 59 ++++++++++++++++++++++----------------- 1 file changed, 34 insertions(+), 25 deletions(-) diff --git a/gx86/eclass/multilib-build.eclass b/gx86/eclass/multilib-build.eclass index d8bd5ab..20d4f1c 100644 --- a/gx86/eclass/multilib-build.eclass +++ b/gx86/eclass/multilib-build.eclass @@ -39,6 +39,23 @@ IUSE=multilib # @CODE MULTILIB_USEDEP='multilib(-)?' +# @FUNCTION: multilib_get_enabled_abis +# @DESCRIPTION: +# Return the ordered list of enabled ABIs if multilib builds +# are enabled. The best (most preferred) ABI will come last. +# +# If multilib is disabled, the default ABI will be returned +# in order to enforce consistent testing with multilib code. +multilib_get_enabled_abis() { + debug-print-function ${FUNCNAME} "${@}" + + if use multilib; then + get_all_abis + else + echo ${DEFAULT_ABI} + fi +} + # @FUNCTION: multilib_foreach_abi # @USAGE: ... # @DESCRIPTION: @@ -51,15 +68,11 @@ MULTILIB_USEDEP='multilib(-)?' multilib_foreach_abi() { local initial_dir=${BUILD_DIR:-${S}} - if use multilib; then - local ABI - for ABI in $(get_all_abis); do - multilib_toolchain_setup "${ABI}" - BUILD_DIR=${initial_dir%%/}-${ABI} "${@}" - done - else - "${@}" - fi + local ABI + for ABI in $(multilib_get_enabled_abis); do + multilib_toolchain_setup "${ABI}" + BUILD_DIR=${initial_dir%%/}-${ABI} "${@}" + done } # @FUNCTION: multilib_parallel_foreach_abi @@ -77,26 +90,22 @@ multilib_foreach_abi() { multilib_parallel_foreach_abi() { local initial_dir=${BUILD_DIR:-${S}} - if use multilib; then - multijob_init + multijob_init - local ABI - for ABI in $(get_all_abis); do - ( - multijob_child_init + local ABI + for ABI in $(multilib_get_enabled_abis); do + ( + multijob_child_init - multilib_toolchain_setup "${ABI}" - BUILD_DIR=${initial_dir%%/}-${ABI} - "${@}" - ) & + multilib_toolchain_setup "${ABI}" + BUILD_DIR=${initial_dir%%/}-${ABI} + "${@}" + ) & - multijob_post_fork - done + multijob_post_fork + done - multijob_finish - else - "${@}" - fi + multijob_finish } _MULTILIB_BUILD=1 -- 1.8.1.1