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

From Code::Blocks
 
(36 intermediate revisions by 11 users not shown)
Line 1: Line 1:
 +
[[Category: Installing Code::Blocks]]
 +
[[Category: Installing Code::Blocks from source]]
 +
== 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: [http://forums.gentoo.org/viewtopic-t-588089.html 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. [http://bugs.gentoo.org/show_bug.cgi?id=89533 Gentoo Code::Blocks Package Suggestion]
 +
To create an overlay, please read [http://gentoo-wiki.com/HOWTO_Installing_3rd_Party_Ebuilds 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'''
 
'''WORK IN PROGRESS'''
  
Line 5: Line 24:
 
===Prepare Libraries===
 
===Prepare Libraries===
  
Code::Blocks uses the [http://www.wxwindows.org/ wxWidgets] library for its GUI. wxWidgets in turn uses [http://www.gtk.org/ 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
+
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 :
  
This means that you need to compile the wxGTK package with the following use flags settings:
+
  # echo x11-libs/wxGTK gtk2 >> /etc/portage/package.use
+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
 
  # emerge wxGTK
 +
 +
Note: Code::Blocks now works fine with Unicode. So you might want to build wxGTK with +unicode flag.
  
 
===Get the source code===
 
===Get the source code===
Line 21: Line 45:
 
This is easy and means you have an easily-reproduced source set.
 
This is easy and means you have an easily-reproduced source set.
  
1) '''Download a source tarball''' from [https://www.codeblocks.org/modules.php?op=modload&name=Downloads&file=index&req=viewsdownload&sid=3 The Download Section of CodeBlocks.org]
+
1) '''Download a source tarball''' from [http://sourceforge.net/project/showfiles.php?group_id=126998&package_id=142469 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.
+
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====
+
====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.
 
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 :
+
1) '''Install the SVN client'''.  You might have it already.  If not, this just requires the usual :
  # emerge dev-util/cvs
+
  # emerge dev-util/subversion
  
2) '''Set the CVS root'''. Run the following command, and enter the password ''anonymous'' when asked :
+
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.
# 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
 
  # cd /usr/local/src
The following command fetches the source from the CVS server :
+
The following command fetches the source from the SVN server :
  # cvs -d :pserver:anonymous@cvs.sourceforge.net:/cvsroot/codeblocks checkout codeblocks
+
  # svn checkout svn://svn.berlios.de/codeblocks/trunk
  
 
===Compile the Code===
 
===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 :
+
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/src
+
  # cd /usr/local/src/codeblocks
or
+
or
  # cd /usr/local/src/CodeBlocks-1.0-beta5
+
  # cd /usr/local/src/codeblocks-1.0rc2
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 :
+
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.
  # make -f Makefile.unix
+
  # ./bootstrap
  # make -f Makefile.unix update
+
Note: If you get weird errors here try running following command and then bootstrap again.
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.
+
  # find . -type f -and -not -name "*.cpp" -and -not -name "*.h" -and -not -name "*.png" -and -not -name "*.bmp" | sed "s/.*/\"\\0\"/" | xargs dos2unix
  
'''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:
+
3) '''configure'''. Use 'configure --help' to see what things you can enable or disable.
  # emerge -av dos2unix
+
  # ./configure
This will install dos2unix. Now we are ready to convert the script.
+
 
  # dos2unix -n update update.unix
+
4) '''make and make install'''.
  # chmod +x update.unix
+
  # make
# ./update.unix
+
  # sudo make install
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===
 
===More===
Line 67: Line 84:
 
to come
 
to come
  
For now ( assuming bash shell ):
+
To run Code::Blocks:
  $ cd /usr/local/src/codeblocks/src/output
+
  # codeblocks
$ LD_LIBRARY_PATH="." ./codeblocks.exe
 
  
 
===References===
 
===References===
Line 75: Line 91:
 
[https://www.codeblocks.org/index.php?name=PNphpBB2&file=viewtopic&t=29 Linux releases or compiling on Linux] from the forum
 
[https://www.codeblocks.org/index.php?name=PNphpBB2&file=viewtopic&t=29 Linux releases or compiling on Linux] from the forum
  
[http://sourceforge.net/cvs/?group_id=126998 Code::Blocks : CVS access instructions]
+
[https://www.codeblocks.org/source_code.shtml Code::Blocks : SVN access instructions]
 
 
[http://sourceforge.net/docman/display_doc.php?docid=14033&group_id=1 Basic Introduction to CVS and SourceForge.net (SF.net) Project CVS Services]
 
  
 
===Credits===
 
===Credits===
  
Original Author: me22 ( me22.ca@gmail.com )
+
First version author: me22 ( me22.ca@gmail.com )
 +
Some changes: sleipner ( themacgyver@gmail.com )
 +
More updating: Crzysdrs
 +
And more updating: d1mk4 ( d1mk4nah@gmail.com )

Latest revision as of 23:26, 4 July 2010

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 )