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:
# Used to find programs/tools during build
export PATH="${GIMP_PREFIX}/bin:$PATH"
# Assuming that you have 'toolchain' installed
gcc -print-multi-os-directory 2>/dev/null | grep ./ && LIB_DIR=$(gcc -print-multi-os-directory | sed 's/\.\.\///g') || LIB_DIR="lib"
gcc -print-multiarch 2>/dev/null | grep . && 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 libraries at runtime
export LD_LIBRARY_PATH="${GIMP_PREFIX}/${LIB_DIR}/${LIB_SUBDIR}${LD_LIBRARY_PATH:+:$LD_LIBRARY_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 introspection files
export GI_TYPELIB_PATH="${GIMP_PREFIX}/${LIB_DIR}/${LIB_SUBDIR}girepository-1.0${GI_TYPELIB_PATH:+:$GI_TYPELIB_PATH}"
# Used by Autotools to find its tools
export ACLOCAL_FLAGS="-I $GIMP_PREFIX/share/aclocal $ACLOCAL_FLAGS"
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, you’re ready to build GIMP!
For the stable branch (gimp-2-10
for GIMP 2.10.x versions), you must build with autotools.
For the unstable branch (master
for GIMP 2.99 versions which will lead
to future stable GIMP 3.0 branch), you must build with Meson.
Autotools build
The steps are the very common historical build process, refered to as
./configure && make && make install
, except that ./autogen.sh runs
./configure for you.
cd into the directory where you unpacked gegl.
If you’re building source you checked out from git, run:
./autogen.sh --prefix=${GIMP_PREFIX}
(assuming, as recommended, you have chosen to install outside the usual place, and defined environment variable GIMP_PREFIX
)
This generates a configure script and then runs it.
If you’re building from a tarball, use configure instead of autogen:
./configure --prefix=${GIMP_PREFIX}
To see options you can configure:
./configure --help
(for a first build, it may be easier to accept the default build configuration, then later tweak the configuration in steps)
Then:
make && make install
Note: it is also possible to build autotools out-of-tree, calling the
configure
script from another directory, i.e.:
mkdir _build && cd _build
../configure --prefix=${GIMP_PREFIX} && make && make install
Meson build
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).
- Autotools build :
–with-gimpdir=GIMP/git
- Meson build :
-Dgimpdir=GIMP/git
Problems?
Most problems will occur during the configure stage, and with any luck it’s just a missing package and the error message will make it clear what package you need. But there are more subtle problems that can occur. If you have a difficult error, look in: Problems and Solutions
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 $HOME\Documents\PowerShell\Profile.ps1
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