]>
Commit | Line | Data |
---|---|---|
e15e858d | 1 | %define crates_ver 13.0.0 |
fa9e9502 JP |
2 | |
3 | Summary: Line oriented search tool using Rust's regex library | |
4 | Name: ripgrep | |
e15e858d JP |
5 | Version: 13.0.0 |
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 | |
e15e858d | 10 | # Source0-md5: 3080265a3ccc09bdc0c81527b09afa15 |
fa9e9502 JP |
11 | # ./create-crates.sh |
12 | Source1: %{name}-crates-%{crates_ver}.tar.xz | |
e15e858d | 13 | # Source1-md5: d90b40dc4c17db0cabc45ca3419c28bc |
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 | ||
fa9e9502 JP |
56 | %prep |
57 | %setup -q -a1 | |
58 | ||
59 | %{__mv} %{name}-%{crates_ver}/* . | |
60 | sed -i -e 's/@@VERSION@@/%{version}/' Cargo.lock | |
61 | ||
62 | # use our offline registry | |
63 | export CARGO_HOME="$(pwd)/.cargo" | |
64 | ||
65 | mkdir -p "$CARGO_HOME" | |
66 | cat >.cargo/config <<EOF | |
67 | [source.crates-io] | |
68 | registry = 'https://github.com/rust-lang/crates.io-index' | |
69 | replace-with = 'vendored-sources' | |
70 | ||
71 | [source.vendored-sources] | |
72 | directory = '$PWD/vendor' | |
73 | EOF | |
74 | ||
75 | %build | |
76 | export CARGO_HOME="$(pwd)/.cargo" | |
77 | ||
78 | %cargo_build --frozen | |
79 | ||
80 | %install | |
81 | rm -rf $RPM_BUILD_ROOT | |
82 | export CARGO_HOME="$(pwd)/.cargo" | |
83 | ||
84 | %cargo_install --frozen --root $RPM_BUILD_ROOT%{_prefix} --path $PWD | |
0835f935 JP |
85 | install -D %{cargo_outdir}/release/build/%{name}-*/out/rg.1 $RPM_BUILD_ROOT%{_mandir}/man1/rg.1 |
86 | install -D %{cargo_outdir}/release/build/%{name}-*/out/rg.bash $RPM_BUILD_ROOT%{bash_compdir}/rg | |
87 | install -D %{cargo_outdir}/release/build/%{name}-*/out/rg.fish $RPM_BUILD_ROOT%{fish_compdir}/rg.fish | |
59fdbee3 | 88 | |
fa9e9502 JP |
89 | %{__rm} $RPM_BUILD_ROOT%{_prefix}/.crates* |
90 | ||
91 | %clean | |
92 | rm -rf $RPM_BUILD_ROOT | |
93 | ||
94 | %files | |
95 | %defattr(644,root,root,755) | |
96 | %doc CHANGELOG.md COPYING FAQ.md GUIDE.md LICENSE-MIT README.md UNLICENSE | |
97 | %attr(755,root,root) %{_bindir}/rg | |
59fdbee3 JP |
98 | %{_mandir}/man1/rg.1* |
99 | ||
100 | %files -n bash-completion-ripgrep | |
101 | %defattr(644,root,root,755) | |
102 | %{bash_compdir}/rg | |
103 | ||
104 | %files -n fish-completion-ripgrep | |
105 | %defattr(644,root,root,755) | |
106 | %{fish_compdir}/rg.fish |