public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] [PATCHES] x86 multilib flags, ver. 2
@ 2013-01-26 22:08 Michał Górny
  2013-01-26 22:08 ` [gentoo-dev] [PATCH 1/5] Introduce a common function to obtain enabled ABIs Michał Górny
                   ` (5 more replies)
  0 siblings, 6 replies; 15+ messages in thread
From: Michał Górny @ 2013-01-26 22:08 UTC (permalink / raw
  To: gentoo-dev; +Cc: amd64, releng, x11

Hello,

Following all the suggestions from Alexis Ballier, I have reworked
the code to remove multiple points of failure. I have also rebased it
on the common multilib-build eclass concept, and updated amd64
no-multilib & x86 profiles as well.

Key points:

1. The list of available flags and corresponding ABIs is now stored
   in a single variable. Adding a new ABI is as simple as adding
   a value to that variable (+ profiles).

2. All ABIs are validated against $(get_all_abis) list. This guarantees
   that we check only the flags proper for the arch.

3. The USE_EXPAND is visible only on amd64 multilib profile. However,
   it is also available on non-multilib amd64 & x86, with all flags
   masked except for the default one which is force-enabled.

The last point means that x86 binary packages (skype) can have
dependencies as simple as:

   dev-libs/libfoo[abi_x86_32]

which would be valid both for amd64 multilib & x86.



^ permalink raw reply	[flat|nested] 15+ messages in thread

* [gentoo-dev] [PATCH 1/5] Introduce a common function to obtain enabled ABIs.
  2013-01-26 22:08 [gentoo-dev] [PATCHES] x86 multilib flags, ver. 2 Michał Górny
@ 2013-01-26 22:08 ` Michał Górny
  2013-01-26 22:08 ` [gentoo-dev] [PATCH 2/5] Use explicit abi_* flags to select multilib targets Michał Górny
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 15+ messages in thread
From: Michał Górny @ 2013-01-26 22:08 UTC (permalink / raw
  To: gentoo-dev; +Cc: amd64, releng, x11, Michał Górny

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: <argv>...
 # @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



^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [gentoo-dev] [PATCH 2/5] Use explicit abi_* flags to select multilib targets.
  2013-01-26 22:08 [gentoo-dev] [PATCHES] x86 multilib flags, ver. 2 Michał Górny
  2013-01-26 22:08 ` [gentoo-dev] [PATCH 1/5] Introduce a common function to obtain enabled ABIs Michał Górny
@ 2013-01-26 22:08 ` Michał Górny
  2013-01-27 12:34   ` Alexis Ballier
  2013-01-26 22:08 ` [gentoo-dev] [PATCH 3/5] Make ABI_X86 an USE_EXPAND, and mask them in global scope Michał Górny
                   ` (3 subsequent siblings)
  5 siblings, 1 reply; 15+ messages in thread
From: Michał Górny @ 2013-01-26 22:08 UTC (permalink / raw
  To: gentoo-dev; +Cc: amd64, releng, x11, Michał Górny

This time, following suggestions from Alexis Ballier, the complete list
of USE flags and corresponding ABIs is stored in a single variable.
I have removed the arch hack and all selected ABIs are validated against
$(get_all_abis) from multilib.eclass.
---
 gx86/eclass/multilib-build.eclass | 36 +++++++++++++++++++++++++++++++-----
 1 file changed, 31 insertions(+), 5 deletions(-)

diff --git a/gx86/eclass/multilib-build.eclass b/gx86/eclass/multilib-build.eclass
index 20d4f1c..a6104e0 100644
--- a/gx86/eclass/multilib-build.eclass
+++ b/gx86/eclass/multilib-build.eclass
@@ -25,7 +25,14 @@ esac
 
 inherit multilib multiprocessing
 
-IUSE=multilib
+# @ECLASS-VARIABLE: _MULTILIB_FLAGS
+# @INTERNAL
+# @DESCRIPTION:
+# The list of multilib flags and corresponding ABI values.
+_MULTILIB_FLAGS=(
+	abi_x86_32:x86
+	abi_x86_64:amd64
+)
 
 # @ECLASS-VARIABLE: MULTILIB_USEDEP
 # @DESCRIPTION:
@@ -37,7 +44,15 @@ IUSE=multilib
 # RDEPEND="dev-libs/libfoo[${MULTILIB_USEDEP}]
 #	net-libs/libbar[ssl,${MULTILIB_USEDEP}]"
 # @CODE
-MULTILIB_USEDEP='multilib(-)?'
+
+_multilib_build_set_globals() {
+	local flags=( "${_MULTILIB_FLAGS[@]%:*}" )
+	local usedeps=${flags[@]/%/(-)?}
+
+	IUSE=${flags[*]}
+	MULTILIB_USEDEP=${usedeps// /,}
+}
+_multilib_build_set_globals
 
 # @FUNCTION: multilib_get_enabled_abis
 # @DESCRIPTION:
@@ -49,9 +64,20 @@ MULTILIB_USEDEP='multilib(-)?'
 multilib_get_enabled_abis() {
 	debug-print-function ${FUNCNAME} "${@}"
 
-	if use multilib; then
-		get_all_abis
-	else
+	local supported_abis=$(get_all_abis)
+	local i found
+	for i in "${_MULTILIB_FLAGS[@]}"; do
+		local abi=${i#*:}
+		local flag=${i%:*}
+
+		if has "${abi}" ${supported_abis} && use "${flag}"; then
+			echo "${abi}"
+			found=1
+		fi
+	done
+
+	if [[ ! ${found} ]]; then
+		debug-print "${FUNCNAME}: no ABIs enabled, fallback to ${DEFAULT_ABI}"
 		echo ${DEFAULT_ABI}
 	fi
 }
-- 
1.8.1.1



^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [gentoo-dev] [PATCH 3/5] Make ABI_X86 an USE_EXPAND, and mask them in global scope.
  2013-01-26 22:08 [gentoo-dev] [PATCHES] x86 multilib flags, ver. 2 Michał Górny
  2013-01-26 22:08 ` [gentoo-dev] [PATCH 1/5] Introduce a common function to obtain enabled ABIs Michał Górny
  2013-01-26 22:08 ` [gentoo-dev] [PATCH 2/5] Use explicit abi_* flags to select multilib targets Michał Górny
@ 2013-01-26 22:08 ` Michał Górny
  2013-01-26 22:08 ` [gentoo-dev] [PATCH 4/5] Set multilib for (Linux) amd64 profile Michał Górny
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 15+ messages in thread
From: Michał Górny @ 2013-01-26 22:08 UTC (permalink / raw
  To: gentoo-dev; +Cc: amd64, releng, x11, Michał Górny

---
 gx86/profiles/base/make.defaults |  4 ++--
 gx86/profiles/base/use.mask      |  5 +++++
 gx86/profiles/desc/abi_x86.desc  | 10 ++++++++++
 3 files changed, 17 insertions(+), 2 deletions(-)
 create mode 100644 gx86/profiles/desc/abi_x86.desc

diff --git a/gx86/profiles/base/make.defaults b/gx86/profiles/base/make.defaults
index 00761b6..07e19cf 100644
--- a/gx86/profiles/base/make.defaults
+++ b/gx86/profiles/base/make.defaults
@@ -16,11 +16,11 @@ USE_EXPAND_VALUES_USERLAND="BSD GNU"
 
 # Env vars to expand into USE vars.  Modifying this requires prior
 # discussion on gentoo-dev@gentoo.org.
-USE_EXPAND="APACHE2_MODULES APACHE2_MPMS CALLIGRA_FEATURES ENLIGHTENMENT_MODULES FOO2ZJS_DEVICES MISDN_CARDS FRITZCAPI_CARDS FCDSL_CARDS VIDEO_CARDS DVB_CARDS LIRC_DEVICES INPUT_DEVICES LINGUAS USERLAND KERNEL ELIBC CROSSCOMPILE_OPTS ALSA_CARDS ALSA_PCM_PLUGINS LCD_DEVICES CAMERAS NETBEANS_MODULES QEMU_SOFTMMU_TARGETS QEMU_USER_TARGETS SANE_BACKENDS RUBY_TARGETS PHP_TARGETS NGINX_MODULES_HTTP NGINX_MODULES_MAIL XFCE_PLUGINS XTABLES_ADDONS GPSD_PROTOCOLS COLLECTD_PLUGINS DRACUT_MODULES OFED_DRIVERS GRUB_PLATFORMS FFTOOLS PYTHON_TARGETS CURL_SSL OPENMPI_FABRICS OPENMPI_RM OPENMPI_OFED_FEATURES LIBREOFFICE_EXTENSIONS VOICEMAIL_STORAGE PYTHON_SINGLE_TARGET"
+USE_EXPAND="APACHE2_MODULES APACHE2_MPMS CALLIGRA_FEATURES ENLIGHTENMENT_MODULES FOO2ZJS_DEVICES MISDN_CARDS FRITZCAPI_CARDS FCDSL_CARDS VIDEO_CARDS DVB_CARDS LIRC_DEVICES INPUT_DEVICES LINGUAS USERLAND KERNEL ELIBC CROSSCOMPILE_OPTS ALSA_CARDS ALSA_PCM_PLUGINS LCD_DEVICES CAMERAS NETBEANS_MODULES QEMU_SOFTMMU_TARGETS QEMU_USER_TARGETS SANE_BACKENDS RUBY_TARGETS PHP_TARGETS NGINX_MODULES_HTTP NGINX_MODULES_MAIL XFCE_PLUGINS XTABLES_ADDONS GPSD_PROTOCOLS COLLECTD_PLUGINS DRACUT_MODULES OFED_DRIVERS GRUB_PLATFORMS FFTOOLS PYTHON_TARGETS CURL_SSL OPENMPI_FABRICS OPENMPI_RM OPENMPI_OFED_FEATURES LIBREOFFICE_EXTENSIONS VOICEMAIL_STORAGE PYTHON_SINGLE_TARGET ABI_X86"
 
 # USE_EXPAND variables whose contents are not shown in package manager
 # output. Changes need discussion on gentoo-dev.
-USE_EXPAND_HIDDEN="USERLAND KERNEL ELIBC CROSSCOMPILE_OPTS"
+USE_EXPAND_HIDDEN="USERLAND KERNEL ELIBC CROSSCOMPILE_OPTS ABI_X86"
 
 CONFIG_PROTECT="/etc"
 CONFIG_PROTECT_MASK="/etc/env.d /etc/gconf"
diff --git a/gx86/profiles/base/use.mask b/gx86/profiles/base/use.mask
index 1ff9aef..a2fe061 100644
--- a/gx86/profiles/base/use.mask
+++ b/gx86/profiles/base/use.mask
@@ -327,3 +327,8 @@ python_targets_pypy2_0
 python_single_target_pypy1_8
 python_single_target_pypy1_9
 python_single_target_pypy2_0
+
+# Michał Górny <mgorny@gentoo.org> (26 Jan 2013)
+# Mask the multilib flags globally. Unmasked in specific arches.
+abi_x86_32
+abi_x86_64
diff --git a/gx86/profiles/desc/abi_x86.desc b/gx86/profiles/desc/abi_x86.desc
new file mode 100644
index 0000000..6d58bfa
--- /dev/null
+++ b/gx86/profiles/desc/abi_x86.desc
@@ -0,0 +1,10 @@
+# Copyright 2013 Gentoo Foundation.
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/profiles/desc/alsa_cards.desc,v 1.8 2009/08/13 15:09:23 beandog Exp $
+
+# This file contains descriptions of ABI_X86 USE_EXPAND flags.
+
+# Keep it sorted. Please do not add anything without prior discussion
+# on gentoo-dev.
+32 - 32-bit (x86) libraries
+64 - 64-bit (amd64) libraries
-- 
1.8.1.1



^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [gentoo-dev] [PATCH 4/5] Set multilib for (Linux) amd64 profile.
  2013-01-26 22:08 [gentoo-dev] [PATCHES] x86 multilib flags, ver. 2 Michał Górny
                   ` (2 preceding siblings ...)
  2013-01-26 22:08 ` [gentoo-dev] [PATCH 3/5] Make ABI_X86 an USE_EXPAND, and mask them in global scope Michał Górny
@ 2013-01-26 22:08 ` Michał Górny
  2013-01-26 22:08 ` [gentoo-dev] [PATCH 5/5] Unmask and force the abi_x86_32 for uniform binary dependencies Michał Górny
  2013-01-27 13:40 ` [gentoo-dev] [PATCHES] x86 multilib flags, ver. 2 Thomas Sachau
  5 siblings, 0 replies; 15+ messages in thread
From: Michał Górny @ 2013-01-26 22:08 UTC (permalink / raw
  To: gentoo-dev; +Cc: amd64, releng, x11, Michał Górny

---
 gx86/profiles/arch/amd64/make.defaults             | 4 ++++
 gx86/profiles/arch/amd64/no-multilib/make.defaults | 4 ++++
 gx86/profiles/arch/amd64/no-multilib/use.mask      | 4 ++++
 gx86/profiles/arch/amd64/use.force                 | 4 ++++
 gx86/profiles/arch/amd64/use.mask                  | 5 +++++
 5 files changed, 21 insertions(+)

diff --git a/gx86/profiles/arch/amd64/make.defaults b/gx86/profiles/arch/amd64/make.defaults
index bd020bb..4ad5c0b 100644
--- a/gx86/profiles/arch/amd64/make.defaults
+++ b/gx86/profiles/arch/amd64/make.defaults
@@ -45,3 +45,7 @@ VIDEO_CARDS="fbdev glint intel mach64 mga nouveau nv r128 radeon savage sis tdfx
 # 2006/12/22 - Danny van Dyk <kugelfang@gentoo.org>
 # Default for ALSA_CARDS USE_EXPAND variable.
 ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci"
+
+# Michał Górny <mgorny@gentoo.org> (26 Jan 2013)
+# Unhide the ABI_X86 USE_EXPAND.
+USE_EXPAND_HIDDEN="-ABI_X86"
diff --git a/gx86/profiles/arch/amd64/no-multilib/make.defaults b/gx86/profiles/arch/amd64/no-multilib/make.defaults
index 5f5b0f7..b05e8e4 100644
--- a/gx86/profiles/arch/amd64/no-multilib/make.defaults
+++ b/gx86/profiles/arch/amd64/no-multilib/make.defaults
@@ -3,3 +3,7 @@
 # $Header: /var/cvsroot/gentoo-x86/profiles/arch/amd64/no-multilib/make.defaults,v 1.1 2008/04/01 17:39:54 wolf31o2 Exp $
 
 MULTILIB_ABIS="amd64"
+
+# Michał Górny <mgorny@gentoo.org> (26 Jan 2013)
+# Hide the ABI_X86 USE_EXPAND back for non-multilib profile.
+USE_EXPAND_HIDDEN="ABI_X86"
diff --git a/gx86/profiles/arch/amd64/no-multilib/use.mask b/gx86/profiles/arch/amd64/no-multilib/use.mask
index 8446804..9bc0ab5 100644
--- a/gx86/profiles/arch/amd64/no-multilib/use.mask
+++ b/gx86/profiles/arch/amd64/no-multilib/use.mask
@@ -19,3 +19,7 @@ hvm
 # Matt Turner <mattst88@gentoo.org) (10 Feb 2012)
 # mask d3d since wine is 32-bit
 d3d
+
+# Michał Górny <mgorny@gentoo.org> (26 Jan 2013)
+# Mask the multilib flags back for non-multilib profile.
+abi_x86_32
diff --git a/gx86/profiles/arch/amd64/use.force b/gx86/profiles/arch/amd64/use.force
index b54bac8..53a3333 100644
--- a/gx86/profiles/arch/amd64/use.force
+++ b/gx86/profiles/arch/amd64/use.force
@@ -1,2 +1,6 @@
 # Force the flag which corresponds to ARCH.
 amd64
+
+# Michał Górny <mgorny@gentoo.org> (26 Jan 2013)
+# Force the flag corresponding to the default ABI.
+abi_x86_64
diff --git a/gx86/profiles/arch/amd64/use.mask b/gx86/profiles/arch/amd64/use.mask
index d4df20a..3f9ad19 100644
--- a/gx86/profiles/arch/amd64/use.mask
+++ b/gx86/profiles/arch/amd64/use.mask
@@ -181,4 +181,9 @@ capslib
 # fdk-aac is already keyworded here
 -fdk
 
+# Michał Górny <mgorny@gentoo.org> (26 Jan 2013)
+# Unmask the multilib flags for this arch.
+-abi_x86_32
+-abi_x86_64
+
 # NOT NECESSARY - SECTION
-- 
1.8.1.1



^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [gentoo-dev] [PATCH 5/5] Unmask and force the abi_x86_32 for uniform binary dependencies.
  2013-01-26 22:08 [gentoo-dev] [PATCHES] x86 multilib flags, ver. 2 Michał Górny
                   ` (3 preceding siblings ...)
  2013-01-26 22:08 ` [gentoo-dev] [PATCH 4/5] Set multilib for (Linux) amd64 profile Michał Górny
@ 2013-01-26 22:08 ` Michał Górny
  2013-01-27 13:40 ` [gentoo-dev] [PATCHES] x86 multilib flags, ver. 2 Thomas Sachau
  5 siblings, 0 replies; 15+ messages in thread
From: Michał Górny @ 2013-01-26 22:08 UTC (permalink / raw
  To: gentoo-dev; +Cc: amd64, releng, x11, Michał Górny

For example, net-im/skype would depend on:

	dev-libs/libfoo[abi_x86_32]

and that dependency would be valid both for amd64 multilib & x86.
---
 gx86/profiles/arch/x86/use.force | 5 +++++
 gx86/profiles/arch/x86/use.mask  | 5 +++++
 2 files changed, 10 insertions(+)

diff --git a/gx86/profiles/arch/x86/use.force b/gx86/profiles/arch/x86/use.force
index 049e7af..1f18bb0 100644
--- a/gx86/profiles/arch/x86/use.force
+++ b/gx86/profiles/arch/x86/use.force
@@ -1,2 +1,7 @@
 # Force the flag which corresponds to ARCH.
 x86
+
+# Michał Górny <mgorny@gentoo.org> (26 Jan 2013)
+# Force the flag corresponding to the only ABI. This allows x86 binary
+# packages to have uniform dependencies for amd64-multilib & x86.
+abi_x86_32
diff --git a/gx86/profiles/arch/x86/use.mask b/gx86/profiles/arch/x86/use.mask
index b342b71..97057ad 100644
--- a/gx86/profiles/arch/x86/use.mask
+++ b/gx86/profiles/arch/x86/use.mask
@@ -170,3 +170,8 @@ win64
 
 # fdk-aac is already keyworded here
 -fdk
+
+# Michał Górny <mgorny@gentoo.org> (26 Jan 2013)
+# Unmask the flag corresponding to the only ABI. This allows x86 binary
+# packages to have uniform dependencies for amd64-multilib & x86.
+abi_x86_32
-- 
1.8.1.1



^ permalink raw reply related	[flat|nested] 15+ messages in thread

* Re: [gentoo-dev] [PATCH 2/5] Use explicit abi_* flags to select multilib targets.
  2013-01-26 22:08 ` [gentoo-dev] [PATCH 2/5] Use explicit abi_* flags to select multilib targets Michał Górny
@ 2013-01-27 12:34   ` Alexis Ballier
  2013-01-27 13:36     ` Michał Górny
  2013-01-27 22:46     ` Michał Górny
  0 siblings, 2 replies; 15+ messages in thread
From: Alexis Ballier @ 2013-01-27 12:34 UTC (permalink / raw
  To: gentoo-dev; +Cc: mgorny, amd64, releng, x11

Very nice work; +1 on everything, it seems we'll finally get serious
and official multilib support after all those years.
I'm looking forward to get this in three :)


On Sat, 26 Jan 2013 23:08:13 +0100
Michał Górny <mgorny@gentoo.org> wrote:
[...]
>  # @FUNCTION: multilib_get_enabled_abis
>  # @DESCRIPTION:
> @@ -49,9 +64,20 @@ MULTILIB_USEDEP='multilib(-)?'
>  multilib_get_enabled_abis() {
>  	debug-print-function ${FUNCNAME} "${@}"
>  
> -	if use multilib; then
> -		get_all_abis
> -	else
> +	local supported_abis=$(get_all_abis)
> +	local i found
> +	for i in "${_MULTILIB_FLAGS[@]}"; do
> +		local abi=${i#*:}
> +		local flag=${i%:*}
> +
> +		if has "${abi}" ${supported_abis} && use "${flag}";
> then
> +			echo "${abi}"
> +			found=1
> +		fi
> +	done
> +
> +	if [[ ! ${found} ]]; then
> +		debug-print "${FUNCNAME}: no ABIs enabled, fallback
> to ${DEFAULT_ABI}" echo ${DEFAULT_ABI}
>  	fi
>  }

Just one thing here: I may have missed something, but how do you ensure
the DEFAULT_ABI is last in the list ? It seems to me you rely on the
order of _MULTILIB_FLAGS. I'd just skip it explicitly (if the
corresponding useflag is enabled) and print DEFAULT_ABI at the end to be
on the safe side, if it has been skipped.

Alexis.


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [gentoo-dev] [PATCH 2/5] Use explicit abi_* flags to select multilib targets.
  2013-01-27 12:34   ` Alexis Ballier
@ 2013-01-27 13:36     ` Michał Górny
  2013-01-27 22:46     ` Michał Górny
  1 sibling, 0 replies; 15+ messages in thread
From: Michał Górny @ 2013-01-27 13:36 UTC (permalink / raw
  To: gentoo-dev; +Cc: aballier, amd64, releng, x11

[-- Attachment #1: Type: text/plain, Size: 1697 bytes --]

On Sun, 27 Jan 2013 09:34:13 -0300
Alexis Ballier <aballier@gentoo.org> wrote:

> Very nice work; +1 on everything, it seems we'll finally get serious
> and official multilib support after all those years.
> I'm looking forward to get this in three :)

I am writing some kind of spec/summary right now.

> On Sat, 26 Jan 2013 23:08:13 +0100
> Michał Górny <mgorny@gentoo.org> wrote:
> [...]
> >  # @FUNCTION: multilib_get_enabled_abis
> >  # @DESCRIPTION:
> > @@ -49,9 +64,20 @@ MULTILIB_USEDEP='multilib(-)?'
> >  multilib_get_enabled_abis() {
> >  	debug-print-function ${FUNCNAME} "${@}"
> >  
> > -	if use multilib; then
> > -		get_all_abis
> > -	else
> > +	local supported_abis=$(get_all_abis)
> > +	local i found
> > +	for i in "${_MULTILIB_FLAGS[@]}"; do
> > +		local abi=${i#*:}
> > +		local flag=${i%:*}
> > +
> > +		if has "${abi}" ${supported_abis} && use "${flag}";
> > then
> > +			echo "${abi}"
> > +			found=1
> > +		fi
> > +	done
> > +
> > +	if [[ ! ${found} ]]; then
> > +		debug-print "${FUNCNAME}: no ABIs enabled, fallback
> > to ${DEFAULT_ABI}" echo ${DEFAULT_ABI}
> >  	fi
> >  }
> 
> Just one thing here: I may have missed something, but how do you ensure
> the DEFAULT_ABI is last in the list ? It seems to me you rely on the
> order of _MULTILIB_FLAGS. I'd just skip it explicitly (if the
> corresponding useflag is enabled) and print DEFAULT_ABI at the end to be
> on the safe side, if it has been skipped.

That seems like a reasonable idea. I'd have a second and third look
at the function, and see if it wouldn't be better to just iterate over
$(get_all_abis) in the outer loop.

-- 
Best regards,
Michał Górny

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 316 bytes --]

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [gentoo-dev] [PATCHES] x86 multilib flags, ver. 2
  2013-01-26 22:08 [gentoo-dev] [PATCHES] x86 multilib flags, ver. 2 Michał Górny
                   ` (4 preceding siblings ...)
  2013-01-26 22:08 ` [gentoo-dev] [PATCH 5/5] Unmask and force the abi_x86_32 for uniform binary dependencies Michał Górny
@ 2013-01-27 13:40 ` Thomas Sachau
  2013-01-29 17:22   ` Michał Górny
  5 siblings, 1 reply; 15+ messages in thread
From: Thomas Sachau @ 2013-01-27 13:40 UTC (permalink / raw
  To: gentoo-dev

[-- Attachment #1: Type: text/plain, Size: 1667 bytes --]

Michał Górny schrieb:
> Hello,
> 
> Following all the suggestions from Alexis Ballier, I have reworked
> the code to remove multiple points of failure. I have also rebased it
> on the common multilib-build eclass concept, and updated amd64
> no-multilib & x86 profiles as well.
> 
> Key points:
> 
> 1. The list of available flags and corresponding ABIs is now stored
>    in a single variable. Adding a new ABI is as simple as adding
>    a value to that variable (+ profiles).
> 
> 2. All ABIs are validated against $(get_all_abis) list. This guarantees
>    that we check only the flags proper for the arch.
> 
> 3. The USE_EXPAND is visible only on amd64 multilib profile. However,
>    it is also available on non-multilib amd64 & x86, with all flags
>    masked except for the default one which is force-enabled.
> 
> The last point means that x86 binary packages (skype) can have
> dependencies as simple as:
> 
>    dev-libs/libfoo[abi_x86_32]
> 
> which would be valid both for amd64 multilib & x86.
> 
> 
> 

Lets see, if i understand your plan right, without reading all your diffs:

1. you currently support amd64/multilib and show same flags on
amd64/no-multilib and x86 to avoid duplicating the dependency list? If
yes, will this be extended to general support for all multilib arches,
only on request for specific arches or not at all?

2. How do you handle other abi-specific files like headers or binaries
and cases like binaries with abi-specific content? Is it possible to
preserve them for all requested abis or to preserve them for an
non-default abi?

-- 

Thomas Sachau
Gentoo Linux Developer


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 379 bytes --]

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [gentoo-dev] [PATCH 2/5] Use explicit abi_* flags to select multilib targets.
  2013-01-27 12:34   ` Alexis Ballier
  2013-01-27 13:36     ` Michał Górny
@ 2013-01-27 22:46     ` Michał Górny
  2013-01-27 22:46       ` [gentoo-dev] [PATCH 1/2] Order ABIs following MULTILIB_ABIS Michał Górny
                         ` (2 more replies)
  1 sibling, 3 replies; 15+ messages in thread
From: Michał Górny @ 2013-01-27 22:46 UTC (permalink / raw
  To: gentoo-dev; +Cc: amd64, releng, aballier, x11

Alexis,

Following your remark, I have redesigned the loop to use MULTILIB_ABIS
list to order the ABIs. This should ensure the most valid replacement
order.

Additionally, I have added an assertion to ensure that DEFAULT_ABI comes
last in MULTILIB_ABIS list.



^ permalink raw reply	[flat|nested] 15+ messages in thread

* [gentoo-dev] [PATCH 1/2] Order ABIs following MULTILIB_ABIS.
  2013-01-27 22:46     ` Michał Górny
@ 2013-01-27 22:46       ` Michał Górny
  2013-01-27 22:46       ` [gentoo-dev] [PATCH 2/2] Add an assertion for valid ABI order Michał Górny
  2013-01-27 23:27       ` [gentoo-dev] [PATCH 2/5] Use explicit abi_* flags to select multilib targets Alexis Ballier
  2 siblings, 0 replies; 15+ messages in thread
From: Michał Górny @ 2013-01-27 22:46 UTC (permalink / raw
  To: gentoo-dev; +Cc: amd64, releng, aballier, x11, Michał Górny

This ensures that profile order is preserved.
---
 gx86/eclass/multilib-build.eclass | 23 +++++++++++++----------
 1 file changed, 13 insertions(+), 10 deletions(-)

diff --git a/gx86/eclass/multilib-build.eclass b/gx86/eclass/multilib-build.eclass
index a6104e0..96bf26f 100644
--- a/gx86/eclass/multilib-build.eclass
+++ b/gx86/eclass/multilib-build.eclass
@@ -64,16 +64,19 @@ _multilib_build_set_globals
 multilib_get_enabled_abis() {
 	debug-print-function ${FUNCNAME} "${@}"
 
-	local supported_abis=$(get_all_abis)
-	local i found
-	for i in "${_MULTILIB_FLAGS[@]}"; do
-		local abi=${i#*:}
-		local flag=${i%:*}
-
-		if has "${abi}" ${supported_abis} && use "${flag}"; then
-			echo "${abi}"
-			found=1
-		fi
+	local abis=( $(get_all_abis) )
+
+	local abi i found
+	for abi in "${abis[@]}"; do
+		for i in "${_MULTILIB_FLAGS[@]}"; do
+			local m_abi=${i#*:}
+			local m_flag=${i%:*}
+
+			if [[ ${m_abi} == ${abi} ]] && use "${m_flag}"; then
+				echo "${abi}"
+				found=1
+			fi
+		done
 	done
 
 	if [[ ! ${found} ]]; then
-- 
1.8.1.1



^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [gentoo-dev] [PATCH 2/2] Add an assertion for valid ABI order.
  2013-01-27 22:46     ` Michał Górny
  2013-01-27 22:46       ` [gentoo-dev] [PATCH 1/2] Order ABIs following MULTILIB_ABIS Michał Górny
@ 2013-01-27 22:46       ` Michał Górny
  2013-01-27 23:27       ` [gentoo-dev] [PATCH 2/5] Use explicit abi_* flags to select multilib targets Alexis Ballier
  2 siblings, 0 replies; 15+ messages in thread
From: Michał Górny @ 2013-01-27 22:46 UTC (permalink / raw
  To: gentoo-dev; +Cc: amd64, releng, aballier, x11, Michał Górny

---
 gx86/eclass/multilib-build.eclass | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/gx86/eclass/multilib-build.eclass b/gx86/eclass/multilib-build.eclass
index 96bf26f..ed8ee23 100644
--- a/gx86/eclass/multilib-build.eclass
+++ b/gx86/eclass/multilib-build.eclass
@@ -66,6 +66,10 @@ multilib_get_enabled_abis() {
 
 	local abis=( $(get_all_abis) )
 
+	if [[ ${abis[-1]} != ${DEFAULT_ABI} ]]; then
+		die "Assertion failed: DEFAULT_ABI (${DEFAULT_ABI}) != last ABI (${abis[-1]})"
+	fi
+
 	local abi i found
 	for abi in "${abis[@]}"; do
 		for i in "${_MULTILIB_FLAGS[@]}"; do
-- 
1.8.1.1



^ permalink raw reply related	[flat|nested] 15+ messages in thread

* Re: [gentoo-dev] [PATCH 2/5] Use explicit abi_* flags to select multilib targets.
  2013-01-27 22:46     ` Michał Górny
  2013-01-27 22:46       ` [gentoo-dev] [PATCH 1/2] Order ABIs following MULTILIB_ABIS Michał Górny
  2013-01-27 22:46       ` [gentoo-dev] [PATCH 2/2] Add an assertion for valid ABI order Michał Górny
@ 2013-01-27 23:27       ` Alexis Ballier
  2013-01-28  9:25         ` Michał Górny
  2 siblings, 1 reply; 15+ messages in thread
From: Alexis Ballier @ 2013-01-27 23:27 UTC (permalink / raw
  To: gentoo-dev; +Cc: mgorny, amd64, releng, x11

On Sun, 27 Jan 2013 23:46:06 +0100
Michał Górny <mgorny@gentoo.org> wrote:

> Alexis,
> 
> Following your remark, I have redesigned the loop to use MULTILIB_ABIS
> list to order the ABIs. This should ensure the most valid replacement
> order.

Great, that's better than what I had thought about

> Additionally, I have added an assertion to ensure that DEFAULT_ABI
> comes last in MULTILIB_ABIS list.

I'm not sure it is a good idea: it is certainly safe, but this removes
the flexibility not to build for the DEFAULT_ABI. Not sure if it's
sane to do so or if there is any usecase either, but since get_all_abis
ensures us DEFAULT_ABI is last I don't see a need to double check it
here.

Alexis.


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [gentoo-dev] [PATCH 2/5] Use explicit abi_* flags to select multilib targets.
  2013-01-27 23:27       ` [gentoo-dev] [PATCH 2/5] Use explicit abi_* flags to select multilib targets Alexis Ballier
@ 2013-01-28  9:25         ` Michał Górny
  0 siblings, 0 replies; 15+ messages in thread
From: Michał Górny @ 2013-01-28  9:25 UTC (permalink / raw
  To: gentoo-dev; +Cc: aballier, amd64, releng, x11

[-- Attachment #1: Type: text/plain, Size: 953 bytes --]

On Sun, 27 Jan 2013 20:27:06 -0300
Alexis Ballier <aballier@gentoo.org> wrote:

> On Sun, 27 Jan 2013 23:46:06 +0100
> Michał Górny <mgorny@gentoo.org> wrote:
> 
> > Alexis,
> > 
> > Following your remark, I have redesigned the loop to use MULTILIB_ABIS
> > list to order the ABIs. This should ensure the most valid replacement
> > order.
> 
> Great, that's better than what I had thought about
> 
> > Additionally, I have added an assertion to ensure that DEFAULT_ABI
> > comes last in MULTILIB_ABIS list.
> 
> I'm not sure it is a good idea: it is certainly safe, but this removes
> the flexibility not to build for the DEFAULT_ABI. Not sure if it's
> sane to do so or if there is any usecase either, but since get_all_abis
> ensures us DEFAULT_ABI is last I don't see a need to double check it
> here.

Well, you are probably right. No point in being more strict than
multilib.eclass.

-- 
Best regards,
Michał Górny

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 316 bytes --]

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [gentoo-dev] [PATCHES] x86 multilib flags, ver. 2
  2013-01-27 13:40 ` [gentoo-dev] [PATCHES] x86 multilib flags, ver. 2 Thomas Sachau
@ 2013-01-29 17:22   ` Michał Górny
  0 siblings, 0 replies; 15+ messages in thread
From: Michał Górny @ 2013-01-29 17:22 UTC (permalink / raw
  To: gentoo-dev; +Cc: tommy

[-- Attachment #1: Type: text/plain, Size: 2389 bytes --]

On Sun, 27 Jan 2013 14:40:35 +0100
Thomas Sachau <tommy@gentoo.org> wrote:

> Michał Górny schrieb:
> > Hello,
> > 
> > Following all the suggestions from Alexis Ballier, I have reworked
> > the code to remove multiple points of failure. I have also rebased it
> > on the common multilib-build eclass concept, and updated amd64
> > no-multilib & x86 profiles as well.
> > 
> > Key points:
> > 
> > 1. The list of available flags and corresponding ABIs is now stored
> >    in a single variable. Adding a new ABI is as simple as adding
> >    a value to that variable (+ profiles).
> > 
> > 2. All ABIs are validated against $(get_all_abis) list. This guarantees
> >    that we check only the flags proper for the arch.
> > 
> > 3. The USE_EXPAND is visible only on amd64 multilib profile. However,
> >    it is also available on non-multilib amd64 & x86, with all flags
> >    masked except for the default one which is force-enabled.
> > 
> > The last point means that x86 binary packages (skype) can have
> > dependencies as simple as:
> > 
> >    dev-libs/libfoo[abi_x86_32]
> > 
> > which would be valid both for amd64 multilib & x86.
> > 
> > 
> > 
> 
> Lets see, if i understand your plan right, without reading all your diffs:
> 
> 1. you currently support amd64/multilib and show same flags on
> amd64/no-multilib and x86 to avoid duplicating the dependency list? If
> yes, will this be extended to general support for all multilib arches,
> only on request for specific arches or not at all?

Yes and no. I do force the flags to enabled but they are hidden
from the end-user using USE_EXPAND.

I don't mind supporting any arch which likes to enable multilib. It's
mostly about adding the flags to proper profiles and to the list
in the eclass. But I'd rather rely on arch teams to decide on how to
proceed with the particular arches.

> 2. How do you handle other abi-specific files like headers or binaries
> and cases like binaries with abi-specific content? Is it possible to
> preserve them for all requested abis or to preserve them for an
> non-default abi?

The idea is that all non-libdir stuff shall be handled properly
by ebuilds. The eclass is meant to support the most common and simplest
case, proper and efficient handling of deviations can't be controlled
centrally.

-- 
Best regards,
Michał Górny

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 316 bytes --]

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2013-01-29 17:22 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-26 22:08 [gentoo-dev] [PATCHES] x86 multilib flags, ver. 2 Michał Górny
2013-01-26 22:08 ` [gentoo-dev] [PATCH 1/5] Introduce a common function to obtain enabled ABIs Michał Górny
2013-01-26 22:08 ` [gentoo-dev] [PATCH 2/5] Use explicit abi_* flags to select multilib targets Michał Górny
2013-01-27 12:34   ` Alexis Ballier
2013-01-27 13:36     ` Michał Górny
2013-01-27 22:46     ` Michał Górny
2013-01-27 22:46       ` [gentoo-dev] [PATCH 1/2] Order ABIs following MULTILIB_ABIS Michał Górny
2013-01-27 22:46       ` [gentoo-dev] [PATCH 2/2] Add an assertion for valid ABI order Michał Górny
2013-01-27 23:27       ` [gentoo-dev] [PATCH 2/5] Use explicit abi_* flags to select multilib targets Alexis Ballier
2013-01-28  9:25         ` Michał Górny
2013-01-26 22:08 ` [gentoo-dev] [PATCH 3/5] Make ABI_X86 an USE_EXPAND, and mask them in global scope Michał Górny
2013-01-26 22:08 ` [gentoo-dev] [PATCH 4/5] Set multilib for (Linux) amd64 profile Michał Górny
2013-01-26 22:08 ` [gentoo-dev] [PATCH 5/5] Unmask and force the abi_x86_32 for uniform binary dependencies Michał Górny
2013-01-27 13:40 ` [gentoo-dev] [PATCHES] x86 multilib flags, ver. 2 Thomas Sachau
2013-01-29 17:22   ` Michał Górny

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox