|
|
@ -18,6 +18,7 @@ GOARCH=amd64 |
|
|
|
FOLDER=/${WHOAMI:-$USER} |
|
|
|
FOLDER=/${WHOAMI:-$USER} |
|
|
|
RACE= |
|
|
|
RACE= |
|
|
|
VERBOSE= |
|
|
|
VERBOSE= |
|
|
|
|
|
|
|
GO_GCFLAGS="all=-c 2" |
|
|
|
DEBUG=false |
|
|
|
DEBUG=false |
|
|
|
NETWORK=main |
|
|
|
NETWORK=main |
|
|
|
STATIC=false |
|
|
|
STATIC=false |
|
|
@ -102,6 +103,7 @@ function build_only |
|
|
|
BUILTBY=${USER}@ |
|
|
|
BUILTBY=${USER}@ |
|
|
|
local build=$1 |
|
|
|
local build=$1 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
set_gcflags |
|
|
|
set -e |
|
|
|
set -e |
|
|
|
|
|
|
|
|
|
|
|
for bin in "${!SRC[@]}"; do |
|
|
|
for bin in "${!SRC[@]}"; do |
|
|
@ -109,12 +111,12 @@ function build_only |
|
|
|
rm -f $BINDIR/$bin |
|
|
|
rm -f $BINDIR/$bin |
|
|
|
echo "building ${SRC[$bin]}" |
|
|
|
echo "building ${SRC[$bin]}" |
|
|
|
if [ "$DEBUG" == "true" ]; then |
|
|
|
if [ "$DEBUG" == "true" ]; then |
|
|
|
env GOOS=$GOOS GOARCH=$GOARCH go build $VERBOSE -gcflags="all=-N -l -c 2" -ldflags="-X main.version=v${VERSION} -X main.commit=${COMMIT} -X main.builtAt=${BUILTAT} -X main.builtBy=${BUILTBY}" -o $BINDIR/$bin $RACE ${SRC[$bin]} |
|
|
|
env GOOS=$GOOS GOARCH=$GOARCH go build $VERBOSE -gcflags="${GO_GCFLAGS}" -ldflags="-X main.version=v${VERSION} -X main.commit=${COMMIT} -X main.builtAt=${BUILTAT} -X main.builtBy=${BUILTBY}" -o $BINDIR/$bin $RACE ${SRC[$bin]} |
|
|
|
else |
|
|
|
else |
|
|
|
if [ "$STATIC" == "true" ]; then |
|
|
|
if [ "$STATIC" == "true" ]; then |
|
|
|
env GOOS=$GOOS GOARCH=$GOARCH go build $VERBOSE -gcflags="all=-c 2" -ldflags="-X main.version=v${VERSION} -X main.commit=${COMMIT} -X main.builtAt=${BUILTAT} -X main.builtBy=${BUILTBY} -w -extldflags \"-static -lm\"" -o $BINDIR/$bin $RACE ${SRC[$bin]} |
|
|
|
env GOOS=$GOOS GOARCH=$GOARCH go build $VERBOSE -gcflags="${GO_GCFLAGS}" -ldflags="-X main.version=v${VERSION} -X main.commit=${COMMIT} -X main.builtAt=${BUILTAT} -X main.builtBy=${BUILTBY} -w -extldflags \"-static -lm\"" -o $BINDIR/$bin $RACE ${SRC[$bin]} |
|
|
|
else |
|
|
|
else |
|
|
|
env GOOS=$GOOS GOARCH=$GOARCH go build $VERBOSE -gcflags="all=-c 2" -ldflags="-X main.version=v${VERSION} -X main.commit=${COMMIT} -X main.builtAt=${BUILTAT} -X main.builtBy=${BUILTBY}" -o $BINDIR/$bin $RACE ${SRC[$bin]} |
|
|
|
env GOOS=$GOOS GOARCH=$GOARCH go build $VERBOSE -gcflags="${GO_GCFLAGS}" -ldflags="-X main.version=v${VERSION} -X main.commit=${COMMIT} -X main.builtAt=${BUILTAT} -X main.builtBy=${BUILTBY}" -o $BINDIR/$bin $RACE ${SRC[$bin]} |
|
|
|
fi |
|
|
|
fi |
|
|
|
fi |
|
|
|
fi |
|
|
|
if [ "$(uname -s)" == "Linux" ]; then |
|
|
|
if [ "$(uname -s)" == "Linux" ]; then |
|
|
@ -145,6 +147,21 @@ function build_only |
|
|
|
popd |
|
|
|
popd |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function set_gcflags |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if [[ ! -z "$RACE" ]]; then |
|
|
|
|
|
|
|
if [ "$DEBUG" == "true" ]; then |
|
|
|
|
|
|
|
GO_GCFLAGS="all=-N -l" |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
GO_GCFLAGS="" |
|
|
|
|
|
|
|
fi |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
if [ "$DEBUG" == "true" ]; then |
|
|
|
|
|
|
|
GO_GCFLAGS="all=-N -l -c 2" |
|
|
|
|
|
|
|
fi |
|
|
|
|
|
|
|
fi |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function upload |
|
|
|
function upload |
|
|
|
{ |
|
|
|
{ |
|
|
|
AWSCLI=aws |
|
|
|
AWSCLI=aws |
|
|
@ -249,7 +266,7 @@ function upload_wallet |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
################################ MAIN FUNCTION ############################## |
|
|
|
################################ MAIN FUNCTION ############################## |
|
|
|
while getopts "hp:a:o:b:f:rvsN:" option; do |
|
|
|
while getopts "hp:a:o:b:f:rvsdN:" option; do |
|
|
|
case $option in |
|
|
|
case $option in |
|
|
|
h) usage ;; |
|
|
|
h) usage ;; |
|
|
|
p) PROFILE=$OPTARG ;; |
|
|
|
p) PROFILE=$OPTARG ;; |
|
|
|