File: build.sh

package info (click to toggle)
kel-agent 0.4.6-2.1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 652 kB
  • sloc: xml: 72; makefile: 72; sh: 15
file content (21 lines) | stat: -rwxr-xr-x 459 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/usr/bin/env bash
set -eu

VERSION=${VERSION:-v$(< debian/changelog head -1 | egrep -o "[0-9]+\.[0-9]+\.[0-9]+")}
BUILDTIME=${BUILDTIME:-$(date -u +"%Y-%m-%dT%H:%M:%SZ")}

export LDFLAGS="\
    -w \
    -X \"main.Version=${VERSION}\" \
    -X \"main.GitCommit=${GITCOMMIT}\" \
    -X \"main.BuildTime=${BUILDTIME}\" \
    ${LDFLAGS:-} \
"

mod=""
if [ -d vendor ]; then
  mod="-mod vendor"
fi

# shellcheck disable=SC2086
go build $mod --ldflags "$LDFLAGS"