Saturday, December 26, 2009

Best way to keep up with GIMP from git

The more people that use the latest GIMP code from git the better. It keeps the required effort to contribute code upstreams small, which in turn increases the likelihood of upstream contributions, and it makes bugs more vulnerable to early discovery which minimizes their impact.

However, keeping up with GIMP from git means extra work compared to using prebuilt packages. Unless you know of an easy way you might not withstand it. What follows is a description of how I do it, which is almost effortless once setup. I assume you know how to install necessary dependencies (note you can use the method I describe for the key dependencies, including babl, GLib, GEGL and GTK+), what "the install prefix" means, and that you run Linux. The approach I use differs in two principal way compared to the many guides found on the net:
  1. I use autoconf's config.site feature instead of setting up environment variables manually
  2. I install in my home directory
Making use of config.site nullifies the need to manually manage environment variables, and installing in the home directory makes it easy to tinker with an installation since you don't need to be root. So, put this in $PREFIX/share/config.site where $PREFIX is in your home directory such as PREFIX=/home/martin/gimp-git, either manually or using this script:
export PATH="$PREFIX/bin:$PATH"
export PKG_CONFIG_PATH="$PREFIX/lib/pkgconfig:$PKG_CONFIG_PATH"
export LD_LIBRARY_PATH="$PREFIX/lib:$LD_LIBRARY_PATH"
export ACLOCAL_FLAGS="-I $PREFIX/share/aclocal $ACLOCAL_FLAGS"
export XDG_DATA_DIRS="$PREFIX/share:$XDG_DATA_DIRS"
Then, assuming you have all the dependencies, you build GIMP the first time with:

git clone git://git.gnome.org/gimp
cd gimp
source $PREFIX/share/config.site
./autogen.sh --prefix=$PREFIX
make
make install
and then to get updated with the latest changes from the constantly moving code base you regularly do
git pull --rebase
source $PREFIX/share/config.site
make
make install
Note that the latter works without requiring any environment variables to be set since configure will source config.site. And because autogen.sh passes --enable-maintainer-mode to configure, it will also work when Makefile.am's or configure.ac are changed. In those rare occasions where things break, just run git clean -xdf which removes all non-version-controlled files so that you can start over from autogen.sh.

The above approach works for as good as all GNOME projects, including GLib, babl, GEGL and GTK+. This makes it easy to adapt to GIMP's build requirements of these and other libraries even if your distro doesn't meet them. Let me know if you have problems!

21 Comments:

At December 26, 2009 at 7:48 PM , Blogger phani said...

thanks a lot for this simple instruction. i wanted to try out GIMP source for a while, but put it off because i thought i'd have to get into the whole git-thing first.

my C++ skills are more than rusty so i doubt i'll be able to contribute anything soon, but i should be able to help with testing at least--and get an idea what you're really up to in the near future.

 
At December 26, 2009 at 11:50 PM , Anonymous Anonymous said...

hmm, great. but hard for windows/osx noobs like me... hmm

 
At December 27, 2009 at 3:22 PM , Anonymous Anonymous said...

hey cool! i like those tips

 
At December 30, 2009 at 10:36 PM , Anonymous Anonymous said...

It would be nice if a Windows bleeding edge version was available. Then I could contribute info on features / bugs.

 
At January 5, 2010 at 11:49 PM , Anonymous Searcher said...

any news about the reselease of GIMP 2.8 ?

 
At January 11, 2010 at 6:37 PM , Anonymous Anonymous said...

Please upload somewhere a test version for Gimp for Windows.

 
At January 26, 2010 at 10:06 PM , Anonymous Anonymous said...

You make want to mention that you have to "git" babl and gegl as well as gimp if this is the first time compiling the 2.7.x code. Adding the -j option to make can also speed up compiling (i.e. make -j3 if you have a duo core machine or make -j5 for a quad core)
Thanks for all your work on gimp.

 
At February 27, 2010 at 5:02 PM , Anonymous Anonymous said...

I run openSuSE 11.2 which has its own pre-compiled packages, and I've always updated from their download site. I am not sure how to follow the procedure you recommend. Should I uninstall Gimp and remove all traces, then build from scratch? Or what? I tend to like running on the bleeding edge of everything. Must be a character flaw, or something. You can tell me I'm just being frivolous, or an insane thrill-seeker. Just curious.

 
At May 3, 2010 at 12:26 AM , Anonymous Anonymous said...

thanks for this easy guid. i love gimp 2.7 from now!!

 
At July 6, 2010 at 5:13 PM , Anonymous John said...

Seems that there are quite a few new dependencies with the most recent builds. Any recommendations on the fastest way to meet those?

 
At July 8, 2010 at 11:37 AM , Blogger Martin Nordholts said...

@John:
First "yum-builddep gimp gegl babl" or "apt-get build-dep gimp gegl babl" which will give you most build dependencies. Then "yum search" or "apt-cache search" or "yum provides" or "apt-file find" to find the last missing ones. And finally use the method described above for the rest.

 
At August 13, 2010 at 6:56 PM , Anonymous Anonymous said...

$ git pull --rebase
fatal: Not a git repository (or any parent up to mount parent )
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).

 
At August 13, 2010 at 7:05 PM , Blogger Martin Nordholts said...

