blob: c054f42ee8bc2facbb0cced782379a55c6a3dadd (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
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
REAL_CURDIR := $(shell readlink "$(CURDIR)" || echo "$(CURDIR)")
GO_LDFLAGS := \
-X $(PACKAGE)/meta.Version=$(shell cat VERSION) \
-X $(PACKAGE)/meta.GitCommit=$(shell git rev-parse --short HEAD)
install:
# workaround bug in case CURDIR is a symlink
# see https://github.com/golang/go/issues/24359
cd "$(REAL_CURDIR)" && \
go install -v -ldflags "$(GO_LDFLAGS)"
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
|