• [gentoo-dev] [PATCH] rocm.eclass: add ROCM_SKIP_GLOBALS for the USE-fla

    From heroxbd@gentoo.org@21:1/5 to All on Mon Nov 27 01:50:01 2023
    From: Benda Xu <heroxbd@gentoo.org>

    Low level ebuilds such as dev-util/hip and
    dev-libs/rocm-opencl-runtime, unconditionally supports all the AMDGPU
    cards. They do not need to define amdgpu_targets_* USE-flags. But
    their src_test() call check_amdgpu() to confirm an AMDGPU is
    available.

    Signed-off-by: Benda Xu <heroxbd@gentoo.org>
    ---
    eclass/rocm.eclass | 18 ++++++++++++++++--
    1 file changed, 16 insertions(+), 2 deletions(-)

    diff --git a/eclass/rocm.eclass b/eclass/rocm.eclass
    index b78dfea1cc31..9804ecde97d0 100644
    --- a/eclass/rocm.eclass
    +++ b/eclass/rocm.eclass
    @@ -125,11 +125,26 @@ _ROCM_ECLASS=1
    # DEPEND="sci-libs/rocBLAS[${ROCM_USEDEP}]"
    # @CODE

    +# @ECLASS_VARIABLE: ROCM_SKIP_GLOBALS
    +# @DESCRIPTION:
    +# Controls whether _rocm_set_globals() is executed. This variable is for
    +# ebuilds that call check_amdgpu() without the need to define amdgpu_targets_* +# USE-flags, such as dev-util/hip and dev-libs/rocm-opencl-runtime.
    +#
    +# Example use:
    +# @CODE
    +# ROCM_SKIP_GLOBALS=1
    +# inherit rocm
    +# @CODE
    +
    # @FUNCTION: _rocm_set_globals
    # @DESCRIPTION:
    # Set global variables useful to ebuilds: IUSE, ROCM_REQUIRED_USE, and
    -# ROCM_USEDEP
    +# ROCM_USEDEP, unless ROCM_SKIP_GLOBALS is set.
    +
    _rocm_set_globals() {
    + [[ -n ${ROCM_SKIP_GLOBALS} ]] && return
    +
    # Two lists of AMDGPU_TARGETS of certain ROC