File: build.sh

package info (click to toggle)
lf 38%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 876 kB
  • sloc: sh: 151; makefile: 19; csh: 4
file content (15 lines) | stat: -rwxr-xr-x 594 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#!/bin/sh
# Builds a static stripped binary with version information.
#
# This script is used to build a binary for the current platform. Cgo is
# disabled to make sure the binary is statically linked. Appropriate flags are
# given to the go compiler to strip the binary. Current git tag is passed to
# the compiler by default to be used as the version in the binary.

set -o errexit -o nounset

[ -z "${version:-}" ] && version=$(git describe --tags --abbrev=0)

CGO_ENABLED=0 go build -ldflags="-s -w -X main.gVersion=$version" "$@"

# vim: tabstop=4 shiftwidth=4 textwidth=80 colorcolumn=80