-
Notifications
You must be signed in to change notification settings - Fork 17
/
build
executable file
·34 lines (24 loc) · 896 Bytes
/
build
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/usr/bin/env bash
set -eu
NAME="ignition"
ORG_PATH="github.com/flatcar"
REPO_PATH="${ORG_PATH}/${NAME}"
GLDFLAGS=${GLDFLAGS:-}
if [ -z ${VERSION+a} ]; then
echo "Using version from git..."
VERSION=$(git describe --dirty --always)
fi
GLDFLAGS+="-X github.com/flatcar/ignition/internal/version.Raw=${VERSION}"
eval $(go env)
if [ -z ${BIN_PATH+a} ]; then
export BIN_PATH=${PWD}/bin/${GOARCH}
fi
export CGO_ENABLED=1
echo "Building ${NAME}..."
# clean the cache since cgo isn't correctly handled by gocache. Test to see if this version
# of go supports caching before trying to clear the cache
go clean -help 2>&1 | grep -F '[-cache]' >/dev/null && go clean -cache -testcache internal
go build -buildmode=pie -ldflags "${GLDFLAGS}" -o ${BIN_PATH}/${NAME} ./internal
NAME="ignition-validate"
echo "Building ${NAME}..."
go build -ldflags "${GLDFLAGS}" -o ${BIN_PATH}/${NAME} ./validate