1 %define crates_ver 12.1.1
3 Summary: Line oriented search tool using Rust's regex library
7 License: MIT or Unlicense
9 Source0: https://github.com/BurntSushi/ripgrep/archive/%{version}/%{name}-%{version}.tar.gz
10 # Source0-md5: d3190853d47d51ad077a65aadbf55448
12 Source1: %{name}-crates-%{crates_ver}.tar.xz
13 # Source1-md5: 9edecedd92d2a028eff4d41fb3d8a800
14 URL: https://github.com/BurntSushi/ripgrep
16 BuildRequires: rpmbuild(macros) >= 2.004
18 BuildRequires: tar >= 1:1.22
20 ExclusiveArch: %{rust_arches}
21 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
24 %define cargo_outdir target/x86_64-unknown-linux-gnux32
26 %define cargo_outdir target
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.
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
42 %description -n bash-completion-ripgrep
43 Bash completion for ripgrep.
45 %package -n fish-completion-ripgrep
46 Summary: fish-completion for ripgrep
47 Group: Applications/Shells
48 Requires: %{name} = %{version}-%{release}
52 %description -n fish-completion-ripgrep
53 fish-completion for ripgrep.
58 %{__mv} %{name}-%{crates_ver}/* .
59 sed -i -e 's/@@VERSION@@/%{version}/' Cargo.lock
61 # use our offline registry
62 export CARGO_HOME="$(pwd)/.cargo"
64 mkdir -p "$CARGO_HOME"
65 cat >.cargo/config <<EOF
67 registry = 'https://github.com/rust-lang/crates.io-index'
68 replace-with = 'vendored-sources'
70 [source.vendored-sources]
71 directory = '$PWD/vendor'
75 export CARGO_HOME="$(pwd)/.cargo"
80 rm -rf $RPM_BUILD_ROOT
81 export CARGO_HOME="$(pwd)/.cargo"
83 %cargo_install --frozen --root $RPM_BUILD_ROOT%{_prefix} --path $PWD
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
88 %{__rm} $RPM_BUILD_ROOT%{_prefix}/.crates*
91 rm -rf $RPM_BUILD_ROOT
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
99 %files -n bash-completion-ripgrep
100 %defattr(644,root,root,755)
103 %files -n fish-completion-ripgrep
104 %defattr(644,root,root,755)
105 %{fish_compdir}/rg.fish