Building GIMP
This page describes how to build GIMP.
Prerequisites
You should know how to use:
- a terminal and the command line;
- shell environment variables.
Download the source code
The sources needed to compile GIMP can be cloned or downloaded here.
If you clone GIMP, you need to be used to at least managing branches before building.
Take a look at this comprehensive page.
Also, regularly make sure that you have gimp-data updated with git submodule update
(inside gimp repo folder). This is mandatory to generate icons, splash screen, etc.
GIMP’s dependencies
You may need to install some software to build GIMP, including a C compiler, meson, and more, plus many dependencies. See the OS-specific pages for this and other details:
- build/linux - Building GIMP on Linux
- build/macos - Building GIMP on macOS
- build/windows - Building GIMP on Windows
For a complete list of dependencies, if you’re interested, see the files
included in the root of GIMP repo or tarball under the name INSTALL*
.
These informative files linked above are generated by our build system and shipped with the tarballs, containing version information for dependencies.
Preparing for Building
- Choose a place to install everything, and set a variable to point to it:
You may not want to install self builds in your system prefix, as you can get odd behavior or even break your system GIMP install (if there is one).
You should then create another prefix directory where GIMP (and some dependencies) may be installed safely. We can name your custom prefix:
export GIMP_PREFIX=${HOME}/_install
- Set some environment variables:
To the build system be able to know the custom prefix, set these variables below:
# Assuming that you have 'toolchain' installed
gcc -print-multi-os-directory 2>/dev/null | grep ./ && export LIB_DIR=$(gcc -print-multi-os-directory | sed 's/\.\.\///g') || export LIB_DIR="lib"
gcc -print-multiarch 2>/dev/null | grep . && export LIB_SUBDIR=$(echo $(gcc -print-multiarch)'/')
# Used to detect the build dependencies
export PKG_CONFIG_PATH="${GIMP_PREFIX}/${LIB_DIR}/${LIB_SUBDIR}pkgconfig${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}"
# Used to find the glib-introspection dependencies
export XDG_DATA_DIRS="${GIMP_PREFIX}/share:/usr/share${XDG_DATA_DIRS:+:$XDG_DATA_DIRS}"
# Used to find programs/tools during build and at runtime
export PATH="${GIMP_PREFIX}/bin:$PATH"
# Used to find the libraries at runtime
export LD_LIBRARY_PATH="${GIMP_PREFIX}/${LIB_DIR}/${LIB_SUBDIR}${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
# Used to find introspection files
export GI_TYPELIB_PATH="${GIMP_PREFIX}/${LIB_DIR}/${LIB_SUBDIR}girepository-1.0${GI_TYPELIB_PATH:+:$GI_TYPELIB_PATH}"
Build the source code
babl and GEGL
Babl and GEGL use Meson. These two deps should be built and ideally from
the latest master
branch (so, unless you know exactly what you’re doing,
avoid pre-compiled binaries and the tarballs).
But the build process is simple. From the root of each project (babl then GEGL), run the following commands:
# Configure how the project will be built
# You can read the file `meson_options.txt` for the project options
# Meson itself also provides built-in options: https://mesonbuild.com/Builtin-options.html
meson setup _build -Dprefix="${GIMP_PREFIX}"
# Build in '_build' dir then install in $GIMP_PREFIX
cd _build
ninja
ninja install
GIMP
Finally, after building babl and GEGL, you’re ready to build GIMP!
Rejoice! All the commands and comments written above regarding babl and GEGL also applies to GIMP building.
Useful build options (optional)
You can customize the directory where GIMP stores settings if you wish. This
prevents any interference with other GIMP installations on the same computer
(being more useful if you’re hacking the stable branch): -Dgimpdir=GIMP/git
Problems?
Most build failures will occur during the meson setup command. You should first re-read this entire page and the OS-specific page. Then, if the problem persists, please report on GIMP bug tracker.
Running Your New GIMP
To run frequently the GIMP you have installed outside the usual places, you need to keep defined the same variables as for the build.
You can do this seting some of these variables in your “profile”: a shell script
that sets environment variables when you login (e.g. $HOME/.*profile
on UNIX
and $profile
on Windows).
See the OS-specific pages for more specific advice:
- build/linux - Building GIMP on Linux
- build/macos - Building GIMP on macOS
- build/windows - Building GIMP on Windows