master hovercats/oakiss / repo / senpai / build
 1#!/bin/sh -e
 2
 3export GOROOT=/usr/lib/go
 4export GOPROXY=https://proxy.golang.org
 5#export CGO_ENABLED=0
 6#export GOFLAGS="-ldflags=-static-pie -ldflags=-s -ldflags=-w"
 7#export GO_LDFLAGS="-buildmode=static-pie -s -w"
 8#export CGO_CFLAGS="-O2 -pipe -static -static-pie -w -Wno-error"
 9
10#go build -a \
11go build -a -ldflags="-w -s -extldflags '-static'" \
12    -trimpath \
13    -modcacherw \
14	-buildvcs=false \
15    ./cmd/senpai
16
17if command -v scdoc; then
18	scdoc < doc/senpai.1.scd > senpai.1
19	scdoc < doc/senpai.5.scd > senpai.5
20	
21	mkdir -p \
22		"$1/usr/share/man/man1" \
23		"$1/usr/share/man/man5"
24
25	cp senpai.1 "$1/usr/share/man/man1/"
26	cp senpai.5 "$1/usr/share/man/man5/"
27
28	# Compress manpages
29	find "$1/usr/share/man" -type f -exec gzip -n -9 {} +
30fi
31
32mkdir -p "$1/usr/bin"
33
34cp senpai "$1/usr/bin/"