]>
Commit | Line | Data |
---|---|---|
c8b6b30d JP |
1 | # |
2 | # Conditional build: | |
3 | %bcond_without system_libgit2 # use system installed libgit2 | |
4 | ||
2b4de7b7 | 5 | %define crates_ver 0.17.0 |
4a2626ba | 6 | |
92a8f118 JP |
7 | Summary: A viewer for git and diff output |
8 | Name: delta | |
2b4de7b7 JP |
9 | Version: 0.17.0 |
10 | Release: 1 | |
92a8f118 JP |
11 | License: MIT |
12 | Group: Applications | |
13 | Source0: https://github.com/dandavison/delta/archive/%{version}/%{name}-%{version}.tar.gz | |
2b4de7b7 | 14 | # Source0-md5: 323ef94cc3d9c0b21691ecc5e250708f |
4a2626ba | 15 | Source1: %{name}-crates-%{crates_ver}.tar.xz |
2b4de7b7 | 16 | # Source1-md5: c32b2651ccef34736929edaca477a269 |
92a8f118 JP |
17 | URL: https://github.com/dandavison/delta |
18 | BuildRequires: cargo | |
c8b6b30d | 19 | %if %{with system_libgit2} |
2b4de7b7 JP |
20 | BuildRequires: libgit2-devel < 1.8.0 |
21 | BuildRequires: libgit2-devel >= 1.7.2 | |
c8b6b30d | 22 | %endif |
2b4de7b7 | 23 | BuildRequires: oniguruma-devel >= 6.9.8 |
e38c63a4 | 24 | BuildRequires: pkgconfig |
a311b6b6 | 25 | BuildRequires: rpmbuild(macros) >= 2.004 |
92a8f118 | 26 | BuildRequires: rust |
5efbe121 | 27 | BuildRequires: rust-bindgen |
c42db62c JP |
28 | BuildRequires: tar >= 1:1.22 |
29 | BuildRequires: xz | |
2b4de7b7 JP |
30 | %{?with_system_libgit2:Requires: libgit2 >= 1.7.2} |
31 | Requires: oniguruma >= 6.9.8 | |
a311b6b6 | 32 | ExclusiveArch: %{rust_arches} |
92a8f118 JP |
33 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) |
34 | ||
35 | %description | |
36 | Delta aims to make studying diffs both efficient and enjoyable: it | |
37 | allows you to make extensive changes to the layout and styling of | |
38 | diffs, as well as allowing you to stay arbitrarily close to the | |
39 | default git/diff output, changing just the aspects that you want to | |
40 | change. | |
41 | ||
42 | Delta's main features are: | |
43 | ||
44 | - Language syntax highlighting with color themes | |
45 | - Within-line highlights based on a Levenshtein edit inference | |
46 | algorithm | |
47 | - Style (foreground color, background color, font attributes) can be | |
48 | configured independently for more than 20 different sections of the | |
49 | diff | |
50 | - Stylable box/line decorations to draw attention to commit, file and | |
51 | hunk header sections. | |
52 | - Line numbering (`-n`) | |
53 | - `--diff-highlight` and `--diff-so-fancy` emulation modes | |
54 | - Code can be copied directly from the diff (`-/+` markers are removed | |
55 | by default). | |
56 | - `n` and `N` keybindings to move between files in large diffs, and | |
57 | between diffs in `log -p` views (`--navigate`) A viewer for git and | |
58 | diff output. | |
59 | ||
60 | %prep | |
4a2626ba JP |
61 | %setup -q -a1 |
62 | ||
63 | %{__mv} delta-%{crates_ver}/* . | |
64 | sed -i -e 's/@@VERSION@@/%{version}/' Cargo.lock | |
92a8f118 JP |
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" | |
52f29b20 | 81 | export RUSTONIG_SYSTEM_LIBONIG=true |
92a8f118 | 82 | |
e5a4ca85 | 83 | %cargo_build --frozen |
92a8f118 JP |
84 | |
85 | %install | |
86 | rm -rf $RPM_BUILD_ROOT | |
87 | export CARGO_HOME="$(pwd)/.cargo" | |
88 | ||
780dd575 | 89 | export RUSTONIG_SYSTEM_LIBONIG=true |
e5a4ca85 | 90 | %cargo_install --frozen --root $RPM_BUILD_ROOT%{_prefix} --path $PWD |
92a8f118 JP |
91 | %{__rm} $RPM_BUILD_ROOT%{_prefix}/.crates* |
92 | ||
93 | %clean | |
94 | rm -rf $RPM_BUILD_ROOT | |
95 | ||
96 | %files | |
97 | %defattr(644,root,root,755) | |
98 | %doc README.md | |
99 | %attr(755,root,root) %{_bindir}/delta |