Linux HOWTOs

About | Home | Search


HOWTO: gtk
Description: Multi-platform GUI toolkit
Click here for ChangeLog
NOTE: I use GNU tar >= 1.13.25 so it's -j for .tar.bz2 files,
it's safe to assume that make, gcc, binutils, fileutils/coreutils, gawk, sed, and grep are prerequisites for almost everything


# GTK+
# ====
# Below are several versions of GTK+.  The latest 1.2.x version, old but
# still in use by several apps, and several 2.x.x versions.  I'll keep
# the others updated with the latest, but keep in mind that I actually
# only use the 2.18.x version.  See notes below for more info.

# Slackware's 'gtk+' package includes the following versions of GTK+:
# 8.1, 9.0, 9.1, 10.0, 10.1, 10.2, 11.0, 12.0, 12.1: 1.2.10
#
# Slackware's 'gtk+2' package includes:
# 9.0: 2.2.1
# 9.1: 2.2.4
# 10.0: 2.4.3
# 10.1: 2.6.1
# 10.2: 2.6.10
# 11.0: 2.8.20
# 12.0: 2.10.13
# 12.1: 2.12.9
# and patched/updated versions may also be in 'patches'.

# Below I remove gtk*.mo files that are installed under /usr/share/locale
# because I'm in the USA and I only read & write English (well).  If
# this is not the case for you, remove --disable-nls from the configure
# line (if it's there) and skip the part that removes the gtk*.mo files
# ("find /usr/share/locale...").

# If you want to uninstall GTK+ or clean up old versions, a good idea when
# upgrading a source-installed version, skip down to the bottom first.


# GTK+ 1.2.10 (GLib 1.2.x)
# ===========
# Prerequisites:
# Perl
# indent
# Glib >= 1.2.8
# XFree86 or X.org

# If you have trouble with the download URL below, you can get it here also:
# http://ftp.gnome.org/pub/gnome/sources/gtk+/1.2/
# http://download.gnome.org/sources/gtk+/1.2/

cd
test -f installed/gtk+-1.2.10.tar.gz && mv installed/gtk+-1.2.10.tar.gz .
test ! -f gtk+-1.2.10.tar.gz &&
 wget ftp://ftp.gtk.org/pub/gtk/v1.2/gtk+-1.2.10.tar.gz

# Verify tarball w/ md5sum:
echo "4d5cb2fc7fb7830e4af9747a36bfce20  gtk+-1.2.10.tar.gz" | md5sum -c

mkdir -p -m 0700 src
cd src
find -maxdepth 1 -type d -name "gtk+-1.*" -exec rm -r {} \;
tar xzvf ~/gtk+-1.2.10.tar.gz
cd gtk+-1.2.10
test $UID = 0 && chown -R root:root .
./configure --prefix=/usr --sysconfdir=/etc --disable-nls
make

# Become root to install it
su

# Remove old files, install the new version
test -x /sbin/removepkg && /sbin/removepkg gtk+
make install
ldconfig

# Make sure your non-root user can remove the source later
chown -R $USER .
chmod -R u+w .

# I only read/write English (well), so I don't need these
find /usr/share/locale -type f -name "gtk+.mo" -exec rm {} \;

# Become yourself again
exit

cd
mkdir -p -m 0700 installed
rm -f installed/gtk+-2.*.tar.*
mv gtk+-1.2.10.tar.gz installed/


# GTK+ 2.12.12
# ============
# Use this one if you're installing it for Gnome 2.20.x or 2.22.x

# Prerequisites:
# pkg-config
# Perl
# indent
# gettext
# Glib >= 2.13.5
# libtiff
# libjpeg
# libpng
# XFree86 or X.org
# pango >= 1.17.3
# atk >= 1.9.0
# Cairo >= 1.2.0
# gtk-doc (Slackware includes this in it's sgml-tools or
#  linuxdoc-tools packages; will be used if --enable-gtk-doc is passed to
#  configure)

# If you have trouble with the download URL below, you can get it here also:
# http://ftp.gnome.org/pub/gnome/sources/gtk+/2.12/
# http://download.gnome.org/sources/gtk+/2.12/

