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