I’m preparing to update my GIMP book and decided it would be best to work from the source repository. A long time ago that repository was in CVS and you needed to download a bunch of GTK related packages as prerequisites. This was actually pretty easy. Then things moved to SVN and things were still pretty easy but you needed different repository tools. Now things are in GIT and you need more packages unrelated to GTK, such as GEGL and BABL. Things keep getting harder. Sounds like GNOME development in general.
But I’m a developer by trade so there should be no reason I cannot figure out. So this blog entry is all about getting that done.
Required Packages
- BABL
- GEGL
- Ruby (when building from the git repository)
- lua-devel
- OpenEXR-devel
- librsvg2-devel
- libopenraw-devel
- graphviz
- avformat
- libspiro-devel
- GIMP
- jasper library
- libpoppler
- libwmf
- libexif
These are just the packages that were not found the first time I tried to build things on Fedora 11. On other systems (including Windows and Macs) you’ll may have other requirements, especially if you don’t use GNOME on your desktop at all. Fedora 11 didn’t seem to have a version of avformat so I skipped it. I installed libpoppler (runtime and devel packages) but GIMP didn’t like that so the PDF support was built using the Postscript plug-in.
The list of packages available from the GIT repository is available from the GIMP Developer web site. This list does not list the prerequisites that are not part of the GIMP GIT repository.
Getting The Source
Git requires two steps to get the code. The first is called a clone, which gets the source sufficient to build the tree. The second step, checkout, actually checks out the source so that you can make modifications and check them back in. A third step, config, allows configuration of general details such as your user name and email address. Only the first step is required if all you want to do is built GIMP from the source tree in order to get all the latest features and bug fixes and are not intending to make source code changes to submit back to the project. All of this information can be found on the GNOME GIT pages.
Compiling Order
Building the GIMP is easy at the moment because there are only two real dependencies that can’t be satisfied by just installing prebuilt development packages. This won’t always be the case as development of the 2.7 version progresses.
For now, you can get away with building in the following order:
Building Into a Development Directory
If you build all the prerequisites into a single directory it will make it easier to compile prerequisites and run programs later. Therefore we choose a single directory: /usr/local/gimpgit. To use this directory for the build we’re going to want to add some environment variable settings:
export PKG_CONFIG_PATH=/usr/local/gimpgit/lib/pkgconfig/:$PKG_CONFIG_PATH
export LD_LIBRARY_PATH=/usr/local/gimpgit/lib:$LD_LIBRARY_PATH
The first variable is used to find pkg-config configuration files for prerequisite libraries. The second is used to find runtime libraries of prerequisite packages during the build. In both cases we’re placing the location to look for file of interest from the build directory tree ahead of any other configurations we might have previously set such as in our .bashrc file. In this way we’ll pick up the new builds first and then pick up the old versions later if the new versions haven’t been built yet. This will cause the build of each prerequisite to behave in the expected fashion, informing us of missing requirements.
Build Process
The GIMP packages (BABL, GEGL and GIMP) are all built using the autogen.sh script. This is a front end to the autoconf/automake/libtool configuration contained in the source tree that makes it easy to create the Makefiles throughout the tree. The general format of the command is as follows:
./autogen.sh –prefix=/usr/local/gimpgit
Running autogen.sh in the gimp source tree the first time will print out the results of simple tests to verify that you have required build tools, such as autoconf and automake. When autogen.sh is run it will also run the configure script it creates which in turn will do additional searches for required packages. It is at this point that the build will detect if you have the proper prerequisite libraries installed such as BABL and GEGL.
In order to find out what prerequisites I was missing I just ran autogen.sh once in the GIMP tree. It told me I was missing babl, which I then built and installed. I then ran the same autogen.sh command but substituted configure for autogen.sh because the latter will rebuild everything while the former (configure) will just run the configuration processing. In other words, autogen.sh is needed once to build the configure script. After that you can usually just run configure instead.
BABL
After running autogen.sh, run the following commands:
GEGL
After installing the myriad of prerequisites and running autogen.sh, run the following commands:
GIMP
Fortunately it doesn’t appear that you need to update GTK+ and its related libraries for GIMP. At least not at this time and not with GIMP 2.7 out of the git repository.
After installing the myriad of prerequisites and running autogen.sh, run the following commands:
Running GIMP
Now that you have it all built you just need to make sure the the build directories are the first in your PATH environment variable. The best way to do this without affecting the rest of you desktop experience is to write a little script and use it to launch the development version.
#!/bin/bash
export PATH=/usr/local/gimpgit/bin:$PATH
gimp-2.7
Note that the program name is not “gimp”. You can now run the development version of GIMP. This version will create a new runtime directory in the users home: .gimp-2.7. GIMP will import its settings from your old .gimp-2.6 directory or even your .gimp-2.4 directory if you skipped 2.6 altogether.
Update: 2011-01-27
To help out with this process, here are two scripts I use to download and build the components required to build GIMP from GIT (and described in this post).
build.sh is the script to run, and it calls getIt.sh for each component. You should edit these scripts since they are not general purpose – make sure they fit your needs. They are just the ones I used to do my builds from GIT and install them locally.
Related posts