cd
test -f installed/gtk+-2.12.12.tar.bz2 && mv installed/gtk+-2.12.12.tar.bz2 .
test ! -f gtk+-2.12.12.tar.bz2 &&
 wget ftp://ftp.gtk.org/pub/gtk/2.12/gtk+-2.12.12.tar.bz2

# Verify tarball w/ md5sum:
echo "8b2df21ce70bd8e75a45889aaf0a948e  gtk+-2.12.12.tar.bz2" | md5sum -c

mkdir -p -m 0700 src
cd src
find -maxdepth 1 -type d -name "gtk+-2.*" -exec rm -r {} \;
tar xjvf ~/gtk+-2.12.12.tar.bz2
cd gtk+-2.12.12
test $UID = 0 && chown -R root:root .
./configure --prefix=/usr --sysconfdir=/etc --with-xinput=yes
make

# Become root to install it
su

# Remove old files, install the new version
test -x /sbin/removepkg && /sbin/removepkg gtk+2
make install
ldconfig

# Make sure your non-root user can remove the source later
chown -R $USER .
chmod -R u+w .

# I only read/write English (well), so I don't need these
find /usr/share/locale -type f -name "gtk20.mo" -exec rm {} \;
find /usr/share/locale -type f -name "gtk20-properties.mo" -exec rm {} \;

# Become yourself again
exit

cd
mkdir -p -m 0700 installed
rm -f installed/gtk+-2.*.tar.*
mv gtk+-2.12.12.tar.bz2 installed/


# GTK+ 2.14.2
# ===========
# Use this one if you're installing it for Gnome 2.23.x
# (or I guess 2.24.x, which isn't out yet as I write this)

# Prerequisites:
# pkg-config
# Perl
# indent
# gettext
# Glib >= 2.17.6
# libtiff
# libjpeg
# libpng
# jasper (to skip, use --without-libjasper)
# XFree86 or X.org
# pango >= 1.20
# atk >= 1.13.0
# Cairo >= 1.6.0
# gtk-doc (Slackware includes this in it's sgml-tools or
#  linuxdoc-tools packages; will be used if --enable-gtk-doc is passed to
#  configure)

# Even with --without-x, you still need the X development libraries.  So,
# if you're doing something like installing GTK+ for GDK so Cairo can use
# it, you may just want to forget it and build Cairo without GDK.

# GTK+ requires Cairo and Cairo can use GTK+.  So you may want to build
# and install Cairo, then GTK+, then Cairo again.

# If you have trouble with the download URL below, you can get it here also:
# http://ftp.gnome.org/pub/gnome/sources/gtk+/2.14/
# http://download.gnome.org/sources/gtk+/2.14/

cd
test -f installed/gtk+-2.14.2.tar.bz2 && mv installed/gtk+-2.14.2.tar.bz2 .
test ! -f gtk+-2.14.2.tar.bz2 &&
 wget ftp://ftp.gtk.org/pub/gtk/2.14/gtk+-2.14.2.tar.bz2

# Verify tarball w/ md5sum:
echo "b693a2c1c2dd95457b87d0d042aa5bba  gtk+-2.14.2.tar.bz2" | md5sum -c

mkdir -p -m 0700 src
cd src
find -maxdepth 1 -type d -name "gtk+-2.*" -exec rm -r {} \;
tar xjvf ~/gtk+-2.14.2.tar.bz2
cd gtk+-2.14.2
test $UID = 0 && chown -R root:root .

# If you build it with Jasper support, you may need to
# prepend the configure line with this:
# LIBS=-lm \

./configure --prefix=/usr --sysconfdir=/etc --with-xinput=yes
make

# Become root to install it
su

# Remove old files, install the new version
test -x /sbin/removepkg && /sbin/removepkg gtk+2
make install
ldconfig

# Make sure your non-root user can remove the source later
chown -R $USER .
chmod -R u+w .

