github.com/sijibomii/docker@v0.0.0-20231230191044-5cf6ca554647/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/docker-$VERSION" ]; then
    13  	mkdir -p "$DEST/linux/amd64"
    14  	(
    15  		cd "$DEST/linux/amd64"
    16  		ln -s ../../../binary/* ./
    17  	)
    18  	echo "Created symlinks:" "$DEST/linux/amd64/"*
    19  fi
    20  
    21  for platform in $DOCKER_CROSSPLATFORMS; do
    22  	(
    23  		export DEST="$DEST/$platform" # bundles/VERSION/cross/GOOS/GOARCH/docker-VERSION
    24  		mkdir -p "$DEST"
    25  		ABS_DEST="$(cd "$DEST" && pwd -P)"
    26  		export GOOS=${platform%/*}
    27  		export GOARCH=${platform##*/}
    28  		if [ -z "${daemonSupporting[$platform]}" ]; then
    29  			export LDFLAGS_STATIC_DOCKER="" # we just need a simple client for these platforms
    30  			export BUILDFLAGS=( "${ORIG_BUILDFLAGS[@]/ daemon/}" ) # remove the "daemon" build tag from platforms that aren't supported
    31  		fi
    32  		source "${MAKEDIR}/binary"
    33  	)
    34  done