File timeit.spec of Package timeit

#
# spec file for package timeit
#
# Copyright (c) 2016 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 http://bugs.opensuse.org/
#


%define srcname TimeIT
Name:           timeit
Version:        1.9.9.22
Release:        0
Summary:        The unobtrusive time tracker
License:        GPL-3.0
Group:          Productivity/Other
Url:            http://hoglet.github.io/TimeIT/
Source0:        https://github.com/Hoglet/TimeIT/archive/%{version}.tar.gz#/%{srcname}-%{version}.tar.gz
# PATCH-FIX-OPENSUSE cmake.patch avvissu@yandex.ru -- Don't use git in OBS
Patch0:         timeit-1.9.9.22_cmake.patch
# PATCH-FIX-OPENSUSE doc.patch avvissu@yandex.ru -- Change path to doc
Patch1:         timeit-1.9.9.22_doc.patch
# PATCH-FIX-UPSTREAM flags.patch avvissu@yandex.ru -- Use optflags
Patch2:         TimeIT-1.9.9.22_flags.patch
BuildRequires:  cmake
BuildRequires:  gcc-c++
BuildRequires:  hicolor-icon-theme
BuildRequires:  pkg-config
BuildRequires:  update-desktop-files
BuildRequires:  pkgconfig(gtkmm-2.4)
BuildRequires:  pkgconfig(jansson)
BuildRequires:  pkgconfig(libcurl)
BuildRequires:  pkgconfig(libnotify)
BuildRequires:  pkgconfig(sqlite3)
BuildRequires:  pkgconfig(xscrnsaver)
BuildRequires:  fdupes
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
TimeIT is a time tracker that aims to be unobtrusive and simple to use. It
has Workspace tracking, Idle detection, hierarchical tasks and can show
summaries over day/week/month.

%lang_package

%prep
%setup -q -n %{srcname}-%{version}
%patch0 -p1
%patch1 -p1
%patch2 -p1

echo "constexpr auto VERSION = \"%{version}\";" > src/version.h

%build
CFLAGS="%{optflags} -fPIC"
export CFLAGS="${CFLAGS/ -fPIE/}"
export CXXFLAGS="$CFLAGS"
%cmake \
	-DOPT_CXX_FLAGS="$CXXFLAGS"

make %{?_smp_mflags}

%install
%cmake_install

install -Dm0644 %{buildroot}%{_datadir}/{pixmaps/,icons/hicolor/scalable/apps}/%{name}.svg
rm -f %{buildroot}%{_datadir}/pixmaps/%{name}.svg
%suse_update_desktop_file -r %{name} Utility TimeUtility

%find_lang %{name}

%fdupes -s %{buildroot}%{_datadir}

%post
%icon_theme_cache_post
%desktop_database_post 

%postun
%icon_theme_cache_postun
%desktop_database_postun

%files
%defattr(-,root,root)
%doc AUTHORS COPYING README
%{_bindir}/%{name}
%{_datadir}/%{name}/
%{_datadir}/icons/hicolor/*/apps/%{name}.svg
%{_datadir}/applications/%{name}.desktop
%{_mandir}/man1/%{name}.1%{ext_info}

%files lang -f %{name}.lang
%defattr(-,root,root)

%changelog
openSUSE Build Service is sponsored by