mirror of
https://github.com/gogrlx/nats-server.git
synced 2026-04-13 09:47:59 -07:00
We are using the tool from https://github.com/mitchellh/gox for cross compilation. When we issue a new release, we create a tag and trigger Travis build which will then invoke the script and upload the files to GH. We were affected by https://github.com/mitchellh/gox/issues/55 Invoking the script on a Linux amd64 would produce this: file pkg/gnatsd-linux-amd64/gnatsd pkg/gnatsd-linux-amd64/gnatsd: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, stripped With the fix, you'll get this: file pkg/gnatsd-linux-amd64/gnatsd pkg/gnatsd-linux-amd64/gnatsd: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, stripped Resolves #470
22 lines
771 B
Bash
Executable File
22 lines
771 B
Bash
Executable File
#!/bin/bash
|
|
go get github.com/mitchellh/gox
|
|
go get github.com/tcnksm/ghr
|
|
|
|
export APPNAME="gnatsd"
|
|
export OSARCH="linux/386 linux/amd64 linux/arm darwin/amd64 windows/386 windows/amd64"
|
|
export DIRS="linux-386 linux-amd64 linux-arm darwin-amd64 windows-386 windows-amd64"
|
|
export OUTDIR="pkg"
|
|
|
|
# If we have an arg, assume its a version tag and rename as appropriate.
|
|
if [[ -n $1 ]]; then
|
|
export APPNAME=$APPNAME-$1
|
|
fi
|
|
|
|
env CGO_ENABLED=0 gox -osarch="$OSARCH" -ldflags="-s -w" -output "$OUTDIR/$APPNAME-{{.OS}}-{{.Arch}}/gnatsd"
|
|
for dir in $DIRS; do \
|
|
(cp README.md $OUTDIR/$APPNAME-$dir/README.md) ;\
|
|
(cp LICENSE $OUTDIR/$APPNAME-$dir/LICENSE) ;\
|
|
(cd $OUTDIR && zip -q $APPNAME-$dir.zip -r $APPNAME-$dir) ;\
|
|
echo "make $OUTDIR/$APPNAME-$dir.zip" ;\
|
|
done
|