mirror of
https://github.com/amitbet/vncproxy.git
synced 2025-09-01 13:19:09 +00:00
a better build script
This commit is contained in:
52
build.sh
52
build.sh
@@ -1,4 +1,48 @@
|
|||||||
export GOOS="darwin"
|
#!/bin/bash
|
||||||
go build -o ./dist/recorder ./recorder/cmd
|
sum="sha1sum"
|
||||||
go build -o ./dist/player ./player/cmd
|
|
||||||
go build -o ./dist/proxy ./proxy/cmd
|
# VERSION=`date -u +%Y%m%d`
|
||||||
|
VERSION="v1.0"
|
||||||
|
LDFLAGS="-X main.VERSION=$VERSION -s -w"
|
||||||
|
GCFLAGS=""
|
||||||
|
|
||||||
|
if ! hash sha1sum 2>/dev/null; then
|
||||||
|
if ! hash shasum 2>/dev/null; then
|
||||||
|
echo "I can't see 'sha1sum' or 'shasum'"
|
||||||
|
echo "Please install one of them!"
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
sum="shasum"
|
||||||
|
fi
|
||||||
|
|
||||||
|
UPX=false
|
||||||
|
if hash upx 2>/dev/null; then
|
||||||
|
UPX=true
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
OSES=(linux darwin windows freebsd)
|
||||||
|
ARCHS=(amd64 386)
|
||||||
|
for os in ${OSES[@]}; do
|
||||||
|
for arch in ${ARCHS[@]}; do
|
||||||
|
suffix=""
|
||||||
|
if [ "$os" == "windows" ]
|
||||||
|
then
|
||||||
|
suffix=".exe"
|
||||||
|
fi
|
||||||
|
|
||||||
|
env CGO_ENABLED=0 GOOS=$os GOARCH=$arch go build -ldflags "$LDFLAGS" -gcflags "$GCFLAGS" -o ./dist/${os}_${arch}/recorder${suffix} ./recorder/cmd
|
||||||
|
env CGO_ENABLED=0 GOOS=$os GOARCH=$arch go build -ldflags "$LDFLAGS" -gcflags "$GCFLAGS" -o ./dist/${os}_${arch}/player${suffix} ./player/cmd
|
||||||
|
env CGO_ENABLED=0 GOOS=$os GOARCH=$arch go build -ldflags "$LDFLAGS" -gcflags "$GCFLAGS" -o ./dist/${os}_${arch}/proxy${suffix} ./proxy/cmd
|
||||||
|
|
||||||
|
if $UPX; then upx -9 client_${os}_${arch}${suffix} server_${os}_${arch}${suffix};fi
|
||||||
|
# tar -zcf ./dist/vncproxy-${os}-${arch}-$VERSION.tar.gz ./dist/${os}_${arch}/proxy${suffix} ./dist/${os}_${arch}/player${suffix} ./dist/${os}_${arch}/recorder${suffix}
|
||||||
|
cd dist/${os}_${arch}/
|
||||||
|
zip -D -q -r ../vncproxy-${os}-${arch}-$VERSION.zip proxy${suffix} player${suffix} recorder${suffix}
|
||||||
|
cd ../..
|
||||||
|
$sum ./dist/vncproxy-${os}-${arch}-$VERSION.zip
|
||||||
|
done
|
||||||
|
done
|
||||||
|
Reference in New Issue
Block a user