File gtkwhats.spec of Package gtkwhats

#
# spec file for package gtkwhats
#
# Copyright (c) 2020 SUSE LLC
#
# 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/
#

%define appname com.gigitux.gtkwhats
Name:           gtkwhats
Version:        1.0
Release:        0
Summary:        A simple wrapper written in rust and gtk-rs for whatsapp web
License:        Unlicense
URL:            https://github.com/gigitux/gtkwhats
Source0:        %{name}-%{version}.tar.gz
Source1:        vendor.tar.xz
BuildRequires:  fdupes
BuildRequires:  cargo-packaging
BuildRequires:  update-desktop-files
BuildRequires:  pkgconfig
BuildRequires:  pkgconfig(atk)
BuildRequires:  pkgconfig(gdk-3.0)
BuildRequires:  pkgconfig(glib-2.0)
BuildRequires:  pkgconfig(libsoup-2.4)
BuildRequires:  pkgconfig(pango)
BuildRequires:  pkgconfig(gdk-pixbuf-2.0)
BuildRequires:  pkgconfig(cairo-gobject)
BuildRequires:  pkgconfig(webkit2gtk-4.0)

%description
A simple wrapper written in rust and gtk-rs for whatsapp web with toggle for dark theme.

%prep
%setup -qa1
mkdir -p .cargo
cat >.cargo/config <<EOF
[source.crates-io]
replace-with = "vendored-sources"

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

%build
cargo build --release --locked %{?_smp_mflags}

%install
cargo install --root=%{buildroot}%{_prefix} --path .
mkdir -p %{buildroot}%{_datadir}/icons/hicolor/scalable/apps
mkdir -p %{buildroot}%{_datadir}/pixmaps
mkdir -p %{buildroot}%{_datadir}/applications
mkdir -p %{buildroot}%{_datadir}/glib-2.0/schemas/
mkdir -p %{buildroot}%{_datadir}/metainfo/
%__install -m 0644 data/com.gigitux.gtkwhats.desktop %{buildroot}%{_datadir}/applications/com.gigitux.gtkwhats.desktop
%__install -m 0644 data/com.gigitux.gtkwhats.gschema.xml %{buildroot}%{_datadir}/glib-2.0/schemas/com.gigitux.gtkwhats.gschema.xml
%__install -m 0644 data/com.gigitux.gtkwhats.metainfo.xml %{buildroot}%{_datadir}/metainfo/com.gigitux.gtkwhats.metainfo.xml
%__install -m 0644 data/com.gigitux.gtkwhats.svg %{buildroot}%{_datadir}/icons/hicolor/scalable/apps/com.gigitux.gtkwhats.svg
%__install -m 0644 data/com.gigitux.gtkwhats.svg %{buildroot}%{_datadir}/pixmaps/com.gigitux.gtkwhats.svg

# remove residue crate file
rm %{buildroot}%{_prefix}/.crates.toml
rm %{buildroot}%{_prefix}/.crates2.json
%suse_update_desktop_file -r %{appname} "GTK;GNOME;Network;InstantMessaging"

%fdupes %{buildroot}%{_prefix}

%files
%doc README.md
%{_bindir}/gtkwhats
%{_datadir}/applications
%{_datadir}/glib-2.0/schemas/
%{_datadir}/metainfo/
%{_datadir}/icons/hicolor
%{_datadir}/icons/hicolor/*/*/*.svg
%{_datadir}/pixmaps/*.svg

%changelog

openSUSE Build Service is sponsored by