GIMP v2.8 Solution

GIMP v2.8 on CentOS 6.x


Introduction
GIMP v2.8 offers a whole slew of new photo editing features to play with but requires many libraries newer then what CentOS (or even Red Hat) 6 offer. For those like me who chose their Linux platform based on stability and the slower release cycles that come with it, well… we sometimes sacrifice the possibility of not always having bleeding edge tools available to us as a result. It’s not always because these applications can’t work on our systems, but because the effort involved in making it happen simply isn’t worth it. We have to hope someone on the internet will get so frustrated that they’ll just created a solution and share how they did it with the rest of us. But more importantly, we hope the solution isn’t going to jeopardize the stability of our system.

Why Isn’t there a GIMP v2.8 package already available to us?
CentOS (and Red Hat) follow a set of rules when they release a major version of their platform. These rules play a major role as to why their releases are so stable. One of those rules involves fixing the version of the core library GLIB to a specific and unaltered version. What’s important to know is GLIB truly is the core library used by just about every application we ever ran in Linux. With CentOS and Red Hat, the only updates to GLIB you will ever see are small patches fixing bugs only. Again I stress the words “bugs only“; these are patches applied to our existing version of GLIB and will not introduce features offered in newer versions of the library.

In September of 2011 GLIB introduced a new standard called C++11 offering developers easier ways write their code. C++11 introduces things that other programming languages have had forever such as the true use of NULL value (separating it from 0 – zero).  I truly can’t say enough great things about C++11 and the many new features it offers. In fact, the C++11 standard is so ingenious that most (if not all) active projects being used today are adopting them into their code for their benefits. Yes… One of those projects is GIMP v2.8.

So here is our problem… GLIB v2.12 shipped with CentOS and Red Hat 6 does not support C++11. Hence our problem is that we can’t run any of the new applications because they simply can’t (and won’t) work (or even compile for that matter) in our environment any more.

What are you going to do about it?
My goal is to have GIMP v2.8 installed on my CentOS 6.x system without jeopardizing the existing stability of my system. So upgrading my version of GLIB is completely out of the question.  I simply want to install the application in parallel through the same package management our platform is built on (RPMs). I certainly do not want to have to install all kinds of development libraries to pull this feat off either.  With my extremely picky requirements, I found absolutely ‘nothing’ on the internet showing me how to do this.

Rajiv Sharma had posted a blog (link) that came the closest to a near working suggestion; at least proving that running GIMP v2.8 can run on CentOS with the right packages.  It was his post that inspired me to take his efforts to another level. My only problem with his approach was that it required you to haul development libraries into your native working environment along with the lack of package management.

The key to the solution I’m offering is a ‘second’ copy of GLIB placed in a completely isolated location on our system so it won’t interfere with anything we already have installed. GIMP can then be compiled and ran against the libraries we isolated safely on our system.  To further this solution; I want to offer it to those who aren’t comfortable with compiling themselves an pre-built packaged solution ready to go.  Trust is hard to earn on the internet; so for those who are sceptical to run a pre-built binary on their system can read further and re-preform the solution for themselves.

Skip To The Goods
99% of my time was spent trying to put this into a working stable and tested RPM file. Some of you aren’t interested in how these results were achieved and simply just want it working for your own system.  I honestly can’t blame you… so here is the prize served to you on a silver platter:

Most users just need the binary package; it can be installed through the command:

yum -y localinstall gimp28-2.8.6-1.el6.x86_64.rpm

For those who want the information for themselves so they can build it for themselves keep reading.

So What Is The Next Step?
First off, I’m not a big fan of compiling code as the root user on the system I work with daily.   I am however a big fan of a tool called ‘mock‘ which allows us to develop software as root except within a safe virtual environment instead of our native one. I am also a big fan of package management; whether its a .DEB (Debian Package) or .RPM (Red Hat Package) for obvious reasons. For this tutorial; I’ll stick with RPMs since it’s what CentOS uses. We’ll prepare the RPMs and preform all our compilations within the mock environment.

# Install 'mock' into your environment if you don't have it already
# This step will require you to be the superuser (root) in your native
# environment.
yum install -y mock

# Grant your normal every day user account access to the mock group
# This step will also require you to be the root user.
usermod -a -G mock YourNonRootUsername

At this point it’s safe to change from the ‘root‘ user back to the user account you granted the mock group privileges to in the step above.  We won’t need the root user again until the end of this tutorial when we install our built RPM.

# Create a directory we can work in
mkdir src
# Change to our directory
cd src

# Fetch our sources; you can use curl or wget for this:
wget ftp://ftp.gimp.org/pub/gimp/v2.8/gimp-2.8.6.tar.bz2
wget http://ftp.acc.umu.se/pub/GNOME/sources/glib/2.34/glib-2.34.0.tar.xz
wget ftp://ftp.gimp.org/pub/babl/0.1/babl-0.1.10.tar.bz2
wget ftp://ftp.gimp.org/pub/gegl/0.2/gegl-0.2.0.tar.bz2
wget http://download.gnome.org/sources/atk/2.2/atk-2.2.0.tar.bz2
wget http://cairographics.org/releases/cairo-1.12.16.tar.xz
wget http://ftp.gnome.org/pub/gnome/sources/pango/1.29/pango-1.29.4.tar.bz2
wget http://ftp.gnome.org/pub/gnome/sources/gdk-pixbuf/2.24/gdk-pixbuf-2.24.1.tar.xz
wget http://ftp.gnome.org/pub/gnome/sources/gtk+/2.24/gtk+-2.24.10.tar.xz

