| 1 | TERMUX_PKG_HOMEPAGE=https://github.com/junegunn/fzf |
| 2 | TERMUX_PKG_DESCRIPTION="Command-line fuzzy finder" |
| 3 | TERMUX_PKG_VERSION=0.12.0 |
| 4 | TERMUX_PKG_SRCURL=https://github.com/junegunn/fzf/archive/${TERMUX_PKG_VERSION}.tar.gz |
| 5 | TERMUX_PKG_FOLDERNAME=fzf-${TERMUX_PKG_VERSION} |
| 6 | TERMUX_PKG_BUILD_IN_SRC="yes" |
| 7 | TERMUX_PKG_DEPENDS="bash, ncurses" |
| 8 | |
| 9 | termux_step_make_install () { |
| 10 | export GOPATH=$TERMUX_PKG_TMPDIR |
| 11 | cd $GOPATH |
| 12 | mkdir -p src/github.com/junegunn/fzf |
| 13 | cp -Rf $TERMUX_PKG_SRCDIR/* src/github.com/junegunn/fzf |
| 14 | |
| 15 | termux_setup_golang |
| 16 | export CGO_CFLAGS="-I$TERMUX_PREFIX/include -L$TERMUX_PREFIX/lib" |
| 17 | export CGO_LDFLAGS="-L$TERMUX_PREFIX/lib" |
| 18 | |
| 19 | mkdir -p $GOPATH/src/github.com/junegunn/fzf/src/vendor/github.com/junegunn/{go-runewidth,go-shellwords} |
| 20 | for file in runewidth.go runewidth_posix.go; do |
| 21 | curl -o $GOPATH/src/github.com/junegunn/fzf/src/vendor/github.com/junegunn/go-runewidth/$file \ |
| 22 | https://raw.githubusercontent.com/junegunn/go-runewidth/master/$file |
| 23 | done |
| 24 | for file in shellwords.go util_posix.go; do |
| 25 | curl -o $GOPATH/src/github.com/junegunn/fzf/src/vendor/github.com/junegunn/go-shellwords/$file \ |
| 26 | https://raw.githubusercontent.com/junegunn/go-shellwords/master/$file |
| 27 | done |
| 28 | |
| 29 | cd $GOPATH/src/github.com/junegunn/fzf/src/fzf |
| 30 | CGO_ENABLED=1 go build -a -ldflags="-extldflags=-pie" -o $TERMUX_PREFIX/bin/fzf |
| 31 | |
| 32 | # Install fzf-tmux, a bash script for launching fzf in a tmux pane: |
| 33 | cp $TERMUX_PKG_SRCDIR/bin/fzf-tmux $TERMUX_PREFIX/bin |
| 34 | |
| 35 | # Install the fzf.1 man page: |
| 36 | mkdir -p $TERMUX_PREFIX/share/man/man1/ |
| 37 | cp $TERMUX_PKG_SRCDIR/man/man1/fzf.1 $TERMUX_PREFIX/share/man/man1/ |
| 38 | |
| 39 | # Install the vim plugin: |
| 40 | mkdir -p $TERMUX_PREFIX/share/vim/vim74/plugin |
| 41 | cp $TERMUX_PKG_SRCDIR/plugin/fzf.vim $TERMUX_PREFIX/share/vim/vim74/plugin/fzf.vim |
| 42 | |
| 43 | # Install the nvim plugin: |
| 44 | mkdir -p $TERMUX_PREFIX/share/nvim/runtime/plugin |
| 45 | cp $TERMUX_PKG_SRCDIR/plugin/fzf.vim $TERMUX_PREFIX/share/nvim/runtime/plugin/ |
| 46 | } |
| 47 | |
| 48 | termux_step_post_massage () { |
| 49 | # Remove so that the vim build doesn't add it to vim-runtime: |
| 50 | rm $TERMUX_PREFIX/share/vim/vim74/plugin/fzf.vim |
| 51 | } |