]> git.pld-linux.org Git - packages/ripgrep.git/blob - ripgrep.spec
up to 14.1.0
[packages/ripgrep.git] / ripgrep.spec
1 %define         crates_ver      14.1.0
2
3 Summary:        Line oriented search tool using Rust's regex library
4 Name:           ripgrep
5 Version:        14.1.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:  ad6b5631a459fd20c257ca20a7eeaf73
11 Source1:        %{name}-crates-%{crates_ver}.tar.xz
12 # Source1-md5:  6e62a710679f4101c354882d01692041
13 URL:            https://github.com/BurntSushi/ripgrep
14 BuildRequires:  cargo
15 BuildRequires:  rpm-build >= 4.6
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 >= 1: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 install -d $RPM_BUILD_ROOT{%{_mandir}/man1,%{bash_compdir},%{fish_compdir},%{zsh_compdir}}
95
96 %cargo_install --frozen --root $RPM_BUILD_ROOT%{_prefix} --path $PWD
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
101
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
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
120
121 %files -n zsh-completion-ripgrep
122 %defattr(644,root,root,755)
123 %{zsh_compdir}/_rg
This page took 0.129941 seconds and 3 git commands to generate.