github.com/jiasir/docker@v1.3.3-0.20170609024000-252e610103e7/hack/make/cross (about)

     1  #!/usr/bin/env bash
     2  set -e
     3  
     4  # explicit list of os/arch combos that support being a daemon
     5  declare -A daemonSupporting
     6  daemonSupporting=(
     7  	[linux/amd64]=1
     8  	[windows/amd64]=1
     9  )
    10  
    11  # if we have our linux/amd64 version compiled, let's symlink it in
    12  if [ -x "$DEST/../binary-daemon/dockerd-$VERSION" ]; then
    13  	arch=$(go env GOHOSTARCH)
    14  	mkdir -p "$DEST/linux/${arch}"
    15  	(
    16  		cd "$DEST/linux/${arch}"
    17  		ln -s ../../../binary-daemon/* ./
    18  	)
    19  	echo "Created symlinks:" "$DEST/linux/${arch}/"*
    20  fi
    21  
    22  for platform in $DOCKER_CROSSPLATFORMS; do
    23  	(
    24  		export KEEPDEST=1
    25  		export DEST="$DEST/$platform" # bundles/VERSION/cross/GOOS/GOARCH/docker-VERSION
    26  		export GOOS=${platform%/*}
    27  		export GOARCH=${platform##*/}
    28  
    29  		if [ "$GOOS" != "solaris" ]; then
    30  			# TODO. Solaris cannot be cross build because of CGO calls.
    31  
    32  			# go install docker/docker/pkg packages to ensure that
    33  			# they build cross platform.
    34  			go install github.com/docker/docker/pkg/...
    35  
    36  			if [ -n "${daemonSupporting[$platform]}" ]; then
    37  				# Since tgz relies on the paths created by mkdir
    38  				# and we removed the clients, we don't want to mkdir
    39  				# for all the platforms, only the ones supported by the daemon.
    40  				mkdir -p "$DEST"
    41  				ABS_DEST="$(cd "$DEST" && pwd -P)"
    42  				source "${MAKEDIR}/binary-daemon"
    43  			fi
    44  		fi
    45  	)
    46  done