Building GIMP for Linux
The main GIMP building instructions are at Building GIMP. This page is for Linux-specific additions. It will help installing the dependencies for some distros, ideally with all build options enabled.
Supported Distributions
GIMP can be built, in principle, on pretty much any GNU/Linux distribution
out there. For the stable branch in particular, we take great care at
not bumping the minimum requirements too often. We also try not to bump
build tools (meson
, autotools
…) without a good reason. But we allow
a bit more flexibility for optional dependencies.
For the development branch, requirements might be higher than the stable branch, though we also try to avoid bumping. First, we try to never bump a dependency if the minimum version is not already at least in Debian testing since it is “reasonably recent yet not too recent”. Also, we will try to find ways to use new features while still keeping an old requirement (for instance using macros to test the dependency version).
As a general advice, software contributors should anyway use distributions
providing reasonably recent packages (e.g. Debian testing, Fedora, Arch)
if you don’t want to have to compile yourself too many dependencies,
which sadly is the case of distributions with longer support (e.g. Ubuntu LTS).
Ideally, in GIMP case, you should only have to build babl
, GEGL
and
GIMP
. All the rest could come from the package manager.
Debian testing
Since our CI build for the development branch uses Debian testing, and that we try to keep this build as full-featured and up-to-date as possible (because it is here to warn us of any new issue), if you use Debian testing, it might be a very good idea to look at the .gitlab-ci.yml file in our repository.
In particular, look at the image-debian-x64
job for most dependencies
installed from the package manager and at deps-debian-x64
job for the
dependencies we build ourselves.
Copying these commands might be all there is to do for you.
Debian stable
Since our CI build for the stable branch uses Debian stable, if you use this version, it might be a good idea to look at the .gitlab-ci.yml file in our repository.
In particular, look at the deps-debian-x64/stable
job:
- the
before_script
section contains the dependencies installed from the package manager; - the
script
section contains the dependencies we build ourselves.
Other distributions
Regarding the distributions below, some things should be considered:
Debian flavors and derivatives using apt
If your distribution is Debian-based, you may find the below trick useful.
For Debian and derivative distributions (Ubuntu, Mint…), a good start
would be to install the build-essential
package. There exists also a
special command which would install all the packages necessary to build
the GIMP package. It gets you mostly there in a single command:
sudo apt build-dep gimp
You may get an error about incomplete sources.list
:
$ sudo apt build-dep gimp
Reading package lists... Done
E: You must put some 'deb-src' URIs in your sources.list
If this happens, this forum thread gives a few hints on how to properly set your system with CLI and GUI alternative methods: https://askubuntu.com/a/857433
Fedora and other distributions using dnf
Fedora has a similar command as Debian which will install all packages necessary to build the GIMP package. It gets you mostly there in a single command:
sudo dnf builddep gimp
Note: builddep
is a plug-in to dnf
so it might require getting installed
first.
Building with Flatpak for all distributions
Most contributors simply build GIMP the “old-school” way above, nevertheless it’s
possible to use flatpak
as a development environment, which is specially useful
for contributors who not use a “dev oriented” distro. Here is how this can be done:
Setting up the environment
Note that you don’t need to use the general variables.
Just choose what architecture to build and where you will “install” your flatpak:
# Architectures supported with GIMP flatpak are one of 'aarch64' or 'x86_64':
export ARCH="x86_64"
# Path where build files are installed
export GIMP_PREFIX="`pwd`/_install-${ARCH}"
And set up some recommended build options:
export BUILD_OPTIONS="--ccache --keep-build-dirs --force-clean"
- We recommend using
ccache
to improve build speed, and to keep build dirs (these will be found in.flatpak-builder/build/
relatively to the work directory) for later debugging if ever any configuration or build issue arises.
Install the dependencies
Install the flatpak packages (available for most distributions):
- flatpak (at least 0.9.5)
- flatpak-builder (at least 0.9.5)
Also, install appstream-compose. This is used to parse the appdata file and generate the appstream (metadata like comments, etc.).
- appstream-compose (On Fedora, this is provided by the package
libappstream-glib
, on Ubuntu byappstream-util
…)
Install the runtimes and the corresponding SDKs if you haven’t already:
flatpak remote-add --user --from gnome https://nightly.gnome.org/gnome-nightly.flatpakrepo
flatpak install --user gnome org.gnome.Platform/${ARCH}/master org.gnome.Sdk/${ARCH}/master
Or simply update them if you have already installed them:
flatpak update
Building the software
Inside the git folder as the working space, let’s build all the dependencies:
flatpak-builder $BUILD_OPTIONS --arch="$ARCH" --stop-at=gimp \
"${GIMP_PREFIX}" build/flatpak/org.gimp.GIMP-nightly.json.in 2>&1 \
| tee flatpak-builder.log
- Note that this will take a lot of time. For this reason, the build log will be
outputted on
stdout
as well as being stored in a fileflatpak-builder.log
.
Now build GIMP itself:
mkdir _build-${ARCH} && cd _build-${ARCH}
flatpak build "${GIMP_PREFIX}" meson setup .. -Dprefix=/app/ -Dlibdir=/app/lib/
flatpak build "${GIMP_PREFIX}" ninja
flatpak build "${GIMP_PREFIX}" ninja install
For development purpose, you don’t need to export the flatpak to a repository or even install it. Just run it directly from your build directory:
# Still in `_build-${ARCH}` folder
flatpak-builder --run "${GIMP_PREFIX}" flatpak/org.gimp.GIMP-nightly.json gimp-GIMP_APP_VERSION
Replace GIMP_APP_VERSION with the numbers defined at _build-${ARCH}/config.h
or
take the command inside _build-${ARCH}/flatpak/org.gimp.GIMP-nightly.json
.