%global debug_package %{nil}

# Enable LTO
%global optflags        %{optflags} -flto=$(nproc)
%global build_ldflags   %{build_ldflags} -flto

%global commit      70f99da68aa7e396e46283d6014e158bb3409662
%global shortcommit %(c=%{commit}; echo ${c:0:7})
%global date        20180517

%global appname io.github.erikwallstrom.Crypto

Name:           crypto
Version:        0
Release:        1.%{date}git%{shortcommit}%{?dist}
Summary:        Cryptocurrency watcher made with GTK+3

License:        GPLv3+
URL:            https://gitlab.com/ErikWallstrom/Crypto
Source0:        %{url}/-/archive/%{commit}/%{name}-%{version}.%{date}git%{shortcommit}.tar.gz

BuildRequires:  desktop-file-utils
BuildRequires:  gcc
BuildRequires:  meson
BuildRequires:  pkgconfig(gtk+-3.0)
BuildRequires:  pkgconfig(json-glib-1.0)
BuildRequires:  pkgconfig(libcurl)
Requires:       hicolor-icon-theme

%description
Crypto - a cryptocurrency watcher made with GTK+3.

Crypto uses the CoinCap.io API to fetch up-to-date data about cryptocurrencies.

%prep
%autosetup -p1 -n Crypto-%{commit}

%build
%make_build

%install
install -D %{name} %{buildroot}%{_bindir}/%{name}
install -D -m 644 %{appname}.desktop %{buildroot}%{_datadir}/applications/%{appname}.desktop

%check
desktop-file-validate %{buildroot}%{_datadir}/applications/%{appname}.desktop

%files
%license LICENSE
%doc README.md
%{_bindir}/%{name}
%{_datadir}/applications/*.desktop

%changelog
* Mon Aug 12 2019 Artem Polishchuk <ego.cordatus@gmail.com> - 0-1.20180517git70f99da
- Initial package