Skip to content

Commit

Permalink
fix build for windows
Browse files Browse the repository at this point in the history
  • Loading branch information
coryb committed Sep 6, 2017
1 parent 6719e92 commit 1b854da
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 39 deletions.
46 changes: 9 additions & 37 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -33,21 +33,10 @@ DIST=$(CWD)$(SEP)dist
GOBIN ?= $(CWD)

CURVER ?= $(patsubst v%,%,$(shell [ -d .git ] && git describe --abbrev=0 --tags || grep ^\#\# CHANGELOG.md | awk '{print $$2; exit}'))
LDFLAGS:=-X jira.VERSION=$(CURVER) -w

# use make DEBUG=1 and you can get a debuggable golang binary
# see https://github.com/mailgun/godebug
ifneq ($(DEBUG),)
GOBUILD=go get -v github.com/mailgun/godebug &&
else
GOBUILD=go build -gcflags="-e -complete" -v -ldflags "$(LDFLAGS) -s"
endif
LDFLAGS:= -w

build:
$(GOBUILD) -o '$(BIN)' cmd/jira/main.go

debug:
go build -v -o '$(BIN)' cmd/jira/main.go
go build -gcflags="-e -complete" -v -ldflags "$(LDFLAGS) -s" -o '$(BIN)' cmd/jira/main.go

vet:
@go vet .
Expand All @@ -64,33 +53,11 @@ lint:
@golint ./jiradata
@golint ./cmd/jira

cross-setup:
for p in $(PLATFORMS); do \
echo Building for $$p"; \
cd $(GOROOT)/src && sudo GOROOT_BOOTSTRAP=$(GOROOT) GOOS=$${p/-*/} GOARCH=$${p/*-/} bash ./make.bash --no-clean; \
done

all:
git push --tags
rm -rf src
${MAKE} src/gopkg.in/Netflix-Skunkworks/go-jira.v0
docker pull karalabe/xgo-latest
rm -rf dist
mkdir -p dist
docker run --rm -e EXT_GOPATH=/gopath -v $$(pwd):/gopath -e TARGETS="$(PLATFORMS)" -v $$(pwd)/dist:/build karalabe/xgo-latest gopkg.in/Netflix-Skunkworks/go-jira.v0/main
cd $(DIST) && for x in main-*; do mv $$x jira-$$(echo $$x | cut -c 6-); done

# all:
# rm -rf $(DIST); \
# mkdir -p $(DIST); \
# for p in $(PLATFORMS); do \
# echo "Building for $$p"; \
# ${MAKE} build GOOS=$${p/-*/} GOARCH=$${p/*-/} BIN=$(DIST)/$(NAME)-$$p; \
# done
# for x in $(DIST)/jira-windows-*; do mv $$x $$x.exe; done

fmt:
gofmt -s -w main/*.go *.go
docker run --rm -e EXT_GOPATH=/gopath -v $$(pwd):/gopath/src/gopkg.in/Netflix-Skunkworks/go-jira.v1 -e TARGETS="$(PLATFORMS)" -v $$(pwd)/dist:/build karalabe/xgo-latest gopkg.in/Netflix-Skunkworks/go-jira.v1/cmd/jira

install:
${MAKE} GOBIN=$$HOME/bin build
Expand All @@ -99,7 +66,7 @@ NEWVER ?= $(shell echo $(CURVER) | awk -F. '{print $$1"."$$2"."$$3+1}')
TODAY := $(shell date +%Y-%m-%d)

changes:
@git log --pretty=format:"* %s [%cn] [%h]" --no-merges ^v$(CURVER) HEAD main/*.go *.go | grep -vE 'gofmt|go fmt'
@git log --pretty=format:"* %s [%cn] [%h]" --no-merges ^v$(CURVER) HEAD *.go jiracli/*.go jiradata/*.go jiracmd/*.go cmd/*/*.go | grep -vE 'gofmt|go fmt'

update-changelog:
@echo "# Changelog" > CHANGELOG.md.new; \
Expand All @@ -110,9 +77,14 @@ update-changelog:
perl -pe 's{\[([a-f0-9]+)\]}{[[$$1](https://github.com/Netflix-Skunkworks/go-jira/commit/$$1)]}g' | \
perl -pe 's{\#(\d+)}{[#$$1](https://github.com/Netflix-Skunkworks/go-jira/issues/$$1)}g' >> CHANGELOG.md.new; \
tail -n +2 CHANGELOG.md >> CHANGELOG.md.new; \
perl -pi -e 's{VERSION = "$(CURVER)"}{VERSION = "$(NEWVER)"}' jira.go; \
mv CHANGELOG.md.new CHANGELOG.md; \
$(NULL)

release:
git commit -m "Updated Changelog" CHANGELOG.md; \
git tag v$(NEWVER)
git push --tags

version:
@echo $(CURVER)
Expand Down
3 changes: 1 addition & 2 deletions jiracli/templates.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import (
"reflect"
"strconv"
"strings"
"syscall"
"text/template"

"github.com/mgutz/ansi"
Expand Down Expand Up @@ -69,7 +68,7 @@ func TemplateProcessor() *template.Template {
return string(bytes), nil
},
"termWidth": func() int {
w, _, err := terminal.GetSize(syscall.Stdout)
w, _, err := terminal.GetSize(int(os.Stdin.Fd()))
if err == nil {
return w
}
Expand Down

0 comments on commit 1b854da

Please sign in to comment.