From 065dd231dd7d7858df982a8decfade9df936cf63 Mon Sep 17 00:00:00 2001 From: Tianon Gravi Date: Fri, 31 Jan 2014 03:16:42 -0700 Subject: [PATCH] Update/fix build tags, Dockerfile, and release.sh for proper building and releasing of linux/386 and linux/arm cross-compiled client binaries Docker-DCO-1.1-Signed-off-by: Andrew Page (github: tianon) --- Dockerfile | 5 +++-- archive/{stat_unsupported.go => stat_darwin.go} | 3 ++- execdriver/lxc/lxc_init_linux.go | 2 ++ execdriver/lxc/lxc_init_unsupported.go | 3 ++- graphdriver/aufs/mount_linux.go | 2 ++ graphdriver/aufs/mount_unsupported.go | 3 ++- graphdriver/btrfs/btrfs.go | 2 +- graphdriver/devmapper/attach_loopback.go | 2 +- graphdriver/devmapper/deviceset.go | 2 +- graphdriver/devmapper/devmapper.go | 2 +- graphdriver/devmapper/devmapper_log.go | 2 +- graphdriver/devmapper/devmapper_test.go | 2 +- graphdriver/devmapper/devmapper_wrapper.go | 2 +- graphdriver/devmapper/driver.go | 2 +- graphdriver/devmapper/driver_test.go | 2 +- graphdriver/devmapper/ioctl.go | 2 +- graphdriver/devmapper/mount.go | 2 +- graphdriver/devmapper/sys.go | 2 +- hack/release.sh | 3 ++- pkg/graphdb/conn_linux.go | 2 ++ pkg/graphdb/{conn_darwin.go => conn_unsupported.go} | 2 ++ pkg/mount/flags_linux.go | 2 ++ pkg/mount/flags_unsupported.go | 3 ++- pkg/mount/mounter_linux.go | 2 ++ pkg/mount/mounter_unsupported.go | 3 ++- pkg/netlink/netlink_linux.go | 2 ++ pkg/netlink/netlink_unsupported.go | 3 ++- reflink_copy_linux.go | 2 ++ reflink_copy_unsupported.go | 3 ++- utils/uname_linux.go | 2 ++ utils/uname_unsupported.go | 3 ++- 31 files changed, 51 insertions(+), 23 deletions(-) rename archive/{stat_unsupported.go => stat_darwin.go} (92%) rename pkg/graphdb/{conn_darwin.go => conn_unsupported.go} (79%) diff --git a/Dockerfile b/Dockerfile index 5cee5e67d0..ce1c0957e5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -68,8 +68,9 @@ ENV GOPATH /go:/go/src/github.com/dotcloud/docker/vendor RUN cd /usr/local/go/src && ./make.bash --no-clean 2>&1 # Compile Go for cross compilation -ENV DOCKER_CROSSPLATFORMS darwin/amd64 darwin/386 -# TODO add linux/386 and linux/arm +ENV DOCKER_CROSSPLATFORMS linux/386 linux/arm darwin/amd64 darwin/386 +# (set an explicit GOARM of 5 for maximum compatibility) +ENV GOARM 5 RUN cd /usr/local/go/src && bash -xc 'for platform in $DOCKER_CROSSPLATFORMS; do GOOS=${platform%/*} GOARCH=${platform##*/} ./make.bash --no-clean 2>&1; done' # Grab Go's cover tool for dead-simple code coverage testing diff --git a/archive/stat_unsupported.go b/archive/stat_darwin.go similarity index 92% rename from archive/stat_unsupported.go rename to archive/stat_darwin.go index 6c2d3a04b3..32203299dd 100644 --- a/archive/stat_unsupported.go +++ b/archive/stat_darwin.go @@ -1,4 +1,5 @@ -// +build: !linux !amd64 +// +build !linux !amd64 + package archive import "syscall" diff --git a/execdriver/lxc/lxc_init_linux.go b/execdriver/lxc/lxc_init_linux.go index b0055c3668..7288f5877b 100644 --- a/execdriver/lxc/lxc_init_linux.go +++ b/execdriver/lxc/lxc_init_linux.go @@ -1,3 +1,5 @@ +// +build amd64 + package lxc import ( diff --git a/execdriver/lxc/lxc_init_unsupported.go b/execdriver/lxc/lxc_init_unsupported.go index 6b19b99285..d68cb91a1e 100644 --- a/execdriver/lxc/lxc_init_unsupported.go +++ b/execdriver/lxc/lxc_init_unsupported.go @@ -1,4 +1,5 @@ -// +build: !linux !amd64 +// +build !linux !amd64 + package lxc func setHostname(hostname string) error { diff --git a/graphdriver/aufs/mount_linux.go b/graphdriver/aufs/mount_linux.go index c86f1bbd63..6082d9f240 100644 --- a/graphdriver/aufs/mount_linux.go +++ b/graphdriver/aufs/mount_linux.go @@ -1,3 +1,5 @@ +// +build amd64 + package aufs import "syscall" diff --git a/graphdriver/aufs/mount_unsupported.go b/graphdriver/aufs/mount_unsupported.go index 24b64226d2..2735624112 100644 --- a/graphdriver/aufs/mount_unsupported.go +++ b/graphdriver/aufs/mount_unsupported.go @@ -1,4 +1,5 @@ -// +build: !linux !amd64 +// +build !linux !amd64 + package aufs import "errors" diff --git a/graphdriver/btrfs/btrfs.go b/graphdriver/btrfs/btrfs.go index e8dc6bd0e9..a50f11f851 100644 --- a/graphdriver/btrfs/btrfs.go +++ b/graphdriver/btrfs/btrfs.go @@ -1,4 +1,4 @@ -// +build linux +// +build linux,amd64 package btrfs diff --git a/graphdriver/devmapper/attach_loopback.go b/graphdriver/devmapper/attach_loopback.go index 456b5645f4..23339076e8 100644 --- a/graphdriver/devmapper/attach_loopback.go +++ b/graphdriver/devmapper/attach_loopback.go @@ -1,4 +1,4 @@ -// +build linux +// +build linux,amd64 package devmapper diff --git a/graphdriver/devmapper/deviceset.go b/graphdriver/devmapper/deviceset.go index 6e3caf657d..8432d92a4e 100644 --- a/graphdriver/devmapper/deviceset.go +++ b/graphdriver/devmapper/deviceset.go @@ -1,4 +1,4 @@ -// +build linux +// +build linux,amd64 package devmapper diff --git a/graphdriver/devmapper/devmapper.go b/graphdriver/devmapper/devmapper.go index d3eba78a27..7f83a09df9 100644 --- a/graphdriver/devmapper/devmapper.go +++ b/graphdriver/devmapper/devmapper.go @@ -1,4 +1,4 @@ -// +build linux +// +build linux,amd64 package devmapper diff --git a/graphdriver/devmapper/devmapper_log.go b/graphdriver/devmapper/devmapper_log.go index 8d54ad4e3a..18dde7cca5 100644 --- a/graphdriver/devmapper/devmapper_log.go +++ b/graphdriver/devmapper/devmapper_log.go @@ -1,4 +1,4 @@ -// +build linux +// +build linux,amd64 package devmapper diff --git a/graphdriver/devmapper/devmapper_test.go b/graphdriver/devmapper/devmapper_test.go index a43e32e059..3ffa163ceb 100644 --- a/graphdriver/devmapper/devmapper_test.go +++ b/graphdriver/devmapper/devmapper_test.go @@ -1,4 +1,4 @@ -// +build linux +// +build linux,amd64 package devmapper diff --git a/graphdriver/devmapper/devmapper_wrapper.go b/graphdriver/devmapper/devmapper_wrapper.go index 7e6dd5e0cb..bf558affc8 100644 --- a/graphdriver/devmapper/devmapper_wrapper.go +++ b/graphdriver/devmapper/devmapper_wrapper.go @@ -1,4 +1,4 @@ -// +build linux +// +build linux,amd64 package devmapper diff --git a/graphdriver/devmapper/driver.go b/graphdriver/devmapper/driver.go index dae712b9b5..664899cfbf 100644 --- a/graphdriver/devmapper/driver.go +++ b/graphdriver/devmapper/driver.go @@ -1,4 +1,4 @@ -// +build linux +// +build linux,amd64 package devmapper diff --git a/graphdriver/devmapper/driver_test.go b/graphdriver/devmapper/driver_test.go index 9a2e409b63..785845ce6e 100644 --- a/graphdriver/devmapper/driver_test.go +++ b/graphdriver/devmapper/driver_test.go @@ -1,4 +1,4 @@ -// +build linux +// +build linux,amd64 package devmapper diff --git a/graphdriver/devmapper/ioctl.go b/graphdriver/devmapper/ioctl.go index f9bf34f353..30bafff943 100644 --- a/graphdriver/devmapper/ioctl.go +++ b/graphdriver/devmapper/ioctl.go @@ -1,4 +1,4 @@ -// +build linux +// +build linux,amd64 package devmapper diff --git a/graphdriver/devmapper/mount.go b/graphdriver/devmapper/mount.go index d0050484bf..4f19109bf8 100644 --- a/graphdriver/devmapper/mount.go +++ b/graphdriver/devmapper/mount.go @@ -1,4 +1,4 @@ -// +build linux +// +build linux,amd64 package devmapper diff --git a/graphdriver/devmapper/sys.go b/graphdriver/devmapper/sys.go index 540c468988..5a9ab4d74b 100644 --- a/graphdriver/devmapper/sys.go +++ b/graphdriver/devmapper/sys.go @@ -1,4 +1,4 @@ -// +build linux +// +build linux,amd64 package devmapper diff --git a/hack/release.sh b/hack/release.sh index 9a38d2b6e9..50913dd395 100755 --- a/hack/release.sh +++ b/hack/release.sh @@ -151,7 +151,8 @@ release_build() { S3ARCH=i386 ;; arm) - # GOARCH is fine + S3ARCH=armel + # someday, we might potentially support mutliple GOARM values, in which case we might get armhf here too ;; *) echo >&2 "error: can't convert $S3ARCH to an appropriate value for 'uname -m'" diff --git a/pkg/graphdb/conn_linux.go b/pkg/graphdb/conn_linux.go index 2bd51940ce..7a1ab8c92f 100644 --- a/pkg/graphdb/conn_linux.go +++ b/pkg/graphdb/conn_linux.go @@ -1,3 +1,5 @@ +// +build amd64 + package graphdb import ( diff --git a/pkg/graphdb/conn_darwin.go b/pkg/graphdb/conn_unsupported.go similarity index 79% rename from pkg/graphdb/conn_darwin.go rename to pkg/graphdb/conn_unsupported.go index 6e75fd8edb..c2d602569f 100644 --- a/pkg/graphdb/conn_darwin.go +++ b/pkg/graphdb/conn_unsupported.go @@ -1,3 +1,5 @@ +// +build !linux !amd64 + package graphdb func NewSqliteConn(root string) (*Database, error) { diff --git a/pkg/mount/flags_linux.go b/pkg/mount/flags_linux.go index 6f4c7acffa..e2e1f91ab9 100644 --- a/pkg/mount/flags_linux.go +++ b/pkg/mount/flags_linux.go @@ -1,3 +1,5 @@ +// +build amd64 + package mount import ( diff --git a/pkg/mount/flags_unsupported.go b/pkg/mount/flags_unsupported.go index d0b59a63bd..c894efe5b1 100644 --- a/pkg/mount/flags_unsupported.go +++ b/pkg/mount/flags_unsupported.go @@ -1,4 +1,5 @@ -// +build: !linux !amd64 +// +build !linux !amd64 + package mount func parseOptions(options string) (int, string) { diff --git a/pkg/mount/mounter_linux.go b/pkg/mount/mounter_linux.go index dd4280c777..70b7798de5 100644 --- a/pkg/mount/mounter_linux.go +++ b/pkg/mount/mounter_linux.go @@ -1,3 +1,5 @@ +// +build amd64 + package mount import ( diff --git a/pkg/mount/mounter_unsupported.go b/pkg/mount/mounter_unsupported.go index 1dd7458eb0..ee27b35f89 100644 --- a/pkg/mount/mounter_unsupported.go +++ b/pkg/mount/mounter_unsupported.go @@ -1,4 +1,5 @@ -// +build: !linux !amd64 +// +build !linux !amd64 + package mount func mount(device, target, mType string, flag uintptr, data string) error { diff --git a/pkg/netlink/netlink_linux.go b/pkg/netlink/netlink_linux.go index ab572e397a..0ea5b4dbac 100644 --- a/pkg/netlink/netlink_linux.go +++ b/pkg/netlink/netlink_linux.go @@ -1,3 +1,5 @@ +// +build amd64 + package netlink import ( diff --git a/pkg/netlink/netlink_unsupported.go b/pkg/netlink/netlink_unsupported.go index 3fa0c1e93f..cd796b373f 100644 --- a/pkg/netlink/netlink_unsupported.go +++ b/pkg/netlink/netlink_unsupported.go @@ -1,4 +1,5 @@ -// +build: !linux !amd64 +// +build !linux !amd64 + package netlink import ( diff --git a/reflink_copy_linux.go b/reflink_copy_linux.go index 83c7f75413..74a0cb98f7 100644 --- a/reflink_copy_linux.go +++ b/reflink_copy_linux.go @@ -1,3 +1,5 @@ +// +build amd64 + package docker // FIXME: This could be easily rewritten in pure Go diff --git a/reflink_copy_unsupported.go b/reflink_copy_unsupported.go index 8ad94c4f60..271ed0178f 100644 --- a/reflink_copy_unsupported.go +++ b/reflink_copy_unsupported.go @@ -1,4 +1,5 @@ -// +build: !linux !amd64 +// +build !linux !amd64 + package docker import ( diff --git a/utils/uname_linux.go b/utils/uname_linux.go index 063f932c99..2f4afb41bd 100644 --- a/utils/uname_linux.go +++ b/utils/uname_linux.go @@ -1,3 +1,5 @@ +// +build amd64 + package utils import ( diff --git a/utils/uname_unsupported.go b/utils/uname_unsupported.go index 79ea51bd86..57b82ecab8 100644 --- a/utils/uname_unsupported.go +++ b/utils/uname_unsupported.go @@ -1,4 +1,5 @@ -// +build: !linux !amd64 +// +build !linux !amd64 + package utils import (