mirror of
https://github.com/yggdrasil-network/yggdrasil-go.git
synced 2024-11-28 20:45:18 +00:00
Update build script
This commit is contained in:
parent
853054eb62
commit
750a79eb09
18
build
18
build
@ -7,24 +7,26 @@ PKGNAME=${PKGNAME:-$(sh contrib/semver/name.sh)}
|
|||||||
PKGVER=${PKGVER:-$(sh contrib/semver/version.sh --bare)}
|
PKGVER=${PKGVER:-$(sh contrib/semver/version.sh --bare)}
|
||||||
|
|
||||||
LDFLAGS="-X $PKGSRC.buildName=$PKGNAME -X $PKGSRC.buildVersion=$PKGVER"
|
LDFLAGS="-X $PKGSRC.buildName=$PKGNAME -X $PKGSRC.buildVersion=$PKGVER"
|
||||||
|
ARGS="-v"
|
||||||
|
|
||||||
while getopts "udaitc:l:r" option
|
while getopts "uaitc:l:dro:" option
|
||||||
do
|
do
|
||||||
case "${option}"
|
case "$option"
|
||||||
in
|
in
|
||||||
u) UPX=true;;
|
u) UPX=true;;
|
||||||
d) DEBUG=true;;
|
|
||||||
i) IOS=true;;
|
i) IOS=true;;
|
||||||
a) ANDROID=true;;
|
a) ANDROID=true;;
|
||||||
t) TABLES=true;;
|
t) TABLES=true;;
|
||||||
c) GCFLAGS="$GCFLAGS $OPTARG";;
|
c) GCFLAGS="$GCFLAGS $OPTARG";;
|
||||||
l) LDFLAGS="$LDFLAGS $OPTARG";;
|
l) LDFLAGS="$LDFLAGS $OPTARG";;
|
||||||
r) RACE="-race";;
|
d) ARGS="$ARGS -tags debug";;
|
||||||
|
r) ARGS="$ARGS -race";;
|
||||||
|
o) ARGS="$ARGS -o $OPTARG";;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
if [ -z $TABLES ]; then
|
if [ -z $TABLES ]; then
|
||||||
STRIP="-s -w"
|
LDFLAGS="$LDFLAGS -s -w"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $IOS ]; then
|
if [ $IOS ]; then
|
||||||
@ -42,12 +44,8 @@ elif [ $ANDROID ]; then
|
|||||||
else
|
else
|
||||||
for CMD in `ls cmd/` ; do
|
for CMD in `ls cmd/` ; do
|
||||||
echo "Building: $CMD"
|
echo "Building: $CMD"
|
||||||
|
go build $ARGS -ldflags="$LDFLAGS" -gcflags="$GCFLAGS" ./cmd/$CMD
|
||||||
|
|
||||||
if [ $DEBUG ]; then
|
|
||||||
go build $RACE -ldflags="$LDFLAGS" -gcflags="$GCFLAGS" -tags debug -v ./cmd/$CMD
|
|
||||||
else
|
|
||||||
go build $RACE -ldflags="$LDFLAGS $STRIP" -gcflags="$GCFLAGS" -v ./cmd/$CMD
|
|
||||||
fi
|
|
||||||
if [ $UPX ]; then
|
if [ $UPX ]; then
|
||||||
upx --brute $CMD
|
upx --brute $CMD
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user