]>
Commit | Line | Data |
---|---|---|
42412a30 | 1 | %define crates_ver 0.8.0 |
0dc3cd0e JP |
2 | |
3 | Summary: A smarter cd command | |
4 | Name: zoxide | |
42412a30 | 5 | Version: 0.8.0 |
0dc3cd0e JP |
6 | Release: 1 |
7 | License: MIT | |
8 | Group: Applications | |
9 | Source0: https://github.com/ajeetdsouza/zoxide/archive/v%{version}/%{name}-%{version}.tar.gz | |
42412a30 | 10 | # Source0-md5: 6783966c8e57061bc3f1d0579410f88d |
0dc3cd0e JP |
11 | # ./create-crates.sh |
12 | Source1: %{name}-crates-%{crates_ver}.tar.xz | |
42412a30 | 13 | # Source1-md5: 2850666699cb60867f03368f608988ee |
0dc3cd0e JP |
14 | URL: https://github.com/ajeetdsouza/zoxide |
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 | ||
23 | %description | |
24 | zoxide is a blazing fast replacement for your cd command, inspired by | |
25 | z and z.lua. It keeps track of the directories you use most | |
26 | frequently, and uses a ranking algorithm to navigate to the best | |
27 | match. | |
28 | ||
29 | %package -n bash-completion-zoxide | |
30 | Summary: bash-completion for zoxide | |
31 | Group: Applications/Shells | |
32 | Requires: %{name} = %{version}-%{release} | |
33 | Requires: bash-completion >= 2.0 | |
34 | BuildArch: noarch | |
35 | ||
36 | %description -n bash-completion-zoxide | |
37 | This package provides bash-completion for zoxide. | |
38 | ||
39 | %package -n fish-completion-zoxide | |
40 | Summary: Fish completion for zoxide command | |
41 | Group: Applications/Shells | |
42 | Requires: %{name} = %{version}-%{release} | |
43 | Requires: fish | |
44 | BuildArch: noarch | |
45 | ||
46 | %description -n fish-completion-zoxide | |
47 | Fish completion for zoxide command. | |
48 | ||
49 | %package -n zsh-completion-zoxide | |
50 | Summary: Zsh completion for zoxide command | |
51 | Group: Applications/Shells | |
52 | Requires: %{name} = %{version}-%{release} | |
53 | Requires: zsh | |
54 | BuildArch: noarch | |
55 | ||
56 | %description -n zsh-completion-zoxide | |
57 | Zsh completion for zoxide command. | |
58 | ||
59 | %prep | |
60 | %setup -q -a1 | |
61 | ||
62 | %{__mv} zoxide-%{crates_ver}/* . | |
63 | sed -i -e 's/@@VERSION@@/%{version}/' Cargo.lock | |
64 | ||
65 | # use our offline registry | |
66 | export CARGO_HOME="$(pwd)/.cargo" | |
67 | ||
68 | mkdir -p "$CARGO_HOME" | |
69 | cat >.cargo/config <<EOF | |
70 | [source.crates-io] | |
71 | registry = 'https://github.com/rust-lang/crates.io-index' | |
72 | replace-with = 'vendored-sources' | |
73 | ||
74 | [source.vendored-sources] | |
75 | directory = '$PWD/vendor' | |
76 | EOF | |
77 | ||
78 | %build | |
79 | export CARGO_HOME="$(pwd)/.cargo" | |
80 | ||
81 | %cargo_build --frozen | |
82 | ||
83 | %install | |
84 | rm -rf $RPM_BUILD_ROOT | |
85 | export CARGO_HOME="$(pwd)/.cargo" | |
86 | ||
87 | %cargo_install --frozen --root $RPM_BUILD_ROOT%{_prefix} --path $PWD | |
88 | %{__rm} $RPM_BUILD_ROOT%{_prefix}/.crates* | |
89 | ||
90 | install -Dp contrib/completions/zoxide.bash $RPM_BUILD_ROOT%{bash_compdir}/zoxide | |
91 | install -Dp contrib/completions/zoxide.fish $RPM_BUILD_ROOT%{fish_compdir}/zoxide.fish | |
92 | install -Dp contrib/completions/_zoxide $RPM_BUILD_ROOT%{zsh_compdir}/_zoxide | |
93 | ||
94 | %clean | |
95 | rm -rf $RPM_BUILD_ROOT | |
96 | ||
97 | %files | |
98 | %defattr(644,root,root,755) | |
99 | %doc CHANGELOG.md README.md | |
100 | %attr(755,root,root) %{_bindir}/zoxide | |
101 | ||
102 | %files -n bash-completion-zoxide | |
103 | %defattr(644,root,root,755) | |
104 | %{bash_compdir}/zoxide | |
105 | ||
106 | %files -n fish-completion-%{name} | |
107 | %defattr(644,root,root,755) | |
108 | %{fish_compdir}/zoxide.fish | |
109 | ||
110 | %files -n zsh-completion-%{name} | |
111 | %defattr(644,root,root,755) | |
112 | %{zsh_compdir}/_zoxide |