commit:     b2ef3711590017fec705bbb8a9f00268781128a1
Author:     William Hubbs <williamh <AT> gentoo <DOT> org>
AuthorDate: Fri Feb 17 03:13:31 2023 +0000
Commit:     William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Fri Feb 17 03:20:13 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b2ef3711

go-module.eclass: fix -buildmode=pie, support makeopts

Closes: https://bugs.gentoo.org/893316
Signed-off-by: William Hubbs <williamh <AT> gentoo.org>

 eclass/go-module.eclass | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/eclass/go-module.eclass b/eclass/go-module.eclass
index 08e9f267d0af..bae5d2a49894 100644
--- a/eclass/go-module.eclass
+++ b/eclass/go-module.eclass
@@ -65,6 +65,8 @@ case ${EAPI} in
        *) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
 esac
 
+inherit multiprocessing
+
 if [[ -z ${_GO_MODULE} ]]; then
 
 _GO_MODULE=1
@@ -100,7 +102,7 @@ export GOMODCACHE="${WORKDIR}/go-mod"
 # -modcacherw makes the build cache read/write
 # -v prints the names of packages as they are compiled
 # -x prints commands as they are executed
-export GOFLAGS="-buildmode=pie -buildvcs=false -modcacherw -v -x"
+export GOFLAGS="-buildvcs=false -modcacherw -v -x"
 
 # Do not complain about CFLAGS etc since go projects do not use them.
 QA_FLAGS_IGNORED='.*'
@@ -349,6 +351,11 @@ go-module_setup_proxy() {
 # - Otherwise, if EGO_VENDOR is set, bail out.
 # - Otherwise do a normal unpack.
 go-module_src_unpack() {
+       if use amd64 || use arm || use arm64 ||
+               ( use ppc64 && ! use big-endian ) || use s390 || use x86; then
+                       GOFLAGS="-buildmode=pie ${GOFLAGS}"
+       fi
+       GOFLAGS="${GOFLAGS} -p $(makeopts_jobs)"
        if [[ "${#EGO_SUM[@]}" -gt 0 ]]; then
                eqawarn "This ebuild uses EGO_SUM which is deprecated"
                eqawarn "Please migrate to a dependency tarball"

Reply via email to