Installing Code::Blocks from source on Gentoo
WORK IN PROGRESS
( Note: This is non-official and unverified. It worked for me, but... )
Code::Blocks uses the wxWidgets library for its GUI. wxWidgets is turn uses GTK+. GTK+ is the library the 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. The trick with wxWidgets and Code::Blocks is that Code::Blocks can only use the gtk2, non-unicode version of wxWidgets
This means that you need to compile the wxGTK package with the following use flags settings:
+no_wxgtk1 +gtk2 -unicode
The best way of getting these set is by adding a line to /etc/portage/package.use and recompiling wxGTK :
# echo x11-libs/wxGTK no_wxgtk1 gtk2 -unicode >> /etc/portage/package.use # emerge wxGTK
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.0-beta5 ( 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:[email protected]:/cvsroot/codeblocks login
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:[email protected]:/cvsroot/codeblocks checkout codeblocks
Compile the Code
1) cd to the directory with the Makefile. Following our example, from CVS this would be /usr/local/src/codeblocks/src; from a tarball, something like /usr/local/src/CodeBlocks-1.0-beta5 :
# cd /usr/local/src/codeblocks/src or # cd /usr/local/src/CodeBlocks-1.0-beta5
If neither of those works, you can always use find to look for it :
# find <parent directory you extracted to> -name Makefile.unix
2) Build the sources. There's no configuration nessesary, just let make go to work :
# make -f Makefile.unix # make -f Makefile.unix update
The first line does the actual compiling. The second moves the nessesary things to the output directory, zips some resources, and performs other miscellaneous nessesary tasks.
For now ( assuming bash shell ):
$ cd /usr/local/src/codeblocks/src/output $ LD_LIBRARY_PATH="." ./codeblocks.exe
Linux releases or compiling on Linux from the forum
Original Author: me22 ( [email protected] )