44 lines
1.0 KiB
Plaintext
44 lines
1.0 KiB
Plaintext
|
#!/bin/bash
|
||
|
DIR=$(dirname "$(dirname "$(readlink -f "$0")")") || exit
|
||
|
BUILD_DIR=$DIR/build
|
||
|
export GOPATH=$BUILD_DIR
|
||
|
# set a specific release
|
||
|
REL=$1
|
||
|
PLUGINS=''
|
||
|
while IFS= read -r line; do
|
||
|
[ $line ] && echo Using Plugin: $line
|
||
|
PLUGINS=`[ $line ] && echo $PLUGINS' --with '$line`
|
||
|
done < $BUILD_DIR/plugins.txt
|
||
|
# reading builds file
|
||
|
cat $BUILD_DIR/builds.txt | while read GOOS GOARCH GOARM;
|
||
|
do
|
||
|
GOOS=${GOOS:-linux}
|
||
|
GOARCH=${GOARCH:-amd64}
|
||
|
BIN_NAME=$GOOS-$GOARCH`[ $GOARM ] && echo -$GOARM`
|
||
|
BIN_PATH=$DIR/bin/$BIN_NAME
|
||
|
echo deleting any old executable $BIN_NAME
|
||
|
[ -f $BIN_PATH ] && rm $BIN_PATH
|
||
|
echo Building binary $BIN_PATH
|
||
|
export GOOS=$GOOS
|
||
|
export GOARCH=$GOARCH
|
||
|
export CGO_ENABLED=1
|
||
|
[ $GOARM ] && export GOARM=$GOARM
|
||
|
echo GO environment before running xcaddy
|
||
|
go env
|
||
|
echo building with
|
||
|
CMD="
|
||
|
${BUILD_DIR}/bin/xcaddy
|
||
|
build
|
||
|
${REL}
|
||
|
--output ${BIN_PATH}
|
||
|
${PLUGINS}
|
||
|
"
|
||
|
echo ${CMD}
|
||
|
echo "$(eval ${CMD})"
|
||
|
echo ...done building
|
||
|
if [ -f $BIN_PATH ]; then
|
||
|
echo build successful at $BIN_PATH
|
||
|
echo run install script with -l option to use this binary
|
||
|
fi
|
||
|
done
|