Installing Code::Blocks from source on Gentoo

From CodeBlocks
Jump to: navigation, search

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... )

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 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

or

# 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.

# ./bootstrap

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.

# ./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 : SVN access instructions

Credits

First version author: me22 ( me22.ca@gmail.com ) Some changes: sleipner ( themacgyver@gmail.com ) More updating: Crzysdrs And more updating: d1mk4 ( d1mk4nah@gmail.com )