1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00
moby--moby/hack/make/cross
Tianon Gravi 52379fa76d Convert script shebangs from "#!/bin/bash" to "#!/usr/bin/env bash"
This is especially important for distributions like NixOS where `/bin/bash` doesn't exist, or for MacOS users who've installed a newer version of Bash than the one that comes with their OS.

Signed-off-by: Andrew "Tianon" Page <admwiggin@gmail.com>
2017-02-13 11:01:54 -08:00

46 lines
1.3 KiB
Bash

#!/usr/bin/env bash
set -e
# explicit list of os/arch combos that support being a daemon
declare -A daemonSupporting
daemonSupporting=(
[linux/amd64]=1
[windows/amd64]=1
)
# if we have our linux/amd64 version compiled, let's symlink it in
if [ -x "$DEST/../binary-daemon/dockerd-$VERSION" ]; then
arch=$(go env GOHOSTARCH)
mkdir -p "$DEST/linux/${arch}"
(
cd "$DEST/linux/${arch}"
ln -s ../../../binary-daemon/* ./
ln -s ../../../binary-client/* ./
)
echo "Created symlinks:" "$DEST/linux/${arch}/"*
fi
for platform in $DOCKER_CROSSPLATFORMS; do
(
export KEEPDEST=1
export DEST="$DEST/$platform" # bundles/VERSION/cross/GOOS/GOARCH/docker-VERSION
mkdir -p "$DEST"
ABS_DEST="$(cd "$DEST" && pwd -P)"
export GOOS=${platform%/*}
export GOARCH=${platform##*/}
if [ "$GOOS" != "solaris" ]; then
# TODO. Solaris cannot be cross build because of CGO calls.
if [ -z "${daemonSupporting[$platform]}" ]; then
# we just need a simple client for these platforms
export LDFLAGS_STATIC_DOCKER=""
# remove the "daemon" build tag from platforms that aren't supported
export BUILDFLAGS=( "${ORIG_BUILDFLAGS[@]/ daemon/}" )
source "${MAKEDIR}/binary-client"
else
source "${MAKEDIR}/binary-client"
source "${MAKEDIR}/binary-daemon"
fi
fi
)
done