Update install/build script from Homebrew
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by Junegunn Choi · committed by Junegunn Choi · parent b8c4b35 · Browse files · 5 files·+49 added−18 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
5 files+49 added−18 removed
- other:+49 added−18 removed
Provenance
- Commit
a3068a3- Tree
25f5c79- Author
Junegunn Choi <junegunn.c@gmail.com>- Committer
Junegunn Choi <junegunn.c@gmail.com>- Parent
b8c4b35
5 files changed+49 added−18 removed
modified:src/Makefile+15 added-12 removed
19 unmodified lines20 BINARY64 := fzf-$(GOOS)_amd6421 VERSION = $(shell fzf/$(BINARY64) --version)22 RELEASE32 = fzf-$(VERSION)-$(GOOS)_38623 RELEASE64 = fzf-$(VERSION)-$(GOOS)_amd6424-ARCHIVE64 = fzf-$(VERSION)-$(GOOS)_amd64-archive24+BREW = fzf-$(VERSION)-homebrew.tgz25 26 all: test release27 28-archive: ../$(ARCHIVE64).tar.gz28+brew: ../$(BREW)29 30-../$(ARCHIVE64).tar.gz: release31- cd ../ && yes | ./install && \32- git archive HEAD --output=$(ARCHIVE64).tar --prefix fzf-$(VERSION)/ && \33- rm -rf fzf-$(VERSION)/bin && mkdir -p fzf-$(VERSION)/bin && \34- cp -a bin/* fzf-$(VERSION)/bin/ && \35- tar --append --file $(ARCHIVE64).tar fzf-$(VERSION)/bin/* && \36- gzip -f $(ARCHIVE64).tar && rm -rf fzf-$(VERSION) && \30+../$(BREW): release31+ifneq ($(UNAME_S),Darwin)32+$(error brew package must be built on OS X)33+endif34+ mkdir -p ../bin && \35+ cp fzf/$(RELEASE64) fzf/$(RELEASE32) ../bin && \36+ cd .. && ln -sf . fzf-$(VERSION) && \37+ tar -cvzf $(BREW) \38+ fzf-$(VERSION)/{{,un}install,fzf-completion.{ba,z}sh,LICENSE} \39+ fzf-$(VERSION)/{plugin/fzf.vim,bin/{$(RELEASE64),$(RELEASE32)}} && \40+ rm fzf-$(VERSION) && \41 openssl sha1 $(notdir $@)42 43 release: build44 cd fzf && \45 cp $(BINARY32) $(RELEASE32) && tar -czf $(RELEASE32).tgz $(RELEASE32) && \42- cp $(BINARY64) $(RELEASE64) && tar -czf $(RELEASE64).tgz $(RELEASE64) && \43- rm $(RELEASE32) $(RELEASE64)46+ cp $(BINARY64) $(RELEASE64) && tar -czf $(RELEASE64).tgz $(RELEASE64)47 48 build: fzf/$(BINARY32) fzf/$(BINARY64)49 50 test:34 unmodified lines85 $(DISTRO): docker86 docker run -i -t -v $(GOPATH):/go junegunn/$(DISTRO)-sandbox \87 sh -c 'cd /go/src/github.com/junegunn/fzf/src; /bin/bash'88 86-.PHONY: all archive build release test install uninstall clean docker linux $(DISTRO)89+.PHONY: all brew build release test install uninstall clean docker linux $(DISTRO)modified:src/README.md+1 added-1 removed
81 unmodified lines8283848586868788899028 unmodified lines81 unmodified lines# Build executables and tarballs for Linux using Dockermake linux
# Build tarball for Homebrew releasemake archivemake brew```
Contribution------------28 unmodified linesmodified:install+11 added-4 removed
11 unmodified lines12 }13 14 check_binary() {15 echo -n " - Checking fzf executable ... "16- if ! "$fzf_base"/bin/fzf --version; then16+ local output=$("$fzf_base"/bin/fzf --version 2>&1)17+ if [ "$version" = "$output" ]; then18+ echo "$output"19+ else20+ echo "$output != $version"21 rm -f "$fzf_base"/bin/fzf18- binary_error="Error occurred"22+ binary_error="Invalid binary"23+ return 124 fi25 }26 27 symlink() {3 unmodified lines31 ln -sf $1 fzf)32 }33 34 download() {30- echo "Downloading bin/$1 ..."31- if [ -x "$fzf_base"/bin/$1 ]; then35+ echo "Downloading bin/fzf ..."36+ if [ -x "$fzf_base"/bin/fzf ]; then37 echo " - Already exists"38+ check_binary && return39+ elif [ -x "$fzf_base"/bin/$1 ]; then40 symlink $141 check_binary && return42 fi43 mkdir -p "$fzf_base"/bin && cd "$fzf_base"/bin450 unmodified linesadded:LICENSE+21 added
1+The MIT License (MIT)2+3+Copyright (c) 2015 Junegunn Choi4+5+Permission is hereby granted, free of charge, to any person obtaining a copy6+of this software and associated documentation files (the "Software"), to deal7+in the Software without restriction, including without limitation the rights8+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell9+copies of the Software, and to permit persons to whom the Software is10+furnished to do so, subject to the following conditions:11+12+The above copyright notice and this permission notice shall be included in13+all copies or substantial portions of the Software.14+15+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR16+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,17+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE18+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER19+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,20+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN21+THE SOFTWARE.modified:README.md+1 added-1 removed
534 unmodified lines535 536 License537 -------538 539-MIT539+[MIT](LICENSE)540 541 Author542 ------543 2 unmodified lines