From 9a653b4634befb4b6cf76db5e69cbcf2cbe0f440 Mon Sep 17 00:00:00 2001 From: Fredrik Fornwall Date: Sun, 10 Jan 2016 19:51:38 -0500 Subject: [PATCH] fzf: Add package --- packages/fzf/bin-fzf-tmux.patch | 24 ++++++++++++++++++ packages/fzf/build.sh | 45 +++++++++++++++++++++++++++++++++ packages/fzf/curses.go.patch | 12 +++++++++ 3 files changed, 81 insertions(+) create mode 100644 packages/fzf/bin-fzf-tmux.patch create mode 100644 packages/fzf/build.sh create mode 100644 packages/fzf/curses.go.patch diff --git a/packages/fzf/bin-fzf-tmux.patch b/packages/fzf/bin-fzf-tmux.patch new file mode 100644 index 000000000..6dc550f4d --- /dev/null +++ b/packages/fzf/bin-fzf-tmux.patch @@ -0,0 +1,24 @@ +diff -u -r ../fzf-0.11.1/bin/fzf-tmux ./bin/fzf-tmux +--- ../fzf-0.11.1/bin/fzf-tmux 2015-11-30 10:39:45.000000000 -0500 ++++ ./bin/fzf-tmux 2016-01-10 19:11:38.223664557 -0500 +@@ -1,4 +1,4 @@ +-#!/usr/bin/env bash ++#!/usr/bin/bash + # fzf-tmux: starts fzf in a tmux pane + # usage: fzf-tmux [-u|-d [HEIGHT[%]]] [-l|-r [WIDTH[%]]] [--] [FZF OPTIONS] + +@@ -91,10 +91,10 @@ + + # Clean up named pipes on exit + id=$RANDOM +-argsf="${TMPDIR:-/tmp}/fzf-args-$id" +-fifo1="${TMPDIR:-/tmp}/fzf-fifo1-$id" +-fifo2="${TMPDIR:-/tmp}/fzf-fifo2-$id" +-fifo3="${TMPDIR:-/tmp}/fzf-fifo3-$id" ++argsf="${TMPDIR:-@TERMUX_PREFIX@/tmp}/fzf-args-$id" ++fifo1="${TMPDIR:-@TERMUX_PREFIX@/tmp}/fzf-fifo1-$id" ++fifo2="${TMPDIR:-@TERMUX_PREFIX@/tmp}/fzf-fifo2-$id" ++fifo3="${TMPDIR:-@TERMUX_PREFIX@/tmp}/fzf-fifo3-$id" + cleanup() { + rm -f $argsf $fifo1 $fifo2 $fifo3 + } diff --git a/packages/fzf/build.sh b/packages/fzf/build.sh new file mode 100644 index 000000000..6bb6ed628 --- /dev/null +++ b/packages/fzf/build.sh @@ -0,0 +1,45 @@ +TERMUX_PKG_HOMEPAGE=https://github.com/junegunn/fzf +TERMUX_PKG_DESCRIPTION="Command-line fuzzy finder" +TERMUX_PKG_VERSION=0.11.1 +TERMUX_PKG_SRCURL=https://github.com/junegunn/fzf/archive/${TERMUX_PKG_VERSION}.tar.gz +TERMUX_PKG_FOLDERNAME=fzf-${TERMUX_PKG_VERSION} +TERMUX_PKG_BUILD_IN_SRC="yes" +TERMUX_PKG_DEPENDS="bash, ncurses" + +termux_step_make_install () { + export GOPATH=$TERMUX_PKG_TMPDIR + cd $GOPATH + mkdir -p src/github.com/junegunn/fzf + cp -Rf $TERMUX_PKG_SRCDIR/* src/github.com/junegunn/fzf + + termux_setup_golang + export CGO_CFLAGS="-I$TERMUX_PREFIX/include -L$TERMUX_PREFIX/lib" + export CGO_LDFLAGS="-L$TERMUX_PREFIX/lib" + + 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 + + cd $GOPATH/src/github.com/junegunn/fzf/src/fzf + CGO_ENABLED=1 go build -a -ldflags="-extldflags=-pie" -o $TERMUX_PREFIX/bin/fzf + + # Install fzf-tmux, a bash script for launching fzf in a tmux pane: + cp $TERMUX_PKG_SRCDIR/bin/fzf-tmux $TERMUX_PREFIX/bin + + # Install the fzf.1 man page: + mkdir -p $TERMUX_PREFIX/share/man/man1/ + cp $TERMUX_PKG_SRCDIR/man/man1/fzf.1 $TERMUX_PREFIX/share/man/man1/ + + # Install the vim plugin: + mkdir -p $TERMUX_PREFIX/share/vim/vim74/plugin + cp $TERMUX_PKG_SRCDIR/plugin/fzf.vim $TERMUX_PREFIX/share/vim/vim74/plugin + + # Install the nvim plugin: + mkdir -p $TERMUX_PREFIX/share/nvim/runtime/plugin + cp $TERMUX_PKG_SRCDIR/plugin/fzf.vim $TERMUX_PREFIX/share/nvim/runtime/plugin/ +} diff --git a/packages/fzf/curses.go.patch b/packages/fzf/curses.go.patch new file mode 100644 index 000000000..9d6c0920f --- /dev/null +++ b/packages/fzf/curses.go.patch @@ -0,0 +1,12 @@ +diff -u -r ../fzf-0.11.1/src/curses/curses.go ./src/curses/curses.go +--- ../fzf-0.11.1/src/curses/curses.go 2015-11-30 10:39:45.000000000 -0500 ++++ ./src/curses/curses.go 2016-01-10 19:03:28.616487822 -0500 +@@ -4,8 +4,6 @@ + #include + #include + #cgo !static LDFLAGS: -lncurses +-#cgo static LDFLAGS: -l:libncursesw.a -l:libtinfo.a -l:libgpm.a -ldl +-#cgo android static LDFLAGS: -l:libncurses.a -fPIE -march=armv7-a -mfpu=neon -mhard-float -Wl,--no-warn-mismatch + + SCREEN *c_newterm () { + return newterm(NULL, stderr, stdin);