mirror of
https://github.com/Llewellynvdm/fzf.git
synced 2024-11-24 21:57:36 +00:00
Update Makefile and installer to use version number
This commit is contained in:
parent
7557737569
commit
8e5ecf6b38
17
install
17
install
@ -3,8 +3,6 @@
|
|||||||
cd `dirname $BASH_SOURCE`
|
cd `dirname $BASH_SOURCE`
|
||||||
fzf_base=`pwd`
|
fzf_base=`pwd`
|
||||||
|
|
||||||
ARCHI=$(uname -sm)
|
|
||||||
|
|
||||||
ask() {
|
ask() {
|
||||||
read -p "$1 ([y]/n) " -n 1 -r
|
read -p "$1 ([y]/n) " -n 1 -r
|
||||||
echo
|
echo
|
||||||
@ -22,7 +20,7 @@ download() {
|
|||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
local url=https://github.com/junegunn/fzf-bin/releases/download/snapshot/${1}.tar.gz
|
local url=https://github.com/junegunn/fzf-bin/releases/download/snapshot/${1}.tgz
|
||||||
if which curl > /dev/null; then
|
if which curl > /dev/null; then
|
||||||
curl -fL $url | tar -xz
|
curl -fL $url | tar -xz
|
||||||
elif which wget > /dev/null; then
|
elif which wget > /dev/null; then
|
||||||
@ -41,19 +39,20 @@ download() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Try to download binary executable
|
# Try to download binary executable
|
||||||
binary_available=0
|
archi=$(uname -sm)
|
||||||
downloaded=0
|
downloaded=0
|
||||||
if [ "$ARCHI" = "Darwin x86_64" ]; then
|
binary_available=0
|
||||||
|
if [ "$archi" = "Darwin x86_64" ]; then
|
||||||
binary_available=1
|
binary_available=1
|
||||||
download fzf_darwin_amd64 && downloaded=1
|
download fzf-0.9.0-darwin_amd64 && downloaded=1
|
||||||
elif [ "$ARCHI" = "Linux x86_64" ]; then
|
elif [ "$archi" = "Linux x86_64" ]; then
|
||||||
binary_available=1
|
binary_available=1
|
||||||
download fzf_linux_amd64 && downloaded=1
|
download fzf-0.9.0-linux_amd64 && downloaded=1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $downloaded -ne 1 ]; then
|
if [ $downloaded -ne 1 ]; then
|
||||||
if [ $binary_available -eq 0 ]; then
|
if [ $binary_available -eq 0 ]; then
|
||||||
echo -n "No prebuilt binary for $ARCHI ... "
|
echo -n "No prebuilt binary for $archi ... "
|
||||||
else
|
else
|
||||||
echo -n "Failed to download binary executable ... "
|
echo -n "Failed to download binary executable ... "
|
||||||
fi
|
fi
|
||||||
|
45
src/Makefile
45
src/Makefile
@ -1,52 +1,51 @@
|
|||||||
BINARY := fzf/fzf
|
|
||||||
|
|
||||||
UNAME_S := $(shell uname -s)
|
UNAME_S := $(shell uname -s)
|
||||||
ifeq ($(UNAME_S),Darwin)
|
ifeq ($(UNAME_S),Darwin)
|
||||||
BINARY := $(BINARY)_darwin
|
SUFFIX := darwin
|
||||||
else ifeq ($(UNAME_S),Linux)
|
else ifeq ($(UNAME_S),Linux)
|
||||||
BINARY := $(BINARY)_linux
|
SUFFIX := linux
|
||||||
endif
|
endif
|
||||||
|
|
||||||
UNAME_M := $(shell uname -m)
|
UNAME_M := $(shell uname -m)
|
||||||
ifneq ($(filter i386 i686,$(UNAME_M)),)
|
|
||||||
$(error "filtered is not supported, yet.")
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq ($(UNAME_M),x86_64)
|
ifeq ($(UNAME_M),x86_64)
|
||||||
BINARY := $(BINARY)_amd64
|
SUFFIX := $(SUFFIX)_amd64
|
||||||
else ifneq ($(filter i386 i686,$(UNAME_M)),)
|
else ifneq ($(filter i386 i686,$(UNAME_M)),)
|
||||||
BINARY := $(BINARY)_386
|
SUFFIX := $(SUFFIX)_386
|
||||||
else # TODO
|
else # TODO
|
||||||
$(error "$(UNAME_M) is not supported, yet.")
|
$(error "$(UNAME_M) is not supported, yet.")
|
||||||
endif
|
endif
|
||||||
|
|
||||||
BINDIR = ../bin
|
BINARY := fzf-$(SUFFIX)
|
||||||
SOURCES = $(wildcard *.go fzf/*.go)
|
BINDIR := ../bin
|
||||||
|
SOURCES := $(wildcard *.go fzf/*.go)
|
||||||
|
RELEASE = fzf-$(shell fzf/$(BINARY) --version)-$(SUFFIX)
|
||||||
|
|
||||||
all: build
|
all: release
|
||||||
|
|
||||||
build: $(BINARY).tar.gz
|
release: build
|
||||||
|
cd fzf && \
|
||||||
|
cp $(BINARY) $(RELEASE) && \
|
||||||
|
tar -czf $(RELEASE).tgz $(RELEASE) && \
|
||||||
|
rm $(RELEASE)
|
||||||
|
|
||||||
$(BINARY).tar.gz: $(BINARY)
|
build: fzf/$(BINARY)
|
||||||
cd fzf && tar -czf $(notdir $(BINARY)).tar.gz $(notdir $(BINARY))
|
|
||||||
|
|
||||||
$(BINARY): $(SOURCES)
|
fzf/$(BINARY): $(SOURCES)
|
||||||
go get
|
go get
|
||||||
go test -v
|
go test -v
|
||||||
cd fzf && go build -o $(notdir $(BINARY))
|
cd fzf && go build -o $(BINARY)
|
||||||
|
|
||||||
install: $(BINARY)
|
install: fzf/$(BINARY)
|
||||||
mkdir -p $(BINDIR)
|
mkdir -p $(BINDIR)
|
||||||
cp -f $(BINARY) $(BINDIR)/fzf
|
cp -f fzf/$(BINARY) $(BINDIR)/fzf
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f $(BINARY) $(BINARY).tar.gz
|
cd fzf && rm -f $(BINARY) $(RELEASE).tgz
|
||||||
|
|
||||||
docker:
|
docker:
|
||||||
docker build -t junegunn/ubuntu-sandbox .
|
docker build -t junegunn/ubuntu-sandbox .
|
||||||
|
|
||||||
linux64:
|
linux64:
|
||||||
docker run -i -t -u jg -v $(shell cd ..; pwd):/fzf junegunn/ubuntu-sandbox \
|
docker run -i -t -u jg -v $(shell cd ..; pwd):/fzf junegunn/ubuntu-sandbox \
|
||||||
/bin/bash -ci 'cd ~jg/go/src/github.com/junegunn/fzf/src; make build'
|
/bin/bash -ci 'cd ~jg/go/src/github.com/junegunn/fzf/src; make'
|
||||||
|
|
||||||
.PHONY: build install linux64 clean docker run
|
.PHONY: build release install linux64 clean docker run
|
||||||
|
Loading…
Reference in New Issue
Block a user