File Clightd.spec of Package Clightd

#
# spec file for package Clightd
#
# Copyright (c) 2024 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/
#


%{!?_modulesloaddir: %define _modulesloaddir %(pkg-config --variable=modulesloaddir systemd)}
Name:           Clightd
Version:        5.9
Release:        0
Summary:        Bus interface to change screen brightness and capture frames from webcam
License:        GPL-3.0-or-later
Group:          System/Daemons
URL:            https://github.com/FedeDP/Clightd
Source0:        https://github.com/FedeDP/Clightd/archive/%{version}.tar.gz#/%{name}-%{version}.tar.gz
Source99:       %{name}-rpmlintrc
BuildRequires:  cmake >= 3.14
BuildRequires:  pkgconfig
BuildRequires:  pkgconfig(dbus-1)
BuildRequires:  pkgconfig(ddcutil) >= 0.9.5
BuildRequires:  pkgconfig(libdrm)
BuildRequires:  pkgconfig(libjpeg)
BuildRequires:  pkgconfig(libmodule) >= 5.0.0
BuildRequires:  pkgconfig(libsystemd) >= 221
BuildRequires:  pkgconfig(libudev)
BuildRequires:  pkgconfig(libusb-1.0)
BuildRequires:  pkgconfig(libiio)
BuildRequires:  pkgconfig(polkit-gobject-1)
BuildRequires:  pkgconfig(systemd)
BuildRequires:  pkgconfig(wayland-client)
BuildRequires:  pkgconfig(x11)
BuildRequires:  pkgconfig(xrandr)

%description
Clightd is a bus interface that lets you easily set/get screen brightness,
gamma temperature and display dpms state.
Moreover, it enables getting ambient brightness through webcam frames
capture or ALS devices.

%prep
%autosetup -p1

%build
%cmake \
     -DCMAKE_INSTALL_PREFIX=%{_prefix} \
     -DCMAKE_INSTALL_LIBDIR=%{_lib} \
     -DCMAKE_INSTALL_LIBEXECDIR=%{_libexecdir} \
     -DSYSTEMD_SERVICE_DIR=%{_unitdir} \
     -DDBUS_CONFIG_DIR=%{_datadir}/dbus-1/system.d \
     -DENABLE_DDC=ON \
     -DENABLE_GAMMA=ON \
     -DENABLE_DPMS=ON \
     -DENABLE_SCREEN=ON \
     -DENABLE_YOCTOLIGHT=ON
%cmake_build

%install
%cmake_install
mkdir -pv %{buildroot}%{_sbindir}
pushd %{buildroot}%{_sbindir}
  ln -s %{_sbindir}/service rcclightd
popd

%pre
%service_add_pre clightd.service

%post
%service_add_post clightd.service

%preun
%service_del_preun clightd.service

%postun
%service_del_postun clightd.service

%files
%license COPYING
%doc README.md
%{_sbindir}/rcclightd
%{_datadir}/dbus-1/system-services/org.clightd.clightd.service
%{_datadir}/dbus-1/system.d/org.clightd.clightd.conf
%{_datadir}/polkit-1/actions/org.clightd.clightd.policy
%{_libexecdir}/clightd
%dir %{_modulesloaddir}
%{_modulesloaddir}/i2c_clightd.conf
%{_unitdir}/clightd.service

%changelog
openSUSE Build Service is sponsored by