mirror of https://github.com/docker/cli.git
				
				
				
			Add windows and linux cross.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
This commit is contained in:
		
							parent
							
								
									a787cbc93b
								
							
						
					
					
						commit
						84a77889c3
					
				| 
						 | 
				
			
			@ -7,11 +7,10 @@ RUN     sed -ri "s/(httpredir|deb).debian.org/$APT_MIRROR/g" /etc/apt/sources.li
 | 
			
		|||
 | 
			
		||||
RUN     apt-get update && apt-get install -y \
 | 
			
		||||
            libltdl-dev \
 | 
			
		||||
            gcc-mingw-w64 \
 | 
			
		||||
            parallel \
 | 
			
		||||
            ;
 | 
			
		||||
 | 
			
		||||
#            build-essential \ 
 | 
			
		||||
#            binutils-mingw-w64 gcc-mingw-w64
 | 
			
		||||
 | 
			
		||||
RUN     go get github.com/mitchellh/gox && \
 | 
			
		||||
        cp /go/bin/gox /usr/bin && \
 | 
			
		||||
        rm -rf /go/src/* /go/pkg/* /go/bin/*
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -2,20 +2,8 @@
 | 
			
		|||
 | 
			
		||||
set -eu -o pipefail
 | 
			
		||||
 | 
			
		||||
source ./scripts/build/.variables
 | 
			
		||||
export BUILDDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
 | 
			
		||||
 | 
			
		||||
# Wow, gox doesn't like extra spaces between these strings...
 | 
			
		||||
CROSS_OSARCH="\
 | 
			
		||||
windows/amd64"
 | 
			
		||||
 | 
			
		||||
#darwin/amd64 \
 | 
			
		||||
#linux/amd64 \
 | 
			
		||||
#linux/arm \
 | 
			
		||||
 | 
			
		||||
# Currently broken
 | 
			
		||||
# linux/ppc64le \
 | 
			
		||||
 | 
			
		||||
gox -output build/docker-{{.OS}}-{{.Arch}} \
 | 
			
		||||
    -osarch "${CROSS_OSARCH}" \
 | 
			
		||||
	--ldflags "${LDFLAGS}" \
 | 
			
		||||
	${SOURCE}
 | 
			
		||||
SHELL=/bin/bash parallel ::: \
 | 
			
		||||
    "$BUILDDIR/linux-cross" \
 | 
			
		||||
    "$BUILDDIR/windows"
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -0,0 +1,21 @@
 | 
			
		|||
#!/usr/bin/env bash
 | 
			
		||||
#
 | 
			
		||||
# Build static linux binary for multiple architectures
 | 
			
		||||
#
 | 
			
		||||
 | 
			
		||||
set -eu -o pipefail
 | 
			
		||||
 | 
			
		||||
source ./scripts/build/.variables
 | 
			
		||||
 | 
			
		||||
CROSS_OSARCH="linux/amd64 linux/arm"
 | 
			
		||||
 | 
			
		||||
# Compile is broken
 | 
			
		||||
# linux/ppc64le
 | 
			
		||||
 | 
			
		||||
# Not yet supported by gox
 | 
			
		||||
# linux/s390x
 | 
			
		||||
 | 
			
		||||
gox -output build/docker-{{.OS}}-{{.Arch}} \
 | 
			
		||||
    -osarch "${CROSS_OSARCH}" \
 | 
			
		||||
	--ldflags "${LDFLAGS}" \
 | 
			
		||||
	"${SOURCE}"
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,19 @@
 | 
			
		|||
#!/usr/bin/env bash
 | 
			
		||||
#
 | 
			
		||||
# Build a windows binary from linux
 | 
			
		||||
#
 | 
			
		||||
 | 
			
		||||
set -eu -o pipefail
 | 
			
		||||
 | 
			
		||||
source ./scripts/build/.variables
 | 
			
		||||
 | 
			
		||||
export CC=x86_64-w64-mingw32-gcc
 | 
			
		||||
export CGO_ENABLED=1
 | 
			
		||||
export GOOS=windows
 | 
			
		||||
export GOARCH=amd64
 | 
			
		||||
 | 
			
		||||
# Override TARGET
 | 
			
		||||
export TARGET="build/docker-windows-amd64"
 | 
			
		||||
 | 
			
		||||
# TODO: -tags pkcs11
 | 
			
		||||
go build -o "${TARGET}" --ldflags "${LDFLAGS}" "${SOURCE}"
 | 
			
		||||
		Loading…
	
		Reference in New Issue