github.com/duglin/docker@v1.13.1/hack/make/cross (about)

     1  #!/bin/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  		ln -s ../../../binary-client/* ./
    19  	)
    20  	echo "Created symlinks:" "$DEST/linux/${arch}/"*
    21  fi
    22  
    23  for platform in $DOCKER_CROSSPLATFORMS; do
    24  	(
    25  		export KEEPDEST=1
    26  		export DEST="$DEST/$platform" # bundles/VERSION/cross/GOOS/GOARCH/docker-VERSION
    27  		mkdir -p "$DEST"
    28  		ABS_DEST="$(cd "$DEST" && pwd -P)"
    29  		export GOOS=${platform%/*}
    30  		export GOARCH=${platform##*/}
    31  
    32  		if [ "$GOOS" != "solaris" ]; then
    33  			# TODO. Solaris cannot be cross build because of CGO calls.
    34  			if [ -z "${daemonSupporting[$platform]}" ]; then
    35  				# we just need a simple client for these platforms
    36  				export LDFLAGS_STATIC_DOCKER=""
    37  				# remove the "daemon" build tag from platforms that aren't supported
    38  				export BUILDFLAGS=( "${ORIG_BUILDFLAGS[@]/ daemon/}" )
    39  				source "${MAKEDIR}/binary-client"
    40  			else
    41  				source "${MAKEDIR}/binary-client"
    42  				source "${MAKEDIR}/binary-daemon"
    43  			fi
    44  		fi
    45  	)
    46  done