cross 1.2 KB

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