This repository has been archived by the owner on Mar 8, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
fzf.cygport
129 lines (110 loc) · 4.81 KB
/
fzf.cygport
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
NAME='fzf'
VERSION='0.12.1'
RELEASE=2
CATEGORY='Shells'
SUMMARY='Command line fuzzy finder'
DESCRIPTION='fzf is a general-purpose command-line fuzzy finder'
HOMEPAGE='https://github.com/junegunn/fzf'
SRC_URI="https://github.com/junegunn/fzf/archive/${PV}/fzf-${PV}.tar.gz"
SRC_DIR="${PN}-${PV}"
PATCH_URI='bash-key-bindings-for-bash-only.patch fix-bad-substitution.patch'
PKG_NAMES='fzf
fzf-bash
fzf-zsh
fzf-fish
fzf-bash-completion
fzf-zsh-completion
fzf-vim'
DEPEND='ruby(curses)'
# Dependencies should generally be obvious, with the following exceptions:
#
# - ncurses: required to provide the tput executable.
#
# Experimentation shows that the fzf-tmux executable is required by fzf, but
# neither seem to actually require tmux!
fzf_CONTENTS='usr/bin/ usr/share/doc usr/share/man'
fzf_REQUIRES='ncurses'
fzf_CATEGORY='Utils'
fzf_bash_SUMMARY='fzf key bindings for Bash'
fzf_bash_CONTENTS='etc/profile.d/fzf.sh'
fzf_bash_REQUIRES='fzf bash ncurses'
fzf_zsh_SUMMARY='fzf key bindings for Z shell'
fzf_zsh_CONTENTS='etc/profile.d/fzf.zsh'
fzf_zsh_REQUIRES='fzf zsh'
fzf_fish_SUMMARY='fzf key bindings for fish shell'
fzf_fish_CONTENTS='etc/profile.d/fzf.fish'
fzf_fish_REQUIRES='fzf fish'
fzf_bash_completion_SUMMARY='fzf completion for Bash'
fzf_bash_completion_CONTENTS='etc/bash_completion.d/'
fzf_bash_completion_REQUIRES='fzf bash-completion'
fzf_zsh_completion_SUMMARY='fzf completion for Z shell'
fzf_zsh_completion_CONTENTS='etc/profile.d/fzf-completion.zsh'
fzf_zsh_completion_REQUIRES='fzf zsh'
fzf_vim_SUMMARY='fzf Vim integration'
fzf_vim_CONTENTS='usr/share/vim/'
fzf_vim_REQUIRES='fzf vim'
fzf_vim_CATEGORY='Editors'
# No compilation -- fzf does have a compiled version, but it requires Go, which
# isn't available for Cygwin.
ARCH='noarch'
src_compile () {
:
}
# Since there was no compilation step, all the code is still in the src
# directory, so all the files to be installed need to be taken from there.
src_install () {
dobin "${S}/fzf"
dobin "${S}/bin/fzf-tmux"
# fzf defines completion commands for some programs that already have their
# own, e.g. kill in util-linux. As a result, the fzf script needs to be
# invoked last so it can overwrite those completions, rather than having its
# completions overwritten. The upstream installation achieves this thanks to
# the per-user scripts being invoked after the global ones, but as the Cygwin
# package cannot sensibly change ~/.bashrc, we make sure the fzf completion
# script is invoked last by just giving it a file name that will put it at
# the bottom of the list.
insinto /etc/bash_completion.d
newins "${S}/shell/completion.bash" zzz-fzf
# Ideally, the Bash key binding script would only be included for Bash, but
# Cygwin's default /etc/profile doesn't source anything Bash-specific.
# Instead, use a .sh extension; this means that all shells that include
# /etc/profile will source this script, so there's a patch included above
# that adds code to bail out if the shell isn't actually Bash. This is the
# approach already taken by bash-completion on Cygwin
insinto /etc/profile.d
newins "${S}/shell/completion.zsh" fzf-completion.zsh
# Including the .zsh scripts is done by both /etc/profile and /etc/zprofile.
# In both cases, the releant bit of code currently has the caveat "zsh is in
# shell compatibility mode here, so we probably shouldn't do this", although
# it looks as though that comment should only apply to profile, not zprofile.
insinto /etc/profile.d
newins "${S}/shell/key-bindings.bash" fzf.sh
# Unlike Bash and Z shell, in the fish case, we're fine using /etc/profile.d:
# the .fish scripts are included from /etc/profile.d by
# /etc/fish/config.fish, and not from anywhere else.
insinto /etc/profile.d
newins "${S}/shell/key-bindings.zsh" fzf.zsh
newins "${S}/shell/key-bindings.fish" fzf.fish
# The upstream method of doing this adds the fzf source directory to Vim's
# runtime path, meaning it can find both the fzf executable and
# plugins/fzf.vim. The below achieves the same thing by putting fzf.vim in
# Vim's main plugin directory, and by symlinking from the Vim directory to
# the fzf executable.
insinto /usr/share/vim/vimfiles/plugin
doins "${S}/plugin/fzf.vim"
dosym /usr/bin/fzf /usr/share/vim/vimfiles
doman "${S}/man/man1/fzf.1"
}
# TODO: The test scripts are currently disabled. There are two scripts that
# could be enabled:
#
# - test_go.rb: I've run this but it has a lot of failures, despite the main
# code working. If it is to be enabled, to run at all it needs
# ruby(minitest) v5.x (Cygwin currently offers both v4.x and v5.x -- make
# sure to get the right one), ncurses and tmux.
#
# - fzf.vader: This appears to be a Vim test script using vader.vim from
# https://github.com/junegunn/vader.vim.
src_test () {
:
}