On Fri, Oct 09, 2020 at 12:26:17AM +0000, Jonathan Yong wrote:
> I'm open to fixing ebuild packages by myself in my own overlay, though I
> prefer not to due to eventual bit rot. Any hints on how to mask CPU USE
> flags based on multilib arch in the .ebuild file itself?

I suppose you could detect whether a CPU_FLAG is enabled for a x86_32  multilib,
although be wary that `MULTILIB_ABI_FLAG` is only  exported  for  some  multilib
functions, such as `multilib_src_configure` [1]:

        if [[ ${MULTILIB_ABI_FLAG} == abi_x86_32 ]] && use cpu_flags_x86_avx2;
        then
                ewarn "Disabling AVX2 extensions for 32-bit build."
                # circumvention measures
        fi

I'm not sure of the best way to achieve the "circumvention measures", hence  the
comment.  You could run this conditional after  GLOBALCMAKEARGS  has  been  set,
omitting the CPU_BASELINE definition in the main block [2],  or  you  could  sed
through the USE flags and disable `cpu_flags_x86_avx2` there.   You're  probably
better asking on IRC for the best-practice way to achieve this.

As mentioned in the relevant bug report, this is not  an  issue  caused  by  the
ebuild, so although this might prove to be a temporary fix, it will hopefully be
resolved by upstream very soon. Just be patient. ;-)

[1] 
https://wiki.gentoo.org/wiki/Project:Multilib/multilib-build#MULTILIB_ABI_FLAG
[2] 
https://github.com/opencv/opencv/wiki/CPU-optimizations-build-options#customizing-cmake-options
[3] https://bugs.gentoo.org/747163#c15

-- 

Ashley Dixon
suugaku.co.uk

2A9A 4117
DA96 D18A
8A7B B0D2
A30E BF25
F290 A8AA

Attachment: signature.asc
Description: PGP signature

Reply via email to