2016-05-06 10:12:09 -07:00
|
|
|
#!/bin/bash
|
2017-05-19 21:41:09 +10:00
|
|
|
set -ex
|
2016-05-06 10:12:09 -07:00
|
|
|
|
|
|
|
ros="$1"
|
|
|
|
|
|
|
|
source $(dirname $0)/version
|
|
|
|
|
|
|
|
cd $(dirname $0)/..
|
|
|
|
|
|
|
|
if [ "${!TOOLCHAIN}" != "" ]; then
|
|
|
|
export CC=/usr/bin/${!TOOLCHAIN}-gcc
|
|
|
|
export CGO_ENABLED=1
|
|
|
|
fi
|
|
|
|
|
|
|
|
OUTPUT=${OUTPUT:-bin/ros}
|
|
|
|
echo Building $OUTPUT
|
2017-07-28 11:50:07 +10:00
|
|
|
BUILDDATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')
|
2016-05-31 21:38:10 -07:00
|
|
|
|
2018-02-28 15:43:08 +08:00
|
|
|
CONST="-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}'"
|
2018-11-07 13:47:56 +08:00
|
|
|
go build -ldflags "$CONST -extldflags -static -s -w" -o ${OUTPUT}
|