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