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