1
0
mirror of https://github.com/rancher/os.git synced 2025-06-19 11:41:55 +00:00
os/scripts/build-target
2018-11-07 13:48:13 +08:00

21 lines
507 B
Bash
Executable File

#!/bin/bash
set -ex
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
BUILDDATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')
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}'"
go build -ldflags "$CONST -extldflags -static -s -w" -o ${OUTPUT}