2022-03-23 10:36:24 +08:00
|
|
|
#!/bin/bash
|
|
|
|
# build hrp cli binary for testing
|
|
|
|
# release will be triggered on github actions, see .github/workflows/release.yml
|
|
|
|
|
|
|
|
# Usage:
|
|
|
|
# $ make build
|
2022-10-12 20:25:02 +08:00
|
|
|
# $ make build tags=opencv
|
2022-03-23 10:36:24 +08:00
|
|
|
# or
|
2022-09-21 17:50:08 +08:00
|
|
|
# $ bash scripts/build.sh
|
2022-10-12 20:25:02 +08:00
|
|
|
# $ bash scripts/build.sh opencv
|
2022-03-23 10:36:24 +08:00
|
|
|
|
|
|
|
set -e
|
|
|
|
set -x
|
|
|
|
|
|
|
|
# prepare path
|
|
|
|
mkdir -p "output"
|
|
|
|
bin_path="output/hrp"
|
|
|
|
|
2022-10-12 20:25:02 +08:00
|
|
|
# optional build tags: opencv
|
2022-09-21 17:50:08 +08:00
|
|
|
tags=$1
|
|
|
|
|
|
|
|
# build
|
|
|
|
if [ -z "$tags" ]; then
|
|
|
|
go build -ldflags '-s -w' -o "$bin_path" hrp/cmd/cli/main.go
|
|
|
|
else
|
|
|
|
go build -ldflags '-s -w' -tags "$tags" -o "$bin_path" hrp/cmd/cli/main.go
|
|
|
|
fi
|
2022-03-23 10:36:24 +08:00
|
|
|
|
|
|
|
# check output and version
|
|
|
|
ls -lh "$bin_path"
|
|
|
|
chmod +x "$bin_path"
|
|
|
|
./"$bin_path" -v
|