chiark / gitweb /
postgresql: Patch away /bin/sh
[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.5
4 TERMUX_PKG_SRCURL=https://github.com/junegunn/fzf/archive/${TERMUX_PKG_VERSION}.tar.gz
5 TERMUX_PKG_SHA256=7add1b5290af779fc1c6a3e306d696fb0e833d4efb5b60d94f9c424ac1b6f9fe
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_install () {
13         termux_setup_golang
14         export CGO_CFLAGS="-I$TERMUX_PREFIX/include"
15         export CGO_LDFLAGS="-L$TERMUX_PREFIX/lib"
16
17         # See the fzf Makefile:
18         local _BINARY="fzf/fzf-${GOOS}_"
19         if [ $TERMUX_ARCH = "arm" ]; then
20                 _BINARY+="arm7"
21         elif [ $TERMUX_ARCH = "i686" ]; then
22                 _BINARY+="386"
23         elif [ $TERMUX_ARCH = "x86_64" ]; then
24                 _BINARY+="amd64"
25         elif [ $TERMUX_ARCH = "aarch64" ]; then
26                 _BINARY+="arm8"
27         else
28                 termux_error_exit "Unsupported arch: $TERMUX_ARCH"
29         fi
30
31         cd $TERMUX_PKG_SRCDIR/src
32         LDFLAGS="-pie" make $_BINARY
33         cp $_BINARY $TERMUX_PREFIX/bin/fzf
34
35         # Install fzf-tmux, a bash script for launching fzf in a tmux pane:
36         cp $TERMUX_PKG_SRCDIR/bin/fzf-tmux $TERMUX_PREFIX/bin
37
38         # Install the fzf.1 man page:
39         mkdir -p $TERMUX_PREFIX/share/man/man1/
40         cp $TERMUX_PKG_SRCDIR/man/man1/fzf.1 $TERMUX_PREFIX/share/man/man1/
41
42         # Install the vim plugin:
43         mkdir -p $TERMUX_PREFIX/share/vim/vim80/plugin
44         cp $TERMUX_PKG_SRCDIR/plugin/fzf.vim $TERMUX_PREFIX/share/vim/vim80/plugin/fzf.vim
45
46         # Install bash, zsh and fish helper scripts:
47         mkdir -p "$TERMUX_PREFIX/share/fzf"
48         cp $TERMUX_PKG_SRCDIR/shell/* "$TERMUX_PREFIX/share/fzf"
49
50         # Install the nvim plugin:
51         mkdir -p $TERMUX_PREFIX/share/nvim/runtime/plugin
52         cp $TERMUX_PKG_SRCDIR/plugin/fzf.vim $TERMUX_PREFIX/share/nvim/runtime/plugin/
53 }
54
55 termux_step_post_massage () {
56         # Remove so that the vim build doesn't add it to vim-runtime:
57         rm $TERMUX_PREFIX/share/vim/vim80/plugin/fzf.vim
58 }