]>
Commit | Line | Data |
---|---|---|
4f5a4b9f | 1 | %define crates_ver 14.0.1 |
fa9e9502 JP |
2 | |
3 | Summary: Line oriented search tool using Rust's regex library | |
4 | Name: ripgrep | |
4f5a4b9f | 5 | Version: 14.0.1 |
e15e858d | 6 | Release: 1 |
fa9e9502 JP |
7 | License: MIT or Unlicense |
8 | Group: Applications | |
9 | Source0: https://github.com/BurntSushi/ripgrep/archive/%{version}/%{name}-%{version}.tar.gz | |
4f5a4b9f | 10 | # Source0-md5: 882f59eeb8570ed197d0deb8d3af6cb9 |
fa9e9502 JP |
11 | # ./create-crates.sh |
12 | Source1: %{name}-crates-%{crates_ver}.tar.xz | |
4f5a4b9f | 13 | # Source1-md5: a97838e28c2ed389073daae4fae68870 |
fa9e9502 JP |
14 | URL: https://github.com/BurntSushi/ripgrep |
15 | BuildRequires: cargo | |
16 | BuildRequires: rpmbuild(macros) >= 2.004 | |
33f1e1d4 | 17 | BuildRequires: ruby-asciidoctor |
fa9e9502 JP |
18 | BuildRequires: rust |
19 | BuildRequires: tar >= 1:1.22 | |
20 | BuildRequires: xz | |
21 | ExclusiveArch: %{rust_arches} | |
22 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) | |
23 | ||
0835f935 JP |
24 | %ifarch x32 |
25 | %define cargo_outdir target/x86_64-unknown-linux-gnux32 | |
26 | %else | |
27 | %define cargo_outdir target | |
28 | %endif | |
29 | ||
fa9e9502 JP |
30 | %description |
31 | ripgrep is a line-oriented search tool that recursively searches your | |
32 | current directory for a regex pattern. By default, ripgrep will | |
33 | respect your .gitignore and automatically skip hidden | |
34 | files/directories and binary files. | |
35 | ||
59fdbee3 JP |
36 | %package -n bash-completion-ripgrep |
37 | Summary: Bash completion for ripgrep | |
38 | Group: Applications/Shells | |
39 | Requires: %{name} = %{version}-%{release} | |
40 | Requires: bash-completion >= 2.0 | |
41 | BuildArch: noarch | |
42 | ||
43 | %description -n bash-completion-ripgrep | |
44 | Bash completion for ripgrep. | |
45 | ||
46 | %package -n fish-completion-ripgrep | |
47 | Summary: fish-completion for ripgrep | |
48 | Group: Applications/Shells | |
49 | Requires: %{name} = %{version}-%{release} | |
50 | Requires: fish | |
51 | BuildArch: noarch | |
52 | ||
53 | %description -n fish-completion-ripgrep | |
54 | fish-completion for ripgrep. | |
55 | ||
451e5449 JP |
56 | %package -n zsh-completion-ripgrep |
57 | Summary: Zsh completion for rg command | |
58 | Group: Applications/Shells | |
59 | Requires: %{name} = %{version}-%{release} | |
60 | Requires: zsh | |
61 | BuildArch: noarch | |
62 | ||
63 | %description -n zsh-completion-ripgrep | |
64 | Zsh completion for rg command. | |
65 | ||
fa9e9502 JP |
66 | %prep |
67 | %setup -q -a1 | |
68 | ||
69 | %{__mv} %{name}-%{crates_ver}/* . | |
70 | sed -i -e 's/@@VERSION@@/%{version}/' Cargo.lock | |
71 | ||
72 | # use our offline registry | |
73 | export CARGO_HOME="$(pwd)/.cargo" | |
74 | ||
75 | mkdir -p "$CARGO_HOME" | |
76 | cat >.cargo/config <<EOF | |
77 | [source.crates-io] | |
78 | registry = 'https://github.com/rust-lang/crates.io-index' | |
79 | replace-with = 'vendored-sources' | |
80 | ||
81 | [source.vendored-sources] | |
82 | directory = '$PWD/vendor' | |
83 | EOF | |
84 | ||
85 | %build | |
86 | export CARGO_HOME="$(pwd)/.cargo" | |
87 | ||
88 | %cargo_build --frozen | |
89 | ||
90 | %install | |
91 | rm -rf $RPM_BUILD_ROOT | |
92 | export CARGO_HOME="$(pwd)/.cargo" | |
93 | ||
4f5a4b9f JP |
94 | install -d $RPM_BUILD_ROOT{%{_mandir}/man1,%{bash_compdir},%{fish_compdir},%{zsh_compdir}} |
95 | ||
fa9e9502 | 96 | %cargo_install --frozen --root $RPM_BUILD_ROOT%{_prefix} --path $PWD |
4f5a4b9f JP |
97 | $RPM_BUILD_ROOT%{_bindir}/rg --generate man > $RPM_BUILD_ROOT%{_mandir}/man1/rg.1 |
98 | $RPM_BUILD_ROOT%{_bindir}/rg --generate complete-bash > $RPM_BUILD_ROOT%{bash_compdir}/rg | |
99 | $RPM_BUILD_ROOT%{_bindir}/rg --generate complete-fish > $RPM_BUILD_ROOT%{fish_compdir}/rg.fish | |
100 | $RPM_BUILD_ROOT%{_bindir}/rg --generate complete-zsh > $RPM_BUILD_ROOT%{zsh_compdir}/_rg | |
59fdbee3 | 101 | |
fa9e9502 JP |
102 | %{__rm} $RPM_BUILD_ROOT%{_prefix}/.crates* |
103 | ||
104 | %clean | |
105 | rm -rf $RPM_BUILD_ROOT | |
106 | ||
107 | %files | |
108 | %defattr(644,root,root,755) | |
109 | %doc CHANGELOG.md COPYING FAQ.md GUIDE.md LICENSE-MIT README.md UNLICENSE | |
110 | %attr(755,root,root) %{_bindir}/rg | |
59fdbee3 JP |
111 | %{_mandir}/man1/rg.1* |
112 | ||
113 | %files -n bash-completion-ripgrep | |
114 | %defattr(644,root,root,755) | |
115 | %{bash_compdir}/rg | |
116 | ||
117 | %files -n fish-completion-ripgrep | |
118 | %defattr(644,root,root,755) | |
119 | %{fish_compdir}/rg.fish | |
451e5449 JP |
120 | |
121 | %files -n zsh-completion-ripgrep | |
122 | %defattr(644,root,root,755) | |
123 | %{zsh_compdir}/_rg |