# I only read/write English (well), so I don't need these
find /usr/share/locale -type f -name "gtk20.mo" -exec rm {} \;
find /usr/share/locale -type f -name "gtk20-properties.mo" -exec rm {} \;

# Become yourself again
exit

cd
mkdir -p -m 0700 installed
rm -f installed/gtk+-2.*.tar.*
mv gtk+-2.14.2.tar.bz2 installed/


# This tells GTK+ to use Xft even if you only have version 1 installed. 
# It'll use version 2 by default.  This will also tell any old GTK+ 2.0 apps
# to use Xft instead of the X11 core font system.
su
echo '#!/bin/sh' > /etc/profile.d/gtk+.sh
echo 'export GDK_USE_XFT=1' >> /etc/profile.d/gtk+.sh
chmod +x /etc/profile.d/gtk+.sh
exit


# If you ever want to uninstall GTK+ 1.x, this should do it:
cd
su
test -d src/gtk+-1.* && ( cd src/gtk+-1.* ; make uninstall )
test -d /etc/gtk && rm -r /etc/gtk
rm -f /usr/bin/gtk-config /usr/share/aclocal/gtk.m4
find /usr/doc -maxdepth 1 -type d -name "gtk+-1.*" -exec rm -r {} \;
( cd /usr/lib ; rm -f libgdk.* libgtk.* libgdk-1.* libgtk-1.* )
( cd /usr/lib/pkgconfig ; rm -f gdk.pc gtk.pc )
( cd /usr/man/man1 ; rm -f gtk-config.1 gtk-config.1.gz )
( cd /usr/info ; rm -f gdk.info* gtk.info* )
find /usr/share/locale -type d -name "gtk+.mo" -exec rm {} \;
test -d /usr/share/themes/Default/gtk &&
 rm -r /usr/share/themes/Default/gtk
test -d /usr/include/gtk-1.2 && rm -r /usr/include/gtk-1.2
ldconfig
exit
find ~/src -maxdepth 1 -type d -name "gtk+-1.*" -exec rm -r {} \;
rm -f ~/installed/gtk+-1.*.tar.*


# If you ever want to uninstall GTK+ 2.x, this should do it:
cd
su
test -d src/gtk+-2.* && ( cd src/gtk+-2.* ; make uninstall )
( cd /usr/bin ; rm -f gdk-pixbuf-csource gdk-pixbuf-query-loaders \
 gtk-query-immodules-2.0 gtk-update-icon-cache gtk-demo )
test -d /usr/include/gtk-2.0 && rm -r /usr/include/gtk-2.0
( cd /usr/lib ; rm -f libgdk_pixbuf-2.* libgdk-x11-2.* libgtk-x11-2.* \
 libgdk_pixbuf_xlib-2.* )
test -d /usr/lib/gtk-2.0 && rm -r /usr/lib/gtk-2.0
( cd /usr/lib/pkgconfig ; rm -f gdk-pixbuf-xlib-2.0.pc gdk-pixbuf-2.0.pc \
 gdk-x11-2.0.pc gtk+-x11-2.0.pc )
( cd /usr/man/man1 ; rm -f gdk-pixbuf-csource.1 gdk-pixbuf-query-loaders.1 \
 gtk-query-immodules-2.0.1 gtk-update-icon-cache.1 )
test -d /usr/share/gtk-2.0 && rm -r /usr/share/gtk-2.0
test -d /usr/share/gtk-doc/html/gdk &&
 rm -r /usr/share/gtk-doc/html/gdk
test -d /usr/share/gtk-doc/html/gdk-pixbuf &&
 rm -r /usr/share/gtk-doc/html/gdk-pixbuf
find /usr/share/themes -type d -name gtk-2.0 -exec rm -r {} \;
rm -f /usr/share/aclocal/gtk-2.0.m4
ldconfig
exit
find ~/src -maxdepth 1 -type d -name "gtk+-2.*" -exec rm -r {} \;
rm -f ~/installed/gtk+-2.*.tar.*

Back to the list


Last updated: Wed, 29 Apr 2020 22:04:50 -0400
Jason Englander <jason at englanders dot us>