Re: [gentoo-dev] [PATCH 2/5] Use explicit abi_* flags to select multilib targets.
On Sun, 27 Jan 2013 20:27:06 -0300 Alexis Ballier aball...@gentoo.org wrote: On Sun, 27 Jan 2013 23:46:06 +0100 Michał Górny mgo...@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 signature.asc Description: PGP signature
Re: [gentoo-dev] [PATCH 2/5] Use explicit abi_* flags to select multilib targets.
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 mgo...@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.
Re: [gentoo-dev] [PATCH 2/5] Use explicit abi_* flags to select multilib targets.
On Sun, 27 Jan 2013 09:34:13 -0300 Alexis Ballier aball...@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 mgo...@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 signature.asc Description: PGP signature
Re: [gentoo-dev] [PATCH 2/5] Use explicit abi_* flags to select multilib targets.
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.
Re: [gentoo-dev] [PATCH 2/5] Use explicit abi_* flags to select multilib targets.
On Sun, 27 Jan 2013 23:46:06 +0100 Michał Górny mgo...@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.