<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.codeblocks.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Matioupi</id>
	<title>Code::Blocks - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.codeblocks.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Matioupi"/>
	<link rel="alternate" type="text/html" href="https://wiki.codeblocks.org/index.php/Special:Contributions/Matioupi"/>
	<updated>2026-05-27T15:16:48Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.35.0</generator>
	<entry>
		<id>https://wiki.codeblocks.org/index.php?title=Installing_Code::Blocks_from_source_on_Mac_OS_X&amp;diff=5558</id>
		<title>Installing Code::Blocks from source on Mac OS X</title>
		<link rel="alternate" type="text/html" href="https://wiki.codeblocks.org/index.php?title=Installing_Code::Blocks_from_source_on_Mac_OS_X&amp;diff=5558"/>
		<updated>2008-07-22T07:49:13Z</updated>

		<summary type="html">&lt;p&gt;Matioupi: /* Proper Application Bundling */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Installing Code::Blocks]]&lt;br /&gt;
[[Category:Installing Code::Blocks from source]]&lt;br /&gt;
These are instructions on how to build Code::Blocks under Apple Mac OS X.&lt;br /&gt;
They have been tested under Mac OS X version 10.3 and under Mac OS X 10.4&lt;br /&gt;
(PowerPC and Intel), and might work on old Mac OS X 10.2 and 10.1 as well.&lt;br /&gt;
&lt;br /&gt;
We will be building everything from scratch using the source code, and&lt;br /&gt;
not use any available package managers like&lt;br /&gt;
[http://www.macports.org MacPorts],&lt;br /&gt;
[http://fink.sourceforge.net/ Fink],&lt;br /&gt;
[http://gentoo-wiki.com/Gentoo_MacOS Gentoo] or&lt;br /&gt;
[http://rpm4darwin.sourceforge.net RPM].&lt;br /&gt;
Packaging can be done later, once it has reached a more stable release.&lt;br /&gt;
&lt;br /&gt;
Update: building for MacPorts can be found at the end of the document.&lt;br /&gt;
&lt;br /&gt;
== Install Developer Tools ==&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
This will install Apple versions of:&lt;br /&gt;
&lt;br /&gt;
* http://www.gnu.org/software/gcc/ (GNU Compilers)&lt;br /&gt;
* http://www.gnu.org/software/gdb/ (GNU Debugger)&lt;br /&gt;
* http://www.gnu.org/software/make/ (GNU Make)&lt;br /&gt;
&lt;br /&gt;
Note: 2006/04&lt;br /&gt;
Apple pulled all the old links in order to promote Mac OS X 10.4, but all the&lt;br /&gt;
old developer tools can be downloaded from ADC at http://connect.apple.com/&lt;br /&gt;
&lt;br /&gt;
You need a (free) developer registration with Apple first, in order to log in there.&lt;br /&gt;
For Mac OS X 10.4, you want (at least) Xcode 2.2, since earlier versions were buggy.&lt;br /&gt;
For Mac OS X 10.3, you want Xcode 1.5.&lt;br /&gt;
&lt;br /&gt;
== Check Autotools versions ==&lt;br /&gt;
&lt;br /&gt;
Depending on your OS version, you might need to download and compile new versions of these:&lt;br /&gt;
&lt;br /&gt;
* http://www.gnu.org/software/autoconf/ (GNU Autoconf)&lt;br /&gt;
* http://www.gnu.org/software/automake/ (GNU Automake)&lt;br /&gt;
* http://www.gnu.org/software/libtool/ (GNU Libtool)&lt;br /&gt;
&lt;br /&gt;
Check what you have, with &amp;lt;tt&amp;gt;--version&amp;lt;/tt&amp;gt; (note that GNU libtool is called &amp;quot;glibtool&amp;quot; on Mac OS X)&lt;br /&gt;
&lt;br /&gt;
Currently Code::Blocks requires versions:&lt;br /&gt;
* autoconf 2.50+&lt;br /&gt;
* automake 1.7+ (1.9+ needed in order to build the dist tarball)&lt;br /&gt;
* libtool 1.4+ (1.5.8+ highly recommended to get some bug fixes)&lt;br /&gt;
&lt;br /&gt;
=== Automake example (Panther) ===&lt;br /&gt;
&lt;br /&gt;
For Mac OS X 10.3, you will only need an upgraded (local) installation of automake 1.7.x.&lt;br /&gt;
&lt;br /&gt;
You can download &amp;quot;[ftp://ftp.gnu.org/gnu/automake/automake-1.7.9.tar.gz automake-1.7.9.tar.gz]&amp;quot; and configure and install it with something like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
./configure --prefix=/usr/local --program-suffix=-1.7&lt;br /&gt;
make&lt;br /&gt;
sudo make install&lt;br /&gt;
sudo cp -pi /usr/share/aclocal/libtool.m4 [prefix]/share/aclocal-1.7/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Since it's now known as &amp;quot;automake-1.7&amp;quot;, it won't interfere with the regular &amp;quot;automake&amp;quot;&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
If you would rather have the new version to be called when calling &amp;quot;automake&amp;quot;, let it install into /usr/local and put /usr/local/bin before /usr/bin in your PATH.&lt;br /&gt;
&lt;br /&gt;
=== Libtool example ===&lt;br /&gt;
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.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd /libtool-*/&lt;br /&gt;
./configure --prefix=/usr --program-prefix=g&lt;br /&gt;
make&lt;br /&gt;
sudo make install&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that this will replace the system version of glibtool, which might have some compatibility issues with building other software.&lt;br /&gt;
&lt;br /&gt;
== FYI: Universal Binaries ==&lt;br /&gt;
&lt;br /&gt;
If you are building for Mac OS X 10.4 or later, you might want to build &amp;quot;[http://www.apple.com/universal/ Universal Binaries ]&amp;quot;&lt;br /&gt;
These are binaries that contain code for both PowerPC (&amp;quot;ppc&amp;quot; arch) and Intel (&amp;quot;i386&amp;quot; arch)&lt;br /&gt;
&lt;br /&gt;
The basic flags that needs to be added are:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CFLAGS += &amp;quot;-isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch i386 -arch ppc&amp;quot;&lt;br /&gt;
&lt;br /&gt;
CXXFLAGS += &amp;quot;-isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch i386 -arch ppc&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
(You only need the sysroot parameter on PowerPC Macintosh, not on a Intel Macintosh)&lt;br /&gt;
The &amp;quot;-arch i386 -arch ppc&amp;quot; is what tells the compiler to build a &amp;quot;universal&amp;quot; (or &amp;quot;fat&amp;quot;) binary.&lt;br /&gt;
&lt;br /&gt;
Usually it's easiest to build one version for &amp;quot;powerpc-apple-darwin8&amp;quot;,&lt;br /&gt;
and one version for &amp;quot;i686-apple-darwin8&amp;quot;, and then merge them with &amp;quot;[http://developer.apple.com/documentation/Darwin/Reference/ManPages/man1/lipo.1.html lipo]&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
./configure --host=powerpc-apple-darwin8 --target=powerpc-apple-darwin8&lt;br /&gt;
&lt;br /&gt;
./configure --host=i686-apple-darwin8 --target=i686-apple-darwin8&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Some caveats:&lt;br /&gt;
* pre-compiled headers might fail with a &amp;quot;no main&amp;quot; error. If they do, add a -c to only compile them&lt;br /&gt;
* when cross-compiling, tools like auto_revision might fail to build. copy these from a native build&lt;br /&gt;
* the Tiger compilers might crash from time to time, but that is only to be expected (it seems)...&lt;br /&gt;
&lt;br /&gt;
See [http://developer.apple.com/technotes/tn2005/tn2137.html Technical Note TN2137]: Building Universal &lt;br /&gt;
Binaries from &amp;quot;configure&amp;quot;-based Open Source Projects&lt;br /&gt;
&lt;br /&gt;
== FYI: ANSI or UNICODE ==&lt;br /&gt;
&lt;br /&gt;
For the moment we are using &amp;quot;ANSI&amp;quot; (--disable-unicode, default) for Mac OS X 10.3 and earlier,&lt;br /&gt;
and &amp;quot;UNICODE&amp;quot; (--enable-unicode, optional) for Mac OS X 10.4 and later. &lt;br /&gt;
&lt;br /&gt;
See http://www.wxwidgets.org/manuals/stable/wx_unicode.html#unicodeandansi&lt;br /&gt;
&lt;br /&gt;
== Build wxWidgets ==&lt;br /&gt;
&lt;br /&gt;
=== Download the source code ===&lt;br /&gt;
&lt;br /&gt;
Download the tarball for the wxMac release:&lt;br /&gt;
&lt;br /&gt;
http://wxwidgets.org/downloads/&lt;br /&gt;
&lt;br /&gt;
=== Apply necessary patches ===&lt;br /&gt;
&lt;br /&gt;
Don't forget to apply any released patches!&lt;br /&gt;
&lt;br /&gt;
http://wxwidgets.org/downloads/patch.htm&lt;br /&gt;
&lt;br /&gt;
=== Configure and (GNU) Make ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mkdir mac-build&lt;br /&gt;
cd mac-build&lt;br /&gt;
../configure --enable-shared --enable-monolithic --enable-unicode --with-mac --with-opengl \&lt;br /&gt;
            --with-png=builtin --with-jpeg=builtin --with-tiff=builtin --with-expat=builtin&lt;br /&gt;
nice make&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
note: the easiest way to build a Universal Binary with wxWidgets is&lt;br /&gt;
the new flag: --enable-universal_binary (you need wxWidgets 2.6.4+)&lt;br /&gt;
&lt;br /&gt;
=== Install into Destination ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo make install&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Bundle library for Mac ==&lt;br /&gt;
&lt;br /&gt;
To avoid having the Code::Blocks user having to compile or install wxWidgets themselves,&lt;br /&gt;
we can bundle it with our application so that it is contained in the application bundle.&lt;br /&gt;
This could also be done by statically linking wxWidgets, but with dynamic linking we can&lt;br /&gt;
share the wxWidgets library between all applications using wxWidgets (not just Code::Blocks)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Way One: Library (dynamic) ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/usr/local/include/wx-2.6/wx/wx.h&lt;br /&gt;
/usr/local/lib/libwx_macu-2.6.dylib -&amp;gt; libwx_macu-2.6.0.dylib&lt;br /&gt;
/usr/local/lib/libwx_macu-2.6.0.dylib -&amp;gt; libwx_macu-2.6.0.4.0.dylib&lt;br /&gt;
/usr/local/lib/libwx_macu-2.6.0.4.0.dylib&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To bundle our shared library with the application, we include it in &amp;quot;MacOS&amp;quot; and change the path:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
install_name_tool -id @executable_path/libwx_macu-2.6.0.dylib&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
@executable_path will be replaced with e.g. /Developer/Applications/CodeBlocks.app/Contents/MacOS&lt;br /&gt;
&lt;br /&gt;
=== Way Two: Framework (bundle) ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/Library/Frameworks/wx.framework/Headers -&amp;gt; Versions/Current/Headers&lt;br /&gt;
/Library/Frameworks/wx.framework/wx -&amp;gt; Versions/Current/wx&lt;br /&gt;
/Library/Frameworks/wx.framework/Versions/Current -&amp;gt; 2.6&lt;br /&gt;
/Library/Frameworks/wx.framework/Versions/2.6/Headers/wx.h&lt;br /&gt;
/Library/Frameworks/wx.framework/Versions/2.6/wx  -&amp;gt; libwx_macu-2.6.0.dylib&lt;br /&gt;
/Library/Frameworks/wx.framework/Versions/2.6/libwx_macu-2.6.0.dylib  -&amp;gt; libwx_macu-2.6.0.4.0.dylib&lt;br /&gt;
/Library/Frameworks/wx.framework/Versions/2.6/libwx_macu-2.6.0.4.0.dylib&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To bundle our framework with the application, we include it in &amp;quot;Frameworks&amp;quot; and change the path:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
install_name_tool -id @executable_path/../Frameworks/wx.framework/Versions/2.6/libwx_macu-2.6.0.dylib&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This way it will first look in the framework path (-F), and then in for the shared library path (-L) as usual.&lt;br /&gt;
&lt;br /&gt;
== Install Subversion client ==&lt;br /&gt;
&lt;br /&gt;
http://subversion.tigris.org/&lt;br /&gt;
&lt;br /&gt;
Note: you need SVN for the Code::Blocks revision scripts to work!&lt;br /&gt;
&lt;br /&gt;
== Build CodeBlocks from SVN ==&lt;br /&gt;
&lt;br /&gt;
=== Download the source code ===&lt;br /&gt;
&lt;br /&gt;
https://www.codeblocks.org/source_code.shtml&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
svn checkout svn://svn.berlios.de/codeblocks/trunk&lt;br /&gt;
cd trunk&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Apply necessary patches ===&lt;br /&gt;
&lt;br /&gt;
For a list of all available patches, see:&lt;br /&gt;
&lt;br /&gt;
http://developer.berlios.de/patch/?group_id=5358&lt;br /&gt;
&lt;br /&gt;
You might need to convert line endings from DOS to Unix first.&lt;br /&gt;
&lt;br /&gt;
=== Bootstrap with Autotools ===&lt;br /&gt;
&lt;br /&gt;
You need to use the newer version of automake (see above), for the &amp;quot;bootstrap&amp;quot;. (OS X 10.5 users may have recent enough autotools so they may not need to install them)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# if you installed newer autotools under names with suffixes.&lt;br /&gt;
export AUTOMAKE=automake-1.9&lt;br /&gt;
export ACLOCAL=aclocal-1.9&lt;br /&gt;
&lt;br /&gt;
# do bootstrap. you may need to adapt /usr/share/aclocal&lt;br /&gt;
# to whatever other location you may use&lt;br /&gt;
# (for instance, in my case, /usr/local/share/aclocal)&lt;br /&gt;
ACLOCAL_FLAGS=&amp;quot;-I /usr/share/aclocal&amp;quot; ./bootstrap&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Mono Fix ===&lt;br /&gt;
&lt;br /&gt;
If you have the Mono.framework installed, then it probably set up a symlink like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/usr/bin/pkg-config -&amp;gt; /Library/Frameworks/Mono.framework/Commands/pkg-config&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Unless you have a &amp;quot;proper&amp;quot; [http://pkgconfig.freedesktop.org/ pkg-config] installation the Code::Blocks configure will fail, so move this symbolic link aside.&lt;br /&gt;
&lt;br /&gt;
=== Configure ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
./configure --enable-contrib&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mkdir ppc-build&lt;br /&gt;
cd ppc-build&lt;br /&gt;
../configure --host=powerpc-apple-darwin8 --target=powerpc-apple-darwin8 --enable-contrib&lt;br /&gt;
cd ..&lt;br /&gt;
&lt;br /&gt;
mkdir x86-build&lt;br /&gt;
cd x86-build&lt;br /&gt;
../configure --host=i686-apple-darwin8 --target=i686-apple-darwin8 --enable-contrib&lt;br /&gt;
cd ..&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note: You need to patch the location of the pre-compiled headers, or it will generate them in the same place for both arch.&lt;br /&gt;
&lt;br /&gt;
=== Tiger Fix ===&lt;br /&gt;
&lt;br /&gt;
There is a bug in the glibtool of Mac OS X 10.4, that fails to link C++ libs:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ld: multiple definitions of symbol ___umoddi3&lt;br /&gt;
/usr/lib/gcc/powerpc-apple-darwin8/4.0.1/libgcc.a(_umoddi3.o) private external definition of ___umoddi3 in section (__TEXT,__text)&lt;br /&gt;
/usr/lib/gcc/powerpc-apple-darwin8/4.0.1/../../../libgcc_s.10.4.dylib(_umoddi3_s.o) definition of ___umoddi3&lt;br /&gt;
&lt;br /&gt;
ld: multiple definitions of symbol ___umoddi3&lt;br /&gt;
/usr/lib/gcc/i686-apple-darwin8/4.0.1/libgcc.a(_umoddi3.o) private external definition of ___umoddi3 in section (__TEXT,__text)&lt;br /&gt;
/usr/lib/gcc/i686-apple-darwin8/4.0.1/../../../libgcc_s.10.4.dylib(_umoddi3_s.o) definition of ___umoddi3&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To work around this, you need to edit the generated &amp;quot;libtool&amp;quot; script manually:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
177c177&lt;br /&gt;
&amp;lt; whole_archive_flag_spec=&amp;quot;-all_load \$convenience&amp;quot;&lt;br /&gt;
---&lt;br /&gt;
&amp;gt; whole_archive_flag_spec=&amp;quot;&amp;quot;&lt;br /&gt;
6921c6921&lt;br /&gt;
&amp;lt; whole_archive_flag_spec=&amp;quot;-all_load \$convenience&amp;quot;&lt;br /&gt;
---&lt;br /&gt;
&amp;gt; whole_archive_flag_spec=&amp;quot;&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This bug has been fixed in GNU libtool 1.5.8 and later.&lt;br /&gt;
&lt;br /&gt;
=== (GNU) Make ===&lt;br /&gt;
&lt;br /&gt;
&amp;quot;nice&amp;quot; isn't strictly needed, it just makes the compile run at a lower process priority&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nice make&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the Universal Binary build:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd ppc-build&lt;br /&gt;
nice make&lt;br /&gt;
cd ..&lt;br /&gt;
&lt;br /&gt;
cd x86-build&lt;br /&gt;
nice make&lt;br /&gt;
cd ..&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Install into Destination ===&lt;br /&gt;
&lt;br /&gt;
&amp;quot;sudo&amp;quot; asks you for an admin password, in order to get install permissions&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo make install&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the Universal Binary build:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd ppc-build&lt;br /&gt;
make install DESTDIR=/tmp/ppc&lt;br /&gt;
cd ..&lt;br /&gt;
&lt;br /&gt;
cd x86-build&lt;br /&gt;
make install DESTDIR=/tmp/x86&lt;br /&gt;
cd ..&lt;br /&gt;
&lt;br /&gt;
lipomerge /tmp/ppc /tmp/x86 /tmp/fat&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where &amp;quot;lipomerge&amp;quot; is a custom shell script:&lt;br /&gt;
&lt;br /&gt;
* http://www.algonet.se/~afb/wx/lipomerge&lt;br /&gt;
&lt;br /&gt;
== Bundle application for Mac ==&lt;br /&gt;
&lt;br /&gt;
After building codeblocks in the regular Unix way, you need to bundle it with the icons&lt;br /&gt;
and various other info that it needs to make a regular stand-alone Macintosh application.&lt;br /&gt;
&lt;br /&gt;
There are two ways of accomplishing this, old Mac OS-style resource or NeXT-style bundle.&lt;br /&gt;
The old resources are handy while developing, while bundles are more suitable for release.&lt;br /&gt;
&lt;br /&gt;
Note: You '''need''' to use either of these methods, or your application will launch&lt;br /&gt;
in the background behind all other windows and will be unable to receive any events!&lt;br /&gt;
&lt;br /&gt;
=== Way One: Mac OS (resource) ===&lt;br /&gt;
&lt;br /&gt;
http://developer.apple.com/documentation/Carbon/Reference/Resource_Manager/&lt;br /&gt;
&lt;br /&gt;
Handy while developing, as you only need to add an icon.&lt;br /&gt;
&lt;br /&gt;
Files needed:&lt;br /&gt;
* http://www.algonet.se/~afb/wx/CodeBlocks.r.gz (Rez icon, gzipped)&lt;br /&gt;
&lt;br /&gt;
First we install the program to the PREFIX directory of your choice:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$PREFIX/bin&lt;br /&gt;
$PREFIX/lib&lt;br /&gt;
$PREFIX/share/codeblocks&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Add a custom icon to the application, and make it receive events:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
gunzip CodeBlocks.r.gz&lt;br /&gt;
sudo /Developer/Tools/Rez -d __DARWIN__ -t APPL -d __WXMAC__ \&lt;br /&gt;
                          CodeBlocks.r Carbon.r -o $PREFIX/bin/codeblocks&lt;br /&gt;
sudo /Developer/Tools/SetFile -a C $PREFIX/bin/codeblocks&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note: on the Intel Macintoshes, the icon comes up as &amp;quot;broken&amp;quot;&lt;br /&gt;
(apparently it assumes that all apps with resforks are Classic)&lt;br /&gt;
&lt;br /&gt;
Without the icon part, this could also have be written as just:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo `wx-config --rezflags` $PREFIX/bin/codeblocks&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Start the application with a small prefix shell wrapper like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:$PREFIX/lib&lt;br /&gt;
export DYLD_LIBRARY_PATH&lt;br /&gt;
&lt;br /&gt;
$PREFIX/bin/codeblocks --prefix=$PREFIX&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You don't need the &amp;quot;DYLD_LIBRARY_PATH&amp;quot; stuff,&lt;br /&gt;
if you are installing to a system directory.&lt;br /&gt;
&lt;br /&gt;
==== Common PREFIX Settings ====&lt;br /&gt;
&lt;br /&gt;
Local: &amp;lt;tt&amp;gt;PREFIX=/usr/local&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
System: &amp;lt;tt&amp;gt;PREFIX=/usr&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
MacPorts: &amp;lt;tt&amp;gt;PREFIX=/opt/local&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Fink: &amp;lt;tt&amp;gt;PREFIX=/sw&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Way Two: NeXT (bundle) ===&lt;br /&gt;
&lt;br /&gt;
http://developer.apple.com/documentation/CoreFoundation/Conceptual/CFBundles/&lt;br /&gt;
&lt;br /&gt;
This does not involve resources, and is more relocatable.&lt;br /&gt;
&lt;br /&gt;
Files needed:&lt;br /&gt;
* http://www.algonet.se/~afb/wx/CodeBlocks.Info.plist (rename to &amp;quot;Info.plist&amp;quot;)&lt;br /&gt;
* http://www.algonet.se/~afb/wx/CodeBlocks.sh (shell wrapper, rename to &amp;quot;CodeBlocks&amp;quot;)&lt;br /&gt;
* http://www.algonet.se/~afb/wx/CodeBlocks.icns (Mac OS X icon, rename to &amp;quot;app.icns&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
The MacOS program will just be a shell wrapper that calls &amp;quot;bin/codeblocks&amp;quot;, like above.&lt;br /&gt;
Traditionally the bundle would include Frameworks and Resources, but we'll just avoid those&lt;br /&gt;
here and use the regular &amp;quot;lib&amp;quot; and &amp;quot;share/codeblocks&amp;quot; instead (just as with a regular install). &lt;br /&gt;
These temporary directories are listed in italic below, they're not really used in bundles...&lt;br /&gt;
&lt;br /&gt;
Setup a hierarchy like this, and copy the files from the regular build/install and the above file list to it:&lt;br /&gt;
&lt;br /&gt;
  CodeBlocks.app&lt;br /&gt;
  CodeBlocks.app/Contents/&lt;br /&gt;
  CodeBlocks.app/Contents/Info.plist&lt;br /&gt;
  CodeBlocks.app/Contents/MacOS/&lt;br /&gt;
  CodeBlocks.app/Contents/MacOS/CodeBlocks&lt;br /&gt;
  CodeBlocks.app/Contents/Resources/&lt;br /&gt;
  CodeBlocks.app/Contents/Resources/app.icns&lt;br /&gt;
  ''CodeBlocks.app/Contents/bin/''&lt;br /&gt;
  ''CodeBlocks.app/Contents/lib/''&lt;br /&gt;
  ''CodeBlocks.app/Contents/share/codeblocks/''&lt;br /&gt;
&lt;br /&gt;
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)&lt;br /&gt;
&lt;br /&gt;
==== Proper Application Bundling ====&lt;br /&gt;
&lt;br /&gt;
To avoid the shell wrapper, the binary can now be moved from &amp;quot;bin/codeblocks&amp;quot; to &amp;quot;MacOS/CodeBlocks&amp;quot;. Helper files are moved from &amp;quot;share/codeblocks&amp;quot; to &amp;quot;Resources&amp;quot;. The dynamic libraries are moved from &amp;quot;lib&amp;quot; to &amp;quot;MacOS&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mv bin/codeblocks MacOS/CodeBlocks&lt;br /&gt;
rmdir bin&lt;br /&gt;
mv lib/* MacOS/&lt;br /&gt;
rmdir lib&lt;br /&gt;
mv share Resources/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
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/:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
install_name_tool -change /usr/local/lib/libcodeblocks.0.dylib \&lt;br /&gt;
                          @executable_path/libcodeblocks.0.dylib MacOS/CodeBlocks&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The libraries can have their names changed using the -id parameter:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
install_name_tool -id @executable_path/libcodeblocks.0.dylib MacOS/libcodeblocks.0.dylib&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You also need to change all of the loadable bundles for the plugins:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
for so in Resources/plugins/*.so&lt;br /&gt;
do install_name_tool -change /usr/local/lib/libcodeblocks.0.dylib \&lt;br /&gt;
                             @executable_path/libcodeblocks.0.dylib $so&lt;br /&gt;
done&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can check the result, what libraries/frameworks it links to, with:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
otool -L CodeBlocks&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Optionally you can then repeat the process, for the wx library too...&lt;br /&gt;
&lt;br /&gt;
Here is a full script to do the job... It assumes to be executed at the same directory level as the CodeBlockSVN.app directory that will receive all the stuff... maybe enhanced but it is a first try that do work when packaging an OS X SVN build.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
cp /usr/local/bin/codeblocks ./CodeBlocksSVN.app/Contents/MacOS/CodeBlocks&lt;br /&gt;
cp /usr/local/bin/cb_share_config ./CodeBlocksSVN.app/Contents/MacOS&lt;br /&gt;
cp /usr/local/bin/cb_console_runner ./CodeBlocksSVN.app/Contents/MacOS&lt;br /&gt;
cp /usr/local/bin/codesnippets ./CodeBlocksSVN.app/Contents/MacOS&lt;br /&gt;
cp /usr/local/lib/libwxsmithlib.0.dylib ./CodeBlocksSVN.app/Contents/MacOS&lt;br /&gt;
cp /usr/local/lib/libwx_macu-2.8.0.dylib ./CodeBlocksSVN.app/Contents/MacOS&lt;br /&gt;
cp /usr/local/lib/libcodeblocks.0.dylib ./CodeBlocksSVN.app/Contents/MacOS&lt;br /&gt;
&lt;br /&gt;
install_name_tool -id @executable_path/libcodeblocks.0.dylib ./CodeBlocksSVN.app/Contents/MacOS/libcodeblocks.0.dylib&lt;br /&gt;
install_name_tool -id @executable_path/libwx_macu-2.8.0.dylib ./CodeBlocksSVN.app/Contents/MacOS/libwx_macu-2.8.0.dylib&lt;br /&gt;
install_name_tool -id @executable_path/libwxsmithlib.0.dylib ./CodeBlocksSVN.app/Contents/MacOS/libwxsmithlib.0.dylib&lt;br /&gt;
&lt;br /&gt;
install_name_tool -change /usr/local/lib/libcodeblocks.0.dylib @executable_path/libcodeblocks.0.dylib ./CodeBlocksSVN.app/Contents/MacOS/CodeBlocks&lt;br /&gt;
install_name_tool -change /usr/local/lib/libwx_macu-2.8.0.dylib @executable_path/libwx_macu-2.8.0.dylib ./CodeBlocksSVN.app/Contents/MacOS/CodeBlocks&lt;br /&gt;
install_name_tool -change /usr/local/lib/libwxsmithlib.0.dylib @executable_path/libwxsmithlib.0.dylib ./CodeBlocksSVN.app/Contents/MacOS/CodeBlocks&lt;br /&gt;
&lt;br /&gt;
install_name_tool -change /usr/local/lib/libcodeblocks.0.dylib @executable_path/libcodeblocks.0.dylib ./CodeBlocksSVN.app/Contents/MacOS/codesnippets&lt;br /&gt;
install_name_tool -change /usr/local/lib/libwx_macu-2.8.0.dylib @executable_path/libwx_macu-2.8.0.dylib ./CodeBlocksSVN.app/Contents/MacOS/codesnippets&lt;br /&gt;
install_name_tool -change /usr/local/lib/libwxsmithlib.0.dylib @executable_path/libwxsmithlib.0.dylib ./CodeBlocksSVN.app/Contents/MacOS/codesnippets&lt;br /&gt;
&lt;br /&gt;
install_name_tool -change /usr/local/lib/libcodeblocks.0.dylib @executable_path/libcodeblocks.0.dylib ./CodeBlocksSVN.app/Contents/MacOS/cb_share_config&lt;br /&gt;
install_name_tool -change /usr/local/lib/libwx_macu-2.8.0.dylib @executable_path/libwx_macu-2.8.0.dylib ./CodeBlocksSVN.app/Contents/MacOS/cb_share_config&lt;br /&gt;
install_name_tool -change /usr/local/lib/libwxsmithlib.0.dylib @executable_path/libwxsmithlib.0.dylib ./CodeBlocksSVN.app/Contents/MacOS/cb_share_config&lt;br /&gt;
&lt;br /&gt;
install_name_tool -change /usr/local/lib/libcodeblocks.0.dylib @executable_path/libcodeblocks.0.dylib ./CodeBlocksSVN.app/Contents/MacOS/cb_console_runner&lt;br /&gt;
install_name_tool -change /usr/local/lib/libwx_macu-2.8.0.dylib @executable_path/libwx_macu-2.8.0.dylib ./CodeBlocksSVN.app/Contents/MacOS/cb_console_runner&lt;br /&gt;
install_name_tool -change /usr/local/lib/libwxsmithlib.0.dylib @executable_path/libwxsmithlib.0.dylib ./CodeBlocksSVN.app/Contents/MacOS/cb_console_runner&lt;br /&gt;
&lt;br /&gt;
install_name_tool -change /usr/local/lib/libwx_macu-2.8.0.dylib @executable_path/libwx_macu-2.8.0.dylib ./CodeBlocksSVN.app/Contents/MacOS/libcodeblocks.0.dylib&lt;br /&gt;
install_name_tool -change /usr/local/lib/libwxsmithlib.0.dylib @executable_path/libwxsmithlib.0.dylib ./CodeBlocksSVN.app/Contents/MacOS/libcodeblocks.0.dylib&lt;br /&gt;
&lt;br /&gt;
install_name_tool -change /usr/local/lib/libcodeblocks.0.dylib @executable_path/libcodeblocks.0.dylib ./CodeBlocksSVN.app/Contents/MacOS/libwxsmithlib.0.dylib&lt;br /&gt;
install_name_tool -change /usr/local/lib/libwx_macu-2.8.0.dylib @executable_path/libwx_macu-2.8.0.dylib ./CodeBlocksSVN.app/Contents/MacOS/libwxsmithlib.0.dylib&lt;br /&gt;
&lt;br /&gt;
cp -R /usr/local/share/codeblocks/ ./CodeBlocksSVN.app/Contents/Resources/share/codeblocks&lt;br /&gt;
&lt;br /&gt;
for dotso in ./CodeBlocksSVN.app/Contents/Resources/share/codeblocks/plugins/*.so&lt;br /&gt;
do&lt;br /&gt;
#echo $dotso&lt;br /&gt;
#	install_name_tool -id $dotso ./libcodeblocks.0.dylib CodeBlocks&lt;br /&gt;
	install_name_tool -change /usr/local/lib/libcodeblocks.0.dylib @executable_path/libcodeblocks.0.dylib $dotso&lt;br /&gt;
	install_name_tool -change /usr/local/lib/libwx_macu-2.8.0.dylib @executable_path/libwx_macu-2.8.0.dylib $dotso&lt;br /&gt;
	install_name_tool -change /usr/local/lib/libwxsmithlib.0.dylib @executable_path/libwxsmithlib.0.dylib $dotso&lt;br /&gt;
done&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== FYI: Darwin vs. Mac OS X ==&lt;br /&gt;
&lt;br /&gt;
&amp;quot;Darwin is the UNIX technology-based foundation of Mac OS X.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* http://developer.apple.com/referencelibrary/Darwin/&lt;br /&gt;
&lt;br /&gt;
* http://en.wikipedia.org/wiki/Darwin_(operating_system)&lt;br /&gt;
&lt;br /&gt;
&amp;quot;Pure Darwin&amp;quot; here refers to the Open Source version of the OS:&lt;br /&gt;
&lt;br /&gt;
* http://www.opensource.apple.com/darwinsource/images/&lt;br /&gt;
&lt;br /&gt;
* http://opendarwin.org/ or http://gnu-darwin.sourceforge.net/&lt;br /&gt;
&lt;br /&gt;
(that is: Darwin using X11 instead of Aqua for the user interface)&lt;br /&gt;
&lt;br /&gt;
== Install with MacPorts ==&lt;br /&gt;
&lt;br /&gt;
=== Install wxWidgets ===&lt;br /&gt;
&lt;br /&gt;
You will need the wxWidgets library, install as port with:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo port install wxWidgets&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want the X11/GTK version on Mac OS X, instead use:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo port install wxgtk&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Install Code::Blocks ===&lt;br /&gt;
&lt;br /&gt;
After that is installed, you can install Code::Blocks with:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo port install codeblocks-devel +aqua&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want the X11/GTK version on Mac OS X, instead use:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo port install codeblocks-devel +x11&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will download the SVN trunk, and any dependencies:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
---&amp;gt;  Fetching codeblocks-devel&lt;br /&gt;
---&amp;gt;  Verifying checksum(s) for codeblocks-devel&lt;br /&gt;
---&amp;gt;  Extracting codeblocks-devel&lt;br /&gt;
---&amp;gt;  Configuring codeblocks-devel&lt;br /&gt;
---&amp;gt;  Building codeblocks-devel with target all&lt;br /&gt;
---&amp;gt;  Staging codeblocks-devel into destroot&lt;br /&gt;
---&amp;gt;  Packaging tgz archive for codeblocks-devel 1.0_0+aqua+macosx&lt;br /&gt;
---&amp;gt;  Installing codeblocks-devel 1.0_0+aqua+macosx&lt;br /&gt;
---&amp;gt;  Activating codeblocks-devel 1.0_0+aqua+macosx&lt;br /&gt;
---&amp;gt;  Cleaning codeblocks-devel&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note: to upgrade from SVN, you need to uninstall first:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo port uninstall codeblocks-devel&lt;br /&gt;
sudo port clean codeblocks-devel&lt;br /&gt;
sudo port install codeblocks-devel&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is both because all SVN versions are numbered &amp;quot;0&amp;quot;,&lt;br /&gt;
but also due to a bug in the Code::Blocks build scripts.&lt;br /&gt;
&lt;br /&gt;
=== Running &amp;lt;tt&amp;gt;+aqua&amp;lt;/tt&amp;gt; (wxMac) version ===&lt;br /&gt;
&lt;br /&gt;
After the build completes, you can start the program by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
open /Applications/MacPorts/CodeBlocks.app&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that the wxMac application bundle in &amp;quot;MacPorts&amp;quot;&lt;br /&gt;
is just a wrapper, with symbolic links to /opt/local...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/opt/local/bin/codeblocks&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Running &amp;lt;tt&amp;gt;+x11&amp;lt;/tt&amp;gt; (wxGTK) version ===&lt;br /&gt;
&lt;br /&gt;
The non-bundled wxGTK version is instead started with:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/opt/local/bin/codeblocks&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When running X11/wxGTK programs in Mac OS X, you can use&lt;br /&gt;
&amp;quot;open-x11&amp;quot; to first start up X11.app and set up $DISPLAY:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
open-x11 /opt/local/bin/codeblocks&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Matioupi</name></author>
	</entry>
</feed>