Debian Codegraph @

build

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