Parcourir la source

hack: name for target ARM architecture not specified

Build currently doesn't set the right name for target ARM
architecture through switches in CGO_CFLAGS and CGO_CXXFLAGS
when doing cross-compilation. This was previously fixed in https://github.com/moby/moby/pull/43474

Also removes the toolchain configuration. Following changes for
cross-compilation in https://github.com/moby/moby/pull/44546,
we forgot to remove the toolchain configuration that is
not used anymore as xx already sets correct cc/cxx envs already.

Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
(cherry picked from commit 945704208a8f4e3aa16c644a9d96c5735cc6f31d)
Kevin Alvarez il y a 2 ans
Parent
commit
8c12a6648b
1 fichiers modifiés avec 16 ajouts et 53 suppressions
  1. 16 53
      hack/make/.binary

+ 16 - 53
hack/make/.binary

@@ -16,59 +16,22 @@ source "${MAKEDIR}/.go-autogen"
 (
 	export GOGC=${DOCKER_BUILD_GOGC:-1000}
 
-	# for non-sandboxed invocation
-	if ! command -v xx-go > /dev/null 2>&1; then
-		if [ "$(go env GOOS)/$(go env GOARCH)" != "$(go env GOHOSTOS)/$(go env GOHOSTARCH)" ]; then
-			# must be cross-compiling!
-			case "$(go env GOOS)/$(go env GOARCH)" in
-				windows/amd64)
-					export CC="${CC:-x86_64-w64-mingw32-gcc}"
-					export CGO_ENABLED=1
-					;;
-				linux/arm)
-					case "${GOARM}" in
-						5)
-							export CC="${CC:-arm-linux-gnueabi-gcc}"
-							export CGO_ENABLED=1
-							export CGO_CFLAGS="-march=armv5t"
-							export CGO_CXXFLAGS="-march=armv5t"
-							;;
-						6)
-							export CC="${CC:-arm-linux-gnueabi-gcc}"
-							export CGO_ENABLED=1
-							export CGO_CFLAGS="-march=armv6"
-							export CGO_CXXFLAGS="-march=armv6"
-							;;
-						7)
-							export CC="${CC:-arm-linux-gnueabihf-gcc}"
-							export CGO_ENABLED=1
-							export CGO_CFLAGS="-march=armv7-a"
-							export CGO_CXXFLAGS="-march=armv7-a"
-							;;
-						*)
-							export CC="${CC:-arm-linux-gnueabihf-gcc}"
-							export CGO_ENABLED=1
-							;;
-					esac
-					;;
-				linux/arm64)
-					export CC="${CC:-aarch64-linux-gnu-gcc}"
-					export CGO_ENABLED=1
-					;;
-				linux/amd64)
-					export CC="${CC:-x86_64-linux-gnu-gcc}"
-					export CGO_ENABLED=1
-					;;
-				linux/ppc64le)
-					export CC="${CC:-powerpc64le-linux-gnu-gcc}"
-					export CGO_ENABLED=1
-					;;
-				linux/s390x)
-					export CC="${CC:-s390x-linux-gnu-gcc}"
-					export CGO_ENABLED=1
-					;;
-			esac
-		fi
+	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
 
 	# -buildmode=pie is not supported on Windows arm64 and Linux mips*, ppc64be