File: build

package info (click to toggle)
hub 2.14.2~ds1-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,376 kB
  • sloc: sh: 1,049; ruby: 857; makefile: 89
file content (39 lines) | stat: -rwxr-xr-x 663 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
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/usr/bin/env bash
# Usage: script/build [-o <BIN>]
#        script/build files

set -e

windows=
[[ $OS == Windows* ]] && windows=1

find_source_files() {
  find . -maxdepth 2 -name '*.go' '!' -name '*_test.go' "$@"
}

build_hub() {
  mkdir -p "$(dirname "$1")"
  go build \
	  -ldflags "-X github.com/github/hub/version.Version=`./script/version` $LDFLAGS" \
	  -gcflags "$GCFLAGS" \
	  -asmflags "$ASMFLAGS" \
	  -o "$1"
}

[ $# -gt 0 ] || set -- -o "bin/hub${windows:+.exe}"

case "$1" in
-o )
  build_hub "${2?}"
  ;;
files )
  find_source_files
  ;;
-h | --help )
  sed -ne '/^#/!q;s/.\{1,2\}//;1d;p' < "$0"
  exit
  ;;
* )
  "$0" --help >&2
  exit 1
esac