Skip to content
Federico edited this page Dec 5, 2019 · 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 >= 221 (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.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)

Runtime deps:

  • libsystemd
  • libpopt
  • gsl
  • libconfig
  • clightd >= 4.0

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.
    It is also used to add support for keyboard backlight.

How to build

Install needed dependencies;
On Ubuntu:

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

On Fedora:

$ sudo dnf install @development-tools cmake systemd-devel popt-devel libconfig-devel gsl-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.

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..."

###########################################################
# To build from latest release instead of -devel version, #
# Comment out following lines and uncomment the next ones #
###########################################################
echo "* Getting Sources from git "
git clone https://github.com/FedeDP/Clight.git
git clone https://github.com/FedeDP/Clightd.git
git clone https://github.com/FedeDP/libmodule.git
git clone https://github.com/rockowitz/ddcutil.git

###########################################################
# To build from latest release, uncomment following lines #
# If needed, update tag name                              #
###########################################################
# echo "* Getting Sources from latest tags "
# git clone -b '4.0' --single-branch --depth 1 https://github.com/FedeDP/Clight.git
# git clone -b '4.0' --single-branch --depth 1 https://github.com/FedeDP/Clightd.git
# git clone -b '5.0.0' --single-branch --depth 1 https://github.com/FedeDP/libmodule.git
# git clone -b 'v0.9.7' --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!"
Clone this wiki locally