github.com/afbjorklund/moby@v20.10.5+incompatible/hack/make/cross (about)

     1  #!/usr/bin/env bash
     2  set -e
     3  
     4  # if we have our linux/amd64 version compiled, let's symlink it in
     5  if [ -x "${DEST}/../binary-daemon/dockerd-${VERSION}" ]; then
     6  	arch=$(go env GOHOSTARCH)
     7  	mkdir -p "$DEST/linux/${arch}"
     8  	(
     9  		cd "${DEST}/linux/${arch}"
    10  		ln -sf ../../../binary-daemon/* ./
    11  	)
    12  	echo "Created symlinks:" "${DEST}/linux/${arch}/"*
    13  fi
    14  
    15  DOCKER_CROSSPLATFORMS=${DOCKER_CROSSPLATFORMS:-"linux/amd64 windows/amd64"}
    16  
    17  for platform in ${DOCKER_CROSSPLATFORMS}; do
    18  	(
    19  		export KEEPDEST=1
    20  		export DEST="${DEST}/${platform}" # bundles/VERSION/cross/GOOS/GOARCH/docker-VERSION
    21  		export GOOS=${platform%%/*}
    22  		export GOARCH=${platform#*/}
    23  
    24  		if [[ "${GOARCH}" = "arm/"* ]]; then
    25  			GOARM=${GOARCH##*/v}
    26  			GOARCH=${GOARCH%/v*}
    27  			export GOARM
    28  		fi
    29  
    30  		echo "Cross building: ${DEST}"
    31  		mkdir -p "${DEST}"
    32  		ABS_DEST="$(cd "${DEST}" && pwd -P)"
    33  		source "${MAKEDIR}/binary-daemon"
    34  
    35  		source "${MAKEDIR}/cross-platform-dependent"
    36  	)
    37  done