• [gentoo-dev] [PATCH 2/4] eclass/go-module.eclass: export compile env in

    From James Le Cuirot@21:1/5 to All on Sun Nov 19 13:40:01 2023
    From: Thilo Fromm <thilo.alexander@gmail.com>

    This change calls go-env_set_compile_environment in go-module's
    src_unpack to set up a sane compile environment early in the go build
    process. This un-breaks cross compiling of all golang ebuilds that
    inherit go-module.

    Signed-off-by: Thilo Fromm <thilo.alexander@gmail.com>
    Signed-off-by: James Le Cuirot <chewi@gentoo.org>
    ---
    eclass/go-module.eclass | 5 ++++-
    1 file changed, 4 insertions(+), 1 deletion(-)

    diff --git a/eclass/go-module.eclass b/eclass/go-module.eclass
    index 6c58d7f26f07..701d36e012e2 100644
    --- a/eclass/go-module.eclass
    +++ b/eclass/go-module.eclass
    @@ -68,7 +68,7 @@ esac
    if [[ -z ${_GO_MODULE_ECLASS} ]]; then
    _GO_MODULE_ECLASS=1

    -inherit multiprocessing toolchain-funcs
    +inherit multiprocessing toolchain-funcs go-env

    if [[ ! ${GO_OPTIONAL} ]]; then
    BDEPEND=">=dev-lang/go-1.18"
    @@ -363,6 +363,7 @@ go-module_setup_proxy() {
    # local go proxy. This mode is deprecated.
    # 2. Otherwise, if EGO_VENDOR is set, bail out, as this functionality was removed.
    # 3. Otherwise, call 'ego mod verify' and then do a normal unpack.
    +# Set compile env via go-env.
    go-module_src_unpack() {
    if use amd64 || use arm || use arm64 ||
    ( use ppc64 && [[ $(tc-endian) == "little" ]] ) || use s390 || use x86; then
    @@ -386,6 +387,8 @@ go-module_src_unpack() {
    ${nf} ego mod verify
    fi
    fi