# Grab the RPM SPEC file which contains the blueprints; this file is
# the key to making everything work
wget --output-document=gimp28.spec https://www.dropbox.com/sh/9dt7klam6ex1kpp/PkMeLDVYrF/20131005/gimp28.spec?dl=1
# Grab the GIMP Desktop Link
wget --output-document=gimp28.desktop.tgz https://www.dropbox.com/sh/9dt7klam6ex1kpp/Tbxef5KE6t/20131005/gimp28.desktop.tgz?dl=1

Setup a Mock Environment We Can Work In

# Initialize Mock Environment
mock -v -r epel-6-x86_64 --init
# Install stable packaging we don't need to rebuild ourselves that are
# requirements of the GIMP software.
mock -v -r epel-6-x86_64 --install aalib aalib-devel libexif-devel gettext \
libjpeg-devel libpng-devel libtiff-devel \
libmng-devel libXpm-devel librsvg2-devel \
libffi-devel libwmf-devel webkitgtk-devel \
python-devel zlib-devel pygtk2-devel \
intltool chrpath freetype-devel \
ghostscript-devel iso-codes-devel \
bzip2-devel curl-devel fontconfig-devel \
gnome-keyring-devel libgnomeui-devel \
python-devel zlib-devel libX11-devel \
sed findutils

# Copy our retrieved files into the mock's building environment
mock -v -r epel-6-x86_64 --copyin cp *.xz *.bz2 /builddir/build/SOURCES
mock -v -r epel-6-x86_64 --copyin cp *.xz *.bz2 /builddir/build/SPECS

# Now shell into the mock environment
mock -v -r epel-6-x86_64 --shell
cd builddir/build

# Permissions are important to rpmbuild from within the mock
# environment By doing this, your actually just giving it the
# 'mock' user exclusive permissions and ownership (since we are
# in the mock environment when calling them)
chown root.root SOURCES/*
chown root.root SPECS/*

# Build our product! Note: this can take a while so be patient
rpmbuild -ba SPECS/gimp28.spec

You can now press Ctrl-D (or type: exit) to return back to your regular working environment. You would have produced 2 new RPMs (the binary and source package) which you can now install into your system.

# Retrieve the binary RPM you just built
mock -v -r epel-6-x86_64 \
  --copyout /builddir/build/SRPMS/gimp28-2.8.6-1.el6.src.rpm .
mock -v -r epel-6-x86_64 \
  --copyout /builddir/build/RPMS/gimp28-2.8.6-1.el6.x86_64.rpm .

You can now install the RPM you just built above into your system:

# You will need to switch back to the superuser (root) to preform this
# The command below will look after resolving any dependencies you were
# otherwise already missing and install the package into your system
# gracefully.
yum -y localinstall gimp28-2.8.6-1.el6.x86_64.rpm

The RPM SPEC File is The Key
This tutorial is pretty easy only because all the hard work is done within the .spec file. Most of my time was spent merging spec files and reading examples as to how the newer platforms built their newer packages.  The rest of the effort was after getting all of the packages to install correctly; have them just ‘work’ without any messing around.

Your new GIMP v2.8 Environment

GIMP v2.8 Loading Screen

GIMP v2.8 Loading Screen

In the end everything (about 250MB worth) is installed into /opt/gimp28. It will not impact or touch anything you may or may not have had already installed on your system. This includes running perfectly in parallel with GIMP v2.6 if you choose to keep running it as something to fall back to.

The RPM additionally includes 3 scripts to greatly simplify access to new parallel install of GIMP v2.8.

The following shell scripts were created by the RPM automatically to make accessing GIMP v2.8 easier.  They will look after setting up the appropriate environment variables and executing the tools they represent.

  • /usr/bin/gimp28 will start the full blown application itself.
  • /usr/bin/gimp28-console for the console users
  • /usr/bin/gimp28tool and the gimptool application for those who use it.

As an added touch; I set up a Gnome menu item too! You can access this new installed application from:
Applications -> Graphics -> GNU Image Manipulation Program v2.8

All local cache goes into ~/.gimp-2.8 so it won’t interfere with any of your GIMP 2.6 configuration you may already have set up in ~/.gimp-2.6

GIMP v2.8 Single Window Mode running on CentOS 6

GIMP v2.8 Single Window Mode running on CentOS 6

Credit
This is my first blog post and I truly hope readers will find this information useful! Please note that this information took me several weeks to put together and test thoroughly. I may not blog often; but I want to re-assure the stability and testing I put into everything I intend share.

if you like what you see and wish to copy and paste this HOWTO and/or use my SPEC file I designed elsewhere, please reference back to this blog post at the very least. It’s really all I ask.

Sources:

  • Once again I want to credit Rajiv Sharma for starting me in the right direction with his blog entry (link).
  • I used pkgs.org frequently to obtain rpm source packaging for GIMP, GDK, etc which helped me construct and build the SPEC file I’m sharing here.
  • rpath alterations played a key in helping made the environment work. I found this link very useful in explaining that to me which again went into the SPEC file design.
  • RPM official reference here; This link here was really useful explaining the SPEC file macro’s.
  • GIMP environment variables and configuration explained here.

Got an idea or request?
If you have an idea of request enhancement; please feel free to contact me and let me know what it is.  I have no problem enhancing the SPEC if the accommodations seem worthy.

About these ads

One thought on “GIMP v2.8 on CentOS 6.x

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s