cross 1.3 KB

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