File ckb.spec of Package ckb

#
# spec file for package ckb
#
# 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/
#


Name:           ckb
Version:        0.2.6
Release:        0
Summary:        RGB Driver for Linux and OS X
License:        GPL-2.0
Group:          Libraries/Hardware
Url:            https://github.com/ccMSC/ckb
Source:         https://github.com/ccMSC/ckb/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz
Patch0:         ckb-external-quazip.patch
Patch1:         ckb-use-var-run.patch
BuildRequires:  libqt5-qtbase-devel >= 5.2
BuildRequires:  libudev-devel
%if 0%{?suse_version} > 1320
BuildRequires:  quazip-qt5-devel
%endif
BuildRequires:  systemd-rpm-macros
BuildRequires:  update-desktop-files
BuildRequires:  zlib-devel
%{systemd_requires}
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
ckb is an open-source driver for Corsair keyboards and mice. It aims to bring
the features of their proprietary CUE software to the Linux and Mac operating
systems. This project is currently a work in progress, but it already supports
much of the same functionality, including full RGB animations.

%prep
%setup -q
%if 0%{?suse_version} > 1320
%patch0 -p1
%endif
%patch1 -p1
sed -e 's|QApplication::applicationDirPath()|"%{_libexecdir}/"|' -i src/ckb/animscript.cpp
sed -e '/^ExecStart/cExecStart=%{_libexecdir}/ckb-daemon' -i service/systemd/ckb-daemon.service

%build
%qmake5
%make_jobs

%install
install -D -m 755 bin/ckb %{buildroot}%{_bindir}/ckb
install -D -m 755 bin/ckb-daemon %{buildroot}%{_libexecdir}/ckb-daemon
install -d %{buildroot}%{_libexecdir}/ckb-animations
install -m 755 bin/ckb-animations/* %{buildroot}%{_libexecdir}/ckb-animations
install -m 644 -D usr/ckb.desktop %{buildroot}%{_datadir}/applications/ckb.desktop
install -m 644 -D usr/ckb.png %{buildroot}%{_datadir}/icons/hicolor/512x512/apps/ckb.png
install -m 644 -D service/systemd/ckb-daemon.service %{buildroot}%{_unitdir}/ckb-daemon.service
mkdir %{buildroot}%{_sbindir}
ln -sf service %{buildroot}%{_sbindir}/rcckb-daemon
%suse_update_desktop_file -r ckb Settings HardwareSettings

%pre
%service_add_pre ckb-daemon.service

%post
%service_add_post ckb-daemon.service

%preun
%service_del_preun ckb-daemon.service

%postun
%service_del_postun ckb-daemon.service

%files
%defattr(-,root,root)
%doc BUILD.md DAEMON.md FIRMWARE LICENSE README.md
%{_bindir}/ckb
%{_sbindir}/rcckb-daemon
%{_libexecdir}/ckb-daemon
%{_libexecdir}/ckb-animations
%{_unitdir}/ckb-daemon.service
%{_datadir}/applications/ckb.desktop
%dir %{_datadir}/icons/hicolor
%dir %{_datadir}/icons/hicolor/512x512
%dir %{_datadir}/icons/hicolor/512x512/apps
%{_datadir}/icons/hicolor/512x512/apps/ckb.png

%changelog
openSUSE Build Service is sponsored by