2020-09-02 10:54:03 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
TARGET=mqttListener
|
|
|
|
|
2020-09-02 18:02:40 +02:00
|
|
|
export PATH=$PATH:~/go/bin
|
2020-09-02 10:54:03 +02:00
|
|
|
|
|
|
|
|
2020-09-02 18:02:40 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
RED='\e[0;31m'
|
|
|
|
GREEN='\e[0;32m'
|
|
|
|
LIGHT_YELLOW='\e[93m'
|
|
|
|
NC='\e[0m' # No Color
|
|
|
|
BOLD='\e[1m'
|
|
|
|
NORMAL='\e[21m'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#######################################################################################
|
|
|
|
# functions
|
|
|
|
|
|
|
|
die() { echo -e "\n${RED}$@${NC}" 1>&2 ; exit 1; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#######################################################################################
|
|
|
|
|
2020-09-02 10:54:03 +02:00
|
|
|
#cd /src
|
|
|
|
|
2020-09-02 18:02:40 +02:00
|
|
|
if ! command -v govvv &> /dev/null ; then
|
|
|
|
die "govv is not installed"
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#######################################################################################
|
|
|
|
# build
|
|
|
|
echo -e "${NC}\n "
|
|
|
|
|
|
|
|
echo -e "\nBuilding for Linux 64-bit:"
|
|
|
|
env GOOS=linux GOARCH=amd64 go build -a -v -ldflags "$(govvv -flags)" -o ${TARGET}-linux-amd64
|
|
|
|
echo -e "\t\t${GREEN}... done${NC}"
|
2020-09-02 10:54:03 +02:00
|
|
|
|
|
|
|
|
2020-09-02 18:02:40 +02:00
|
|
|
echo -e "\nBuilding for arm:"
|
|
|
|
env GOOS=linux GOARCH=arm go build -a -v -ldflags "$(govvv -flags)" -o ${TARGET}-linux-arm
|
|
|
|
echo -e "\t\t${GREEN}... done${NC}"
|
2020-09-02 10:54:03 +02:00
|
|
|
|
2020-09-02 18:02:40 +02:00
|
|
|
echo -e "\nstipping arm binary:"
|
|
|
|
strip -o ${TARGET}-linux-arm-stripped ${TARGET}-linux-arm
|
|
|
|
echo -e "\t\t${GREEN}... done${NC}"
|