aboutsummaryrefslogblamecommitdiffstats
path: root/app-shells/fzf/fzf-0.20.0.ebuild
blob: 252242162d9eaae85d527d29b7fc3bc628604ee1 (plain) (tree)
















































































                                                                             
# Copyright 2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=7

GIT_COMMIT="${PV}"
EGO_PN="github.com/junegunn/${PN}"
EGO_VENDOR=(
	"github.com/gdamore/tcell 0a0db94084df"
	"github.com/mattn/go-isatty 66b8e73f3f5c"
	"github.com/mattn/go-runewidth 14207d285c6c"
	"github.com/mattn/go-shellwords v1.0.3"
	"golang.org/x/crypto 558b6879de74 github.com/golang/crypto"
	"golang.org/x/sys a5b02f93d862 github.com/golang/sys"
)

inherit bash-completion-r1 golang-vcs-snapshot

DESCRIPTION="A general-purpose command-line fuzzy finder"
HOMEPAGE="https://github.com/junegunn/fzf"
ARCHIVE_URI="https://${EGO_PN}/archive/${PV}.tar.gz -> ${P}.tar.gz"
SRC_URI="${ARCHIVE_URI} ${EGO_VENDOR_URI}"
RESTRICT="mirror"

LICENSE="MIT"
SLOT="0"
KEYWORDS="amd64"
IUSE="debug tmux"

RDEPEND="tmux? ( app-misc/tmux )"

DOCS=( CHANGELOG.md README.md )
QA_PRESTRIPPED="usr/bin/.*"

S="${WORKDIR}/${P}/src/${EGO_PN}"

src_compile() {
	local mygoargs=(
		-v
		-work
		-x
		-tags release
		-ldflags "-X main.version=${PV}"
		-asmflags "-trimpath=${S}"
		-gcflags "-trimpath=${S}"
	)
	GO111MODULE=off GOPATH="${WORKDIR}/${P}:$(get_golibdir_gopath)" \
		go build "${mygoargs[@]}" || die
}

src_test() {
	GO111MODULE=off GOPATH="${WORKDIR}/${P}:$(get_golibdir_gopath)" \
		go test -timeout 30m -v -work ./src{,/algo,/tui,/util} || die
}

src_install() {
	dobin fzf
	use debug && dostrip -x /usr/bin/fzf
	einstalldocs

	doman man/man1/fzf.1

	newbashcomp shell/completion.bash fzf

	insinto /usr/share/nvim/runtime/plugin
	doins plugin/fzf.vim

	insinto /usr/share/vim/vimfiles/plugin
	doins plugin/fzf.vim
	dodoc README-VIM.md

	insinto /usr/share/zsh/site-functions
	newins shell/completion.zsh _fzf
	insinto /usr/share/zsh/site-contrib/
	newins shell/key-bindings.zsh fzf.zsh

	if use tmux; then
		dobin bin/fzf-tmux
		doman man/man1/fzf-tmux.1
	fi
}