Difference between revisions of "Installing Code::Blocks from source on Gentoo"

From Code::Blocks
(OUT OF DATE)
Line 1: Line 1:
 +
 +
= NOTE: THIS INFORMATION IS ANTIQUATED! =
 +
 +
== Code::Blocks now works fine with Unicode and wx2.6, and the build system has changed ==
 +
 
'''WORK IN PROGRESS'''
 
'''WORK IN PROGRESS'''
  

Revision as of 19:43, 25 October 2005

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 library for its GUI. wxWidgets in turn uses GTK+. 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. 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: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 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.

Note: The "update" script seems to be using Dos character encoding, which will result in its failure to run on Linux. To fix this, use dos2unix:

# emerge -av dos2unix

This will install dos2unix. Now we are ready to convert the script.

# dos2unix -n update update.unix
# chmod +x update.unix
# ./update.unix

The first line converts the script character encoding, the second makes it executable and the third runs it. This trick is from a forum post by ilkapo.

More

to come

For now ( assuming bash shell ):

$ cd /usr/local/src/codeblocks/src/output
$ LD_LIBRARY_PATH="." ./codeblocks.exe

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 )