https://wiki.codeblocks.org/api.php?action=feedcontributions&user=Auria&feedformat=atomCode::Blocks - User contributions [en]2024-03-29T08:31:35ZUser contributionsMediaWiki 1.35.0https://wiki.codeblocks.org/index.php?title=Installing_Code::Blocks_from_source_on_Mac_OS_X&diff=5537Installing Code::Blocks from source on Mac OS X2008-07-11T00:22:23Z<p>Auria: /* Install Developer Tools */</p>
<hr />
<div>[[Category:Installing Code::Blocks]]<br />
[[Category:Installing Code::Blocks from source]]<br />
These are instructions on how to build Code::Blocks under Apple Mac OS X.<br />
They have been tested under Mac OS X version 10.3 and under Mac OS X 10.4<br />
(PowerPC and Intel), and might work on old Mac OS X 10.2 and 10.1 as well.<br />
<br />
We will be building everything from scratch using the source code, and<br />
not use any available package managers like<br />
[http://www.macports.org MacPorts],<br />
[http://fink.sourceforge.net/ Fink],<br />
[http://gentoo-wiki.com/Gentoo_MacOS Gentoo] or<br />
[http://rpm4darwin.sourceforge.net RPM].<br />
Packaging can be done later, once it has reached a more stable release.<br />
<br />
Update: building for MacPorts can be found at the end of the document.<br />
<br />
== Install Developer Tools ==<br />
<br />
If they didn't come bundled with Mac OS X, get the Xcode Tools (or Developer Tools for older Mac OS X) from http://developer.apple.com/tools/ or from your install disk.<br />
<br />
This will install Apple versions of:<br />
<br />
* http://www.gnu.org/software/gcc/ (GNU Compilers)<br />
* http://www.gnu.org/software/gdb/ (GNU Debugger)<br />
* http://www.gnu.org/software/make/ (GNU Make)<br />
<br />
Note: 2006/04<br />
Apple pulled all the old links in order to promote Mac OS X 10.4, but all the<br />
old developer tools can be downloaded from ADC at http://connect.apple.com/<br />
<br />
You need a (free) developer registration with Apple first, in order to log in there.<br />
For Mac OS X 10.4, you want (at least) Xcode 2.2, since earlier versions were buggy.<br />
For Mac OS X 10.3, you want Xcode 1.5.<br />
<br />
== Check Autotools versions ==<br />
<br />
Depending on your OS version, you might need to download and compile new versions of these:<br />
<br />
* http://www.gnu.org/software/autoconf/ (GNU Autoconf)<br />
* http://www.gnu.org/software/automake/ (GNU Automake)<br />
* http://www.gnu.org/software/libtool/ (GNU Libtool)<br />
<br />
Check what you have, with <tt>--version</tt> (note that GNU libtool is called "glibtool" on Mac OS X)<br />
<br />
Currently Code::Blocks requires versions:<br />
* autoconf 2.50+<br />
* automake 1.7+ (1.9+ needed in order to build the dist tarball)<br />
* libtool 1.4+ (1.5.8+ highly recommended to get some bug fixes)<br />
<br />
=== Automake example (Panther) ===<br />
<br />
For Mac OS X 10.3, you will only need an upgraded (local) installation of automake 1.7.x.<br />
<br />
You can download "[ftp://ftp.gnu.org/gnu/automake/automake-1.7.9.tar.gz automake-1.7.9.tar.gz]" and configure and install it with something like:<br />
<br />
<pre><br />
./configure --prefix=/usr/local --program-suffix=-1.7<br />
make<br />
sudo make install<br />
sudo cp -pi /usr/share/aclocal/libtool.m4 [prefix]/share/aclocal-1.7/<br />
</pre><br />
<br />
Since it's now known as "automake-1.7", it won't interfere with the regular "automake"<br />
<br />
On Mac OS X 10.4.8, i downloaded and installed version 1.9. I configured without any options and followed the same steps as above. I just replaced 'automake-1.7' and 'aclocal-1.7' in the bootstrap section by 'automake-1.9' and 'aclocal-1.9' and everything worked.<br />
<br />
If you would rather have the new version to be called when calling "automake", let it install into /usr/local and put /usr/local/bin before /usr/bin in your PATH.<br />
<br />
=== Libtool example ===<br />
Download [http://www.gnu.org/software/libtool/ libtool] source. The following instructions will overwrite your current version of libtool with the one you just downloaded.<br />
<pre><br />
cd /libtool-*/<br />
./configure --prefix=/usr --program-prefix=g<br />
make<br />
sudo make install<br />
</pre><br />
<br />
Note that this will replace the system version of glibtool, which might have some compatibility issues with building other software.<br />
<br />
== FYI: Universal Binaries ==<br />
<br />
If you are building for Mac OS X 10.4 or later, you might want to build "[http://www.apple.com/universal/ Universal Binaries ]"<br />
These are binaries that contain code for both PowerPC ("ppc" arch) and Intel ("i386" arch)<br />
<br />
The basic flags that needs to be added are:<br />
<pre><br />
CFLAGS += "-isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch i386 -arch ppc"<br />
<br />
CXXFLAGS += "-isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch i386 -arch ppc"<br />
</pre><br />
(You only need the sysroot parameter on PowerPC Macintosh, not on a Intel Macintosh)<br />
The "-arch i386 -arch ppc" is what tells the compiler to build a "universal" (or "fat") binary.<br />
<br />
Usually it's easiest to build one version for "powerpc-apple-darwin8",<br />
and one version for "i686-apple-darwin8", and then merge them with "[http://developer.apple.com/documentation/Darwin/Reference/ManPages/man1/lipo.1.html lipo]"<br />
<br />
<pre><br />
./configure --host=powerpc-apple-darwin8 --target=powerpc-apple-darwin8<br />
<br />
./configure --host=i686-apple-darwin8 --target=i686-apple-darwin8<br />
</pre><br />
<br />
Some caveats:<br />
* pre-compiled headers might fail with a "no main" error. If they do, add a -c to only compile them<br />
* when cross-compiling, tools like auto_revision might fail to build. copy these from a native build<br />
* the Tiger compilers might crash from time to time, but that is only to be expected (it seems)...<br />
<br />
See [http://developer.apple.com/technotes/tn2005/tn2137.html Technical Note TN2137]: Building Universal <br />
Binaries from "configure"-based Open Source Projects<br />
<br />
== FYI: ANSI or UNICODE ==<br />
<br />
For the moment we are using "ANSI" (--disable-unicode, default) for Mac OS X 10.3 and earlier,<br />
and "UNICODE" (--enable-unicode, optional) for Mac OS X 10.4 and later. <br />
<br />
See http://www.wxwidgets.org/manuals/stable/wx_unicode.html#unicodeandansi<br />
<br />
== Build wxWidgets ==<br />
<br />
=== Download the source code ===<br />
<br />
Download the tarball for the wxMac release:<br />
<br />
http://wxwidgets.org/downloads/<br />
<br />
=== Apply necessary patches ===<br />
<br />
Don't forget to apply any released patches!<br />
<br />
http://wxwidgets.org/downloads/patch.htm<br />
<br />
=== Configure and (GNU) Make ===<br />
<br />
<pre><br />
mkdir mac-build<br />
cd mac-build<br />
../configure --enable-shared --enable-monolithic --enable-unicode --with-mac --with-opengl \<br />
--with-png=builtin --with-jpeg=builtin --with-tiff=builtin --with-expat=builtin<br />
nice make<br />
</pre><br />
<br />
note: the easiest way to build a Universal Binary with wxWidgets is<br />
the new flag: --enable-universal_binary (you need wxWidgets 2.6.4+)<br />
<br />
=== Install into Destination ===<br />
<br />
<pre><br />
sudo make install<br />
</pre><br />
<br />
== Bundle library for Mac ==<br />
<br />
To avoid having the Code::Blocks user having to compile or install wxWidgets themselves,<br />
we can bundle it with our application so that it is contained in the application bundle.<br />
This could also be done by statically linking wxWidgets, but with dynamic linking we can<br />
share the wxWidgets library between all applications using wxWidgets (not just Code::Blocks)<br />
<br />
<br />
=== Way One: Library (dynamic) ===<br />
<br />
<pre><br />
/usr/local/include/wx-2.6/wx/wx.h<br />
/usr/local/lib/libwx_macu-2.6.dylib -> libwx_macu-2.6.0.dylib<br />
/usr/local/lib/libwx_macu-2.6.0.dylib -> libwx_macu-2.6.0.4.0.dylib<br />
/usr/local/lib/libwx_macu-2.6.0.4.0.dylib<br />
</pre><br />
<br />
To bundle our shared library with the application, we include it in "MacOS" and change the path:<br />
<br />
<pre><br />
install_name_tool -id @executable_path/libwx_macu-2.6.0.dylib<br />
</pre><br />
<br />
@executable_path will be replaced with e.g. /Developer/Applications/CodeBlocks.app/Contents/MacOS<br />
<br />
=== Way Two: Framework (bundle) ===<br />
<br />
<pre><br />
/Library/Frameworks/wx.framework/Headers -> Versions/Current/Headers<br />
/Library/Frameworks/wx.framework/wx -> Versions/Current/wx<br />
/Library/Frameworks/wx.framework/Versions/Current -> 2.6<br />
/Library/Frameworks/wx.framework/Versions/2.6/Headers/wx.h<br />
/Library/Frameworks/wx.framework/Versions/2.6/wx -> libwx_macu-2.6.0.dylib<br />
/Library/Frameworks/wx.framework/Versions/2.6/libwx_macu-2.6.0.dylib -> libwx_macu-2.6.0.4.0.dylib<br />
/Library/Frameworks/wx.framework/Versions/2.6/libwx_macu-2.6.0.4.0.dylib<br />
</pre><br />
<br />
To bundle our framework with the application, we include it in "Frameworks" and change the path:<br />
<br />
<pre><br />
install_name_tool -id @executable_path/../Frameworks/wx.framework/Versions/2.6/libwx_macu-2.6.0.dylib<br />
</pre><br />
<br />
This way it will first look in the framework path (-F), and then in for the shared library path (-L) as usual.<br />
<br />
== Install Subversion client ==<br />
<br />
http://subversion.tigris.org/<br />
<br />
Note: you need SVN for the Code::Blocks revision scripts to work!<br />
<br />
== Build CodeBlocks from SVN ==<br />
<br />
=== Download the source code ===<br />
<br />
https://www.codeblocks.org/source_code.shtml<br />
<br />
<pre><br />
svn checkout svn://svn.berlios.de/codeblocks/trunk<br />
cd trunk<br />
</pre><br />
<br />
=== Apply necessary patches ===<br />
<br />
For a list of all available patches, see:<br />
<br />
http://developer.berlios.de/patch/?group_id=5358<br />
<br />
You might need to convert line endings from DOS to Unix first.<br />
<br />
=== Bootstrap with Autotools ===<br />
<br />
You need to use the newer version of automake (see above), for the "bootstrap". (OS X 10.5 users may have recent enough autotools so they may not need to install them)<br />
<br />
<pre><br />
# if you installed newer autotools under names with suffixes.<br />
export AUTOMAKE=automake-1.9<br />
export ACLOCAL=aclocal-1.9<br />
<br />
# do bootstrap. you may need to adapt /usr/share/aclocal<br />
# to whatever other location you may use<br />
# (for instance, in my case, /usr/local/share/aclocal)<br />
ACLOCAL_FLAGS="-I /usr/share/aclocal" ./bootstrap<br />
</pre><br />
<br />
=== Mono Fix ===<br />
<br />
If you have the Mono.framework installed, then it probably set up a symlink like:<br />
<br />
<pre><br />
/usr/bin/pkg-config -> /Library/Frameworks/Mono.framework/Commands/pkg-config<br />
</pre><br />
<br />
Unless you have a "proper" [http://pkgconfig.freedesktop.org/ pkg-config] installation the Code::Blocks configure will fail, so move this symbolic link aside.<br />
<br />
=== Configure ===<br />
<br />
<pre><br />
./configure --enable-contrib<br />
</pre><br />
<br />
Note: the easiest way to build a Universal Binary for Code::Blocks is to build once for PowerPC (-arch ppc) and once for Intel (-arch i386), and then merge them (with lipo) afterwards.<br />
<br />
<pre><br />
mkdir ppc-build<br />
cd ppc-build<br />
../configure --host=powerpc-apple-darwin8 --target=powerpc-apple-darwin8 --enable-contrib<br />
cd ..<br />
<br />
mkdir x86-build<br />
cd x86-build<br />
../configure --host=i686-apple-darwin8 --target=i686-apple-darwin8 --enable-contrib<br />
cd ..<br />
</pre><br />
<br />
Note: You need to patch the location of the pre-compiled headers, or it will generate them in the same place for both arch.<br />
<br />
=== Tiger Fix ===<br />
<br />
There is a bug in the glibtool of Mac OS X 10.4, that fails to link C++ libs:<br />
<br />
<pre><br />
ld: multiple definitions of symbol ___umoddi3<br />
/usr/lib/gcc/powerpc-apple-darwin8/4.0.1/libgcc.a(_umoddi3.o) private external definition of ___umoddi3 in section (__TEXT,__text)<br />
/usr/lib/gcc/powerpc-apple-darwin8/4.0.1/../../../libgcc_s.10.4.dylib(_umoddi3_s.o) definition of ___umoddi3<br />
<br />
ld: multiple definitions of symbol ___umoddi3<br />
/usr/lib/gcc/i686-apple-darwin8/4.0.1/libgcc.a(_umoddi3.o) private external definition of ___umoddi3 in section (__TEXT,__text)<br />
/usr/lib/gcc/i686-apple-darwin8/4.0.1/../../../libgcc_s.10.4.dylib(_umoddi3_s.o) definition of ___umoddi3<br />
</pre><br />
<br />
To work around this, you need to edit the generated "libtool" script manually:<br />
<br />
<pre><br />
177c177<br />
< whole_archive_flag_spec="-all_load \$convenience"<br />
---<br />
> whole_archive_flag_spec=""<br />
6921c6921<br />
< whole_archive_flag_spec="-all_load \$convenience"<br />
---<br />
> whole_archive_flag_spec=""<br />
</pre><br />
<br />
This bug has been fixed in GNU libtool 1.5.8 and later.<br />
<br />
=== (GNU) Make ===<br />
<br />
"nice" isn't strictly needed, it just makes the compile run at a lower process priority<br />
<br />
<pre><br />
nice make<br />
</pre><br />
<br />
For the Universal Binary build:<br />
<br />
<pre><br />
cd ppc-build<br />
nice make<br />
cd ..<br />
<br />
cd x86-build<br />
nice make<br />
cd ..<br />
</pre><br />
<br />
=== Install into Destination ===<br />
<br />
"sudo" asks you for an admin password, in order to get install permissions<br />
<br />
<pre><br />
sudo make install<br />
</pre><br />
<br />
For the Universal Binary build:<br />
<br />
<pre><br />
cd ppc-build<br />
make install DESTDIR=/tmp/ppc<br />
cd ..<br />
<br />
cd x86-build<br />
make install DESTDIR=/tmp/x86<br />
cd ..<br />
<br />
lipomerge /tmp/ppc /tmp/x86 /tmp/fat<br />
</pre><br />
<br />
Where "lipomerge" is a custom shell script:<br />
<br />
* http://www.algonet.se/~afb/wx/lipomerge<br />
<br />
== Bundle application for Mac ==<br />
<br />
After building codeblocks in the regular Unix way, you need to bundle it with the icons<br />
and various other info that it needs to make a regular stand-alone Macintosh application.<br />
<br />
There are two ways of accomplishing this, old Mac OS-style resource or NeXT-style bundle.<br />
The old resources are handy while developing, while bundles are more suitable for release.<br />
<br />
Note: You '''need''' to use either of these methods, or your application will launch<br />
in the background behind all other windows and will be unable to receive any events!<br />
<br />
=== Way One: Mac OS (resource) ===<br />
<br />
http://developer.apple.com/documentation/Carbon/Reference/Resource_Manager/<br />
<br />
Handy while developing, as you only need to add an icon.<br />
<br />
Files needed:<br />
* http://www.algonet.se/~afb/wx/CodeBlocks.r.gz (Rez icon, gzipped)<br />
<br />
First we install the program to the PREFIX directory of your choice:<br />
<br />
<pre><br />
$PREFIX/bin<br />
$PREFIX/lib<br />
$PREFIX/share/codeblocks<br />
</pre><br />
<br />
Add a custom icon to the application, and make it receive events:<br />
<br />
<pre><br />
gunzip CodeBlocks.r.gz<br />
sudo /Developer/Tools/Rez -d __DARWIN__ -t APPL -d __WXMAC__ \<br />
CodeBlocks.r Carbon.r -o $PREFIX/bin/codeblocks<br />
sudo /Developer/Tools/SetFile -a C $PREFIX/bin/codeblocks<br />
</pre><br />
<br />
Note: on the Intel Macintoshes, the icon comes up as "broken"<br />
(apparently it assumes that all apps with resforks are Classic)<br />
<br />
Without the icon part, this could also have be written as just:<br />
<br />
<pre><br />
sudo `wx-config --rezflags` $PREFIX/bin/codeblocks<br />
</pre><br />
<br />
Start the application with a small prefix shell wrapper like this:<br />
<br />
<pre><br />
DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:$PREFIX/lib<br />
export DYLD_LIBRARY_PATH<br />
<br />
$PREFIX/bin/codeblocks --prefix=$PREFIX<br />
</pre><br />
<br />
You don't need the "DYLD_LIBRARY_PATH" stuff,<br />
if you are installing to a system directory.<br />
<br />
==== Common PREFIX Settings ====<br />
<br />
Local: <tt>PREFIX=/usr/local</tt><br />
<br />
System: <tt>PREFIX=/usr</tt><br />
<br />
MacPorts: <tt>PREFIX=/opt/local</tt><br />
<br />
Fink: <tt>PREFIX=/sw</tt><br />
<br />
=== Way Two: NeXT (bundle) ===<br />
<br />
http://developer.apple.com/documentation/CoreFoundation/Conceptual/CFBundles/<br />
<br />
This does not involve resources, and is more relocatable.<br />
<br />
Files needed:<br />
* http://www.algonet.se/~afb/wx/CodeBlocks.Info.plist (rename to "Info.plist")<br />
* http://www.algonet.se/~afb/wx/CodeBlocks.sh (shell wrapper, rename to "CodeBlocks")<br />
* http://www.algonet.se/~afb/wx/CodeBlocks.icns (Mac OS X icon, rename to "app.icns")<br />
<br />
The MacOS program will just be a shell wrapper that calls "bin/codeblocks", like above.<br />
Traditionally the bundle would include Frameworks and Resources, but we'll just avoid those<br />
here and use the regular "lib" and "share/codeblocks" instead (just as with a regular install). <br />
These temporary directories are listed in italic below, they're not really used in bundles...<br />
<br />
Setup a hierarchy like this, and copy the files from the regular build/install and the above file list to it:<br />
<br />
CodeBlocks.app<br />
CodeBlocks.app/Contents/<br />
CodeBlocks.app/Contents/Info.plist<br />
CodeBlocks.app/Contents/MacOS/<br />
CodeBlocks.app/Contents/MacOS/CodeBlocks<br />
CodeBlocks.app/Contents/Resources/<br />
CodeBlocks.app/Contents/Resources/app.icns<br />
''CodeBlocks.app/Contents/bin/''<br />
''CodeBlocks.app/Contents/lib/''<br />
''CodeBlocks.app/Contents/share/codeblocks/''<br />
<br />
The CodeBlocks application can now be moved with the Finder, and started up like a regular Mac application. (the nightly build includes a more advanced Info.plist and more icons - for also mapping all the files that the application can open, like source code and header files and such)<br />
<br />
==== Proper Application Bundling ====<br />
<br />
To avoid the shell wrapper, the binary can now be moved from "bin/codeblocks" to "MacOS/CodeBlocks". Helper files are moved from "share/codeblocks" to "Resources". The dynamic libraries are moved from "lib" to "MacOS":<br />
<br />
<pre><br />
mv bin/codeblocks MacOS/CodeBlocks<br />
rmdir bin<br />
mv lib/* MacOS/<br />
rmdir lib<br />
mv share Resources/<br />
</pre><br />
<br />
To avoid having to use a DYLD_LIBRARY_PATH, we rename the shared libraries (with the install_name_tool program) from e.g. /usr/local/lib/ to @executable_path/:<br />
<br />
<pre><br />
install_name_tool -change /usr/local/lib/libcodeblocks.0.dylib \<br />
@executable_path/libcodeblocks.0.dylib MacOS/CodeBlocks<br />
</pre><br />
<br />
The libraries can have their names changed using the -id parameter:<br />
<br />
<pre><br />
install_name_tool -id @executable_path/libcodeblocks.0.dylib MacOS/libcodeblocks.0.dylib<br />
</pre><br />
<br />
You also need to change all of the loadable bundles for the plugins:<br />
<br />
<pre><br />
for so in Resources/plugins/*.so<br />
do install_name_tool -change /usr/local/lib/libcodeblocks.0.dylib \<br />
@executable_path/libcodeblocks.0.dylib $so<br />
done<br />
</pre><br />
<br />
You can check the result, what libraries/frameworks it links to, with:<br />
<br />
<pre><br />
otool -L CodeBlocks<br />
</pre><br />
<br />
Optionally you can then repeat the process, for the wx library too...<br />
<br />
== FYI: Darwin vs. Mac OS X ==<br />
<br />
"Darwin is the UNIX technology-based foundation of Mac OS X."<br />
<br />
* http://developer.apple.com/referencelibrary/Darwin/<br />
<br />
* http://en.wikipedia.org/wiki/Darwin_(operating_system)<br />
<br />
"Pure Darwin" here refers to the Open Source version of the OS:<br />
<br />
* http://www.opensource.apple.com/darwinsource/images/<br />
<br />
* http://opendarwin.org/ or http://gnu-darwin.sourceforge.net/<br />
<br />
(that is: Darwin using X11 instead of Aqua for the user interface)<br />
<br />
== Install with MacPorts ==<br />
<br />
=== Install wxWidgets ===<br />
<br />
You will need the wxWidgets library, install as port with:<br />
<br />
<pre><br />
sudo port install wxWidgets<br />
</pre><br />
<br />
If you want the X11/GTK version on Mac OS X, instead use:<br />
<br />
<pre><br />
sudo port install wxgtk<br />
</pre><br />
<br />
=== Install Code::Blocks ===<br />
<br />
After that is installed, you can install Code::Blocks with:<br />
<br />
<pre><br />
sudo port install codeblocks-devel +aqua<br />
</pre><br />
<br />
If you want the X11/GTK version on Mac OS X, instead use:<br />
<br />
<pre><br />
sudo port install codeblocks-devel +x11<br />
</pre><br />
<br />
This will download the SVN trunk, and any dependencies:<br />
<br />
<pre><br />
---> Fetching codeblocks-devel<br />
---> Verifying checksum(s) for codeblocks-devel<br />
---> Extracting codeblocks-devel<br />
---> Configuring codeblocks-devel<br />
---> Building codeblocks-devel with target all<br />
---> Staging codeblocks-devel into destroot<br />
---> Packaging tgz archive for codeblocks-devel 1.0_0+aqua+macosx<br />
---> Installing codeblocks-devel 1.0_0+aqua+macosx<br />
---> Activating codeblocks-devel 1.0_0+aqua+macosx<br />
---> Cleaning codeblocks-devel<br />
</pre><br />
<br />
Note: to upgrade from SVN, you need to uninstall first:<br />
<br />
<pre><br />
sudo port uninstall codeblocks-devel<br />
sudo port clean codeblocks-devel<br />
sudo port install codeblocks-devel<br />
</pre><br />
<br />
This is both because all SVN versions are numbered "0",<br />
but also due to a bug in the Code::Blocks build scripts.<br />
<br />
=== Running <tt>+aqua</tt> (wxMac) version ===<br />
<br />
After the build completes, you can start the program by:<br />
<br />
<pre><br />
open /Applications/MacPorts/CodeBlocks.app<br />
</pre><br />
<br />
Note that the wxMac application bundle in "MacPorts"<br />
is just a wrapper, with symbolic links to /opt/local...<br />
<br />
<pre><br />
/opt/local/bin/codeblocks<br />
</pre><br />
<br />
=== Running <tt>+x11</tt> (wxGTK) version ===<br />
<br />
The non-bundled wxGTK version is instead started with:<br />
<br />
<pre><br />
/opt/local/bin/codeblocks<br />
</pre><br />
<br />
When running X11/wxGTK programs in Mac OS X, you can use<br />
"open-x11" to first start up X11.app and set up $DISPLAY:<br />
<br />
<pre><br />
open-x11 /opt/local/bin/codeblocks<br />
</pre></div>Auriahttps://wiki.codeblocks.org/index.php?title=Installing_Code::Blocks_from_source_on_Mac_OS_X&diff=5536Installing Code::Blocks from source on Mac OS X2008-07-11T00:20:53Z<p>Auria: /* Automake example (Panther) */</p>
<hr />
<div>[[Category:Installing Code::Blocks]]<br />
[[Category:Installing Code::Blocks from source]]<br />
These are instructions on how to build Code::Blocks under Apple Mac OS X.<br />
They have been tested under Mac OS X version 10.3 and under Mac OS X 10.4<br />
(PowerPC and Intel), and might work on old Mac OS X 10.2 and 10.1 as well.<br />
<br />
We will be building everything from scratch using the source code, and<br />
not use any available package managers like<br />
[http://www.macports.org MacPorts],<br />
[http://fink.sourceforge.net/ Fink],<br />
[http://gentoo-wiki.com/Gentoo_MacOS Gentoo] or<br />
[http://rpm4darwin.sourceforge.net RPM].<br />
Packaging can be done later, once it has reached a more stable release.<br />
<br />
Update: building for MacPorts can be found at the end of the document.<br />
<br />
== Install Developer Tools ==<br />
<br />
If they didn't come bundled with Mac OS X, get the Xcode Tools (or Developer Tools for older Mac OS X) from:<br />
<br />
http://developer.apple.com/tools/<br />
<br />
This will install Apple versions of:<br />
<br />
* http://www.gnu.org/software/gcc/ (GNU Compilers)<br />
* http://www.gnu.org/software/gdb/ (GNU Debugger)<br />
* http://www.gnu.org/software/make/ (GNU Make)<br />
<br />
Note: 2006/04<br />
Apple pulled all the old links in order to promote Mac OS X 10.4, but all the<br />
old developer tools can be downloaded from ADC at http://connect.apple.com/<br />
<br />
You need a (free) developer registration with Apple first, in order to log in there.<br />
For Mac OS X 10.4, you want (at least) Xcode 2.2, since earlier versions were buggy.<br />
For Mac OS X 10.3, you want Xcode 1.5. For Mac OS X 10.1-10.2, the latest Dev Tools.<br />
<br />
== Check Autotools versions ==<br />
<br />
Depending on your OS version, you might need to download and compile new versions of these:<br />
<br />
* http://www.gnu.org/software/autoconf/ (GNU Autoconf)<br />
* http://www.gnu.org/software/automake/ (GNU Automake)<br />
* http://www.gnu.org/software/libtool/ (GNU Libtool)<br />
<br />
Check what you have, with <tt>--version</tt> (note that GNU libtool is called "glibtool" on Mac OS X)<br />
<br />
Currently Code::Blocks requires versions:<br />
* autoconf 2.50+<br />
* automake 1.7+ (1.9+ needed in order to build the dist tarball)<br />
* libtool 1.4+ (1.5.8+ highly recommended to get some bug fixes)<br />
<br />
=== Automake example (Panther) ===<br />
<br />
For Mac OS X 10.3, you will only need an upgraded (local) installation of automake 1.7.x.<br />
<br />
You can download "[ftp://ftp.gnu.org/gnu/automake/automake-1.7.9.tar.gz automake-1.7.9.tar.gz]" and configure and install it with something like:<br />
<br />
<pre><br />
./configure --prefix=/usr/local --program-suffix=-1.7<br />
make<br />
sudo make install<br />
sudo cp -pi /usr/share/aclocal/libtool.m4 [prefix]/share/aclocal-1.7/<br />
</pre><br />
<br />
Since it's now known as "automake-1.7", it won't interfere with the regular "automake"<br />
<br />
On Mac OS X 10.4.8, i downloaded and installed version 1.9. I configured without any options and followed the same steps as above. I just replaced 'automake-1.7' and 'aclocal-1.7' in the bootstrap section by 'automake-1.9' and 'aclocal-1.9' and everything worked.<br />
<br />
If you would rather have the new version to be called when calling "automake", let it install into /usr/local and put /usr/local/bin before /usr/bin in your PATH.<br />
<br />
=== Libtool example ===<br />
Download [http://www.gnu.org/software/libtool/ libtool] source. The following instructions will overwrite your current version of libtool with the one you just downloaded.<br />
<pre><br />
cd /libtool-*/<br />
./configure --prefix=/usr --program-prefix=g<br />
make<br />
sudo make install<br />
</pre><br />
<br />
Note that this will replace the system version of glibtool, which might have some compatibility issues with building other software.<br />
<br />
== FYI: Universal Binaries ==<br />
<br />
If you are building for Mac OS X 10.4 or later, you might want to build "[http://www.apple.com/universal/ Universal Binaries ]"<br />
These are binaries that contain code for both PowerPC ("ppc" arch) and Intel ("i386" arch)<br />
<br />
The basic flags that needs to be added are:<br />
<pre><br />
CFLAGS += "-isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch i386 -arch ppc"<br />
<br />
CXXFLAGS += "-isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch i386 -arch ppc"<br />
</pre><br />
(You only need the sysroot parameter on PowerPC Macintosh, not on a Intel Macintosh)<br />
The "-arch i386 -arch ppc" is what tells the compiler to build a "universal" (or "fat") binary.<br />
<br />
Usually it's easiest to build one version for "powerpc-apple-darwin8",<br />
and one version for "i686-apple-darwin8", and then merge them with "[http://developer.apple.com/documentation/Darwin/Reference/ManPages/man1/lipo.1.html lipo]"<br />
<br />
<pre><br />
./configure --host=powerpc-apple-darwin8 --target=powerpc-apple-darwin8<br />
<br />
./configure --host=i686-apple-darwin8 --target=i686-apple-darwin8<br />
</pre><br />
<br />
Some caveats:<br />
* pre-compiled headers might fail with a "no main" error. If they do, add a -c to only compile them<br />
* when cross-compiling, tools like auto_revision might fail to build. copy these from a native build<br />
* the Tiger compilers might crash from time to time, but that is only to be expected (it seems)...<br />
<br />
See [http://developer.apple.com/technotes/tn2005/tn2137.html Technical Note TN2137]: Building Universal <br />
Binaries from "configure"-based Open Source Projects<br />
<br />
== FYI: ANSI or UNICODE ==<br />
<br />
For the moment we are using "ANSI" (--disable-unicode, default) for Mac OS X 10.3 and earlier,<br />
and "UNICODE" (--enable-unicode, optional) for Mac OS X 10.4 and later. <br />
<br />
See http://www.wxwidgets.org/manuals/stable/wx_unicode.html#unicodeandansi<br />
<br />
== Build wxWidgets ==<br />
<br />
=== Download the source code ===<br />
<br />
Download the tarball for the wxMac release:<br />
<br />
http://wxwidgets.org/downloads/<br />
<br />
=== Apply necessary patches ===<br />
<br />
Don't forget to apply any released patches!<br />
<br />
http://wxwidgets.org/downloads/patch.htm<br />
<br />
=== Configure and (GNU) Make ===<br />
<br />
<pre><br />
mkdir mac-build<br />
cd mac-build<br />
../configure --enable-shared --enable-monolithic --enable-unicode --with-mac --with-opengl \<br />
--with-png=builtin --with-jpeg=builtin --with-tiff=builtin --with-expat=builtin<br />
nice make<br />
</pre><br />
<br />
note: the easiest way to build a Universal Binary with wxWidgets is<br />
the new flag: --enable-universal_binary (you need wxWidgets 2.6.4+)<br />
<br />
=== Install into Destination ===<br />
<br />
<pre><br />
sudo make install<br />
</pre><br />
<br />
== Bundle library for Mac ==<br />
<br />
To avoid having the Code::Blocks user having to compile or install wxWidgets themselves,<br />
we can bundle it with our application so that it is contained in the application bundle.<br />
This could also be done by statically linking wxWidgets, but with dynamic linking we can<br />
share the wxWidgets library between all applications using wxWidgets (not just Code::Blocks)<br />
<br />
<br />
=== Way One: Library (dynamic) ===<br />
<br />
<pre><br />
/usr/local/include/wx-2.6/wx/wx.h<br />
/usr/local/lib/libwx_macu-2.6.dylib -> libwx_macu-2.6.0.dylib<br />
/usr/local/lib/libwx_macu-2.6.0.dylib -> libwx_macu-2.6.0.4.0.dylib<br />
/usr/local/lib/libwx_macu-2.6.0.4.0.dylib<br />
</pre><br />
<br />
To bundle our shared library with the application, we include it in "MacOS" and change the path:<br />
<br />
<pre><br />
install_name_tool -id @executable_path/libwx_macu-2.6.0.dylib<br />
</pre><br />
<br />
@executable_path will be replaced with e.g. /Developer/Applications/CodeBlocks.app/Contents/MacOS<br />
<br />
=== Way Two: Framework (bundle) ===<br />
<br />
<pre><br />
/Library/Frameworks/wx.framework/Headers -> Versions/Current/Headers<br />
/Library/Frameworks/wx.framework/wx -> Versions/Current/wx<br />
/Library/Frameworks/wx.framework/Versions/Current -> 2.6<br />
/Library/Frameworks/wx.framework/Versions/2.6/Headers/wx.h<br />
/Library/Frameworks/wx.framework/Versions/2.6/wx -> libwx_macu-2.6.0.dylib<br />
/Library/Frameworks/wx.framework/Versions/2.6/libwx_macu-2.6.0.dylib -> libwx_macu-2.6.0.4.0.dylib<br />
/Library/Frameworks/wx.framework/Versions/2.6/libwx_macu-2.6.0.4.0.dylib<br />
</pre><br />
<br />
To bundle our framework with the application, we include it in "Frameworks" and change the path:<br />
<br />
<pre><br />
install_name_tool -id @executable_path/../Frameworks/wx.framework/Versions/2.6/libwx_macu-2.6.0.dylib<br />
</pre><br />
<br />
This way it will first look in the framework path (-F), and then in for the shared library path (-L) as usual.<br />
<br />
== Install Subversion client ==<br />
<br />
http://subversion.tigris.org/<br />
<br />
Note: you need SVN for the Code::Blocks revision scripts to work!<br />
<br />
== Build CodeBlocks from SVN ==<br />
<br />
=== Download the source code ===<br />
<br />
https://www.codeblocks.org/source_code.shtml<br />
<br />
<pre><br />
svn checkout svn://svn.berlios.de/codeblocks/trunk<br />
cd trunk<br />
</pre><br />
<br />
=== Apply necessary patches ===<br />
<br />
For a list of all available patches, see:<br />
<br />
http://developer.berlios.de/patch/?group_id=5358<br />
<br />
You might need to convert line endings from DOS to Unix first.<br />
<br />
=== Bootstrap with Autotools ===<br />
<br />
You need to use the newer version of automake (see above), for the "bootstrap". (OS X 10.5 users may have recent enough autotools so they may not need to install them)<br />
<br />
<pre><br />
# if you installed newer autotools under names with suffixes.<br />
export AUTOMAKE=automake-1.9<br />
export ACLOCAL=aclocal-1.9<br />
<br />
# do bootstrap. you may need to adapt /usr/share/aclocal<br />
# to whatever other location you may use<br />
# (for instance, in my case, /usr/local/share/aclocal)<br />
ACLOCAL_FLAGS="-I /usr/share/aclocal" ./bootstrap<br />
</pre><br />
<br />
=== Mono Fix ===<br />
<br />
If you have the Mono.framework installed, then it probably set up a symlink like:<br />
<br />
<pre><br />
/usr/bin/pkg-config -> /Library/Frameworks/Mono.framework/Commands/pkg-config<br />
</pre><br />
<br />
Unless you have a "proper" [http://pkgconfig.freedesktop.org/ pkg-config] installation the Code::Blocks configure will fail, so move this symbolic link aside.<br />
<br />
=== Configure ===<br />
<br />
<pre><br />
./configure --enable-contrib<br />
</pre><br />
<br />
Note: the easiest way to build a Universal Binary for Code::Blocks is to build once for PowerPC (-arch ppc) and once for Intel (-arch i386), and then merge them (with lipo) afterwards.<br />
<br />
<pre><br />
mkdir ppc-build<br />
cd ppc-build<br />
../configure --host=powerpc-apple-darwin8 --target=powerpc-apple-darwin8 --enable-contrib<br />
cd ..<br />
<br />
mkdir x86-build<br />
cd x86-build<br />
../configure --host=i686-apple-darwin8 --target=i686-apple-darwin8 --enable-contrib<br />
cd ..<br />
</pre><br />
<br />
Note: You need to patch the location of the pre-compiled headers, or it will generate them in the same place for both arch.<br />
<br />
=== Tiger Fix ===<br />
<br />
There is a bug in the glibtool of Mac OS X 10.4, that fails to link C++ libs:<br />
<br />
<pre><br />
ld: multiple definitions of symbol ___umoddi3<br />
/usr/lib/gcc/powerpc-apple-darwin8/4.0.1/libgcc.a(_umoddi3.o) private external definition of ___umoddi3 in section (__TEXT,__text)<br />
/usr/lib/gcc/powerpc-apple-darwin8/4.0.1/../../../libgcc_s.10.4.dylib(_umoddi3_s.o) definition of ___umoddi3<br />
<br />
ld: multiple definitions of symbol ___umoddi3<br />
/usr/lib/gcc/i686-apple-darwin8/4.0.1/libgcc.a(_umoddi3.o) private external definition of ___umoddi3 in section (__TEXT,__text)<br />
/usr/lib/gcc/i686-apple-darwin8/4.0.1/../../../libgcc_s.10.4.dylib(_umoddi3_s.o) definition of ___umoddi3<br />
</pre><br />
<br />
To work around this, you need to edit the generated "libtool" script manually:<br />
<br />
<pre><br />
177c177<br />
< whole_archive_flag_spec="-all_load \$convenience"<br />
---<br />
> whole_archive_flag_spec=""<br />
6921c6921<br />
< whole_archive_flag_spec="-all_load \$convenience"<br />
---<br />
> whole_archive_flag_spec=""<br />
</pre><br />
<br />
This bug has been fixed in GNU libtool 1.5.8 and later.<br />
<br />
=== (GNU) Make ===<br />
<br />
"nice" isn't strictly needed, it just makes the compile run at a lower process priority<br />
<br />
<pre><br />
nice make<br />
</pre><br />
<br />
For the Universal Binary build:<br />
<br />
<pre><br />
cd ppc-build<br />
nice make<br />
cd ..<br />
<br />
cd x86-build<br />
nice make<br />
cd ..<br />
</pre><br />
<br />
=== Install into Destination ===<br />
<br />
"sudo" asks you for an admin password, in order to get install permissions<br />
<br />
<pre><br />
sudo make install<br />
</pre><br />
<br />
For the Universal Binary build:<br />
<br />
<pre><br />
cd ppc-build<br />
make install DESTDIR=/tmp/ppc<br />
cd ..<br />
<br />
cd x86-build<br />
make install DESTDIR=/tmp/x86<br />
cd ..<br />
<br />
lipomerge /tmp/ppc /tmp/x86 /tmp/fat<br />
</pre><br />
<br />
Where "lipomerge" is a custom shell script:<br />
<br />
* http://www.algonet.se/~afb/wx/lipomerge<br />
<br />
== Bundle application for Mac ==<br />
<br />
After building codeblocks in the regular Unix way, you need to bundle it with the icons<br />
and various other info that it needs to make a regular stand-alone Macintosh application.<br />
<br />
There are two ways of accomplishing this, old Mac OS-style resource or NeXT-style bundle.<br />
The old resources are handy while developing, while bundles are more suitable for release.<br />
<br />
Note: You '''need''' to use either of these methods, or your application will launch<br />
in the background behind all other windows and will be unable to receive any events!<br />
<br />
=== Way One: Mac OS (resource) ===<br />
<br />
http://developer.apple.com/documentation/Carbon/Reference/Resource_Manager/<br />
<br />
Handy while developing, as you only need to add an icon.<br />
<br />
Files needed:<br />
* http://www.algonet.se/~afb/wx/CodeBlocks.r.gz (Rez icon, gzipped)<br />
<br />
First we install the program to the PREFIX directory of your choice:<br />
<br />
<pre><br />
$PREFIX/bin<br />
$PREFIX/lib<br />
$PREFIX/share/codeblocks<br />
</pre><br />
<br />
Add a custom icon to the application, and make it receive events:<br />
<br />
<pre><br />
gunzip CodeBlocks.r.gz<br />
sudo /Developer/Tools/Rez -d __DARWIN__ -t APPL -d __WXMAC__ \<br />
CodeBlocks.r Carbon.r -o $PREFIX/bin/codeblocks<br />
sudo /Developer/Tools/SetFile -a C $PREFIX/bin/codeblocks<br />
</pre><br />
<br />
Note: on the Intel Macintoshes, the icon comes up as "broken"<br />
(apparently it assumes that all apps with resforks are Classic)<br />
<br />
Without the icon part, this could also have be written as just:<br />
<br />
<pre><br />
sudo `wx-config --rezflags` $PREFIX/bin/codeblocks<br />
</pre><br />
<br />
Start the application with a small prefix shell wrapper like this:<br />
<br />
<pre><br />
DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:$PREFIX/lib<br />
export DYLD_LIBRARY_PATH<br />
<br />
$PREFIX/bin/codeblocks --prefix=$PREFIX<br />
</pre><br />
<br />
You don't need the "DYLD_LIBRARY_PATH" stuff,<br />
if you are installing to a system directory.<br />
<br />
==== Common PREFIX Settings ====<br />
<br />
Local: <tt>PREFIX=/usr/local</tt><br />
<br />
System: <tt>PREFIX=/usr</tt><br />
<br />
MacPorts: <tt>PREFIX=/opt/local</tt><br />
<br />
Fink: <tt>PREFIX=/sw</tt><br />
<br />
=== Way Two: NeXT (bundle) ===<br />
<br />
http://developer.apple.com/documentation/CoreFoundation/Conceptual/CFBundles/<br />
<br />
This does not involve resources, and is more relocatable.<br />
<br />
Files needed:<br />
* http://www.algonet.se/~afb/wx/CodeBlocks.Info.plist (rename to "Info.plist")<br />
* http://www.algonet.se/~afb/wx/CodeBlocks.sh (shell wrapper, rename to "CodeBlocks")<br />
* http://www.algonet.se/~afb/wx/CodeBlocks.icns (Mac OS X icon, rename to "app.icns")<br />
<br />
The MacOS program will just be a shell wrapper that calls "bin/codeblocks", like above.<br />
Traditionally the bundle would include Frameworks and Resources, but we'll just avoid those<br />
here and use the regular "lib" and "share/codeblocks" instead (just as with a regular install). <br />
These temporary directories are listed in italic below, they're not really used in bundles...<br />
<br />
Setup a hierarchy like this, and copy the files from the regular build/install and the above file list to it:<br />
<br />
CodeBlocks.app<br />
CodeBlocks.app/Contents/<br />
CodeBlocks.app/Contents/Info.plist<br />
CodeBlocks.app/Contents/MacOS/<br />
CodeBlocks.app/Contents/MacOS/CodeBlocks<br />
CodeBlocks.app/Contents/Resources/<br />
CodeBlocks.app/Contents/Resources/app.icns<br />
''CodeBlocks.app/Contents/bin/''<br />
''CodeBlocks.app/Contents/lib/''<br />
''CodeBlocks.app/Contents/share/codeblocks/''<br />
<br />
The CodeBlocks application can now be moved with the Finder, and started up like a regular Mac application. (the nightly build includes a more advanced Info.plist and more icons - for also mapping all the files that the application can open, like source code and header files and such)<br />
<br />
==== Proper Application Bundling ====<br />
<br />
To avoid the shell wrapper, the binary can now be moved from "bin/codeblocks" to "MacOS/CodeBlocks". Helper files are moved from "share/codeblocks" to "Resources". The dynamic libraries are moved from "lib" to "MacOS":<br />
<br />
<pre><br />
mv bin/codeblocks MacOS/CodeBlocks<br />
rmdir bin<br />
mv lib/* MacOS/<br />
rmdir lib<br />
mv share Resources/<br />
</pre><br />
<br />
To avoid having to use a DYLD_LIBRARY_PATH, we rename the shared libraries (with the install_name_tool program) from e.g. /usr/local/lib/ to @executable_path/:<br />
<br />
<pre><br />
install_name_tool -change /usr/local/lib/libcodeblocks.0.dylib \<br />
@executable_path/libcodeblocks.0.dylib MacOS/CodeBlocks<br />
</pre><br />
<br />
The libraries can have their names changed using the -id parameter:<br />
<br />
<pre><br />
install_name_tool -id @executable_path/libcodeblocks.0.dylib MacOS/libcodeblocks.0.dylib<br />
</pre><br />
<br />
You also need to change all of the loadable bundles for the plugins:<br />
<br />
<pre><br />
for so in Resources/plugins/*.so<br />
do install_name_tool -change /usr/local/lib/libcodeblocks.0.dylib \<br />
@executable_path/libcodeblocks.0.dylib $so<br />
done<br />
</pre><br />
<br />
You can check the result, what libraries/frameworks it links to, with:<br />
<br />
<pre><br />
otool -L CodeBlocks<br />
</pre><br />
<br />
Optionally you can then repeat the process, for the wx library too...<br />
<br />
== FYI: Darwin vs. Mac OS X ==<br />
<br />
"Darwin is the UNIX technology-based foundation of Mac OS X."<br />
<br />
* http://developer.apple.com/referencelibrary/Darwin/<br />
<br />
* http://en.wikipedia.org/wiki/Darwin_(operating_system)<br />
<br />
"Pure Darwin" here refers to the Open Source version of the OS:<br />
<br />
* http://www.opensource.apple.com/darwinsource/images/<br />
<br />
* http://opendarwin.org/ or http://gnu-darwin.sourceforge.net/<br />
<br />
(that is: Darwin using X11 instead of Aqua for the user interface)<br />
<br />
== Install with MacPorts ==<br />
<br />
=== Install wxWidgets ===<br />
<br />
You will need the wxWidgets library, install as port with:<br />
<br />
<pre><br />
sudo port install wxWidgets<br />
</pre><br />
<br />
If you want the X11/GTK version on Mac OS X, instead use:<br />
<br />
<pre><br />
sudo port install wxgtk<br />
</pre><br />
<br />
=== Install Code::Blocks ===<br />
<br />
After that is installed, you can install Code::Blocks with:<br />
<br />
<pre><br />
sudo port install codeblocks-devel +aqua<br />
</pre><br />
<br />
If you want the X11/GTK version on Mac OS X, instead use:<br />
<br />
<pre><br />
sudo port install codeblocks-devel +x11<br />
</pre><br />
<br />
This will download the SVN trunk, and any dependencies:<br />
<br />
<pre><br />
---> Fetching codeblocks-devel<br />
---> Verifying checksum(s) for codeblocks-devel<br />
---> Extracting codeblocks-devel<br />
---> Configuring codeblocks-devel<br />
---> Building codeblocks-devel with target all<br />
---> Staging codeblocks-devel into destroot<br />
---> Packaging tgz archive for codeblocks-devel 1.0_0+aqua+macosx<br />
---> Installing codeblocks-devel 1.0_0+aqua+macosx<br />
---> Activating codeblocks-devel 1.0_0+aqua+macosx<br />
---> Cleaning codeblocks-devel<br />
</pre><br />
<br />
Note: to upgrade from SVN, you need to uninstall first:<br />
<br />
<pre><br />
sudo port uninstall codeblocks-devel<br />
sudo port clean codeblocks-devel<br />
sudo port install codeblocks-devel<br />
</pre><br />
<br />
This is both because all SVN versions are numbered "0",<br />
but also due to a bug in the Code::Blocks build scripts.<br />
<br />
=== Running <tt>+aqua</tt> (wxMac) version ===<br />
<br />
After the build completes, you can start the program by:<br />
<br />
<pre><br />
open /Applications/MacPorts/CodeBlocks.app<br />
</pre><br />
<br />
Note that the wxMac application bundle in "MacPorts"<br />
is just a wrapper, with symbolic links to /opt/local...<br />
<br />
<pre><br />
/opt/local/bin/codeblocks<br />
</pre><br />
<br />
=== Running <tt>+x11</tt> (wxGTK) version ===<br />
<br />
The non-bundled wxGTK version is instead started with:<br />
<br />
<pre><br />
/opt/local/bin/codeblocks<br />
</pre><br />
<br />
When running X11/wxGTK programs in Mac OS X, you can use<br />
"open-x11" to first start up X11.app and set up $DISPLAY:<br />
<br />
<pre><br />
open-x11 /opt/local/bin/codeblocks<br />
</pre></div>Auriahttps://wiki.codeblocks.org/index.php?title=Installing_Code::Blocks_from_source_on_Mac_OS_X&diff=5535Installing Code::Blocks from source on Mac OS X2008-07-11T00:18:40Z<p>Auria: /* Bootstrap with Autotools */</p>
<hr />
<div>[[Category:Installing Code::Blocks]]<br />
[[Category:Installing Code::Blocks from source]]<br />
These are instructions on how to build Code::Blocks under Apple Mac OS X.<br />
They have been tested under Mac OS X version 10.3 and under Mac OS X 10.4<br />
(PowerPC and Intel), and might work on old Mac OS X 10.2 and 10.1 as well.<br />
<br />
We will be building everything from scratch using the source code, and<br />
not use any available package managers like<br />
[http://www.macports.org MacPorts],<br />
[http://fink.sourceforge.net/ Fink],<br />
[http://gentoo-wiki.com/Gentoo_MacOS Gentoo] or<br />
[http://rpm4darwin.sourceforge.net RPM].<br />
Packaging can be done later, once it has reached a more stable release.<br />
<br />
Update: building for MacPorts can be found at the end of the document.<br />
<br />
== Install Developer Tools ==<br />
<br />
If they didn't come bundled with Mac OS X, get the Xcode Tools (or Developer Tools for older Mac OS X) from:<br />
<br />
http://developer.apple.com/tools/<br />
<br />
This will install Apple versions of:<br />
<br />
* http://www.gnu.org/software/gcc/ (GNU Compilers)<br />
* http://www.gnu.org/software/gdb/ (GNU Debugger)<br />
* http://www.gnu.org/software/make/ (GNU Make)<br />
<br />
Note: 2006/04<br />
Apple pulled all the old links in order to promote Mac OS X 10.4, but all the<br />
old developer tools can be downloaded from ADC at http://connect.apple.com/<br />
<br />
You need a (free) developer registration with Apple first, in order to log in there.<br />
For Mac OS X 10.4, you want (at least) Xcode 2.2, since earlier versions were buggy.<br />
For Mac OS X 10.3, you want Xcode 1.5. For Mac OS X 10.1-10.2, the latest Dev Tools.<br />
<br />
== Check Autotools versions ==<br />
<br />
Depending on your OS version, you might need to download and compile new versions of these:<br />
<br />
* http://www.gnu.org/software/autoconf/ (GNU Autoconf)<br />
* http://www.gnu.org/software/automake/ (GNU Automake)<br />
* http://www.gnu.org/software/libtool/ (GNU Libtool)<br />
<br />
Check what you have, with <tt>--version</tt> (note that GNU libtool is called "glibtool" on Mac OS X)<br />
<br />
Currently Code::Blocks requires versions:<br />
* autoconf 2.50+<br />
* automake 1.7+ (1.9+ needed in order to build the dist tarball)<br />
* libtool 1.4+ (1.5.8+ highly recommended to get some bug fixes)<br />
<br />
=== Automake example (Panther) ===<br />
<br />
For Mac OS X 10.3, you will only need an upgraded (local) installation of automake 1.7.x.<br />
<br />
You can download "[ftp://ftp.gnu.org/gnu/automake/automake-1.7.9.tar.gz automake-1.7.9.tar.gz]" and configure and install it with something like:<br />
<br />
<pre><br />
./configure --prefix=/usr/local --program-suffix=-1.7<br />
make<br />
sudo make install<br />
sudo cp -pi /usr/share/aclocal/libtool.m4 /usr/local/share/aclocal-1.7/<br />
</pre><br />
<br />
Since it's now known as "automake-1.7", it won't interfere with the regular "automake"<br />
<br />
On Mac OS X 10.4.8, i downloaded and installed version 1.9. I configured without any options and followed the same steps as above. I just replaced 'automake-1.7' and 'aclocal-1.7' in the bootstrap section by 'automake-1.9' and 'aclocal-1.9' and everything worked.<br />
<br />
If you would rather have the new version to be called when calling "automake", and use a suffix only if you need to call the old one, you can omit the "--program-suffix=-1.7" part, and move the old automake with something like ''sudo mv /usr/bin/automake /usr/bin/automake-old''. The same thingcan apply to other auto* libs as well.<br />
<br />
=== Libtool example ===<br />
Download [http://www.gnu.org/software/libtool/ libtool] source. The following instructions will overwrite your current version of libtool with the one you just downloaded.<br />
<pre><br />
cd /libtool-*/<br />
./configure --prefix=/usr --program-prefix=g<br />
make<br />
sudo make install<br />
</pre><br />
<br />
Note that this will replace the system version of glibtool, which might have some compatibility issues with building other software.<br />
<br />
== FYI: Universal Binaries ==<br />
<br />
If you are building for Mac OS X 10.4 or later, you might want to build "[http://www.apple.com/universal/ Universal Binaries ]"<br />
These are binaries that contain code for both PowerPC ("ppc" arch) and Intel ("i386" arch)<br />
<br />
The basic flags that needs to be added are:<br />
<pre><br />
CFLAGS += "-isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch i386 -arch ppc"<br />
<br />
CXXFLAGS += "-isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch i386 -arch ppc"<br />
</pre><br />
(You only need the sysroot parameter on PowerPC Macintosh, not on a Intel Macintosh)<br />
The "-arch i386 -arch ppc" is what tells the compiler to build a "universal" (or "fat") binary.<br />
<br />
Usually it's easiest to build one version for "powerpc-apple-darwin8",<br />
and one version for "i686-apple-darwin8", and then merge them with "[http://developer.apple.com/documentation/Darwin/Reference/ManPages/man1/lipo.1.html lipo]"<br />
<br />
<pre><br />
./configure --host=powerpc-apple-darwin8 --target=powerpc-apple-darwin8<br />
<br />
./configure --host=i686-apple-darwin8 --target=i686-apple-darwin8<br />
</pre><br />
<br />
Some caveats:<br />
* pre-compiled headers might fail with a "no main" error. If they do, add a -c to only compile them<br />
* when cross-compiling, tools like auto_revision might fail to build. copy these from a native build<br />
* the Tiger compilers might crash from time to time, but that is only to be expected (it seems)...<br />
<br />
See [http://developer.apple.com/technotes/tn2005/tn2137.html Technical Note TN2137]: Building Universal <br />
Binaries from "configure"-based Open Source Projects<br />
<br />
== FYI: ANSI or UNICODE ==<br />
<br />
For the moment we are using "ANSI" (--disable-unicode, default) for Mac OS X 10.3 and earlier,<br />
and "UNICODE" (--enable-unicode, optional) for Mac OS X 10.4 and later. <br />
<br />
See http://www.wxwidgets.org/manuals/stable/wx_unicode.html#unicodeandansi<br />
<br />
== Build wxWidgets ==<br />
<br />
=== Download the source code ===<br />
<br />
Download the tarball for the wxMac release:<br />
<br />
http://wxwidgets.org/downloads/<br />
<br />
=== Apply necessary patches ===<br />
<br />
Don't forget to apply any released patches!<br />
<br />
http://wxwidgets.org/downloads/patch.htm<br />
<br />
=== Configure and (GNU) Make ===<br />
<br />
<pre><br />
mkdir mac-build<br />
cd mac-build<br />
../configure --enable-shared --enable-monolithic --enable-unicode --with-mac --with-opengl \<br />
--with-png=builtin --with-jpeg=builtin --with-tiff=builtin --with-expat=builtin<br />
nice make<br />
</pre><br />
<br />
note: the easiest way to build a Universal Binary with wxWidgets is<br />
the new flag: --enable-universal_binary (you need wxWidgets 2.6.4+)<br />
<br />
=== Install into Destination ===<br />
<br />
<pre><br />
sudo make install<br />
</pre><br />
<br />
== Bundle library for Mac ==<br />
<br />
To avoid having the Code::Blocks user having to compile or install wxWidgets themselves,<br />
we can bundle it with our application so that it is contained in the application bundle.<br />
This could also be done by statically linking wxWidgets, but with dynamic linking we can<br />
share the wxWidgets library between all applications using wxWidgets (not just Code::Blocks)<br />
<br />
<br />
=== Way One: Library (dynamic) ===<br />
<br />
<pre><br />
/usr/local/include/wx-2.6/wx/wx.h<br />
/usr/local/lib/libwx_macu-2.6.dylib -> libwx_macu-2.6.0.dylib<br />
/usr/local/lib/libwx_macu-2.6.0.dylib -> libwx_macu-2.6.0.4.0.dylib<br />
/usr/local/lib/libwx_macu-2.6.0.4.0.dylib<br />
</pre><br />
<br />
To bundle our shared library with the application, we include it in "MacOS" and change the path:<br />
<br />
<pre><br />
install_name_tool -id @executable_path/libwx_macu-2.6.0.dylib<br />
</pre><br />
<br />
@executable_path will be replaced with e.g. /Developer/Applications/CodeBlocks.app/Contents/MacOS<br />
<br />
=== Way Two: Framework (bundle) ===<br />
<br />
<pre><br />
/Library/Frameworks/wx.framework/Headers -> Versions/Current/Headers<br />
/Library/Frameworks/wx.framework/wx -> Versions/Current/wx<br />
/Library/Frameworks/wx.framework/Versions/Current -> 2.6<br />
/Library/Frameworks/wx.framework/Versions/2.6/Headers/wx.h<br />
/Library/Frameworks/wx.framework/Versions/2.6/wx -> libwx_macu-2.6.0.dylib<br />
/Library/Frameworks/wx.framework/Versions/2.6/libwx_macu-2.6.0.dylib -> libwx_macu-2.6.0.4.0.dylib<br />
/Library/Frameworks/wx.framework/Versions/2.6/libwx_macu-2.6.0.4.0.dylib<br />
</pre><br />
<br />
To bundle our framework with the application, we include it in "Frameworks" and change the path:<br />
<br />
<pre><br />
install_name_tool -id @executable_path/../Frameworks/wx.framework/Versions/2.6/libwx_macu-2.6.0.dylib<br />
</pre><br />
<br />
This way it will first look in the framework path (-F), and then in for the shared library path (-L) as usual.<br />
<br />
== Install Subversion client ==<br />
<br />
http://subversion.tigris.org/<br />
<br />
Note: you need SVN for the Code::Blocks revision scripts to work!<br />
<br />
== Build CodeBlocks from SVN ==<br />
<br />
=== Download the source code ===<br />
<br />
https://www.codeblocks.org/source_code.shtml<br />
<br />
<pre><br />
svn checkout svn://svn.berlios.de/codeblocks/trunk<br />
cd trunk<br />
</pre><br />
<br />
=== Apply necessary patches ===<br />
<br />
For a list of all available patches, see:<br />
<br />
http://developer.berlios.de/patch/?group_id=5358<br />
<br />
You might need to convert line endings from DOS to Unix first.<br />
<br />
=== Bootstrap with Autotools ===<br />
<br />
You need to use the newer version of automake (see above), for the "bootstrap". (OS X 10.5 users may have recent enough autotools so they may not need to install them)<br />
<br />
<pre><br />
# if you installed newer autotools under names with suffixes.<br />
export AUTOMAKE=automake-1.9<br />
export ACLOCAL=aclocal-1.9<br />
<br />
# do bootstrap. you may need to adapt /usr/share/aclocal<br />
# to whatever other location you may use<br />
# (for instance, in my case, /usr/local/share/aclocal)<br />
ACLOCAL_FLAGS="-I /usr/share/aclocal" ./bootstrap<br />
</pre><br />
<br />
=== Mono Fix ===<br />
<br />
If you have the Mono.framework installed, then it probably set up a symlink like:<br />
<br />
<pre><br />
/usr/bin/pkg-config -> /Library/Frameworks/Mono.framework/Commands/pkg-config<br />
</pre><br />
<br />
Unless you have a "proper" [http://pkgconfig.freedesktop.org/ pkg-config] installation the Code::Blocks configure will fail, so move this symbolic link aside.<br />
<br />
=== Configure ===<br />
<br />
<pre><br />
./configure --enable-contrib<br />
</pre><br />
<br />
Note: the easiest way to build a Universal Binary for Code::Blocks is to build once for PowerPC (-arch ppc) and once for Intel (-arch i386), and then merge them (with lipo) afterwards.<br />
<br />
<pre><br />
mkdir ppc-build<br />
cd ppc-build<br />
../configure --host=powerpc-apple-darwin8 --target=powerpc-apple-darwin8 --enable-contrib<br />
cd ..<br />
<br />
mkdir x86-build<br />
cd x86-build<br />
../configure --host=i686-apple-darwin8 --target=i686-apple-darwin8 --enable-contrib<br />
cd ..<br />
</pre><br />
<br />
Note: You need to patch the location of the pre-compiled headers, or it will generate them in the same place for both arch.<br />
<br />
=== Tiger Fix ===<br />
<br />
There is a bug in the glibtool of Mac OS X 10.4, that fails to link C++ libs:<br />
<br />
<pre><br />
ld: multiple definitions of symbol ___umoddi3<br />
/usr/lib/gcc/powerpc-apple-darwin8/4.0.1/libgcc.a(_umoddi3.o) private external definition of ___umoddi3 in section (__TEXT,__text)<br />
/usr/lib/gcc/powerpc-apple-darwin8/4.0.1/../../../libgcc_s.10.4.dylib(_umoddi3_s.o) definition of ___umoddi3<br />
<br />
ld: multiple definitions of symbol ___umoddi3<br />
/usr/lib/gcc/i686-apple-darwin8/4.0.1/libgcc.a(_umoddi3.o) private external definition of ___umoddi3 in section (__TEXT,__text)<br />
/usr/lib/gcc/i686-apple-darwin8/4.0.1/../../../libgcc_s.10.4.dylib(_umoddi3_s.o) definition of ___umoddi3<br />
</pre><br />
<br />
To work around this, you need to edit the generated "libtool" script manually:<br />
<br />
<pre><br />
177c177<br />
< whole_archive_flag_spec="-all_load \$convenience"<br />
---<br />
> whole_archive_flag_spec=""<br />
6921c6921<br />
< whole_archive_flag_spec="-all_load \$convenience"<br />
---<br />
> whole_archive_flag_spec=""<br />
</pre><br />
<br />
This bug has been fixed in GNU libtool 1.5.8 and later.<br />
<br />
=== (GNU) Make ===<br />
<br />
"nice" isn't strictly needed, it just makes the compile run at a lower process priority<br />
<br />
<pre><br />
nice make<br />
</pre><br />
<br />
For the Universal Binary build:<br />
<br />
<pre><br />
cd ppc-build<br />
nice make<br />
cd ..<br />
<br />
cd x86-build<br />
nice make<br />
cd ..<br />
</pre><br />
<br />
=== Install into Destination ===<br />
<br />
"sudo" asks you for an admin password, in order to get install permissions<br />
<br />
<pre><br />
sudo make install<br />
</pre><br />
<br />
For the Universal Binary build:<br />
<br />
<pre><br />
cd ppc-build<br />
make install DESTDIR=/tmp/ppc<br />
cd ..<br />
<br />
cd x86-build<br />
make install DESTDIR=/tmp/x86<br />
cd ..<br />
<br />
lipomerge /tmp/ppc /tmp/x86 /tmp/fat<br />
</pre><br />
<br />
Where "lipomerge" is a custom shell script:<br />
<br />
* http://www.algonet.se/~afb/wx/lipomerge<br />
<br />
== Bundle application for Mac ==<br />
<br />
After building codeblocks in the regular Unix way, you need to bundle it with the icons<br />
and various other info that it needs to make a regular stand-alone Macintosh application.<br />
<br />
There are two ways of accomplishing this, old Mac OS-style resource or NeXT-style bundle.<br />
The old resources are handy while developing, while bundles are more suitable for release.<br />
<br />
Note: You '''need''' to use either of these methods, or your application will launch<br />
in the background behind all other windows and will be unable to receive any events!<br />
<br />
=== Way One: Mac OS (resource) ===<br />
<br />
http://developer.apple.com/documentation/Carbon/Reference/Resource_Manager/<br />
<br />
Handy while developing, as you only need to add an icon.<br />
<br />
Files needed:<br />
* http://www.algonet.se/~afb/wx/CodeBlocks.r.gz (Rez icon, gzipped)<br />
<br />
First we install the program to the PREFIX directory of your choice:<br />
<br />
<pre><br />
$PREFIX/bin<br />
$PREFIX/lib<br />
$PREFIX/share/codeblocks<br />
</pre><br />
<br />
Add a custom icon to the application, and make it receive events:<br />
<br />
<pre><br />
gunzip CodeBlocks.r.gz<br />
sudo /Developer/Tools/Rez -d __DARWIN__ -t APPL -d __WXMAC__ \<br />
CodeBlocks.r Carbon.r -o $PREFIX/bin/codeblocks<br />
sudo /Developer/Tools/SetFile -a C $PREFIX/bin/codeblocks<br />
</pre><br />
<br />
Note: on the Intel Macintoshes, the icon comes up as "broken"<br />
(apparently it assumes that all apps with resforks are Classic)<br />
<br />
Without the icon part, this could also have be written as just:<br />
<br />
<pre><br />
sudo `wx-config --rezflags` $PREFIX/bin/codeblocks<br />
</pre><br />
<br />
Start the application with a small prefix shell wrapper like this:<br />
<br />
<pre><br />
DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:$PREFIX/lib<br />
export DYLD_LIBRARY_PATH<br />
<br />
$PREFIX/bin/codeblocks --prefix=$PREFIX<br />
</pre><br />
<br />
You don't need the "DYLD_LIBRARY_PATH" stuff,<br />
if you are installing to a system directory.<br />
<br />
==== Common PREFIX Settings ====<br />
<br />
Local: <tt>PREFIX=/usr/local</tt><br />
<br />
System: <tt>PREFIX=/usr</tt><br />
<br />
MacPorts: <tt>PREFIX=/opt/local</tt><br />
<br />
Fink: <tt>PREFIX=/sw</tt><br />
<br />
=== Way Two: NeXT (bundle) ===<br />
<br />
http://developer.apple.com/documentation/CoreFoundation/Conceptual/CFBundles/<br />
<br />
This does not involve resources, and is more relocatable.<br />
<br />
Files needed:<br />
* http://www.algonet.se/~afb/wx/CodeBlocks.Info.plist (rename to "Info.plist")<br />
* http://www.algonet.se/~afb/wx/CodeBlocks.sh (shell wrapper, rename to "CodeBlocks")<br />
* http://www.algonet.se/~afb/wx/CodeBlocks.icns (Mac OS X icon, rename to "app.icns")<br />
<br />
The MacOS program will just be a shell wrapper that calls "bin/codeblocks", like above.<br />
Traditionally the bundle would include Frameworks and Resources, but we'll just avoid those<br />
here and use the regular "lib" and "share/codeblocks" instead (just as with a regular install). <br />
These temporary directories are listed in italic below, they're not really used in bundles...<br />
<br />
Setup a hierarchy like this, and copy the files from the regular build/install and the above file list to it:<br />
<br />
CodeBlocks.app<br />
CodeBlocks.app/Contents/<br />
CodeBlocks.app/Contents/Info.plist<br />
CodeBlocks.app/Contents/MacOS/<br />
CodeBlocks.app/Contents/MacOS/CodeBlocks<br />
CodeBlocks.app/Contents/Resources/<br />
CodeBlocks.app/Contents/Resources/app.icns<br />
''CodeBlocks.app/Contents/bin/''<br />
''CodeBlocks.app/Contents/lib/''<br />
''CodeBlocks.app/Contents/share/codeblocks/''<br />
<br />
The CodeBlocks application can now be moved with the Finder, and started up like a regular Mac application. (the nightly build includes a more advanced Info.plist and more icons - for also mapping all the files that the application can open, like source code and header files and such)<br />
<br />
==== Proper Application Bundling ====<br />
<br />
To avoid the shell wrapper, the binary can now be moved from "bin/codeblocks" to "MacOS/CodeBlocks". Helper files are moved from "share/codeblocks" to "Resources". The dynamic libraries are moved from "lib" to "MacOS":<br />
<br />
<pre><br />
mv bin/codeblocks MacOS/CodeBlocks<br />
rmdir bin<br />
mv lib/* MacOS/<br />
rmdir lib<br />
mv share Resources/<br />
</pre><br />
<br />
To avoid having to use a DYLD_LIBRARY_PATH, we rename the shared libraries (with the install_name_tool program) from e.g. /usr/local/lib/ to @executable_path/:<br />
<br />
<pre><br />
install_name_tool -change /usr/local/lib/libcodeblocks.0.dylib \<br />
@executable_path/libcodeblocks.0.dylib MacOS/CodeBlocks<br />
</pre><br />
<br />
The libraries can have their names changed using the -id parameter:<br />
<br />
<pre><br />
install_name_tool -id @executable_path/libcodeblocks.0.dylib MacOS/libcodeblocks.0.dylib<br />
</pre><br />
<br />
You also need to change all of the loadable bundles for the plugins:<br />
<br />
<pre><br />
for so in Resources/plugins/*.so<br />
do install_name_tool -change /usr/local/lib/libcodeblocks.0.dylib \<br />
@executable_path/libcodeblocks.0.dylib $so<br />
done<br />
</pre><br />
<br />
You can check the result, what libraries/frameworks it links to, with:<br />
<br />
<pre><br />
otool -L CodeBlocks<br />
</pre><br />
<br />
Optionally you can then repeat the process, for the wx library too...<br />
<br />
== FYI: Darwin vs. Mac OS X ==<br />
<br />
"Darwin is the UNIX technology-based foundation of Mac OS X."<br />
<br />
* http://developer.apple.com/referencelibrary/Darwin/<br />
<br />
* http://en.wikipedia.org/wiki/Darwin_(operating_system)<br />
<br />
"Pure Darwin" here refers to the Open Source version of the OS:<br />
<br />
* http://www.opensource.apple.com/darwinsource/images/<br />
<br />
* http://opendarwin.org/ or http://gnu-darwin.sourceforge.net/<br />
<br />
(that is: Darwin using X11 instead of Aqua for the user interface)<br />
<br />
== Install with MacPorts ==<br />
<br />
=== Install wxWidgets ===<br />
<br />
You will need the wxWidgets library, install as port with:<br />
<br />
<pre><br />
sudo port install wxWidgets<br />
</pre><br />
<br />
If you want the X11/GTK version on Mac OS X, instead use:<br />
<br />
<pre><br />
sudo port install wxgtk<br />
</pre><br />
<br />
=== Install Code::Blocks ===<br />
<br />
After that is installed, you can install Code::Blocks with:<br />
<br />
<pre><br />
sudo port install codeblocks-devel +aqua<br />
</pre><br />
<br />
If you want the X11/GTK version on Mac OS X, instead use:<br />
<br />
<pre><br />
sudo port install codeblocks-devel +x11<br />
</pre><br />
<br />
This will download the SVN trunk, and any dependencies:<br />
<br />
<pre><br />
---> Fetching codeblocks-devel<br />
---> Verifying checksum(s) for codeblocks-devel<br />
---> Extracting codeblocks-devel<br />
---> Configuring codeblocks-devel<br />
---> Building codeblocks-devel with target all<br />
---> Staging codeblocks-devel into destroot<br />
---> Packaging tgz archive for codeblocks-devel 1.0_0+aqua+macosx<br />
---> Installing codeblocks-devel 1.0_0+aqua+macosx<br />
---> Activating codeblocks-devel 1.0_0+aqua+macosx<br />
---> Cleaning codeblocks-devel<br />
</pre><br />
<br />
Note: to upgrade from SVN, you need to uninstall first:<br />
<br />
<pre><br />
sudo port uninstall codeblocks-devel<br />
sudo port clean codeblocks-devel<br />
sudo port install codeblocks-devel<br />
</pre><br />
<br />
This is both because all SVN versions are numbered "0",<br />
but also due to a bug in the Code::Blocks build scripts.<br />
<br />
=== Running <tt>+aqua</tt> (wxMac) version ===<br />
<br />
After the build completes, you can start the program by:<br />
<br />
<pre><br />
open /Applications/MacPorts/CodeBlocks.app<br />
</pre><br />
<br />
Note that the wxMac application bundle in "MacPorts"<br />
is just a wrapper, with symbolic links to /opt/local...<br />
<br />
<pre><br />
/opt/local/bin/codeblocks<br />
</pre><br />
<br />
=== Running <tt>+x11</tt> (wxGTK) version ===<br />
<br />
The non-bundled wxGTK version is instead started with:<br />
<br />
<pre><br />
/opt/local/bin/codeblocks<br />
</pre><br />
<br />
When running X11/wxGTK programs in Mac OS X, you can use<br />
"open-x11" to first start up X11.app and set up $DISPLAY:<br />
<br />
<pre><br />
open-x11 /opt/local/bin/codeblocks<br />
</pre></div>Auriahttps://wiki.codeblocks.org/index.php?title=Roadmap_for_version_1.0&diff=5534Roadmap for version 1.02008-07-11T00:14:18Z<p>Auria: </p>
<hr />
<div>[[Category:Roadmaps]]<br />
<br />
'''Warning : This page is very likely outdated and irrelevant of what is actually going on'''<br />
<br />
==Version 1.0 (Pheidippides)==<br />
''To Be Announced''<br />
<br />
==Version 1.0 RC final (Athenades)==<br />
''TBA''<br />
*No feature additions.<br />
*Regression and bug handling only.<br />
<br />
==Version 1.0 RC 3 (Ephialtes)==<br />
''TBA''<br />
<br />
*[[Image:Chk.png]]Unicode support<br />
**[[Image:Chk.png]]User interface<br />
**[[Image:Chk.png]]Configuration system<br />
**[[Image:Chk.png]]Editor component<br />
**[[Image:Nop.png]]Fully automatic detection of document encoding<br />
*[[Image:Blk.png]]<s>Scripting support (Angelscript)</s> <i>(abandoned due to lack of 64bit support)</i><br />
*[[Image:Chk.png]]Scripting support (Squirrel/Sq plus)<br />
**[[Image:Chk.png]]Watch scripts (see [[Debugger scripts]])<br />
**[[Image:Chk.png]]Build target scripts<br />
*[[Image:Chk.png]]Virtual folder support<br />
*[[Image:Chk.png]]Global user variables<br />
**[[Image:Chk.png]]Profile-dependent GUVs<br />
**[[Image:Chk.png]]Multiple variable sets<br />
**[[Image:Chk.png]]Custom variable definition<br />
*[[Image:Chk.png]]wxFlatNoteBook editors<br />
*[[Image:Chk.png]]wxAUI docking library<br />
*[[Image:Chk.png]]Context-sensitive layout switching<br />
*[[Image:Chk.png]]XML-based configuration system<br />
*[[Image:Blk.png]]XML-based compiler framework<br />
*[[Image:Blk.png]]Property-based build system<br />
*[[Image:Chk.png]]Improved configuration user interface<br />
*[[Image:Blk.png]]Automatic updates<br />
*[[Image:Blk.png]]Usability and stability fixes for code completion plugin <br />
*[[Image:Blk.png]]Regression and bug handling.<br />
<br />
==Version 1.0 RC 2 (Leonidas)==<br />
''25 October 2005''<br />
*Precompiled headers (PCH) support! (currently works only with GCC) <br />
*The source is now fully UNICODE-compatible! <br />
*The source is also fully 64-bit compatible! <br />
*Autoconf/automake build system is now used for non-windows platforms<br />
* New editor functionality<br />
**Find declaration<br />
**Open #include<br />
*Project wizard plugins<br />
*Support for SDCC<br />
*Better handling of modified files outside the IDE<br />
*Single file compilation<br />
*Find-in-Files for arbitrary paths/filemasks<br />
*All internal file formats are well-formed, valid XML<br />
*New plugins:<br />
**Code statistics: counts nr. of source lines, nr. of comment lines, etc. <br />
**CBProfiler: parses and displays the output of GProf, the GNU Profiler<br />
**SourceExporter: exports the active file to HTML/RTF/ODT<br />
*New lexers: <br />
**Fortran77 <br />
**NVidia CG<br />
**X-Base languages (Clipper, Foxpro) <br />
*New and improved project templates: <br />
**SDCC program <br />
**Irrlicht 3D Graphics Engine <br />
**Ogre 3D Graphics Engine <br />
**GLFW project (OpenGL FrameWork) <br />
**wxWidgets: static/dynamic unicode/ansi versions. <br />
<br />
<br />
==Version 1.0 RC 1-1 (Oedipus)==<br />
''2 August 2005''<br />
*Several critical bug fixes<br />
<br />
<br />
==Version 1.0 RC 1 (Laius)==<br />
''25 July 2005''<br />
*Compiler support for OpenWatcom <br />
*Per-target environment variables<br />
*Convenient "Start here" page<br />
*Improved gcc error parsing<br />
*Find in files functionality<br />
*Ability to add files to project recursively. <br />
*External dependency handling<br />
*Better import of foreign project files<br />
*Many GDB debugger updates<br />
*Numerous user interface improvements<br />
*New project templates<br />
**QT4. <br />
**Ogre3D. <br />
* Modular Syntax highlighting<br />
* Syntax highlighting support for:<br />
**C/C++ <br />
**Windows resources <br />
**HTML/XML/XSL<br />
**Lua scripts <br />
**GameMonkey scripts <br />
**Hitach H8 ASM</div>Auriahttps://wiki.codeblocks.org/index.php?title=Installing_Code::Blocks_from_source_on_Mac_OS_X&diff=4985Installing Code::Blocks from source on Mac OS X2007-09-25T16:54:44Z<p>Auria: /* Automake example (Panther) */</p>
<hr />
<div>[[Category:Installing Code::Blocks]]<br />
[[Category:Installing Code::Blocks from source]]<br />
These are instructions on how to build Code::Blocks under Apple Mac OS X.<br />
They have been tested under Mac OS X version 10.3 and under Mac OS X 10.4<br />
(PowerPC and Intel), and might work on old Mac OS X 10.2 and 10.1 as well.<br />
<br />
We will be building everything from scratch using the source code, and<br />
not use any available package managers like<br />
[http://www.macports.org MacPorts],<br />
[http://fink.sourceforge.net/ Fink],<br />
[http://gentoo-wiki.com/Gentoo_MacOS Gentoo] or<br />
[http://rpm4darwin.sourceforge.net RPM].<br />
Packaging can be done later, once it has reached a more stable release.<br />
<br />
Update: building for MacPorts can be found at the end of the document.<br />
<br />
== Install Developer Tools ==<br />
<br />
If they didn't come bundled with Mac OS X, get the Xcode Tools (or Developer Tools for older Mac OS X) from:<br />
<br />
http://developer.apple.com/tools/<br />
<br />
This will install Apple versions of:<br />
<br />
* http://www.gnu.org/software/gcc/ (GNU Compilers)<br />
* http://www.gnu.org/software/gdb/ (GNU Debugger)<br />
* http://www.gnu.org/software/make/ (GNU Make)<br />
<br />
Note: 2006/04<br />
Apple pulled all the old links in order to promote Mac OS X 10.4, but all the<br />
old developer tools can be downloaded from ADC at http://connect.apple.com/<br />
<br />
You need a (free) developer registration with Apple first, in order to log in there.<br />
For Mac OS X 10.4, you want (at least) Xcode 2.2, since earlier versions were buggy.<br />
For Mac OS X 10.3, you want Xcode 1.5. For Mac OS X 10.1-10.2, the latest Dev Tools.<br />
<br />
== Check Autotools versions ==<br />
<br />
Depending on your OS version, you might need to download and compile new versions of these:<br />
<br />
* http://www.gnu.org/software/autoconf/ (GNU Autoconf)<br />
* http://www.gnu.org/software/automake/ (GNU Automake)<br />
* http://www.gnu.org/software/libtool/ (GNU Libtool)<br />
<br />
Check what you have, with <tt>--version</tt> (note that GNU libtool is called "glibtool" on Mac OS X)<br />
<br />
Currently Code::Blocks requires versions:<br />
* autoconf 2.50+<br />
* automake 1.7+ (1.9+ needed in order to build the dist tarball)<br />
* libtool 1.4+ (1.5.8+ highly recommended to get some bug fixes)<br />
<br />
=== Automake example (Panther) ===<br />
<br />
For Mac OS X 10.3, you will only need an upgraded (local) installation of automake 1.7.x.<br />
<br />
You can download "[ftp://ftp.gnu.org/gnu/automake/automake-1.7.9.tar.gz automake-1.7.9.tar.gz]" and configure and install it with something like:<br />
<br />
<pre><br />
./configure --prefix=/usr/local --program-suffix=-1.7<br />
make<br />
sudo make install<br />
sudo cp -pi /usr/share/aclocal/libtool.m4 /usr/local/share/aclocal-1.7/<br />
</pre><br />
<br />
Since it's now known as "automake-1.7", it won't interfere with the regular "automake"<br />
<br />
On Mac OS X 10.4.8, i downloaded and installed version 1.9. I configured without any options and followed the same steps as above. I just replaced 'automake-1.7' and 'aclocal-1.7' in the bootstrap section by 'automake-1.9' and 'aclocal-1.9' and everything worked.<br />
<br />
If you would rather have the new version to be called when calling "automake", and use a suffix only if you need to call the old one, you can omit the "--program-suffix=-1.7" part, and move the old automake with something like ''sudo mv /usr/bin/automake /usr/bin/automake-old''. The same thingcan apply to other auto* libs as well.<br />
<br />
=== Libtool example ===<br />
Download [http://www.gnu.org/software/libtool/ libtool] source. The following instructions will overwrite your current version of libtool with the one you just downloaded.<br />
<pre><br />
cd /libtool-*/<br />
./configure --prefix=/usr --program-prefix=g<br />
make<br />
sudo make install<br />
</pre><br />
<br />
Note that this will replace the system version of glibtool, which might have some compatibility issues with building other software.<br />
<br />
== FYI: Universal Binaries ==<br />
<br />
If you are building for Mac OS X 10.4 or later, you might want to build "[http://www.apple.com/universal/ Universal Binaries ]"<br />
These are binaries that contain code for both PowerPC ("ppc" arch) and Intel ("i386" arch)<br />
<br />
The basic flags that needs to be added are:<br />
<pre><br />
CFLAGS += "-isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch i386 -arch ppc"<br />
<br />
CXXFLAGS += "-isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch i386 -arch ppc"<br />
</pre><br />
(You only need the sysroot parameter on PowerPC Macintosh, not on a Intel Macintosh)<br />
The "-arch i386 -arch ppc" is what tells the compiler to build a "universal" (or "fat") binary.<br />
<br />
Usually it's easiest to build one version for "powerpc-apple-darwin8",<br />
and one version for "i686-apple-darwin8", and then merge them with "[http://developer.apple.com/documentation/Darwin/Reference/ManPages/man1/lipo.1.html lipo]"<br />
<br />
<pre><br />
./configure --host=powerpc-apple-darwin8 --target=powerpc-apple-darwin8<br />
<br />
./configure --host=i686-apple-darwin8 --target=i686-apple-darwin8<br />
</pre><br />
<br />
Some caveats:<br />
* pre-compiled headers might fail with a "no main" error. If they do, add a -c to only compile them<br />
* when cross-compiling, tools like auto_revision might fail to build. copy these from a native build<br />
* the Tiger compilers might crash from time to time, but that is only to be expected (it seems)...<br />
<br />
See [http://developer.apple.com/technotes/tn2005/tn2137.html Technical Note TN2137]: Building Universal <br />
Binaries from "configure"-based Open Source Projects<br />
<br />
== FYI: ANSI or UNICODE ==<br />
<br />
For the moment we are using "ANSI" (--disable-unicode, default) for Mac OS X 10.3 and earlier,<br />
and "UNICODE" (--enable-unicode, optional) for Mac OS X 10.4 and later. <br />
<br />
See http://www.wxwidgets.org/manuals/stable/wx_unicode.html#unicodeandansi<br />
<br />
== Build wxWidgets ==<br />
<br />
=== Download the source code ===<br />
<br />
Download the tarball for the wxMac release:<br />
<br />
http://wxwidgets.org/downloads/<br />
<br />
=== Apply necessary patches ===<br />
<br />
Don't forget to apply any released patches!<br />
<br />
http://wxwidgets.org/downloads/patch.htm<br />
<br />
=== Configure and (GNU) Make ===<br />
<br />
<pre><br />
mkdir mac-build<br />
cd mac-build<br />
../configure --enable-shared --enable-monolithic --enable-unicode --with-mac --with-opengl \<br />
--with-png=builtin --with-jpeg=builtin --with-tiff=builtin --with-expat=builtin<br />
nice make<br />
</pre><br />
<br />
note: the easiest way to build a Universal Binary with wxWidgets is<br />
the new flag: --enable-universal_binary (you need wxWidgets 2.6.4+)<br />
<br />
=== Install into Destination ===<br />
<br />
<pre><br />
sudo make install<br />
</pre><br />
<br />
== Bundle library for Mac ==<br />
<br />
To avoid having the Code::Blocks user having to compile or install wxWidgets themselves,<br />
we can bundle it with our application so that it is contained in the application bundle.<br />
This could also be done by statically linking wxWidgets, but with dynamic linking we can<br />
share the wxWidgets library between all applications using wxWidgets (not just Code::Blocks)<br />
<br />
<br />
=== Way One: Library (dynamic) ===<br />
<br />
<pre><br />
/usr/local/include/wx-2.6/wx/wx.h<br />
/usr/local/lib/libwx_macu-2.6.dylib -> libwx_macu-2.6.0.dylib<br />
/usr/local/lib/libwx_macu-2.6.0.dylib -> libwx_macu-2.6.0.4.0.dylib<br />
/usr/local/lib/libwx_macu-2.6.0.4.0.dylib<br />
</pre><br />
<br />
To bundle our shared library with the application, we include it in "MacOS" and change the path:<br />
<br />
<pre><br />
install_name_tool -id @executable_path/libwx_macu-2.6.0.dylib<br />
</pre><br />
<br />
@executable_path will be replaced with e.g. /Developer/Applications/CodeBlocks.app/Contents/MacOS<br />
<br />
=== Way Two: Framework (bundle) ===<br />
<br />
<pre><br />
/Library/Frameworks/wx.framework/Headers -> Versions/Current/Headers<br />
/Library/Frameworks/wx.framework/wx -> Versions/Current/wx<br />
/Library/Frameworks/wx.framework/Versions/Current -> 2.6<br />
/Library/Frameworks/wx.framework/Versions/2.6/Headers/wx.h<br />
/Library/Frameworks/wx.framework/Versions/2.6/wx -> libwx_macu-2.6.0.dylib<br />
/Library/Frameworks/wx.framework/Versions/2.6/libwx_macu-2.6.0.dylib -> libwx_macu-2.6.0.4.0.dylib<br />
/Library/Frameworks/wx.framework/Versions/2.6/libwx_macu-2.6.0.4.0.dylib<br />
</pre><br />
<br />
To bundle our framework with the application, we include it in "Frameworks" and change the path:<br />
<br />
<pre><br />
install_name_tool -id @executable_path/../Frameworks/wx.framework/Versions/2.6/libwx_macu-2.6.0.dylib<br />
</pre><br />
<br />
This way it will first look in the framework path (-F), and then in for the shared library path (-L) as usual.<br />
<br />
== Install Subversion client ==<br />
<br />
http://subversion.tigris.org/<br />
<br />
Note: you need SVN for the Code::Blocks revision scripts to work!<br />
<br />
== Build CodeBlocks from SVN ==<br />
<br />
=== Download the source code ===<br />
<br />
https://www.codeblocks.org/source_code.shtml<br />
<br />
<pre><br />
svn checkout svn://svn.berlios.de/codeblocks/trunk<br />
cd trunk<br />
</pre><br />
<br />
=== Apply necessary patches ===<br />
<br />
For a list of all available patches, see:<br />
<br />
http://developer.berlios.de/patch/?group_id=5358<br />
<br />
You might need to convert line endings from DOS to Unix first.<br />
<br />
=== Bootstrap with Autotools ===<br />
<br />
You need to use the newer version of automake, for the "bootstrap":<br />
<br />
<pre><br />
AUTOMAKE=automake-1.7 ACLOCAL=aclocal-1.7 ACLOCAL_FLAGS="-I /usr/share/aclocal" ./bootstrap<br />
</pre><br />
<br />
See above for how to compile and install automake-1.7 on Mac OS X.<br />
<br />
=== Mono Fix ===<br />
<br />
If you have the Mono.framework installed, then it probably set up a symlink like:<br />
<br />
<pre><br />
/usr/bin/pkg-config -> /Library/Frameworks/Mono.framework/Commands/pkg-config<br />
</pre><br />
<br />
Unless you have a "proper" [http://pkgconfig.freedesktop.org/ pkg-config] installation the Code::Blocks configure will fail, so move this symbolic link aside.<br />
<br />
=== Configure ===<br />
<br />
<pre><br />
./configure --enable-contrib<br />
</pre><br />
<br />
Note: the easiest way to build a Universal Binary for Code::Blocks is to build once for PowerPC (-arch ppc) and once for Intel (-arch i386), and then merge them (with lipo) afterwards.<br />
<br />
<pre><br />
mkdir ppc-build<br />
cd ppc-build<br />
../configure --host=powerpc-apple-darwin8 --target=powerpc-apple-darwin8 --enable-contrib<br />
cd ..<br />
<br />
mkdir x86-build<br />
cd x86-build<br />
../configure --host=i686-apple-darwin8 --target=i686-apple-darwin8 --enable-contrib<br />
cd ..<br />
</pre><br />
<br />
Note: You need to patch the location of the pre-compiled headers, or it will generate them in the same place for both arch.<br />
<br />
=== Tiger Fix ===<br />
<br />
There is a bug in the glibtool of Mac OS X 10.4, that fails to link C++ libs:<br />
<br />
<pre><br />
ld: multiple definitions of symbol ___umoddi3<br />
/usr/lib/gcc/powerpc-apple-darwin8/4.0.1/libgcc.a(_umoddi3.o) private external definition of ___umoddi3 in section (__TEXT,__text)<br />
/usr/lib/gcc/powerpc-apple-darwin8/4.0.1/../../../libgcc_s.10.4.dylib(_umoddi3_s.o) definition of ___umoddi3<br />
<br />
ld: multiple definitions of symbol ___umoddi3<br />
/usr/lib/gcc/i686-apple-darwin8/4.0.1/libgcc.a(_umoddi3.o) private external definition of ___umoddi3 in section (__TEXT,__text)<br />
/usr/lib/gcc/i686-apple-darwin8/4.0.1/../../../libgcc_s.10.4.dylib(_umoddi3_s.o) definition of ___umoddi3<br />
</pre><br />
<br />
To work around this, you need to edit the generated "libtool" script manually:<br />
<br />
<pre><br />
177c177<br />
< whole_archive_flag_spec="-all_load \$convenience"<br />
---<br />
> whole_archive_flag_spec=""<br />
6921c6921<br />
< whole_archive_flag_spec="-all_load \$convenience"<br />
---<br />
> whole_archive_flag_spec=""<br />
</pre><br />
<br />
This bug has been fixed in GNU libtool 1.5.8 and later.<br />
<br />
=== (GNU) Make ===<br />
<br />
"nice" isn't strictly needed, it just makes the compile run at a lower process priority<br />
<br />
<pre><br />
nice make<br />
</pre><br />
<br />
For the Universal Binary build:<br />
<br />
<pre><br />
cd ppc-build<br />
nice make<br />
cd ..<br />
<br />
cd x86-build<br />
nice make<br />
cd ..<br />
</pre><br />
<br />
=== Install into Destination ===<br />
<br />
"sudo" asks you for an admin password, in order to get install permissions<br />
<br />
<pre><br />
sudo make install<br />
</pre><br />
<br />
For the Universal Binary build:<br />
<br />
<pre><br />
cd ppc-build<br />
make install DESTDIR=/tmp/ppc<br />
cd ..<br />
<br />
cd x86-build<br />
make install DESTDIR=/tmp/x86<br />
cd ..<br />
<br />
lipomerge /tmp/ppc /tmp/x86 /tmp/fat<br />
</pre><br />
<br />
Where "lipomerge" is a custom shell script:<br />
<br />
* http://www.algonet.se/~afb/wx/lipomerge<br />
<br />
== Bundle application for Mac ==<br />
<br />
After building codeblocks in the regular Unix way, you need to bundle it with the icons<br />
and various other info that it needs to make a regular stand-alone Macintosh application.<br />
<br />
There are two ways of accomplishing this, old Mac OS-style resource or NeXT-style bundle.<br />
The old resources are handy while developing, while bundles are more suitable for release.<br />
<br />
Note: You '''need''' to use either of these methods, or your application will launch<br />
in the background behind all other windows and will be unable to receive any events!<br />
<br />
=== Way One: Mac OS (resource) ===<br />
<br />
http://developer.apple.com/documentation/Carbon/Reference/Resource_Manager/<br />
<br />
Handy while developing, as you only need to add an icon.<br />
<br />
Files needed:<br />
* http://www.algonet.se/~afb/wx/CodeBlocks.r.gz (Rez icon, gzipped)<br />
<br />
First we install the program to the PREFIX directory of your choice:<br />
<br />
<pre><br />
$PREFIX/bin<br />
$PREFIX/lib<br />
$PREFIX/share/codeblocks<br />
</pre><br />
<br />
Add a custom icon to the application, and make it receive events:<br />
<br />
<pre><br />
gunzip CodeBlocks.r.gz<br />
sudo /Developer/Tools/Rez -d __DARWIN__ -t APPL -d __WXMAC__ \<br />
CodeBlocks.r Carbon.r -o $PREFIX/bin/codeblocks<br />
sudo /Developer/Tools/SetFile -a C $PREFIX/bin/codeblocks<br />
</pre><br />
<br />
Note: on the Intel Macintoshes, the icon comes up as "broken"<br />
(apparently it assumes that all apps with resforks are Classic)<br />
<br />
Without the icon part, this could also have be written as just:<br />
<br />
<pre><br />
sudo `wx-config --rezflags` $PREFIX/bin/codeblocks<br />
</pre><br />
<br />
Start the application with a small prefix shell wrapper like this:<br />
<br />
<pre><br />
DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:$PREFIX/lib<br />
export DYLD_LIBRARY_PATH<br />
<br />
$PREFIX/bin/codeblocks --prefix=$PREFIX<br />
</pre><br />
<br />
You don't need the "DYLD_LIBRARY_PATH" stuff,<br />
if you are installing to a system directory.<br />
<br />
==== Common PREFIX Settings ====<br />
<br />
Local: <tt>PREFIX=/usr/local</tt><br />
<br />
System: <tt>PREFIX=/usr</tt><br />
<br />
MacPorts: <tt>PREFIX=/opt/local</tt><br />
<br />
Fink: <tt>PREFIX=/sw</tt><br />
<br />
=== Way Two: NeXT (bundle) ===<br />
<br />
http://developer.apple.com/documentation/CoreFoundation/Conceptual/CFBundles/<br />
<br />
This does not involve resources, and is more relocatable.<br />
<br />
Files needed:<br />
* http://www.algonet.se/~afb/wx/CodeBlocks.Info.plist (rename to "Info.plist")<br />
* http://www.algonet.se/~afb/wx/CodeBlocks.sh (shell wrapper, rename to "CodeBlocks")<br />
* http://www.algonet.se/~afb/wx/CodeBlocks.icns (Mac OS X icon, rename to "app.icns")<br />
<br />
The MacOS program will just be a shell wrapper that calls "bin/codeblocks", like above.<br />
Traditionally the bundle would include Frameworks and Resources, but we'll just avoid those<br />
here and use the regular "lib" and "share/codeblocks" instead (just as with a regular install). <br />
These temporary directories are listed in italic below, they're not really used in bundles...<br />
<br />
Setup a hierarchy like this, and copy the files from the regular build/install and the above file list to it:<br />
<br />
CodeBlocks.app<br />
CodeBlocks.app/Contents/<br />
CodeBlocks.app/Contents/Info.plist<br />
CodeBlocks.app/Contents/MacOS/<br />
CodeBlocks.app/Contents/MacOS/CodeBlocks<br />
CodeBlocks.app/Contents/Resources/<br />
CodeBlocks.app/Contents/Resources/app.icns<br />
''CodeBlocks.app/Contents/bin/''<br />
''CodeBlocks.app/Contents/lib/''<br />
''CodeBlocks.app/Contents/share/codeblocks/''<br />
<br />
The CodeBlocks application can now be moved with the Finder, and started up like a regular Mac application. (the nightly build includes a more advanced Info.plist and more icons - for also mapping all the files that the application can open, like source code and header files and such)<br />
<br />
==== Proper Application Bundling ====<br />
<br />
To avoid the shell wrapper, the binary can now be moved from "bin/codeblocks" to "MacOS/CodeBlocks". Helper files are moved from "share/codeblocks" to "Resources". The dynamic libraries are moved from "lib" to "MacOS":<br />
<br />
<pre><br />
mv bin/codeblocks MacOS/CodeBlocks<br />
rmdir bin<br />
mv lib/* MacOS/<br />
rmdir lib<br />
mv share Resources/<br />
</pre><br />
<br />
To avoid having to use a DYLD_LIBRARY_PATH, we rename the shared libraries (with the install_name_tool program) from e.g. /usr/local/lib/ to @executable_path/:<br />
<br />
<pre><br />
install_name_tool -change /usr/local/lib/libcodeblocks.0.dylib \<br />
@executable_path/libcodeblocks.0.dylib MacOS/CodeBlocks<br />
</pre><br />
<br />
The libraries can have their names changed using the -id parameter:<br />
<br />
<pre><br />
install_name_tool -id @executable_path/libcodeblocks.0.dylib MacOS/libcodeblocks.0.dylib<br />
</pre><br />
<br />
You also need to change all of the loadable bundles for the plugins:<br />
<br />
<pre><br />
for so in Resources/plugins/*.so<br />
do install_name_tool -change /usr/local/lib/libcodeblocks.0.dylib \<br />
@executable_path/libcodeblocks.0.dylib $so<br />
done<br />
</pre><br />
<br />
You can check the result, what libraries/frameworks it links to, with:<br />
<br />
<pre><br />
otool -L CodeBlocks<br />
</pre><br />
<br />
Optionally you can then repeat the process, for the wx library too...<br />
<br />
== FYI: Darwin vs. Mac OS X ==<br />
<br />
"Darwin is the UNIX technology-based foundation of Mac OS X."<br />
<br />
* http://developer.apple.com/referencelibrary/Darwin/<br />
<br />
* http://en.wikipedia.org/wiki/Darwin_(operating_system)<br />
<br />
"Pure Darwin" here refers to the Open Source version of the OS:<br />
<br />
* http://www.opensource.apple.com/darwinsource/images/<br />
<br />
* http://opendarwin.org/ or http://gnu-darwin.sourceforge.net/<br />
<br />
(that is: Darwin using X11 instead of Aqua for the user interface)<br />
<br />
== Install with MacPorts ==<br />
<br />
=== Install wxWidgets ===<br />
<br />
You will need the wxWidgets library, install as port with:<br />
<br />
<pre><br />
sudo port install wxWidgets<br />
</pre><br />
<br />
If you want the X11/GTK version on Mac OS X, instead use:<br />
<br />
<pre><br />
sudo port install wxgtk<br />
</pre><br />
<br />
=== Install Code::Blocks ===<br />
<br />
After that is installed, you can install Code::Blocks with:<br />
<br />
<pre><br />
sudo port install codeblocks-devel +aqua<br />
</pre><br />
<br />
If you want the X11/GTK version on Mac OS X, instead use:<br />
<br />
<pre><br />
sudo port install codeblocks-devel +x11<br />
</pre><br />
<br />
This will download the SVN trunk, and any dependencies:<br />
<br />
<pre><br />
---> Fetching codeblocks-devel<br />
---> Verifying checksum(s) for codeblocks-devel<br />
---> Extracting codeblocks-devel<br />
---> Configuring codeblocks-devel<br />
---> Building codeblocks-devel with target all<br />
---> Staging codeblocks-devel into destroot<br />
---> Packaging tgz archive for codeblocks-devel 1.0_0+aqua+macosx<br />
---> Installing codeblocks-devel 1.0_0+aqua+macosx<br />
---> Activating codeblocks-devel 1.0_0+aqua+macosx<br />
---> Cleaning codeblocks-devel<br />
</pre><br />
<br />
Note: to upgrade from SVN, you need to uninstall first:<br />
<br />
<pre><br />
sudo port uninstall codeblocks-devel<br />
sudo port clean codeblocks-devel<br />
sudo port install codeblocks-devel<br />
</pre><br />
<br />
This is both because all SVN versions are numbered "0",<br />
but also due to a bug in the Code::Blocks build scripts.<br />
<br />
=== Running <tt>+aqua</tt> (wxMac) version ===<br />
<br />
After the build completes, you can start the program by:<br />
<br />
<pre><br />
open /Applications/MacPorts/CodeBlocks.app<br />
</pre><br />
<br />
Note that the wxMac application bundle in "MacPorts"<br />
is just a wrapper, with symbolic links to /opt/local...<br />
<br />
<pre><br />
/opt/local/bin/codeblocks<br />
</pre><br />
<br />
=== Running <tt>+x11</tt> (wxGTK) version ===<br />
<br />
The non-bundled wxGTK version is instead started with:<br />
<br />
<pre><br />
/opt/local/bin/codeblocks<br />
</pre><br />
<br />
When running X11/wxGTK programs in Mac OS X, you can use<br />
"open-x11" to first start up X11.app and set up $DISPLAY:<br />
<br />
<pre><br />
open-x11 /opt/local/bin/codeblocks<br />
</pre></div>Auriahttps://wiki.codeblocks.org/index.php?title=Roadmap_for_version_1.0&diff=4485Roadmap for version 1.02007-03-06T03:07:50Z<p>Auria: /* Version 1.0 RC 3 (Ephialtes) */</p>
<hr />
<div>[[Category:Roadmaps]]<br />
==Version 1.0 (Pheidippides)==<br />
''August 2006''<br />
<br />
==Version 1.0 RC final (Athenades)==<br />
''Mid-July 2006''<br />
*No feature additions.<br />
*Regression and bug handling only.<br />
<br />
==Version 1.0 RC 3 (Ephialtes)==<br />
*[[Image:Chk.png]]Unicode support<br />
**[[Image:Chk.png]]User interface<br />
**[[Image:Chk.png]]Configuration system<br />
**[[Image:Chk.png]]Editor component<br />
**[[Image:Nop.png]]Fully automatic detection of document encoding<br />
*[[Image:Blk.png]]<s>Scripting support (Angelscript)</s> <i>(abandoned due to lack of 64bit support)</i><br />
*[[Image:Chk.png]]Scripting support (Squirrel/Sq plus)<br />
**[[Image:Chk.png]]Watch scripts (see [[Debugger scripts]])<br />
**[[Image:Chk.png]]Build target scripts<br />
*[[Image:Chk.png]]Virtual folder support<br />
*[[Image:Chk.png]]Global user variables<br />
**[[Image:Chk.png]]Profile-dependent GUVs<br />
**[[Image:Chk.png]]Multiple variable sets<br />
**[[Image:Chk.png]]Custom variable definition<br />
*[[Image:Chk.png]]wxFlatNoteBook editors<br />
*[[Image:Chk.png]]wxAUI docking library<br />
*[[Image:Chk.png]]Context-sensitive layout switching<br />
*[[Image:Chk.png]]XML-based configuration system<br />
*[[Image:Blk.png]]XML-based compiler framework<br />
*[[Image:Blk.png]]Property-based build system<br />
*[[Image:Chk.png]]Improved configuration user interface<br />
*[[Image:Blk.png]]Automatic updates<br />
*[[Image:Blk.png]]Usability and stability fixes for code completion plugin <br />
*[[Image:Blk.png]]Regression and bug handling.<br />
<br />
==Version 1.0 RC 2 (Leonidas)==<br />
''25 October 2005''<br />
*Precompiled headers (PCH) support! (currently works only with GCC) <br />
*The source is now fully UNICODE-compatible! <br />
*The source is also fully 64-bit compatible! <br />
*Autoconf/automake build system is now used for non-windows platforms<br />
* New editor functionality<br />
**Find declaration<br />
**Open #include<br />
*Project wizard plugins<br />
*Support for SDCC<br />
*Better handling of modified files outside the IDE<br />
*Single file compilation<br />
*Find-in-Files for arbitrary paths/filemasks<br />
*All internal file formats are well-formed, valid XML<br />
*New plugins:<br />
**Code statistics: counts nr. of source lines, nr. of comment lines, etc. <br />
**CBProfiler: parses and displays the output of GProf, the GNU Profiler<br />
**SourceExporter: exports the active file to HTML/RTF/ODT<br />
*New lexers: <br />
**Fortran77 <br />
**NVidia CG<br />
**X-Base languages (Clipper, Foxpro) <br />
*New and improved project templates: <br />
**SDCC program <br />
**Irrlicht 3D Graphics Engine <br />
**Ogre 3D Graphics Engine <br />
**GLFW project (OpenGL FrameWork) <br />
**wxWidgets: static/dynamic unicode/ansi versions. <br />
<br />
<br />
==Version 1.0 RC 1-1 (Oedipus)==<br />
''2 August 2005''<br />
*Several critical bug fixes<br />
<br />
<br />
==Version 1.0 RC 1 (Laius)==<br />
''25 July 2005''<br />
*Compiler support for OpenWatcom <br />
*Per-target environment variables<br />
*Convenient "Start here" page<br />
*Improved gcc error parsing<br />
*Find in files functionality<br />
*Ability to add files to project recursively. <br />
*External dependency handling<br />
*Better import of foreign project files<br />
*Many GDB debugger updates<br />
*Numerous user interface improvements<br />
*New project templates<br />
**QT4. <br />
**Ogre3D. <br />
* Modular Syntax highlighting<br />
* Syntax highlighting support for:<br />
**C/C++ <br />
**Windows resources <br />
**HTML/XML/XSL<br />
**Lua scripts <br />
**GameMonkey scripts <br />
**Hitach H8 ASM</div>Auriahttps://wiki.codeblocks.org/index.php?title=Installing_Code::Blocks_from_source_on_Mac_OS_X&diff=4484Installing Code::Blocks from source on Mac OS X2007-03-06T03:01:35Z<p>Auria: /* Automake example (Panther) */</p>
<hr />
<div>[[Category:Installing Code::Blocks]]<br />
[[Category:Installing Code::Blocks from source]]<br />
These are instructions on how to build Code::Blocks under Apple Mac OS X.<br />
They have been tested under Mac OS X version 10.3 and under Mac OS X 10.4<br />
(PowerPC and Intel), and might work on old Mac OS X 10.2 and 10.1 as well.<br />
<br />
We will be building everything from scratch using the source code, and<br />
not use any available package managers like<br />
[http://darwinports.opendarwin.org DarwinPorts],<br />
[http://fink.sourceforge.net/ Fink],<br />
[http://gentoo-wiki.com/Gentoo_MacOS Gentoo] or<br />
[http://rpm4darwin.sourceforge.net RPM].<br />
Packaging can be done later, once it has reached a more stable release.<br />
<br />
Update: building for DarwinPorts can be found at the end of the document.<br />
<br />
== Install Developer Tools ==<br />
<br />
If they didn't come bundled with Mac OS X, get the Xcode Tools (or Developer Tools for older Mac OS X) from:<br />
<br />
http://developer.apple.com/tools/<br />
<br />
This will install Apple versions of:<br />
<br />
* http://www.gnu.org/software/gcc/ (GNU Compilers)<br />
* http://www.gnu.org/software/gdb/ (GNU Debugger)<br />
* http://www.gnu.org/software/make/ (GNU Make)<br />
<br />
Note: 2006/04<br />
Apple pulled all the old links in order to promote Mac OS X 10.4, but all the<br />
old developer tools can be downloaded from ADC at http://connect.apple.com/<br />
<br />
You need a (free) developer registration with Apple first, in order to log in there.<br />
For Mac OS X 10.4, you want (at least) Xcode 2.2, since earlier versions were buggy.<br />
For Mac OS X 10.3, you want Xcode 1.5. For Mac OS X 10.1-10.2, the latest Dev Tools.<br />
<br />
== Check Autotools versions ==<br />
<br />
Depending on your OS version, you might need to download and compile new versions of these:<br />
<br />
* http://www.gnu.org/software/autoconf/ (GNU Autoconf)<br />
* http://www.gnu.org/software/automake/ (GNU Automake)<br />
* http://www.gnu.org/software/libtool/ (GNU Libtool)<br />
<br />
Check what you have, with <tt>--version</tt> (note that GNU libtool is called "glibtool" on Mac OS X)<br />
<br />
Currently Code::Blocks requires versions:<br />
* autoconf 2.50+<br />
* automake 1.7+<br />
* libtool 1.4+ (1.5.8+ highly recommended to get some bug fixes)<br />
<br />
=== Automake example (Panther) ===<br />
<br />
For Mac OS X 10.3, you will only need an upgraded (local) installation of automake 1.7.x.<br />
<br />
You can download "[ftp://ftp.gnu.org/gnu/automake/automake-1.7.9.tar.gz automake-1.7.9.tar.gz]" and configure and install it with something like:<br />
<br />
<pre><br />
./configure --prefix=/usr/local --program-suffix=-1.7<br />
make<br />
sudo make install<br />
sudo cp -pi /usr/share/aclocal/libtool.m4 /usr/local/share/aclocal-1.7/<br />
</pre><br />
<br />
Since it's now known as "automake-1.7", it won't interfere with the regular "automake"<br />
<br />
On Mac OS X 10.4.8, i downloaded and installed version 1.9. I configured without any options and followed the same steps as above. I just replaced 'automake-1.7' and 'aclocal-1.7' in the bootstrap section by 'automake-1.9' and 'aclocal-1.9' and everything worked.<br />
<br />
=== Libtool example ===<br />
Download [http://www.gnu.org/software/libtool/ libtool] source. The following instructions will overwrite your current version of libtool with the one you just downloaded.<br />
<pre><br />
cd /libtool-dir/<br />
./configure --prefix=/usr/ --program-prefix=g<br />
make<br />
sudo make install<br />
</pre><br />
<br />
== FYI: Universal Binaries ==<br />
<br />
If you are building for Mac OS X 10.4 or later, you might want to build "[http://www.apple.com/universal/ Universal Binaries ]"<br />
These are binaries that contain code for both PowerPC ("ppc" arch) and Intel ("i386" arch)<br />
<br />
The basic flags that needs to be added are:<br />
<pre><br />
CFLAGS += "-isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch i386 -arch ppc"<br />
<br />
CXXFLAGS += "-isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch i386 -arch ppc"<br />
</pre><br />
(You only need the sysroot parameter on PowerPC Macintosh, not on a Intel Macintosh)<br />
The "-arch i386 -arch ppc" is what tells the compiler to build a "universal" (or "fat") binary.<br />
<br />
Usually it's easiest to build one version for "powerpc-apple-darwin8",<br />
and one version for "i686-apple-darwin8", and then merge them with "[http://developer.apple.com/documentation/Darwin/Reference/ManPages/man1/lipo.1.html lipo]"<br />
<br />
<pre><br />
./configure --host=powerpc-apple-darwin8 --target=powerpc-apple-darwin8<br />
<br />
./configure --host=i686-apple-darwin8 --target=i686-apple-darwin8<br />
</pre><br />
<br />
Some caveats:<br />
* pre-compiled headers might fail with a "no main" error. If they do, add a -c to only compile them<br />
* when cross-compiling, tools like auto_revision might fail to build. copy these from a native build<br />
* the Tiger compilers might crash from time to time, but that is only to be expected (it seems)...<br />
<br />
See [http://developer.apple.com/technotes/tn2005/tn2137.html Technical Note TN2137]: Building Universal <br />
Binaries from "configure"-based Open Source Projects<br />
<br />
== FYI: ANSI or UNICODE ==<br />
<br />
For the moment we are using "ANSI" (--disable-unicode, default) for Mac OS X 10.3 and earlier,<br />
and "UNICODE" (--enable-unicode, optional) for Mac OS X 10.4 and later. <br />
<br />
See http://www.wxwidgets.org/manuals/2.6.3/wx_unicode.html#unicodeandansi<br />
<br />
== Build wxWidgets 2.6 ==<br />
<br />
=== Download the source code ===<br />
<br />
Download the tarball for the wxMac release:<br />
<br />
http://wxwidgets.org/downloads/#latest_stable<br />
<br />
=== Apply necessary patches ===<br />
<br />
Don't forget to apply any released patches!<br />
<br />
http://wxwidgets.org/downloads/patch.htm<br />
<br />
For Intel Macintosh, you will need this additional patch:<br />
<br />
* http://www.algonet.se/~afb/wx/wxWidgets-killpoll.patch<br />
<br />
<pre><br />
patch -p1 -i wxWidgets-killpoll.patch<br />
</pre><br />
<br />
=== Configure and (GNU) Make ===<br />
<br />
<pre><br />
mkdir mac-build<br />
cd mac-build<br />
../configure --enable-shared --enable-monolithic --with-mac --with-opengl \<br />
--with-png=builtin --with-jpeg=builtin --with-tiff=builtin --with-expat=builtin<br />
nice make<br />
</pre><br />
<br />
note: the easiest way to build a Universal Binary with wxWidgets is<br />
the new flag: --enable-universal_binary (you need wxWidgets 2.6.3+)<br />
<br />
=== Install into Destination ===<br />
<br />
<pre><br />
sudo make install<br />
</pre><br />
<br />
== Bundle library for Mac ==<br />
<br />
To avoid having the Code::Blocks user having to compile or install wxWidgets themselves,<br />
we can bundle it with our application so that it is contained in the application bundle.<br />
This could also be done by statically linking wxWidgets, but with dynamic linking we can<br />
share the wxWidgets library between all applications using wxWidgets (not just Code::Blocks)<br />
<br />
<br />
=== Way One: Library (dynamic) ===<br />
<br />
<pre><br />
/usr/local/include/wx-2.6/wx/wx.h<br />
/usr/local/lib/libwx_macu-2.6.dylib -> libwx_macu-2.6.0.dylib<br />
/usr/local/lib/libwx_macu-2.6.0.dylib -> libwx_macu-2.6.0.3.1.dylib<br />
/usr/local/lib/libwx_macu-2.6.0.3.1.dylib<br />
</pre><br />
<br />
To bundle our shared library with the application, we include it in "MacOS" and change the path:<br />
<br />
<pre><br />
install_name_tool -id @executable_path/libwx_macu-2.6.0.dylib<br />
</pre><br />
<br />
@executable_path will be replaced with e.g. /Developer/Applications/CodeBlocks.app/Contents/MacOS<br />
<br />
=== Way Two: Framework (bundle) ===<br />
<br />
<pre><br />
/Library/Frameworks/wx.framework/Headers -> Versions/Current/Headers<br />
/Library/Frameworks/wx.framework/wx -> Versions/Current/wx<br />
/Library/Frameworks/wx.framework/Versions/Current -> 2.6.3<br />
/Library/Frameworks/wx.framework/Versions/2.6.3/Headers/wx.h<br />
/Library/Frameworks/wx.framework/Versions/2.6.3/wx -> libwx_macu-2.6.0.dylib<br />
/Library/Frameworks/wx.framework/Versions/2.6.3/libwx_macu-2.6.0.dylib -> libwx_macu-2.6.0.3.1.dylib<br />
/Library/Frameworks/wx.framework/Versions/2.6.3/libwx_macu-2.6.0.3.1.dylib<br />
</pre><br />
<br />
To bundle our framework with the application, we include it in "Frameworks" and change the path:<br />
<br />
<pre><br />
install_name_tool -id @executable_path/../Frameworks/wx.framework/Versions/2.6.3/libwx_macu-2.6.0.dylib<br />
</pre><br />
<br />
This way it will first look in the framework path (-F), and then in for the shared library path (-L) as usual.<br />
<br />
== Install Subversion client ==<br />
<br />
http://subversion.tigris.org/<br />
<br />
Note: you need SVN for the Code::Blocks revision scripts to work!<br />
<br />
== Build CodeBlocks from SVN ==<br />
<br />
=== Download the source code ===<br />
<br />
https://www.codeblocks.org/source_code.shtml<br />
<br />
<pre><br />
svn checkout svn://svn.berlios.de/codeblocks/trunk<br />
cd trunk<br />
</pre><br />
<br />
=== Apply necessary patches ===<br />
<br />
For a list of necessary patches, see below under "DarwinPorts", or:<br />
<br />
http://developer.berlios.de/patch/?group_id=5358<br />
<br />
<pre><br />
patch -p0 -i codeblocks-rev3656_pluginslib.patch<br />
</pre><br />
<br />
You might need to convert the line endings from DOS to Unix first.<br />
<br />
Hopefully most of these should be merged upstream, before release:<br />
<br />
* http://developer.berlios.de/patch/?func=detailpatch&patch_id=1395&group_id=5358<br />
<br />
(when they are, the above stand-alone patches might fail to apply)<br />
<br />
=== Bootstrap with Autotools ===<br />
<br />
You need to use the newer version of automake, for the "bootstrap":<br />
<br />
<pre><br />
AUTOMAKE=automake-1.7 ACLOCAL=aclocal-1.7 ACLOCAL_FLAGS="-I /usr/share/aclocal" ./bootstrap<br />
</pre><br />
<br />
See above for how to compile and install automake-1.7 on Mac OS X.<br />
<br />
=== Configure ===<br />
<br />
<pre><br />
./configure --enable-contrib<br />
</pre><br />
<br />
Note: the easiest way to build a Universal Binary for Code::Blocks is to build once for PowerPC (-arch ppc) and once for Intel (-arch i386), and then merge them (with lipo) afterwards.<br />
<br />
<pre><br />
mkdir ppc-build<br />
cd ppc-build<br />
../configure --host=powerpc-apple-darwin8 --target=powerpc-apple-darwin8 --enable-contrib<br />
cd ..<br />
<br />
mkdir x86-build<br />
cd x86-build<br />
../configure --host=i686-apple-darwin8 --target=i686-apple-darwin8 --enable-contrib<br />
cd ..<br />
</pre><br />
<br />
Note: You need to patch the location of the pre-compiled headers, or it will generate them in the same place for both arch.<br />
<br />
=== Tiger Fix ===<br />
<br />
There is a bug in the glibtool of Mac OS X 10.4, that fails to link C++ libs:<br />
<br />
<pre><br />
ld: multiple definitions of symbol ___umoddi3<br />
/usr/lib/gcc/powerpc-apple-darwin8/4.0.1/libgcc.a(_umoddi3.o) private external definition of ___umoddi3 in section (__TEXT,__text)<br />
/usr/lib/gcc/powerpc-apple-darwin8/4.0.1/../../../libgcc_s.10.4.dylib(_umoddi3_s.o) definition of ___umoddi3<br />
<br />
ld: multiple definitions of symbol ___umoddi3<br />
/usr/lib/gcc/i686-apple-darwin8/4.0.1/libgcc.a(_umoddi3.o) private external definition of ___umoddi3 in section (__TEXT,__text)<br />
/usr/lib/gcc/i686-apple-darwin8/4.0.1/../../../libgcc_s.10.4.dylib(_umoddi3_s.o) definition of ___umoddi3<br />
</pre><br />
<br />
To work around this, you need to edit the generated "libtool" script manually:<br />
<br />
<pre><br />
177c177<br />
< whole_archive_flag_spec="-all_load \$convenience"<br />
---<br />
> whole_archive_flag_spec=""<br />
6921c6921<br />
< whole_archive_flag_spec="-all_load \$convenience"<br />
---<br />
> whole_archive_flag_spec=""<br />
</pre><br />
<br />
This bug has been fixed in GNU libtool 1.5.8 and later.<br />
<br />
=== (GNU) Make ===<br />
<br />
<pre><br />
nice make<br />
</pre><br />
<br />
For the Universal Binary build:<br />
<br />
<pre><br />
cd ppc-build<br />
nice make<br />
cd ..<br />
<br />
cd x86-build<br />
nice make<br />
cd ..<br />
</pre><br />
<br />
=== Install into Destination ===<br />
<br />
<pre><br />
sudo make install<br />
</pre><br />
<br />
For the Universal Binary build:<br />
<br />
<pre><br />
cd ppc-build<br />
make install DESTDIR=/tmp/ppc<br />
cd ..<br />
<br />
cd x86-build<br />
make install DESTDIR=/tmp/x86<br />
cd ..<br />
<br />
lipomerge /tmp/ppc /tmp/x86 /tmp/fat<br />
</pre><br />
<br />
Where "lipomerge" is a custom shell script:<br />
<br />
* http://www.algonet.se/~afb/wx/lipomerge<br />
<br />
== Bundle application for Mac ==<br />
<br />
After building codeblocks in the regular Unix way, you need to bundle it with the icons<br />
and various other info that it needs to make a regular stand-alone Macintosh application.<br />
<br />
There are two ways of accomplishing this, old Mac OS-style resource or NeXT-style bundle.<br />
The old resources are handy while developing, while bundles are more suitable for release.<br />
<br />
Note: You '''need''' to use either of these methods, or your application will launch<br />
in the background behind all other windows and will be unable to receive any events!<br />
<br />
=== Way One: Mac OS (resource) ===<br />
<br />
http://developer.apple.com/documentation/Carbon/Reference/Resource_Manager/<br />
<br />
Handy while developing, as you only need to add an icon.<br />
<br />
Files needed:<br />
* http://www.algonet.se/~afb/wx/CodeBlocks.r.gz (Rez icon, gzipped)<br />
<br />
First we install the program to the PREFIX directory of your choice:<br />
<br />
<pre><br />
$PREFIX/bin<br />
$PREFIX/lib<br />
$PREFIX/share/codeblocks<br />
</pre><br />
<br />
Add a custom icon to the application, and make it receive events:<br />
<br />
<pre><br />
gunzip CodeBlocks.r.gz<br />
sudo /Developer/Tools/Rez -d __DARWIN__ -t APPL -d __WXMAC__ \<br />
CodeBlocks.r Carbon.r -o $PREFIX/bin/codeblocks<br />
sudo /Developer/Tools/SetFile -a C $PREFIX/bin/codeblocks<br />
</pre><br />
<br />
Note: on the Intel Macintoshes, the icon comes up as "broken"<br />
(apparently it assumes that all apps with resforks are Classic)<br />
<br />
Without the icon part, this could also have be written as just:<br />
<br />
<pre><br />
sudo `wx-config --rezflags` $PREFIX/bin/codeblocks<br />
</pre><br />
<br />
Start the application with a small prefix shell wrapper like this:<br />
<br />
<pre><br />
DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:$PREFIX/lib<br />
export DYLD_LIBRARY_PATH<br />
<br />
$PREFIX/bin/codeblocks --prefix=$PREFIX<br />
</pre><br />
<br />
You don't need the "DYLD_LIBRARY_PATH" stuff,<br />
if you are installing to a system directory.<br />
<br />
==== Common PREFIX Settings ====<br />
<br />
Local: <tt>PREFIX=/usr/local</tt><br />
<br />
System: <tt>PREFIX=/usr</tt><br />
<br />
DarwinPorts: <tt>PREFIX=/opt/local</tt><br />
<br />
Fink: <tt>PREFIX=/sw</tt><br />
<br />
=== Way Two: NeXT (bundle) ===<br />
<br />
http://developer.apple.com/documentation/CoreFoundation/Conceptual/CFBundles/<br />
<br />
This does not involve resources, and is more relocatable.<br />
<br />
Files needed:<br />
* http://www.algonet.se/~afb/wx/CodeBlocks.Info.plist (rename to "Info.plist")<br />
* http://www.algonet.se/~afb/wx/CodeBlocks.sh (shell wrapper, rename to "CodeBlocks")<br />
* http://www.algonet.se/~afb/wx/CodeBlocks.icns (Mac OS X icon, rename to "app.icns")<br />
<br />
The MacOS program will just be a shell wrapper that calls "bin/codeblocks", like above.<br />
Traditionally the bundle would include Frameworks and Resources, but we'll just avoid those<br />
here and use the regular "lib" and "share/codeblocks" instead (just as with a regular install). <br />
These temporary directories are listed in italic below, they're not really used in bundles...<br />
<br />
Setup a hierarchy like this, and copy the files from the regular build/install and the above file list to it:<br />
<br />
CodeBlocks.app<br />
CodeBlocks.app/Contents/<br />
CodeBlocks.app/Contents/Info.plist<br />
CodeBlocks.app/Contents/MacOS/<br />
CodeBlocks.app/Contents/MacOS/CodeBlocks<br />
CodeBlocks.app/Contents/Resources/<br />
CodeBlocks.app/Contents/Resources/app.icns<br />
''CodeBlocks.app/Contents/bin/''<br />
''CodeBlocks.app/Contents/lib/''<br />
''CodeBlocks.app/Contents/share/codeblocks/''<br />
<br />
The CodeBlocks application can now be moved with the Finder, and started up like a regular Mac application. (the nightly build includes a more advanced Info.plist and more icons - for also mapping all the files that the application can open, like source code and header files and such)<br />
<br />
==== Proper Application Bundling ====<br />
<br />
To avoid the shell wrapper, the binary can now be moved from "bin/codeblocks" to "MacOS/CodeBlocks". Helper files are moved from "share/codeblocks" to "Resources". The dynamic libraries are moved from "lib" to "MacOS":<br />
<br />
<pre><br />
mv bin/codeblocks MacOS/CodeBlocks<br />
rmdir bin<br />
mv lib/* MacOS/<br />
rmdir lib<br />
mv share Resources/<br />
</pre><br />
<br />
To avoid having to use a DYLD_LIBRARY_PATH, we rename the shared libraries (with the install_name_tool program) from e.g. /usr/local/lib/ to @executable_path/:<br />
<br />
<pre><br />
install_name_tool -change /usr/local/lib/libcodeblocks.0.dylib \<br />
@executable_path/libcodeblocks.0.dylib MacOS/CodeBlocks<br />
</pre><br />
<br />
The libraries can have their names changed using the -id parameter:<br />
<br />
<pre><br />
install_name_tool -id @executable_path/libcodeblocks.0.dylib MacOS/libcodeblocks.0.dylib<br />
</pre><br />
<br />
You also need to change all of the loadable bundles for the plugins:<br />
<br />
<pre><br />
for so in Resources/plugins/*.so<br />
do install_name_tool -change /usr/local/lib/libcodeblocks.0.dylib \<br />
@executable_path/libcodeblocks.0.dylib $so<br />
done<br />
</pre><br />
<br />
You can check the result, what libraries/frameworks it links to, with:<br />
<br />
<pre><br />
otool -L CodeBlocks<br />
</pre><br />
<br />
Optionally you can then repeat the process, for the wx library too...<br />
<br />
== FYI: Darwin vs. Mac OS X ==<br />
<br />
"Darwin is the UNIX technology-based foundation of Mac OS X."<br />
<br />
* http://developer.apple.com/referencelibrary/Darwin/<br />
<br />
* http://en.wikipedia.org/wiki/Darwin_(operating_system)<br />
<br />
"Pure Darwin" here refers to the Open Source version of the OS:<br />
<br />
* http://www.opensource.apple.com/darwinsource/images/<br />
<br />
(that is: Darwin using X11 instead of Aqua for the user interface)<br />
<br />
== Install with DarwinPorts ==<br />
<br />
To build and install Code::Blocks, you will need:<br />
<br />
* http://www.algonet.se/~afb/wx/codeblocks.Portfile<br />
<br />
The following need to go in the "files" directory:<br />
<br />
* http://www.algonet.se/~afb/wx/codeblocks.plist<br />
* http://www.algonet.se/~afb/wx/codeblocks.sh.in<br />
* http://www.algonet.se/~afb/wx/dos2unix.sh<br />
* http://www.algonet.se/~afb/wx/codeblocks-rev3656_pluginslib.patch<br />
* http://www.algonet.se/~afb/wx/codeblocks-wxauigtk.patch<br />
<br />
Put the Portfile in your local DarwinPorts tree (usually in <tt>~/dports</tt> - set up in <tt>/opt/local/etc/ports/sources.conf</tt>, create the directory if needed), as <tt>dports/devel/codeblocks/Portfile</tt> and download the helper files to <tt>dports/devel/codeblocks/files</tt>. (then do a chdir to <tt>dports</tt>, and run the <tt>/opt/local/bin/portindex</tt> command)<br />
<br />
You will also need these custom wxWidgets ports:<br />
<br />
* http://www.algonet.se/~afb/wx/wxMac.Portfile<br />
* http://www.algonet.se/~afb/wx/patch-polling.diff<br />
* http://www.algonet.se/~afb/wx/wxGTK.Portfile<br />
* http://www.algonet.se/~afb/wx/patch-soundsdl.diff<br />
<br />
The optional wxWidgets file go in <tt>graphics/wx{Mac,GTK}/Portfile</tt>. Normally one use the regular wxWidgets port from the DarwinPorts main, but that should in turn use wxMac on Mac OS X and wxGTK on Pure Darwin so it is all the same software. (the regular DarwinPorts version is broken now on Intel though, and it also hardcodes wxMac -see [http://trac.macosforge.org/projects/macports/ticket/10815 Ticket 10815])<br />
<br />
After that set up has been done, you can install it with:<br />
<br />
<pre><br />
sudo port install codeblocks<br />
</pre><br />
<br />
If you want the X11/GTK version on Mac OS X, instead use:<br />
<br />
<pre><br />
sudo port install codeblocks -macosx+puredarwin<br />
</pre><br />
<br />
This will download the SVN trunk, and any dependencies:<br />
<br />
<pre><br />
---> Fetching codeblocks<br />
---> Verifying checksum(s) for codeblocks<br />
---> Extracting codeblocks<br />
---> Applying patches to codeblocks<br />
---> Configuring codeblocks<br />
---> Building codeblocks with target all<br />
---> Staging codeblocks into destroot<br />
---> Packaging tgz archive for codeblocks 1.0_0+macosx<br />
---> Installing codeblocks 1.0_0+macosx<br />
---> Activating codeblocks 1.0_0+macosx<br />
---> Cleaning codeblocks<br />
</pre><br />
<br />
Note: to upgrade from SVN, you need to uninstall first:<br />
<br />
<pre><br />
sudo port uninstall codeblocks<br />
sudo port clean codeblocks<br />
sudo port install codeblocks<br />
</pre><br />
<br />
This is both because all SVN versions are numbered "0",<br />
but also due to a bug in the Code::Blocks build scripts.<br />
<br />
=== Running <tt>+macosx</tt> (wxMac) version ===<br />
<br />
After the build completes, you can start the program by:<br />
<br />
<pre><br />
open /Applications/DarwinPorts/CodeBlocks.app<br />
</pre><br />
<br />
Note that the wxMac application bundle in "DarwinPorts"<br />
is just a wrapper, with symbolic links to /opt/local...<br />
<br />
<pre><br />
/opt/local/bin/codeblocks --prefix=/opt/local<br />
</pre><br />
<br />
=== Running <tt>+puredarwin</tt> (wxGTK) version ===<br />
<br />
The non-bundled wxGTK version is instead started with:<br />
<br />
<pre><br />
/opt/local/bin/codeblocks --prefix=/opt/local<br />
</pre><br />
<br />
There is also a wxGTK startup command in "DarwinPorts",<br />
that will first start up X11.app and then launch C::B:<br />
<br />
<pre><br />
open /Applications/DarwinPorts/CodeBlocks.command<br />
</pre></div>Auriahttps://wiki.codeblocks.org/index.php?title=Installing_Code::Blocks_from_source_on_Mac_OS_X&diff=4483Installing Code::Blocks from source on Mac OS X2007-03-06T03:01:02Z<p>Auria: /* Automake example (Panther) */</p>
<hr />
<div>[[Category:Installing Code::Blocks]]<br />
[[Category:Installing Code::Blocks from source]]<br />
These are instructions on how to build Code::Blocks under Apple Mac OS X.<br />
They have been tested under Mac OS X version 10.3 and under Mac OS X 10.4<br />
(PowerPC and Intel), and might work on old Mac OS X 10.2 and 10.1 as well.<br />
<br />
We will be building everything from scratch using the source code, and<br />
not use any available package managers like<br />
[http://darwinports.opendarwin.org DarwinPorts],<br />
[http://fink.sourceforge.net/ Fink],<br />
[http://gentoo-wiki.com/Gentoo_MacOS Gentoo] or<br />
[http://rpm4darwin.sourceforge.net RPM].<br />
Packaging can be done later, once it has reached a more stable release.<br />
<br />
Update: building for DarwinPorts can be found at the end of the document.<br />
<br />
== Install Developer Tools ==<br />
<br />
If they didn't come bundled with Mac OS X, get the Xcode Tools (or Developer Tools for older Mac OS X) from:<br />
<br />
http://developer.apple.com/tools/<br />
<br />
This will install Apple versions of:<br />
<br />
* http://www.gnu.org/software/gcc/ (GNU Compilers)<br />
* http://www.gnu.org/software/gdb/ (GNU Debugger)<br />
* http://www.gnu.org/software/make/ (GNU Make)<br />
<br />
Note: 2006/04<br />
Apple pulled all the old links in order to promote Mac OS X 10.4, but all the<br />
old developer tools can be downloaded from ADC at http://connect.apple.com/<br />
<br />
You need a (free) developer registration with Apple first, in order to log in there.<br />
For Mac OS X 10.4, you want (at least) Xcode 2.2, since earlier versions were buggy.<br />
For Mac OS X 10.3, you want Xcode 1.5. For Mac OS X 10.1-10.2, the latest Dev Tools.<br />
<br />
== Check Autotools versions ==<br />
<br />
Depending on your OS version, you might need to download and compile new versions of these:<br />
<br />
* http://www.gnu.org/software/autoconf/ (GNU Autoconf)<br />
* http://www.gnu.org/software/automake/ (GNU Automake)<br />
* http://www.gnu.org/software/libtool/ (GNU Libtool)<br />
<br />
Check what you have, with <tt>--version</tt> (note that GNU libtool is called "glibtool" on Mac OS X)<br />
<br />
Currently Code::Blocks requires versions:<br />
* autoconf 2.50+<br />
* automake 1.7+<br />
* libtool 1.4+ (1.5.8+ highly recommended to get some bug fixes)<br />
<br />
=== Automake example (Panther) ===<br />
<br />
For Mac OS X 10.3, you will only need an upgraded (local) installation of automake 1.7.x.<br />
<br />
You can download "[ftp://ftp.gnu.org/gnu/automake/automake-1.7.9.tar.gz automake-1.7.9.tar.gz]" and configure and install it with something like:<br />
<br />
<pre><br />
./configure --prefix=/usr/local --program-suffix=-1.7<br />
make<br />
sudo make install<br />
sudo cp -pi /usr/share/aclocal/libtool.m4 /usr/local/share/aclocal-1.7/<br />
</pre><br />
<br />
Since it's now known as "automake-1.7", it won't interfere with the regular "automake"<br />
<br />
On Mac OS X 10.4.8, i downloaded and installed version 1.9. I configured without any options and followed the same steps otherwiseI just replaced 'automake-1.7' and 'aclocal-1.7' in the bootstrap section by 'automake-1.9' and 'aclocal-1.9' and everything worked.<br />
<br />
=== Libtool example ===<br />
Download [http://www.gnu.org/software/libtool/ libtool] source. The following instructions will overwrite your current version of libtool with the one you just downloaded.<br />
<pre><br />
cd /libtool-dir/<br />
./configure --prefix=/usr/ --program-prefix=g<br />
make<br />
sudo make install<br />
</pre><br />
<br />
== FYI: Universal Binaries ==<br />
<br />
If you are building for Mac OS X 10.4 or later, you might want to build "[http://www.apple.com/universal/ Universal Binaries ]"<br />
These are binaries that contain code for both PowerPC ("ppc" arch) and Intel ("i386" arch)<br />
<br />
The basic flags that needs to be added are:<br />
<pre><br />
CFLAGS += "-isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch i386 -arch ppc"<br />
<br />
CXXFLAGS += "-isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch i386 -arch ppc"<br />
</pre><br />
(You only need the sysroot parameter on PowerPC Macintosh, not on a Intel Macintosh)<br />
The "-arch i386 -arch ppc" is what tells the compiler to build a "universal" (or "fat") binary.<br />
<br />
Usually it's easiest to build one version for "powerpc-apple-darwin8",<br />
and one version for "i686-apple-darwin8", and then merge them with "[http://developer.apple.com/documentation/Darwin/Reference/ManPages/man1/lipo.1.html lipo]"<br />
<br />
<pre><br />
./configure --host=powerpc-apple-darwin8 --target=powerpc-apple-darwin8<br />
<br />
./configure --host=i686-apple-darwin8 --target=i686-apple-darwin8<br />
</pre><br />
<br />
Some caveats:<br />
* pre-compiled headers might fail with a "no main" error. If they do, add a -c to only compile them<br />
* when cross-compiling, tools like auto_revision might fail to build. copy these from a native build<br />
* the Tiger compilers might crash from time to time, but that is only to be expected (it seems)...<br />
<br />
See [http://developer.apple.com/technotes/tn2005/tn2137.html Technical Note TN2137]: Building Universal <br />
Binaries from "configure"-based Open Source Projects<br />
<br />
== FYI: ANSI or UNICODE ==<br />
<br />
For the moment we are using "ANSI" (--disable-unicode, default) for Mac OS X 10.3 and earlier,<br />
and "UNICODE" (--enable-unicode, optional) for Mac OS X 10.4 and later. <br />
<br />
See http://www.wxwidgets.org/manuals/2.6.3/wx_unicode.html#unicodeandansi<br />
<br />
== Build wxWidgets 2.6 ==<br />
<br />
=== Download the source code ===<br />
<br />
Download the tarball for the wxMac release:<br />
<br />
http://wxwidgets.org/downloads/#latest_stable<br />
<br />
=== Apply necessary patches ===<br />
<br />
Don't forget to apply any released patches!<br />
<br />
http://wxwidgets.org/downloads/patch.htm<br />
<br />
For Intel Macintosh, you will need this additional patch:<br />
<br />
* http://www.algonet.se/~afb/wx/wxWidgets-killpoll.patch<br />
<br />
<pre><br />
patch -p1 -i wxWidgets-killpoll.patch<br />
</pre><br />
<br />
=== Configure and (GNU) Make ===<br />
<br />
<pre><br />
mkdir mac-build<br />
cd mac-build<br />
../configure --enable-shared --enable-monolithic --with-mac --with-opengl \<br />
--with-png=builtin --with-jpeg=builtin --with-tiff=builtin --with-expat=builtin<br />
nice make<br />
</pre><br />
<br />
note: the easiest way to build a Universal Binary with wxWidgets is<br />
the new flag: --enable-universal_binary (you need wxWidgets 2.6.3+)<br />
<br />
=== Install into Destination ===<br />
<br />
<pre><br />
sudo make install<br />
</pre><br />
<br />
== Bundle library for Mac ==<br />
<br />
To avoid having the Code::Blocks user having to compile or install wxWidgets themselves,<br />
we can bundle it with our application so that it is contained in the application bundle.<br />
This could also be done by statically linking wxWidgets, but with dynamic linking we can<br />
share the wxWidgets library between all applications using wxWidgets (not just Code::Blocks)<br />
<br />
<br />
=== Way One: Library (dynamic) ===<br />
<br />
<pre><br />
/usr/local/include/wx-2.6/wx/wx.h<br />
/usr/local/lib/libwx_macu-2.6.dylib -> libwx_macu-2.6.0.dylib<br />
/usr/local/lib/libwx_macu-2.6.0.dylib -> libwx_macu-2.6.0.3.1.dylib<br />
/usr/local/lib/libwx_macu-2.6.0.3.1.dylib<br />
</pre><br />
<br />
To bundle our shared library with the application, we include it in "MacOS" and change the path:<br />
<br />
<pre><br />
install_name_tool -id @executable_path/libwx_macu-2.6.0.dylib<br />
</pre><br />
<br />
@executable_path will be replaced with e.g. /Developer/Applications/CodeBlocks.app/Contents/MacOS<br />
<br />
=== Way Two: Framework (bundle) ===<br />
<br />
<pre><br />
/Library/Frameworks/wx.framework/Headers -> Versions/Current/Headers<br />
/Library/Frameworks/wx.framework/wx -> Versions/Current/wx<br />
/Library/Frameworks/wx.framework/Versions/Current -> 2.6.3<br />
/Library/Frameworks/wx.framework/Versions/2.6.3/Headers/wx.h<br />
/Library/Frameworks/wx.framework/Versions/2.6.3/wx -> libwx_macu-2.6.0.dylib<br />
/Library/Frameworks/wx.framework/Versions/2.6.3/libwx_macu-2.6.0.dylib -> libwx_macu-2.6.0.3.1.dylib<br />
/Library/Frameworks/wx.framework/Versions/2.6.3/libwx_macu-2.6.0.3.1.dylib<br />
</pre><br />
<br />
To bundle our framework with the application, we include it in "Frameworks" and change the path:<br />
<br />
<pre><br />
install_name_tool -id @executable_path/../Frameworks/wx.framework/Versions/2.6.3/libwx_macu-2.6.0.dylib<br />
</pre><br />
<br />
This way it will first look in the framework path (-F), and then in for the shared library path (-L) as usual.<br />
<br />
== Install Subversion client ==<br />
<br />
http://subversion.tigris.org/<br />
<br />
Note: you need SVN for the Code::Blocks revision scripts to work!<br />
<br />
== Build CodeBlocks from SVN ==<br />
<br />
=== Download the source code ===<br />
<br />
https://www.codeblocks.org/source_code.shtml<br />
<br />
<pre><br />
svn checkout svn://svn.berlios.de/codeblocks/trunk<br />
cd trunk<br />
</pre><br />
<br />
=== Apply necessary patches ===<br />
<br />
For a list of necessary patches, see below under "DarwinPorts", or:<br />
<br />
http://developer.berlios.de/patch/?group_id=5358<br />
<br />
<pre><br />
patch -p0 -i codeblocks-rev3656_pluginslib.patch<br />
</pre><br />
<br />
You might need to convert the line endings from DOS to Unix first.<br />
<br />
Hopefully most of these should be merged upstream, before release:<br />
<br />
* http://developer.berlios.de/patch/?func=detailpatch&patch_id=1395&group_id=5358<br />
<br />
(when they are, the above stand-alone patches might fail to apply)<br />
<br />
=== Bootstrap with Autotools ===<br />
<br />
You need to use the newer version of automake, for the "bootstrap":<br />
<br />
<pre><br />
AUTOMAKE=automake-1.7 ACLOCAL=aclocal-1.7 ACLOCAL_FLAGS="-I /usr/share/aclocal" ./bootstrap<br />
</pre><br />
<br />
See above for how to compile and install automake-1.7 on Mac OS X.<br />
<br />
=== Configure ===<br />
<br />
<pre><br />
./configure --enable-contrib<br />
</pre><br />
<br />
Note: the easiest way to build a Universal Binary for Code::Blocks is to build once for PowerPC (-arch ppc) and once for Intel (-arch i386), and then merge them (with lipo) afterwards.<br />
<br />
<pre><br />
mkdir ppc-build<br />
cd ppc-build<br />
../configure --host=powerpc-apple-darwin8 --target=powerpc-apple-darwin8 --enable-contrib<br />
cd ..<br />
<br />
mkdir x86-build<br />
cd x86-build<br />
../configure --host=i686-apple-darwin8 --target=i686-apple-darwin8 --enable-contrib<br />
cd ..<br />
</pre><br />
<br />
Note: You need to patch the location of the pre-compiled headers, or it will generate them in the same place for both arch.<br />
<br />
=== Tiger Fix ===<br />
<br />
There is a bug in the glibtool of Mac OS X 10.4, that fails to link C++ libs:<br />
<br />
<pre><br />
ld: multiple definitions of symbol ___umoddi3<br />
/usr/lib/gcc/powerpc-apple-darwin8/4.0.1/libgcc.a(_umoddi3.o) private external definition of ___umoddi3 in section (__TEXT,__text)<br />
/usr/lib/gcc/powerpc-apple-darwin8/4.0.1/../../../libgcc_s.10.4.dylib(_umoddi3_s.o) definition of ___umoddi3<br />
<br />
ld: multiple definitions of symbol ___umoddi3<br />
/usr/lib/gcc/i686-apple-darwin8/4.0.1/libgcc.a(_umoddi3.o) private external definition of ___umoddi3 in section (__TEXT,__text)<br />
/usr/lib/gcc/i686-apple-darwin8/4.0.1/../../../libgcc_s.10.4.dylib(_umoddi3_s.o) definition of ___umoddi3<br />
</pre><br />
<br />
To work around this, you need to edit the generated "libtool" script manually:<br />
<br />
<pre><br />
177c177<br />
< whole_archive_flag_spec="-all_load \$convenience"<br />
---<br />
> whole_archive_flag_spec=""<br />
6921c6921<br />
< whole_archive_flag_spec="-all_load \$convenience"<br />
---<br />
> whole_archive_flag_spec=""<br />
</pre><br />
<br />
This bug has been fixed in GNU libtool 1.5.8 and later.<br />
<br />
=== (GNU) Make ===<br />
<br />
<pre><br />
nice make<br />
</pre><br />
<br />
For the Universal Binary build:<br />
<br />
<pre><br />
cd ppc-build<br />
nice make<br />
cd ..<br />
<br />
cd x86-build<br />
nice make<br />
cd ..<br />
</pre><br />
<br />
=== Install into Destination ===<br />
<br />
<pre><br />
sudo make install<br />
</pre><br />
<br />
For the Universal Binary build:<br />
<br />
<pre><br />
cd ppc-build<br />
make install DESTDIR=/tmp/ppc<br />
cd ..<br />
<br />
cd x86-build<br />
make install DESTDIR=/tmp/x86<br />
cd ..<br />
<br />
lipomerge /tmp/ppc /tmp/x86 /tmp/fat<br />
</pre><br />
<br />
Where "lipomerge" is a custom shell script:<br />
<br />
* http://www.algonet.se/~afb/wx/lipomerge<br />
<br />
== Bundle application for Mac ==<br />
<br />
After building codeblocks in the regular Unix way, you need to bundle it with the icons<br />
and various other info that it needs to make a regular stand-alone Macintosh application.<br />
<br />
There are two ways of accomplishing this, old Mac OS-style resource or NeXT-style bundle.<br />
The old resources are handy while developing, while bundles are more suitable for release.<br />
<br />
Note: You '''need''' to use either of these methods, or your application will launch<br />
in the background behind all other windows and will be unable to receive any events!<br />
<br />
=== Way One: Mac OS (resource) ===<br />
<br />
http://developer.apple.com/documentation/Carbon/Reference/Resource_Manager/<br />
<br />
Handy while developing, as you only need to add an icon.<br />
<br />
Files needed:<br />
* http://www.algonet.se/~afb/wx/CodeBlocks.r.gz (Rez icon, gzipped)<br />
<br />
First we install the program to the PREFIX directory of your choice:<br />
<br />
<pre><br />
$PREFIX/bin<br />
$PREFIX/lib<br />
$PREFIX/share/codeblocks<br />
</pre><br />
<br />
Add a custom icon to the application, and make it receive events:<br />
<br />
<pre><br />
gunzip CodeBlocks.r.gz<br />
sudo /Developer/Tools/Rez -d __DARWIN__ -t APPL -d __WXMAC__ \<br />
CodeBlocks.r Carbon.r -o $PREFIX/bin/codeblocks<br />
sudo /Developer/Tools/SetFile -a C $PREFIX/bin/codeblocks<br />
</pre><br />
<br />
Note: on the Intel Macintoshes, the icon comes up as "broken"<br />
(apparently it assumes that all apps with resforks are Classic)<br />
<br />
Without the icon part, this could also have be written as just:<br />
<br />
<pre><br />
sudo `wx-config --rezflags` $PREFIX/bin/codeblocks<br />
</pre><br />
<br />
Start the application with a small prefix shell wrapper like this:<br />
<br />
<pre><br />
DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:$PREFIX/lib<br />
export DYLD_LIBRARY_PATH<br />
<br />
$PREFIX/bin/codeblocks --prefix=$PREFIX<br />
</pre><br />
<br />
You don't need the "DYLD_LIBRARY_PATH" stuff,<br />
if you are installing to a system directory.<br />
<br />
==== Common PREFIX Settings ====<br />
<br />
Local: <tt>PREFIX=/usr/local</tt><br />
<br />
System: <tt>PREFIX=/usr</tt><br />
<br />
DarwinPorts: <tt>PREFIX=/opt/local</tt><br />
<br />
Fink: <tt>PREFIX=/sw</tt><br />
<br />
=== Way Two: NeXT (bundle) ===<br />
<br />
http://developer.apple.com/documentation/CoreFoundation/Conceptual/CFBundles/<br />
<br />
This does not involve resources, and is more relocatable.<br />
<br />
Files needed:<br />
* http://www.algonet.se/~afb/wx/CodeBlocks.Info.plist (rename to "Info.plist")<br />
* http://www.algonet.se/~afb/wx/CodeBlocks.sh (shell wrapper, rename to "CodeBlocks")<br />
* http://www.algonet.se/~afb/wx/CodeBlocks.icns (Mac OS X icon, rename to "app.icns")<br />
<br />
The MacOS program will just be a shell wrapper that calls "bin/codeblocks", like above.<br />
Traditionally the bundle would include Frameworks and Resources, but we'll just avoid those<br />
here and use the regular "lib" and "share/codeblocks" instead (just as with a regular install). <br />
These temporary directories are listed in italic below, they're not really used in bundles...<br />
<br />
Setup a hierarchy like this, and copy the files from the regular build/install and the above file list to it:<br />
<br />
CodeBlocks.app<br />
CodeBlocks.app/Contents/<br />
CodeBlocks.app/Contents/Info.plist<br />
CodeBlocks.app/Contents/MacOS/<br />
CodeBlocks.app/Contents/MacOS/CodeBlocks<br />
CodeBlocks.app/Contents/Resources/<br />
CodeBlocks.app/Contents/Resources/app.icns<br />
''CodeBlocks.app/Contents/bin/''<br />
''CodeBlocks.app/Contents/lib/''<br />
''CodeBlocks.app/Contents/share/codeblocks/''<br />
<br />
The CodeBlocks application can now be moved with the Finder, and started up like a regular Mac application. (the nightly build includes a more advanced Info.plist and more icons - for also mapping all the files that the application can open, like source code and header files and such)<br />
<br />
==== Proper Application Bundling ====<br />
<br />
To avoid the shell wrapper, the binary can now be moved from "bin/codeblocks" to "MacOS/CodeBlocks". Helper files are moved from "share/codeblocks" to "Resources". The dynamic libraries are moved from "lib" to "MacOS":<br />
<br />
<pre><br />
mv bin/codeblocks MacOS/CodeBlocks<br />
rmdir bin<br />
mv lib/* MacOS/<br />
rmdir lib<br />
mv share Resources/<br />
</pre><br />
<br />
To avoid having to use a DYLD_LIBRARY_PATH, we rename the shared libraries (with the install_name_tool program) from e.g. /usr/local/lib/ to @executable_path/:<br />
<br />
<pre><br />
install_name_tool -change /usr/local/lib/libcodeblocks.0.dylib \<br />
@executable_path/libcodeblocks.0.dylib MacOS/CodeBlocks<br />
</pre><br />
<br />
The libraries can have their names changed using the -id parameter:<br />
<br />
<pre><br />
install_name_tool -id @executable_path/libcodeblocks.0.dylib MacOS/libcodeblocks.0.dylib<br />
</pre><br />
<br />
You also need to change all of the loadable bundles for the plugins:<br />
<br />
<pre><br />
for so in Resources/plugins/*.so<br />
do install_name_tool -change /usr/local/lib/libcodeblocks.0.dylib \<br />
@executable_path/libcodeblocks.0.dylib $so<br />
done<br />
</pre><br />
<br />
You can check the result, what libraries/frameworks it links to, with:<br />
<br />
<pre><br />
otool -L CodeBlocks<br />
</pre><br />
<br />
Optionally you can then repeat the process, for the wx library too...<br />
<br />
== FYI: Darwin vs. Mac OS X ==<br />
<br />
"Darwin is the UNIX technology-based foundation of Mac OS X."<br />
<br />
* http://developer.apple.com/referencelibrary/Darwin/<br />
<br />
* http://en.wikipedia.org/wiki/Darwin_(operating_system)<br />
<br />
"Pure Darwin" here refers to the Open Source version of the OS:<br />
<br />
* http://www.opensource.apple.com/darwinsource/images/<br />
<br />
(that is: Darwin using X11 instead of Aqua for the user interface)<br />
<br />
== Install with DarwinPorts ==<br />
<br />
To build and install Code::Blocks, you will need:<br />
<br />
* http://www.algonet.se/~afb/wx/codeblocks.Portfile<br />
<br />
The following need to go in the "files" directory:<br />
<br />
* http://www.algonet.se/~afb/wx/codeblocks.plist<br />
* http://www.algonet.se/~afb/wx/codeblocks.sh.in<br />
* http://www.algonet.se/~afb/wx/dos2unix.sh<br />
* http://www.algonet.se/~afb/wx/codeblocks-rev3656_pluginslib.patch<br />
* http://www.algonet.se/~afb/wx/codeblocks-wxauigtk.patch<br />
<br />
Put the Portfile in your local DarwinPorts tree (usually in <tt>~/dports</tt> - set up in <tt>/opt/local/etc/ports/sources.conf</tt>, create the directory if needed), as <tt>dports/devel/codeblocks/Portfile</tt> and download the helper files to <tt>dports/devel/codeblocks/files</tt>. (then do a chdir to <tt>dports</tt>, and run the <tt>/opt/local/bin/portindex</tt> command)<br />
<br />
You will also need these custom wxWidgets ports:<br />
<br />
* http://www.algonet.se/~afb/wx/wxMac.Portfile<br />
* http://www.algonet.se/~afb/wx/patch-polling.diff<br />
* http://www.algonet.se/~afb/wx/wxGTK.Portfile<br />
* http://www.algonet.se/~afb/wx/patch-soundsdl.diff<br />
<br />
The optional wxWidgets file go in <tt>graphics/wx{Mac,GTK}/Portfile</tt>. Normally one use the regular wxWidgets port from the DarwinPorts main, but that should in turn use wxMac on Mac OS X and wxGTK on Pure Darwin so it is all the same software. (the regular DarwinPorts version is broken now on Intel though, and it also hardcodes wxMac -see [http://trac.macosforge.org/projects/macports/ticket/10815 Ticket 10815])<br />
<br />
After that set up has been done, you can install it with:<br />
<br />
<pre><br />
sudo port install codeblocks<br />
</pre><br />
<br />
If you want the X11/GTK version on Mac OS X, instead use:<br />
<br />
<pre><br />
sudo port install codeblocks -macosx+puredarwin<br />
</pre><br />
<br />
This will download the SVN trunk, and any dependencies:<br />
<br />
<pre><br />
---> Fetching codeblocks<br />
---> Verifying checksum(s) for codeblocks<br />
---> Extracting codeblocks<br />
---> Applying patches to codeblocks<br />
---> Configuring codeblocks<br />
---> Building codeblocks with target all<br />
---> Staging codeblocks into destroot<br />
---> Packaging tgz archive for codeblocks 1.0_0+macosx<br />
---> Installing codeblocks 1.0_0+macosx<br />
---> Activating codeblocks 1.0_0+macosx<br />
---> Cleaning codeblocks<br />
</pre><br />
<br />
Note: to upgrade from SVN, you need to uninstall first:<br />
<br />
<pre><br />
sudo port uninstall codeblocks<br />
sudo port clean codeblocks<br />
sudo port install codeblocks<br />
</pre><br />
<br />
This is both because all SVN versions are numbered "0",<br />
but also due to a bug in the Code::Blocks build scripts.<br />
<br />
=== Running <tt>+macosx</tt> (wxMac) version ===<br />
<br />
After the build completes, you can start the program by:<br />
<br />
<pre><br />
open /Applications/DarwinPorts/CodeBlocks.app<br />
</pre><br />
<br />
Note that the wxMac application bundle in "DarwinPorts"<br />
is just a wrapper, with symbolic links to /opt/local...<br />
<br />
<pre><br />
/opt/local/bin/codeblocks --prefix=/opt/local<br />
</pre><br />
<br />
=== Running <tt>+puredarwin</tt> (wxGTK) version ===<br />
<br />
The non-bundled wxGTK version is instead started with:<br />
<br />
<pre><br />
/opt/local/bin/codeblocks --prefix=/opt/local<br />
</pre><br />
<br />
There is also a wxGTK startup command in "DarwinPorts",<br />
that will first start up X11.app and then launch C::B:<br />
<br />
<pre><br />
open /Applications/DarwinPorts/CodeBlocks.command<br />
</pre></div>Auriahttps://wiki.codeblocks.org/index.php?title=Installing_Code::Blocks_from_source_on_Mac_OS_X&diff=4482Installing Code::Blocks from source on Mac OS X2007-03-06T02:58:45Z<p>Auria: /* Libtool example */</p>
<hr />
<div>[[Category:Installing Code::Blocks]]<br />
[[Category:Installing Code::Blocks from source]]<br />
These are instructions on how to build Code::Blocks under Apple Mac OS X.<br />
They have been tested under Mac OS X version 10.3 and under Mac OS X 10.4<br />
(PowerPC and Intel), and might work on old Mac OS X 10.2 and 10.1 as well.<br />
<br />
We will be building everything from scratch using the source code, and<br />
not use any available package managers like<br />
[http://darwinports.opendarwin.org DarwinPorts],<br />
[http://fink.sourceforge.net/ Fink],<br />
[http://gentoo-wiki.com/Gentoo_MacOS Gentoo] or<br />
[http://rpm4darwin.sourceforge.net RPM].<br />
Packaging can be done later, once it has reached a more stable release.<br />
<br />
Update: building for DarwinPorts can be found at the end of the document.<br />
<br />
== Install Developer Tools ==<br />
<br />
If they didn't come bundled with Mac OS X, get the Xcode Tools (or Developer Tools for older Mac OS X) from:<br />
<br />
http://developer.apple.com/tools/<br />
<br />
This will install Apple versions of:<br />
<br />
* http://www.gnu.org/software/gcc/ (GNU Compilers)<br />
* http://www.gnu.org/software/gdb/ (GNU Debugger)<br />
* http://www.gnu.org/software/make/ (GNU Make)<br />
<br />
Note: 2006/04<br />
Apple pulled all the old links in order to promote Mac OS X 10.4, but all the<br />
old developer tools can be downloaded from ADC at http://connect.apple.com/<br />
<br />
You need a (free) developer registration with Apple first, in order to log in there.<br />
For Mac OS X 10.4, you want (at least) Xcode 2.2, since earlier versions were buggy.<br />
For Mac OS X 10.3, you want Xcode 1.5. For Mac OS X 10.1-10.2, the latest Dev Tools.<br />
<br />
== Check Autotools versions ==<br />
<br />
Depending on your OS version, you might need to download and compile new versions of these:<br />
<br />
* http://www.gnu.org/software/autoconf/ (GNU Autoconf)<br />
* http://www.gnu.org/software/automake/ (GNU Automake)<br />
* http://www.gnu.org/software/libtool/ (GNU Libtool)<br />
<br />
Check what you have, with <tt>--version</tt> (note that GNU libtool is called "glibtool" on Mac OS X)<br />
<br />
Currently Code::Blocks requires versions:<br />
* autoconf 2.50+<br />
* automake 1.7+<br />
* libtool 1.4+ (1.5.8+ highly recommended to get some bug fixes)<br />
<br />
=== Automake example (Panther) ===<br />
<br />
For Mac OS X 10.3, you will only need an upgraded (local) installation of automake 1.7.x.<br />
<br />
You can download "[ftp://ftp.gnu.org/gnu/automake/automake-1.7.9.tar.gz automake-1.7.9.tar.gz]" and configure and install it with something like:<br />
<br />
<pre><br />
./configure --prefix=/usr/local --program-suffix=-1.7<br />
make<br />
sudo make install<br />
sudo cp -pi /usr/share/aclocal/libtool.m4 /usr/local/share/aclocal-1.7/<br />
</pre><br />
<br />
Since it's now known as "automake-1.7", it won't interfere with the regular "automake"<br />
<br />
=== Libtool example ===<br />
Download [http://www.gnu.org/software/libtool/ libtool] source. The following instructions will overwrite your current version of libtool with the one you just downloaded.<br />
<pre><br />
cd /libtool-dir/<br />
./configure --prefix=/usr/ --program-prefix=g<br />
make<br />
sudo make install<br />
</pre><br />
<br />
== FYI: Universal Binaries ==<br />
<br />
If you are building for Mac OS X 10.4 or later, you might want to build "[http://www.apple.com/universal/ Universal Binaries ]"<br />
These are binaries that contain code for both PowerPC ("ppc" arch) and Intel ("i386" arch)<br />
<br />
The basic flags that needs to be added are:<br />
<pre><br />
CFLAGS += "-isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch i386 -arch ppc"<br />
<br />
CXXFLAGS += "-isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch i386 -arch ppc"<br />
</pre><br />
(You only need the sysroot parameter on PowerPC Macintosh, not on a Intel Macintosh)<br />
The "-arch i386 -arch ppc" is what tells the compiler to build a "universal" (or "fat") binary.<br />
<br />
Usually it's easiest to build one version for "powerpc-apple-darwin8",<br />
and one version for "i686-apple-darwin8", and then merge them with "[http://developer.apple.com/documentation/Darwin/Reference/ManPages/man1/lipo.1.html lipo]"<br />
<br />
<pre><br />
./configure --host=powerpc-apple-darwin8 --target=powerpc-apple-darwin8<br />
<br />
./configure --host=i686-apple-darwin8 --target=i686-apple-darwin8<br />
</pre><br />
<br />
Some caveats:<br />
* pre-compiled headers might fail with a "no main" error. If they do, add a -c to only compile them<br />
* when cross-compiling, tools like auto_revision might fail to build. copy these from a native build<br />
* the Tiger compilers might crash from time to time, but that is only to be expected (it seems)...<br />
<br />
See [http://developer.apple.com/technotes/tn2005/tn2137.html Technical Note TN2137]: Building Universal <br />
Binaries from "configure"-based Open Source Projects<br />
<br />
== FYI: ANSI or UNICODE ==<br />
<br />
For the moment we are using "ANSI" (--disable-unicode, default) for Mac OS X 10.3 and earlier,<br />
and "UNICODE" (--enable-unicode, optional) for Mac OS X 10.4 and later. <br />
<br />
See http://www.wxwidgets.org/manuals/2.6.3/wx_unicode.html#unicodeandansi<br />
<br />
== Build wxWidgets 2.6 ==<br />
<br />
=== Download the source code ===<br />
<br />
Download the tarball for the wxMac release:<br />
<br />
http://wxwidgets.org/downloads/#latest_stable<br />
<br />
=== Apply necessary patches ===<br />
<br />
Don't forget to apply any released patches!<br />
<br />
http://wxwidgets.org/downloads/patch.htm<br />
<br />
For Intel Macintosh, you will need this additional patch:<br />
<br />
* http://www.algonet.se/~afb/wx/wxWidgets-killpoll.patch<br />
<br />
<pre><br />
patch -p1 -i wxWidgets-killpoll.patch<br />
</pre><br />
<br />
=== Configure and (GNU) Make ===<br />
<br />
<pre><br />
mkdir mac-build<br />
cd mac-build<br />
../configure --enable-shared --enable-monolithic --with-mac --with-opengl \<br />
--with-png=builtin --with-jpeg=builtin --with-tiff=builtin --with-expat=builtin<br />
nice make<br />
</pre><br />
<br />
note: the easiest way to build a Universal Binary with wxWidgets is<br />
the new flag: --enable-universal_binary (you need wxWidgets 2.6.3+)<br />
<br />
=== Install into Destination ===<br />
<br />
<pre><br />
sudo make install<br />
</pre><br />
<br />
== Bundle library for Mac ==<br />
<br />
To avoid having the Code::Blocks user having to compile or install wxWidgets themselves,<br />
we can bundle it with our application so that it is contained in the application bundle.<br />
This could also be done by statically linking wxWidgets, but with dynamic linking we can<br />
share the wxWidgets library between all applications using wxWidgets (not just Code::Blocks)<br />
<br />
<br />
=== Way One: Library (dynamic) ===<br />
<br />
<pre><br />
/usr/local/include/wx-2.6/wx/wx.h<br />
/usr/local/lib/libwx_macu-2.6.dylib -> libwx_macu-2.6.0.dylib<br />
/usr/local/lib/libwx_macu-2.6.0.dylib -> libwx_macu-2.6.0.3.1.dylib<br />
/usr/local/lib/libwx_macu-2.6.0.3.1.dylib<br />
</pre><br />
<br />
To bundle our shared library with the application, we include it in "MacOS" and change the path:<br />
<br />
<pre><br />
install_name_tool -id @executable_path/libwx_macu-2.6.0.dylib<br />
</pre><br />
<br />
@executable_path will be replaced with e.g. /Developer/Applications/CodeBlocks.app/Contents/MacOS<br />
<br />
=== Way Two: Framework (bundle) ===<br />
<br />
<pre><br />
/Library/Frameworks/wx.framework/Headers -> Versions/Current/Headers<br />
/Library/Frameworks/wx.framework/wx -> Versions/Current/wx<br />
/Library/Frameworks/wx.framework/Versions/Current -> 2.6.3<br />
/Library/Frameworks/wx.framework/Versions/2.6.3/Headers/wx.h<br />
/Library/Frameworks/wx.framework/Versions/2.6.3/wx -> libwx_macu-2.6.0.dylib<br />
/Library/Frameworks/wx.framework/Versions/2.6.3/libwx_macu-2.6.0.dylib -> libwx_macu-2.6.0.3.1.dylib<br />
/Library/Frameworks/wx.framework/Versions/2.6.3/libwx_macu-2.6.0.3.1.dylib<br />
</pre><br />
<br />
To bundle our framework with the application, we include it in "Frameworks" and change the path:<br />
<br />
<pre><br />
install_name_tool -id @executable_path/../Frameworks/wx.framework/Versions/2.6.3/libwx_macu-2.6.0.dylib<br />
</pre><br />
<br />
This way it will first look in the framework path (-F), and then in for the shared library path (-L) as usual.<br />
<br />
== Install Subversion client ==<br />
<br />
http://subversion.tigris.org/<br />
<br />
Note: you need SVN for the Code::Blocks revision scripts to work!<br />
<br />
== Build CodeBlocks from SVN ==<br />
<br />
=== Download the source code ===<br />
<br />
https://www.codeblocks.org/source_code.shtml<br />
<br />
<pre><br />
svn checkout svn://svn.berlios.de/codeblocks/trunk<br />
cd trunk<br />
</pre><br />
<br />
=== Apply necessary patches ===<br />
<br />
For a list of necessary patches, see below under "DarwinPorts", or:<br />
<br />
http://developer.berlios.de/patch/?group_id=5358<br />
<br />
<pre><br />
patch -p0 -i codeblocks-rev3656_pluginslib.patch<br />
</pre><br />
<br />
You might need to convert the line endings from DOS to Unix first.<br />
<br />
Hopefully most of these should be merged upstream, before release:<br />
<br />
* http://developer.berlios.de/patch/?func=detailpatch&patch_id=1395&group_id=5358<br />
<br />
(when they are, the above stand-alone patches might fail to apply)<br />
<br />
=== Bootstrap with Autotools ===<br />
<br />
You need to use the newer version of automake, for the "bootstrap":<br />
<br />
<pre><br />
AUTOMAKE=automake-1.7 ACLOCAL=aclocal-1.7 ACLOCAL_FLAGS="-I /usr/share/aclocal" ./bootstrap<br />
</pre><br />
<br />
See above for how to compile and install automake-1.7 on Mac OS X.<br />
<br />
=== Configure ===<br />
<br />
<pre><br />
./configure --enable-contrib<br />
</pre><br />
<br />
Note: the easiest way to build a Universal Binary for Code::Blocks is to build once for PowerPC (-arch ppc) and once for Intel (-arch i386), and then merge them (with lipo) afterwards.<br />
<br />
<pre><br />
mkdir ppc-build<br />
cd ppc-build<br />
../configure --host=powerpc-apple-darwin8 --target=powerpc-apple-darwin8 --enable-contrib<br />
cd ..<br />
<br />
mkdir x86-build<br />
cd x86-build<br />
../configure --host=i686-apple-darwin8 --target=i686-apple-darwin8 --enable-contrib<br />
cd ..<br />
</pre><br />
<br />
Note: You need to patch the location of the pre-compiled headers, or it will generate them in the same place for both arch.<br />
<br />
=== Tiger Fix ===<br />
<br />
There is a bug in the glibtool of Mac OS X 10.4, that fails to link C++ libs:<br />
<br />
<pre><br />
ld: multiple definitions of symbol ___umoddi3<br />
/usr/lib/gcc/powerpc-apple-darwin8/4.0.1/libgcc.a(_umoddi3.o) private external definition of ___umoddi3 in section (__TEXT,__text)<br />
/usr/lib/gcc/powerpc-apple-darwin8/4.0.1/../../../libgcc_s.10.4.dylib(_umoddi3_s.o) definition of ___umoddi3<br />
<br />
ld: multiple definitions of symbol ___umoddi3<br />
/usr/lib/gcc/i686-apple-darwin8/4.0.1/libgcc.a(_umoddi3.o) private external definition of ___umoddi3 in section (__TEXT,__text)<br />
/usr/lib/gcc/i686-apple-darwin8/4.0.1/../../../libgcc_s.10.4.dylib(_umoddi3_s.o) definition of ___umoddi3<br />
</pre><br />
<br />
To work around this, you need to edit the generated "libtool" script manually:<br />
<br />
<pre><br />
177c177<br />
< whole_archive_flag_spec="-all_load \$convenience"<br />
---<br />
> whole_archive_flag_spec=""<br />
6921c6921<br />
< whole_archive_flag_spec="-all_load \$convenience"<br />
---<br />
> whole_archive_flag_spec=""<br />
</pre><br />
<br />
This bug has been fixed in GNU libtool 1.5.8 and later.<br />
<br />
=== (GNU) Make ===<br />
<br />
<pre><br />
nice make<br />
</pre><br />
<br />
For the Universal Binary build:<br />
<br />
<pre><br />
cd ppc-build<br />
nice make<br />
cd ..<br />
<br />
cd x86-build<br />
nice make<br />
cd ..<br />
</pre><br />
<br />
=== Install into Destination ===<br />
<br />
<pre><br />
sudo make install<br />
</pre><br />
<br />
For the Universal Binary build:<br />
<br />
<pre><br />
cd ppc-build<br />
make install DESTDIR=/tmp/ppc<br />
cd ..<br />
<br />
cd x86-build<br />
make install DESTDIR=/tmp/x86<br />
cd ..<br />
<br />
lipomerge /tmp/ppc /tmp/x86 /tmp/fat<br />
</pre><br />
<br />
Where "lipomerge" is a custom shell script:<br />
<br />
* http://www.algonet.se/~afb/wx/lipomerge<br />
<br />
== Bundle application for Mac ==<br />
<br />
After building codeblocks in the regular Unix way, you need to bundle it with the icons<br />
and various other info that it needs to make a regular stand-alone Macintosh application.<br />
<br />
There are two ways of accomplishing this, old Mac OS-style resource or NeXT-style bundle.<br />
The old resources are handy while developing, while bundles are more suitable for release.<br />
<br />
Note: You '''need''' to use either of these methods, or your application will launch<br />
in the background behind all other windows and will be unable to receive any events!<br />
<br />
=== Way One: Mac OS (resource) ===<br />
<br />
http://developer.apple.com/documentation/Carbon/Reference/Resource_Manager/<br />
<br />
Handy while developing, as you only need to add an icon.<br />
<br />
Files needed:<br />
* http://www.algonet.se/~afb/wx/CodeBlocks.r.gz (Rez icon, gzipped)<br />
<br />
First we install the program to the PREFIX directory of your choice:<br />
<br />
<pre><br />
$PREFIX/bin<br />
$PREFIX/lib<br />
$PREFIX/share/codeblocks<br />
</pre><br />
<br />
Add a custom icon to the application, and make it receive events:<br />
<br />
<pre><br />
gunzip CodeBlocks.r.gz<br />
sudo /Developer/Tools/Rez -d __DARWIN__ -t APPL -d __WXMAC__ \<br />
CodeBlocks.r Carbon.r -o $PREFIX/bin/codeblocks<br />
sudo /Developer/Tools/SetFile -a C $PREFIX/bin/codeblocks<br />
</pre><br />
<br />
Note: on the Intel Macintoshes, the icon comes up as "broken"<br />
(apparently it assumes that all apps with resforks are Classic)<br />
<br />
Without the icon part, this could also have be written as just:<br />
<br />
<pre><br />
sudo `wx-config --rezflags` $PREFIX/bin/codeblocks<br />
</pre><br />
<br />
Start the application with a small prefix shell wrapper like this:<br />
<br />
<pre><br />
DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:$PREFIX/lib<br />
export DYLD_LIBRARY_PATH<br />
<br />
$PREFIX/bin/codeblocks --prefix=$PREFIX<br />
</pre><br />
<br />
You don't need the "DYLD_LIBRARY_PATH" stuff,<br />
if you are installing to a system directory.<br />
<br />
==== Common PREFIX Settings ====<br />
<br />
Local: <tt>PREFIX=/usr/local</tt><br />
<br />
System: <tt>PREFIX=/usr</tt><br />
<br />
DarwinPorts: <tt>PREFIX=/opt/local</tt><br />
<br />
Fink: <tt>PREFIX=/sw</tt><br />
<br />
=== Way Two: NeXT (bundle) ===<br />
<br />
http://developer.apple.com/documentation/CoreFoundation/Conceptual/CFBundles/<br />
<br />
This does not involve resources, and is more relocatable.<br />
<br />
Files needed:<br />
* http://www.algonet.se/~afb/wx/CodeBlocks.Info.plist (rename to "Info.plist")<br />
* http://www.algonet.se/~afb/wx/CodeBlocks.sh (shell wrapper, rename to "CodeBlocks")<br />
* http://www.algonet.se/~afb/wx/CodeBlocks.icns (Mac OS X icon, rename to "app.icns")<br />
<br />
The MacOS program will just be a shell wrapper that calls "bin/codeblocks", like above.<br />
Traditionally the bundle would include Frameworks and Resources, but we'll just avoid those<br />
here and use the regular "lib" and "share/codeblocks" instead (just as with a regular install). <br />
These temporary directories are listed in italic below, they're not really used in bundles...<br />
<br />
Setup a hierarchy like this, and copy the files from the regular build/install and the above file list to it:<br />
<br />
CodeBlocks.app<br />
CodeBlocks.app/Contents/<br />
CodeBlocks.app/Contents/Info.plist<br />
CodeBlocks.app/Contents/MacOS/<br />
CodeBlocks.app/Contents/MacOS/CodeBlocks<br />
CodeBlocks.app/Contents/Resources/<br />
CodeBlocks.app/Contents/Resources/app.icns<br />
''CodeBlocks.app/Contents/bin/''<br />
''CodeBlocks.app/Contents/lib/''<br />
''CodeBlocks.app/Contents/share/codeblocks/''<br />
<br />
The CodeBlocks application can now be moved with the Finder, and started up like a regular Mac application. (the nightly build includes a more advanced Info.plist and more icons - for also mapping all the files that the application can open, like source code and header files and such)<br />
<br />
==== Proper Application Bundling ====<br />
<br />
To avoid the shell wrapper, the binary can now be moved from "bin/codeblocks" to "MacOS/CodeBlocks". Helper files are moved from "share/codeblocks" to "Resources". The dynamic libraries are moved from "lib" to "MacOS":<br />
<br />
<pre><br />
mv bin/codeblocks MacOS/CodeBlocks<br />
rmdir bin<br />
mv lib/* MacOS/<br />
rmdir lib<br />
mv share Resources/<br />
</pre><br />
<br />
To avoid having to use a DYLD_LIBRARY_PATH, we rename the shared libraries (with the install_name_tool program) from e.g. /usr/local/lib/ to @executable_path/:<br />
<br />
<pre><br />
install_name_tool -change /usr/local/lib/libcodeblocks.0.dylib \<br />
@executable_path/libcodeblocks.0.dylib MacOS/CodeBlocks<br />
</pre><br />
<br />
The libraries can have their names changed using the -id parameter:<br />
<br />
<pre><br />
install_name_tool -id @executable_path/libcodeblocks.0.dylib MacOS/libcodeblocks.0.dylib<br />
</pre><br />
<br />
You also need to change all of the loadable bundles for the plugins:<br />
<br />
<pre><br />
for so in Resources/plugins/*.so<br />
do install_name_tool -change /usr/local/lib/libcodeblocks.0.dylib \<br />
@executable_path/libcodeblocks.0.dylib $so<br />
done<br />
</pre><br />
<br />
You can check the result, what libraries/frameworks it links to, with:<br />
<br />
<pre><br />
otool -L CodeBlocks<br />
</pre><br />
<br />
Optionally you can then repeat the process, for the wx library too...<br />
<br />
== FYI: Darwin vs. Mac OS X ==<br />
<br />
"Darwin is the UNIX technology-based foundation of Mac OS X."<br />
<br />
* http://developer.apple.com/referencelibrary/Darwin/<br />
<br />
* http://en.wikipedia.org/wiki/Darwin_(operating_system)<br />
<br />
"Pure Darwin" here refers to the Open Source version of the OS:<br />
<br />
* http://www.opensource.apple.com/darwinsource/images/<br />
<br />
(that is: Darwin using X11 instead of Aqua for the user interface)<br />
<br />
== Install with DarwinPorts ==<br />
<br />
To build and install Code::Blocks, you will need:<br />
<br />
* http://www.algonet.se/~afb/wx/codeblocks.Portfile<br />
<br />
The following need to go in the "files" directory:<br />
<br />
* http://www.algonet.se/~afb/wx/codeblocks.plist<br />
* http://www.algonet.se/~afb/wx/codeblocks.sh.in<br />
* http://www.algonet.se/~afb/wx/dos2unix.sh<br />
* http://www.algonet.se/~afb/wx/codeblocks-rev3656_pluginslib.patch<br />
* http://www.algonet.se/~afb/wx/codeblocks-wxauigtk.patch<br />
<br />
Put the Portfile in your local DarwinPorts tree (usually in <tt>~/dports</tt> - set up in <tt>/opt/local/etc/ports/sources.conf</tt>, create the directory if needed), as <tt>dports/devel/codeblocks/Portfile</tt> and download the helper files to <tt>dports/devel/codeblocks/files</tt>. (then do a chdir to <tt>dports</tt>, and run the <tt>/opt/local/bin/portindex</tt> command)<br />
<br />
You will also need these custom wxWidgets ports:<br />
<br />
* http://www.algonet.se/~afb/wx/wxMac.Portfile<br />
* http://www.algonet.se/~afb/wx/patch-polling.diff<br />
* http://www.algonet.se/~afb/wx/wxGTK.Portfile<br />
* http://www.algonet.se/~afb/wx/patch-soundsdl.diff<br />
<br />
The optional wxWidgets file go in <tt>graphics/wx{Mac,GTK}/Portfile</tt>. Normally one use the regular wxWidgets port from the DarwinPorts main, but that should in turn use wxMac on Mac OS X and wxGTK on Pure Darwin so it is all the same software. (the regular DarwinPorts version is broken now on Intel though, and it also hardcodes wxMac -see [http://trac.macosforge.org/projects/macports/ticket/10815 Ticket 10815])<br />
<br />
After that set up has been done, you can install it with:<br />
<br />
<pre><br />
sudo port install codeblocks<br />
</pre><br />
<br />
If you want the X11/GTK version on Mac OS X, instead use:<br />
<br />
<pre><br />
sudo port install codeblocks -macosx+puredarwin<br />
</pre><br />
<br />
This will download the SVN trunk, and any dependencies:<br />
<br />
<pre><br />
---> Fetching codeblocks<br />
---> Verifying checksum(s) for codeblocks<br />
---> Extracting codeblocks<br />
---> Applying patches to codeblocks<br />
---> Configuring codeblocks<br />
---> Building codeblocks with target all<br />
---> Staging codeblocks into destroot<br />
---> Packaging tgz archive for codeblocks 1.0_0+macosx<br />
---> Installing codeblocks 1.0_0+macosx<br />
---> Activating codeblocks 1.0_0+macosx<br />
---> Cleaning codeblocks<br />
</pre><br />
<br />
Note: to upgrade from SVN, you need to uninstall first:<br />
<br />
<pre><br />
sudo port uninstall codeblocks<br />
sudo port clean codeblocks<br />
sudo port install codeblocks<br />
</pre><br />
<br />
This is both because all SVN versions are numbered "0",<br />
but also due to a bug in the Code::Blocks build scripts.<br />
<br />
=== Running <tt>+macosx</tt> (wxMac) version ===<br />
<br />
After the build completes, you can start the program by:<br />
<br />
<pre><br />
open /Applications/DarwinPorts/CodeBlocks.app<br />
</pre><br />
<br />
Note that the wxMac application bundle in "DarwinPorts"<br />
is just a wrapper, with symbolic links to /opt/local...<br />
<br />
<pre><br />
/opt/local/bin/codeblocks --prefix=/opt/local<br />
</pre><br />
<br />
=== Running <tt>+puredarwin</tt> (wxGTK) version ===<br />
<br />
The non-bundled wxGTK version is instead started with:<br />
<br />
<pre><br />
/opt/local/bin/codeblocks --prefix=/opt/local<br />
</pre><br />
<br />
There is also a wxGTK startup command in "DarwinPorts",<br />
that will first start up X11.app and then launch C::B:<br />
<br />
<pre><br />
open /Applications/DarwinPorts/CodeBlocks.command<br />
</pre></div>Auriahttps://wiki.codeblocks.org/index.php?title=Installing_Code::Blocks_from_source_on_Mac_OS_X&diff=4481Installing Code::Blocks from source on Mac OS X2007-03-06T02:57:58Z<p>Auria: /* Check Autotools versions */</p>
<hr />
<div>[[Category:Installing Code::Blocks]]<br />
[[Category:Installing Code::Blocks from source]]<br />
These are instructions on how to build Code::Blocks under Apple Mac OS X.<br />
They have been tested under Mac OS X version 10.3 and under Mac OS X 10.4<br />
(PowerPC and Intel), and might work on old Mac OS X 10.2 and 10.1 as well.<br />
<br />
We will be building everything from scratch using the source code, and<br />
not use any available package managers like<br />
[http://darwinports.opendarwin.org DarwinPorts],<br />
[http://fink.sourceforge.net/ Fink],<br />
[http://gentoo-wiki.com/Gentoo_MacOS Gentoo] or<br />
[http://rpm4darwin.sourceforge.net RPM].<br />
Packaging can be done later, once it has reached a more stable release.<br />
<br />
Update: building for DarwinPorts can be found at the end of the document.<br />
<br />
== Install Developer Tools ==<br />
<br />
If they didn't come bundled with Mac OS X, get the Xcode Tools (or Developer Tools for older Mac OS X) from:<br />
<br />
http://developer.apple.com/tools/<br />
<br />
This will install Apple versions of:<br />
<br />
* http://www.gnu.org/software/gcc/ (GNU Compilers)<br />
* http://www.gnu.org/software/gdb/ (GNU Debugger)<br />
* http://www.gnu.org/software/make/ (GNU Make)<br />
<br />
Note: 2006/04<br />
Apple pulled all the old links in order to promote Mac OS X 10.4, but all the<br />
old developer tools can be downloaded from ADC at http://connect.apple.com/<br />
<br />
You need a (free) developer registration with Apple first, in order to log in there.<br />
For Mac OS X 10.4, you want (at least) Xcode 2.2, since earlier versions were buggy.<br />
For Mac OS X 10.3, you want Xcode 1.5. For Mac OS X 10.1-10.2, the latest Dev Tools.<br />
<br />
== Check Autotools versions ==<br />
<br />
Depending on your OS version, you might need to download and compile new versions of these:<br />
<br />
* http://www.gnu.org/software/autoconf/ (GNU Autoconf)<br />
* http://www.gnu.org/software/automake/ (GNU Automake)<br />
* http://www.gnu.org/software/libtool/ (GNU Libtool)<br />
<br />
Check what you have, with <tt>--version</tt> (note that GNU libtool is called "glibtool" on Mac OS X)<br />
<br />
Currently Code::Blocks requires versions:<br />
* autoconf 2.50+<br />
* automake 1.7+<br />
* libtool 1.4+ (1.5.8+ highly recommended to get some bug fixes)<br />
<br />
=== Automake example (Panther) ===<br />
<br />
For Mac OS X 10.3, you will only need an upgraded (local) installation of automake 1.7.x.<br />
<br />
You can download "[ftp://ftp.gnu.org/gnu/automake/automake-1.7.9.tar.gz automake-1.7.9.tar.gz]" and configure and install it with something like:<br />
<br />
<pre><br />
./configure --prefix=/usr/local --program-suffix=-1.7<br />
make<br />
sudo make install<br />
sudo cp -pi /usr/share/aclocal/libtool.m4 /usr/local/share/aclocal-1.7/<br />
</pre><br />
<br />
Since it's now known as "automake-1.7", it won't interfere with the regular "automake"<br />
<br />
=== Libtool example ===<br />
Download [http://www.gnu.org/software/libtool/ libtool] source. The following instructions will overwrite the current version off libtool with the one you just downloaded.<br />
<pre><br />
cd /libtool-dir/<br />
./configure --prefix=/usr/ --program-prefix=g<br />
make<br />
sudo make install<br />
</pre><br />
<br />
== FYI: Universal Binaries ==<br />
<br />
If you are building for Mac OS X 10.4 or later, you might want to build "[http://www.apple.com/universal/ Universal Binaries ]"<br />
These are binaries that contain code for both PowerPC ("ppc" arch) and Intel ("i386" arch)<br />
<br />
The basic flags that needs to be added are:<br />
<pre><br />
CFLAGS += "-isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch i386 -arch ppc"<br />
<br />
CXXFLAGS += "-isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch i386 -arch ppc"<br />
</pre><br />
(You only need the sysroot parameter on PowerPC Macintosh, not on a Intel Macintosh)<br />
The "-arch i386 -arch ppc" is what tells the compiler to build a "universal" (or "fat") binary.<br />
<br />
Usually it's easiest to build one version for "powerpc-apple-darwin8",<br />
and one version for "i686-apple-darwin8", and then merge them with "[http://developer.apple.com/documentation/Darwin/Reference/ManPages/man1/lipo.1.html lipo]"<br />
<br />
<pre><br />
./configure --host=powerpc-apple-darwin8 --target=powerpc-apple-darwin8<br />
<br />
./configure --host=i686-apple-darwin8 --target=i686-apple-darwin8<br />
</pre><br />
<br />
Some caveats:<br />
* pre-compiled headers might fail with a "no main" error. If they do, add a -c to only compile them<br />
* when cross-compiling, tools like auto_revision might fail to build. copy these from a native build<br />
* the Tiger compilers might crash from time to time, but that is only to be expected (it seems)...<br />
<br />
See [http://developer.apple.com/technotes/tn2005/tn2137.html Technical Note TN2137]: Building Universal <br />
Binaries from "configure"-based Open Source Projects<br />
<br />
== FYI: ANSI or UNICODE ==<br />
<br />
For the moment we are using "ANSI" (--disable-unicode, default) for Mac OS X 10.3 and earlier,<br />
and "UNICODE" (--enable-unicode, optional) for Mac OS X 10.4 and later. <br />
<br />
See http://www.wxwidgets.org/manuals/2.6.3/wx_unicode.html#unicodeandansi<br />
<br />
== Build wxWidgets 2.6 ==<br />
<br />
=== Download the source code ===<br />
<br />
Download the tarball for the wxMac release:<br />
<br />
http://wxwidgets.org/downloads/#latest_stable<br />
<br />
=== Apply necessary patches ===<br />
<br />
Don't forget to apply any released patches!<br />
<br />
http://wxwidgets.org/downloads/patch.htm<br />
<br />
For Intel Macintosh, you will need this additional patch:<br />
<br />
* http://www.algonet.se/~afb/wx/wxWidgets-killpoll.patch<br />
<br />
<pre><br />
patch -p1 -i wxWidgets-killpoll.patch<br />
</pre><br />
<br />
=== Configure and (GNU) Make ===<br />
<br />
<pre><br />
mkdir mac-build<br />
cd mac-build<br />
../configure --enable-shared --enable-monolithic --with-mac --with-opengl \<br />
--with-png=builtin --with-jpeg=builtin --with-tiff=builtin --with-expat=builtin<br />
nice make<br />
</pre><br />
<br />
note: the easiest way to build a Universal Binary with wxWidgets is<br />
the new flag: --enable-universal_binary (you need wxWidgets 2.6.3+)<br />
<br />
=== Install into Destination ===<br />
<br />
<pre><br />
sudo make install<br />
</pre><br />
<br />
== Bundle library for Mac ==<br />
<br />
To avoid having the Code::Blocks user having to compile or install wxWidgets themselves,<br />
we can bundle it with our application so that it is contained in the application bundle.<br />
This could also be done by statically linking wxWidgets, but with dynamic linking we can<br />
share the wxWidgets library between all applications using wxWidgets (not just Code::Blocks)<br />
<br />
<br />
=== Way One: Library (dynamic) ===<br />
<br />
<pre><br />
/usr/local/include/wx-2.6/wx/wx.h<br />
/usr/local/lib/libwx_macu-2.6.dylib -> libwx_macu-2.6.0.dylib<br />
/usr/local/lib/libwx_macu-2.6.0.dylib -> libwx_macu-2.6.0.3.1.dylib<br />
/usr/local/lib/libwx_macu-2.6.0.3.1.dylib<br />
</pre><br />
<br />
To bundle our shared library with the application, we include it in "MacOS" and change the path:<br />
<br />
<pre><br />
install_name_tool -id @executable_path/libwx_macu-2.6.0.dylib<br />
</pre><br />
<br />
@executable_path will be replaced with e.g. /Developer/Applications/CodeBlocks.app/Contents/MacOS<br />
<br />
=== Way Two: Framework (bundle) ===<br />
<br />
<pre><br />
/Library/Frameworks/wx.framework/Headers -> Versions/Current/Headers<br />
/Library/Frameworks/wx.framework/wx -> Versions/Current/wx<br />
/Library/Frameworks/wx.framework/Versions/Current -> 2.6.3<br />
/Library/Frameworks/wx.framework/Versions/2.6.3/Headers/wx.h<br />
/Library/Frameworks/wx.framework/Versions/2.6.3/wx -> libwx_macu-2.6.0.dylib<br />
/Library/Frameworks/wx.framework/Versions/2.6.3/libwx_macu-2.6.0.dylib -> libwx_macu-2.6.0.3.1.dylib<br />
/Library/Frameworks/wx.framework/Versions/2.6.3/libwx_macu-2.6.0.3.1.dylib<br />
</pre><br />
<br />
To bundle our framework with the application, we include it in "Frameworks" and change the path:<br />
<br />
<pre><br />
install_name_tool -id @executable_path/../Frameworks/wx.framework/Versions/2.6.3/libwx_macu-2.6.0.dylib<br />
</pre><br />
<br />
This way it will first look in the framework path (-F), and then in for the shared library path (-L) as usual.<br />
<br />
== Install Subversion client ==<br />
<br />
http://subversion.tigris.org/<br />
<br />
Note: you need SVN for the Code::Blocks revision scripts to work!<br />
<br />
== Build CodeBlocks from SVN ==<br />
<br />
=== Download the source code ===<br />
<br />
https://www.codeblocks.org/source_code.shtml<br />
<br />
<pre><br />
svn checkout svn://svn.berlios.de/codeblocks/trunk<br />
cd trunk<br />
</pre><br />
<br />
=== Apply necessary patches ===<br />
<br />
For a list of necessary patches, see below under "DarwinPorts", or:<br />
<br />
http://developer.berlios.de/patch/?group_id=5358<br />
<br />
<pre><br />
patch -p0 -i codeblocks-rev3656_pluginslib.patch<br />
</pre><br />
<br />
You might need to convert the line endings from DOS to Unix first.<br />
<br />
Hopefully most of these should be merged upstream, before release:<br />
<br />
* http://developer.berlios.de/patch/?func=detailpatch&patch_id=1395&group_id=5358<br />
<br />
(when they are, the above stand-alone patches might fail to apply)<br />
<br />
=== Bootstrap with Autotools ===<br />
<br />
You need to use the newer version of automake, for the "bootstrap":<br />
<br />
<pre><br />
AUTOMAKE=automake-1.7 ACLOCAL=aclocal-1.7 ACLOCAL_FLAGS="-I /usr/share/aclocal" ./bootstrap<br />
</pre><br />
<br />
See above for how to compile and install automake-1.7 on Mac OS X.<br />
<br />
=== Configure ===<br />
<br />
<pre><br />
./configure --enable-contrib<br />
</pre><br />
<br />
Note: the easiest way to build a Universal Binary for Code::Blocks is to build once for PowerPC (-arch ppc) and once for Intel (-arch i386), and then merge them (with lipo) afterwards.<br />
<br />
<pre><br />
mkdir ppc-build<br />
cd ppc-build<br />
../configure --host=powerpc-apple-darwin8 --target=powerpc-apple-darwin8 --enable-contrib<br />
cd ..<br />
<br />
mkdir x86-build<br />
cd x86-build<br />
../configure --host=i686-apple-darwin8 --target=i686-apple-darwin8 --enable-contrib<br />
cd ..<br />
</pre><br />
<br />
Note: You need to patch the location of the pre-compiled headers, or it will generate them in the same place for both arch.<br />
<br />
=== Tiger Fix ===<br />
<br />
There is a bug in the glibtool of Mac OS X 10.4, that fails to link C++ libs:<br />
<br />
<pre><br />
ld: multiple definitions of symbol ___umoddi3<br />
/usr/lib/gcc/powerpc-apple-darwin8/4.0.1/libgcc.a(_umoddi3.o) private external definition of ___umoddi3 in section (__TEXT,__text)<br />
/usr/lib/gcc/powerpc-apple-darwin8/4.0.1/../../../libgcc_s.10.4.dylib(_umoddi3_s.o) definition of ___umoddi3<br />
<br />
ld: multiple definitions of symbol ___umoddi3<br />
/usr/lib/gcc/i686-apple-darwin8/4.0.1/libgcc.a(_umoddi3.o) private external definition of ___umoddi3 in section (__TEXT,__text)<br />
/usr/lib/gcc/i686-apple-darwin8/4.0.1/../../../libgcc_s.10.4.dylib(_umoddi3_s.o) definition of ___umoddi3<br />
</pre><br />
<br />
To work around this, you need to edit the generated "libtool" script manually:<br />
<br />
<pre><br />
177c177<br />
< whole_archive_flag_spec="-all_load \$convenience"<br />
---<br />
> whole_archive_flag_spec=""<br />
6921c6921<br />
< whole_archive_flag_spec="-all_load \$convenience"<br />
---<br />
> whole_archive_flag_spec=""<br />
</pre><br />
<br />
This bug has been fixed in GNU libtool 1.5.8 and later.<br />
<br />
=== (GNU) Make ===<br />
<br />
<pre><br />
nice make<br />
</pre><br />
<br />
For the Universal Binary build:<br />
<br />
<pre><br />
cd ppc-build<br />
nice make<br />
cd ..<br />
<br />
cd x86-build<br />
nice make<br />
cd ..<br />
</pre><br />
<br />
=== Install into Destination ===<br />
<br />
<pre><br />
sudo make install<br />
</pre><br />
<br />
For the Universal Binary build:<br />
<br />
<pre><br />
cd ppc-build<br />
make install DESTDIR=/tmp/ppc<br />
cd ..<br />
<br />
cd x86-build<br />
make install DESTDIR=/tmp/x86<br />
cd ..<br />
<br />
lipomerge /tmp/ppc /tmp/x86 /tmp/fat<br />
</pre><br />
<br />
Where "lipomerge" is a custom shell script:<br />
<br />
* http://www.algonet.se/~afb/wx/lipomerge<br />
<br />
== Bundle application for Mac ==<br />
<br />
After building codeblocks in the regular Unix way, you need to bundle it with the icons<br />
and various other info that it needs to make a regular stand-alone Macintosh application.<br />
<br />
There are two ways of accomplishing this, old Mac OS-style resource or NeXT-style bundle.<br />
The old resources are handy while developing, while bundles are more suitable for release.<br />
<br />
Note: You '''need''' to use either of these methods, or your application will launch<br />
in the background behind all other windows and will be unable to receive any events!<br />
<br />
=== Way One: Mac OS (resource) ===<br />
<br />
http://developer.apple.com/documentation/Carbon/Reference/Resource_Manager/<br />
<br />
Handy while developing, as you only need to add an icon.<br />
<br />
Files needed:<br />
* http://www.algonet.se/~afb/wx/CodeBlocks.r.gz (Rez icon, gzipped)<br />
<br />
First we install the program to the PREFIX directory of your choice:<br />
<br />
<pre><br />
$PREFIX/bin<br />
$PREFIX/lib<br />
$PREFIX/share/codeblocks<br />
</pre><br />
<br />
Add a custom icon to the application, and make it receive events:<br />
<br />
<pre><br />
gunzip CodeBlocks.r.gz<br />
sudo /Developer/Tools/Rez -d __DARWIN__ -t APPL -d __WXMAC__ \<br />
CodeBlocks.r Carbon.r -o $PREFIX/bin/codeblocks<br />
sudo /Developer/Tools/SetFile -a C $PREFIX/bin/codeblocks<br />
</pre><br />
<br />
Note: on the Intel Macintoshes, the icon comes up as "broken"<br />
(apparently it assumes that all apps with resforks are Classic)<br />
<br />
Without the icon part, this could also have be written as just:<br />
<br />
<pre><br />
sudo `wx-config --rezflags` $PREFIX/bin/codeblocks<br />
</pre><br />
<br />
Start the application with a small prefix shell wrapper like this:<br />
<br />
<pre><br />
DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:$PREFIX/lib<br />
export DYLD_LIBRARY_PATH<br />
<br />
$PREFIX/bin/codeblocks --prefix=$PREFIX<br />
</pre><br />
<br />
You don't need the "DYLD_LIBRARY_PATH" stuff,<br />
if you are installing to a system directory.<br />
<br />
==== Common PREFIX Settings ====<br />
<br />
Local: <tt>PREFIX=/usr/local</tt><br />
<br />
System: <tt>PREFIX=/usr</tt><br />
<br />
DarwinPorts: <tt>PREFIX=/opt/local</tt><br />
<br />
Fink: <tt>PREFIX=/sw</tt><br />
<br />
=== Way Two: NeXT (bundle) ===<br />
<br />
http://developer.apple.com/documentation/CoreFoundation/Conceptual/CFBundles/<br />
<br />
This does not involve resources, and is more relocatable.<br />
<br />
Files needed:<br />
* http://www.algonet.se/~afb/wx/CodeBlocks.Info.plist (rename to "Info.plist")<br />
* http://www.algonet.se/~afb/wx/CodeBlocks.sh (shell wrapper, rename to "CodeBlocks")<br />
* http://www.algonet.se/~afb/wx/CodeBlocks.icns (Mac OS X icon, rename to "app.icns")<br />
<br />
The MacOS program will just be a shell wrapper that calls "bin/codeblocks", like above.<br />
Traditionally the bundle would include Frameworks and Resources, but we'll just avoid those<br />
here and use the regular "lib" and "share/codeblocks" instead (just as with a regular install). <br />
These temporary directories are listed in italic below, they're not really used in bundles...<br />
<br />
Setup a hierarchy like this, and copy the files from the regular build/install and the above file list to it:<br />
<br />
CodeBlocks.app<br />
CodeBlocks.app/Contents/<br />
CodeBlocks.app/Contents/Info.plist<br />
CodeBlocks.app/Contents/MacOS/<br />
CodeBlocks.app/Contents/MacOS/CodeBlocks<br />
CodeBlocks.app/Contents/Resources/<br />
CodeBlocks.app/Contents/Resources/app.icns<br />
''CodeBlocks.app/Contents/bin/''<br />
''CodeBlocks.app/Contents/lib/''<br />
''CodeBlocks.app/Contents/share/codeblocks/''<br />
<br />
The CodeBlocks application can now be moved with the Finder, and started up like a regular Mac application. (the nightly build includes a more advanced Info.plist and more icons - for also mapping all the files that the application can open, like source code and header files and such)<br />
<br />
==== Proper Application Bundling ====<br />
<br />
To avoid the shell wrapper, the binary can now be moved from "bin/codeblocks" to "MacOS/CodeBlocks". Helper files are moved from "share/codeblocks" to "Resources". The dynamic libraries are moved from "lib" to "MacOS":<br />
<br />
<pre><br />
mv bin/codeblocks MacOS/CodeBlocks<br />
rmdir bin<br />
mv lib/* MacOS/<br />
rmdir lib<br />
mv share Resources/<br />
</pre><br />
<br />
To avoid having to use a DYLD_LIBRARY_PATH, we rename the shared libraries (with the install_name_tool program) from e.g. /usr/local/lib/ to @executable_path/:<br />
<br />
<pre><br />
install_name_tool -change /usr/local/lib/libcodeblocks.0.dylib \<br />
@executable_path/libcodeblocks.0.dylib MacOS/CodeBlocks<br />
</pre><br />
<br />
The libraries can have their names changed using the -id parameter:<br />
<br />
<pre><br />
install_name_tool -id @executable_path/libcodeblocks.0.dylib MacOS/libcodeblocks.0.dylib<br />
</pre><br />
<br />
You also need to change all of the loadable bundles for the plugins:<br />
<br />
<pre><br />
for so in Resources/plugins/*.so<br />
do install_name_tool -change /usr/local/lib/libcodeblocks.0.dylib \<br />
@executable_path/libcodeblocks.0.dylib $so<br />
done<br />
</pre><br />
<br />
You can check the result, what libraries/frameworks it links to, with:<br />
<br />
<pre><br />
otool -L CodeBlocks<br />
</pre><br />
<br />
Optionally you can then repeat the process, for the wx library too...<br />
<br />
== FYI: Darwin vs. Mac OS X ==<br />
<br />
"Darwin is the UNIX technology-based foundation of Mac OS X."<br />
<br />
* http://developer.apple.com/referencelibrary/Darwin/<br />
<br />
* http://en.wikipedia.org/wiki/Darwin_(operating_system)<br />
<br />
"Pure Darwin" here refers to the Open Source version of the OS:<br />
<br />
* http://www.opensource.apple.com/darwinsource/images/<br />
<br />
(that is: Darwin using X11 instead of Aqua for the user interface)<br />
<br />
== Install with DarwinPorts ==<br />
<br />
To build and install Code::Blocks, you will need:<br />
<br />
* http://www.algonet.se/~afb/wx/codeblocks.Portfile<br />
<br />
The following need to go in the "files" directory:<br />
<br />
* http://www.algonet.se/~afb/wx/codeblocks.plist<br />
* http://www.algonet.se/~afb/wx/codeblocks.sh.in<br />
* http://www.algonet.se/~afb/wx/dos2unix.sh<br />
* http://www.algonet.se/~afb/wx/codeblocks-rev3656_pluginslib.patch<br />
* http://www.algonet.se/~afb/wx/codeblocks-wxauigtk.patch<br />
<br />
Put the Portfile in your local DarwinPorts tree (usually in <tt>~/dports</tt> - set up in <tt>/opt/local/etc/ports/sources.conf</tt>, create the directory if needed), as <tt>dports/devel/codeblocks/Portfile</tt> and download the helper files to <tt>dports/devel/codeblocks/files</tt>. (then do a chdir to <tt>dports</tt>, and run the <tt>/opt/local/bin/portindex</tt> command)<br />
<br />
You will also need these custom wxWidgets ports:<br />
<br />
* http://www.algonet.se/~afb/wx/wxMac.Portfile<br />
* http://www.algonet.se/~afb/wx/patch-polling.diff<br />
* http://www.algonet.se/~afb/wx/wxGTK.Portfile<br />
* http://www.algonet.se/~afb/wx/patch-soundsdl.diff<br />
<br />
The optional wxWidgets file go in <tt>graphics/wx{Mac,GTK}/Portfile</tt>. Normally one use the regular wxWidgets port from the DarwinPorts main, but that should in turn use wxMac on Mac OS X and wxGTK on Pure Darwin so it is all the same software. (the regular DarwinPorts version is broken now on Intel though, and it also hardcodes wxMac -see [http://trac.macosforge.org/projects/macports/ticket/10815 Ticket 10815])<br />
<br />
After that set up has been done, you can install it with:<br />
<br />
<pre><br />
sudo port install codeblocks<br />
</pre><br />
<br />
If you want the X11/GTK version on Mac OS X, instead use:<br />
<br />
<pre><br />
sudo port install codeblocks -macosx+puredarwin<br />
</pre><br />
<br />
This will download the SVN trunk, and any dependencies:<br />
<br />
<pre><br />
---> Fetching codeblocks<br />
---> Verifying checksum(s) for codeblocks<br />
---> Extracting codeblocks<br />
---> Applying patches to codeblocks<br />
---> Configuring codeblocks<br />
---> Building codeblocks with target all<br />
---> Staging codeblocks into destroot<br />
---> Packaging tgz archive for codeblocks 1.0_0+macosx<br />
---> Installing codeblocks 1.0_0+macosx<br />
---> Activating codeblocks 1.0_0+macosx<br />
---> Cleaning codeblocks<br />
</pre><br />
<br />
Note: to upgrade from SVN, you need to uninstall first:<br />
<br />
<pre><br />
sudo port uninstall codeblocks<br />
sudo port clean codeblocks<br />
sudo port install codeblocks<br />
</pre><br />
<br />
This is both because all SVN versions are numbered "0",<br />
but also due to a bug in the Code::Blocks build scripts.<br />
<br />
=== Running <tt>+macosx</tt> (wxMac) version ===<br />
<br />
After the build completes, you can start the program by:<br />
<br />
<pre><br />
open /Applications/DarwinPorts/CodeBlocks.app<br />
</pre><br />
<br />
Note that the wxMac application bundle in "DarwinPorts"<br />
is just a wrapper, with symbolic links to /opt/local...<br />
<br />
<pre><br />
/opt/local/bin/codeblocks --prefix=/opt/local<br />
</pre><br />
<br />
=== Running <tt>+puredarwin</tt> (wxGTK) version ===<br />
<br />
The non-bundled wxGTK version is instead started with:<br />
<br />
<pre><br />
/opt/local/bin/codeblocks --prefix=/opt/local<br />
</pre><br />
<br />
There is also a wxGTK startup command in "DarwinPorts",<br />
that will first start up X11.app and then launch C::B:<br />
<br />
<pre><br />
open /Applications/DarwinPorts/CodeBlocks.command<br />
</pre></div>Auriahttps://wiki.codeblocks.org/index.php?title=Installing_Code::Blocks_from_source_on_Linux&diff=4458Installing Code::Blocks from source on Linux2007-02-22T22:19:40Z<p>Auria: /* Building Code::Blocks RC2 and SVN */</p>
<hr />
<div>[[Category:Installing Code::Blocks]]<br />
[[Category:Installing Code::Blocks from source]]<br />
These are instructions on how to build Code::Blocks under Linux. I 've ran and verified this procedure to work under SuSE 9.2 and Fedora Core 3. These instructions should work for all Linux distros, as we 'll be installing from sources.<br />
<br />
===Prerequisites===<br />
<br />
In order to sucesfully compile Code::Blocks, the wxWidgets (<u>wxGTK-2.6.1 or later</u>) cross-platform UI library <u>must be installed</u>. In this document, it is not assumed that it is already installed in your system and instructions are given on how to download, build and install it.<br />
What is '''not''' covered here, is the wxWidgets prerequisites. The most important being GTK2, of course!<br />
Let me stress it here, while it's early: <u>GTK2 is required</u>, not GTK1, for Code::Blocks to be operational.<br />
<br />
You do not need to Compile wxWidgets if your distribution has wxGTK 2.6 and wxGTK 2.6-dev package available. A quick search for "wxGTK" through your respective package manager should show bring up the needed packages. After you have installed successfully you can moving on the the Installing Code::Blocks portion. If you are using Ubuntu and have installed the wxGTK package, you must also have the dev version as well as the "wx-common" package in order to successfully compile Code::Blocks.<br />
<br />
All the instructions below, assume an existing directory named <tt>~/devel</tt>. If you 'll be using a different one, adjust the path to match.<br />
As a first step create this directory:<br />
<br />
<pre>mkdir ~/devel</pre><br />
<br />
===wxGTK installation===<br />
<br />
====Getting wxGTK====<br />
<br />
Visit the [http://www.wxwidgets.org wxWidgets web site]. Click the "Download" button at the top of the page. Under wxWidgets 2.6.3 downloads, select wxGTK. Save the file in <tt>~/devel</tt>.<br />
<br />
wxWidgets project has released two patches for 2.6.3 release. Click the "Patches" in the left side of the page. Download the Patch 2, either in zip or tar.gz format. Save the file in <tt>~/devel</tt><br />
<br />
====Uncompressing the wxGTK sources====<br />
<br />
After the download finishes, switch to <tt>~/devel</tt>:<br />
<br />
<pre>cd ~/devel</pre><br />
<br />
Now, untar the wxGTK sources:<br />
<br />
<pre>tar zxf wxGTK-2.6.3.tar.gz</pre><br />
<br />
Move the patch to the wxGTK directory<br />
<br />
<pre>mv wxWidgets-2.6.3-Patch-2.tar.gz wxGTK-2.6.3</pre><br />
<br />
or<br />
<br />
<pre>mv wxWidgets-2.6.3-Patch-2.zip wxGTK-2.6.3</pre><br />
<br />
Switch to the wxGTK directory<br />
<br />
<pre>cd wxGTK-2.6.3</pre><br />
<br />
Extract the patch<br />
<br />
<pre>tar zxf wxWidgets-2.6.3-Patch-2.tar.gz</pre><br />
<br />
or<br />
<br />
<pre>unzip -fo wxWidgets-2.6.3-Patch-2.zip</pre><br />
<br />
Remove the patch file<br />
<br />
<pre>rm wxWidgets-2.6.3-Patch-2.tar.gz</pre><br />
<br />
or<br />
<br />
<pre>rm wxWidgets-2.6.3-Patch-2.zip</pre><br />
<br />
====wxWidgets build====<br />
<br />
Here we will create a seperate build directory instead of building from the src directory, so that we can easily rebuild with different options (unicode / ansi, monolithic / many libs, etc).<br />
<br />
The documentation says the default is for gtk2 to use unicode and wx > 2.5 to build as a monolithic library. This doesn't appear to be the case, so these flags are passed to configure.<br />
<br />
mkdir build_gtk2_shared_monolithic_unicode<br />
cd build_gtk2_shared_monolithic_unicode<br />
../configure --prefix=/opt/wx/2.6 \<br />
--enable-xrc \<br />
--enable-monolithic \<br />
--enable-unicode<br />
make<br />
make -C contrib/src/stc<br />
su<br />
make install<br />
make -C contrib/src/stc install<br />
exit<br />
<br />
(Note: it's not necessary to make or install stc if you're compiling cvs HEAD or Code::Blocks newer than RC1)<br />
<br />
Add /opt/wx/2.6/bin to the PATH (if you're shell is bash then edit /etc/profile or ~/.bash_profile)<br />
(On Suse 10.1 edit /etc/profile.local, it will only be available after a new login). an example PATH<br />
export PATH=/usr/bin:/opt/wx/2.6/bin:$PATH<br />
<br />
'''Note:''' On Ubuntu Hoary it was necessary to check "Run command as login shell" <br />
in the gnome-terminal profile-settings, otherwise the PATH changes are not available in a gnome-terminal window.<br />
<br />
add /opt/wx/2.6/lib to /etc/ld.so.conf (nano /etc/ld.so.conf)<br />
then run:<br />
ldconfig<br />
source /etc/profile<br />
<br />
That's it. Now the linker will look in /opt/wx/2.6/lib for wx libraries and you will have a monolithic shared library unicode build.<br />
<br />
To check that things are working, type:<br />
wx-config --prefix<br />
which should give you /opt/wx/2.6<br />
wx-config --libs<br />
which should have at least<br />
-L/opt/wx/2.6/lib -lwx_gtk2-2.6<br />
but can contain other flags as well.<br />
which wx-config<br />
should return /opt/wx/2.6/bin/wx-config<br />
<br />
===Code::Blocks installation===<br />
<br />
====Downloading Code::Blocks====<br />
<br />
You can get Code::Blocks source code in one of two ways:<br />
* Download the latest source package, or<br />
* Get the latest sources from the SVN repository.<br />
Both methods, are described below.<br />
<br />
<br />
=====Downloading the latest source package=====<br />
<br />
Go to the Code::Blocks [https://www.codeblocks.org web site] and download the latest source package. This would be the " Code::Blocks IDE version 1.0rc2 source code (tarball)" codeblocks-1.0rc2.tar.gz.<br />
Save this file in <tt>~/devel</tt> and then untar it:<br />
<pre>cd ~/devel<br />
tar zxf codeblocks-1.0rc2.tar.gz</pre><br />
This will create the directory <tt>~/devel/codeblocks-1.0rc2</tt>.<br />
Change to the source code directory, by issuing the following command:<br />
<pre>cd codeblocks-1.0rc2</pre><br />
<br />
=====Getting the latest sources from SVN=====<br />
'''IMPORTANT NOTICE: The Sourceforge CVS is no longer used although it still exists'''<br />
<br />
Enter your development directory:<br />
<pre>cd ~/devel</pre><br />
<br />
Then checkout the source using one of [https://www.codeblocks.org/source_code.shtml these] methods.<br />
<br />
This will create the directory <tt>trunk</tt>.<br />
Change to the source code directory, by issuing the following command:<br />
<br />
<pre>cd trunk</pre><br />
<br />
====Building Code::Blocks RC2 and SVN====<br />
If you are a Gentoo user, please see [[Compiling_Code::Blocks_in_Gentoo]].<br />
<br />
Before beginning, it is often a good idea to check you have recent versions of autoconf and automake - repositories versions are not always recent enough.<br />
<br />
If you're compiling the svn trunk versions of CodeBlocks (or future versions) then the unix build has switched to autotools. So first build wxWidgets as described above and then build CodeBlocks as follows:<br />
<br />
./bootstrap<br />
<br />
This sets up the configure script and it's dependencies. It only needs to be run once (after downloading the source from svn). '''If you get errors like:'''<br />
aclocal:configure.in:61: warning: macro `AM_OPTIONS_WXCONFIG' not found in library<br />
Then aclocal is having trouble finding the wxWidgets .m4 files. You can do one of two things:<br />
To just get bootstrap to find the path this time do:<br />
<!-- *********** Bad syntax... removed 2006-08-28 by BentFX ****************************<br />
export ACLOCAL_FLAGS="--acdir=`wx-config --prefix`/share/aclocal"<br />
<br />
: Note: The above command resulted in missing macros when running ./bootstrap for me. Setting an additional search path instead of overwriting like above worked for me. In case of missing macros try <br />
***********************************************************************************--><br />
<pre>export ACLOCAL_FLAGS="-I `wx-config --prefix`/share/aclocal"</pre> <!--[[User:Jabber|Jabber]] 06:24, 2 August 2006 (EDT)--><br />
<br />
To change the aclocal search path more permanently do:<br />
echo `wx-config --prefix`/share/aclocal >> /usr/share/aclocal/dirlist<br />
Then aclocal will also search somewhere like /opt/wx/2.6/share/aclocal<br />
<br />
If you get something like<br />
The usual way to define `LIBTOOL' is to add `AC_PROG_LIBTOOL'<br />
<br />
it can be solved by something like: (adapt path, use `wx-config --prefix` is necessary)<br />
<br />
ACLOCAL_FLAGS="-I /usr/share/aclocal" ./bootstrap<br />
<br />
(*Note// '''If you run ./bootstrap and get errors like''':<br />
: bad interpreter: File not found<br />
then there exists a problem with DOS line-endings. i had this error after i tried to build a codeblocks from sources which were checked out with cvs on a windows machine. After i checked out a fresh copy of codeblocks from cvs under Ubuntu linux (see above topic: Downloading the latest source package fom SVN), all errors were gone. <br />
//tiwag 051008*)<br><br />
Or, instead of downloading from SVN, you might consider using the little command line tool dos2unix, which normally comes with most distributions. //lizzarddude060103<br />
<br><br />
If configure aborts with some unspecific error message(".infig.status: error: cannot find input file: Makefile"), you might consider also running<br />
dos2unix bootstrap acinclude.m4 codeblocks.pc.in configure.in Makefile.am<br />
before running bootstrap<br />
<br />
Once you've run the bootstrap script, installing is as simple as:<br />
./configure<br />
make<br />
make install<br />
<br />
If you have multiple versions of wxWidgets installed or kept them inplace, you can use<br />
./configure --with-wx-config=/path/to/wx-config<br />
<br />
To uninstall you can later run:<br />
make uninstall<br />
<br />
If you want to recompile everything, first run:<br />
make clean<br />
make distclean<br />
make clean-bin<br />
make clean-zipfiles<br />
and then follow the above sequence for installing.<br />
<br />
By default, CodeBlocks will install to /usr/local. If you want it in its own tree (so you can have multiple versions of CodeBlocks, each in its own subdirectory of /opt) replace the above ./configure command with:<br />
./configure --prefix=/opt/codeblocks-svn<br />
or similar. Then you can later install a different build like:<br />
./configure --prefix=/opt/codeblocks2-svn<br />
followed by 'make && make install' as usual.<br />
<br />
By default, CodeBlocks will not compile the contributed plugins from SVN. If you want to compile / install them too, replace the above ./configure command with:<br />
./configure --enable-contrib<br />
followed by 'make && make install' as usual.<br />
<br />
To see a list of other options available for configuring the build of CodeBlocks do:<br />
./configure --help<br />
<br />
To compile under gentoo, use<br />
./configure --with-wx-config=wx-config-2.6<br />
<br />
====Building Code::Blocks RC1 and former====<br />
<br />
To build Code::Blocks all you have to do now is type:<br />
<br />
<pre>make -f Makefile.unix</pre><br />
<br />
This will build everything: the application and the plugins. The final step is to update the working environment for your system:<br />
<br />
<pre>make -f Makefile.unix update</pre><br />
<br />
The following notes about converting the line endings does '''not''' apply to the CVS Version! The "update" script included there works just fine.<br />
<br />
'''Important note:''' Don't run that final make yet! 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:<br />
<br />
To install it in Gentoo, do:<br />
<br />
# emerge -av dos2unix<br />
<br />
In Debian and Ubuntu, do (as root, or using sudo etc.):<br />
<br />
# apt-get install sysutils<br />
<br />
This will install dos2unix. Now we are ready to convert the script.<br />
# dos2unix -n update update.unix<br />
# chmod +x update.unix<br />
# ./update.unix<br />
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.<br />
<br />
OK. Now that the update script is converted to unix format, you can run the final make:<br />
<br />
<pre>make -f Makefile.unix update</pre><br />
<br />
If everything's gone well, congratulations! You should be able to launch Code::Blocks by running the generated <tt>run.sh</tt> script in the <tt>output</tt> subdir:<br />
<br />
<pre>output/run.sh</pre><br />
<br />
This script can be ran from anywhere in your system so, yes, you can make a shortcut to it on your desktop ;)<br />
<br />
Enjoy!</div>Auriahttps://wiki.codeblocks.org/index.php?title=Installing_Code::Blocks_from_source_on_Linux&diff=4457Installing Code::Blocks from source on Linux2007-02-22T22:18:58Z<p>Auria: /* Building Code::Blocks RC2 and SVN */</p>
<hr />
<div>[[Category:Installing Code::Blocks]]<br />
[[Category:Installing Code::Blocks from source]]<br />
These are instructions on how to build Code::Blocks under Linux. I 've ran and verified this procedure to work under SuSE 9.2 and Fedora Core 3. These instructions should work for all Linux distros, as we 'll be installing from sources.<br />
<br />
===Prerequisites===<br />
<br />
In order to sucesfully compile Code::Blocks, the wxWidgets (<u>wxGTK-2.6.1 or later</u>) cross-platform UI library <u>must be installed</u>. In this document, it is not assumed that it is already installed in your system and instructions are given on how to download, build and install it.<br />
What is '''not''' covered here, is the wxWidgets prerequisites. The most important being GTK2, of course!<br />
Let me stress it here, while it's early: <u>GTK2 is required</u>, not GTK1, for Code::Blocks to be operational.<br />
<br />
You do not need to Compile wxWidgets if your distribution has wxGTK 2.6 and wxGTK 2.6-dev package available. A quick search for "wxGTK" through your respective package manager should show bring up the needed packages. After you have installed successfully you can moving on the the Installing Code::Blocks portion. If you are using Ubuntu and have installed the wxGTK package, you must also have the dev version as well as the "wx-common" package in order to successfully compile Code::Blocks.<br />
<br />
All the instructions below, assume an existing directory named <tt>~/devel</tt>. If you 'll be using a different one, adjust the path to match.<br />
As a first step create this directory:<br />
<br />
<pre>mkdir ~/devel</pre><br />
<br />
===wxGTK installation===<br />
<br />
====Getting wxGTK====<br />
<br />
Visit the [http://www.wxwidgets.org wxWidgets web site]. Click the "Download" button at the top of the page. Under wxWidgets 2.6.3 downloads, select wxGTK. Save the file in <tt>~/devel</tt>.<br />
<br />
wxWidgets project has released two patches for 2.6.3 release. Click the "Patches" in the left side of the page. Download the Patch 2, either in zip or tar.gz format. Save the file in <tt>~/devel</tt><br />
<br />
====Uncompressing the wxGTK sources====<br />
<br />
After the download finishes, switch to <tt>~/devel</tt>:<br />
<br />
<pre>cd ~/devel</pre><br />
<br />
Now, untar the wxGTK sources:<br />
<br />
<pre>tar zxf wxGTK-2.6.3.tar.gz</pre><br />
<br />
Move the patch to the wxGTK directory<br />
<br />
<pre>mv wxWidgets-2.6.3-Patch-2.tar.gz wxGTK-2.6.3</pre><br />
<br />
or<br />
<br />
<pre>mv wxWidgets-2.6.3-Patch-2.zip wxGTK-2.6.3</pre><br />
<br />
Switch to the wxGTK directory<br />
<br />
<pre>cd wxGTK-2.6.3</pre><br />
<br />
Extract the patch<br />
<br />
<pre>tar zxf wxWidgets-2.6.3-Patch-2.tar.gz</pre><br />
<br />
or<br />
<br />
<pre>unzip -fo wxWidgets-2.6.3-Patch-2.zip</pre><br />
<br />
Remove the patch file<br />
<br />
<pre>rm wxWidgets-2.6.3-Patch-2.tar.gz</pre><br />
<br />
or<br />
<br />
<pre>rm wxWidgets-2.6.3-Patch-2.zip</pre><br />
<br />
====wxWidgets build====<br />
<br />
Here we will create a seperate build directory instead of building from the src directory, so that we can easily rebuild with different options (unicode / ansi, monolithic / many libs, etc).<br />
<br />
The documentation says the default is for gtk2 to use unicode and wx > 2.5 to build as a monolithic library. This doesn't appear to be the case, so these flags are passed to configure.<br />
<br />
mkdir build_gtk2_shared_monolithic_unicode<br />
cd build_gtk2_shared_monolithic_unicode<br />
../configure --prefix=/opt/wx/2.6 \<br />
--enable-xrc \<br />
--enable-monolithic \<br />
--enable-unicode<br />
make<br />
make -C contrib/src/stc<br />
su<br />
make install<br />
make -C contrib/src/stc install<br />
exit<br />
<br />
(Note: it's not necessary to make or install stc if you're compiling cvs HEAD or Code::Blocks newer than RC1)<br />
<br />
Add /opt/wx/2.6/bin to the PATH (if you're shell is bash then edit /etc/profile or ~/.bash_profile)<br />
(On Suse 10.1 edit /etc/profile.local, it will only be available after a new login). an example PATH<br />
export PATH=/usr/bin:/opt/wx/2.6/bin:$PATH<br />
<br />
'''Note:''' On Ubuntu Hoary it was necessary to check "Run command as login shell" <br />
in the gnome-terminal profile-settings, otherwise the PATH changes are not available in a gnome-terminal window.<br />
<br />
add /opt/wx/2.6/lib to /etc/ld.so.conf (nano /etc/ld.so.conf)<br />
then run:<br />
ldconfig<br />
source /etc/profile<br />
<br />
That's it. Now the linker will look in /opt/wx/2.6/lib for wx libraries and you will have a monolithic shared library unicode build.<br />
<br />
To check that things are working, type:<br />
wx-config --prefix<br />
which should give you /opt/wx/2.6<br />
wx-config --libs<br />
which should have at least<br />
-L/opt/wx/2.6/lib -lwx_gtk2-2.6<br />
but can contain other flags as well.<br />
which wx-config<br />
should return /opt/wx/2.6/bin/wx-config<br />
<br />
===Code::Blocks installation===<br />
<br />
====Downloading Code::Blocks====<br />
<br />
You can get Code::Blocks source code in one of two ways:<br />
* Download the latest source package, or<br />
* Get the latest sources from the SVN repository.<br />
Both methods, are described below.<br />
<br />
<br />
=====Downloading the latest source package=====<br />
<br />
Go to the Code::Blocks [https://www.codeblocks.org web site] and download the latest source package. This would be the " Code::Blocks IDE version 1.0rc2 source code (tarball)" codeblocks-1.0rc2.tar.gz.<br />
Save this file in <tt>~/devel</tt> and then untar it:<br />
<pre>cd ~/devel<br />
tar zxf codeblocks-1.0rc2.tar.gz</pre><br />
This will create the directory <tt>~/devel/codeblocks-1.0rc2</tt>.<br />
Change to the source code directory, by issuing the following command:<br />
<pre>cd codeblocks-1.0rc2</pre><br />
<br />
=====Getting the latest sources from SVN=====<br />
'''IMPORTANT NOTICE: The Sourceforge CVS is no longer used although it still exists'''<br />
<br />
Enter your development directory:<br />
<pre>cd ~/devel</pre><br />
<br />
Then checkout the source using one of [https://www.codeblocks.org/source_code.shtml these] methods.<br />
<br />
This will create the directory <tt>trunk</tt>.<br />
Change to the source code directory, by issuing the following command:<br />
<br />
<pre>cd trunk</pre><br />
<br />
====Building Code::Blocks RC2 and SVN====<br />
If you are a Gentoo user, please see [[Compiling_Code::Blocks_in_Gentoo]].<br />
<br />
Before beginning, it is often a good idea to check you have recent versions of autoconf and automake - repositories versions are not always recent enough.<br />
<br />
If you're compiling the svn trunk versions of CodeBlocks (or future versions) then the unix build has switched to autotools. So first build wxWidgets as described above and then build CodeBlocks as follows:<br />
<br />
./bootstrap<br />
<br />
This sets up the configure script and it's dependencies. It only needs to be run once (after downloading the source from svn). '''If you get errors like:'''<br />
aclocal:configure.in:61: warning: macro `AM_OPTIONS_WXCONFIG' not found in library<br />
Then aclocal is having trouble finding the wxWidgets .m4 files. You can do one of two things:<br />
To just get bootstrap to find the path this time do:<br />
<!-- *********** Bad syntax... removed 2006-08-28 by BentFX ****************************<br />
export ACLOCAL_FLAGS="--acdir=`wx-config --prefix`/share/aclocal"<br />
<br />
: Note: The above command resulted in missing macros when running ./bootstrap for me. Setting an additional search path instead of overwriting like above worked for me. In case of missing macros try <br />
***********************************************************************************--><br />
<pre>export ACLOCAL_FLAGS="-I `wx-config --prefix`/share/aclocal"</pre> <!--[[User:Jabber|Jabber]] 06:24, 2 August 2006 (EDT)--><br />
<br />
To change the aclocal search path more permanently do:<br />
echo `wx-config --prefix`/share/aclocal >> /usr/share/aclocal/dirlist<br />
Then aclocal will also search somewhere like /opt/wx/2.6/share/aclocal<br />
<br />
If you get something like<br />
The usual way to define `LIBTOOL' is to add `AC_PROG_LIBTOOL'<br />
<br />
it can be solved by something like: (adapt path, use `wx-config --prefix` is necessary)<br />
<br />
ACLOCAL_FLAGS="-I /usr/share/aclocal" ./bootstrap<br />
<br />
(*Note// '''If you run ./bootstrap and get errors like''':<br />
: bad interpreter: File not found<br />
then there exists a problem with DOS line-endings. i had this error after i tried to build a codeblocks from sources which were checked out with cvs on a windows machine. After i checked out a fresh copy of codeblocks from cvs under Ubuntu linux (see above topic: Downloading the latest source package fom SVN), all errors were gone. <br />
//tiwag 051008*)<br><br />
Or, instead of downloading from CVS, you might consider using the little command line tool dos2unix, which normally comes with most distributions. //lizzarddude060103<br />
<br><br />
If configure aborts with some unspecific error message(".infig.status: error: cannot find input file: Makefile"), you might consider also running<br />
dos2unix bootstrap acinclude.m4 codeblocks.pc.in configure.in Makefile.am<br />
before running bootstrap<br />
<br />
Once you've run the bootstrap script, installing is as simple as:<br />
./configure<br />
make<br />
make install<br />
<br />
If you have multiple versions of wxWidgets installed or kept them inplace, you can use<br />
./configure --with-wx-config=/path/to/wx-config<br />
<br />
To uninstall you can later run:<br />
make uninstall<br />
<br />
If you want to recompile everything, first run:<br />
make clean<br />
make distclean<br />
make clean-bin<br />
make clean-zipfiles<br />
and then follow the above sequence for installing.<br />
<br />
By default, CodeBlocks will install to /usr/local. If you want it in its own tree (so you can have multiple versions of CodeBlocks, each in its own subdirectory of /opt) replace the above ./configure command with:<br />
./configure --prefix=/opt/codeblocks-svn<br />
or similar. Then you can later install a different build like:<br />
./configure --prefix=/opt/codeblocks2-svn<br />
followed by 'make && make install' as usual.<br />
<br />
By default, CodeBlocks will not compile the contributed plugins from SVN. If you want to compile / install them too, replace the above ./configure command with:<br />
./configure --enable-contrib<br />
followed by 'make && make install' as usual.<br />
<br />
To see a list of other options available for configuring the build of CodeBlocks do:<br />
./configure --help<br />
<br />
To compile under gentoo, use<br />
./configure --with-wx-config=wx-config-2.6<br />
<br />
====Building Code::Blocks RC1 and former====<br />
<br />
To build Code::Blocks all you have to do now is type:<br />
<br />
<pre>make -f Makefile.unix</pre><br />
<br />
This will build everything: the application and the plugins. The final step is to update the working environment for your system:<br />
<br />
<pre>make -f Makefile.unix update</pre><br />
<br />
The following notes about converting the line endings does '''not''' apply to the CVS Version! The "update" script included there works just fine.<br />
<br />
'''Important note:''' Don't run that final make yet! 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:<br />
<br />
To install it in Gentoo, do:<br />
<br />
# emerge -av dos2unix<br />
<br />
In Debian and Ubuntu, do (as root, or using sudo etc.):<br />
<br />
# apt-get install sysutils<br />
<br />
This will install dos2unix. Now we are ready to convert the script.<br />
# dos2unix -n update update.unix<br />
# chmod +x update.unix<br />
# ./update.unix<br />
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.<br />
<br />
OK. Now that the update script is converted to unix format, you can run the final make:<br />
<br />
<pre>make -f Makefile.unix update</pre><br />
<br />
If everything's gone well, congratulations! You should be able to launch Code::Blocks by running the generated <tt>run.sh</tt> script in the <tt>output</tt> subdir:<br />
<br />
<pre>output/run.sh</pre><br />
<br />
This script can be ran from anywhere in your system so, yes, you can make a shortcut to it on your desktop ;)<br />
<br />
Enjoy!</div>Auriahttps://wiki.codeblocks.org/index.php?title=Installing_Code::Blocks_from_source_on_Linux&diff=4456Installing Code::Blocks from source on Linux2007-02-22T21:37:47Z<p>Auria: /* Building Code::Blocks RC2 and SVN */</p>
<hr />
<div>[[Category:Installing Code::Blocks]]<br />
[[Category:Installing Code::Blocks from source]]<br />
These are instructions on how to build Code::Blocks under Linux. I 've ran and verified this procedure to work under SuSE 9.2 and Fedora Core 3. These instructions should work for all Linux distros, as we 'll be installing from sources.<br />
<br />
===Prerequisites===<br />
<br />
In order to sucesfully compile Code::Blocks, the wxWidgets (<u>wxGTK-2.6.1 or later</u>) cross-platform UI library <u>must be installed</u>. In this document, it is not assumed that it is already installed in your system and instructions are given on how to download, build and install it.<br />
What is '''not''' covered here, is the wxWidgets prerequisites. The most important being GTK2, of course!<br />
Let me stress it here, while it's early: <u>GTK2 is required</u>, not GTK1, for Code::Blocks to be operational.<br />
<br />
You do not need to Compile wxWidgets if your distribution has wxGTK 2.6 and wxGTK 2.6-dev package available. A quick search for "wxGTK" through your respective package manager should show bring up the needed packages. After you have installed successfully you can moving on the the Installing Code::Blocks portion. If you are using Ubuntu and have installed the wxGTK package, you must also have the dev version as well as the "wx-common" package in order to successfully compile Code::Blocks.<br />
<br />
All the instructions below, assume an existing directory named <tt>~/devel</tt>. If you 'll be using a different one, adjust the path to match.<br />
As a first step create this directory:<br />
<br />
<pre>mkdir ~/devel</pre><br />
<br />
===wxGTK installation===<br />
<br />
====Getting wxGTK====<br />
<br />
Visit the [http://www.wxwidgets.org wxWidgets web site]. Click the "Download" button at the top of the page. Under wxWidgets 2.6.3 downloads, select wxGTK. Save the file in <tt>~/devel</tt>.<br />
<br />
wxWidgets project has released two patches for 2.6.3 release. Click the "Patches" in the left side of the page. Download the Patch 2, either in zip or tar.gz format. Save the file in <tt>~/devel</tt><br />
<br />
====Uncompressing the wxGTK sources====<br />
<br />
After the download finishes, switch to <tt>~/devel</tt>:<br />
<br />
<pre>cd ~/devel</pre><br />
<br />
Now, untar the wxGTK sources:<br />
<br />
<pre>tar zxf wxGTK-2.6.3.tar.gz</pre><br />
<br />
Move the patch to the wxGTK directory<br />
<br />
<pre>mv wxWidgets-2.6.3-Patch-2.tar.gz wxGTK-2.6.3</pre><br />
<br />
or<br />
<br />
<pre>mv wxWidgets-2.6.3-Patch-2.zip wxGTK-2.6.3</pre><br />
<br />
Switch to the wxGTK directory<br />
<br />
<pre>cd wxGTK-2.6.3</pre><br />
<br />
Extract the patch<br />
<br />
<pre>tar zxf wxWidgets-2.6.3-Patch-2.tar.gz</pre><br />
<br />
or<br />
<br />
<pre>unzip -fo wxWidgets-2.6.3-Patch-2.zip</pre><br />
<br />
Remove the patch file<br />
<br />
<pre>rm wxWidgets-2.6.3-Patch-2.tar.gz</pre><br />
<br />
or<br />
<br />
<pre>rm wxWidgets-2.6.3-Patch-2.zip</pre><br />
<br />
====wxWidgets build====<br />
<br />
Here we will create a seperate build directory instead of building from the src directory, so that we can easily rebuild with different options (unicode / ansi, monolithic / many libs, etc).<br />
<br />
The documentation says the default is for gtk2 to use unicode and wx > 2.5 to build as a monolithic library. This doesn't appear to be the case, so these flags are passed to configure.<br />
<br />
mkdir build_gtk2_shared_monolithic_unicode<br />
cd build_gtk2_shared_monolithic_unicode<br />
../configure --prefix=/opt/wx/2.6 \<br />
--enable-xrc \<br />
--enable-monolithic \<br />
--enable-unicode<br />
make<br />
make -C contrib/src/stc<br />
su<br />
make install<br />
make -C contrib/src/stc install<br />
exit<br />
<br />
(Note: it's not necessary to make or install stc if you're compiling cvs HEAD or Code::Blocks newer than RC1)<br />
<br />
Add /opt/wx/2.6/bin to the PATH (if you're shell is bash then edit /etc/profile or ~/.bash_profile)<br />
(On Suse 10.1 edit /etc/profile.local, it will only be available after a new login). an example PATH<br />
export PATH=/usr/bin:/opt/wx/2.6/bin:$PATH<br />
<br />
'''Note:''' On Ubuntu Hoary it was necessary to check "Run command as login shell" <br />
in the gnome-terminal profile-settings, otherwise the PATH changes are not available in a gnome-terminal window.<br />
<br />
add /opt/wx/2.6/lib to /etc/ld.so.conf (nano /etc/ld.so.conf)<br />
then run:<br />
ldconfig<br />
source /etc/profile<br />
<br />
That's it. Now the linker will look in /opt/wx/2.6/lib for wx libraries and you will have a monolithic shared library unicode build.<br />
<br />
To check that things are working, type:<br />
wx-config --prefix<br />
which should give you /opt/wx/2.6<br />
wx-config --libs<br />
which should have at least<br />
-L/opt/wx/2.6/lib -lwx_gtk2-2.6<br />
but can contain other flags as well.<br />
which wx-config<br />
should return /opt/wx/2.6/bin/wx-config<br />
<br />
===Code::Blocks installation===<br />
<br />
====Downloading Code::Blocks====<br />
<br />
You can get Code::Blocks source code in one of two ways:<br />
* Download the latest source package, or<br />
* Get the latest sources from the SVN repository.<br />
Both methods, are described below.<br />
<br />
<br />
=====Downloading the latest source package=====<br />
<br />
Go to the Code::Blocks [https://www.codeblocks.org web site] and download the latest source package. This would be the " Code::Blocks IDE version 1.0rc2 source code (tarball)" codeblocks-1.0rc2.tar.gz.<br />
Save this file in <tt>~/devel</tt> and then untar it:<br />
<pre>cd ~/devel<br />
tar zxf codeblocks-1.0rc2.tar.gz</pre><br />
This will create the directory <tt>~/devel/codeblocks-1.0rc2</tt>.<br />
Change to the source code directory, by issuing the following command:<br />
<pre>cd codeblocks-1.0rc2</pre><br />
<br />
=====Getting the latest sources from SVN=====<br />
'''IMPORTANT NOTICE: The Sourceforge CVS is no longer used although it still exists'''<br />
<br />
Enter your development directory:<br />
<pre>cd ~/devel</pre><br />
<br />
Then checkout the source using one of [https://www.codeblocks.org/source_code.shtml these] methods.<br />
<br />
This will create the directory <tt>trunk</tt>.<br />
Change to the source code directory, by issuing the following command:<br />
<br />
<pre>cd trunk</pre><br />
<br />
====Building Code::Blocks RC2 and SVN====<br />
If you are a Gentoo user, please see [[Compiling_Code::Blocks_in_Gentoo]].<br />
<br />
Before beginning, it is often a good idea to check you have recent versions of autoconf and automake - repositories versions are not always recent enough.<br />
<br />
If you're compiling the svn trunk versions of CodeBlocks (or future versions) then the unix build has switched to autotools. So first build wxWidgets as described above and then build CodeBlocks as follows:<br />
<br />
./bootstrap<br />
<br />
This sets up the configure script and it's dependencies. It only needs to be run once (after downloading the source from svn). '''If you get errors like:'''<br />
aclocal:configure.in:61: warning: macro `AM_OPTIONS_WXCONFIG' not found in library<br />
Then aclocal is having trouble finding the wxWidgets .m4 files. You can do one of two things:<br />
To just get bootstrap to find the path this time do:<br />
<!-- *********** Bad syntax... removed 2006-08-28 by BentFX ****************************<br />
export ACLOCAL_FLAGS="--acdir=`wx-config --prefix`/share/aclocal"<br />
<br />
: Note: The above command resulted in missing macros when running ./bootstrap for me. Setting an additional search path instead of overwriting like above worked for me. In case of missing macros try <br />
***********************************************************************************--><br />
<pre>export ACLOCAL_FLAGS="-I `wx-config --prefix`/share/aclocal"</pre> <!--[[User:Jabber|Jabber]] 06:24, 2 August 2006 (EDT)--><br />
<br />
To change the aclocal search path more permanently do:<br />
echo `wx-config --prefix`/share/aclocal >> /usr/share/aclocal/dirlist<br />
Then aclocal will also search somewhere like /opt/wx/2.6/share/aclocal<br />
<br />
If you get something like<br />
The usual way to define `LIBTOOL' is to add `AC_PROG_LIBTOOL'<br />
<br />
it can be solved by something like: (adapt path, use `wx-config --prefix` is necessary)<br />
<br />
ACLOCAL_FLAGS="-I /usr/share/aclocal" ./bootstrap<br />
<br />
(*Note// '''If you run ./bootstrap and get errors like''':<br />
: bad interpreter: File not found<br />
then there exists a problem with DOS line-endings. i had this error after i tried to build a codeblocks from sources which were checked out with cvs on a windows machine. After i checked out a fresh copy of codeblocks from cvs under Ubuntu linux (see above topic: Downloading the latest source package fom SVN), all errors were gone. <br />
//tiwag 051008*)<br><br />
Or, instead of downloading from CVS, you might consider using the little command line tool dos2unix, which normally comes with most distributions. //lizzarddude060103<br />
<br><br />
If configure aborts with some unspecific error message(".infig.status: error: cannot find input file: Makefile"), you might consider also running<br />
dos2unix bootstrap acinclude.m4 codeblocks.pc.in configure.in Makefile.am<br />
before running bootstrap<br />
<br />
Once you've run the bootstrap script, installing is as simple as:<br />
./configure<br />
make<br />
make install<br />
<br />
If you have multiple versions of wxWidgets installed or kept them inplace, you can use ./configure --with-wx-config=/path/to/wx-config<br />
<br />
To uninstall you can later run:<br />
make uninstall<br />
<br />
If you want to recompile everything, first run:<br />
make clean<br />
make distclean<br />
make clean-bin<br />
make clean-zipfiles<br />
and then follow the above sequence for installing.<br />
<br />
By default, CodeBlocks will install to /usr/local. If you want it in its own tree (so you can have multiple versions of CodeBlocks, each in its own subdirectory of /opt) replace the above ./configure command with:<br />
./configure --prefix=/opt/codeblocks-svn<br />
or similar. Then you can later install a different build like:<br />
./configure --prefix=/opt/codeblocks2-svn<br />
followed by 'make && make install' as usual.<br />
<br />
By default, CodeBlocks will not compile the contributed plugins from SVN. If you want to compile / install them too, replace the above ./configure command with:<br />
./configure --enable-contrib<br />
followed by 'make && make install' as usual.<br />
<br />
To see a list of other options available for configuring the build of CodeBlocks do:<br />
./configure --help<br />
<br />
To compile under gentoo, use<br />
./configure --with-wx-config=wx-config-2.6<br />
<br />
====Building Code::Blocks RC1 and former====<br />
<br />
To build Code::Blocks all you have to do now is type:<br />
<br />
<pre>make -f Makefile.unix</pre><br />
<br />
This will build everything: the application and the plugins. The final step is to update the working environment for your system:<br />
<br />
<pre>make -f Makefile.unix update</pre><br />
<br />
The following notes about converting the line endings does '''not''' apply to the CVS Version! The "update" script included there works just fine.<br />
<br />
'''Important note:''' Don't run that final make yet! 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:<br />
<br />
To install it in Gentoo, do:<br />
<br />
# emerge -av dos2unix<br />
<br />
In Debian and Ubuntu, do (as root, or using sudo etc.):<br />
<br />
# apt-get install sysutils<br />
<br />
This will install dos2unix. Now we are ready to convert the script.<br />
# dos2unix -n update update.unix<br />
# chmod +x update.unix<br />
# ./update.unix<br />
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.<br />
<br />
OK. Now that the update script is converted to unix format, you can run the final make:<br />
<br />
<pre>make -f Makefile.unix update</pre><br />
<br />
If everything's gone well, congratulations! You should be able to launch Code::Blocks by running the generated <tt>run.sh</tt> script in the <tt>output</tt> subdir:<br />
<br />
<pre>output/run.sh</pre><br />
<br />
This script can be ran from anywhere in your system so, yes, you can make a shortcut to it on your desktop ;)<br />
<br />
Enjoy!</div>Auriahttps://wiki.codeblocks.org/index.php?title=Installing_Code::Blocks_from_source_on_Linux&diff=4455Installing Code::Blocks from source on Linux2007-02-22T00:55:56Z<p>Auria: /* Building Code::Blocks RC2 and SVN */</p>
<hr />
<div>[[Category:Installing Code::Blocks]]<br />
[[Category:Installing Code::Blocks from source]]<br />
These are instructions on how to build Code::Blocks under Linux. I 've ran and verified this procedure to work under SuSE 9.2 and Fedora Core 3. These instructions should work for all Linux distros, as we 'll be installing from sources.<br />
<br />
===Prerequisites===<br />
<br />
In order to sucesfully compile Code::Blocks, the wxWidgets (<u>wxGTK-2.6.1 or later</u>) cross-platform UI library <u>must be installed</u>. In this document, it is not assumed that it is already installed in your system and instructions are given on how to download, build and install it.<br />
What is '''not''' covered here, is the wxWidgets prerequisites. The most important being GTK2, of course!<br />
Let me stress it here, while it's early: <u>GTK2 is required</u>, not GTK1, for Code::Blocks to be operational.<br />
<br />
You do not need to Compile wxWidgets if your distribution has wxGTK 2.6 and wxGTK 2.6-dev package available. A quick search for "wxGTK" through your respective package manager should show bring up the needed packages. After you have installed successfully you can moving on the the Installing Code::Blocks portion. If you are using Ubuntu and have installed the wxGTK package, you must also have the dev version as well as the "wx-common" package in order to successfully compile Code::Blocks.<br />
<br />
All the instructions below, assume an existing directory named <tt>~/devel</tt>. If you 'll be using a different one, adjust the path to match.<br />
As a first step create this directory:<br />
<br />
<pre>mkdir ~/devel</pre><br />
<br />
===wxGTK installation===<br />
<br />
====Getting wxGTK====<br />
<br />
Visit the [http://www.wxwidgets.org wxWidgets web site]. Click the "Download" button at the top of the page. Under wxWidgets 2.6.3 downloads, select wxGTK. Save the file in <tt>~/devel</tt>.<br />
<br />
wxWidgets project has released two patches for 2.6.3 release. Click the "Patches" in the left side of the page. Download the Patch 2, either in zip or tar.gz format. Save the file in <tt>~/devel</tt><br />
<br />
====Uncompressing the wxGTK sources====<br />
<br />
After the download finishes, switch to <tt>~/devel</tt>:<br />
<br />
<pre>cd ~/devel</pre><br />
<br />
Now, untar the wxGTK sources:<br />
<br />
<pre>tar zxf wxGTK-2.6.3.tar.gz</pre><br />
<br />
Move the patch to the wxGTK directory<br />
<br />
<pre>mv wxWidgets-2.6.3-Patch-2.tar.gz wxGTK-2.6.3</pre><br />
<br />
or<br />
<br />
<pre>mv wxWidgets-2.6.3-Patch-2.zip wxGTK-2.6.3</pre><br />
<br />
Switch to the wxGTK directory<br />
<br />
<pre>cd wxGTK-2.6.3</pre><br />
<br />
Extract the patch<br />
<br />
<pre>tar zxf wxWidgets-2.6.3-Patch-2.tar.gz</pre><br />
<br />
or<br />
<br />
<pre>unzip -fo wxWidgets-2.6.3-Patch-2.zip</pre><br />
<br />
Remove the patch file<br />
<br />
<pre>rm wxWidgets-2.6.3-Patch-2.tar.gz</pre><br />
<br />
or<br />
<br />
<pre>rm wxWidgets-2.6.3-Patch-2.zip</pre><br />
<br />
====wxWidgets build====<br />
<br />
Here we will create a seperate build directory instead of building from the src directory, so that we can easily rebuild with different options (unicode / ansi, monolithic / many libs, etc).<br />
<br />
The documentation says the default is for gtk2 to use unicode and wx > 2.5 to build as a monolithic library. This doesn't appear to be the case, so these flags are passed to configure.<br />
<br />
mkdir build_gtk2_shared_monolithic_unicode<br />
cd build_gtk2_shared_monolithic_unicode<br />
../configure --prefix=/opt/wx/2.6 \<br />
--enable-xrc \<br />
--enable-monolithic \<br />
--enable-unicode<br />
make<br />
make -C contrib/src/stc<br />
su<br />
make install<br />
make -C contrib/src/stc install<br />
exit<br />
<br />
(Note: it's not necessary to make or install stc if you're compiling cvs HEAD or Code::Blocks newer than RC1)<br />
<br />
Add /opt/wx/2.6/bin to the PATH (if you're shell is bash then edit /etc/profile or ~/.bash_profile)<br />
(On Suse 10.1 edit /etc/profile.local, it will only be available after a new login). an example PATH<br />
export PATH=/usr/bin:/opt/wx/2.6/bin:$PATH<br />
<br />
'''Note:''' On Ubuntu Hoary it was necessary to check "Run command as login shell" <br />
in the gnome-terminal profile-settings, otherwise the PATH changes are not available in a gnome-terminal window.<br />
<br />
add /opt/wx/2.6/lib to /etc/ld.so.conf (nano /etc/ld.so.conf)<br />
then run:<br />
ldconfig<br />
source /etc/profile<br />
<br />
That's it. Now the linker will look in /opt/wx/2.6/lib for wx libraries and you will have a monolithic shared library unicode build.<br />
<br />
To check that things are working, type:<br />
wx-config --prefix<br />
which should give you /opt/wx/2.6<br />
wx-config --libs<br />
which should have at least<br />
-L/opt/wx/2.6/lib -lwx_gtk2-2.6<br />
but can contain other flags as well.<br />
which wx-config<br />
should return /opt/wx/2.6/bin/wx-config<br />
<br />
===Code::Blocks installation===<br />
<br />
====Downloading Code::Blocks====<br />
<br />
You can get Code::Blocks source code in one of two ways:<br />
* Download the latest source package, or<br />
* Get the latest sources from the SVN repository.<br />
Both methods, are described below.<br />
<br />
<br />
=====Downloading the latest source package=====<br />
<br />
Go to the Code::Blocks [https://www.codeblocks.org web site] and download the latest source package. This would be the " Code::Blocks IDE version 1.0rc2 source code (tarball)" codeblocks-1.0rc2.tar.gz.<br />
Save this file in <tt>~/devel</tt> and then untar it:<br />
<pre>cd ~/devel<br />
tar zxf codeblocks-1.0rc2.tar.gz</pre><br />
This will create the directory <tt>~/devel/codeblocks-1.0rc2</tt>.<br />
Change to the source code directory, by issuing the following command:<br />
<pre>cd codeblocks-1.0rc2</pre><br />
<br />
=====Getting the latest sources from SVN=====<br />
'''IMPORTANT NOTICE: The Sourceforge CVS is no longer used although it still exists'''<br />
<br />
Enter your development directory:<br />
<pre>cd ~/devel</pre><br />
<br />
Then checkout the source using one of [https://www.codeblocks.org/source_code.shtml these] methods.<br />
<br />
This will create the directory <tt>trunk</tt>.<br />
Change to the source code directory, by issuing the following command:<br />
<br />
<pre>cd trunk</pre><br />
<br />
====Building Code::Blocks RC2 and SVN====<br />
If you are a Gentoo user, please see [[Compiling_Code::Blocks_in_Gentoo]].<br />
<br />
Before beginning, it is often a good idea to check you have recent versions of autoconf and automake - repositories versions are not always recent enough.<br />
<br />
If you're compiling the svn trunk versions of CodeBlocks (or future versions) then the unix build has switched to autotools. So first build wxWidgets as described above and then build CodeBlocks as follows:<br />
<br />
./bootstrap<br />
<br />
This sets up the configure script and it's dependencies. It only needs to be run once (after downloading the source from svn). '''If you get errors like:'''<br />
aclocal:configure.in:61: warning: macro `AM_OPTIONS_WXCONFIG' not found in library<br />
Then aclocal is having trouble finding the wxWidgets .m4 files. You can do one of two things:<br />
To just get bootstrap to find the path this time do:<br />
<!-- *********** Bad syntax... removed 2006-08-28 by BentFX ****************************<br />
export ACLOCAL_FLAGS="--acdir=`wx-config --prefix`/share/aclocal"<br />
<br />
: Note: The above command resulted in missing macros when running ./bootstrap for me. Setting an additional search path instead of overwriting like above worked for me. In case of missing macros try <br />
***********************************************************************************--><br />
<pre>export ACLOCAL_FLAGS="-I `wx-config --prefix`/share/aclocal"</pre> <!--[[User:Jabber|Jabber]] 06:24, 2 August 2006 (EDT)--><br />
<br />
To change the aclocal search path more permanently do:<br />
echo `wx-config --prefix`/share/aclocal >> /usr/share/aclocal/dirlist<br />
Then aclocal will also search somewhere like /opt/wx/2.6/share/aclocal<br />
<br />
If you get something like<br />
The usual way to define `LIBTOOL' is to add `AC_PROG_LIBTOOL'<br />
<br />
it can be solved by something like: (adapt path, use `wx-config --prefix` is necessary)<br />
<br />
ACLOCAL_FLAGS="-I /usr/share/aclocal" ./bootstrap<br />
<br />
(*Note// '''If you run ./bootstrap and get errors like''':<br />
: bad interpreter: File not found<br />
then there exists a problem with DOS line-endings. i had this error after i tried to build a codeblocks from sources which were checked out with cvs on a windows machine. After i checked out a fresh copy of codeblocks from cvs under Ubuntu linux (see above topic: Downloading the latest source package fom SVN), all errors were gone. <br />
//tiwag 051008*)<br><br />
Or, instead of downloading from CVS, you might consider using the little command line tool dos2unix, which normally comes with most distributions. //lizzarddude060103<br />
<br><br />
If configure aborts with some unspecific error message(".infig.status: error: cannot find input file: Makefile"), you might consider also running<br />
dos2unix bootstrap acinclude.m4 codeblocks.pc.in configure.in Makefile.am<br />
before running bootstrap<br />
<br />
Once you've run the bootstrap script, installing is as simple as:<br />
./configure<br />
make<br />
make install<br />
<br />
To uninstall you can later run:<br />
make uninstall<br />
<br />
If you want to recompile everything, first run:<br />
make clean<br />
make distclean<br />
make clean-bin<br />
make clean-zipfiles<br />
and then follow the above sequence for installing.<br />
<br />
By default, CodeBlocks will install to /usr/local. If you want it in its own tree (so you can have multiple versions of CodeBlocks, each in its own subdirectory of /opt) replace the above ./configure command with:<br />
./configure --prefix=/opt/codeblocks-svn<br />
or similar. Then you can later install a different build like:<br />
./configure --prefix=/opt/codeblocks2-svn<br />
followed by 'make && make install' as usual.<br />
<br />
By default, CodeBlocks will not compile the contributed plugins from SVN. If you want to compile / install them too, replace the above ./configure command with:<br />
./configure --enable-contrib<br />
followed by 'make && make install' as usual.<br />
<br />
To see a list of other options available for configuring the build of CodeBlocks do:<br />
./configure --help<br />
<br />
To compile under gentoo, use<br />
./configure --with-wx-config=wx-config-2.6<br />
<br />
====Building Code::Blocks RC1 and former====<br />
<br />
To build Code::Blocks all you have to do now is type:<br />
<br />
<pre>make -f Makefile.unix</pre><br />
<br />
This will build everything: the application and the plugins. The final step is to update the working environment for your system:<br />
<br />
<pre>make -f Makefile.unix update</pre><br />
<br />
The following notes about converting the line endings does '''not''' apply to the CVS Version! The "update" script included there works just fine.<br />
<br />
'''Important note:''' Don't run that final make yet! 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:<br />
<br />
To install it in Gentoo, do:<br />
<br />
# emerge -av dos2unix<br />
<br />
In Debian and Ubuntu, do (as root, or using sudo etc.):<br />
<br />
# apt-get install sysutils<br />
<br />
This will install dos2unix. Now we are ready to convert the script.<br />
# dos2unix -n update update.unix<br />
# chmod +x update.unix<br />
# ./update.unix<br />
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.<br />
<br />
OK. Now that the update script is converted to unix format, you can run the final make:<br />
<br />
<pre>make -f Makefile.unix update</pre><br />
<br />
If everything's gone well, congratulations! You should be able to launch Code::Blocks by running the generated <tt>run.sh</tt> script in the <tt>output</tt> subdir:<br />
<br />
<pre>output/run.sh</pre><br />
<br />
This script can be ran from anywhere in your system so, yes, you can make a shortcut to it on your desktop ;)<br />
<br />
Enjoy!</div>Auriahttps://wiki.codeblocks.org/index.php?title=Installing_Code::Blocks_from_source_on_Linux&diff=4454Installing Code::Blocks from source on Linux2007-02-22T00:44:18Z<p>Auria: /* Building Code::Blocks RC2 and SVN */</p>
<hr />
<div>[[Category:Installing Code::Blocks]]<br />
[[Category:Installing Code::Blocks from source]]<br />
These are instructions on how to build Code::Blocks under Linux. I 've ran and verified this procedure to work under SuSE 9.2 and Fedora Core 3. These instructions should work for all Linux distros, as we 'll be installing from sources.<br />
<br />
===Prerequisites===<br />
<br />
In order to sucesfully compile Code::Blocks, the wxWidgets (<u>wxGTK-2.6.1 or later</u>) cross-platform UI library <u>must be installed</u>. In this document, it is not assumed that it is already installed in your system and instructions are given on how to download, build and install it.<br />
What is '''not''' covered here, is the wxWidgets prerequisites. The most important being GTK2, of course!<br />
Let me stress it here, while it's early: <u>GTK2 is required</u>, not GTK1, for Code::Blocks to be operational.<br />
<br />
You do not need to Compile wxWidgets if your distribution has wxGTK 2.6 and wxGTK 2.6-dev package available. A quick search for "wxGTK" through your respective package manager should show bring up the needed packages. After you have installed successfully you can moving on the the Installing Code::Blocks portion. If you are using Ubuntu and have installed the wxGTK package, you must also have the dev version as well as the "wx-common" package in order to successfully compile Code::Blocks.<br />
<br />
All the instructions below, assume an existing directory named <tt>~/devel</tt>. If you 'll be using a different one, adjust the path to match.<br />
As a first step create this directory:<br />
<br />
<pre>mkdir ~/devel</pre><br />
<br />
===wxGTK installation===<br />
<br />
====Getting wxGTK====<br />
<br />
Visit the [http://www.wxwidgets.org wxWidgets web site]. Click the "Download" button at the top of the page. Under wxWidgets 2.6.3 downloads, select wxGTK. Save the file in <tt>~/devel</tt>.<br />
<br />
wxWidgets project has released two patches for 2.6.3 release. Click the "Patches" in the left side of the page. Download the Patch 2, either in zip or tar.gz format. Save the file in <tt>~/devel</tt><br />
<br />
====Uncompressing the wxGTK sources====<br />
<br />
After the download finishes, switch to <tt>~/devel</tt>:<br />
<br />
<pre>cd ~/devel</pre><br />
<br />
Now, untar the wxGTK sources:<br />
<br />
<pre>tar zxf wxGTK-2.6.3.tar.gz</pre><br />
<br />
Move the patch to the wxGTK directory<br />
<br />
<pre>mv wxWidgets-2.6.3-Patch-2.tar.gz wxGTK-2.6.3</pre><br />
<br />
or<br />
<br />
<pre>mv wxWidgets-2.6.3-Patch-2.zip wxGTK-2.6.3</pre><br />
<br />
Switch to the wxGTK directory<br />
<br />
<pre>cd wxGTK-2.6.3</pre><br />
<br />
Extract the patch<br />
<br />
<pre>tar zxf wxWidgets-2.6.3-Patch-2.tar.gz</pre><br />
<br />
or<br />
<br />
<pre>unzip -fo wxWidgets-2.6.3-Patch-2.zip</pre><br />
<br />
Remove the patch file<br />
<br />
<pre>rm wxWidgets-2.6.3-Patch-2.tar.gz</pre><br />
<br />
or<br />
<br />
<pre>rm wxWidgets-2.6.3-Patch-2.zip</pre><br />
<br />
====wxWidgets build====<br />
<br />
Here we will create a seperate build directory instead of building from the src directory, so that we can easily rebuild with different options (unicode / ansi, monolithic / many libs, etc).<br />
<br />
The documentation says the default is for gtk2 to use unicode and wx > 2.5 to build as a monolithic library. This doesn't appear to be the case, so these flags are passed to configure.<br />
<br />
mkdir build_gtk2_shared_monolithic_unicode<br />
cd build_gtk2_shared_monolithic_unicode<br />
../configure --prefix=/opt/wx/2.6 \<br />
--enable-xrc \<br />
--enable-monolithic \<br />
--enable-unicode<br />
make<br />
make -C contrib/src/stc<br />
su<br />
make install<br />
make -C contrib/src/stc install<br />
exit<br />
<br />
(Note: it's not necessary to make or install stc if you're compiling cvs HEAD or Code::Blocks newer than RC1)<br />
<br />
Add /opt/wx/2.6/bin to the PATH (if you're shell is bash then edit /etc/profile or ~/.bash_profile)<br />
(On Suse 10.1 edit /etc/profile.local, it will only be available after a new login). an example PATH<br />
export PATH=/usr/bin:/opt/wx/2.6/bin:$PATH<br />
<br />
'''Note:''' On Ubuntu Hoary it was necessary to check "Run command as login shell" <br />
in the gnome-terminal profile-settings, otherwise the PATH changes are not available in a gnome-terminal window.<br />
<br />
add /opt/wx/2.6/lib to /etc/ld.so.conf (nano /etc/ld.so.conf)<br />
then run:<br />
ldconfig<br />
source /etc/profile<br />
<br />
That's it. Now the linker will look in /opt/wx/2.6/lib for wx libraries and you will have a monolithic shared library unicode build.<br />
<br />
To check that things are working, type:<br />
wx-config --prefix<br />
which should give you /opt/wx/2.6<br />
wx-config --libs<br />
which should have at least<br />
-L/opt/wx/2.6/lib -lwx_gtk2-2.6<br />
but can contain other flags as well.<br />
which wx-config<br />
should return /opt/wx/2.6/bin/wx-config<br />
<br />
===Code::Blocks installation===<br />
<br />
====Downloading Code::Blocks====<br />
<br />
You can get Code::Blocks source code in one of two ways:<br />
* Download the latest source package, or<br />
* Get the latest sources from the SVN repository.<br />
Both methods, are described below.<br />
<br />
<br />
=====Downloading the latest source package=====<br />
<br />
Go to the Code::Blocks [https://www.codeblocks.org web site] and download the latest source package. This would be the " Code::Blocks IDE version 1.0rc2 source code (tarball)" codeblocks-1.0rc2.tar.gz.<br />
Save this file in <tt>~/devel</tt> and then untar it:<br />
<pre>cd ~/devel<br />
tar zxf codeblocks-1.0rc2.tar.gz</pre><br />
This will create the directory <tt>~/devel/codeblocks-1.0rc2</tt>.<br />
Change to the source code directory, by issuing the following command:<br />
<pre>cd codeblocks-1.0rc2</pre><br />
<br />
=====Getting the latest sources from SVN=====<br />
'''IMPORTANT NOTICE: The Sourceforge CVS is no longer used although it still exists'''<br />
<br />
Enter your development directory:<br />
<pre>cd ~/devel</pre><br />
<br />
Then checkout the source using one of [https://www.codeblocks.org/source_code.shtml these] methods.<br />
<br />
This will create the directory <tt>trunk</tt>.<br />
Change to the source code directory, by issuing the following command:<br />
<br />
<pre>cd trunk</pre><br />
<br />
====Building Code::Blocks RC2 and SVN====<br />
If you are a Gentoo user, please see [[Compiling_Code::Blocks_in_Gentoo]].<br />
<br />
Before beginning, it is often a good idea to check you have recent versions of autoconf and automake - repositories versions are not always recent enough.<br />
<br />
If you're compiling the svn trunk versions of CodeBlocks (or future versions) then the unix build has switched to autotools. So first build wxWidgets as described above and then build CodeBlocks as follows:<br />
<br />
./bootstrap<br />
<br />
This sets up the configure script and it's dependencies. It only needs to be run once (after downloading the source from svn). '''If you get errors like:'''<br />
aclocal:configure.in:61: warning: macro `AM_OPTIONS_WXCONFIG' not found in library<br />
Then aclocal is having trouble finding the wxWidgets .m4 files. You can do one of two things:<br />
To just get bootstrap to find the path this time do:<br />
<!-- *********** Bad syntax... removed 2006-08-28 by BentFX ****************************<br />
export ACLOCAL_FLAGS="--acdir=`wx-config --prefix`/share/aclocal"<br />
<br />
: Note: The above command resulted in missing macros when running ./bootstrap for me. Setting an additional search path instead of overwriting like above worked for me. In case of missing macros try <br />
***********************************************************************************--><br />
<pre>export ACLOCAL_FLAGS="-I `wx-config --prefix`/share/aclocal"</pre> <!--[[User:Jabber|Jabber]] 06:24, 2 August 2006 (EDT)--><br />
<br />
To change the aclocal search path more permanently do:<br />
echo `wx-config --prefix`/share/aclocal >> /usr/share/aclocal/dirlist<br />
Then aclocal will also search somewhere like /opt/wx/2.6/share/aclocal<br />
<br />
If you get something like<br />
The usual way to define `LIBTOOL' is to add `AC_PROG_LIBTOOL'<br />
<br />
it can be solved by something like:<br />
<br />
ACLOCAL_FLAGS="-I /usr/share/aclocal" ./bootstrap<br />
<br />
(*Note// '''If you run ./bootstrap and get errors like''':<br />
: bad interpreter: File not found<br />
then there exists a problem with DOS line-endings. i had this error after i tried to build a codeblocks from sources which were checked out with cvs on a windows machine. After i checked out a fresh copy of codeblocks from cvs under Ubuntu linux (see above topic: Downloading the latest source package fom SVN), all errors were gone. <br />
//tiwag 051008*)<br><br />
Or, instead of downloading from CVS, you might consider using the little command line tool dos2unix, which normally comes with most distributions. //lizzarddude060103<br />
<br><br />
If configure aborts with some unspecific error message(".infig.status: error: cannot find input file: Makefile"), you might consider also running<br />
dos2unix bootstrap acinclude.m4 codeblocks.pc.in configure.in Makefile.am<br />
before running bootstrap<br />
<br />
Once you've run the bootstrap script, installing is as simple as:<br />
./configure<br />
make<br />
make install<br />
<br />
To uninstall you can later run:<br />
make uninstall<br />
<br />
If you want to recompile everything, first run:<br />
make clean<br />
make distclean<br />
make clean-bin<br />
make clean-zipfiles<br />
and then follow the above sequence for installing.<br />
<br />
By default, CodeBlocks will install to /usr/local. If you want it in its own tree (so you can have multiple versions of CodeBlocks, each in its own subdirectory of /opt) replace the above ./configure command with:<br />
./configure --prefix=/opt/codeblocks-svn<br />
or similar. Then you can later install a different build like:<br />
./configure --prefix=/opt/codeblocks2-svn<br />
followed by 'make && make install' as usual.<br />
<br />
By default, CodeBlocks will not compile the contributed plugins from SVN. If you want to compile / install them too, replace the above ./configure command with:<br />
./configure --enable-contrib<br />
followed by 'make && make install' as usual.<br />
<br />
To see a list of other options available for configuring the build of CodeBlocks do:<br />
./configure --help<br />
<br />
To compile under gentoo, use<br />
./configure --with-wx-config=wx-config-2.6<br />
<br />
====Building Code::Blocks RC1 and former====<br />
<br />
To build Code::Blocks all you have to do now is type:<br />
<br />
<pre>make -f Makefile.unix</pre><br />
<br />
This will build everything: the application and the plugins. The final step is to update the working environment for your system:<br />
<br />
<pre>make -f Makefile.unix update</pre><br />
<br />
The following notes about converting the line endings does '''not''' apply to the CVS Version! The "update" script included there works just fine.<br />
<br />
'''Important note:''' Don't run that final make yet! 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:<br />
<br />
To install it in Gentoo, do:<br />
<br />
# emerge -av dos2unix<br />
<br />
In Debian and Ubuntu, do (as root, or using sudo etc.):<br />
<br />
# apt-get install sysutils<br />
<br />
This will install dos2unix. Now we are ready to convert the script.<br />
# dos2unix -n update update.unix<br />
# chmod +x update.unix<br />
# ./update.unix<br />
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.<br />
<br />
OK. Now that the update script is converted to unix format, you can run the final make:<br />
<br />
<pre>make -f Makefile.unix update</pre><br />
<br />
If everything's gone well, congratulations! You should be able to launch Code::Blocks by running the generated <tt>run.sh</tt> script in the <tt>output</tt> subdir:<br />
<br />
<pre>output/run.sh</pre><br />
<br />
This script can be ran from anywhere in your system so, yes, you can make a shortcut to it on your desktop ;)<br />
<br />
Enjoy!</div>Auriahttps://wiki.codeblocks.org/index.php?title=Installing_Code::Blocks_from_source_on_Linux&diff=4453Installing Code::Blocks from source on Linux2007-02-20T14:17:59Z<p>Auria: /* Building Code::Blocks RC2 and SVN */</p>
<hr />
<div>[[Category:Installing Code::Blocks]]<br />
[[Category:Installing Code::Blocks from source]]<br />
These are instructions on how to build Code::Blocks under Linux. I 've ran and verified this procedure to work under SuSE 9.2 and Fedora Core 3. These instructions should work for all Linux distros, as we 'll be installing from sources.<br />
<br />
===Prerequisites===<br />
<br />
In order to sucesfully compile Code::Blocks, the wxWidgets (<u>wxGTK-2.6.1 or later</u>) cross-platform UI library <u>must be installed</u>. In this document, it is not assumed that it is already installed in your system and instructions are given on how to download, build and install it.<br />
What is '''not''' covered here, is the wxWidgets prerequisites. The most important being GTK2, of course!<br />
Let me stress it here, while it's early: <u>GTK2 is required</u>, not GTK1, for Code::Blocks to be operational.<br />
<br />
You do not need to Compile wxWidgets if your distribution has wxGTK 2.6 and wxGTK 2.6-dev package available. A quick search for "wxGTK" through your respective package manager should show bring up the needed packages. After you have installed successfully you can moving on the the Installing Code::Blocks portion. If you are using Ubuntu and have installed the wxGTK package, you must also have the dev version as well as the "wx-common" package in order to successfully compile Code::Blocks.<br />
<br />
All the instructions below, assume an existing directory named <tt>~/devel</tt>. If you 'll be using a different one, adjust the path to match.<br />
As a first step create this directory:<br />
<br />
<pre>mkdir ~/devel</pre><br />
<br />
===wxGTK installation===<br />
<br />
====Getting wxGTK====<br />
<br />
Visit the [http://www.wxwidgets.org wxWidgets web site]. Click the "Download" button at the top of the page. Under wxWidgets 2.6.3 downloads, select wxGTK. Save the file in <tt>~/devel</tt>.<br />
<br />
wxWidgets project has released two patches for 2.6.3 release. Click the "Patches" in the left side of the page. Download the Patch 2, either in zip or tar.gz format. Save the file in <tt>~/devel</tt><br />
<br />
====Uncompressing the wxGTK sources====<br />
<br />
After the download finishes, switch to <tt>~/devel</tt>:<br />
<br />
<pre>cd ~/devel</pre><br />
<br />
Now, untar the wxGTK sources:<br />
<br />
<pre>tar zxf wxGTK-2.6.3.tar.gz</pre><br />
<br />
Move the patch to the wxGTK directory<br />
<br />
<pre>mv wxWidgets-2.6.3-Patch-2.tar.gz wxGTK-2.6.3</pre><br />
<br />
or<br />
<br />
<pre>mv wxWidgets-2.6.3-Patch-2.zip wxGTK-2.6.3</pre><br />
<br />
Switch to the wxGTK directory<br />
<br />
<pre>cd wxGTK-2.6.3</pre><br />
<br />
Extract the patch<br />
<br />
<pre>tar zxf wxWidgets-2.6.3-Patch-2.tar.gz</pre><br />
<br />
or<br />
<br />
<pre>unzip -fo wxWidgets-2.6.3-Patch-2.zip</pre><br />
<br />
Remove the patch file<br />
<br />
<pre>rm wxWidgets-2.6.3-Patch-2.tar.gz</pre><br />
<br />
or<br />
<br />
<pre>rm wxWidgets-2.6.3-Patch-2.zip</pre><br />
<br />
====wxWidgets build====<br />
<br />
Here we will create a seperate build directory instead of building from the src directory, so that we can easily rebuild with different options (unicode / ansi, monolithic / many libs, etc).<br />
<br />
The documentation says the default is for gtk2 to use unicode and wx > 2.5 to build as a monolithic library. This doesn't appear to be the case, so these flags are passed to configure.<br />
<br />
mkdir build_gtk2_shared_monolithic_unicode<br />
cd build_gtk2_shared_monolithic_unicode<br />
../configure --prefix=/opt/wx/2.6 \<br />
--enable-xrc \<br />
--enable-monolithic \<br />
--enable-unicode<br />
make<br />
make -C contrib/src/stc<br />
su<br />
make install<br />
make -C contrib/src/stc install<br />
exit<br />
<br />
(Note: it's not necessary to make or install stc if you're compiling cvs HEAD or Code::Blocks newer than RC1)<br />
<br />
Add /opt/wx/2.6/bin to the PATH (if you're shell is bash then edit /etc/profile or ~/.bash_profile)<br />
(On Suse 10.1 edit /etc/profile.local, it will only be available after a new login). an example PATH<br />
export PATH=/usr/bin:/opt/wx/2.6/bin:$PATH<br />
<br />
'''Note:''' On Ubuntu Hoary it was necessary to check "Run command as login shell" <br />
in the gnome-terminal profile-settings, otherwise the PATH changes are not available in a gnome-terminal window.<br />
<br />
add /opt/wx/2.6/lib to /etc/ld.so.conf (nano /etc/ld.so.conf)<br />
then run:<br />
ldconfig<br />
source /etc/profile<br />
<br />
That's it. Now the linker will look in /opt/wx/2.6/lib for wx libraries and you will have a monolithic shared library unicode build.<br />
<br />
To check that things are working, type:<br />
wx-config --prefix<br />
which should give you /opt/wx/2.6<br />
wx-config --libs<br />
which should have at least<br />
-L/opt/wx/2.6/lib -lwx_gtk2-2.6<br />
but can contain other flags as well.<br />
which wx-config<br />
should return /opt/wx/2.6/bin/wx-config<br />
<br />
===Code::Blocks installation===<br />
<br />
====Downloading Code::Blocks====<br />
<br />
You can get Code::Blocks source code in one of two ways:<br />
* Download the latest source package, or<br />
* Get the latest sources from the SVN repository.<br />
Both methods, are described below.<br />
<br />
<br />
=====Downloading the latest source package=====<br />
<br />
Go to the Code::Blocks [https://www.codeblocks.org web site] and download the latest source package. This would be the " Code::Blocks IDE version 1.0rc2 source code (tarball)" codeblocks-1.0rc2.tar.gz.<br />
Save this file in <tt>~/devel</tt> and then untar it:<br />
<pre>cd ~/devel<br />
tar zxf codeblocks-1.0rc2.tar.gz</pre><br />
This will create the directory <tt>~/devel/codeblocks-1.0rc2</tt>.<br />
Change to the source code directory, by issuing the following command:<br />
<pre>cd codeblocks-1.0rc2</pre><br />
<br />
=====Getting the latest sources from SVN=====<br />
'''IMPORTANT NOTICE: The Sourceforge CVS is no longer used although it still exists'''<br />
<br />
Enter your development directory:<br />
<pre>cd ~/devel</pre><br />
<br />
Then checkout the source using one of [https://www.codeblocks.org/source_code.shtml these] methods.<br />
<br />
This will create the directory <tt>trunk</tt>.<br />
Change to the source code directory, by issuing the following command:<br />
<br />
<pre>cd trunk</pre><br />
<br />
====Building Code::Blocks RC2 and SVN====<br />
If you are a Gentoo user, please see [[Compiling_Code::Blocks_in_Gentoo]].<br />
<br />
Before beginning, it is often a good idea to check you have recent versions of autoconf and automake - repositories versions are not always recent enough.<br />
<br />
If you're compiling the svn trunk versions of CodeBlocks (or future versions) then the unix build has switched to autotools. So first build wxWidgets as described above and then build CodeBlocks as follows:<br />
<br />
./bootstrap<br />
<br />
This sets up the configure script and it's dependencies. It only needs to be run once (after downloading the source from svn). '''If you get errors like:'''<br />
aclocal:configure.in:61: warning: macro `AM_OPTIONS_WXCONFIG' not found in library<br />
Then aclocal is having trouble finding the wxWidgets .m4 files. You can do one of two things:<br />
To just get bootstrap to find the path this time do:<br />
<!-- *********** Bad syntax... removed 2006-08-28 by BentFX ****************************<br />
export ACLOCAL_FLAGS="--acdir=`wx-config --prefix`/share/aclocal"<br />
<br />
: Note: The above command resulted in missing macros when running ./bootstrap for me. Setting an additional search path instead of overwriting like above worked for me. In case of missing macros try <br />
***********************************************************************************--><br />
<pre>export ACLOCAL_FLAGS="-I `wx-config --prefix`/share/aclocal"</pre> <!--[[User:Jabber|Jabber]] 06:24, 2 August 2006 (EDT)--><br />
<br />
To change the aclocal search path more permanently do:<br />
echo `wx-config --prefix`/share/aclocal >> /usr/share/aclocal/dirlist<br />
Then aclocal will also search somewhere like /opt/wx/2.6/share/aclocal<br />
<br />
Note: the same procedure will also fix<br />
The usual way to define `LIBTOOL' is to add `AC_PROG_LIBTOOL'<br />
<br />
(*Note// '''If you run ./bootstrap and get errors like''':<br />
: bad interpreter: File not found<br />
then there exists a problem with DOS line-endings. i had this error after i tried to build a codeblocks from sources which were checked out with cvs on a windows machine. After i checked out a fresh copy of codeblocks from cvs under Ubuntu linux (see above topic: Downloading the latest source package fom SVN), all errors were gone. <br />
//tiwag 051008*)<br><br />
Or, instead of downloading from CVS, you might consider using the little command line tool dos2unix, which normally comes with most distributions. //lizzarddude060103<br />
<br><br />
If configure aborts with some unspecific error message(".infig.status: error: cannot find input file: Makefile"), you might consider also running<br />
dos2unix bootstrap acinclude.m4 codeblocks.pc.in configure.in Makefile.am<br />
before running bootstrap<br />
<br />
Once you've run the bootstrap script, installing is as simple as:<br />
./configure<br />
make<br />
make install<br />
<br />
To uninstall you can later run:<br />
make uninstall<br />
<br />
If you want to recompile everything, first run:<br />
make clean<br />
make distclean<br />
make clean-bin<br />
make clean-zipfiles<br />
and then follow the above sequence for installing.<br />
<br />
By default, CodeBlocks will install to /usr/local. If you want it in its own tree (so you can have multiple versions of CodeBlocks, each in its own subdirectory of /opt) replace the above ./configure command with:<br />
./configure --prefix=/opt/codeblocks-svn<br />
or similar. Then you can later install a different build like:<br />
./configure --prefix=/opt/codeblocks2-svn<br />
followed by 'make && make install' as usual.<br />
<br />
By default, CodeBlocks will not compile the contributed plugins from SVN. If you want to compile / install them too, replace the above ./configure command with:<br />
./configure --enable-contrib<br />
followed by 'make && make install' as usual.<br />
<br />
To see a list of other options available for configuring the build of CodeBlocks do:<br />
./configure --help<br />
<br />
To compile under gentoo, use<br />
./configure --with-wx-config=wx-config-2.6<br />
<br />
====Building Code::Blocks RC1 and former====<br />
<br />
To build Code::Blocks all you have to do now is type:<br />
<br />
<pre>make -f Makefile.unix</pre><br />
<br />
This will build everything: the application and the plugins. The final step is to update the working environment for your system:<br />
<br />
<pre>make -f Makefile.unix update</pre><br />
<br />
The following notes about converting the line endings does '''not''' apply to the CVS Version! The "update" script included there works just fine.<br />
<br />
'''Important note:''' Don't run that final make yet! 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:<br />
<br />
To install it in Gentoo, do:<br />
<br />
# emerge -av dos2unix<br />
<br />
In Debian and Ubuntu, do (as root, or using sudo etc.):<br />
<br />
# apt-get install sysutils<br />
<br />
This will install dos2unix. Now we are ready to convert the script.<br />
# dos2unix -n update update.unix<br />
# chmod +x update.unix<br />
# ./update.unix<br />
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.<br />
<br />
OK. Now that the update script is converted to unix format, you can run the final make:<br />
<br />
<pre>make -f Makefile.unix update</pre><br />
<br />
If everything's gone well, congratulations! You should be able to launch Code::Blocks by running the generated <tt>run.sh</tt> script in the <tt>output</tt> subdir:<br />
<br />
<pre>output/run.sh</pre><br />
<br />
This script can be ran from anywhere in your system so, yes, you can make a shortcut to it on your desktop ;)<br />
<br />
Enjoy!</div>Auriahttps://wiki.codeblocks.org/index.php?title=Installing_Code::Blocks_from_source_on_Linux&diff=4452Installing Code::Blocks from source on Linux2007-02-20T14:04:11Z<p>Auria: /* Building Code::Blocks RC2 and SVN */</p>
<hr />
<div>[[Category:Installing Code::Blocks]]<br />
[[Category:Installing Code::Blocks from source]]<br />
These are instructions on how to build Code::Blocks under Linux. I 've ran and verified this procedure to work under SuSE 9.2 and Fedora Core 3. These instructions should work for all Linux distros, as we 'll be installing from sources.<br />
<br />
===Prerequisites===<br />
<br />
In order to sucesfully compile Code::Blocks, the wxWidgets (<u>wxGTK-2.6.1 or later</u>) cross-platform UI library <u>must be installed</u>. In this document, it is not assumed that it is already installed in your system and instructions are given on how to download, build and install it.<br />
What is '''not''' covered here, is the wxWidgets prerequisites. The most important being GTK2, of course!<br />
Let me stress it here, while it's early: <u>GTK2 is required</u>, not GTK1, for Code::Blocks to be operational.<br />
<br />
You do not need to Compile wxWidgets if your distribution has wxGTK 2.6 and wxGTK 2.6-dev package available. A quick search for "wxGTK" through your respective package manager should show bring up the needed packages. After you have installed successfully you can moving on the the Installing Code::Blocks portion. If you are using Ubuntu and have installed the wxGTK package, you must also have the dev version as well as the "wx-common" package in order to successfully compile Code::Blocks.<br />
<br />
All the instructions below, assume an existing directory named <tt>~/devel</tt>. If you 'll be using a different one, adjust the path to match.<br />
As a first step create this directory:<br />
<br />
<pre>mkdir ~/devel</pre><br />
<br />
===wxGTK installation===<br />
<br />
====Getting wxGTK====<br />
<br />
Visit the [http://www.wxwidgets.org wxWidgets web site]. Click the "Download" button at the top of the page. Under wxWidgets 2.6.3 downloads, select wxGTK. Save the file in <tt>~/devel</tt>.<br />
<br />
wxWidgets project has released two patches for 2.6.3 release. Click the "Patches" in the left side of the page. Download the Patch 2, either in zip or tar.gz format. Save the file in <tt>~/devel</tt><br />
<br />
====Uncompressing the wxGTK sources====<br />
<br />
After the download finishes, switch to <tt>~/devel</tt>:<br />
<br />
<pre>cd ~/devel</pre><br />
<br />
Now, untar the wxGTK sources:<br />
<br />
<pre>tar zxf wxGTK-2.6.3.tar.gz</pre><br />
<br />
Move the patch to the wxGTK directory<br />
<br />
<pre>mv wxWidgets-2.6.3-Patch-2.tar.gz wxGTK-2.6.3</pre><br />
<br />
or<br />
<br />
<pre>mv wxWidgets-2.6.3-Patch-2.zip wxGTK-2.6.3</pre><br />
<br />
Switch to the wxGTK directory<br />
<br />
<pre>cd wxGTK-2.6.3</pre><br />
<br />
Extract the patch<br />
<br />
<pre>tar zxf wxWidgets-2.6.3-Patch-2.tar.gz</pre><br />
<br />
or<br />
<br />
<pre>unzip -fo wxWidgets-2.6.3-Patch-2.zip</pre><br />
<br />
Remove the patch file<br />
<br />
<pre>rm wxWidgets-2.6.3-Patch-2.tar.gz</pre><br />
<br />
or<br />
<br />
<pre>rm wxWidgets-2.6.3-Patch-2.zip</pre><br />
<br />
====wxWidgets build====<br />
<br />
Here we will create a seperate build directory instead of building from the src directory, so that we can easily rebuild with different options (unicode / ansi, monolithic / many libs, etc).<br />
<br />
The documentation says the default is for gtk2 to use unicode and wx > 2.5 to build as a monolithic library. This doesn't appear to be the case, so these flags are passed to configure.<br />
<br />
mkdir build_gtk2_shared_monolithic_unicode<br />
cd build_gtk2_shared_monolithic_unicode<br />
../configure --prefix=/opt/wx/2.6 \<br />
--enable-xrc \<br />
--enable-monolithic \<br />
--enable-unicode<br />
make<br />
make -C contrib/src/stc<br />
su<br />
make install<br />
make -C contrib/src/stc install<br />
exit<br />
<br />
(Note: it's not necessary to make or install stc if you're compiling cvs HEAD or Code::Blocks newer than RC1)<br />
<br />
Add /opt/wx/2.6/bin to the PATH (if you're shell is bash then edit /etc/profile or ~/.bash_profile)<br />
(On Suse 10.1 edit /etc/profile.local, it will only be available after a new login). an example PATH<br />
export PATH=/usr/bin:/opt/wx/2.6/bin:$PATH<br />
<br />
'''Note:''' On Ubuntu Hoary it was necessary to check "Run command as login shell" <br />
in the gnome-terminal profile-settings, otherwise the PATH changes are not available in a gnome-terminal window.<br />
<br />
add /opt/wx/2.6/lib to /etc/ld.so.conf (nano /etc/ld.so.conf)<br />
then run:<br />
ldconfig<br />
source /etc/profile<br />
<br />
That's it. Now the linker will look in /opt/wx/2.6/lib for wx libraries and you will have a monolithic shared library unicode build.<br />
<br />
To check that things are working, type:<br />
wx-config --prefix<br />
which should give you /opt/wx/2.6<br />
wx-config --libs<br />
which should have at least<br />
-L/opt/wx/2.6/lib -lwx_gtk2-2.6<br />
but can contain other flags as well.<br />
which wx-config<br />
should return /opt/wx/2.6/bin/wx-config<br />
<br />
===Code::Blocks installation===<br />
<br />
====Downloading Code::Blocks====<br />
<br />
You can get Code::Blocks source code in one of two ways:<br />
* Download the latest source package, or<br />
* Get the latest sources from the SVN repository.<br />
Both methods, are described below.<br />
<br />
<br />
=====Downloading the latest source package=====<br />
<br />
Go to the Code::Blocks [https://www.codeblocks.org web site] and download the latest source package. This would be the " Code::Blocks IDE version 1.0rc2 source code (tarball)" codeblocks-1.0rc2.tar.gz.<br />
Save this file in <tt>~/devel</tt> and then untar it:<br />
<pre>cd ~/devel<br />
tar zxf codeblocks-1.0rc2.tar.gz</pre><br />
This will create the directory <tt>~/devel/codeblocks-1.0rc2</tt>.<br />
Change to the source code directory, by issuing the following command:<br />
<pre>cd codeblocks-1.0rc2</pre><br />
<br />
=====Getting the latest sources from SVN=====<br />
'''IMPORTANT NOTICE: The Sourceforge CVS is no longer used although it still exists'''<br />
<br />
Enter your development directory:<br />
<pre>cd ~/devel</pre><br />
<br />
Then checkout the source using one of [https://www.codeblocks.org/source_code.shtml these] methods.<br />
<br />
This will create the directory <tt>trunk</tt>.<br />
Change to the source code directory, by issuing the following command:<br />
<br />
<pre>cd trunk</pre><br />
<br />
====Building Code::Blocks RC2 and SVN====<br />
If you are a Gentoo user, please see [[Compiling_Code::Blocks_in_Gentoo]].<br />
<br />
If you're compiling the svn trunk versions of CodeBlocks (or future versions) then the unix build has switched to autotools. So first build wxWidgets as described above and then build CodeBlocks as follows:<br />
<br />
./bootstrap<br />
<br />
This sets up the configure script and it's dependencies. It only needs to be run once (after downloading the source from svn). '''If you get errors like:'''<br />
aclocal:configure.in:61: warning: macro `AM_OPTIONS_WXCONFIG' not found in library<br />
Then aclocal is having trouble finding the wxWidgets .m4 files. You can do one of two things:<br />
To just get bootstrap to find the path this time do:<br />
<!-- *********** Bad syntax... removed 2006-08-28 by BentFX ****************************<br />
export ACLOCAL_FLAGS="--acdir=`wx-config --prefix`/share/aclocal"<br />
<br />
: Note: The above command resulted in missing macros when running ./bootstrap for me. Setting an additional search path instead of overwriting like above worked for me. In case of missing macros try <br />
***********************************************************************************--><br />
<pre>export ACLOCAL_FLAGS="-I `wx-config --prefix`/share/aclocal"</pre> <!--[[User:Jabber|Jabber]] 06:24, 2 August 2006 (EDT)--><br />
<br />
To change the aclocal search path more permanently do:<br />
echo `wx-config --prefix`/share/aclocal >> /usr/share/aclocal/dirlist<br />
Then aclocal will also search somewhere like /opt/wx/2.6/share/aclocal<br />
<br />
Note: the same procedure will also fix<br />
The usual way to define `LIBTOOL' is to add `AC_PROG_LIBTOOL'<br />
<br />
(*Note// '''If you run ./bootstrap and get errors like''':<br />
: bad interpreter: File not found<br />
then there exists a problem with DOS line-endings. i had this error after i tried to build a codeblocks from sources which were checked out with cvs on a windows machine. After i checked out a fresh copy of codeblocks from cvs under Ubuntu linux (see above topic: Downloading the latest source package fom SVN), all errors were gone. <br />
//tiwag 051008*)<br><br />
Or, instead of downloading from CVS, you might consider using the little command line tool dos2unix, which normally comes with most distributions. //lizzarddude060103<br />
<br><br />
If configure aborts with some unspecific error message(".infig.status: error: cannot find input file: Makefile"), you might consider also running<br />
dos2unix bootstrap acinclude.m4 codeblocks.pc.in configure.in Makefile.am<br />
before running bootstrap<br />
<br />
Once you've run the bootstrap script, installing is as simple as:<br />
./configure<br />
make<br />
make install<br />
<br />
To uninstall you can later run:<br />
make uninstall<br />
<br />
If you want to recompile everything, first run:<br />
make clean<br />
make distclean<br />
make clean-bin<br />
make clean-zipfiles<br />
and then follow the above sequence for installing.<br />
<br />
By default, CodeBlocks will install to /usr/local. If you want it in its own tree (so you can have multiple versions of CodeBlocks, each in its own subdirectory of /opt) replace the above ./configure command with:<br />
./configure --prefix=/opt/codeblocks-svn<br />
or similar. Then you can later install a different build like:<br />
./configure --prefix=/opt/codeblocks2-svn<br />
followed by 'make && make install' as usual.<br />
<br />
By default, CodeBlocks will not compile the contributed plugins from SVN. If you want to compile / install them too, replace the above ./configure command with:<br />
./configure --enable-contrib<br />
followed by 'make && make install' as usual.<br />
<br />
To see a list of other options available for configuring the build of CodeBlocks do:<br />
./configure --help<br />
<br />
To compile under gentoo, use<br />
./configure --with-wx-config=wx-config-2.6<br />
<br />
====Building Code::Blocks RC1 and former====<br />
<br />
To build Code::Blocks all you have to do now is type:<br />
<br />
<pre>make -f Makefile.unix</pre><br />
<br />
This will build everything: the application and the plugins. The final step is to update the working environment for your system:<br />
<br />
<pre>make -f Makefile.unix update</pre><br />
<br />
The following notes about converting the line endings does '''not''' apply to the CVS Version! The "update" script included there works just fine.<br />
<br />
'''Important note:''' Don't run that final make yet! 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:<br />
<br />
To install it in Gentoo, do:<br />
<br />
# emerge -av dos2unix<br />
<br />
In Debian and Ubuntu, do (as root, or using sudo etc.):<br />
<br />
# apt-get install sysutils<br />
<br />
This will install dos2unix. Now we are ready to convert the script.<br />
# dos2unix -n update update.unix<br />
# chmod +x update.unix<br />
# ./update.unix<br />
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.<br />
<br />
OK. Now that the update script is converted to unix format, you can run the final make:<br />
<br />
<pre>make -f Makefile.unix update</pre><br />
<br />
If everything's gone well, congratulations! You should be able to launch Code::Blocks by running the generated <tt>run.sh</tt> script in the <tt>output</tt> subdir:<br />
<br />
<pre>output/run.sh</pre><br />
<br />
This script can be ran from anywhere in your system so, yes, you can make a shortcut to it on your desktop ;)<br />
<br />
Enjoy!</div>Auria