uvc/build.sh

37 lines
598 B
Bash
Executable File

#! /bin/bash
function main() {
init
server
local name="$(gitname)"
pack "$name"
}
function init() {
set -e
cd "$(dirname "$BASH_SOURCE")"
}
function server() {
local f="./exec-server"
GOOS=linux CGO_ENABLED=0 go build -o "$f" -a -installsuffix cgo >&2
echo "$f"
}
function gitname() {
local name="$(git describe --tags)"
if [ -z "$name" ]; then
name="$(git rev-parse --abbrev-ref HEAD)"
fi
echo "$name"
}
function pack() {
tar -czf "$1.tar" "./exec-server" "./public"
echo "$1.tar"
}
if [ "$0" == "${BASH_SOURCE[0]}" ]; then
main "$@"
fi