File pijul.spec of Package pijul

#
# spec file for package pijul
#
# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via https://bugs.opensuse.org/
#


Name:           pijul
Version:        0.12.2
Release:        0
Summary:        Distributed version control system based on a theory of patches
License:        GPL-2.0-only
Group:          Development/Tools/Version Control
URL:            https://pijul.org/
Source0:        https://crates.io/api/v1/crates/pijul/%{version}/download#/%{name}-%{version}.tar.gz
Source1:        vendor.tar.xz
BuildRequires:  cargo
BuildRequires:  clang-devel
BuildRequires:  pkgconfig
BuildRequires:  rust
BuildRequires:  rust-std
BuildRequires:  pkgconfig(libsodium)
BuildRequires:  pkgconfig(nettle)
BuildRequires:  pkgconfig(openssl)

%description
Pijul is a distributed version control system. Its distinctive feature is to be
based on a theory of patches, which makes it really distributed.

%package bash-completion
Summary:        Bash completion for pijul
Group:          System/Shells
Requires:       bash-completion
Supplements:    packageand(%{name}:bash)
BuildArch:      noarch

%description bash-completion
The Bash completion script, generated by pijul's generate-completions subcommand.

%package fish-completion
Summary:        fish completion for pijul
Group:          System/Shells
Supplements:    packageand(%{name}:fish)
BuildArch:      noarch

%description fish-completion
The fish completion script, generated by pijul's generate-completions subcommand.

%package zsh-completion
Summary:        Zsh completion for pijul
Group:          System/Shells
Supplements:    packageand(%{name}:zsh)
BuildArch:      noarch

%description zsh-completion
The Zsh completion script, generated by pijul's generate-completions subcommand.

%prep
%setup -qa1
mkdir cargo-home
cat >cargo-home/config <<EOF

[source.crates-io]
registry = 'https://github.com/rust-lang/crates.io-index'
replace-with = 'vendored-sources'
[source.vendored-sources]
directory = './vendor'
EOF
%ifarch aarch64 ppc64le
# Save config.guess to restore it
mv ./vendor/backtrace-sys/src/libbacktrace/config.guess ./vendor/backtrace-sys/src/libbacktrace/config.guess.save
%endif

%build
%ifarch aarch64 ppc64le
# Restore config.guess
mv ./vendor/backtrace-sys/src/libbacktrace/config.guess.save ./vendor/backtrace-sys/src/libbacktrace/config.guess
%endif
export CARGO_HOME=`pwd`/cargo-home/
cargo build --release %{?_smp_mflags}

%install
target/release/pijul generate-completions --bash > pijul.bash
target/release/pijul generate-completions --zsh > pijul.zsh
target/release/pijul generate-completions --fish > pijul.fish

install -Dm0755 target/release/pijul %{buildroot}%{_bindir}/pijul
install -Dm0644 pijul.bash %{buildroot}%{_datadir}/bash-completion/completions/pijul
install -Dm0644 pijul.fish %{buildroot}%{_datadir}/fish/vendor_completions.d/pijul.fish
install -Dm0644 pijul.zsh %{buildroot}%{_datadir}/zsh/site-functions/_pijul

%files
%license COPYING
%{_bindir}/pijul

%files bash-completion
%{_datadir}/bash-completion

%files fish-completion
%{_datadir}/fish

%files zsh-completion
%{_datadir}/zsh

%changelog
openSUSE Build Service is sponsored by