Skip to content

Commit

Permalink
Release build now uses its own GOROOT/GOPATH so it doesnt mess with y…
Browse files Browse the repository at this point in the history
…our system go
  • Loading branch information
joewalnes committed Mar 15, 2013
1 parent dea4df4 commit 1f0e543
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 9 deletions.
3 changes: 3 additions & 0 deletions release/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
bin
go-local
out
go-path
websocketd.exe
23 changes: 14 additions & 9 deletions release/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,16 @@ GO_DIR=go-local/$(GO_VERSION)
GO_UNPACKED=$(GO_DIR)/.unpacked

# Prevent any global environment polluting the builds
GOROOT=
GOROOT=$(shell readlink -f $(GO_DIR))/go
GOPATH=$(shell readlink -f go-path)

FLAGS_linux_amd64 = GOOS=linux GOARCH=amd64
FLAGS_linux_386 = GOOS=linux GOARCH=386
FLAGS_linux_arm = GOOS=linux GOARCH=arm GOARM=5 # ARM5 support for Raspberry Pi
FLAGS_darwin_amd64 = GOOS=darwin GOARCH=amd64 CGO_ENABLED=0
FLAGS_windows_386 = GOOS=windows GOARCH=386 CGO_ENABLED=0
FLAGS_windows_amd64 = GOOS=windows GOARCH=amd64 CGO_ENABLED=0
FLAGS_all = GOROOT=$(GOROOT) GOPATH=$(GOPATH)
FLAGS_linux_amd64 = $(FLAGS_all) GOOS=linux GOARCH=amd64
FLAGS_linux_386 = $(FLAGS_all) GOOS=linux GOARCH=386
FLAGS_linux_arm = $(FLAGS_all) GOOS=linux GOARCH=arm GOARM=5 # ARM5 support for Raspberry Pi
FLAGS_darwin_amd64 = $(FLAGS_all) GOOS=darwin GOARCH=amd64 CGO_ENABLED=0
FLAGS_windows_386 = $(FLAGS_all) GOOS=windows GOARCH=386 CGO_ENABLED=0
FLAGS_windows_amd64 = $(FLAGS_all) GOOS=windows GOARCH=amd64 CGO_ENABLED=0

EXTENSION_windows_386=.exe
EXTENSION_windows_amd64=.exe
Expand All @@ -30,6 +32,9 @@ EXTENSION_windows_amd64=.exe
all: apps
.PHONY: all

go-path/src/github.com/joewalnes/websocketd:
mkdir -p go-path/src/github.com/joewalnes
ln -s ../../../../../ go-path/src/github.com/joewalnes/websocketd

# Download Go source code
$(GO_DOWNLOAD):
Expand Down Expand Up @@ -63,10 +68,10 @@ go-compile: $(foreach PLATFORM,$(PLATFORMS),$(GO_DIR)/go/pkg/$(PLATFORM)/.built)


# Cross-compile final applications
out/$(RELEASE_VERSION)/%/.built: $(GO_DIR)/go/pkg/%/.built $(wildcard ../*.go)
out/$(RELEASE_VERSION)/%/.built: $(GO_DIR)/go/pkg/%/.built $(wildcard ../*.go) go-path/src/github.com/joewalnes/websocketd
rm -f $@
mkdir -p $(dir $@)
$(FLAGS_$*) $(GO_DIR)/go/bin/go get ..
$(FLAGS_$*) $(GO_DIR)/go/bin/go get ./go-path/src/github.com/joewalnes/websocketd
$(FLAGS_$*) $(GO_DIR)/go/bin/go build -ldflags "-X main.version $(RELEASE_VERSION)" -o out/$(RELEASE_VERSION)/$*/websocketd$(EXTENSION_$*) $(wildcard ../*.go)
touch $@

Expand Down

0 comments on commit 1f0e543

Please sign in to comment.