[meta-virtualization] [PATCH v2 3/4] docker: use a switch to set GOARCH based on TARGET_ARCH value

Fathi Boudra fathi.boudra at linaro.org
Tue Dec 20 01:25:34 PST 2016


It allows to:
* easily extend future architecture added/supported
* tune arm architecture and set GOARM as appropriate

Signed-off-by: Fathi Boudra <fathi.boudra at linaro.org>
---
 recipes-containers/docker/docker_git.bb | 31 +++++++++++++++++++++++--------
 1 file changed, 23 insertions(+), 8 deletions(-)

diff --git a/recipes-containers/docker/docker_git.bb b/recipes-containers/docker/docker_git.bb
index 37df3c4..d163b13 100644
--- a/recipes-containers/docker/docker_git.bb
+++ b/recipes-containers/docker/docker_git.bb
@@ -66,14 +66,29 @@ DOCKER_PKG="github.com/docker/docker"
 do_configure[noexec] = "1"
 
 do_compile() {
-	export GOARCH="${TARGET_ARCH}"
-	# supported amd64, 386, arm arm64
-	if [ "${TARGET_ARCH}" = "x86_64" ]; then
-		export GOARCH="amd64"
-	fi
-	if [ "${TARGET_ARCH}" = "aarch64" ]; then
-		export GOARCH="arm64"
-	fi
+	case "${TARGET_ARCH}" in
+		arm)
+			GOARCH=arm
+			case "${TUNE_PKGARCH}" in
+				cortexa*)
+					export GOARM=7
+				;;
+			esac
+		;;
+		aarch64)
+			GOARCH=arm64
+		;;
+		i586|i686)
+			GOARCH=386
+		;;
+		x86_64)
+			GOARCH=amd64
+		;;
+		*)
+			GOARCH="${TARGET_ARCH}"
+		;;
+	esac
+	export GOARCH
 
 	# Set GOPATH. See 'PACKAGERS.md'. Don't rely on
 	# docker to download its dependencies but rather
-- 
2.11.0



More information about the meta-virtualization mailing list