You need to be in the source dir. What is your working directory when you issue that command?

 
At November 16, 2010 at 11:10 PM , Blogger Hazza said...

I am using Ubuntu 10.10, I have downloaded and compiled Babl, GEGL and GIMP several times over the past week. GIMP will start and I can create a new file but none of the tools work.

I figure that it can't be THAT broken so the problem must be my end.

 
At January 14, 2011 at 2:08 AM , Anonymous anonymous said...

CCLD gimp-2.7
tools/libapptools.a(gimpcagetool.o): In function `gimp_cage_tool_compute_coef':
/home/ego/Gimpdev/gimp/app/tools/gimpcagetool.c:690: undefined reference to `babl_format_n'
gegl/libappgegl.a(gimpoperationcagecoefcalc.o): In function `gimp_operation_cage_coef_calc_process':
/home/ego/Gimpdev/gimp/app/gegl/gimpoperationcagecoefcalc.c:196: undefined reference to `babl_format_n'
gegl/libappgegl.a(gimpoperationcagecoefcalc.o): In function `gimp_operation_cage_coef_calc_prepare':
/home/ego/Gimpdev/gimp/app/gegl/gimpoperationcagecoefcalc.c:98: undefined reference to `babl_format_n'
gegl/libappgegl.a(gimpoperationcagetransform.o): In function `gimp_operation_cage_transform_init':
/home/ego/Gimpdev/gimp/app/gegl/gimpoperationcagetransform.c:127: undefined reference to `babl_format_n'
gegl/libappgegl.a(gimpoperationcagetransform.o): In function `gimp_cage_transform_compute_destination':
/home/ego/Gimpdev/gimp/app/gegl/gimpoperationcagetransform.c:493: undefined reference to `babl_format_n'
gegl/libappgegl.a(gimpoperationcagetransform.o):/home/ego/Gimpdev/gimp/app/gegl/gimpoperationcagetransform.c:199: more undefined references to `babl_format_n' follow
collect2: ld returned 1 exit status

 
At January 18, 2011 at 4:56 PM , Anonymous Anonymous said...

Re "undefined reference to `babl_format_n'"
You need a git version of babl.
Do a 'git clone git://git.gnome.org/babl babl-git' and compile that first.

- Peder

 
At May 17, 2011 at 1:37 AM , Blogger dom said...

just wanted to share my appreciation. new to GNOME development, this has saved me some headache :)

 
At September 10, 2011 at 7:31 AM , Anonymous Anonymous said...

I got two problems :
aclocal-1.11: couldn't open directory `/home/simon/Informatique/softs/gimp-git/share/aclocal': Aucun fichier ou dossier de ce type

a simple mkdir fixed it, and the other :

configure.ac:443: warning: macro `AM_GLIB_GNU_GETTEXT' not found in library
configure.ac:468: warning: macro `AM_PATH_GLIB_2_0' not found in library
configure.ac:497: warning: macro `AM_PATH_GTK_2_0' not found in library
libtoolize: putting auxiliary files in `.'.
libtoolize: linking file `./ltmain.sh'
libtoolize: putting macros in AC_CONFIG_MACRO_DIR, `m4macros'.
libtoolize: linking file `m4macros/libtool.m4'
libtoolize: linking file `m4macros/ltoptions.m4'
libtoolize: linking file `m4macros/ltsugar.m4'
libtoolize: linking file `m4macros/ltversion.m4'
libtoolize: linking file `m4macros/lt~obsolete.m4'
configure.ac:156: installing `./compile'
configure.ac:160: installing `./config.guess'
configure.ac:160: installing `./config.sub'
configure.ac:74: installing `./install-sh'
configure.ac:74: installing `./missing'
app/Makefile.am: installing `./depcomp'
plug-ins/pygimp/Makefile.am:119: installing `./py-compile'
configure.ac:451: error: possibly undefined macro: AM_GLIB_GNU_GETTEXT
If this token and others are legitimate, please use m4_pattern_allow.
See the Autoconf documentation.
configure.ac:480: error: possibly undefined macro: AM_PATH_GLIB_2_0
configure.ac:509: error: possibly undefined macro: AM_PATH_GTK_2_0

:-(
I am using Fedora 15, by the way, your post helped me for others softs ;) thank you

 
At October 26, 2011 at 9:55 PM , Blogger Jason Simanek said...

This comment has been removed by the author.

 
At October 27, 2011 at 1:04 AM , Blogger Jason Simanek said...

OK. Think I'm getting close. Just keep seeing this after trying to run the .autogen.sh line in the terminal:

aclocal-1.11: couldn't open directory `/home/jason/Development/Gimp/share/aclocal': No such file or directory

The folder "aclocal" is in the right place... any help?

 
At November 5, 2012 at 10:29 AM , Anonymous kommander klink said...

1: continue expounding upon these bits for compile noobs

I assume you know how to install necessary dependencies (note you can use the method I describe for the key dependencies, including babl, GLib, GEGL and GTK+), what "the install prefix" means, and that you run Linux. The approach I use differs in two principal way compared to the many guides found on the net:

2: need anything be changed to follow gimp 2.8.x?

3: what neeeds to be changed commandwise if one wishes to install into

/hooray

instead of mucking up one users home directory?

 

Post a Comment

Subscribe to Post Comments [Atom]

<< Home