Installing Code::Blocks from source on Gentoo

From Code::Blocks

NOTE: THIS INFORMATION IS ANTIQUATED!

Code::Blocks now works fine with Unicode and wx2.6, and the build system has changed

WORK IN PROGRESS

( Note: This is non-official and unverified. It worked for me, but... )

Prepare Libraries

Code::Blocks uses the wxWidgets (http://www.wxwindows.org/) library for its GUI. wxWidgets in turn uses GTK+ (http://www.gtk.org/). GTK+ is the library which GNOME desktop uses, but GNOME is not required to use it. In fact, odds are very good that if you have a number of GUI programs installed, you already have it. wxWidgets is also very common, if slightly less so.

You need to compile the wxGTK package with the following use flag:

+gtk2 

The best way of getting this done is by adding a line to /etc/portage/package.use and recompiling wxGTK :

# echo x11-libs/wxGTK gtk2  >> /etc/portage/package.use
# emerge wxGTK

Note: Code::Blocks now works fine with Unicode. So you might want to build wxGTK with +unicode flag.

Get the source code

For this you have 2 options:

Option 1: Download a source tarball.

This is easy and means you have an easily-reproduced source set.

1) Download a source tarball from The Download Section of CodeBlocks.org

2) Extract it. For this tutorial, I'm going to assume that you're installing as root, so /usr/local/src is a good pick. Any location is fine, however. This should create a codeblocks-1.0rc2 ( or similar ) folder.

Option 2: Fetch from CVS

This is not signifigantly harder and means you have a more up-to-date version of the source code. Usually this means more features and different bugs, which might be more or less annoying.

1) Install the CVS client. You might have it already. If not, this just requires the usual :

# emerge dev-util/cvs

2) Set the CVS root. Run the following command, and enter the password anonymous when asked :

# cvs -d :pserver:anonymous@cvs.sourceforge.net:/cvsroot/codeblocks login

Note that simply hitting enter--not entering a password--might also work.

3) Checkout a copy. cd to the directory you want the code to be placed in. Note that CVS will create a codeblocks directory for you. For this tutorial, I'm going to assume that you're installing as root, so /usr/local/src is a good pick. Any location is fine, however.

# cd /usr/local/src

The following command fetches the source from the CVS server :

# cvs -d :pserver:anonymous@cvs.sourceforge.net:/cvsroot/codeblocks checkout codeblocks

Compile the Code

1) cd to codeblocks directory. Following our example, from CVS this would be /usr/local/src/codeblocks; from a tarball, something like /usr/local/src/codeblocks-1.0rc2 :

# cd /usr/local/src/codeblocks

or

# cd /usr/local/src/codeblocks-1.0rc2

2) bootsrap. The very first time you unpack the source (or checkout from CVS), you need to run ./bootstrap. This will create a sane building environment.

# ./bootsrap

Note: If you get weird errors here try running following command and then bootsrap again.

# find . -type f -and -not -name "*.cpp" -and -not -name "*.h" -and -not -name "*.png" -and -not -name "*.bmp" | sed "s/.*/\"\\0\"/" | xargs dos2unix

3) configure. Use 'configure --help' to see what things you can enable or disable.

# ./configure

4) make and make install.

# make
# sudo make install

More

to come

To run Code::Blocks:

# codeblocks

References

Linux releases or compiling on Linux from the forum

Code::Blocks : CVS access instructions

Basic Introduction to CVS and SourceForge.net (SF.net) Project CVS Services

Credits

Original Author: me22 ( me22.ca@gmail.com ) Some changes: sleipner ( themacgyver@gmail.com )