From b8c4b35415a096d245272556be5231f071404365 Mon Sep 17 00:00:00 2001 From: Junegunn Choi Date: Tue, 13 Jan 2015 12:29:12 +0900 Subject: [PATCH] `make archive` for homebrew release --- install | 5 +++-- src/Makefile | 19 ++++++++++++++++--- src/README.md | 3 +++ 3 files changed, 22 insertions(+), 5 deletions(-) diff --git a/install b/install index 4098c87..c61cf88 100755 --- a/install +++ b/install @@ -21,8 +21,9 @@ check_binary() { symlink() { echo " - Creating symlink: bin/$1 -> bin/fzf" - rm -f "$fzf_base"/bin/fzf - ln -sf "$fzf_base"/bin/$1 "$fzf_base"/bin/fzf + (cd "$fzf_base"/bin && + rm -f fzf + ln -sf $1 fzf) } download() { diff --git a/src/Makefile b/src/Makefile index 43a7bc0..2758164 100644 --- a/src/Makefile +++ b/src/Makefile @@ -18,11 +18,24 @@ BINDIR := ../bin BINARY32 := fzf-$(GOOS)_386 BINARY64 := fzf-$(GOOS)_amd64 -RELEASE32 = fzf-$(shell fzf/$(BINARY64) --version)-$(GOOS)_386 -RELEASE64 = fzf-$(shell fzf/$(BINARY64) --version)-$(GOOS)_amd64 +VERSION = $(shell fzf/$(BINARY64) --version) +RELEASE32 = fzf-$(VERSION)-$(GOOS)_386 +RELEASE64 = fzf-$(VERSION)-$(GOOS)_amd64 +ARCHIVE64 = fzf-$(VERSION)-$(GOOS)_amd64-archive all: test release +archive: ../$(ARCHIVE64).tar.gz + +../$(ARCHIVE64).tar.gz: release + cd ../ && yes | ./install && \ + git archive HEAD --output=$(ARCHIVE64).tar --prefix fzf-$(VERSION)/ && \ + rm -rf fzf-$(VERSION)/bin && mkdir -p fzf-$(VERSION)/bin && \ + cp -a bin/* fzf-$(VERSION)/bin/ && \ + tar --append --file $(ARCHIVE64).tar fzf-$(VERSION)/bin/* && \ + gzip -f $(ARCHIVE64).tar && rm -rf fzf-$(VERSION) && \ + openssl sha1 $(notdir $@) + release: build cd fzf && \ cp $(BINARY32) $(RELEASE32) && tar -czf $(RELEASE32).tgz $(RELEASE32) && \ @@ -70,4 +83,4 @@ $(DISTRO): docker docker run -i -t -v $(GOPATH):/go junegunn/$(DISTRO)-sandbox \ sh -c 'cd /go/src/github.com/junegunn/fzf/src; /bin/bash' -.PHONY: all build release test install uninstall clean docker linux $(DISTRO) +.PHONY: all archive build release test install uninstall clean docker linux $(DISTRO) diff --git a/src/README.md b/src/README.md index c071865..915e96a 100644 --- a/src/README.md +++ b/src/README.md @@ -81,6 +81,9 @@ make install # Build executables and tarballs for Linux using Docker make linux + +# Build tarball for Homebrew release +make archive ``` Contribution