Skip to content
Federico Di Pierro edited this page Sep 21, 2023 · 50 revisions

Dependencies

Please note that at least on Ubuntu and Fedora, -devel packages are splitted from their main package. You'll need them.

Remember to install your distro devel packages too, eg: build-essential on Ubuntu or base-devel on arch.

Build deps

  • libsystemd >= 234 (systemd/sd-bus.h) or elogind (elogind/sd-bus.h)
  • libpopt (popt.h)
  • gsl (gsl/gsl_multifit.h, gsl/gsl_statistics_double.h)
  • libconfig (libconfig.h)
  • libmodule 5.x >= 5.0.0
  • gcc or clang
  • cmake >= 3.5
  • pkg-config
  • dbus-1 (needed to let pkg-config find SESSION_BUS_DIR variable)

Optional build deps

  • bash-completion (needed only if you wish to have a bash completion script for Clight)
  • fish (needed only if you wish to have fish shell completion script for Clight)
  • systemd (to fetch some systemd unit related variables)

Runtime deps:

  • libsystemd
  • libpopt
  • gsl
  • libconfig
  • libmodule
  • Clightd

Optional runtime deps:

  • Geoclue2 to automatically retrieve user location (no geoclue and no user position specified will disable GAMMA support)
  • Upower to honor timeouts between captures, to use different ambient brightness -> screen backlight matching coefficients, to change dimmer timeout and to change dpms timeouts depending on ac state.

How to build

NOTE: libmodule must be built from source, where it is not packaged
NOTE: Clight is NOT API-compatible with libmodule master. Please use latest 5.x tag!
NOTE: you will need to install Clightd too, in order to use Clight

Install needed dependencies:
On Ubuntu:

$ sudo apt install build-essential cmake libsystemd-dev libpopt-dev libconfig-dev libgsl-dev libdbus-1-dev

On Fedora:

$ sudo dnf install @development-tools cmake systemd-devel popt-devel libconfig-devel gsl-devel dbus-devel

On OpenSuse:

$ sudo zypper install --type pattern devel_basis
$ sudo zypper install cmake systemd-devel popt-devel libconfig-devel gsl-devel dbus-1-devel

Then, to build clight you just need to issue a:

$ mkdir build
$ cd build
$ cmake \
    -G "Unix Makefiles" \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DCMAKE_INSTALL_LIBDIR=lib \
    -DCMAKE_BUILD_TYPE="Release" \
    ..
$ make

Installation - Generic OS

# make install

Installation - Red Hat/Fedora

$ cpack -G RPM

And finally install generated RPM package.

Installation - Debian/Ubuntu

$ cpack -G DEB

And finally install generated DEB package.

That's it.

Installation - OpenSuse

OpenSuse offers Clight in its repositories; to install it:

  • Go to “Clight” page at: https://software.opensuse.org/package/Clight
  • Select your distro version
  • Click on “display experimental package”
  • Click on “one click installation”
  • Accept opening one click file with Yast
  • Accept all steps by clicking “Next” and finally “Terminate”

Warning : you must fill the root password blindly, be cautious.
If you type the wrong password then just abandon the procedure and repeat it.

This procedure installs bot Clight and Clightd; moreover, it adds a new hardware repo.

Dealing with dependencies

As both Clight and Clightd depend upon libmodule, and Clightd depends upon ddcutil too, user brianread108 developed a tiny build script that automatically manages all dependencies:

#!/bin/sh

echo "Building Clight and its dependencies..."

# Eventually bump the version numbers if any update is available!
echo "* Getting Sources from latest tags "
git clone -b '4.9' --single-branch --depth 1 https://github.com/FedeDP/Clight.git
git clone -b '5.7' --single-branch --depth 1 https://github.com/FedeDP/Clightd.git
git clone -b '5.0.1' --single-branch --depth 1 https://github.com/FedeDP/libmodule.git
git clone -b 'v1.4.1' --single-branch --depth 1 https://github.com/rockowitz/ddcutil.git

cd ddcutil
echo "* Building ddcutil"
./autogen.sh
./configure --prefix=/usr
make
sudo make install
cd ..

cd libmodule
echo "* Building Libmodule"
mkdir build
cd build
cmake  \
         -G "Unix Makefiles" \
         -DCMAKE_INSTALL_PREFIX=/usr \
         -DCMAKE_INSTALL_LIBDIR=lib \
         -DCMAKE_BUILD_TYPE="Release" \
         ..
make
sudo make install
cd ../..

cd Clightd
echo "* Building clightd"
mkdir build
cd build
cmake \
        -G "Unix Makefiles" \
        -DCMAKE_INSTALL_PREFIX=/usr \
        -DCMAKE_INSTALL_LIBDIR=lib \
        -DCMAKE_BUILD_TYPE="Release" \
        -DENABLE_DDC=1 -DENABLE_GAMMA=1 -DENABLE_SCREEN=1 -DENABLE_DPMS=1 \
        ..
make
sudo make install
cd ../..

cd Clight
echo "* Building clight"
mkdir build
cd build
cmake \
        -G "Unix Makefiles" \
        -DCMAKE_INSTALL_PREFIX=/usr \
        -DCMAKE_INSTALL_LIBDIR=lib \
        -DCMAKE_BUILD_TYPE="Release" \
        ..
make
sudo make install

echo "Done...Enjoy Clight!"

Uninstallation

To uninstall Clight, since CMake does not offer an uninstall target, you can run:

xargs rm < install_manifest.txt

from within the build folder.
Relevant stackoverflow thread: https://stackoverflow.com/questions/41471620/cmake-support-make-uninstall.