File alacritty.spec of Package alacritty

#
# spec file for package alacritty
#
# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
# Copyright (c) 2018 zzndb <emricg2@gmail.com>
#
# 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 http://bugs.opensuse.org/
#


Name:           alacritty
Version:        0.4.1
Release:        0
Summary:        A cross-platform, GPU-accelerated terminal emulator
License:        Apache-2.0
Group:          System/X11/Terminals
Url:            https://github.com/jwilm/alacritty
Source:         %{name}-%{version}.tar.gz
Source1:        vendor.tar.gz
BuildRequires:  cargo
BuildRequires:  rust >= 1.41.0
BuildRequires:  rust-std-static
BuildRequires:  cmake 
BuildRequires:  freetype-devel
BuildRequires:  fontconfig-devel
BuildRequires:  libxcb-devel
Obsoletes:      alacritty < %{version}
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
Alacritty is the fastest terminal emulator in existence. Using the GPU for 
rendering enables optimizations that simply aren't possible in other emulators. 

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

%description bash-completion
The official bash completion script for alacritty. It includes support
for every argument that can currently be passed to alacritty.

%package fish-completion
Summary:        Fish Completion for %{name}
Group:          System/X11/Terminals
Supplements:    packageand(%{name}:fish)
BuildArch:      noarch

%description fish-completion
The official fish completion script for alacritty.

%package zsh-completion
Summary:        ZSH Completion for %{name}
Group:          System/X11/Terminals
Supplements:    packageand(%{name}:zsh)
BuildArch:      noarch

%description zsh-completion
The official zsh completion script for alacritty.

%prep
%setup -q -n %{name}-%{version} -a1
mkdir cargo-home
cat >cargo-home/config <<EOF
[source.crates-io]
replace-with = "vendored-sources"

[source.vendored-sources]
directory = "vendor"
EOF

%build
export CARGO_HOME=$PWD/cargo-home
cargo build --release %{?_smp_mflags}

%install
export CARGO_HOME=$PWD/cargo-home
## cargo install --path . --root %{buildroot}%{_prefix}
install -Dm 0755 target/release/%{name} %{buildroot}%{_bindir}/%{name}

# rm duplicate license and useless toml file
rm -fr %{buildroot}%{_datadir}
## rm  %{buildroot}%{_prefix}/.crates.toml

# install man page desktop file and completions
install -Dm 0644 extra/%{name}.man %{buildroot}%{_mandir}/man1/%{name}.1
install -Dm 0644 extra/linux/Alacritty.desktop %{buildroot}%{_datadir}/applications/Alacritty.desktop
install -Dm 0644 extra/logo/%{name}-term.svg %{buildroot}%{_datadir}/icons/hicolor/scalable/apps/Alacritty.svg
install -Dm 0644 extra/completions/%{name}.bash %{buildroot}%{_datadir}/bash-completion/completions/%{name}
install -Dm 0644 extra/completions/%{name}.fish %{buildroot}%{_datadir}/fish/vendor_completions.d/%{name}.fish
install -Dm 0644 extra/completions/_%{name}  %{buildroot}%{_datadir}/zsh/site-functions/_%{name}

%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig

%files
%license LICENSE-APACHE
%doc CHANGELOG.md README.md alacritty.yml
%{_bindir}/%{name}
%{_mandir}/man1/%{name}.1%{?ext_man}
%{_datadir}/applications/Alacritty.desktop
%{_datadir}/icons/hicolor/scalable/apps/Alacritty.svg

%dir %{_datadir}/icons/hicolor/scalable/apps
%dir %{_datadir}/icons/hicolor
%dir %{_datadir}/icons/hicolor/scalable

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

%files fish-completion
%{_datadir}/fish

%files zsh-completion
%{_datadir}/zsh

%changelog
openSUSE Build Service is sponsored by