ccache: add package
[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.16.9
4 TERMUX_PKG_SHA256=dd9434576c68313481613a5bd52dbf623eee37a5c87f7bb66ca71ac8add5ff94
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 # Depend on findutils as fzf uses the -fstype option, which busybox
9 # find does not support, when invoking find:
10 TERMUX_PKG_DEPENDS="bash, findutils"
11
12 termux_step_make() {
13 :
14 }
15
16 termux_step_make_install () {
17 termux_setup_golang
18 export CGO_CFLAGS="-I$TERMUX_PREFIX/include"
19 export CGO_LDFLAGS="-L$TERMUX_PREFIX/lib"
20
21 # See the fzf Makefile:
22 local _BINARY="target/fzf-${GOOS}_"
23 if [ $TERMUX_ARCH = "arm" ]; then
24 _BINARY+="arm7"
25 elif [ $TERMUX_ARCH = "i686" ]; then
26 _BINARY+="386"
27 elif [ $TERMUX_ARCH = "x86_64" ]; then
28 _BINARY+="amd64"
29 elif [ $TERMUX_ARCH = "aarch64" ]; then
30 _BINARY+="arm8"
31 else
32 termux_error_exit "Unsupported arch: $TERMUX_ARCH"
33 fi
34
35 LDFLAGS="-pie" make $_BINARY
36 cp $_BINARY $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 }