Installing Code::Blocks from source on RPM based distributions

From Code::Blocks


Install Requirements

Note: Code::Blocks requires GTK+ 2.x. Older distributions might only support GTK+ 1.x.

Install Development Tools

This has to be installed before starting:

  • zip
  • update-desktop-files (only on SUSE)
  • make
  • gettext
  • autoconf >= 2.5
  • automake >= 1.7
  • libtool >= 1.4
  • m4
  • intltool
  • gcc-c++
  • libstdc++-devel

In Fedora/CentOS, this can be done with:

su -c 'yum groupinstall "Development Tools"'

Install newer autotools versions

If you have CentOS 3 or RHEL 3, you will need to rebuild "automake17" to use instead of automake-1.6:

rpmbuild --rebuild automake17-1.7.9-5.src.rpm

Then you need to invoke bootstrap like this, both on the commandline and in codeblocks.spec:

AUTOMAKE=automake-1.7 ACLOCAL=aclocal-1.7 ACLOCAL_FLAGS="-I /usr/share/aclocal" ./bootstrap

And edit the BuildRequires in codeblocks.spec, from "automake >= 1.7" to "automake17" package.

Setup RPM environment

This has to be installed before starting:

  • rpm-build

The top work directory for RPM varies between distributions and setups, but you can find your RPM top dir by setting a variable like:

RPM_TOPDIR=`rpm --eval %{_topdir}`
echo $RPM_TOPDIR

Non-root rpmbuild environment

It is recommended that you don't use the root account to build packages, here is how you set up a minimal user build environment:

cd
echo "%_topdir $HOME/rpm" >> .rpmmacros
echo "%_tmppath /tmp/$USER/rpm" >> .rpmmacros
mkdir rpm
cd rpm
mkdir SPECS SOURCES BUILD RPMS SRPMS

You can now build packages without being root (assuming that the spec files are correct). You will still need root access to install.

Install wxWidgets 2.6.x

The build requirements in the source RPM are set to a minimum. So it isn't checked whether wxGTK is installed or not. So you have to take a look at it yourself.

This has to be installed:

  1. wxGTK >= 2.6.0 and its devel package (see wxwidgets.org)
  2. wxGTK-xrc and its devel package (in some distributions included in the packages of point 1)

In later Fedora, this can be done with:

su -c 'yum install wxGTK-devel'

Build the wxGTK RPM from source (if needed)

TODO

RPMS

  • wx-base-unicode-2.6.3.0.2-1.i386.rpm
  • wx-base-unicode-devel-2.6.3.0.2-1.i386.rpm
  • wx-gtk2-unicode-2.6.3.0.2-1.i386.rpm
  • wx-gtk2-unicode-devel-2.6.3.0.2-1.i386.rpm
  • wx-gtk2-unicode-gl-2.6.3.0.2-1.i386.rpm
  • wx-gtk2-unicode-contrib-2.6.3.0.2-1.i386.rpm
  • wx-gtk2-unicode-contrib-devel-2.6.3.0.2-1.i386.rpm
  • wx-gtk2-unicode-debuginfo-2.6.3.0.2-1.i386.rpm
  • wx-i18n-2.6.3.0.2-1.i386.rpm

Install Subversion client

This has to be installed before starting:

Binary packages for Red Hat Linux 9, Fedora Core 1, CentOS 3, CentOS 4 at:

http://the.earth.li/pub/subversion/summersoft.fay.ar.us/pub/subversion/latest/

In later Fedora, this can be done with:

su -c 'yum install subversion'

Build Subversion RPM from source (if needed)

TODO

RPMS

  • subversion-1.4.0-1.i386.rpm
  • subversion-devel-1.4.0-1.i386.rpm
  • subversion-perl-1.4.0-1.i386.rpm
  • subversion-python-1.4.0-1.i386.rpm
  • subversion-tools-1.4.0-1.i386.rpm
  • subversion-debuginfo-1.4.0-1.i386.rpm

Install Code::Blocks

Download the Source RPM

1. Download the Source RPM from www.codeblocks.org/downloads.shtml

Prepare SRPM package from SVN (if needed)

1. You need to get the latest sources from SVN www.codeblocks.org/source_code.shtml

2. go into trunk, if you haven't already done it.

3. run these three commands in this order

./bootstrap
./configure --enable-contrib
make dist

the last one will create a .tar.gz archive that contains the sources.

4. copy the archive to the directory $RPM_TOPDIR/SOURCES

sudo mv codeblocks-trunk-r$REVISION.tar.gz $RPM_TOPDIR/SOURCES

5. build the source RPM, or copy spec to $RPM_TOPDIR/SPECS

rpmbuild -bs codeblocks.spec

This will create a source package in the directory $RPM_TOPDIR/SRPMS/.

Build the RPM package

1. Build the binary package

rpmbuild --rebuild codeblocks-1.0*.src.rpm

This will create several packages in one of the architecture specific subdirectories (i386, x86_64, ppc, ...) of $RPM_TOPDIR/RPMS/.

These are:

  • codeblocks: main package
  • codeblocks-contrib: contrib plugins
  • codeblocks-devel: SDK headers
  • codeblocks-debuginfo: stripped debug information

Install the RPM package

Install as root the packages you want (usually codeblocks and codeblocks-contrib) and enjoy Code::Blocks!