3 %bcond_without system_libgit2 # use system installed libgit2
5 %define crates_ver 0.17.0
7 Summary: A viewer for git and diff output
13 Source0: https://github.com/dandavison/delta/archive/%{version}/%{name}-%{version}.tar.gz
14 # Source0-md5: 323ef94cc3d9c0b21691ecc5e250708f
15 Source1: %{name}-crates-%{crates_ver}.tar.xz
16 # Source1-md5: c32b2651ccef34736929edaca477a269
17 URL: https://github.com/dandavison/delta
19 %if %{with system_libgit2}
20 BuildRequires: libgit2-devel < 1.8.0
21 BuildRequires: libgit2-devel >= 1.7.2
23 BuildRequires: oniguruma-devel >= 6.9.8
24 BuildRequires: pkgconfig
25 BuildRequires: rpmbuild(macros) >= 2.004
27 BuildRequires: rust-bindgen
28 BuildRequires: tar >= 1:1.22
30 %{?with_system_libgit2:Requires: libgit2 >= 1.7.2}
31 Requires: oniguruma >= 6.9.8
32 ExclusiveArch: %{rust_arches}
33 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
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
42 Delta's main features are:
44 - Language syntax highlighting with color themes
45 - Within-line highlights based on a Levenshtein edit inference
47 - Style (foreground color, background color, font attributes) can be
48 configured independently for more than 20 different sections of the
50 - Stylable box/line decorations to draw attention to commit, file and
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
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
63 %{__mv} delta-%{crates_ver}/* .
64 sed -i -e 's/@@VERSION@@/%{version}/' Cargo.lock
66 # use our offline registry
67 export CARGO_HOME="$(pwd)/.cargo"
69 mkdir -p "$CARGO_HOME"
70 cat >.cargo/config <<EOF
72 registry = 'https://github.com/rust-lang/crates.io-index'
73 replace-with = 'vendored-sources'
75 [source.vendored-sources]
76 directory = '$PWD/vendor'
80 export CARGO_HOME="$(pwd)/.cargo"
81 export RUSTONIG_SYSTEM_LIBONIG=true
86 rm -rf $RPM_BUILD_ROOT
87 export CARGO_HOME="$(pwd)/.cargo"
89 export RUSTONIG_SYSTEM_LIBONIG=true
90 %cargo_install --frozen --root $RPM_BUILD_ROOT%{_prefix} --path $PWD
91 %{__rm} $RPM_BUILD_ROOT%{_prefix}/.crates*
94 rm -rf $RPM_BUILD_ROOT
97 %defattr(644,root,root,755)
99 %attr(755,root,root) %{_bindir}/delta