hack: check if cross-compiling before setting ARM target name
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
parent
95e207933d
commit
67aa86f1e0
1 changed files with 19 additions and 16 deletions
|
@ -16,22 +16,25 @@ source "${MAKEDIR}/.go-autogen"
|
|||
(
|
||||
export GOGC=${DOCKER_BUILD_GOGC:-1000}
|
||||
|
||||
if [ "$(go env GOOS)/$(go env GOARCH)" = "linux/arm" ]; then
|
||||
# specify name of the target ARM architecture
|
||||
case "$(go env GOARM)" in
|
||||
5)
|
||||
export CGO_CFLAGS="-march=armv5t"
|
||||
export CGO_CXXFLAGS="-march=armv5t"
|
||||
;;
|
||||
6)
|
||||
export CGO_CFLAGS="-march=armv6"
|
||||
export CGO_CXXFLAGS="-march=armv6"
|
||||
;;
|
||||
7)
|
||||
export CGO_CFLAGS="-march=armv7-a"
|
||||
export CGO_CXXFLAGS="-march=armv7-a"
|
||||
;;
|
||||
esac
|
||||
if [ "$(go env GOOS)/$(go env GOARCH)" != "$(go env GOHOSTOS)/$(go env GOHOSTARCH)" ]; then
|
||||
# must be cross-compiling!
|
||||
if [ "$(go env GOOS)/$(go env GOARCH)" = "linux/arm" ]; then
|
||||
# specify name of the target ARM architecture
|
||||
case "$(go env GOARM)" in
|
||||
5)
|
||||
export CGO_CFLAGS="-march=armv5t"
|
||||
export CGO_CXXFLAGS="-march=armv5t"
|
||||
;;
|
||||
6)
|
||||
export CGO_CFLAGS="-march=armv6"
|
||||
export CGO_CXXFLAGS="-march=armv6"
|
||||
;;
|
||||
7)
|
||||
export CGO_CFLAGS="-march=armv7-a"
|
||||
export CGO_CXXFLAGS="-march=armv7-a"
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
fi
|
||||
|
||||
# -buildmode=pie is not supported on Windows arm64 and Linux mips*, ppc64be
|
||||
|
|
Loading…
Reference in a new issue