summaryrefslogtreecommitdiff
path: root/build.sh
diff options
context:
space:
mode:
authorWolfy-J <[email protected]>2018-06-15 15:54:14 +0300
committerWolfy-J <[email protected]>2018-06-15 15:54:14 +0300
commitdfef39c64132192d13e2315364a74f1b0244791e (patch)
treeb0959bbbb1ca5a16d94646454d7f2e9340081915 /build.sh
parentccd297dbe2586b3fd29854f72f795be9e818522e (diff)
readme, samples, golint, build scripts
Diffstat (limited to 'build.sh')
-rwxr-xr-xbuild.sh50
1 files changed, 50 insertions, 0 deletions
diff --git a/build.sh b/build.sh
new file mode 100755
index 00000000..fd84fc79
--- /dev/null
+++ b/build.sh
@@ -0,0 +1,50 @@
+#!/bin/bash
+set -e
+
+cd $(dirname "${BASH_SOURCE[0]}")
+OD="$(pwd)"
+
+# Pushes application version into the build information.
+RR_VERSION=1.0.1
+
+# Hardcode some values to the core package
+LDFLAGS="$LDFLAGS -X github.com/spiral/roadrunner/cmd/rr/cmd.Version=${RR_VERSION}"
+LDFLAGS="$LDFLAGS -X github.com/spiral/roadrunner/cmd/rr/cmd.BuildTime=$(date +%FT%T%z)"
+
+build(){
+ echo Packaging $1 Build
+ bdir=roadrunner-${RR_VERSION}-$2-$3
+ rm -rf builds/$bdir && mkdir -p builds/$bdir
+ GOOS=$2 GOARCH=$3 ./build.sh
+
+ if [ "$2" == "windows" ]; then
+ mv rr builds/$bdir/rr.exe
+ else
+ mv rr builds/$bdir
+ fi
+
+ cp README.md builds/$bdir
+ cp CHANGELOG.md builds/$bdir
+ cp LICENSE builds/$bdir
+ cd builds
+
+ if [ "$2" == "linux" ]; then
+ tar -zcf $bdir.tar.gz $bdir
+ else
+ zip -r -q $bdir.zip $bdir
+ fi
+
+ rm -rf $bdir
+ cd ..
+}
+
+if [ "$1" == "all" ]; then
+ rm -rf builds/
+ build "Windows" "windows" "amd64"
+ build "Mac" "darwin" "amd64"
+ build "Linux" "linux" "amd64"
+ build "FreeBSD" "freebsd" "amd64"
+ exit
+fi
+
+CGO_ENABLED=0 go build -ldflags "$LDFLAGS -extldflags '-static'" -o "$OD/rr" cmd/rr/main.go \ No newline at end of file