2021-03-03 02:03:02 -05:00
|
|
|
#!/usr/bin/env sh
|
2017-05-11 18:52:17 -04:00
|
|
|
#
|
|
|
|
# Build a static binary for the host OS/ARCH
|
|
|
|
#
|
2017-05-09 12:38:23 -04:00
|
|
|
|
2021-03-03 02:03:02 -05:00
|
|
|
set -eu
|
2017-05-09 12:38:23 -04:00
|
|
|
|
2021-03-03 02:03:02 -05:00
|
|
|
. ./scripts/build/.variables
|
2017-05-11 18:52:17 -04:00
|
|
|
|
2021-03-03 02:03:02 -05:00
|
|
|
if [ "$CGO_ENABLED" = "1" ] && [ "$(go env GOOS)" != "windows" ]; then
|
2021-11-17 11:18:15 -05:00
|
|
|
GO_BUILDTAGS="$GO_BUILDTAGS pkcs11"
|
2021-03-03 02:03:02 -05:00
|
|
|
fi
|
|
|
|
|
|
|
|
echo "Building $GO_LINKMODE $(basename "${TARGET}")"
|
|
|
|
|
|
|
|
export GO111MODULE=auto
|
|
|
|
|
2021-10-11 10:54:09 -04:00
|
|
|
if [ "$(go env GOOS)" = "windows" ]; then
|
|
|
|
if [ ! -x "$(command -v goversioninfo)" ]; then
|
|
|
|
>&2 echo "goversioninfo not found, skipping manifesting binary"
|
|
|
|
else
|
|
|
|
./scripts/build/mkversioninfo
|
|
|
|
(set -x ; go generate -v "${SOURCE}")
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2021-11-17 11:18:15 -05:00
|
|
|
(set -x ; go build -o "${TARGET}" -tags "${GO_BUILDTAGS}" -ldflags "${LDFLAGS}" ${GO_BUILDMODE} "${SOURCE}")
|
2021-03-03 02:03:02 -05:00
|
|
|
|
|
|
|
ln -sf "$(basename "${TARGET}")" "$(dirname "${TARGET}")/docker"
|