docker-ce: fix cross compilation and enable build for aarch64 and arm
authorJohann Neuhauser <johann@it-neuhauser.de>
Tue, 5 Nov 2019 10:56:47 +0000 (11:56 +0100)
committerYousong Zhou <yszhou4tech@gmail.com>
Wed, 6 Nov 2019 14:11:12 +0000 (22:11 +0800)
Compile-tested on: bcm2710, imx6
Runtime-tested on: bcm2710, imx6

Signed-off-by: Johann Neuhauser <johann@it-neuhauser.de>
utils/docker-ce/Makefile
utils/docker-ce/patches/002-imporve-hardcoded-CC-on-cross-compile.patch [new file with mode: 0644]

index 6fbb4434a6c6fb396547e1cf543befd1f05a7ef9..bd90b22061cc6016881248b55896b9a12bd0d3e3 100644 (file)
@@ -2,7 +2,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=docker-ce
 PKG_VERSION:=19.03.4
-PKG_RELEASE:=1
+PKG_RELEASE:=2
 PKG_LICENSE:=Apache-2.0
 PKG_LICENSE_FILES:=components/cli/LICENSE components/engine/LICENSE
 
@@ -44,7 +44,7 @@ define Package/docker-ce
   CATEGORY:=Utilities
   TITLE:=Docker Community Edition
   URL:=https://www.docker.com/
-  DEPENDS:=$(GO_ARCH_DEPENDS) @TARGET_x86_64 +btrfs-progs +ca-certificates +cgroupfs-mount +containerd +libdevmapper +libnetwork +tini \
+  DEPENDS:=$(GO_ARCH_DEPENDS) @(aarch64||arm||x86_64) +btrfs-progs +ca-certificates +cgroupfs-mount +containerd +libdevmapper +libnetwork +tini \
            +DOCKER_SECCOMP:libseccomp +iptables-mod-extra +kmod-br-netfilter +kmod-ikconfig +kmod-nf-conntrack-netlink +kmod-nf-ipvs +kmod-veth
   USERID:=docker:docker
   MENU:=1
diff --git a/utils/docker-ce/patches/002-imporve-hardcoded-CC-on-cross-compile.patch b/utils/docker-ce/patches/002-imporve-hardcoded-CC-on-cross-compile.patch
new file mode 100644 (file)
index 0000000..b134cdf
--- /dev/null
@@ -0,0 +1,58 @@
+From 2fdfb4404ab811cb00227a3de111437b829e55cf Mon Sep 17 00:00:00 2001
+From: Hongxu Jia <hongxu.jia@windriver.com>
+Date: Wed, 17 Jul 2019 17:34:04 +0800
+Subject: [PATCH] imporve hardcoded CC on cross compile
+
+Since commit applied in moby [61a3285 Support cross-compile for arm]
+it hardcoded var-CC to support cross-compile for arm
+
+Correct it with "${parameter:-word}" format, it is helpful for user
+define toolchains
+
+(Use Default Values.  If parameter is unset or null, the expansion of
+word is substituted.  Otherwise, the value of parameter is substituted.)
+
+Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
+Upstream-commit: 3c701e4db1b8646c2324ae524b4e7ca1b1147a07
+Component: engine
+---
+ components/engine/hack/make/.binary | 10 +++++-----
+ 1 file changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/components/engine/hack/make/.binary b/components/engine/hack/make/.binary
+index 53de6749e5..66f4ca05f3 100644
+--- a/components/engine/hack/make/.binary
++++ b/components/engine/hack/make/.binary
+@@ -44,27 +44,27 @@ if [ "$(go env GOOS)/$(go env GOARCH)" != "$(go env GOHOSTOS)/$(go env GOHOSTARC
+       # must be cross-compiling!
+       case "$(go env GOOS)/$(go env GOARCH)" in
+               windows/amd64)
+-                      export CC=x86_64-w64-mingw32-gcc
++                      export CC="${CC:-x86_64-w64-mingw32-gcc}"
+                       export CGO_ENABLED=1
+                       ;;
+               linux/arm)
+                       case "${GOARM}" in
+                       5|"")
+-                              export CC=arm-linux-gnueabi-gcc
++                              export CC="${CC:-arm-linux-gnueabi-gcc}"
+                               export CGO_ENABLED=1
+                               ;;
+                       7)
+-                              export CC=arm-linux-gnueabihf-gcc
++                              export CC="${CC:-arm-linux-gnueabihf-gcc}"
+                               export CGO_ENABLED=1
+                               ;;
+                       esac
+                       ;;
+               linux/arm64)
+-                      export CC=aarch64-linux-gnu-gcc
++                      export CC="${CC:-aarch64-linux-gnu-gcc}"
+                       export CGO_ENABLED=1
+                       ;;
+               linux/amd64)
+-                      export CC=x86_64-linux-gnu-gcc
++                      export CC="${CC:-x86_64-linux-gnu-gcc}"
+                       export CGO_ENABLED=1
+                       ;;
+       esac