Skip to content

Commit

Permalink
go-env.eclass: Reapply "also set GOARM & GO386 when applicable"
Browse files Browse the repository at this point in the history
This reverts commit 5718f84.

Reverted because of the issue mentioned in 5718f84
to not leave things broken while investigating a fix.

Reapplying and fixing it up in a followup.

Signed-off-by: Sam James <[email protected]>
  • Loading branch information
thesamesam committed Nov 24, 2023
1 parent ed06052 commit 6a3a1e6
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions eclass/go-env.eclass
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ inherit toolchain-funcs
# @FUNCTION: go-env_set_compile_environment
# @DESCRIPTION:
# Set up basic compile environment: CC, CXX, and GOARCH.
# Necessary platform-specific settings such as GOARM or GO386 are also set
# according to the Portage configuration when building for those architectures.
# Also carry over CFLAGS, LDFLAGS and friends.
# Required for cross-compiling with crossdev.
# If not set, host defaults will be used and the resulting binaries are host arch.
Expand All @@ -28,6 +30,9 @@ go-env_set_compile_environment() {
tc-export CC CXX

export GOARCH="$(go-env_goarch)"
use arm && export GOARM=$(go-env_goarm)
use x86 && export GO386=$(usex cpu_flags_x86_sse2 '' 'softfloat')

export CGO_CFLAGS="${CGO_CFLAGS:-$CFLAGS}"
export CGO_CPPFLAGS="${CGO_CPPFLAGS:-$CPPFLAGS}"
export CGO_CXXFLAGS="${CGO_CXXFLAGS:-$CXXFLAGS}"
Expand Down Expand Up @@ -57,4 +62,20 @@ go-env_goarch() {
esac
}

# @FUNCTION: go-env_goarm
# @USAGE: [CHOST-value]
# @DESCRIPTION:
# Returns the appropriate GOARM setting for the CHOST given, or the default
# CHOST.
go-env_goarm() {
case "${1:-${CHOST}}" in
armv5*) echo 5;;
armv6*) echo 6;;
armv7*) echo 7;;
*)
die "unknown GOARM for ${1:-${CHOST}}"
;;
esac
}

fi

0 comments on commit 6a3a1e6

Please sign in to comment.