]> git.pld-linux.org Git - packages/ripgrep.git/blob - ripgrep.spec
d63d8b039d1bcaa953483f4c49d5e43b60337526
[packages/ripgrep.git] / ripgrep.spec
1 %define         crates_ver      13.0.0
2
3 Summary:        Line oriented search tool using Rust's regex library
4 Name:           ripgrep
5 Version:        13.0.0
6 Release:        1
7 License:        MIT or Unlicense
8 Group:          Applications
9 Source0:        https://github.com/BurntSushi/ripgrep/archive/%{version}/%{name}-%{version}.tar.gz
10 # Source0-md5:  3080265a3ccc09bdc0c81527b09afa15
11 # ./create-crates.sh
12 Source1:        %{name}-crates-%{crates_ver}.tar.xz
13 # Source1-md5:  d90b40dc4c17db0cabc45ca3419c28bc
14 URL:            https://github.com/BurntSushi/ripgrep
15 BuildRequires:  cargo
16 BuildRequires:  rpmbuild(macros) >= 2.004
17 BuildRequires:  ruby-asciidoctor
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
24 %ifarch x32
25 %define         cargo_outdir    target/x86_64-unknown-linux-gnux32
26 %else
27 %define         cargo_outdir    target
28 %endif
29
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
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
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
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
94 %cargo_install --frozen --root $RPM_BUILD_ROOT%{_prefix} --path $PWD
95 install -D %{cargo_outdir}/release/build/%{name}-*/out/rg.1 $RPM_BUILD_ROOT%{_mandir}/man1/rg.1
96 install -D %{cargo_outdir}/release/build/%{name}-*/out/rg.bash $RPM_BUILD_ROOT%{bash_compdir}/rg
97 install -D %{cargo_outdir}/release/build/%{name}-*/out/rg.fish $RPM_BUILD_ROOT%{fish_compdir}/rg.fish
98 install -D complete/_rg $RPM_BUILD_ROOT%{zsh_compdir}/_rg
99
100 %{__rm} $RPM_BUILD_ROOT%{_prefix}/.crates*
101
102 %clean
103 rm -rf $RPM_BUILD_ROOT
104
105 %files
106 %defattr(644,root,root,755)
107 %doc CHANGELOG.md COPYING FAQ.md GUIDE.md LICENSE-MIT README.md UNLICENSE
108 %attr(755,root,root) %{_bindir}/rg
109 %{_mandir}/man1/rg.1*
110
111 %files -n bash-completion-ripgrep
112 %defattr(644,root,root,755)
113 %{bash_compdir}/rg
114
115 %files -n fish-completion-ripgrep
116 %defattr(644,root,root,755)
117 %{fish_compdir}/rg.fish
118
119 %files -n zsh-completion-ripgrep
120 %defattr(644,root,root,755)
121 %{zsh_compdir}/_rg
This page took 0.04549 seconds and 3 git commands to generate.