* [gentoo-dev] [PATCHES] multilib-build: use MULTILIB_ABI for eclass-specific ABI value
@ 2013-04-02 21:42 Michał Górny
2013-04-02 21:43 ` [gentoo-dev] [PATCH 1/2] multilib-build: set MULTILIB_ABI as the 'global' " Michał Górny
` (3 more replies)
0 siblings, 4 replies; 8+ messages in thread
From: Michał Górny @ 2013-04-02 21:42 UTC (permalink / raw
To: Gentoo Developer Mailing List
[-- Attachment #1: Type: text/plain, Size: 1104 bytes --]
Hello,
Currently, the multilib-build eclass uses abi_* constants only for USE
flags and only ${ABI} is exported to the function. This is bad since it
basically requires a reverse mapping of ABI->abi_* values, often
inlined as ${ABI} checks.
The patches which I will send in reply to this thread aim to fix it.
The first patch changes the eclass logic. The abi_* values, with 'abi_'
prefix stripped, are called MULTILIB_ABI now. They are used to run
the 'foreach' functions, and now are set in the called functions along
with ABI.
As a downside, the switch required the MULTILIB_ABI -> ABI mapping to
occur inside foreach -- as in, another 'for' loop. It shouldn't cause
any noticeable difference.
Additionally, the 'default' fallback no longer calls
multilib_toolchain_setup. This should improve compatibility with
multilib-portage and *maybe* cross-compiling.
The second patch uses new ${MULTILIB_ABI} variable in header wrapping
function. In other words, it removes the ABI -> MULTILIB_ABI reverse
mapping which becomes unnecessary.
--
Best regards,
Michał Górny
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 966 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* [gentoo-dev] [PATCH 1/2] multilib-build: set MULTILIB_ABI as the 'global' ABI value.
2013-04-02 21:42 [gentoo-dev] [PATCHES] multilib-build: use MULTILIB_ABI for eclass-specific ABI value Michał Górny
@ 2013-04-02 21:43 ` Michał Górny
2013-04-02 21:43 ` [gentoo-dev] [PATCH 2/2] Use MULTILIB_ABI in header wrapping code Michał Górny
` (2 subsequent siblings)
3 siblings, 0 replies; 8+ messages in thread
From: Michał Górny @ 2013-04-02 21:43 UTC (permalink / raw
To: gentoo-dev; +Cc: Michał Górny
---
gx86/eclass/multilib-build.eclass | 41 ++++++++++++++++++++++++++++++++++-----
1 file changed, 36 insertions(+), 5 deletions(-)
diff --git a/gx86/eclass/multilib-build.eclass b/gx86/eclass/multilib-build.eclass
index dbaed70..fdaed6b 100644
--- a/gx86/eclass/multilib-build.eclass
+++ b/gx86/eclass/multilib-build.eclass
@@ -25,10 +25,22 @@ esac
inherit multibuild multilib
+# @ECLASS-VARIABLE: MULTILIB_ABI
+# @DEFAULT-UNSET
+# @DESCRIPTION:
+# The current ABI, in form of base arch and sub-ABI, joined using
+# an underscore. It's equal to the flag name with 'abi_' prefix
+# stripped.
+#
+# Exported by multilib_foreach_abi, multilib_parallel_foreach_abi,
+# multilib_for_best_abi.
+#
+# Example values: x86_32, mips_n32
+
# @ECLASS-VARIABLE: _MULTILIB_FLAGS
# @INTERNAL
# @DESCRIPTION:
-# The list of multilib flags and corresponding ABI values.
+# The list of corresponding USE flags and ABI values.
_MULTILIB_FLAGS=(
abi_x86_32:x86
abi_x86_64:amd64
@@ -56,6 +68,7 @@ _multilib_build_set_globals() {
_multilib_build_set_globals
# @FUNCTION: multilib_get_enabled_abis
+# @INTERNAL
# @DESCRIPTION:
# Return the ordered list of enabled ABIs if multilib builds
# are enabled. The best (most preferred) ABI will come last.
@@ -74,7 +87,7 @@ multilib_get_enabled_abis() {
local m_flag=${i%:*}
if [[ ${m_abi} == ${abi} ]] && use "${m_flag}"; then
- echo "${abi}"
+ echo "${m_flag#abi_}"
found=1
fi
done
@@ -87,7 +100,7 @@ multilib_get_enabled_abis() {
debug-print "${FUNCNAME}: no ABIs enabled, fallback to ${abi}"
debug-print "${FUNCNAME}: ABI=${ABI}, DEFAULT_ABI=${DEFAULT_ABI}"
- echo ${abi}
+ echo default
fi
}
@@ -99,8 +112,26 @@ multilib_get_enabled_abis() {
_multilib_multibuild_wrapper() {
debug-print-function ${FUNCNAME} "${@}"
- local ABI=${MULTIBUILD_VARIANT}
- multilib_toolchain_setup "${ABI}"
+ local MULTILIB_ABI=${MULTIBUILD_VARIANT}
+ local i
+
+ if [[ ${MULTILIB_ABI} != default ]]; then
+ local ABI
+
+ for i in "${_MULTILIB_FLAGS[@]}"; do
+ local m_abi=${i#*:}
+ local m_flag=${i%:*}
+
+ if [[ ${MULTILIB_ABI} == ${m_flag#abi_} ]]; then
+ local -x ABI=${m_abi}
+ break
+ fi
+ done
+
+ [[ ${ABI} ]] || die "Unable to match ${MULTILIB_ABI} to an ABI!"
+ multilib_toolchain_setup "${ABI}"
+ fi
+
"${@}"
}
--
1.8.1.5
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [gentoo-dev] [PATCH 2/2] Use MULTILIB_ABI in header wrapping code.
2013-04-02 21:42 [gentoo-dev] [PATCHES] multilib-build: use MULTILIB_ABI for eclass-specific ABI value Michał Górny
2013-04-02 21:43 ` [gentoo-dev] [PATCH 1/2] multilib-build: set MULTILIB_ABI as the 'global' " Michał Górny
@ 2013-04-02 21:43 ` Michał Górny
2013-04-03 9:40 ` [gentoo-dev] [PATCHES] multilib-build: use MULTILIB_ABI for eclass-specific ABI value Thomas Sachau
2013-04-05 20:56 ` Michał Górny
3 siblings, 0 replies; 8+ messages in thread
From: Michał Górny @ 2013-04-02 21:43 UTC (permalink / raw
To: gentoo-dev; +Cc: Michał Górny
---
gx86/eclass/autotools-multilib.eclass | 21 ++++-----------------
1 file changed, 4 insertions(+), 17 deletions(-)
diff --git a/gx86/eclass/autotools-multilib.eclass b/gx86/eclass/autotools-multilib.eclass
index 5ecbd2f..55d32d7 100644
--- a/gx86/eclass/autotools-multilib.eclass
+++ b/gx86/eclass/autotools-multilib.eclass
@@ -102,33 +102,20 @@ _autotools-multilib_wrap_headers() {
#if defined(__x86_64__) /* amd64 */
# if defined(__ILP32__) /* x32 ABI */
-# error "abi_x86_x32 not supported by the package."
+# error "x86_x32 not supported by the package."
# else /* 64-bit ABI */
-# error "abi_x86_64 not supported by the package."
+# error "x86_64 not supported by the package."
# endif
#elif defined(__i386__) /* plain x86 */
-# error "abi_x86_32 not supported by the package."
+# error "x86_32 not supported by the package."
#else
# error "No ABI matched, please report a bug to bugs.gentoo.org"
#endif
_EOF_
fi
- # XXX: get abi_* directly
- local abi_flag
- case "${ABI}" in
- amd64)
- abi_flag=abi_x86_64;;
- x86)
- abi_flag=abi_x86_32;;
- x32)
- abi_flag=abi_x86_x32;;
- *)
- die "Header wrapping for ${ABI} not supported yet";;
- esac
-
# Note: match a space afterwards to avoid collision potential.
- sed -e "/${abi_flag} /s&error.*&include <${CHOST}/${f}>&" \
+ sed -e "/${MULTILIB_ABI} /s&error.*&include <${CHOST}/${f}>&" \
-i "${ED}/tmp/multilib-include${f}" || die
done
}
--
1.8.1.5
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [gentoo-dev] [PATCHES] multilib-build: use MULTILIB_ABI for eclass-specific ABI value
2013-04-03 9:40 ` [gentoo-dev] [PATCHES] multilib-build: use MULTILIB_ABI for eclass-specific ABI value Thomas Sachau
@ 2013-04-03 9:40 ` Ciaran McCreesh
2013-04-03 9:52 ` Michał Górny
2013-04-05 3:53 ` Michał Górny
2 siblings, 0 replies; 8+ messages in thread
From: Ciaran McCreesh @ 2013-04-03 9:40 UTC (permalink / raw
To: gentoo-dev
[-- Attachment #1: Type: text/plain, Size: 364 bytes --]
On Wed, 03 Apr 2013 11:40:31 +0200
Thomas Sachau <tommy@gentoo.org> wrote:
> You know, that multilib-portage does use MULTILIB_ABI as USE-expanded
> variable? Using exactly the same in the eclass will call for collision
> issues.
I doubt very many people know that, since there's still no spec for the
changes in multilib-portage.
--
Ciaran McCreesh
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 198 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [gentoo-dev] [PATCHES] multilib-build: use MULTILIB_ABI for eclass-specific ABI value
2013-04-02 21:42 [gentoo-dev] [PATCHES] multilib-build: use MULTILIB_ABI for eclass-specific ABI value Michał Górny
2013-04-02 21:43 ` [gentoo-dev] [PATCH 1/2] multilib-build: set MULTILIB_ABI as the 'global' " Michał Górny
2013-04-02 21:43 ` [gentoo-dev] [PATCH 2/2] Use MULTILIB_ABI in header wrapping code Michał Górny
@ 2013-04-03 9:40 ` Thomas Sachau
2013-04-03 9:40 ` Ciaran McCreesh
` (2 more replies)
2013-04-05 20:56 ` Michał Górny
3 siblings, 3 replies; 8+ messages in thread
From: Thomas Sachau @ 2013-04-03 9:40 UTC (permalink / raw
To: gentoo-dev
[-- Attachment #1: Type: text/plain, Size: 1160 bytes --]
Michał Górny schrieb:
> Hello,
>
> Currently, the multilib-build eclass uses abi_* constants only for USE
> flags and only ${ABI} is exported to the function. This is bad since it
> basically requires a reverse mapping of ABI->abi_* values, often
> inlined as ${ABI} checks.
>
> The patches which I will send in reply to this thread aim to fix it.
>
> The first patch changes the eclass logic. The abi_* values, with 'abi_'
> prefix stripped, are called MULTILIB_ABI now. They are used to run
> the 'foreach' functions, and now are set in the called functions along
> with ABI.
>
> As a downside, the switch required the MULTILIB_ABI -> ABI mapping to
> occur inside foreach -- as in, another 'for' loop. It shouldn't cause
> any noticeable difference.
>
> Additionally, the 'default' fallback no longer calls
> multilib_toolchain_setup. This should improve compatibility with
> multilib-portage and *maybe* cross-compiling.
You know, that multilib-portage does use MULTILIB_ABI as USE-expanded
variable? Using exactly the same in the eclass will call for collision
issues.
--
Thomas Sachau
Gentoo Linux Developer
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 379 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [gentoo-dev] [PATCHES] multilib-build: use MULTILIB_ABI for eclass-specific ABI value
2013-04-03 9:40 ` [gentoo-dev] [PATCHES] multilib-build: use MULTILIB_ABI for eclass-specific ABI value Thomas Sachau
2013-04-03 9:40 ` Ciaran McCreesh
@ 2013-04-03 9:52 ` Michał Górny
2013-04-05 3:53 ` Michał Górny
2 siblings, 0 replies; 8+ messages in thread
From: Michał Górny @ 2013-04-03 9:52 UTC (permalink / raw
To: gentoo-dev; +Cc: tommy
[-- Attachment #1: Type: text/plain, Size: 1321 bytes --]
On Wed, 03 Apr 2013 11:40:31 +0200
Thomas Sachau <tommy@gentoo.org> wrote:
> Michał Górny schrieb:
> > Hello,
> >
> > Currently, the multilib-build eclass uses abi_* constants only for USE
> > flags and only ${ABI} is exported to the function. This is bad since it
> > basically requires a reverse mapping of ABI->abi_* values, often
> > inlined as ${ABI} checks.
> >
> > The patches which I will send in reply to this thread aim to fix it.
> >
> > The first patch changes the eclass logic. The abi_* values, with 'abi_'
> > prefix stripped, are called MULTILIB_ABI now. They are used to run
> > the 'foreach' functions, and now are set in the called functions along
> > with ABI.
> >
> > As a downside, the switch required the MULTILIB_ABI -> ABI mapping to
> > occur inside foreach -- as in, another 'for' loop. It shouldn't cause
> > any noticeable difference.
> >
> > Additionally, the 'default' fallback no longer calls
> > multilib_toolchain_setup. This should improve compatibility with
> > multilib-portage and *maybe* cross-compiling.
>
> You know, that multilib-portage does use MULTILIB_ABI as USE-expanded
> variable? Using exactly the same in the eclass will call for collision
> issues.
Argv. Could you suggest a new name then?
--
Best regards,
Michał Górny
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 966 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [gentoo-dev] [PATCHES] multilib-build: use MULTILIB_ABI for eclass-specific ABI value
2013-04-03 9:40 ` [gentoo-dev] [PATCHES] multilib-build: use MULTILIB_ABI for eclass-specific ABI value Thomas Sachau
2013-04-03 9:40 ` Ciaran McCreesh
2013-04-03 9:52 ` Michał Górny
@ 2013-04-05 3:53 ` Michał Górny
2 siblings, 0 replies; 8+ messages in thread
From: Michał Górny @ 2013-04-05 3:53 UTC (permalink / raw
To: gentoo-dev; +Cc: tommy
[-- Attachment #1: Type: text/plain, Size: 1016 bytes --]
On Wed, 03 Apr 2013 11:40:31 +0200
Thomas Sachau <tommy@gentoo.org> wrote:
> Michał Górny schrieb:
> > The first patch changes the eclass logic. The abi_* values, with 'abi_'
> > prefix stripped, are called MULTILIB_ABI now. They are used to run
> > the 'foreach' functions, and now are set in the called functions along
> > with ABI.
> >
> > [...]
> >
> > Additionally, the 'default' fallback no longer calls
> > multilib_toolchain_setup. This should improve compatibility with
> > multilib-portage and *maybe* cross-compiling.
>
> You know, that multilib-portage does use MULTILIB_ABI as USE-expanded
> variable? Using exactly the same in the eclass will call for collision
> issues.
Ok, I see one more issue. Whenever ebuilds start checking
MULTILIB_ABI or the new-named equivalent of it, multilib portage is
going to fail those checks by using 'default'.
Any suggestions how to avoid that? Probably achievable only through
staying with $ABI.
--
Best regards,
Michał Górny
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 966 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [gentoo-dev] [PATCHES] multilib-build: use MULTILIB_ABI for eclass-specific ABI value
2013-04-02 21:42 [gentoo-dev] [PATCHES] multilib-build: use MULTILIB_ABI for eclass-specific ABI value Michał Górny
` (2 preceding siblings ...)
2013-04-03 9:40 ` [gentoo-dev] [PATCHES] multilib-build: use MULTILIB_ABI for eclass-specific ABI value Thomas Sachau
@ 2013-04-05 20:56 ` Michał Górny
3 siblings, 0 replies; 8+ messages in thread
From: Michał Górny @ 2013-04-05 20:56 UTC (permalink / raw
To: gentoo-dev
[-- Attachment #1: Type: text/plain, Size: 728 bytes --]
On Tue, 2 Apr 2013 23:42:42 +0200
Michał Górny <mgorny@gentoo.org> wrote:
> Currently, the multilib-build eclass uses abi_* constants only for USE
> flags and only ${ABI} is exported to the function. This is bad since it
> basically requires a reverse mapping of ABI->abi_* values, often
> inlined as ${ABI} checks.
Due to the multilib-portage conflicts pointed out by Tommy, and other
potential issues resulting from spreading the use of abi_* constants
over the tree, I have decided to withdraw these patches for now.
They may be re-considered in the future when multilib-portage will
respect and use the eclass, or when a better and less conflicting
method is found.
--
Best regards,
Michał Górny
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 966 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2013-04-05 20:56 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-02 21:42 [gentoo-dev] [PATCHES] multilib-build: use MULTILIB_ABI for eclass-specific ABI value Michał Górny
2013-04-02 21:43 ` [gentoo-dev] [PATCH 1/2] multilib-build: set MULTILIB_ABI as the 'global' " Michał Górny
2013-04-02 21:43 ` [gentoo-dev] [PATCH 2/2] Use MULTILIB_ABI in header wrapping code Michał Górny
2013-04-03 9:40 ` [gentoo-dev] [PATCHES] multilib-build: use MULTILIB_ABI for eclass-specific ABI value Thomas Sachau
2013-04-03 9:40 ` Ciaran McCreesh
2013-04-03 9:52 ` Michał Górny
2013-04-05 3:53 ` Michał Górny
2013-04-05 20:56 ` 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