build-target 849 B

123456789101112131415161718192021
  1. #!/bin/bash
  2. set -ex
  3. ros="$1"
  4. source $(dirname $0)/version
  5. cd $(dirname $0)/..
  6. if [ "${!TOOLCHAIN}" != "" ]; then
  7. export CC=/usr/bin/${!TOOLCHAIN}-gcc
  8. export CGO_ENABLED=1
  9. fi
  10. OUTPUT=${OUTPUT:-bin/ros}
  11. echo Building $OUTPUT
  12. BUILDDATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')
  13. CONST="-X github.com/docker/docker/dockerversion.GitCommit=${COMMIT} -X github.com/docker/docker/dockerversion.Version=${DOCKER_PATCH_VERSION} -X github.com/docker/docker/dockerversion.BuildTime='${BUILDDATE}' -X github.com/docker/docker/dockerversion.IAmStatic=true -X github.com/rancher/os/config.Version=${VERSION} -X github.com/rancher/os/config.OsRepo=${OS_REPO} -X github.com/rancher/os/config.BuildDate='${BUILDDATE}'"
  14. go build -tags "selinux cgo daemon netgo dnspatch" -installsuffix netgo -ldflags "$CONST -linkmode external -extldflags -static -s -w" -o ${OUTPUT}