-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathbuild.sh
executable file
·44 lines (41 loc) · 1 KB
/
build.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/bin/bash
cd `dirname $0`
BASEDIR=`pwd`
set -ex
VERSION=0.0.0
BUILD_DIR=$BASEDIR/build
PACKAGES_DIR=$BUILD_DIR/packages
build () {
platform=$1
bdir=$BUILD_DIR/gokestrel.$platform
name=gokestrel.$platform #.`date +%Y%m%d`
mkdir -p $bdir
rm -rf $bdir/*
# cp commands/* $bdir/
if [[ "$platform" == mswin* ]]; then
ext=".exe"
else
ext=""
fi
output=kestrel$ext
go build -ldflags="-X 'main.Version=v$VERSION'" -o $bdir/$output ./cmd/gokestrel
cd $bdir
if [[ "$platform" == mswin* ]]; then
zip -r $name.zip *
cp $name.zip $PACKAGES_DIR
else
tar czvf $name.tgz *
cp $name.tgz $PACKAGES_DIR
fi
cd -
}
mkdir -p $PACKAGES_DIR
rm -rf $PACKAGES_DIR/*
GOOS=darwin GOARCH=amd64 build macos64
GOOS=windows GOARCH=386 build mswin32
GOOS=windows GOARCH=amd64 build mswin64
GOOS=linux GOARCH=386 build linux-intel32
GOOS=linux GOARCH=amd64 build linux-intel64
GOOS=linux GOARCH=arm64 build linux-arm64
GOOS=linux GOARCH=ppc64le build linux-ppc64le
find build