Update install/build script from Homebrew

pull/117/head 0.9.0
Junegunn Choi 10 years ago
parent b8c4b35415
commit a3068a33d5

@ -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.

@ -536,7 +536,7 @@ find . | iconv -f utf-8-mac -t utf8//ignore | fzf
License License
------- -------
MIT [MIT](LICENSE)
Author Author
------ ------

@ -13,9 +13,14 @@ ask() {
check_binary() { check_binary() {
echo -n " - Checking fzf executable ... " 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 rm -f "$fzf_base"/bin/fzf
binary_error="Error occurred" binary_error="Invalid binary"
return 1
fi fi
} }
@ -27,9 +32,11 @@ symlink() {
} }
download() { download() {
echo "Downloading bin/$1 ..." echo "Downloading bin/fzf ..."
if [ -x "$fzf_base"/bin/$1 ]; then if [ -x "$fzf_base"/bin/fzf ]; then
echo " - Already exists" echo " - Already exists"
check_binary && return
elif [ -x "$fzf_base"/bin/$1 ]; then
symlink $1 symlink $1
check_binary && return check_binary && return
fi fi

@ -21,26 +21,29 @@ BINARY64 := fzf-$(GOOS)_amd64
VERSION = $(shell fzf/$(BINARY64) --version) VERSION = $(shell fzf/$(BINARY64) --version)
RELEASE32 = fzf-$(VERSION)-$(GOOS)_386 RELEASE32 = fzf-$(VERSION)-$(GOOS)_386
RELEASE64 = fzf-$(VERSION)-$(GOOS)_amd64 RELEASE64 = fzf-$(VERSION)-$(GOOS)_amd64
ARCHIVE64 = fzf-$(VERSION)-$(GOOS)_amd64-archive BREW = fzf-$(VERSION)-homebrew.tgz
all: test release all: test release
archive: ../$(ARCHIVE64).tar.gz brew: ../$(BREW)
../$(ARCHIVE64).tar.gz: release ../$(BREW): release
cd ../ && yes | ./install && \ ifneq ($(UNAME_S),Darwin)
git archive HEAD --output=$(ARCHIVE64).tar --prefix fzf-$(VERSION)/ && \ $(error brew package must be built on OS X)
rm -rf fzf-$(VERSION)/bin && mkdir -p fzf-$(VERSION)/bin && \ endif
cp -a bin/* fzf-$(VERSION)/bin/ && \ mkdir -p ../bin && \
tar --append --file $(ARCHIVE64).tar fzf-$(VERSION)/bin/* && \ cp fzf/$(RELEASE64) fzf/$(RELEASE32) ../bin && \
gzip -f $(ARCHIVE64).tar && rm -rf fzf-$(VERSION) && \ 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 $@) openssl sha1 $(notdir $@)
release: build release: build
cd fzf && \ cd fzf && \
cp $(BINARY32) $(RELEASE32) && tar -czf $(RELEASE32).tgz $(RELEASE32) && \ cp $(BINARY32) $(RELEASE32) && tar -czf $(RELEASE32).tgz $(RELEASE32) && \
cp $(BINARY64) $(RELEASE64) && tar -czf $(RELEASE64).tgz $(RELEASE64) && \ cp $(BINARY64) $(RELEASE64) && tar -czf $(RELEASE64).tgz $(RELEASE64)
rm $(RELEASE32) $(RELEASE64)
build: fzf/$(BINARY32) fzf/$(BINARY64) build: fzf/$(BINARY32) fzf/$(BINARY64)
@ -83,4 +86,4 @@ $(DISTRO): docker
docker run -i -t -v $(GOPATH):/go junegunn/$(DISTRO)-sandbox \ docker run -i -t -v $(GOPATH):/go junegunn/$(DISTRO)-sandbox \
sh -c 'cd /go/src/github.com/junegunn/fzf/src; /bin/bash' 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)

@ -83,7 +83,7 @@ make install
make linux make linux
# Build tarball for Homebrew release # Build tarball for Homebrew release
make archive make brew
``` ```
Contribution Contribution

Loading…
Cancel
Save