diff --git a/Makefile b/Makefile index b34e921..45bc2d2 100644 --- a/Makefile +++ b/Makefile @@ -39,10 +39,11 @@ lint: @golint ./cmd/jira all: - GO111MODULE=off $(GO) get -u src.techknowlogick.com/xgo + GO111MODULE=off $(GO) get -u github.com/mitchellh/gox rm -rf dist mkdir -p dist - xgo --targets="freebsd/amd64,linux/386,linux/amd64,windows/386,windows/amd64,darwin/amd64" -dest ./dist -ldflags="-w -s" ./cmd/jira + gox -ldflags="-w -s" -output="dist/github.com/go-jira/jira-{{.OS}}-{{.Arch}}" -osarch="darwin/amd64 linux/386 linux/amd64 windows/386 windows/amd64" ./... + _t/test_binaries.sh install: ${MAKE} GOBIN=$$HOME/bin build diff --git a/_t/test_binaries.sh b/_t/test_binaries.sh new file mode 100755 index 0000000..3b37e33 --- /dev/null +++ b/_t/test_binaries.sh @@ -0,0 +1,40 @@ +#!/bin/bash + +#dist/github.com/go-jira/jira-darwin-amd64 dist/github.com/go-jira/jira-linux-amd64 dist/github.com/go-jira/jira-windows-amd64.exe +#dist/github.com/go-jira/jira-linux-386 dist/github.com/go-jira/jira-windows-386.exe + +EXIT_CODE=0 + +function error() { + echo $1 + EXIT_CODE=1 +} + +DIST_DIR="dist/github.com/go-jira" + +out=`file ${DIST_DIR}/jira-darwin-amd64 2>&1` +if ! [[ "$out" =~ "Mach-O 64-bit executable x86_64" ]]; then + error "darwin/amd64 build not as expected: $out" +fi + +out=`file ${DIST_DIR}/jira-linux-amd64 2>&1` +if ! [[ "$out" =~ "ELF 64-bit LSB executable, x86-64" ]]; then + error "linux/amd64 build not as expected: $out" +fi + +out=`file ${DIST_DIR}/jira-linux-386 2>&1` +if ! [[ "$out" =~ "ELF 32-bit LSB executable, Intel 80386" ]]; then + error "linux/i386 build not as expected: $out" +fi + +out=`file ${DIST_DIR}/jira-windows-amd64.exe 2>&1` +if ! [[ "$out" =~ "PE32+ executable (console) x86-64" ]]; then + error "windows/amd64 build not as expected: $out" +fi + +out=`file ${DIST_DIR}/jira-windows-386.exe 2>&1` +if ! [[ "$out" =~ "PE32 executable (console) Intel 80386" ]]; then + error "windows/i386 build not as expected: $out" +fi + +exit $EXIT_CODE