diff --git a/LICENSE b/LICENSE new file mode 100644 index 00000000..fe4c31ae --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2015 Junegunn Choi + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/README.md b/README.md index 998db0c6..4b7c6c5f 100644 --- a/README.md +++ b/README.md @@ -536,7 +536,7 @@ find . | iconv -f utf-8-mac -t utf8//ignore | fzf License ------- -MIT +[MIT](LICENSE) Author ------ diff --git a/install b/install index c61cf889..a481d576 100755 --- a/install +++ b/install @@ -13,9 +13,14 @@ ask() { check_binary() { echo -n " - Checking fzf executable ... " - if ! "$fzf_base"/bin/fzf --version; then + local output=$("$fzf_base"/bin/fzf --version 2>&1) + if [ "$version" = "$output" ]; then + echo "$output" + else + echo "$output != $version" rm -f "$fzf_base"/bin/fzf - binary_error="Error occurred" + binary_error="Invalid binary" + return 1 fi } @@ -27,9 +32,11 @@ symlink() { } download() { - echo "Downloading bin/$1 ..." - if [ -x "$fzf_base"/bin/$1 ]; then + echo "Downloading bin/fzf ..." + if [ -x "$fzf_base"/bin/fzf ]; then echo " - Already exists" + check_binary && return + elif [ -x "$fzf_base"/bin/$1 ]; then symlink $1 check_binary && return fi diff --git a/src/Makefile b/src/Makefile index 2758164f..68067efc 100644 --- a/src/Makefile +++ b/src/Makefile @@ -21,26 +21,29 @@ BINARY64 := fzf-$(GOOS)_amd64 VERSION = $(shell fzf/$(BINARY64) --version) RELEASE32 = fzf-$(VERSION)-$(GOOS)_386 RELEASE64 = fzf-$(VERSION)-$(GOOS)_amd64 -ARCHIVE64 = fzf-$(VERSION)-$(GOOS)_amd64-archive +BREW = fzf-$(VERSION)-homebrew.tgz all: test release -archive: ../$(ARCHIVE64).tar.gz +brew: ../$(BREW) -../$(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) && \ +../$(BREW): release +ifneq ($(UNAME_S),Darwin) +$(error brew package must be built on OS X) +endif + mkdir -p ../bin && \ + cp fzf/$(RELEASE64) fzf/$(RELEASE32) ../bin && \ + cd .. && ln -sf . fzf-$(VERSION) && \ + tar -cvzf $(BREW) \ + fzf-$(VERSION)/{{,un}install,fzf-completion.{ba,z}sh,LICENSE} \ + fzf-$(VERSION)/{plugin/fzf.vim,bin/{$(RELEASE64),$(RELEASE32)}} && \ + rm fzf-$(VERSION) && \ openssl sha1 $(notdir $@) release: build cd fzf && \ cp $(BINARY32) $(RELEASE32) && tar -czf $(RELEASE32).tgz $(RELEASE32) && \ - cp $(BINARY64) $(RELEASE64) && tar -czf $(RELEASE64).tgz $(RELEASE64) && \ - rm $(RELEASE32) $(RELEASE64) + cp $(BINARY64) $(RELEASE64) && tar -czf $(RELEASE64).tgz $(RELEASE64) build: fzf/$(BINARY32) fzf/$(BINARY64) @@ -83,4 +86,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 archive build release test install uninstall clean docker linux $(DISTRO) +.PHONY: all brew build release test install uninstall clean docker linux $(DISTRO) diff --git a/src/README.md b/src/README.md index 915e96ac..a15ab58e 100644 --- a/src/README.md +++ b/src/README.md @@ -83,7 +83,7 @@ make install make linux # Build tarball for Homebrew release -make archive +make brew ``` Contribution