mirror of https://github.com/tidwall/tile38.git
package builder
This commit is contained in:
parent
c0836dd1ac
commit
9060ed68d6
|
@ -2,4 +2,5 @@
|
|||
tile38-*
|
||||
!cmd/tile38-*
|
||||
data*/
|
||||
coverage.out
|
||||
coverage.out
|
||||
packages/
|
2
Makefile
2
Makefile
|
@ -13,3 +13,5 @@ install: all
|
|||
uninstall:
|
||||
rm -f /usr/local/bin/tile38-server
|
||||
rm -f /usr/local/bin/tile38-cli
|
||||
package:
|
||||
@./build.sh package
|
30
build.sh
30
build.sh
|
@ -70,6 +70,33 @@ export GO15VENDOREXPERIMENT=1
|
|||
cd $(dirname "${BASH_SOURCE[0]}")
|
||||
OD="$(pwd)"
|
||||
|
||||
package(){
|
||||
echo Packaging $1 Binary
|
||||
bdir=tile38-v${VERSION}-$2-$3
|
||||
rm -rf packages/$bdir && mkdir -p packages/$bdir
|
||||
GOOS=$2 GOARCH=$3 ./build.sh
|
||||
mv tile38-server packages/$bdir
|
||||
mv tile38-cli packages/$bdir
|
||||
cp README.md packages/$bdir
|
||||
cd packages
|
||||
if [ "$2" == "linux" ]; then
|
||||
tar -zcf $bdir.tar.gz $bdir
|
||||
else
|
||||
zip -r -q $bdir.zip $bdir
|
||||
fi
|
||||
rm -rf $bdir
|
||||
cd ..
|
||||
}
|
||||
|
||||
if [ "$1" == "package" ]; then
|
||||
rm -rf packages/
|
||||
package "Windows" "windows" "amd64"
|
||||
package "Mac" "darwin" "amd64"
|
||||
package "Linux" "linux" "amd64"
|
||||
exit
|
||||
fi
|
||||
|
||||
|
||||
# temp directory for storing isolated environment.
|
||||
TMP="$(mktemp -d -t tile38.XXXX)"
|
||||
function rmtemp {
|
||||
|
@ -91,8 +118,6 @@ if [ "$NOCOPY" != "1" ]; then
|
|||
cd $WD
|
||||
fi
|
||||
|
||||
#core/gen.sh
|
||||
|
||||
# build and store objects into original directory.
|
||||
go build -ldflags "$LDFLAGS" -o "$OD/tile38-server" cmd/tile38-server/*.go
|
||||
go build -ldflags "$LDFLAGS" -o "$OD/tile38-cli" cmd/tile38-cli/*.go
|
||||
|
@ -119,3 +144,4 @@ if [ "$1" == "cover" ]; then
|
|||
go test -cover $(go list ./... | grep -v /vendor/)
|
||||
fi
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue