- mkdir -p $GOPATH/src/github.com/junegunn/fzf/src/vendor/github.com/junegunn/{go-runewidth,go-shellwords,go-isatty}
- for file in runewidth.go runewidth_posix.go; do
- curl -o $GOPATH/src/github.com/junegunn/fzf/src/vendor/github.com/junegunn/go-runewidth/$file \
- https://raw.githubusercontent.com/junegunn/go-runewidth/master/$file
- done
- for file in shellwords.go util_posix.go; do
- curl -o $GOPATH/src/github.com/junegunn/fzf/src/vendor/github.com/junegunn/go-shellwords/$file \
- https://raw.githubusercontent.com/junegunn/go-shellwords/master/$file
- done
- curl -o $GOPATH/src/github.com/junegunn/fzf/src/vendor/github.com/junegunn/go-isatty/isatty_linux.go \
- https://raw.githubusercontent.com/junegunn/go-isatty/master/isatty_linux.go
-
- cd $GOPATH/src/github.com/junegunn/fzf/src/fzf
- CGO_ENABLED=1 go build -a -ldflags="-extldflags=-pie" -o $TERMUX_PREFIX/bin/fzf
+ # See the fzf Makefile:
+ local _BINARY="target/fzf-${GOOS}_"
+ if [ $TERMUX_ARCH = "arm" ]; then
+ _BINARY+="arm7"
+ elif [ $TERMUX_ARCH = "i686" ]; then
+ _BINARY+="386"
+ elif [ $TERMUX_ARCH = "x86_64" ]; then
+ _BINARY+="amd64"
+ elif [ $TERMUX_ARCH = "aarch64" ]; then
+ _BINARY+="arm8"
+ else
+ termux_error_exit "Unsupported arch: $TERMUX_ARCH"
+ fi
+
+ LDFLAGS="-pie" make $_BINARY
+ cp $_BINARY $TERMUX_PREFIX/bin/fzf