fzf: Use git master for neovim fix
[termux-packages] / packages / fzf / build.sh
1 TERMUX_PKG_HOMEPAGE=https://github.com/junegunn/fzf
2 TERMUX_PKG_DESCRIPTION="Command-line fuzzy finder"
3 # Use git master until next release with https://github.com/junegunn/fzf/pull/768
4 TERMUX_PKG_VERSION=0.15.9.1
5 _COMMIT=847c512539f9909ae69a5067c1a64cb9bb485ea3
6 # TERMUX_PKG_SRCURL=https://github.com/junegunn/fzf/archive/${TERMUX_PKG_VERSION}.tar.gz
7 # TERMUX_PKG_FOLDERNAME=fzf-${TERMUX_PKG_VERSION}
8 TERMUX_PKG_SRCURL=https://github.com/junegunn/fzf/archive/$_COMMIT.zip
9 TERMUX_PKG_FOLDERNAME=fzf-$_COMMIT
10 TERMUX_PKG_BUILD_IN_SRC="yes"
11 TERMUX_PKG_DEPENDS="bash, ncurses"
12
13 termux_step_make_install () {
14 export GOPATH=$TERMUX_PKG_TMPDIR
15 cd $GOPATH
16 mkdir -p src/github.com/junegunn/fzf
17 cp -Rf $TERMUX_PKG_SRCDIR/* src/github.com/junegunn/fzf
18
19 termux_setup_golang
20 export CGO_CFLAGS="-I$TERMUX_PREFIX/include -L$TERMUX_PREFIX/lib"
21 export CGO_LDFLAGS="-L$TERMUX_PREFIX/lib"
22
23 mkdir -p $GOPATH/src/github.com/junegunn/fzf/src/vendor/github.com/junegunn/{go-runewidth,go-shellwords,go-isatty}
24 for file in runewidth.go runewidth_posix.go; do
25 curl -o $GOPATH/src/github.com/junegunn/fzf/src/vendor/github.com/junegunn/go-runewidth/$file \
26 https://raw.githubusercontent.com/junegunn/go-runewidth/master/$file
27 done
28 for file in shellwords.go util_posix.go; do
29 curl -o $GOPATH/src/github.com/junegunn/fzf/src/vendor/github.com/junegunn/go-shellwords/$file \
30 https://raw.githubusercontent.com/junegunn/go-shellwords/master/$file
31 done
32 curl -o $GOPATH/src/github.com/junegunn/fzf/src/vendor/github.com/junegunn/go-isatty/isatty_linux.go \
33 https://raw.githubusercontent.com/junegunn/go-isatty/master/isatty_linux.go
34
35 cd $GOPATH/src/github.com/junegunn/fzf/src/fzf
36 CGO_ENABLED=1 go build -a -ldflags="-extldflags=-pie" -o $TERMUX_PREFIX/bin/fzf
37
38 # Install fzf-tmux, a bash script for launching fzf in a tmux pane:
39 cp $TERMUX_PKG_SRCDIR/bin/fzf-tmux $TERMUX_PREFIX/bin
40
41 # Install the fzf.1 man page:
42 mkdir -p $TERMUX_PREFIX/share/man/man1/
43 cp $TERMUX_PKG_SRCDIR/man/man1/fzf.1 $TERMUX_PREFIX/share/man/man1/
44
45 # Install the vim plugin:
46 mkdir -p $TERMUX_PREFIX/share/vim/vim80/plugin
47 cp $TERMUX_PKG_SRCDIR/plugin/fzf.vim $TERMUX_PREFIX/share/vim/vim80/plugin/fzf.vim
48
49 # Install bash, zsh and fish helper scripts:
50 mkdir -p "$TERMUX_PREFIX/share/fzf"
51 cp $TERMUX_PKG_SRCDIR/shell/* "$TERMUX_PREFIX/share/fzf"
52
53 # Install the nvim plugin:
54 mkdir -p $TERMUX_PREFIX/share/nvim/runtime/plugin
55 cp $TERMUX_PKG_SRCDIR/plugin/fzf.vim $TERMUX_PREFIX/share/nvim/runtime/plugin/
56 }
57
58 termux_step_post_massage () {
59 # Remove so that the vim build doesn't add it to vim-runtime:
60 rm $TERMUX_PREFIX/share/vim/vim80/plugin/fzf.vim
61 }