summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTyler Cipriani <tcipriani@wikimedia.org>2018-05-24 11:46:02 -0600
committerTyler Cipriani <tcipriani@wikimedia.org>2018-05-24 12:15:05 -0600
commitb0e3e7d8a55f1fd77625880853c156811ff007dc (patch)
treeefb7955f0bfeaeb30ceba7681aaca3f188591fa8
parent798f96381057f4b2ebf4ba08852da8d976c62502 (diff)
downloadblubber-b0e3e7d8a55f1fd77625880853c156811ff007dc.tar.gz
Cross-compile using gox
Reviewers: dduvall, #release-engineering-team Reviewed By: dduvall, #release-engineering-team Tags: #release-engineering-team Differential Revision: https://phabricator.wikimedia.org/D1059
-rw-r--r--.gitignore1
-rw-r--r--CONTRIBUTING.md9
-rw-r--r--Makefile12
3 files changed, 21 insertions, 1 deletions
diff --git a/.gitignore b/.gitignore
index c0899c9..483f344 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,3 +2,4 @@
/bin
/blubber
/blubber.git
+/_release
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 8e08cc1..d9c2d8f 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -25,6 +25,8 @@ to both users inside and outside of WMF and our communities.
4. An account at [phabricator.wikimedia.org](https://phabricator.wikimedia.org)
* See our [help article](https://www.mediawiki.org/wiki/Phabricator/Help)
for setup instructions.
+ 5. (optional) `gox` is used for cross-compiling binary releases. To
+ install `gox` use `go get github.com/mitchellh/gox`.
## Get the source
@@ -92,3 +94,10 @@ Use `arc diff` to submit your changes to Differential.
Once your changes have been accepted, run `arc land` on your local branch to
merge/push the commit and close the diff.
+
+## Releases
+
+The `release` target of the `Makefile` in this repository uses `gox` to
+cross-compile binary releases of Blubber.
+
+ make release
diff --git a/Makefile b/Makefile
index cb06b90..9a73549 100644
--- a/Makefile
+++ b/Makefile
@@ -1,3 +1,6 @@
+RELEASE_DIR ?= ./_release
+TARGETS ?= darwin/amd64 linux/amd64 linux/386 linux/arm linux/arm64 linux/ppc64le windows/amd64 plan9/amd64
+
PACKAGE := phabricator.wikimedia.org/source/blubber
GO_LDFLAGS := \
@@ -7,4 +10,11 @@ GO_LDFLAGS := \
install:
go install -v -ldflags "$(GO_LDFLAGS)"
-.PHONY: install
+release:
+ gox -output="$(RELEASE_DIR)/{{.OS}}-{{.Arch}}/{{.Dir}}" -osarch='$(TARGETS)' -ldflags '$(GO_LDFLAGS)' $(PACKAGE)
+ cp LICENSE "$(RELEASE_DIR)"
+ for f in "$(RELEASE_DIR)"/*/blubber; do \
+ shasum -a 256 "$${f}" | awk '{print $$1}' > "$${f}.sha256"; \
+ done
+
+.PHONY: install release