Skip to content

Compiling from source

Daniel Kondor edited this page Feb 22, 2025 · 5 revisions

Get the sources

Latest sources are available in the git repositories (note that you need both, since the plugins provide essential functionality):
https://github.com/Cairo-Dock/cairo-dock-core
https://github.com/Cairo-Dock/cairo-dock-plug-ins

Download them with git:

git clone https://github.com/Cairo-Dock/cairo-dock-core.git
git clone https://github.com/Cairo-Dock/cairo-dock-plug-ins.git

this will create two subdirectories, cairo-dock-core and cairo-dock-plug-ins. To update them, run the following command in both:

git pull

To switch to an older version (e.g. the latest stable version):

git checkout 3.5.1

To switch back to the latest (likely beta / development) version:

git checkout master

Install the dependencies

Compilation tools:

required: cmake make pkg-config gettext gcc g++ (or any other C / C++ compiler)
optional, for Wayland support: extra-cmake-modules wayland-scanner wayland-protocols
optional, for some plugins: valac python3

Libraries for the core:

required: gtk+-3.0 glib-2.0 gthread-2.0 cairo librsvg-2.0 dbus-1 dbus-glib-1 libxml-2.0 xrender gl glu egl libcurl xtst xcomposite xrandr
optional, for Wayland support: libwayland-dev json-c gtk-layer-shell

Libraries for the plugins:

Required: cairo librsvg-2.0 dbus-1 dbus-glib-1 libxml-2.0 glib-2.0
Highly Recommended: libalsa libetpan libgnome-menu3 gio-2.0 libxklavier xrandr x11 xxf86vm
gvfs upower-glib zeitgeist-1.0 libexif vte(-2.90) lm_sensors curl wget dbusmenu-glib(-0.4) dbusmenu-gtk(3)(-0.4)
Suggested: ayatana-indicator3 libayatana-ido3 libical libpulse webkitgtk-3.0 ayatana-indicator-messages ayatana-indicator-sound
Optional: fftw3

On recent Debian / Ubuntu, these can be installed with the following command:

sudo apt install cmake make pkg-config gcc g++ gettext build-essential libglib2.0-dev libcairo2-dev librsvg2-dev libdbus-glib-1-dev libxml2-dev libxrender-dev libglu1-mesa-dev libpango1.0-dev libxxf86vm-dev libxtst-dev libxrandr-dev libx11-dev libcurl4-gnutls-dev libgtk-3-dev libdbusmenu-gtk3-dev libasound2-dev libgnome-menu-3-dev libetpan-dev libxklavier-dev libwebkit-dev libexif-dev libvte-2.90-dev libzeitgeist-dev libayatana-ido3-dev libayatana-indicator3-dev libsensors4-dev libupower-glib-dev wget curl extra-cmake-modules libwayland-bin libwayland-dev libegl-dev wayland-protocols valac python3 libgtk-layer-shell-dev libjson-c-dev

Compiling the core

cd cairo-dock-core
mkdir build
cd build
cmake .. -DCMAKE_INSTALL_PREFIX=/usr/local -DCMAKE_BUILD_TYPE=Release -Denable-desktop-manager=True
make # or e.g. make -j 4 on a quad-core CPU
sudo make install # as root 
cd ../..

This will install Cairo-Dock and related data under /usr/local with all features (if available). Some useful options:

  • -DCMAKE_BUILD_TYPE=Debug to compile with debug symbols
  • -Denable-desktop-manager=[True/False] whether to install files for a "desktop session" that can be selected from the login manager (uses X11, either Compiz or Metacity and components from gnome-session)
  • -Denable-systemd-service=[True/False] whether to install a Systemd service file (disabled by default) that can be used to auto-start Cairo-Dock
  • -Denable-wayland-support=[True/False] whether to enable Wayland support at all
  • -Denable-wayland-protocols=[True/False] whether to enable Wayland protocols such as foreign-toplevel-management that are required for the taskbar functionality
  • -Denable-egl-support=[True/False] whether to compile support for EGL (required for OpenGL on Wayland, can be used on X11)
  • -Denable-x11-support=[True/False] whether to enable support for X11 specific features at all
  • -Denable-glx-support=[True/False] whether to compile support for GLX (can be used for OpenGL on X11)
  • -Denable-gtk-layer-shell=[True/False] whether the enable using gtk-layer-shell (required for positioning docks on Wayland)

After running cmake, a summary will be printed with compilation options that will be used (and some issues, e.g. if a library is not found). Note that not finding an optional library will not result in an error, just disable the component that requires it.

Compiling the plugins

cd cairo-dock-plug-ins
mkdir build
cd build
cmake .. -DCMAKE_INSTALL_PREFIX=/usr/local -DCMAKE_BUILD_TYPE=Release
make # or e.g. make -j 4 on a quad-core CPU
sudo make install # as root and if you had no errors
cd ../..

Notes:

  • Currently, plug-ins must always be installed under the same prefix as core; this is best achieved by explicitly using the -DCMAKE_INSTALL_PREFIX option (using the same value as for the core). This is especially important if you have multiple versions of Cairo-Dock installed.
  • Individual plugins can be enabled or disabled by specific CMake options, e.g. use -Denable-mail=False to disable the "Mail" plugin.
  • Plugins will be disabled if their specific dependencies are not found (with a warning message about missing dependencies).
  • The Dbus plugin provides a Python interface to interact with Cairo-Dock. Currently, it will try to find an install path that is both under the install prefix and also included in $PYTHONPATH. This will likely fail if you're installing to a non-standard prefix.

Using a non-standard prefix

For best results, it is recommended to install under /usr/local which is considered "standard" and is well supported on most distributions. When installing in a custom prefix (e.g. /opt or under a user directory), pay attention to the following:

  • Make sure you set the same -DCMAKE_INSTALL_PREFIX when compiling the core and plugins.
  • If using an older version, you will likely also need to set the PKG_CONFIG_PATH environment variable to point to the appropriate pkgconfig directory under the installation prefix when building the plugins (e.g. /opt/lib/pkgconfig).
  • If the binary directory is not in PATH, you will need to ensure that Cairo-Dock is started using the full path (e.g. /opt/bin/cairo-dock instead of just cairo-dock).
  • On older versions, you will need to adjust the LD_LIBRARY_PATH environment variable to include the library path under the prefix. This is not required on the latest git master.
  • The Python and Ruby interfaces currently cannot be installed in a non-standard prefix; this will mean that external plugins written in these languages will not work. This will be fixed in an upcoming release.
  • Using a custom prefix will typically mean that the cairo-dock.desktop file will not be in a location that is automatically picked up by other apps (so that you will not have a "Cairo-Dock" entry in your menus, etc.)
  • Also, the desktop session will likely not be available (as the session files will be installed in a non-standard location); you will need to manually copy / symlink files under ${prefix}/share/xsessions (cairo-dock-*.desktop) and ${prefix}/share/gnome-session/sessions (cairo-dock-*.session) to the respective directories under /usr or /usr/local (i.e. /usr/local/share/xsessions and /usr/local/share/gnome-session/sessions).
  • The same applies to systemd target files that are installed under ${prefix}/lib/systemd/user: gnome-session-x11@cairo-dock-*.target and cairo-dock.service; these should be symlinked under /usr/local/lib/systemd/user or under ~/.local/systemd/user.
  • When running under KWin (including KDE / Plasma) the taskbar will not work unless the cairo-dock.desktop file is placed in a "standard" location (i.e. under /usr/local/share/applications); you will need to copy or symlink it from under the installation prefix (e.g. /opt/share/applications/cairo-dock.desktop)