Installing Code::Blocks from source on Gentoo
Current Code::Blocks Compilation Methods for Gentoo
Subversion Portage Overlay
Code::Blocks is available in Portage. So the current suggested method for installing Code::Blocks on Gentoo is as simple as:
# emerge -av codeblocks
However you may want to use development version of Code::Blocks which is in portage, too. Previously it was available through the use of custom ebuild that is located here: Gentoo Forums Code::Blocks Portage Overlay But since it is in portage, there is no need for it. To install the development version (codeblocks-9999.ebuild), all you have to do is just adding the line (without quotes) "dev-util/codeblocks **" into your /etc/portage/package.keywords file. And then install as usual:
# emerge -av codeblocks
Create your own overlay
Another method of pulling together your own Ebuilds and creating your own portage overlay is to view the bug report for adding Code::Blocks to portage. Gentoo Code::Blocks Package Suggestion To create an overlay, please read HOWTO Installing 3rd Party Ebuilds. But since Code::Blocks is already in portage you should not need this. Just use the current suggested method as stated above.
Preparing Code::Blocks from Source (For 1.0rc2)
WORK IN PROGRESS
( Note: This is non-official and unverified. It worked for me, but... )
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:
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 SVN
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 SVN client. You might have it already. If not, this just requires the usual :
# emerge dev-util/subversion
2) Checkout a copy. cd to the directory you want the code to be placed in. Note that SVN 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 SVN server :
# svn checkout svn://svn.berlios.de/codeblocks/trunk
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
# cd /usr/local/src/codeblocks-1.0rc2
2) bootstrap. The very first time you unpack the source (or checkout from CVS), you need to run ./bootstrap. This will create a sane building environment.
Note: If you get weird errors here try running following command and then bootstrap 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.
4) make and make install.
# make # sudo make install
To run Code::Blocks:
Linux releases or compiling on Linux from the forum
First version author: me22 ( email@example.com ) Some changes: sleipner ( firstname.lastname@example.org ) More updating: Crzysdrs And more updating: d1mk4 ( email@example.com )