<?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=Afb</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=Afb"/>
	<link rel="alternate" type="text/html" href="https://wiki.codeblocks.org/index.php/Special:Contributions/Afb"/>
	<updated>2026-05-23T13:15:24Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.35.0</generator>
	<entry>
		<id>https://wiki.codeblocks.org/index.php?title=Main_Page&amp;diff=6414</id>
		<title>Main Page</title>
		<link rel="alternate" type="text/html" href="https://wiki.codeblocks.org/index.php?title=Main_Page&amp;diff=6414"/>
		<updated>2010-08-28T13:55:59Z</updated>

		<summary type="html">&lt;p&gt;Afb: DMD for all platforms, LDC added&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOEDITSECTION__ __NOTOC__&lt;br /&gt;
{{Layout_box1|1=&lt;br /&gt;
[[Image:cb_splash.png|left]]&lt;br /&gt;
'''Welcome to the official Wiki for Code::Blocks'''&amp;lt;br&amp;gt;&lt;br /&gt;
[https://www.codeblocks.org Code::Blocks] is an open-source, cross-platform [[wikipedia:Integrated Development Environment|IDE]]. Using a plugin architecture, its capabilities and features are defined by the provided plugins.&amp;lt;br&amp;gt;&lt;br /&gt;
Currently, [https://www.codeblocks.org Code::Blocks] is oriented towards C/C++.&lt;br /&gt;
The Code::Blocks team does not take responsibility for the content nor accuracy of these pages.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;Wiki Editors: In order to login to edit pages, you must create an account on the [/ forums]. Use the same username and password for the wiki. Read the [[Help:Contents|Help]] for editing guidelines. Look in the [[CodeBlocks:Community_Portal|community portal]] for things to do.&lt;br /&gt;
&amp;lt;/small&amp;gt;&lt;br /&gt;
&amp;lt;br clear=&amp;quot;all&amp;quot; /&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{|width=&amp;quot;100%&amp;quot; background-color=&amp;quot;transparent&amp;quot; &lt;br /&gt;
|width=&amp;quot;60%&amp;quot; valign=&amp;quot;top&amp;quot;|&lt;br /&gt;
&amp;lt;!-- LEFT --&amp;gt;&lt;br /&gt;
&amp;lt;!-- Did you know that using Layout_box2 here instead of &amp;lt;div&amp;gt; breaks the inner table? Strange... --&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;background-color: #dfeefb; border: 1px dotted #010101; margin: 5px; padding: 5px;&amp;quot;&amp;gt;&lt;br /&gt;
{|align=&amp;quot;center&amp;quot; style=&amp;quot;background:transparent&amp;quot; cellspacing=&amp;quot;5&amp;quot;&lt;br /&gt;
&lt;br /&gt;
|valign=&amp;quot;top&amp;quot; align=&amp;quot;center&amp;quot; colspan=&amp;quot;2&amp;quot;|&lt;br /&gt;
=== How do I... ===&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
|align=&amp;quot;center&amp;quot;|&lt;br /&gt;
'''[[Installing_Code::Blocks|...install Code::Blocks?]]'''&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;font-size:.9em&amp;quot;&amp;gt;&lt;br /&gt;
[[Installing_the_latest_official_version_of_Code::Blocks_on_Windows|Windows]] &amp;amp;middot;&lt;br /&gt;
[[Installing_Code::Blocks#Ubuntu|Ubuntu]] &amp;amp;middot;&lt;br /&gt;
[[Installing_Code::Blocks#Mac_OS_X|Mac OS X]] &amp;amp;middot;&lt;br /&gt;
[[Installing_Code::Blocks#Fedora|Fedora]] &amp;amp;middot;&lt;br /&gt;
[[Installing_Code::Blocks|more...]]&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
|align=&amp;quot;center&amp;quot;|&lt;br /&gt;
'''[[Installing_a_supported_compiler|...set up a compiler in Code::Blocks?]]'''&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;font-size:.9em&amp;quot;&amp;gt;&lt;br /&gt;
[[Installing_a_supported_compiler#MinGW.2FGCC|MinGW]] &amp;amp;middot;&lt;br /&gt;
[[Installing_a_supported_compiler#Microsoft_Visual_C.2B.2B|MS Visual C++]] &amp;amp;middot;&lt;br /&gt;
[[Installing_a_supported_compiler|more...]]&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
|align=&amp;quot;center&amp;quot;|&lt;br /&gt;
'''...create a new project?''' (Coming soon)&lt;br /&gt;
&lt;br /&gt;
|align=&amp;quot;center&amp;quot;|&lt;br /&gt;
'''[[Debugging_with_Code::Blocks|...debug my program?]]'''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
|align=&amp;quot;center&amp;quot;|&lt;br /&gt;
'''[[FAQ#Q:_How_do_I_make_Code::Blocks_portable.3F|...make Code::Blocks portable?]]'''&lt;br /&gt;
&lt;br /&gt;
|align=&amp;quot;center&amp;quot;|&lt;br /&gt;
'''[[User_documentation#Third-party_libraries|...use a 3rd-party library?]]'''&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;font-size:.9em&amp;quot;&amp;gt;&lt;br /&gt;
[[Using_wxWidgets|wxWidgets]] &amp;amp;middot;&lt;br /&gt;
[[Using_Boost|Boost]] &amp;amp;middot;&lt;br /&gt;
[[Using_SDL_with_Code::Blocks|SDL]] &amp;amp;middot;&lt;br /&gt;
[[User_documentation#Third-party_libraries|more...]]&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Layout_box3|1=&lt;br /&gt;
== Table of Contents ==&lt;br /&gt;
&amp;lt;span style=&amp;quot;font-size:.9em&amp;quot;&amp;gt;''Main article: [[Code::Blocks Documentation]]''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== [[User documentation]] ===&lt;br /&gt;
:Articles for Code::Blocks users&lt;br /&gt;
&lt;br /&gt;
=== [[FAQ]] ===&lt;br /&gt;
:Frequently Asked Questions&lt;br /&gt;
&lt;br /&gt;
=== [[Feature List]] ===&lt;br /&gt;
:An index of Code::Blocks' useful features&lt;br /&gt;
&lt;br /&gt;
=== [[Code::Blocks Plugins]] ===&lt;br /&gt;
:Plugins extend Code::Blocks' functionality&lt;br /&gt;
&lt;br /&gt;
=== [[Off-site documentation]] ===&lt;br /&gt;
:Links to external documentation&lt;br /&gt;
&lt;br /&gt;
=== [[Developer documentation]] ===&lt;br /&gt;
:Articles for developers of Code::Blocks itself&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
|width=&amp;quot;40%&amp;quot; valign=&amp;quot;top&amp;quot;|&lt;br /&gt;
&amp;lt;!-- RIGHT --&amp;gt;&lt;br /&gt;
{{Layout_box4|1=&lt;br /&gt;
=== Download Code::Blocks ===&lt;br /&gt;
* Latest official release: [https://www.codeblocks.org/downloads/26 10.05]&lt;br /&gt;
* [/index.php?board=20.0 Nightly builds] (updated each night)&lt;br /&gt;
* [[Compiled_packages_of_Code::Blocks|Official and third-party binaries]] (for various distributions)&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{Layout_box2|1=&lt;br /&gt;
=== Other resources ===&lt;br /&gt;
* [https://www.codeblocks.org Main website]&lt;br /&gt;
* [ Community forums]&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{Layout_box2|1=&lt;br /&gt;
=== Development ===&lt;br /&gt;
[[Image:Chk.png]][[Roadmap]] &lt;br /&gt;
* [[Developer documentation]]&lt;br /&gt;
* [http://developer.berlios.de/projects/codeblocks/ Project page at BerliOS]&lt;br /&gt;
* '''Bugs''': [http://developer.berlios.de/bugs/?group_id=5358 Browse] or [http://developer.berlios.de/bugs/?func=addbug&amp;amp;group_id=5358 submit new]&lt;br /&gt;
* '''Features''': [http://developer.berlios.de/feature/?group_id=5358 Browse] or [http://developer.berlios.de/feature/?func=addfeature&amp;amp;group_id=5358 submit new]&lt;br /&gt;
* '''Patches''': [http://developer.berlios.de/patch/?group_id=5358 Browse] or [http://developer.berlios.de/patch/?func=addpatch&amp;amp;group_id=5358 submit new]&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{Layout_box3|1=&lt;br /&gt;
=== Supported compilers ===&lt;br /&gt;
* [http://gcc.gnu.org/ GNU GCC (incl. G77)] (Linux)&lt;br /&gt;
* [http://www.mingw.org MinGW GCC (incl. G77)] (Win32)&lt;br /&gt;
* [http://mspgcc.sourceforge.net MSP430 GCC] (Win32, Linux, BSD)&lt;br /&gt;
* [http://www.hightec-rt.com TriCore GCC] (Win32, Linux)&lt;br /&gt;
* [http://www.hightec-rt.com PowerPC GCC] (Win32, Linux)&lt;br /&gt;
* [http://developer.apple.com/tools/ Apple GCC (Xcode)] (Mac OS X)&lt;br /&gt;
&amp;lt;!-- Tested and working with Microsoft PSDK for Windows 2003 R2 and CodeBlocks b3577 --&amp;gt;&lt;br /&gt;
* [http://xona.com/2004/06/29.html Microsoft Visual C++ Toolkit 2003] (Win32) &lt;br /&gt;
* [http://msdn.microsoft.com/vstudio/express/visualc/download/ Microsoft Visual C++ 2005] (Win32)&lt;br /&gt;
* [http://www.borland.com/products/downloads/download_cbuilder.html Borland's C++ Compiler 5.5] (Win32)&lt;br /&gt;
* [http://www.digitalmars.com/ DigitalMars C/C++] (Win32)&lt;br /&gt;
* [http://openwatcom.org/index.php/Main_Page OpenWatcom] (Win32)&lt;br /&gt;
* [http://www.intel.com/cd/software/products/asmo-na/eng/compilers/219754.htm Intel C++ compiler] (Win32)&lt;br /&gt;
* [http://sdcc.sourceforge.net/ Small Device C Compiler (SDCC)]&lt;br /&gt;
* [http://www.digitalmars.com/d/dcompiler.html Digital Mars D]&lt;br /&gt;
* [http://dgcc.sourceforge.net/ GDC D Compiler]&lt;br /&gt;
* [http://dsource.org/projects/ldc/ LLVM D Compiler]&lt;br /&gt;
}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[https://www.codeblocks.org/about.shtml The Code::Blocks team]&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[Special:Allpages|Index]]&amp;lt;/center&amp;gt;&lt;/div&gt;</summary>
		<author><name>Afb</name></author>
	</entry>
	<entry>
		<id>https://wiki.codeblocks.org/index.php?title=Installing_the_latest_official_version_of_Code::Blocks_on_Mac_OS_X&amp;diff=6379</id>
		<title>Installing the latest official version of Code::Blocks on Mac OS X</title>
		<link rel="alternate" type="text/html" href="https://wiki.codeblocks.org/index.php?title=Installing_the_latest_official_version_of_Code::Blocks_on_Mac_OS_X&amp;diff=6379"/>
		<updated>2010-06-07T06:51:13Z</updated>

		<summary type="html">&lt;p&gt;Afb: /* Install steps */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== Install steps ===&lt;br /&gt;
&lt;br /&gt;
# [https://www.codeblocks.org/downloads/26#mac Download the Code::Blocks 10.05 image]. If you know you don't have Xcode installed, download the [http://developer.apple.com/tools Developer Tools DVD] from Apple.&lt;br /&gt;
# Mount the disk image, it's a standard Apple Disk Image (.dmg). Copy the application to where you want it (e.g. /Developer/Applications).&lt;br /&gt;
&lt;br /&gt;
==== Known Bugs ====&lt;br /&gt;
&lt;br /&gt;
* The &amp;quot;keybinder&amp;quot; plugin is not working in the 10.05 release. Please disable it, or remove &amp;lt;tt&amp;gt;CodeBlocks.app/Contents/Resources/share/codeblocks/libkeybinder.so&amp;lt;/tt&amp;gt;&lt;/div&gt;</summary>
		<author><name>Afb</name></author>
	</entry>
	<entry>
		<id>https://wiki.codeblocks.org/index.php?title=Installing_the_latest_official_version_of_Code::Blocks_on_Mac_OS_X&amp;diff=6375</id>
		<title>Installing the latest official version of Code::Blocks on Mac OS X</title>
		<link rel="alternate" type="text/html" href="https://wiki.codeblocks.org/index.php?title=Installing_the_latest_official_version_of_Code::Blocks_on_Mac_OS_X&amp;diff=6375"/>
		<updated>2010-06-05T11:11:28Z</updated>

		<summary type="html">&lt;p&gt;Afb: /* Install steps */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== Install steps ===&lt;br /&gt;
&lt;br /&gt;
# [https://www.codeblocks.org/downloads/26#mac Download the Code::Blocks 10.05 image]. If you know you don't have Xcode installed, download the [http://developer.apple.com/tools Developer Tools DVD] from Apple.&lt;br /&gt;
&lt;br /&gt;
# Mount the disk image, it's a standard Apple Disk Image (.dmg). Copy the application to where you want it (e.g. /Developer/Applications).&lt;/div&gt;</summary>
		<author><name>Afb</name></author>
	</entry>
	<entry>
		<id>https://wiki.codeblocks.org/index.php?title=Installing_the_latest_official_version_of_Code::Blocks_on_Mac_OS_X&amp;diff=6374</id>
		<title>Installing the latest official version of Code::Blocks on Mac OS X</title>
		<link rel="alternate" type="text/html" href="https://wiki.codeblocks.org/index.php?title=Installing_the_latest_official_version_of_Code::Blocks_on_Mac_OS_X&amp;diff=6374"/>
		<updated>2010-06-05T11:10:06Z</updated>

		<summary type="html">&lt;p&gt;Afb: placeholder&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== Install steps ===&lt;br /&gt;
&lt;br /&gt;
# [https://www.codeblocks.org/downloads/26#mac Download the Code::Blocks 10.05 image]. If you know you don't have Xcode installed, download the [http://developer.apple.com/tools Developer Tools DVD] from Apple.&lt;br /&gt;
&lt;br /&gt;
# Mount the disk image, it's a standard Apple Disk Image. Copy the application to where you want it (e.g. /Developer/Applications).&lt;/div&gt;</summary>
		<author><name>Afb</name></author>
	</entry>
	<entry>
		<id>https://wiki.codeblocks.org/index.php?title=Installing_the_latest_official_version_of_Code::Blocks_on_Windows&amp;diff=6373</id>
		<title>Installing the latest official version of Code::Blocks on Windows</title>
		<link rel="alternate" type="text/html" href="https://wiki.codeblocks.org/index.php?title=Installing_the_latest_official_version_of_Code::Blocks_on_Windows&amp;diff=6373"/>
		<updated>2010-06-05T11:09:57Z</updated>

		<summary type="html">&lt;p&gt;Afb: /* Install steps */  10.05&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Installing Code::Blocks]]&lt;br /&gt;
[[Category:Installing the latest official version of Code::Blocks]]&lt;br /&gt;
&lt;br /&gt;
=== Install steps ===&lt;br /&gt;
&lt;br /&gt;
# [https://www.codeblocks.org/downloads/26 Download the Code::Blocks 10.05 installer]. If you know you don't have MinGW installed, download the package which has MinGW bundled.&lt;br /&gt;
# Run the installer, it's a standard installer for Windows; just press Next after reading each screen.&lt;br /&gt;
# If you're planning installing a compiler after you've installed Code::Blocks, read the information provided in the installer.&lt;br /&gt;
# If you downloaded the installer which doesn't come with MinGW, you may have to configure the compiler manually (usually Code::Blocks' auto detects the compiler).&lt;/div&gt;</summary>
		<author><name>Afb</name></author>
	</entry>
	<entry>
		<id>https://wiki.codeblocks.org/index.php?title=Installing_Code::Blocks&amp;diff=6372</id>
		<title>Installing Code::Blocks</title>
		<link rel="alternate" type="text/html" href="https://wiki.codeblocks.org/index.php?title=Installing_Code::Blocks&amp;diff=6372"/>
		<updated>2010-06-05T11:04:12Z</updated>

		<summary type="html">&lt;p&gt;Afb: /* Mac OS X */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Installing Code::Blocks]]&lt;br /&gt;
&lt;br /&gt;
[[Compiled packages of Code::Blocks]]&lt;br /&gt;
&lt;br /&gt;
== MS Windows ==&lt;br /&gt;
&lt;br /&gt;
* [[Installing the latest official version of Code::Blocks on Windows]]&lt;br /&gt;
* [[Installing Code::Blocks nightly build on Windows]]&lt;br /&gt;
* [[Installing Code::Blocks from source on Windows]]&lt;br /&gt;
&lt;br /&gt;
== Linux ==&lt;br /&gt;
&lt;br /&gt;
* [[Installing Code::Blocks from source on Linux]] (applies to all distros)&lt;br /&gt;
&lt;br /&gt;
=== Ubuntu ===&lt;br /&gt;
&lt;br /&gt;
:* [[Installing Code::Blocks nightly build on Ubuntu]]&lt;br /&gt;
&lt;br /&gt;
=== Debian ===&lt;br /&gt;
&lt;br /&gt;
:* [http://apt.jenslody.de/ Installing Code::Blocks nightly build on Debian]&lt;br /&gt;
&lt;br /&gt;
=== Fedora ===&lt;br /&gt;
&lt;br /&gt;
:* [[Installing Code::Blocks nightly build on Fedora]]&lt;br /&gt;
&lt;br /&gt;
=== Blag ===&lt;br /&gt;
&lt;br /&gt;
:* [[Installing Code::Blocks nightly build on Blag]]&lt;br /&gt;
&lt;br /&gt;
=== Gentoo ===&lt;br /&gt;
&lt;br /&gt;
:* [[Installing Code::Blocks from source on Gentoo]]&lt;br /&gt;
&lt;br /&gt;
=== RPM based distributions ===&lt;br /&gt;
&lt;br /&gt;
Such as: Red Hat Linux, Yellow Dog Linux, Fedora Core, CentOS, etc. etc.&lt;br /&gt;
&lt;br /&gt;
:* [[Installing Code::Blocks nightly build on RPM based distributions]]&lt;br /&gt;
:* [[Installing Code::Blocks from source on RPM based distributions]]&lt;br /&gt;
&lt;br /&gt;
== BSD ==&lt;br /&gt;
&lt;br /&gt;
=== FreeBSD ===&lt;br /&gt;
&lt;br /&gt;
:* [[Installing Code::Blocks from source on FreeBSD]]&lt;br /&gt;
&lt;br /&gt;
== Solaris ==&lt;br /&gt;
&lt;br /&gt;
* [[Installing Code::Blocks from source on Solaris]]&lt;br /&gt;
&lt;br /&gt;
== Mac OS X ==&lt;br /&gt;
&lt;br /&gt;
* [[Installing the latest official version of Code::Blocks on Mac OS X]]&lt;br /&gt;
&lt;br /&gt;
* [[Installing Code::Blocks nightly build on Mac OS X]]&lt;br /&gt;
&lt;br /&gt;
* [[Installing Code::Blocks from source on Mac OS X]]&lt;br /&gt;
&lt;br /&gt;
==Working on Code::Blocks sources from within Code::Blocks!==&lt;br /&gt;
&lt;br /&gt;
The following applies for all platforms where you have Code::Blocks installed and working.&lt;br /&gt;
&lt;br /&gt;
After correct install of Code::Blocks you will find two folders under .../trunc/scr , a directory named &amp;quot;devel&amp;quot; and another one named &amp;quot;output&amp;quot;.&lt;br /&gt;
These two folders will contain the same files and directory structure and you can use the IDE from either of these two directories. This structure has been created so that you can work in Code::Blocks while editing Code::Blocks' sources ;).&lt;br /&gt;
Basically, you 'll be using the &amp;quot;output/CodeBlocks.exe&amp;quot; executable. Code::Blocks' project settings are such that all output goes under &amp;quot;devel&amp;quot;. So you can edit Code::Blocks' sources inside Code::Blocks and, when pressing &amp;quot;Run&amp;quot;, it will run the &amp;quot;devel/CodeBlocks.exe&amp;quot; executable ;). This way, you can't ruin the main executable you 're using (under &amp;quot;output&amp;quot;). When your changes satisfy you and all works well, quit Code::Blocks, run &amp;quot;make update&amp;quot; from command line and re-launch &amp;quot;output/CodeBlocks.exe&amp;quot;. You 'll be working on your brand new IDE!&lt;/div&gt;</summary>
		<author><name>Afb</name></author>
	</entry>
	<entry>
		<id>https://wiki.codeblocks.org/index.php?title=Installing_Code::Blocks_from_source_on_Mac_OS_X&amp;diff=6371</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=6371"/>
		<updated>2010-06-05T11:01:47Z</updated>

		<summary type="html">&lt;p&gt;Afb: /* Configure */&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.4 (PowerPC and Intel),&lt;br /&gt;
and should work similarly on the newer Mac OS X 10.5 and 10.6 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;
Apple regularly pulls all older links in order to promote newer Mac OS X, 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;
&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 ===&lt;br /&gt;
&lt;br /&gt;
For Mac OS X 10.4, you will only need an upgraded (local) installation of automake 1.9.x.&lt;br /&gt;
&lt;br /&gt;
You can download &amp;quot;[ftp://ftp.gnu.org/gnu/automake/automake-1.9.6.tar.gz automake-1.9.6.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.9&lt;br /&gt;
make&lt;br /&gt;
sudo make install&lt;br /&gt;
sudo cp -pi /usr/share/aclocal/libtool.m4 /usr/local/share/aclocal-1.9/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Since it's now known as &amp;quot;automake-1.9&amp;quot;, it won't interfere with the regular &amp;quot;automake&amp;quot;&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: Compilers ==&lt;br /&gt;
&lt;br /&gt;
When building for older versions of the SDK, you want to make sure to use the same compiler.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CC = gcc-4.0&lt;br /&gt;
&lt;br /&gt;
CXX = g++-4.0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Mac OS X 10.6 has GCC 4.2 as the default compiler, which won't work for the Mac OS X 10.4 SDK.&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;
== FYI: 32-bit or 64-bit ==&lt;br /&gt;
&lt;br /&gt;
Code::Blocks currently uses wxMac (wxOSX/Carbon), which is 32-bit only. So it's not possible to build for &amp;quot;x86_64&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
When Code::Blocks (and requirements) has been updated to use wxOSX/Cocoa, then a 64-bit version might be built too.&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;
&amp;lt;pre&amp;gt;&lt;br /&gt;
--enable-universal_binary --with-macosx-sdk=/Developer/SDKs/MacOSX10.4u.sdk --with-macosx-version-min=10.4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&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.8/wx/wx.h&lt;br /&gt;
/usr/local/lib/libwx_macu-2.8.dylib -&amp;gt; libwx_macu-2.8.0.dylib&lt;br /&gt;
/usr/local/lib/libwx_macu-2.8.0.dylib -&amp;gt; libwx_macu-2.8.0.6.0.dylib&lt;br /&gt;
/usr/local/lib/libwx_macu-2.8.0.6.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.8.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.8&lt;br /&gt;
/Library/Frameworks/wx.framework/Versions/2.8/Headers/wx.h&lt;br /&gt;
/Library/Frameworks/wx.framework/Versions/2.8/wx  -&amp;gt; libwx_macu-2.8.0.dylib&lt;br /&gt;
/Library/Frameworks/wx.framework/Versions/2.8/libwx_macu-2.8.0.dylib  -&amp;gt; libwx_macu-2.8.0.6.0.dylib&lt;br /&gt;
/Library/Frameworks/wx.framework/Versions/2.8/libwx_macu-2.8.0.6.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.8/libwx_macu-2.8.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;
On Mac OS X 10.4, you need to install the Subversion (svn) program:&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 --with-contrib-plugins=all&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 --with-contrib-plugins=all&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 --with-contrib-plugins=all&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 don't need to create a whole bundle.&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;
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;
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;
* codeblocks.plist (generated, rename to &amp;quot;Info.plist&amp;quot;)&lt;br /&gt;
* codeblocks.sh (shell wrapper, rename to &amp;quot;CodeBlocks&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
&lt;br /&gt;
DIR=&amp;quot;`dirname \&amp;quot;$0\&amp;quot;`/..&amp;quot;&lt;br /&gt;
&lt;br /&gt;
BIN=&amp;quot;$DIR/bin&amp;quot;&lt;br /&gt;
LIB=&amp;quot;$DIR/lib&amp;quot;&lt;br /&gt;
&lt;br /&gt;
DYLD_LIBRARY_PATH=&amp;quot;$DYLD_LIBRARY_PATH:$LIB&amp;quot;&lt;br /&gt;
export DYLD_LIBRARY_PATH&lt;br /&gt;
&lt;br /&gt;
exec &amp;quot;$BIN/codeblocks&amp;quot; --prefix=&amp;quot;$DIR&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* app.icns (icons are available in src/src/resources/icons)&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://puredarwin.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>Afb</name></author>
	</entry>
	<entry>
		<id>https://wiki.codeblocks.org/index.php?title=Installing_Code::Blocks_from_source_on_Mac_OS_X&amp;diff=6370</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=6370"/>
		<updated>2010-06-05T10:59:22Z</updated>

		<summary type="html">&lt;p&gt;Afb: /* FYI: Darwin vs. Mac OS X */&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.4 (PowerPC and Intel),&lt;br /&gt;
and should work similarly on the newer Mac OS X 10.5 and 10.6 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;
Apple regularly pulls all older links in order to promote newer Mac OS X, 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;
&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 ===&lt;br /&gt;
&lt;br /&gt;
For Mac OS X 10.4, you will only need an upgraded (local) installation of automake 1.9.x.&lt;br /&gt;
&lt;br /&gt;
You can download &amp;quot;[ftp://ftp.gnu.org/gnu/automake/automake-1.9.6.tar.gz automake-1.9.6.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.9&lt;br /&gt;
make&lt;br /&gt;
sudo make install&lt;br /&gt;
sudo cp -pi /usr/share/aclocal/libtool.m4 /usr/local/share/aclocal-1.9/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Since it's now known as &amp;quot;automake-1.9&amp;quot;, it won't interfere with the regular &amp;quot;automake&amp;quot;&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: Compilers ==&lt;br /&gt;
&lt;br /&gt;
When building for older versions of the SDK, you want to make sure to use the same compiler.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CC = gcc-4.0&lt;br /&gt;
&lt;br /&gt;
CXX = g++-4.0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Mac OS X 10.6 has GCC 4.2 as the default compiler, which won't work for the Mac OS X 10.4 SDK.&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;
== FYI: 32-bit or 64-bit ==&lt;br /&gt;
&lt;br /&gt;
Code::Blocks currently uses wxMac (wxOSX/Carbon), which is 32-bit only. So it's not possible to build for &amp;quot;x86_64&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
When Code::Blocks (and requirements) has been updated to use wxOSX/Cocoa, then a 64-bit version might be built too.&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;
&amp;lt;pre&amp;gt;&lt;br /&gt;
--enable-universal_binary --with-macosx-sdk=/Developer/SDKs/MacOSX10.4u.sdk --with-macosx-version-min=10.4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&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.8/wx/wx.h&lt;br /&gt;
/usr/local/lib/libwx_macu-2.8.dylib -&amp;gt; libwx_macu-2.8.0.dylib&lt;br /&gt;
/usr/local/lib/libwx_macu-2.8.0.dylib -&amp;gt; libwx_macu-2.8.0.6.0.dylib&lt;br /&gt;
/usr/local/lib/libwx_macu-2.8.0.6.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.8.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.8&lt;br /&gt;
/Library/Frameworks/wx.framework/Versions/2.8/Headers/wx.h&lt;br /&gt;
/Library/Frameworks/wx.framework/Versions/2.8/wx  -&amp;gt; libwx_macu-2.8.0.dylib&lt;br /&gt;
/Library/Frameworks/wx.framework/Versions/2.8/libwx_macu-2.8.0.dylib  -&amp;gt; libwx_macu-2.8.0.6.0.dylib&lt;br /&gt;
/Library/Frameworks/wx.framework/Versions/2.8/libwx_macu-2.8.0.6.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.8/libwx_macu-2.8.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;
On Mac OS X 10.4, you need to install the Subversion (svn) program:&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 don't need to create a whole bundle.&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;
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;
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;
* codeblocks.plist (generated, rename to &amp;quot;Info.plist&amp;quot;)&lt;br /&gt;
* codeblocks.sh (shell wrapper, rename to &amp;quot;CodeBlocks&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
&lt;br /&gt;
DIR=&amp;quot;`dirname \&amp;quot;$0\&amp;quot;`/..&amp;quot;&lt;br /&gt;
&lt;br /&gt;
BIN=&amp;quot;$DIR/bin&amp;quot;&lt;br /&gt;
LIB=&amp;quot;$DIR/lib&amp;quot;&lt;br /&gt;
&lt;br /&gt;
DYLD_LIBRARY_PATH=&amp;quot;$DYLD_LIBRARY_PATH:$LIB&amp;quot;&lt;br /&gt;
export DYLD_LIBRARY_PATH&lt;br /&gt;
&lt;br /&gt;
exec &amp;quot;$BIN/codeblocks&amp;quot; --prefix=&amp;quot;$DIR&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* app.icns (icons are available in src/src/resources/icons)&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://puredarwin.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>Afb</name></author>
	</entry>
	<entry>
		<id>https://wiki.codeblocks.org/index.php?title=Installing_Code::Blocks_from_source_on_Mac_OS_X&amp;diff=6369</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=6369"/>
		<updated>2010-06-05T10:58:08Z</updated>

		<summary type="html">&lt;p&gt;Afb: /* Way Two: NeXT (bundle) */&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.4 (PowerPC and Intel),&lt;br /&gt;
and should work similarly on the newer Mac OS X 10.5 and 10.6 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;
Apple regularly pulls all older links in order to promote newer Mac OS X, 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;
&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 ===&lt;br /&gt;
&lt;br /&gt;
For Mac OS X 10.4, you will only need an upgraded (local) installation of automake 1.9.x.&lt;br /&gt;
&lt;br /&gt;
You can download &amp;quot;[ftp://ftp.gnu.org/gnu/automake/automake-1.9.6.tar.gz automake-1.9.6.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.9&lt;br /&gt;
make&lt;br /&gt;
sudo make install&lt;br /&gt;
sudo cp -pi /usr/share/aclocal/libtool.m4 /usr/local/share/aclocal-1.9/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Since it's now known as &amp;quot;automake-1.9&amp;quot;, it won't interfere with the regular &amp;quot;automake&amp;quot;&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: Compilers ==&lt;br /&gt;
&lt;br /&gt;
When building for older versions of the SDK, you want to make sure to use the same compiler.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CC = gcc-4.0&lt;br /&gt;
&lt;br /&gt;
CXX = g++-4.0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Mac OS X 10.6 has GCC 4.2 as the default compiler, which won't work for the Mac OS X 10.4 SDK.&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;
== FYI: 32-bit or 64-bit ==&lt;br /&gt;
&lt;br /&gt;
Code::Blocks currently uses wxMac (wxOSX/Carbon), which is 32-bit only. So it's not possible to build for &amp;quot;x86_64&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
When Code::Blocks (and requirements) has been updated to use wxOSX/Cocoa, then a 64-bit version might be built too.&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;
&amp;lt;pre&amp;gt;&lt;br /&gt;
--enable-universal_binary --with-macosx-sdk=/Developer/SDKs/MacOSX10.4u.sdk --with-macosx-version-min=10.4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&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.8/wx/wx.h&lt;br /&gt;
/usr/local/lib/libwx_macu-2.8.dylib -&amp;gt; libwx_macu-2.8.0.dylib&lt;br /&gt;
/usr/local/lib/libwx_macu-2.8.0.dylib -&amp;gt; libwx_macu-2.8.0.6.0.dylib&lt;br /&gt;
/usr/local/lib/libwx_macu-2.8.0.6.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.8.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.8&lt;br /&gt;
/Library/Frameworks/wx.framework/Versions/2.8/Headers/wx.h&lt;br /&gt;
/Library/Frameworks/wx.framework/Versions/2.8/wx  -&amp;gt; libwx_macu-2.8.0.dylib&lt;br /&gt;
/Library/Frameworks/wx.framework/Versions/2.8/libwx_macu-2.8.0.dylib  -&amp;gt; libwx_macu-2.8.0.6.0.dylib&lt;br /&gt;
/Library/Frameworks/wx.framework/Versions/2.8/libwx_macu-2.8.0.6.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.8/libwx_macu-2.8.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;
On Mac OS X 10.4, you need to install the Subversion (svn) program:&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 don't need to create a whole bundle.&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;
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;
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;
* codeblocks.plist (generated, rename to &amp;quot;Info.plist&amp;quot;)&lt;br /&gt;
* codeblocks.sh (shell wrapper, rename to &amp;quot;CodeBlocks&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
&lt;br /&gt;
DIR=&amp;quot;`dirname \&amp;quot;$0\&amp;quot;`/..&amp;quot;&lt;br /&gt;
&lt;br /&gt;
BIN=&amp;quot;$DIR/bin&amp;quot;&lt;br /&gt;
LIB=&amp;quot;$DIR/lib&amp;quot;&lt;br /&gt;
&lt;br /&gt;
DYLD_LIBRARY_PATH=&amp;quot;$DYLD_LIBRARY_PATH:$LIB&amp;quot;&lt;br /&gt;
export DYLD_LIBRARY_PATH&lt;br /&gt;
&lt;br /&gt;
exec &amp;quot;$BIN/codeblocks&amp;quot; --prefix=&amp;quot;$DIR&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* app.icns (icons are available in src/src/resources/icons)&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>Afb</name></author>
	</entry>
	<entry>
		<id>https://wiki.codeblocks.org/index.php?title=Installing_Code::Blocks_from_source_on_Mac_OS_X&amp;diff=6368</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=6368"/>
		<updated>2010-06-05T10:52:24Z</updated>

		<summary type="html">&lt;p&gt;Afb: /* Way One: Mac OS (resource) */&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.4 (PowerPC and Intel),&lt;br /&gt;
and should work similarly on the newer Mac OS X 10.5 and 10.6 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;
Apple regularly pulls all older links in order to promote newer Mac OS X, 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;
&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 ===&lt;br /&gt;
&lt;br /&gt;
For Mac OS X 10.4, you will only need an upgraded (local) installation of automake 1.9.x.&lt;br /&gt;
&lt;br /&gt;
You can download &amp;quot;[ftp://ftp.gnu.org/gnu/automake/automake-1.9.6.tar.gz automake-1.9.6.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.9&lt;br /&gt;
make&lt;br /&gt;
sudo make install&lt;br /&gt;
sudo cp -pi /usr/share/aclocal/libtool.m4 /usr/local/share/aclocal-1.9/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Since it's now known as &amp;quot;automake-1.9&amp;quot;, it won't interfere with the regular &amp;quot;automake&amp;quot;&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: Compilers ==&lt;br /&gt;
&lt;br /&gt;
When building for older versions of the SDK, you want to make sure to use the same compiler.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CC = gcc-4.0&lt;br /&gt;
&lt;br /&gt;
CXX = g++-4.0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Mac OS X 10.6 has GCC 4.2 as the default compiler, which won't work for the Mac OS X 10.4 SDK.&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;
== FYI: 32-bit or 64-bit ==&lt;br /&gt;
&lt;br /&gt;
Code::Blocks currently uses wxMac (wxOSX/Carbon), which is 32-bit only. So it's not possible to build for &amp;quot;x86_64&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
When Code::Blocks (and requirements) has been updated to use wxOSX/Cocoa, then a 64-bit version might be built too.&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;
&amp;lt;pre&amp;gt;&lt;br /&gt;
--enable-universal_binary --with-macosx-sdk=/Developer/SDKs/MacOSX10.4u.sdk --with-macosx-version-min=10.4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&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.8/wx/wx.h&lt;br /&gt;
/usr/local/lib/libwx_macu-2.8.dylib -&amp;gt; libwx_macu-2.8.0.dylib&lt;br /&gt;
/usr/local/lib/libwx_macu-2.8.0.dylib -&amp;gt; libwx_macu-2.8.0.6.0.dylib&lt;br /&gt;
/usr/local/lib/libwx_macu-2.8.0.6.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.8.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.8&lt;br /&gt;
/Library/Frameworks/wx.framework/Versions/2.8/Headers/wx.h&lt;br /&gt;
/Library/Frameworks/wx.framework/Versions/2.8/wx  -&amp;gt; libwx_macu-2.8.0.dylib&lt;br /&gt;
/Library/Frameworks/wx.framework/Versions/2.8/libwx_macu-2.8.0.dylib  -&amp;gt; libwx_macu-2.8.0.6.0.dylib&lt;br /&gt;
/Library/Frameworks/wx.framework/Versions/2.8/libwx_macu-2.8.0.6.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.8/libwx_macu-2.8.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;
On Mac OS X 10.4, you need to install the Subversion (svn) program:&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 don't need to create a whole bundle.&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;
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;
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>Afb</name></author>
	</entry>
	<entry>
		<id>https://wiki.codeblocks.org/index.php?title=Installing_Code::Blocks_from_source_on_Mac_OS_X&amp;diff=6367</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=6367"/>
		<updated>2010-06-05T10:49:12Z</updated>

		<summary type="html">&lt;p&gt;Afb: /* Install Subversion client */&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.4 (PowerPC and Intel),&lt;br /&gt;
and should work similarly on the newer Mac OS X 10.5 and 10.6 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;
Apple regularly pulls all older links in order to promote newer Mac OS X, 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;
&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 ===&lt;br /&gt;
&lt;br /&gt;
For Mac OS X 10.4, you will only need an upgraded (local) installation of automake 1.9.x.&lt;br /&gt;
&lt;br /&gt;
You can download &amp;quot;[ftp://ftp.gnu.org/gnu/automake/automake-1.9.6.tar.gz automake-1.9.6.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.9&lt;br /&gt;
make&lt;br /&gt;
sudo make install&lt;br /&gt;
sudo cp -pi /usr/share/aclocal/libtool.m4 /usr/local/share/aclocal-1.9/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Since it's now known as &amp;quot;automake-1.9&amp;quot;, it won't interfere with the regular &amp;quot;automake&amp;quot;&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: Compilers ==&lt;br /&gt;
&lt;br /&gt;
When building for older versions of the SDK, you want to make sure to use the same compiler.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CC = gcc-4.0&lt;br /&gt;
&lt;br /&gt;
CXX = g++-4.0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Mac OS X 10.6 has GCC 4.2 as the default compiler, which won't work for the Mac OS X 10.4 SDK.&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;
== FYI: 32-bit or 64-bit ==&lt;br /&gt;
&lt;br /&gt;
Code::Blocks currently uses wxMac (wxOSX/Carbon), which is 32-bit only. So it's not possible to build for &amp;quot;x86_64&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
When Code::Blocks (and requirements) has been updated to use wxOSX/Cocoa, then a 64-bit version might be built too.&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;
&amp;lt;pre&amp;gt;&lt;br /&gt;
--enable-universal_binary --with-macosx-sdk=/Developer/SDKs/MacOSX10.4u.sdk --with-macosx-version-min=10.4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&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.8/wx/wx.h&lt;br /&gt;
/usr/local/lib/libwx_macu-2.8.dylib -&amp;gt; libwx_macu-2.8.0.dylib&lt;br /&gt;
/usr/local/lib/libwx_macu-2.8.0.dylib -&amp;gt; libwx_macu-2.8.0.6.0.dylib&lt;br /&gt;
/usr/local/lib/libwx_macu-2.8.0.6.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.8.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.8&lt;br /&gt;
/Library/Frameworks/wx.framework/Versions/2.8/Headers/wx.h&lt;br /&gt;
/Library/Frameworks/wx.framework/Versions/2.8/wx  -&amp;gt; libwx_macu-2.8.0.dylib&lt;br /&gt;
/Library/Frameworks/wx.framework/Versions/2.8/libwx_macu-2.8.0.dylib  -&amp;gt; libwx_macu-2.8.0.6.0.dylib&lt;br /&gt;
/Library/Frameworks/wx.framework/Versions/2.8/libwx_macu-2.8.0.6.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.8/libwx_macu-2.8.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;
On Mac OS X 10.4, you need to install the Subversion (svn) program:&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>Afb</name></author>
	</entry>
	<entry>
		<id>https://wiki.codeblocks.org/index.php?title=Installing_Code::Blocks_from_source_on_Mac_OS_X&amp;diff=6366</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=6366"/>
		<updated>2010-06-05T10:42:28Z</updated>

		<summary type="html">&lt;p&gt;Afb: compilers and bits&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.4 (PowerPC and Intel),&lt;br /&gt;
and should work similarly on the newer Mac OS X 10.5 and 10.6 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;
Apple regularly pulls all older links in order to promote newer Mac OS X, 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;
&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 ===&lt;br /&gt;
&lt;br /&gt;
For Mac OS X 10.4, you will only need an upgraded (local) installation of automake 1.9.x.&lt;br /&gt;
&lt;br /&gt;
You can download &amp;quot;[ftp://ftp.gnu.org/gnu/automake/automake-1.9.6.tar.gz automake-1.9.6.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.9&lt;br /&gt;
make&lt;br /&gt;
sudo make install&lt;br /&gt;
sudo cp -pi /usr/share/aclocal/libtool.m4 /usr/local/share/aclocal-1.9/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Since it's now known as &amp;quot;automake-1.9&amp;quot;, it won't interfere with the regular &amp;quot;automake&amp;quot;&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: Compilers ==&lt;br /&gt;
&lt;br /&gt;
When building for older versions of the SDK, you want to make sure to use the same compiler.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CC = gcc-4.0&lt;br /&gt;
&lt;br /&gt;
CXX = g++-4.0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Mac OS X 10.6 has GCC 4.2 as the default compiler, which won't work for the Mac OS X 10.4 SDK.&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;
== FYI: 32-bit or 64-bit ==&lt;br /&gt;
&lt;br /&gt;
Code::Blocks currently uses wxMac (wxOSX/Carbon), which is 32-bit only. So it's not possible to build for &amp;quot;x86_64&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
When Code::Blocks (and requirements) has been updated to use wxOSX/Cocoa, then a 64-bit version might be built too.&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;
&amp;lt;pre&amp;gt;&lt;br /&gt;
--enable-universal_binary --with-macosx-sdk=/Developer/SDKs/MacOSX10.4u.sdk --with-macosx-version-min=10.4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&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.8/wx/wx.h&lt;br /&gt;
/usr/local/lib/libwx_macu-2.8.dylib -&amp;gt; libwx_macu-2.8.0.dylib&lt;br /&gt;
/usr/local/lib/libwx_macu-2.8.0.dylib -&amp;gt; libwx_macu-2.8.0.6.0.dylib&lt;br /&gt;
/usr/local/lib/libwx_macu-2.8.0.6.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.8.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.8&lt;br /&gt;
/Library/Frameworks/wx.framework/Versions/2.8/Headers/wx.h&lt;br /&gt;
/Library/Frameworks/wx.framework/Versions/2.8/wx  -&amp;gt; libwx_macu-2.8.0.dylib&lt;br /&gt;
/Library/Frameworks/wx.framework/Versions/2.8/libwx_macu-2.8.0.dylib  -&amp;gt; libwx_macu-2.8.0.6.0.dylib&lt;br /&gt;
/Library/Frameworks/wx.framework/Versions/2.8/libwx_macu-2.8.0.6.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.8/libwx_macu-2.8.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>Afb</name></author>
	</entry>
	<entry>
		<id>https://wiki.codeblocks.org/index.php?title=Installing_Code::Blocks_from_source_on_Mac_OS_X&amp;diff=6365</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=6365"/>
		<updated>2010-06-05T10:29:25Z</updated>

		<summary type="html">&lt;p&gt;Afb: /* Bundle library for Mac */&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.4 (PowerPC and Intel),&lt;br /&gt;
and should work similarly on the newer Mac OS X 10.5 and 10.6 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;
Apple regularly pulls all older links in order to promote newer Mac OS X, 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;
&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 ===&lt;br /&gt;
&lt;br /&gt;
For Mac OS X 10.4, you will only need an upgraded (local) installation of automake 1.9.x.&lt;br /&gt;
&lt;br /&gt;
You can download &amp;quot;[ftp://ftp.gnu.org/gnu/automake/automake-1.9.6.tar.gz automake-1.9.6.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.9&lt;br /&gt;
make&lt;br /&gt;
sudo make install&lt;br /&gt;
sudo cp -pi /usr/share/aclocal/libtool.m4 /usr/local/share/aclocal-1.9/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Since it's now known as &amp;quot;automake-1.9&amp;quot;, it won't interfere with the regular &amp;quot;automake&amp;quot;&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;
&amp;lt;pre&amp;gt;&lt;br /&gt;
--enable-universal_binary --with-macosx-sdk=/Developer/SDKs/MacOSX10.4u.sdk --with-macosx-version-min=10.4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&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.8/wx/wx.h&lt;br /&gt;
/usr/local/lib/libwx_macu-2.8.dylib -&amp;gt; libwx_macu-2.8.0.dylib&lt;br /&gt;
/usr/local/lib/libwx_macu-2.8.0.dylib -&amp;gt; libwx_macu-2.8.0.6.0.dylib&lt;br /&gt;
/usr/local/lib/libwx_macu-2.8.0.6.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.8.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.8&lt;br /&gt;
/Library/Frameworks/wx.framework/Versions/2.8/Headers/wx.h&lt;br /&gt;
/Library/Frameworks/wx.framework/Versions/2.8/wx  -&amp;gt; libwx_macu-2.8.0.dylib&lt;br /&gt;
/Library/Frameworks/wx.framework/Versions/2.8/libwx_macu-2.8.0.dylib  -&amp;gt; libwx_macu-2.8.0.6.0.dylib&lt;br /&gt;
/Library/Frameworks/wx.framework/Versions/2.8/libwx_macu-2.8.0.6.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.8/libwx_macu-2.8.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>Afb</name></author>
	</entry>
	<entry>
		<id>https://wiki.codeblocks.org/index.php?title=Installing_Code::Blocks_from_source_on_Mac_OS_X&amp;diff=6364</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=6364"/>
		<updated>2010-06-05T10:25:10Z</updated>

		<summary type="html">&lt;p&gt;Afb: /* Automake example (Panther) */&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.4 (PowerPC and Intel),&lt;br /&gt;
and should work similarly on the newer Mac OS X 10.5 and 10.6 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;
Apple regularly pulls all older links in order to promote newer Mac OS X, 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;
&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 ===&lt;br /&gt;
&lt;br /&gt;
For Mac OS X 10.4, you will only need an upgraded (local) installation of automake 1.9.x.&lt;br /&gt;
&lt;br /&gt;
You can download &amp;quot;[ftp://ftp.gnu.org/gnu/automake/automake-1.9.6.tar.gz automake-1.9.6.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.9&lt;br /&gt;
make&lt;br /&gt;
sudo make install&lt;br /&gt;
sudo cp -pi /usr/share/aclocal/libtool.m4 /usr/local/share/aclocal-1.9/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Since it's now known as &amp;quot;automake-1.9&amp;quot;, it won't interfere with the regular &amp;quot;automake&amp;quot;&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;
&amp;lt;pre&amp;gt;&lt;br /&gt;
--enable-universal_binary --with-macosx-sdk=/Developer/SDKs/MacOSX10.4u.sdk --with-macosx-version-min=10.4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&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>Afb</name></author>
	</entry>
	<entry>
		<id>https://wiki.codeblocks.org/index.php?title=Installing_Code::Blocks_from_source_on_Mac_OS_X&amp;diff=6363</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=6363"/>
		<updated>2010-06-05T10:21:29Z</updated>

		<summary type="html">&lt;p&gt;Afb: /* Install Developer Tools */&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.4 (PowerPC and Intel),&lt;br /&gt;
and should work similarly on the newer Mac OS X 10.5 and 10.6 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;
Apple regularly pulls all older links in order to promote newer Mac OS X, 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;
&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;
&amp;lt;pre&amp;gt;&lt;br /&gt;
--enable-universal_binary --with-macosx-sdk=/Developer/SDKs/MacOSX10.4u.sdk --with-macosx-version-min=10.4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&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>Afb</name></author>
	</entry>
	<entry>
		<id>https://wiki.codeblocks.org/index.php?title=Installing_Code::Blocks_from_source_on_Mac_OS_X&amp;diff=6362</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=6362"/>
		<updated>2010-06-05T10:18:36Z</updated>

		<summary type="html">&lt;p&gt;Afb: update supported systems versions&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.4 (PowerPC and Intel),&lt;br /&gt;
and should work similarly on the newer Mac OS X 10.5 and 10.6 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;
&amp;lt;pre&amp;gt;&lt;br /&gt;
--enable-universal_binary --with-macosx-sdk=/Developer/SDKs/MacOSX10.4u.sdk --with-macosx-version-min=10.4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&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>Afb</name></author>
	</entry>
	<entry>
		<id>https://wiki.codeblocks.org/index.php?title=Installing_Code::Blocks_from_source_on_Mac_OS_X&amp;diff=6361</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=6361"/>
		<updated>2010-06-05T10:16:04Z</updated>

		<summary type="html">&lt;p&gt;Afb: /* Configure and (GNU) Make */&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;
&amp;lt;pre&amp;gt;&lt;br /&gt;
--enable-universal_binary --with-macosx-sdk=/Developer/SDKs/MacOSX10.4u.sdk --with-macosx-version-min=10.4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&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>Afb</name></author>
	</entry>
	<entry>
		<id>https://wiki.codeblocks.org/index.php?title=Installing_Code::Blocks_nightly_build_on_Mac_OS_X&amp;diff=6360</id>
		<title>Installing Code::Blocks nightly build on Mac OS X</title>
		<link rel="alternate" type="text/html" href="https://wiki.codeblocks.org/index.php?title=Installing_Code::Blocks_nightly_build_on_Mac_OS_X&amp;diff=6360"/>
		<updated>2010-06-05T10:09:35Z</updated>

		<summary type="html">&lt;p&gt;Afb: update names/versions&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Installing Code::Blocks]]&lt;br /&gt;
[[Category:Installing Code::Blocks nightly build]]&lt;br /&gt;
This article describes how to install a nightly build of Code::Blocks.&lt;br /&gt;
&lt;br /&gt;
:''NOTE'': The nightly builds for Mac OS X are not official (just yet)&lt;br /&gt;
&lt;br /&gt;
The packages are currently done infrequently, and not really &amp;quot;nightly&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
=== Install steps ===&lt;br /&gt;
&lt;br /&gt;
# Download the Developer Tools from [http://developer.apple.com/tools/ Apple], if not installed with Mac OS X.&lt;br /&gt;
#* For Mac OS X 10.4, you need to install Xcode Tools version 2.4 or later&lt;br /&gt;
# Download the latest Mac binary ZIP package of Code::Blocks, from [http://developer.berlios.de/project/showfiles.php?group_id=5358 BerliOS].&lt;br /&gt;
#* For Mac OS X 10.4 up to 10.6 (PowerPC or Intel), download the &amp;quot;Universal&amp;quot;&lt;br /&gt;
# Now unpack the zip file package, and put CodeBlocks.app where you like it.&lt;br /&gt;
#* The suggested location is /Developer/Applications or ~/Applications.&lt;br /&gt;
#* wxWidgets (2.8.x, dylib) is included inside the application bundle.&lt;br /&gt;
&lt;br /&gt;
=== MacPorts ===&lt;br /&gt;
&lt;br /&gt;
If you prefer, you can install Code::Blocks / wxWidgets using [http://www.macports.org MacPorts] instead:&lt;br /&gt;
[[Installing_Code::Blocks_from_source_on_Mac_OS_X#Install_with_MacPorts]].&lt;br /&gt;
&lt;br /&gt;
There are no binary packages for MacPorts just yet, so it compiles from the source.&lt;br /&gt;
&lt;br /&gt;
=== Known Issues ===&lt;br /&gt;
&lt;br /&gt;
First of all, see the issues that apply to all builds of Code::Blocks:&lt;br /&gt;
&lt;br /&gt;
* /index.php?board=20.0 (release notes)&lt;br /&gt;
* http://developer.berlios.de/bugs/?group_id=5358 (reported bugs)&lt;br /&gt;
&lt;br /&gt;
There are also some bugs that only apply to the Mac OS X version:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;s&amp;gt;Open in console doesn't work with Terminal.app, only wxGTK/X11/xterm&amp;lt;/s&amp;gt;&lt;br /&gt;
* &amp;lt;s&amp;gt;Splash window is not centered on the display&amp;lt;/s&amp;gt;&lt;br /&gt;
* Occasional &amp;quot;can't flush file descriptor 12&amp;quot;&lt;br /&gt;
* Batch building (from the terminal) crashes&lt;br /&gt;
&lt;br /&gt;
Not really bugs, but some things that might require extra setup:&lt;br /&gt;
* There is no direct support for adding frameworks, use -framework&lt;br /&gt;
* The default package does not have developer files for wxWidgets&lt;br /&gt;
* Not all wizards have Mac tweaks to the generated code/projects&lt;br /&gt;
* Not all of the included contributed plugins work on Mac just yet&lt;/div&gt;</summary>
		<author><name>Afb</name></author>
	</entry>
	<entry>
		<id>https://wiki.codeblocks.org/index.php?title=Installing_Code::Blocks_from_source_on_Mac_OS_X&amp;diff=4858</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=4858"/>
		<updated>2007-08-08T09:14:53Z</updated>

		<summary type="html">&lt;p&gt;Afb: /* Install Code::Blocks */&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:&lt;br /&gt;
&lt;br /&gt;
http://developer.apple.com/tools/&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. For Mac OS X 10.1-10.2, the latest Dev Tools.&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 /usr/local/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;
=== 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, for the &amp;quot;bootstrap&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
AUTOMAKE=automake-1.7 ACLOCAL=aclocal-1.7 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;
See above for how to compile and install automake-1.7 on Mac OS X.&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;
== 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>Afb</name></author>
	</entry>
	<entry>
		<id>https://wiki.codeblocks.org/index.php?title=Installing_Code::Blocks_from_source_on_Mac_OS_X&amp;diff=4847</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=4847"/>
		<updated>2007-07-15T19:09:19Z</updated>

		<summary type="html">&lt;p&gt;Afb: /* Install Code::Blocks */&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:&lt;br /&gt;
&lt;br /&gt;
http://developer.apple.com/tools/&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. For Mac OS X 10.1-10.2, the latest Dev Tools.&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 /usr/local/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;
=== 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, for the &amp;quot;bootstrap&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
AUTOMAKE=automake-1.7 ACLOCAL=aclocal-1.7 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;
See above for how to compile and install automake-1.7 on Mac OS X.&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;
== 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&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>Afb</name></author>
	</entry>
	<entry>
		<id>https://wiki.codeblocks.org/index.php?title=Installing_Code::Blocks_from_source_on_Mac_OS_X&amp;diff=4846</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=4846"/>
		<updated>2007-07-15T18:59:05Z</updated>

		<summary type="html">&lt;p&gt;Afb: update to wxWidgets 2.8 and official MacPorts port&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:&lt;br /&gt;
&lt;br /&gt;
http://developer.apple.com/tools/&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. For Mac OS X 10.1-10.2, the latest Dev Tools.&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 /usr/local/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;
=== 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, for the &amp;quot;bootstrap&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
AUTOMAKE=automake-1.7 ACLOCAL=aclocal-1.7 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;
See above for how to compile and install automake-1.7 on Mac OS X.&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;
== 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 CB with:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo port install codeblocks-devel&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>Afb</name></author>
	</entry>
	<entry>
		<id>https://wiki.codeblocks.org/index.php?title=Installing_Code::Blocks_from_source_on_Mac_OS_X&amp;diff=4546</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=4546"/>
		<updated>2007-04-10T22:05:36Z</updated>

		<summary type="html">&lt;p&gt;Afb: DarwinPorts -&amp;gt; MacPorts&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:&lt;br /&gt;
&lt;br /&gt;
http://developer.apple.com/tools/&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. For Mac OS X 10.1-10.2, the latest Dev Tools.&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 /usr/local/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;
=== 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/2.6/wx_unicode.html#unicodeandansi&lt;br /&gt;
&lt;br /&gt;
== Build wxWidgets 2.6 ==&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/#previous_stable&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;
For Intel Macintosh, you will need this additional patch:&lt;br /&gt;
&lt;br /&gt;
* http://www.algonet.se/~afb/wx/wxWidgets-killpoll.patch&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
patch -p1 -i wxWidgets-killpoll.patch&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note: this patch is not needed for wxWidgets 2.6.4 and later&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.3+)&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.3.1.dylib&lt;br /&gt;
/usr/local/lib/libwx_macu-2.6.0.3.1.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.3.1.dylib&lt;br /&gt;
/Library/Frameworks/wx.framework/Versions/2.6/libwx_macu-2.6.0.3.1.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, for the &amp;quot;bootstrap&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
AUTOMAKE=automake-1.7 ACLOCAL=aclocal-1.7 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;
See above for how to compile and install automake-1.7 on Mac OS X.&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;
== 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;
=== Set up a local MacPorts tree ===&lt;br /&gt;
&lt;br /&gt;
Set up a local MacPorts tree (usually in &amp;lt;tt&amp;gt;~/dports&amp;lt;/tt&amp;gt; - set up in &amp;lt;tt&amp;gt;/opt/local/etc/ports/sources.conf&amp;lt;/tt&amp;gt;, create the directory if needed), as e.g. &amp;lt;tt&amp;gt;dports/devel/codeblocks/Portfile&amp;lt;/tt&amp;gt; and download any helper files to e.g. &amp;lt;tt&amp;gt;dports/devel/codeblocks/files&amp;lt;/tt&amp;gt;. (then do a chdir to &amp;lt;tt&amp;gt;dports&amp;lt;/tt&amp;gt;, and run the &amp;lt;tt&amp;gt;/opt/local/bin/portindex&amp;lt;/tt&amp;gt; command)&lt;br /&gt;
&lt;br /&gt;
The tree might look something like:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dports&lt;br /&gt;
|-- PortIndex&lt;br /&gt;
`-- devel&lt;br /&gt;
    `-- codeblocks&lt;br /&gt;
        `-- Portfile&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Install wxWidgets ===&lt;br /&gt;
&lt;br /&gt;
Currently you need wxWidgets version 2.6.x, install with:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo port install wxWidgets26&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 wxgk26&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Install Code::Blocks ===&lt;br /&gt;
&lt;br /&gt;
To build and install Code::Blocks, you will need:&lt;br /&gt;
&lt;br /&gt;
* http://www.algonet.se/~afb/wx/codeblocks.Portfile&lt;br /&gt;
&lt;br /&gt;
After the set up has been done, you can install it with:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo port install codeblocks&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 -macosx+puredarwin&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&lt;br /&gt;
---&amp;gt;  Verifying checksum(s) for codeblocks&lt;br /&gt;
---&amp;gt;  Extracting codeblocks&lt;br /&gt;
---&amp;gt;  Configuring codeblocks&lt;br /&gt;
---&amp;gt;  Building codeblocks with target all&lt;br /&gt;
---&amp;gt;  Staging codeblocks into destroot&lt;br /&gt;
---&amp;gt;  Packaging tgz archive for codeblocks 1.0_0+macosx&lt;br /&gt;
---&amp;gt;  Installing codeblocks 1.0_0+macosx&lt;br /&gt;
---&amp;gt;  Activating codeblocks 1.0_0+macosx&lt;br /&gt;
---&amp;gt;  Cleaning codeblocks&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&lt;br /&gt;
sudo port clean codeblocks&lt;br /&gt;
sudo port install codeblocks&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;+macosx&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;+puredarwin&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>Afb</name></author>
	</entry>
	<entry>
		<id>https://wiki.codeblocks.org/index.php?title=Installing_Code::Blocks_from_source_on_Mac_OS_X&amp;diff=4523</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=4523"/>
		<updated>2007-03-29T12:18:14Z</updated>

		<summary type="html">&lt;p&gt;Afb: /* Install with DarwinPorts */ no more patches&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://darwinports.opendarwin.org DarwinPorts],&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 DarwinPorts 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:&lt;br /&gt;
&lt;br /&gt;
http://developer.apple.com/tools/&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. For Mac OS X 10.1-10.2, the latest Dev Tools.&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 /usr/local/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;
=== 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/2.6/wx_unicode.html#unicodeandansi&lt;br /&gt;
&lt;br /&gt;
== Build wxWidgets 2.6 ==&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/#previous_stable&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;
For Intel Macintosh, you will need this additional patch:&lt;br /&gt;
&lt;br /&gt;
* http://www.algonet.se/~afb/wx/wxWidgets-killpoll.patch&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
patch -p1 -i wxWidgets-killpoll.patch&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note: this patch is not needed for wxWidgets 2.6.4 and later&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.3+)&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.3.1.dylib&lt;br /&gt;
/usr/local/lib/libwx_macu-2.6.0.3.1.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.3.1.dylib&lt;br /&gt;
/Library/Frameworks/wx.framework/Versions/2.6/libwx_macu-2.6.0.3.1.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, for the &amp;quot;bootstrap&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
AUTOMAKE=automake-1.7 ACLOCAL=aclocal-1.7 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;
See above for how to compile and install automake-1.7 on Mac OS X.&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;
DarwinPorts: &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;
== 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 DarwinPorts ==&lt;br /&gt;
&lt;br /&gt;
=== Set up a local DarwinPorts tree ===&lt;br /&gt;
&lt;br /&gt;
Set up a local DarwinPorts tree (usually in &amp;lt;tt&amp;gt;~/dports&amp;lt;/tt&amp;gt; - set up in &amp;lt;tt&amp;gt;/opt/local/etc/ports/sources.conf&amp;lt;/tt&amp;gt;, create the directory if needed), as e.g. &amp;lt;tt&amp;gt;dports/devel/codeblocks/Portfile&amp;lt;/tt&amp;gt; and download any helper files to e.g. &amp;lt;tt&amp;gt;dports/devel/codeblocks/files&amp;lt;/tt&amp;gt;. (then do a chdir to &amp;lt;tt&amp;gt;dports&amp;lt;/tt&amp;gt;, and run the &amp;lt;tt&amp;gt;/opt/local/bin/portindex&amp;lt;/tt&amp;gt; command)&lt;br /&gt;
&lt;br /&gt;
The tree might look something like:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dports&lt;br /&gt;
|-- PortIndex&lt;br /&gt;
|-- devel&lt;br /&gt;
|   `-- codeblocks&lt;br /&gt;
|       `-- Portfile&lt;br /&gt;
`-- graphics&lt;br /&gt;
   |-- wxGTK&lt;br /&gt;
   |    |-- Portfile&lt;br /&gt;
   |    `-- files&lt;br /&gt;
   |       |-- patch-soundsdl-26.diff&lt;br /&gt;
   |       `-- patch-soundsdl-28.diff&lt;br /&gt;
   `-- wxMac&lt;br /&gt;
        `-- Portfile&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Install wxWidgets ===&lt;br /&gt;
&lt;br /&gt;
You will need these custom wxWidgets ports:&lt;br /&gt;
&lt;br /&gt;
* http://www.algonet.se/~afb/wx/wxMac.Portfile&lt;br /&gt;
* http://www.algonet.se/~afb/wx/wxGTK.Portfile&lt;br /&gt;
* http://www.algonet.se/~afb/wx/patch-soundsdl-26.diff&lt;br /&gt;
* http://www.algonet.se/~afb/wx/patch-soundsdl-28.diff&lt;br /&gt;
&lt;br /&gt;
The optional wxWidgets file go in &amp;lt;tt&amp;gt;graphics/wx{Mac,GTK}/Portfile&amp;lt;/tt&amp;gt;. 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 [http://trac.macports.org/projects/macports/browser/trunk/dports/graphics/wxWidgets wxWidgets] port is now upgraded to 2.8, and the alternative [http://trac.macports.org/projects/macports/browser/trunk/dports/graphics/wxWidgets26 wxWidgets26] port doesn't yet have all the needed patches)&lt;br /&gt;
&lt;br /&gt;
After the set up has been done, you can install it with:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo port install wxMac&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;
To build and install Code::Blocks, you will need:&lt;br /&gt;
&lt;br /&gt;
* http://www.algonet.se/~afb/wx/codeblocks.Portfile&lt;br /&gt;
&lt;br /&gt;
After the set up has been done, you can install it with:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo port install codeblocks&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 -macosx+puredarwin&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&lt;br /&gt;
---&amp;gt;  Verifying checksum(s) for codeblocks&lt;br /&gt;
---&amp;gt;  Extracting codeblocks&lt;br /&gt;
---&amp;gt;  Configuring codeblocks&lt;br /&gt;
---&amp;gt;  Building codeblocks with target all&lt;br /&gt;
---&amp;gt;  Staging codeblocks into destroot&lt;br /&gt;
---&amp;gt;  Packaging tgz archive for codeblocks 1.0_0+macosx&lt;br /&gt;
---&amp;gt;  Installing codeblocks 1.0_0+macosx&lt;br /&gt;
---&amp;gt;  Activating codeblocks 1.0_0+macosx&lt;br /&gt;
---&amp;gt;  Cleaning codeblocks&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&lt;br /&gt;
sudo port clean codeblocks&lt;br /&gt;
sudo port install codeblocks&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;+macosx&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/DarwinPorts/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;DarwinPorts&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;+puredarwin&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>Afb</name></author>
	</entry>
	<entry>
		<id>https://wiki.codeblocks.org/index.php?title=Installing_Code::Blocks_from_source_on_Mac_OS_X&amp;diff=4522</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=4522"/>
		<updated>2007-03-29T08:00:22Z</updated>

		<summary type="html">&lt;p&gt;Afb: /* Install with DarwinPorts */&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://darwinports.opendarwin.org DarwinPorts],&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 DarwinPorts 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:&lt;br /&gt;
&lt;br /&gt;
http://developer.apple.com/tools/&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. For Mac OS X 10.1-10.2, the latest Dev Tools.&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 /usr/local/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;
=== 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/2.6/wx_unicode.html#unicodeandansi&lt;br /&gt;
&lt;br /&gt;
== Build wxWidgets 2.6 ==&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/#previous_stable&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;
For Intel Macintosh, you will need this additional patch:&lt;br /&gt;
&lt;br /&gt;
* http://www.algonet.se/~afb/wx/wxWidgets-killpoll.patch&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
patch -p1 -i wxWidgets-killpoll.patch&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note: this patch is not needed for wxWidgets 2.6.4 and later&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.3+)&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.3.1.dylib&lt;br /&gt;
/usr/local/lib/libwx_macu-2.6.0.3.1.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.3.1.dylib&lt;br /&gt;
/Library/Frameworks/wx.framework/Versions/2.6/libwx_macu-2.6.0.3.1.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, for the &amp;quot;bootstrap&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
AUTOMAKE=automake-1.7 ACLOCAL=aclocal-1.7 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;
See above for how to compile and install automake-1.7 on Mac OS X.&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;
DarwinPorts: &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;
== 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 DarwinPorts ==&lt;br /&gt;
&lt;br /&gt;
=== Set up a local DarwinPorts tree ===&lt;br /&gt;
&lt;br /&gt;
Set up a local DarwinPorts tree (usually in &amp;lt;tt&amp;gt;~/dports&amp;lt;/tt&amp;gt; - set up in &amp;lt;tt&amp;gt;/opt/local/etc/ports/sources.conf&amp;lt;/tt&amp;gt;, create the directory if needed), as e.g. &amp;lt;tt&amp;gt;dports/devel/codeblocks/Portfile&amp;lt;/tt&amp;gt; and download any helper files to e.g. &amp;lt;tt&amp;gt;dports/devel/codeblocks/files&amp;lt;/tt&amp;gt;. (then do a chdir to &amp;lt;tt&amp;gt;dports&amp;lt;/tt&amp;gt;, and run the &amp;lt;tt&amp;gt;/opt/local/bin/portindex&amp;lt;/tt&amp;gt; command)&lt;br /&gt;
&lt;br /&gt;
The tree might look something like:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dports&lt;br /&gt;
|-- PortIndex&lt;br /&gt;
|-- devel&lt;br /&gt;
|   `-- codeblocks&lt;br /&gt;
|       |-- Portfile&lt;br /&gt;
|       `-- files&lt;br /&gt;
|           |-- codeblocks.plist&lt;br /&gt;
|           |-- codeblocks.sh.in&lt;br /&gt;
|           `-- dos2unix.sh&lt;br /&gt;
`-- graphics&lt;br /&gt;
   |-- wxGTK&lt;br /&gt;
   |    |-- Portfile&lt;br /&gt;
   |    `-- files&lt;br /&gt;
   |       |-- patch-soundsdl-26.diff&lt;br /&gt;
   |       `-- patch-soundsdl-28.diff&lt;br /&gt;
   `-- wxMac&lt;br /&gt;
        `-- Portfile&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Install wxWidgets ===&lt;br /&gt;
&lt;br /&gt;
You will need these custom wxWidgets ports:&lt;br /&gt;
&lt;br /&gt;
* http://www.algonet.se/~afb/wx/wxMac.Portfile&lt;br /&gt;
* http://www.algonet.se/~afb/wx/wxGTK.Portfile&lt;br /&gt;
* http://www.algonet.se/~afb/wx/patch-soundsdl-26.diff&lt;br /&gt;
* http://www.algonet.se/~afb/wx/patch-soundsdl-28.diff&lt;br /&gt;
&lt;br /&gt;
The optional wxWidgets file go in &amp;lt;tt&amp;gt;graphics/wx{Mac,GTK}/Portfile&amp;lt;/tt&amp;gt;. 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 [http://trac.macports.org/projects/macports/browser/trunk/dports/graphics/wxWidgets wxWidgets] port is now upgraded to 2.8, and the alternative [http://trac.macports.org/projects/macports/browser/trunk/dports/graphics/wxWidgets26 wxWidgets26] port doesn't yet have all the needed patches)&lt;br /&gt;
&lt;br /&gt;
After the set up has been done, you can install it with:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo port install wxMac&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;
To build and install Code::Blocks, you will need:&lt;br /&gt;
&lt;br /&gt;
* http://www.algonet.se/~afb/wx/codeblocks.Portfile&lt;br /&gt;
&lt;br /&gt;
The following need to go in the &amp;quot;files&amp;quot; directory:&lt;br /&gt;
&lt;br /&gt;
* http://www.algonet.se/~afb/wx/codeblocks.sh.in&lt;br /&gt;
* http://www.algonet.se/~afb/wx/dos2unix.sh&lt;br /&gt;
&lt;br /&gt;
After the set up has been done, you can install it with:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo port install codeblocks&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 -macosx+puredarwin&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&lt;br /&gt;
---&amp;gt;  Verifying checksum(s) for codeblocks&lt;br /&gt;
---&amp;gt;  Extracting codeblocks&lt;br /&gt;
---&amp;gt;  Applying patches to codeblocks&lt;br /&gt;
---&amp;gt;  Configuring codeblocks&lt;br /&gt;
---&amp;gt;  Building codeblocks with target all&lt;br /&gt;
---&amp;gt;  Staging codeblocks into destroot&lt;br /&gt;
---&amp;gt;  Packaging tgz archive for codeblocks 1.0_0+macosx&lt;br /&gt;
---&amp;gt;  Installing codeblocks 1.0_0+macosx&lt;br /&gt;
---&amp;gt;  Activating codeblocks 1.0_0+macosx&lt;br /&gt;
---&amp;gt;  Cleaning codeblocks&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&lt;br /&gt;
sudo port clean codeblocks&lt;br /&gt;
sudo port install codeblocks&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;+macosx&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/DarwinPorts/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;DarwinPorts&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 --prefix=/opt/local&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Running &amp;lt;tt&amp;gt;+puredarwin&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 --prefix=/opt/local&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There is also a wxGTK startup command in &amp;quot;DarwinPorts&amp;quot;,&lt;br /&gt;
that will first start up X11.app and then launch C::B:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
open /Applications/DarwinPorts/CodeBlocks.command&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Afb</name></author>
	</entry>
	<entry>
		<id>https://wiki.codeblocks.org/index.php?title=Installing_Code::Blocks_from_source_on_Mac_OS_X&amp;diff=4521</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=4521"/>
		<updated>2007-03-26T20:23:37Z</updated>

		<summary type="html">&lt;p&gt;Afb: /* Apply necessary patches */&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://darwinports.opendarwin.org DarwinPorts],&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 DarwinPorts 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:&lt;br /&gt;
&lt;br /&gt;
http://developer.apple.com/tools/&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. For Mac OS X 10.1-10.2, the latest Dev Tools.&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 /usr/local/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;
=== 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/2.6/wx_unicode.html#unicodeandansi&lt;br /&gt;
&lt;br /&gt;
== Build wxWidgets 2.6 ==&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/#previous_stable&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;
For Intel Macintosh, you will need this additional patch:&lt;br /&gt;
&lt;br /&gt;
* http://www.algonet.se/~afb/wx/wxWidgets-killpoll.patch&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
patch -p1 -i wxWidgets-killpoll.patch&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note: this patch is not needed for wxWidgets 2.6.4 and later&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.3+)&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.3.1.dylib&lt;br /&gt;
/usr/local/lib/libwx_macu-2.6.0.3.1.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.3.1.dylib&lt;br /&gt;
/Library/Frameworks/wx.framework/Versions/2.6/libwx_macu-2.6.0.3.1.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, for the &amp;quot;bootstrap&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
AUTOMAKE=automake-1.7 ACLOCAL=aclocal-1.7 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;
See above for how to compile and install automake-1.7 on Mac OS X.&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;
DarwinPorts: &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;
== 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 DarwinPorts ==&lt;br /&gt;
&lt;br /&gt;
=== Set up a local DarwinPorts tree ===&lt;br /&gt;
&lt;br /&gt;
Set up a local DarwinPorts tree (usually in &amp;lt;tt&amp;gt;~/dports&amp;lt;/tt&amp;gt; - set up in &amp;lt;tt&amp;gt;/opt/local/etc/ports/sources.conf&amp;lt;/tt&amp;gt;, create the directory if needed), as e.g. &amp;lt;tt&amp;gt;dports/devel/codeblocks/Portfile&amp;lt;/tt&amp;gt; and download any helper files to e.g. &amp;lt;tt&amp;gt;dports/devel/codeblocks/files&amp;lt;/tt&amp;gt;. (then do a chdir to &amp;lt;tt&amp;gt;dports&amp;lt;/tt&amp;gt;, and run the &amp;lt;tt&amp;gt;/opt/local/bin/portindex&amp;lt;/tt&amp;gt; command)&lt;br /&gt;
&lt;br /&gt;
The tree might look something like:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dports&lt;br /&gt;
|-- PortIndex&lt;br /&gt;
|-- devel&lt;br /&gt;
|   `-- codeblocks&lt;br /&gt;
|       |-- Portfile&lt;br /&gt;
|       `-- files&lt;br /&gt;
|           |-- codeblocks.plist&lt;br /&gt;
|           |-- codeblocks.sh.in&lt;br /&gt;
|           |-- codeblocks-wxauigtk.patch&lt;br /&gt;
|           |-- codeblocks-darwinplatform.patch&lt;br /&gt;
|           `-- dos2unix.sh&lt;br /&gt;
`-- graphics&lt;br /&gt;
   |-- wxGTK&lt;br /&gt;
   |    |-- Portfile&lt;br /&gt;
   |    `-- files&lt;br /&gt;
   |       |-- patch-soundsdl-26.diff&lt;br /&gt;
   |       `-- patch-soundsdl-28.diff&lt;br /&gt;
   `-- wxMac&lt;br /&gt;
        `-- Portfile&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Install wxWidgets ===&lt;br /&gt;
&lt;br /&gt;
You will need these custom wxWidgets ports:&lt;br /&gt;
&lt;br /&gt;
* http://www.algonet.se/~afb/wx/wxMac.Portfile&lt;br /&gt;
* http://www.algonet.se/~afb/wx/wxGTK.Portfile&lt;br /&gt;
* http://www.algonet.se/~afb/wx/patch-soundsdl-26.diff&lt;br /&gt;
* http://www.algonet.se/~afb/wx/patch-soundsdl-28.diff&lt;br /&gt;
&lt;br /&gt;
The optional wxWidgets file go in &amp;lt;tt&amp;gt;graphics/wx{Mac,GTK}/Portfile&amp;lt;/tt&amp;gt;. 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 [http://trac.macports.org/projects/macports/browser/trunk/dports/graphics/wxWidgets wxWidgets] port is now upgraded to 2.8, and the alternative [http://trac.macports.org/projects/macports/browser/trunk/dports/graphics/wxWidgets26 wxWidgets26] port doesn't yet have all the needed patches)&lt;br /&gt;
&lt;br /&gt;
After the set up has been done, you can install it with:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo port install wxMac&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;
To build and install Code::Blocks, you will need:&lt;br /&gt;
&lt;br /&gt;
* http://www.algonet.se/~afb/wx/codeblocks.Portfile&lt;br /&gt;
&lt;br /&gt;
The following need to go in the &amp;quot;files&amp;quot; directory:&lt;br /&gt;
&lt;br /&gt;
* http://www.algonet.se/~afb/wx/codeblocks.sh.in&lt;br /&gt;
* http://www.algonet.se/~afb/wx/dos2unix.sh&lt;br /&gt;
* http://www.algonet.se/~afb/wx/codeblocks-wxauigtk.patch&lt;br /&gt;
* http://www.algonet.se/~afb/wx/codeblocks-darwinplatform.patch&lt;br /&gt;
&lt;br /&gt;
After the set up has been done, you can install it with:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo port install codeblocks&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 -macosx+puredarwin&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&lt;br /&gt;
---&amp;gt;  Verifying checksum(s) for codeblocks&lt;br /&gt;
---&amp;gt;  Extracting codeblocks&lt;br /&gt;
---&amp;gt;  Applying patches to codeblocks&lt;br /&gt;
---&amp;gt;  Configuring codeblocks&lt;br /&gt;
---&amp;gt;  Building codeblocks with target all&lt;br /&gt;
---&amp;gt;  Staging codeblocks into destroot&lt;br /&gt;
---&amp;gt;  Packaging tgz archive for codeblocks 1.0_0+macosx&lt;br /&gt;
---&amp;gt;  Installing codeblocks 1.0_0+macosx&lt;br /&gt;
---&amp;gt;  Activating codeblocks 1.0_0+macosx&lt;br /&gt;
---&amp;gt;  Cleaning codeblocks&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&lt;br /&gt;
sudo port clean codeblocks&lt;br /&gt;
sudo port install codeblocks&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;+macosx&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/DarwinPorts/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;DarwinPorts&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 --prefix=/opt/local&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Running &amp;lt;tt&amp;gt;+puredarwin&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 --prefix=/opt/local&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There is also a wxGTK startup command in &amp;quot;DarwinPorts&amp;quot;,&lt;br /&gt;
that will first start up X11.app and then launch C::B:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
open /Applications/DarwinPorts/CodeBlocks.command&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Afb</name></author>
	</entry>
	<entry>
		<id>https://wiki.codeblocks.org/index.php?title=Installing_Code::Blocks_nightly_build_on_Mac_OS_X&amp;diff=4520</id>
		<title>Installing Code::Blocks nightly build on Mac OS X</title>
		<link rel="alternate" type="text/html" href="https://wiki.codeblocks.org/index.php?title=Installing_Code::Blocks_nightly_build_on_Mac_OS_X&amp;diff=4520"/>
		<updated>2007-03-26T20:18:12Z</updated>

		<summary type="html">&lt;p&gt;Afb: /* Known Issues */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Installing Code::Blocks]]&lt;br /&gt;
[[Category:Installing Code::Blocks nightly build]]&lt;br /&gt;
This article describes how to install a nightly build of Code::Blocks.&lt;br /&gt;
&lt;br /&gt;
:''NOTE'': The nightly builds for Mac OS X are not official (just yet)&lt;br /&gt;
&lt;br /&gt;
The packages are currently done infrequently, and not really &amp;quot;nightly&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
=== Install steps ===&lt;br /&gt;
&lt;br /&gt;
# Download the Developer Tools from [http://developer.apple.com/tools/ Apple], if not included with Mac OS X.&lt;br /&gt;
#* For Mac OS X 10.3, you need to install Xcode Tools version 1.2 or later&lt;br /&gt;
#* For Mac OS X 10.4, you need to install Xcode Tools version 2.2 or later&lt;br /&gt;
# Download the latest Mac binary ZIP package of Code::Blocks, from [http://developer.berlios.de/project/showfiles.php?group_id=5358 BerliOS].&lt;br /&gt;
#* For Mac OS X 10.1 up to 10.3 (PPC), download the &amp;quot;macppc&amp;quot; version&lt;br /&gt;
#* For Mac OS X 10.4 (PowerPC or Intel), download the &amp;quot;macx86&amp;quot; version&lt;br /&gt;
# Now unpack the zip file package, and put CodeBlocks.app where you like it.&lt;br /&gt;
#* The suggested location is /Developer/Applications or ~/Applications.&lt;br /&gt;
#* wxWidgets (2.6.3p2, dylib) is included inside the application bundle.&lt;br /&gt;
&lt;br /&gt;
=== MacPorts ===&lt;br /&gt;
&lt;br /&gt;
If you prefer, you can install Code::Blocks / wxWidgets using [http://www.macports.org MacPorts] instead:&lt;br /&gt;
[[Installing_Code::Blocks_from_source_on_Mac_OS_X#Install_with_DarwinPorts]].&lt;br /&gt;
&lt;br /&gt;
There are no binary packages for MacPorts just yet, so it compiles from the source.&lt;br /&gt;
&lt;br /&gt;
=== Known Issues ===&lt;br /&gt;
&lt;br /&gt;
First of all, see the issues that apply to all builds of Code::Blocks:&lt;br /&gt;
&lt;br /&gt;
* /index.php?board=20.0 (release notes)&lt;br /&gt;
* http://developer.berlios.de/bugs/?group_id=5358 (reported bugs)&lt;br /&gt;
&lt;br /&gt;
There are also some bugs that only apply to the Mac OS X version:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;s&amp;gt;Open in console doesn't work with Terminal.app, only wxGTK/X11/xterm&amp;lt;/s&amp;gt;&lt;br /&gt;
* &amp;lt;s&amp;gt;Splash window is not centered on the display&amp;lt;/s&amp;gt;&lt;br /&gt;
* Occasional &amp;quot;can't flush file descriptor 12&amp;quot;&lt;br /&gt;
* Batch building (from the terminal) crashes&lt;br /&gt;
&lt;br /&gt;
Not really bugs, but some things that might require extra setup:&lt;br /&gt;
* There is no direct support for adding frameworks, use -framework&lt;br /&gt;
* The default package does not have developer files for wxWidgets&lt;br /&gt;
* Not all wizards have Mac tweaks to the generated code/projects&lt;br /&gt;
* Not all of the included contributed plugins work on Mac just yet&lt;/div&gt;</summary>
		<author><name>Afb</name></author>
	</entry>
	<entry>
		<id>https://wiki.codeblocks.org/index.php?title=Installing_Code::Blocks_from_source_on_Mac_OS_X&amp;diff=4519</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=4519"/>
		<updated>2007-03-26T11:55:39Z</updated>

		<summary type="html">&lt;p&gt;Afb: /* Install Code::Blocks */&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://darwinports.opendarwin.org DarwinPorts],&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 DarwinPorts 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:&lt;br /&gt;
&lt;br /&gt;
http://developer.apple.com/tools/&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. For Mac OS X 10.1-10.2, the latest Dev Tools.&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 /usr/local/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;
=== 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/2.6/wx_unicode.html#unicodeandansi&lt;br /&gt;
&lt;br /&gt;
== Build wxWidgets 2.6 ==&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/#previous_stable&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;
For Intel Macintosh, you will need this additional patch:&lt;br /&gt;
&lt;br /&gt;
* http://www.algonet.se/~afb/wx/wxWidgets-killpoll.patch&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
patch -p1 -i wxWidgets-killpoll.patch&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note: this patch is not needed for wxWidgets 2.6.4 and later&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.3+)&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.3.1.dylib&lt;br /&gt;
/usr/local/lib/libwx_macu-2.6.0.3.1.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.3.1.dylib&lt;br /&gt;
/Library/Frameworks/wx.framework/Versions/2.6/libwx_macu-2.6.0.3.1.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 necessary patches, see below under &amp;quot;DarwinPorts&amp;quot;, or:&lt;br /&gt;
&lt;br /&gt;
http://developer.berlios.de/patch/?group_id=5358&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
patch -p0 -i codeblocks-rev3656_pluginslib.patch&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You might need to convert the line endings from DOS to Unix first.&lt;br /&gt;
&lt;br /&gt;
Hopefully most of these should be merged upstream, before release:&lt;br /&gt;
&lt;br /&gt;
* http://developer.berlios.de/patch/?func=detailpatch&amp;amp;patch_id=1395&amp;amp;group_id=5358&lt;br /&gt;
&lt;br /&gt;
(when they are, the above stand-alone patches might fail to apply)&lt;br /&gt;
&lt;br /&gt;
=== Bootstrap with Autotools ===&lt;br /&gt;
&lt;br /&gt;
You need to use the newer version of automake, for the &amp;quot;bootstrap&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
AUTOMAKE=automake-1.7 ACLOCAL=aclocal-1.7 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;
See above for how to compile and install automake-1.7 on Mac OS X.&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;
DarwinPorts: &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;
== 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 DarwinPorts ==&lt;br /&gt;
&lt;br /&gt;
=== Set up a local DarwinPorts tree ===&lt;br /&gt;
&lt;br /&gt;
Set up a local DarwinPorts tree (usually in &amp;lt;tt&amp;gt;~/dports&amp;lt;/tt&amp;gt; - set up in &amp;lt;tt&amp;gt;/opt/local/etc/ports/sources.conf&amp;lt;/tt&amp;gt;, create the directory if needed), as e.g. &amp;lt;tt&amp;gt;dports/devel/codeblocks/Portfile&amp;lt;/tt&amp;gt; and download any helper files to e.g. &amp;lt;tt&amp;gt;dports/devel/codeblocks/files&amp;lt;/tt&amp;gt;. (then do a chdir to &amp;lt;tt&amp;gt;dports&amp;lt;/tt&amp;gt;, and run the &amp;lt;tt&amp;gt;/opt/local/bin/portindex&amp;lt;/tt&amp;gt; command)&lt;br /&gt;
&lt;br /&gt;
The tree might look something like:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dports&lt;br /&gt;
|-- PortIndex&lt;br /&gt;
|-- devel&lt;br /&gt;
|   `-- codeblocks&lt;br /&gt;
|       |-- Portfile&lt;br /&gt;
|       `-- files&lt;br /&gt;
|           |-- codeblocks.plist&lt;br /&gt;
|           |-- codeblocks.sh.in&lt;br /&gt;
|           |-- codeblocks-wxauigtk.patch&lt;br /&gt;
|           |-- codeblocks-darwinplatform.patch&lt;br /&gt;
|           `-- dos2unix.sh&lt;br /&gt;
`-- graphics&lt;br /&gt;
   |-- wxGTK&lt;br /&gt;
   |    |-- Portfile&lt;br /&gt;
   |    `-- files&lt;br /&gt;
   |       |-- patch-soundsdl-26.diff&lt;br /&gt;
   |       `-- patch-soundsdl-28.diff&lt;br /&gt;
   `-- wxMac&lt;br /&gt;
        `-- Portfile&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Install wxWidgets ===&lt;br /&gt;
&lt;br /&gt;
You will need these custom wxWidgets ports:&lt;br /&gt;
&lt;br /&gt;
* http://www.algonet.se/~afb/wx/wxMac.Portfile&lt;br /&gt;
* http://www.algonet.se/~afb/wx/wxGTK.Portfile&lt;br /&gt;
* http://www.algonet.se/~afb/wx/patch-soundsdl-26.diff&lt;br /&gt;
* http://www.algonet.se/~afb/wx/patch-soundsdl-28.diff&lt;br /&gt;
&lt;br /&gt;
The optional wxWidgets file go in &amp;lt;tt&amp;gt;graphics/wx{Mac,GTK}/Portfile&amp;lt;/tt&amp;gt;. 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 [http://trac.macports.org/projects/macports/browser/trunk/dports/graphics/wxWidgets wxWidgets] port is now upgraded to 2.8, and the alternative [http://trac.macports.org/projects/macports/browser/trunk/dports/graphics/wxWidgets26 wxWidgets26] port doesn't yet have all the needed patches)&lt;br /&gt;
&lt;br /&gt;
After the set up has been done, you can install it with:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo port install wxMac&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;
To build and install Code::Blocks, you will need:&lt;br /&gt;
&lt;br /&gt;
* http://www.algonet.se/~afb/wx/codeblocks.Portfile&lt;br /&gt;
&lt;br /&gt;
The following need to go in the &amp;quot;files&amp;quot; directory:&lt;br /&gt;
&lt;br /&gt;
* http://www.algonet.se/~afb/wx/codeblocks.sh.in&lt;br /&gt;
* http://www.algonet.se/~afb/wx/dos2unix.sh&lt;br /&gt;
* http://www.algonet.se/~afb/wx/codeblocks-wxauigtk.patch&lt;br /&gt;
* http://www.algonet.se/~afb/wx/codeblocks-darwinplatform.patch&lt;br /&gt;
&lt;br /&gt;
After the set up has been done, you can install it with:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo port install codeblocks&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 -macosx+puredarwin&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&lt;br /&gt;
---&amp;gt;  Verifying checksum(s) for codeblocks&lt;br /&gt;
---&amp;gt;  Extracting codeblocks&lt;br /&gt;
---&amp;gt;  Applying patches to codeblocks&lt;br /&gt;
---&amp;gt;  Configuring codeblocks&lt;br /&gt;
---&amp;gt;  Building codeblocks with target all&lt;br /&gt;
---&amp;gt;  Staging codeblocks into destroot&lt;br /&gt;
---&amp;gt;  Packaging tgz archive for codeblocks 1.0_0+macosx&lt;br /&gt;
---&amp;gt;  Installing codeblocks 1.0_0+macosx&lt;br /&gt;
---&amp;gt;  Activating codeblocks 1.0_0+macosx&lt;br /&gt;
---&amp;gt;  Cleaning codeblocks&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&lt;br /&gt;
sudo port clean codeblocks&lt;br /&gt;
sudo port install codeblocks&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;+macosx&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/DarwinPorts/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;DarwinPorts&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 --prefix=/opt/local&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Running &amp;lt;tt&amp;gt;+puredarwin&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 --prefix=/opt/local&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There is also a wxGTK startup command in &amp;quot;DarwinPorts&amp;quot;,&lt;br /&gt;
that will first start up X11.app and then launch C::B:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
open /Applications/DarwinPorts/CodeBlocks.command&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Afb</name></author>
	</entry>
	<entry>
		<id>https://wiki.codeblocks.org/index.php?title=Installing_Code::Blocks_from_source_on_Mac_OS_X&amp;diff=4518</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=4518"/>
		<updated>2007-03-26T11:55:12Z</updated>

		<summary type="html">&lt;p&gt;Afb: /* Install with DarwinPorts */&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://darwinports.opendarwin.org DarwinPorts],&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 DarwinPorts 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:&lt;br /&gt;
&lt;br /&gt;
http://developer.apple.com/tools/&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. For Mac OS X 10.1-10.2, the latest Dev Tools.&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 /usr/local/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;
=== 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/2.6/wx_unicode.html#unicodeandansi&lt;br /&gt;
&lt;br /&gt;
== Build wxWidgets 2.6 ==&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/#previous_stable&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;
For Intel Macintosh, you will need this additional patch:&lt;br /&gt;
&lt;br /&gt;
* http://www.algonet.se/~afb/wx/wxWidgets-killpoll.patch&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
patch -p1 -i wxWidgets-killpoll.patch&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note: this patch is not needed for wxWidgets 2.6.4 and later&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.3+)&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.3.1.dylib&lt;br /&gt;
/usr/local/lib/libwx_macu-2.6.0.3.1.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.3.1.dylib&lt;br /&gt;
/Library/Frameworks/wx.framework/Versions/2.6/libwx_macu-2.6.0.3.1.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 necessary patches, see below under &amp;quot;DarwinPorts&amp;quot;, or:&lt;br /&gt;
&lt;br /&gt;
http://developer.berlios.de/patch/?group_id=5358&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
patch -p0 -i codeblocks-rev3656_pluginslib.patch&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You might need to convert the line endings from DOS to Unix first.&lt;br /&gt;
&lt;br /&gt;
Hopefully most of these should be merged upstream, before release:&lt;br /&gt;
&lt;br /&gt;
* http://developer.berlios.de/patch/?func=detailpatch&amp;amp;patch_id=1395&amp;amp;group_id=5358&lt;br /&gt;
&lt;br /&gt;
(when they are, the above stand-alone patches might fail to apply)&lt;br /&gt;
&lt;br /&gt;
=== Bootstrap with Autotools ===&lt;br /&gt;
&lt;br /&gt;
You need to use the newer version of automake, for the &amp;quot;bootstrap&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
AUTOMAKE=automake-1.7 ACLOCAL=aclocal-1.7 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;
See above for how to compile and install automake-1.7 on Mac OS X.&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;
DarwinPorts: &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;
== 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 DarwinPorts ==&lt;br /&gt;
&lt;br /&gt;
=== Set up a local DarwinPorts tree ===&lt;br /&gt;
&lt;br /&gt;
Set up a local DarwinPorts tree (usually in &amp;lt;tt&amp;gt;~/dports&amp;lt;/tt&amp;gt; - set up in &amp;lt;tt&amp;gt;/opt/local/etc/ports/sources.conf&amp;lt;/tt&amp;gt;, create the directory if needed), as e.g. &amp;lt;tt&amp;gt;dports/devel/codeblocks/Portfile&amp;lt;/tt&amp;gt; and download any helper files to e.g. &amp;lt;tt&amp;gt;dports/devel/codeblocks/files&amp;lt;/tt&amp;gt;. (then do a chdir to &amp;lt;tt&amp;gt;dports&amp;lt;/tt&amp;gt;, and run the &amp;lt;tt&amp;gt;/opt/local/bin/portindex&amp;lt;/tt&amp;gt; command)&lt;br /&gt;
&lt;br /&gt;
The tree might look something like:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dports&lt;br /&gt;
|-- PortIndex&lt;br /&gt;
|-- devel&lt;br /&gt;
|   `-- codeblocks&lt;br /&gt;
|       |-- Portfile&lt;br /&gt;
|       `-- files&lt;br /&gt;
|           |-- codeblocks.plist&lt;br /&gt;
|           |-- codeblocks.sh.in&lt;br /&gt;
|           |-- codeblocks-wxauigtk.patch&lt;br /&gt;
|           |-- codeblocks-darwinplatform.patch&lt;br /&gt;
|           `-- dos2unix.sh&lt;br /&gt;
`-- graphics&lt;br /&gt;
   |-- wxGTK&lt;br /&gt;
   |    |-- Portfile&lt;br /&gt;
   |    `-- files&lt;br /&gt;
   |       |-- patch-soundsdl-26.diff&lt;br /&gt;
   |       `-- patch-soundsdl-28.diff&lt;br /&gt;
   `-- wxMac&lt;br /&gt;
        `-- Portfile&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Install wxWidgets ===&lt;br /&gt;
&lt;br /&gt;
You will need these custom wxWidgets ports:&lt;br /&gt;
&lt;br /&gt;
* http://www.algonet.se/~afb/wx/wxMac.Portfile&lt;br /&gt;
* http://www.algonet.se/~afb/wx/wxGTK.Portfile&lt;br /&gt;
* http://www.algonet.se/~afb/wx/patch-soundsdl-26.diff&lt;br /&gt;
* http://www.algonet.se/~afb/wx/patch-soundsdl-28.diff&lt;br /&gt;
&lt;br /&gt;
The optional wxWidgets file go in &amp;lt;tt&amp;gt;graphics/wx{Mac,GTK}/Portfile&amp;lt;/tt&amp;gt;. 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 [http://trac.macports.org/projects/macports/browser/trunk/dports/graphics/wxWidgets wxWidgets] port is now upgraded to 2.8, and the alternative [http://trac.macports.org/projects/macports/browser/trunk/dports/graphics/wxWidgets26 wxWidgets26] port doesn't yet have all the needed patches)&lt;br /&gt;
&lt;br /&gt;
After the set up has been done, you can install it with:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo port install wxMac&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;
To build and install Code::Blocks, you will need:&lt;br /&gt;
&lt;br /&gt;
* http://www.algonet.se/~afb/wx/codeblocks.Portfile&lt;br /&gt;
&lt;br /&gt;
The following need to go in the &amp;quot;files&amp;quot; directory:&lt;br /&gt;
&lt;br /&gt;
* http://www.algonet.se/~afb/wx/codeblocks.plist&lt;br /&gt;
* http://www.algonet.se/~afb/wx/codeblocks.sh.in&lt;br /&gt;
* http://www.algonet.se/~afb/wx/dos2unix.sh&lt;br /&gt;
* http://www.algonet.se/~afb/wx/codeblocks-wxauigtk.patch&lt;br /&gt;
* http://www.algonet.se/~afb/wx/codeblocks-darwinplatform.patch&lt;br /&gt;
&lt;br /&gt;
After the set up has been done, you can install it with:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo port install codeblocks&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 -macosx+puredarwin&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&lt;br /&gt;
---&amp;gt;  Verifying checksum(s) for codeblocks&lt;br /&gt;
---&amp;gt;  Extracting codeblocks&lt;br /&gt;
---&amp;gt;  Applying patches to codeblocks&lt;br /&gt;
---&amp;gt;  Configuring codeblocks&lt;br /&gt;
---&amp;gt;  Building codeblocks with target all&lt;br /&gt;
---&amp;gt;  Staging codeblocks into destroot&lt;br /&gt;
---&amp;gt;  Packaging tgz archive for codeblocks 1.0_0+macosx&lt;br /&gt;
---&amp;gt;  Installing codeblocks 1.0_0+macosx&lt;br /&gt;
---&amp;gt;  Activating codeblocks 1.0_0+macosx&lt;br /&gt;
---&amp;gt;  Cleaning codeblocks&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&lt;br /&gt;
sudo port clean codeblocks&lt;br /&gt;
sudo port install codeblocks&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;+macosx&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/DarwinPorts/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;DarwinPorts&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 --prefix=/opt/local&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Running &amp;lt;tt&amp;gt;+puredarwin&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 --prefix=/opt/local&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There is also a wxGTK startup command in &amp;quot;DarwinPorts&amp;quot;,&lt;br /&gt;
that will first start up X11.app and then launch C::B:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
open /Applications/DarwinPorts/CodeBlocks.command&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Afb</name></author>
	</entry>
	<entry>
		<id>https://wiki.codeblocks.org/index.php?title=Installing_Code::Blocks_from_source_on_Mac_OS_X&amp;diff=4517</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=4517"/>
		<updated>2007-03-26T11:54:18Z</updated>

		<summary type="html">&lt;p&gt;Afb: /* Set up a local DarwinPorts tree */&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://darwinports.opendarwin.org DarwinPorts],&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 DarwinPorts 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:&lt;br /&gt;
&lt;br /&gt;
http://developer.apple.com/tools/&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. For Mac OS X 10.1-10.2, the latest Dev Tools.&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 /usr/local/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;
=== 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/2.6/wx_unicode.html#unicodeandansi&lt;br /&gt;
&lt;br /&gt;
== Build wxWidgets 2.6 ==&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/#previous_stable&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;
For Intel Macintosh, you will need this additional patch:&lt;br /&gt;
&lt;br /&gt;
* http://www.algonet.se/~afb/wx/wxWidgets-killpoll.patch&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
patch -p1 -i wxWidgets-killpoll.patch&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note: this patch is not needed for wxWidgets 2.6.4 and later&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.3+)&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.3.1.dylib&lt;br /&gt;
/usr/local/lib/libwx_macu-2.6.0.3.1.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.3.1.dylib&lt;br /&gt;
/Library/Frameworks/wx.framework/Versions/2.6/libwx_macu-2.6.0.3.1.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 necessary patches, see below under &amp;quot;DarwinPorts&amp;quot;, or:&lt;br /&gt;
&lt;br /&gt;
http://developer.berlios.de/patch/?group_id=5358&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
patch -p0 -i codeblocks-rev3656_pluginslib.patch&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You might need to convert the line endings from DOS to Unix first.&lt;br /&gt;
&lt;br /&gt;
Hopefully most of these should be merged upstream, before release:&lt;br /&gt;
&lt;br /&gt;
* http://developer.berlios.de/patch/?func=detailpatch&amp;amp;patch_id=1395&amp;amp;group_id=5358&lt;br /&gt;
&lt;br /&gt;
(when they are, the above stand-alone patches might fail to apply)&lt;br /&gt;
&lt;br /&gt;
=== Bootstrap with Autotools ===&lt;br /&gt;
&lt;br /&gt;
You need to use the newer version of automake, for the &amp;quot;bootstrap&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
AUTOMAKE=automake-1.7 ACLOCAL=aclocal-1.7 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;
See above for how to compile and install automake-1.7 on Mac OS X.&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;
DarwinPorts: &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;
== 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 DarwinPorts ==&lt;br /&gt;
&lt;br /&gt;
=== Set up a local DarwinPorts tree ===&lt;br /&gt;
&lt;br /&gt;
Set up a local DarwinPorts tree (usually in &amp;lt;tt&amp;gt;~/dports&amp;lt;/tt&amp;gt; - set up in &amp;lt;tt&amp;gt;/opt/local/etc/ports/sources.conf&amp;lt;/tt&amp;gt;, create the directory if needed), as e.g. &amp;lt;tt&amp;gt;dports/devel/codeblocks/Portfile&amp;lt;/tt&amp;gt; and download any helper files to e.g. &amp;lt;tt&amp;gt;dports/devel/codeblocks/files&amp;lt;/tt&amp;gt;. (then do a chdir to &amp;lt;tt&amp;gt;dports&amp;lt;/tt&amp;gt;, and run the &amp;lt;tt&amp;gt;/opt/local/bin/portindex&amp;lt;/tt&amp;gt; command)&lt;br /&gt;
&lt;br /&gt;
The tree might look something like:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dports&lt;br /&gt;
|-- PortIndex&lt;br /&gt;
|-- devel&lt;br /&gt;
|   `-- codeblocks&lt;br /&gt;
|       |-- Portfile&lt;br /&gt;
|       `-- files&lt;br /&gt;
|           |-- codeblocks.plist&lt;br /&gt;
|           |-- codeblocks.sh.in&lt;br /&gt;
|           |-- codeblocks-wxauigtk.patch&lt;br /&gt;
|           |-- codeblocks-darwinplatform.patch&lt;br /&gt;
|           `-- dos2unix.sh&lt;br /&gt;
`-- graphics&lt;br /&gt;
   |-- wxGTK&lt;br /&gt;
   |    |-- Portfile&lt;br /&gt;
   |    `-- files&lt;br /&gt;
   |       |-- patch-soundsdl-26.diff&lt;br /&gt;
   |       `-- patch-soundsdl-28.diff&lt;br /&gt;
   `-- wxMac&lt;br /&gt;
        `-- Portfile&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Install wxWidgets ===&lt;br /&gt;
&lt;br /&gt;
You will need these custom wxWidgets ports:&lt;br /&gt;
&lt;br /&gt;
* http://www.algonet.se/~afb/wx/wxMac.Portfile&lt;br /&gt;
* http://www.algonet.se/~afb/wx/patch-polling.diff&lt;br /&gt;
* http://www.algonet.se/~afb/wx/wxGTK.Portfile&lt;br /&gt;
* http://www.algonet.se/~afb/wx/patch-soundsdl.diff&lt;br /&gt;
&lt;br /&gt;
The optional wxWidgets file go in &amp;lt;tt&amp;gt;graphics/wx{Mac,GTK}/Portfile&amp;lt;/tt&amp;gt;. 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 [http://trac.macports.org/projects/macports/browser/trunk/dports/graphics/wxWidgets wxWidgets] port is now upgraded to 2.8, and the alternative [http://trac.macports.org/projects/macports/browser/trunk/dports/graphics/wxWidgets26 wxWidgets26] port doesn't yet have all the needed patches)&lt;br /&gt;
&lt;br /&gt;
After the set up has been done, you can install it with:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo port install wxMac&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;
To build and install Code::Blocks, you will need:&lt;br /&gt;
&lt;br /&gt;
* http://www.algonet.se/~afb/wx/codeblocks.Portfile&lt;br /&gt;
&lt;br /&gt;
The following need to go in the &amp;quot;files&amp;quot; directory:&lt;br /&gt;
&lt;br /&gt;
* http://www.algonet.se/~afb/wx/codeblocks.plist&lt;br /&gt;
* http://www.algonet.se/~afb/wx/codeblocks.sh.in&lt;br /&gt;
* http://www.algonet.se/~afb/wx/dos2unix.sh&lt;br /&gt;
* http://www.algonet.se/~afb/wx/codeblocks-rev3656_pluginslib.patch&lt;br /&gt;
* http://www.algonet.se/~afb/wx/codeblocks-wxauigtk.patch&lt;br /&gt;
&lt;br /&gt;
After the set up has been done, you can install it with:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo port install codeblocks&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 -macosx+puredarwin&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&lt;br /&gt;
---&amp;gt;  Verifying checksum(s) for codeblocks&lt;br /&gt;
---&amp;gt;  Extracting codeblocks&lt;br /&gt;
---&amp;gt;  Applying patches to codeblocks&lt;br /&gt;
---&amp;gt;  Configuring codeblocks&lt;br /&gt;
---&amp;gt;  Building codeblocks with target all&lt;br /&gt;
---&amp;gt;  Staging codeblocks into destroot&lt;br /&gt;
---&amp;gt;  Packaging tgz archive for codeblocks 1.0_0+macosx&lt;br /&gt;
---&amp;gt;  Installing codeblocks 1.0_0+macosx&lt;br /&gt;
---&amp;gt;  Activating codeblocks 1.0_0+macosx&lt;br /&gt;
---&amp;gt;  Cleaning codeblocks&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&lt;br /&gt;
sudo port clean codeblocks&lt;br /&gt;
sudo port install codeblocks&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;+macosx&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/DarwinPorts/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;DarwinPorts&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 --prefix=/opt/local&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Running &amp;lt;tt&amp;gt;+puredarwin&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 --prefix=/opt/local&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There is also a wxGTK startup command in &amp;quot;DarwinPorts&amp;quot;,&lt;br /&gt;
that will first start up X11.app and then launch C::B:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
open /Applications/DarwinPorts/CodeBlocks.command&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Afb</name></author>
	</entry>
	<entry>
		<id>https://wiki.codeblocks.org/index.php?title=Installing_Code::Blocks_from_source_on_RPM_based_distributions&amp;diff=4516</id>
		<title>Installing Code::Blocks from source on RPM based distributions</title>
		<link rel="alternate" type="text/html" href="https://wiki.codeblocks.org/index.php?title=Installing_Code::Blocks_from_source_on_RPM_based_distributions&amp;diff=4516"/>
		<updated>2007-03-26T07:57:02Z</updated>

		<summary type="html">&lt;p&gt;Afb: /* Install wxWidgets 2.6.x */&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;
&lt;br /&gt;
== Install Requirements ==&lt;br /&gt;
&lt;br /&gt;
Note: Code::Blocks requires GTK+ 2.x. Older distributions might only support GTK+ 1.x.&lt;br /&gt;
&lt;br /&gt;
Upgrading GTK+ is beyond the scope of this document, easier to upgrade distribution ?&lt;br /&gt;
&lt;br /&gt;
=== Install Development Tools ===&lt;br /&gt;
&lt;br /&gt;
This has to be installed before starting:&lt;br /&gt;
* zip&lt;br /&gt;
* update-desktop-files (only on SUSE)&lt;br /&gt;
* make&lt;br /&gt;
* gettext&lt;br /&gt;
* autoconf &amp;gt;= 2.5&lt;br /&gt;
* automake &amp;gt;= 1.7&lt;br /&gt;
* libtool &amp;gt;= 1.4&lt;br /&gt;
* m4&lt;br /&gt;
* intltool&lt;br /&gt;
* gcc-c++&lt;br /&gt;
* libstdc++-devel&lt;br /&gt;
&lt;br /&gt;
In Fedora/CentOS, this can be done with:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
su -c 'yum groupinstall &amp;quot;Development Tools&amp;quot;'&lt;br /&gt;
su -c 'yum install intltool'&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Install newer autotools versions (if needed) ====&lt;br /&gt;
&lt;br /&gt;
If you have CentOS 3 or RHEL 3, you will need to rebuild &amp;quot;automake17&amp;quot; to use instead of automake-1.6:&lt;br /&gt;
* ftp://ftp.redhat.com/pub/redhat/linux/enterprise/4/en/os/i386/SRPMS/automake17-1.7.9-5.src.rpm&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
rpmbuild --rebuild automake17-1.7.9-5.src.rpm&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then you need to invoke bootstrap like this, both on the commandline and in codeblocks.spec:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
AUTOMAKE=automake-1.7 ACLOCAL=aclocal-1.7 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;
=== Setup RPM environment ===&lt;br /&gt;
&lt;br /&gt;
This has to be installed before starting:&lt;br /&gt;
* rpm-build&lt;br /&gt;
&lt;br /&gt;
The top work directory for RPM varies between distributions and setups, but you can find your RPM top dir by setting a variable like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
RPM_TOPDIR=`rpm --eval %{_topdir}`&lt;br /&gt;
echo $RPM_TOPDIR&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Non-root rpmbuild environment (recommended) ====&lt;br /&gt;
&lt;br /&gt;
It is recommended that you don't use the root account to build packages, here is how you set up a minimal user build environment:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd&lt;br /&gt;
mkdir rpm&lt;br /&gt;
echo &amp;quot;%_topdir $HOME/rpm&amp;quot; &amp;gt;&amp;gt; .rpmmacros&lt;br /&gt;
mkdir /tmp/$USER/rpm&lt;br /&gt;
echo &amp;quot;%_tmppath /tmp/$USER/rpm&amp;quot; &amp;gt;&amp;gt; .rpmmacros&lt;br /&gt;
cd rpm&lt;br /&gt;
mkdir SPECS SOURCES BUILD RPMS SRPMS&lt;br /&gt;
RPM_TOPDIR=`rpm --eval %{_topdir}`&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can now build packages without being root (assuming that the spec files are correct). You will still need root access to install.&lt;br /&gt;
&lt;br /&gt;
=== Install wxWidgets 2.6.x ===&lt;br /&gt;
&lt;br /&gt;
The build requirements in the source RPM are set to a minimum. So it isn't checked whether wxGTK is installed or not. So you have to take a look at it yourself. Note that currently Code::Blocks requires wxWidgets '''2.6''', not 2.8! So if your distribution only provides packages for wxWidgets 2.8, you need to build wxWidgets 2.6 yourself.&lt;br /&gt;
&lt;br /&gt;
This has to be installed:&lt;br /&gt;
# wxGTK &amp;gt;= 2.6.0 and its devel package (see [http://wxwidgets.org wxwidgets.org])&lt;br /&gt;
# wxGTK-xrc and its devel package (in some distributions included in the packages of point 1)&lt;br /&gt;
&lt;br /&gt;
In later Fedora, this can be done with:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
su -c 'yum install wxGTK-devel'&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Build the wxGTK RPM from source (if needed) ====&lt;br /&gt;
&lt;br /&gt;
TODO&lt;br /&gt;
&lt;br /&gt;
* http://prdownloads.sourceforge.net/wxwindows/wxGTK-2.6.3.tar.gz&lt;br /&gt;
* ftp://biolpc22.york.ac.uk/pub/2.6.3/wxWidgets-2.6.3-Patch-2.tar.gz&lt;br /&gt;
* http://www.algonet.se/~afb/wx/wxGTK.spec&lt;br /&gt;
&lt;br /&gt;
RPMS&lt;br /&gt;
&lt;br /&gt;
* wx-base-unicode-2.6.3.0.2-1.i386.rpm&lt;br /&gt;
* wx-base-unicode-devel-2.6.3.0.2-1.i386.rpm&lt;br /&gt;
* wx-gtk2-unicode-2.6.3.0.2-1.i386.rpm&lt;br /&gt;
* wx-gtk2-unicode-devel-2.6.3.0.2-1.i386.rpm&lt;br /&gt;
* wx-gtk2-unicode-gl-2.6.3.0.2-1.i386.rpm&lt;br /&gt;
* wx-gtk2-unicode-contrib-2.6.3.0.2-1.i386.rpm&lt;br /&gt;
* wx-gtk2-unicode-contrib-devel-2.6.3.0.2-1.i386.rpm&lt;br /&gt;
* wx-gtk2-unicode-debuginfo-2.6.3.0.2-1.i386.rpm&lt;br /&gt;
* wx-i18n-2.6.3.0.2-1.i386.rpm&lt;br /&gt;
&lt;br /&gt;
=== Install Subversion client ===&lt;br /&gt;
&lt;br /&gt;
This has to be installed before starting:&lt;br /&gt;
* subversion &amp;gt;= 1.4.0, (see [http://subversion.tigris.org subversion.tigris.org])&lt;br /&gt;
&lt;br /&gt;
Binary packages for Red Hat Linux 9, Fedora Core 1, CentOS 3, CentOS 4 at:&lt;br /&gt;
&lt;br /&gt;
http://the.earth.li/pub/subversion/summersoft.fay.ar.us/pub/subversion/latest/&lt;br /&gt;
&lt;br /&gt;
In later Fedora, this can be done with:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
su -c 'yum install subversion'&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Build Subversion RPM from source (if needed) ====&lt;br /&gt;
&lt;br /&gt;
TODO&lt;br /&gt;
&lt;br /&gt;
* http://subversion.tigris.org/downloads/subversion-1.4.2.tar.gz&lt;br /&gt;
* packages/rpm/rhel-3/subversion.spec (CentOS 3)&lt;br /&gt;
* packages/rpm/rhel-4/subversion.spec (CentOS 4)&lt;br /&gt;
&lt;br /&gt;
RPMS&lt;br /&gt;
&lt;br /&gt;
* subversion-1.4.2-1.i386.rpm&lt;br /&gt;
* subversion-devel-1.4.2-1.i386.rpm&lt;br /&gt;
* subversion-perl-1.4.2-1.i386.rpm&lt;br /&gt;
* subversion-python-1.4.2-1.i386.rpm&lt;br /&gt;
* subversion-tools-1.4.2-1.i386.rpm&lt;br /&gt;
* subversion-debuginfo-1.4.2-1.i386.rpm&lt;br /&gt;
&lt;br /&gt;
== Install Code::Blocks ==&lt;br /&gt;
&lt;br /&gt;
=== Download the Source RPM ===&lt;br /&gt;
&lt;br /&gt;
1. Download the Source RPM from [https://www.codeblocks.org/downloads.shtml www.codeblocks.org/downloads.shtml]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;Note: the SRPM is currently unavailable (latest version being the old RC2), use SVN:&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Prepare SRPM package from SVN (if needed) ====&lt;br /&gt;
&lt;br /&gt;
1. You need to get the latest sources from SVN [https://www.codeblocks.org/source_code.shtml www.codeblocks.org/source_code.shtml]&lt;br /&gt;
&lt;br /&gt;
 svn checkout svn://svn.berlios.de/codeblocks/trunk&lt;br /&gt;
&lt;br /&gt;
2. go into ''trunk'', if you haven't already done it.&lt;br /&gt;
&lt;br /&gt;
3. run these three commands in this order&lt;br /&gt;
 ./bootstrap&lt;br /&gt;
 ./configure --enable-contrib&lt;br /&gt;
 make dist&lt;br /&gt;
the last one will create a .tar.gz archive that contains the sources.&lt;br /&gt;
&lt;br /&gt;
4. copy the archive to the directory $RPM_TOPDIR/SOURCES &lt;br /&gt;
 sudo mv codeblocks-trunk-r*.tar.gz $RPM_TOPDIR/SOURCES&lt;br /&gt;
&lt;br /&gt;
5. build the source RPM, or copy spec to $RPM_TOPDIR/SPECS&lt;br /&gt;
 rpmbuild -bs codeblocks.spec&lt;br /&gt;
&lt;br /&gt;
This will create a source package in the directory $RPM_TOPDIR/SRPMS/.&lt;br /&gt;
&lt;br /&gt;
=== Build the RPM package ===&lt;br /&gt;
&lt;br /&gt;
1. Build the binary package&lt;br /&gt;
 rpmbuild --rebuild codeblocks-1.0*.src.rpm&lt;br /&gt;
&lt;br /&gt;
This will create several packages in one of the architecture specific subdirectories (i386, x86_64, ppc, ...) of $RPM_TOPDIR/RPMS/.&lt;br /&gt;
&lt;br /&gt;
These are:&lt;br /&gt;
* codeblocks: main package&lt;br /&gt;
* codeblocks-contrib: contrib plugins&lt;br /&gt;
* codeblocks-devel: SDK headers&lt;br /&gt;
* codeblocks-debuginfo: stripped debug information&lt;br /&gt;
&lt;br /&gt;
=== Install the RPM package ===&lt;br /&gt;
&lt;br /&gt;
Install as root the packages you want (usually codeblocks and codeblocks-contrib) and enjoy Code::Blocks!&lt;br /&gt;
 su -c 'rpm -Uvh codeblocks-1.0*.i386.rpm'&lt;/div&gt;</summary>
		<author><name>Afb</name></author>
	</entry>
	<entry>
		<id>https://wiki.codeblocks.org/index.php?title=Installing_Code::Blocks_from_source_on_RPM_based_distributions&amp;diff=4515</id>
		<title>Installing Code::Blocks from source on RPM based distributions</title>
		<link rel="alternate" type="text/html" href="https://wiki.codeblocks.org/index.php?title=Installing_Code::Blocks_from_source_on_RPM_based_distributions&amp;diff=4515"/>
		<updated>2007-03-26T07:55:30Z</updated>

		<summary type="html">&lt;p&gt;Afb: /* Install the RPM package */&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;
&lt;br /&gt;
== Install Requirements ==&lt;br /&gt;
&lt;br /&gt;
Note: Code::Blocks requires GTK+ 2.x. Older distributions might only support GTK+ 1.x.&lt;br /&gt;
&lt;br /&gt;
Upgrading GTK+ is beyond the scope of this document, easier to upgrade distribution ?&lt;br /&gt;
&lt;br /&gt;
=== Install Development Tools ===&lt;br /&gt;
&lt;br /&gt;
This has to be installed before starting:&lt;br /&gt;
* zip&lt;br /&gt;
* update-desktop-files (only on SUSE)&lt;br /&gt;
* make&lt;br /&gt;
* gettext&lt;br /&gt;
* autoconf &amp;gt;= 2.5&lt;br /&gt;
* automake &amp;gt;= 1.7&lt;br /&gt;
* libtool &amp;gt;= 1.4&lt;br /&gt;
* m4&lt;br /&gt;
* intltool&lt;br /&gt;
* gcc-c++&lt;br /&gt;
* libstdc++-devel&lt;br /&gt;
&lt;br /&gt;
In Fedora/CentOS, this can be done with:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
su -c 'yum groupinstall &amp;quot;Development Tools&amp;quot;'&lt;br /&gt;
su -c 'yum install intltool'&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Install newer autotools versions (if needed) ====&lt;br /&gt;
&lt;br /&gt;
If you have CentOS 3 or RHEL 3, you will need to rebuild &amp;quot;automake17&amp;quot; to use instead of automake-1.6:&lt;br /&gt;
* ftp://ftp.redhat.com/pub/redhat/linux/enterprise/4/en/os/i386/SRPMS/automake17-1.7.9-5.src.rpm&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
rpmbuild --rebuild automake17-1.7.9-5.src.rpm&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then you need to invoke bootstrap like this, both on the commandline and in codeblocks.spec:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
AUTOMAKE=automake-1.7 ACLOCAL=aclocal-1.7 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;
=== Setup RPM environment ===&lt;br /&gt;
&lt;br /&gt;
This has to be installed before starting:&lt;br /&gt;
* rpm-build&lt;br /&gt;
&lt;br /&gt;
The top work directory for RPM varies between distributions and setups, but you can find your RPM top dir by setting a variable like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
RPM_TOPDIR=`rpm --eval %{_topdir}`&lt;br /&gt;
echo $RPM_TOPDIR&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Non-root rpmbuild environment (recommended) ====&lt;br /&gt;
&lt;br /&gt;
It is recommended that you don't use the root account to build packages, here is how you set up a minimal user build environment:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd&lt;br /&gt;
mkdir rpm&lt;br /&gt;
echo &amp;quot;%_topdir $HOME/rpm&amp;quot; &amp;gt;&amp;gt; .rpmmacros&lt;br /&gt;
mkdir /tmp/$USER/rpm&lt;br /&gt;
echo &amp;quot;%_tmppath /tmp/$USER/rpm&amp;quot; &amp;gt;&amp;gt; .rpmmacros&lt;br /&gt;
cd rpm&lt;br /&gt;
mkdir SPECS SOURCES BUILD RPMS SRPMS&lt;br /&gt;
RPM_TOPDIR=`rpm --eval %{_topdir}`&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can now build packages without being root (assuming that the spec files are correct). You will still need root access to install.&lt;br /&gt;
&lt;br /&gt;
=== Install wxWidgets 2.6.x ===&lt;br /&gt;
&lt;br /&gt;
The build requirements in the source RPM are set to a minimum. So it isn't checked whether wxGTK is installed or not. So you have to take a look at it yourself.&lt;br /&gt;
&lt;br /&gt;
This has to be installed:&lt;br /&gt;
# wxGTK &amp;gt;= 2.6.0 and its devel package (see [http://wxwidgets.org wxwidgets.org])&lt;br /&gt;
# wxGTK-xrc and its devel package (in some distributions included in the packages of point 1)&lt;br /&gt;
&lt;br /&gt;
In later Fedora, this can be done with:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
su -c 'yum install wxGTK-devel'&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Build the wxGTK RPM from source (if needed) ====&lt;br /&gt;
&lt;br /&gt;
TODO&lt;br /&gt;
&lt;br /&gt;
* http://prdownloads.sourceforge.net/wxwindows/wxGTK-2.6.3.tar.gz&lt;br /&gt;
* ftp://biolpc22.york.ac.uk/pub/2.6.3/wxWidgets-2.6.3-Patch-2.tar.gz&lt;br /&gt;
* http://www.algonet.se/~afb/wx/wxGTK.spec&lt;br /&gt;
&lt;br /&gt;
RPMS&lt;br /&gt;
&lt;br /&gt;
* wx-base-unicode-2.6.3.0.2-1.i386.rpm&lt;br /&gt;
* wx-base-unicode-devel-2.6.3.0.2-1.i386.rpm&lt;br /&gt;
* wx-gtk2-unicode-2.6.3.0.2-1.i386.rpm&lt;br /&gt;
* wx-gtk2-unicode-devel-2.6.3.0.2-1.i386.rpm&lt;br /&gt;
* wx-gtk2-unicode-gl-2.6.3.0.2-1.i386.rpm&lt;br /&gt;
* wx-gtk2-unicode-contrib-2.6.3.0.2-1.i386.rpm&lt;br /&gt;
* wx-gtk2-unicode-contrib-devel-2.6.3.0.2-1.i386.rpm&lt;br /&gt;
* wx-gtk2-unicode-debuginfo-2.6.3.0.2-1.i386.rpm&lt;br /&gt;
* wx-i18n-2.6.3.0.2-1.i386.rpm&lt;br /&gt;
&lt;br /&gt;
=== Install Subversion client ===&lt;br /&gt;
&lt;br /&gt;
This has to be installed before starting:&lt;br /&gt;
* subversion &amp;gt;= 1.4.0, (see [http://subversion.tigris.org subversion.tigris.org])&lt;br /&gt;
&lt;br /&gt;
Binary packages for Red Hat Linux 9, Fedora Core 1, CentOS 3, CentOS 4 at:&lt;br /&gt;
&lt;br /&gt;
http://the.earth.li/pub/subversion/summersoft.fay.ar.us/pub/subversion/latest/&lt;br /&gt;
&lt;br /&gt;
In later Fedora, this can be done with:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
su -c 'yum install subversion'&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Build Subversion RPM from source (if needed) ====&lt;br /&gt;
&lt;br /&gt;
TODO&lt;br /&gt;
&lt;br /&gt;
* http://subversion.tigris.org/downloads/subversion-1.4.2.tar.gz&lt;br /&gt;
* packages/rpm/rhel-3/subversion.spec (CentOS 3)&lt;br /&gt;
* packages/rpm/rhel-4/subversion.spec (CentOS 4)&lt;br /&gt;
&lt;br /&gt;
RPMS&lt;br /&gt;
&lt;br /&gt;
* subversion-1.4.2-1.i386.rpm&lt;br /&gt;
* subversion-devel-1.4.2-1.i386.rpm&lt;br /&gt;
* subversion-perl-1.4.2-1.i386.rpm&lt;br /&gt;
* subversion-python-1.4.2-1.i386.rpm&lt;br /&gt;
* subversion-tools-1.4.2-1.i386.rpm&lt;br /&gt;
* subversion-debuginfo-1.4.2-1.i386.rpm&lt;br /&gt;
&lt;br /&gt;
== Install Code::Blocks ==&lt;br /&gt;
&lt;br /&gt;
=== Download the Source RPM ===&lt;br /&gt;
&lt;br /&gt;
1. Download the Source RPM from [https://www.codeblocks.org/downloads.shtml www.codeblocks.org/downloads.shtml]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;Note: the SRPM is currently unavailable (latest version being the old RC2), use SVN:&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Prepare SRPM package from SVN (if needed) ====&lt;br /&gt;
&lt;br /&gt;
1. You need to get the latest sources from SVN [https://www.codeblocks.org/source_code.shtml www.codeblocks.org/source_code.shtml]&lt;br /&gt;
&lt;br /&gt;
 svn checkout svn://svn.berlios.de/codeblocks/trunk&lt;br /&gt;
&lt;br /&gt;
2. go into ''trunk'', if you haven't already done it.&lt;br /&gt;
&lt;br /&gt;
3. run these three commands in this order&lt;br /&gt;
 ./bootstrap&lt;br /&gt;
 ./configure --enable-contrib&lt;br /&gt;
 make dist&lt;br /&gt;
the last one will create a .tar.gz archive that contains the sources.&lt;br /&gt;
&lt;br /&gt;
4. copy the archive to the directory $RPM_TOPDIR/SOURCES &lt;br /&gt;
 sudo mv codeblocks-trunk-r*.tar.gz $RPM_TOPDIR/SOURCES&lt;br /&gt;
&lt;br /&gt;
5. build the source RPM, or copy spec to $RPM_TOPDIR/SPECS&lt;br /&gt;
 rpmbuild -bs codeblocks.spec&lt;br /&gt;
&lt;br /&gt;
This will create a source package in the directory $RPM_TOPDIR/SRPMS/.&lt;br /&gt;
&lt;br /&gt;
=== Build the RPM package ===&lt;br /&gt;
&lt;br /&gt;
1. Build the binary package&lt;br /&gt;
 rpmbuild --rebuild codeblocks-1.0*.src.rpm&lt;br /&gt;
&lt;br /&gt;
This will create several packages in one of the architecture specific subdirectories (i386, x86_64, ppc, ...) of $RPM_TOPDIR/RPMS/.&lt;br /&gt;
&lt;br /&gt;
These are:&lt;br /&gt;
* codeblocks: main package&lt;br /&gt;
* codeblocks-contrib: contrib plugins&lt;br /&gt;
* codeblocks-devel: SDK headers&lt;br /&gt;
* codeblocks-debuginfo: stripped debug information&lt;br /&gt;
&lt;br /&gt;
=== Install the RPM package ===&lt;br /&gt;
&lt;br /&gt;
Install as root the packages you want (usually codeblocks and codeblocks-contrib) and enjoy Code::Blocks!&lt;br /&gt;
 su -c 'rpm -Uvh codeblocks-1.0*.i386.rpm'&lt;/div&gt;</summary>
		<author><name>Afb</name></author>
	</entry>
	<entry>
		<id>https://wiki.codeblocks.org/index.php?title=Installing_Code::Blocks_from_source_on_RPM_based_distributions&amp;diff=4514</id>
		<title>Installing Code::Blocks from source on RPM based distributions</title>
		<link rel="alternate" type="text/html" href="https://wiki.codeblocks.org/index.php?title=Installing_Code::Blocks_from_source_on_RPM_based_distributions&amp;diff=4514"/>
		<updated>2007-03-26T07:54:38Z</updated>

		<summary type="html">&lt;p&gt;Afb: /* Install Requirements */&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;
&lt;br /&gt;
== Install Requirements ==&lt;br /&gt;
&lt;br /&gt;
Note: Code::Blocks requires GTK+ 2.x. Older distributions might only support GTK+ 1.x.&lt;br /&gt;
&lt;br /&gt;
Upgrading GTK+ is beyond the scope of this document, easier to upgrade distribution ?&lt;br /&gt;
&lt;br /&gt;
=== Install Development Tools ===&lt;br /&gt;
&lt;br /&gt;
This has to be installed before starting:&lt;br /&gt;
* zip&lt;br /&gt;
* update-desktop-files (only on SUSE)&lt;br /&gt;
* make&lt;br /&gt;
* gettext&lt;br /&gt;
* autoconf &amp;gt;= 2.5&lt;br /&gt;
* automake &amp;gt;= 1.7&lt;br /&gt;
* libtool &amp;gt;= 1.4&lt;br /&gt;
* m4&lt;br /&gt;
* intltool&lt;br /&gt;
* gcc-c++&lt;br /&gt;
* libstdc++-devel&lt;br /&gt;
&lt;br /&gt;
In Fedora/CentOS, this can be done with:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
su -c 'yum groupinstall &amp;quot;Development Tools&amp;quot;'&lt;br /&gt;
su -c 'yum install intltool'&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Install newer autotools versions (if needed) ====&lt;br /&gt;
&lt;br /&gt;
If you have CentOS 3 or RHEL 3, you will need to rebuild &amp;quot;automake17&amp;quot; to use instead of automake-1.6:&lt;br /&gt;
* ftp://ftp.redhat.com/pub/redhat/linux/enterprise/4/en/os/i386/SRPMS/automake17-1.7.9-5.src.rpm&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
rpmbuild --rebuild automake17-1.7.9-5.src.rpm&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then you need to invoke bootstrap like this, both on the commandline and in codeblocks.spec:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
AUTOMAKE=automake-1.7 ACLOCAL=aclocal-1.7 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;
=== Setup RPM environment ===&lt;br /&gt;
&lt;br /&gt;
This has to be installed before starting:&lt;br /&gt;
* rpm-build&lt;br /&gt;
&lt;br /&gt;
The top work directory for RPM varies between distributions and setups, but you can find your RPM top dir by setting a variable like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
RPM_TOPDIR=`rpm --eval %{_topdir}`&lt;br /&gt;
echo $RPM_TOPDIR&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Non-root rpmbuild environment (recommended) ====&lt;br /&gt;
&lt;br /&gt;
It is recommended that you don't use the root account to build packages, here is how you set up a minimal user build environment:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd&lt;br /&gt;
mkdir rpm&lt;br /&gt;
echo &amp;quot;%_topdir $HOME/rpm&amp;quot; &amp;gt;&amp;gt; .rpmmacros&lt;br /&gt;
mkdir /tmp/$USER/rpm&lt;br /&gt;
echo &amp;quot;%_tmppath /tmp/$USER/rpm&amp;quot; &amp;gt;&amp;gt; .rpmmacros&lt;br /&gt;
cd rpm&lt;br /&gt;
mkdir SPECS SOURCES BUILD RPMS SRPMS&lt;br /&gt;
RPM_TOPDIR=`rpm --eval %{_topdir}`&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can now build packages without being root (assuming that the spec files are correct). You will still need root access to install.&lt;br /&gt;
&lt;br /&gt;
=== Install wxWidgets 2.6.x ===&lt;br /&gt;
&lt;br /&gt;
The build requirements in the source RPM are set to a minimum. So it isn't checked whether wxGTK is installed or not. So you have to take a look at it yourself.&lt;br /&gt;
&lt;br /&gt;
This has to be installed:&lt;br /&gt;
# wxGTK &amp;gt;= 2.6.0 and its devel package (see [http://wxwidgets.org wxwidgets.org])&lt;br /&gt;
# wxGTK-xrc and its devel package (in some distributions included in the packages of point 1)&lt;br /&gt;
&lt;br /&gt;
In later Fedora, this can be done with:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
su -c 'yum install wxGTK-devel'&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Build the wxGTK RPM from source (if needed) ====&lt;br /&gt;
&lt;br /&gt;
TODO&lt;br /&gt;
&lt;br /&gt;
* http://prdownloads.sourceforge.net/wxwindows/wxGTK-2.6.3.tar.gz&lt;br /&gt;
* ftp://biolpc22.york.ac.uk/pub/2.6.3/wxWidgets-2.6.3-Patch-2.tar.gz&lt;br /&gt;
* http://www.algonet.se/~afb/wx/wxGTK.spec&lt;br /&gt;
&lt;br /&gt;
RPMS&lt;br /&gt;
&lt;br /&gt;
* wx-base-unicode-2.6.3.0.2-1.i386.rpm&lt;br /&gt;
* wx-base-unicode-devel-2.6.3.0.2-1.i386.rpm&lt;br /&gt;
* wx-gtk2-unicode-2.6.3.0.2-1.i386.rpm&lt;br /&gt;
* wx-gtk2-unicode-devel-2.6.3.0.2-1.i386.rpm&lt;br /&gt;
* wx-gtk2-unicode-gl-2.6.3.0.2-1.i386.rpm&lt;br /&gt;
* wx-gtk2-unicode-contrib-2.6.3.0.2-1.i386.rpm&lt;br /&gt;
* wx-gtk2-unicode-contrib-devel-2.6.3.0.2-1.i386.rpm&lt;br /&gt;
* wx-gtk2-unicode-debuginfo-2.6.3.0.2-1.i386.rpm&lt;br /&gt;
* wx-i18n-2.6.3.0.2-1.i386.rpm&lt;br /&gt;
&lt;br /&gt;
=== Install Subversion client ===&lt;br /&gt;
&lt;br /&gt;
This has to be installed before starting:&lt;br /&gt;
* subversion &amp;gt;= 1.4.0, (see [http://subversion.tigris.org subversion.tigris.org])&lt;br /&gt;
&lt;br /&gt;
Binary packages for Red Hat Linux 9, Fedora Core 1, CentOS 3, CentOS 4 at:&lt;br /&gt;
&lt;br /&gt;
http://the.earth.li/pub/subversion/summersoft.fay.ar.us/pub/subversion/latest/&lt;br /&gt;
&lt;br /&gt;
In later Fedora, this can be done with:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
su -c 'yum install subversion'&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Build Subversion RPM from source (if needed) ====&lt;br /&gt;
&lt;br /&gt;
TODO&lt;br /&gt;
&lt;br /&gt;
* http://subversion.tigris.org/downloads/subversion-1.4.2.tar.gz&lt;br /&gt;
* packages/rpm/rhel-3/subversion.spec (CentOS 3)&lt;br /&gt;
* packages/rpm/rhel-4/subversion.spec (CentOS 4)&lt;br /&gt;
&lt;br /&gt;
RPMS&lt;br /&gt;
&lt;br /&gt;
* subversion-1.4.2-1.i386.rpm&lt;br /&gt;
* subversion-devel-1.4.2-1.i386.rpm&lt;br /&gt;
* subversion-perl-1.4.2-1.i386.rpm&lt;br /&gt;
* subversion-python-1.4.2-1.i386.rpm&lt;br /&gt;
* subversion-tools-1.4.2-1.i386.rpm&lt;br /&gt;
* subversion-debuginfo-1.4.2-1.i386.rpm&lt;br /&gt;
&lt;br /&gt;
== Install Code::Blocks ==&lt;br /&gt;
&lt;br /&gt;
=== Download the Source RPM ===&lt;br /&gt;
&lt;br /&gt;
1. Download the Source RPM from [https://www.codeblocks.org/downloads.shtml www.codeblocks.org/downloads.shtml]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;Note: the SRPM is currently unavailable (latest version being the old RC2), use SVN:&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Prepare SRPM package from SVN (if needed) ====&lt;br /&gt;
&lt;br /&gt;
1. You need to get the latest sources from SVN [https://www.codeblocks.org/source_code.shtml www.codeblocks.org/source_code.shtml]&lt;br /&gt;
&lt;br /&gt;
 svn checkout svn://svn.berlios.de/codeblocks/trunk&lt;br /&gt;
&lt;br /&gt;
2. go into ''trunk'', if you haven't already done it.&lt;br /&gt;
&lt;br /&gt;
3. run these three commands in this order&lt;br /&gt;
 ./bootstrap&lt;br /&gt;
 ./configure --enable-contrib&lt;br /&gt;
 make dist&lt;br /&gt;
the last one will create a .tar.gz archive that contains the sources.&lt;br /&gt;
&lt;br /&gt;
4. copy the archive to the directory $RPM_TOPDIR/SOURCES &lt;br /&gt;
 sudo mv codeblocks-trunk-r*.tar.gz $RPM_TOPDIR/SOURCES&lt;br /&gt;
&lt;br /&gt;
5. build the source RPM, or copy spec to $RPM_TOPDIR/SPECS&lt;br /&gt;
 rpmbuild -bs codeblocks.spec&lt;br /&gt;
&lt;br /&gt;
This will create a source package in the directory $RPM_TOPDIR/SRPMS/.&lt;br /&gt;
&lt;br /&gt;
=== Build the RPM package ===&lt;br /&gt;
&lt;br /&gt;
1. Build the binary package&lt;br /&gt;
 rpmbuild --rebuild codeblocks-1.0*.src.rpm&lt;br /&gt;
&lt;br /&gt;
This will create several packages in one of the architecture specific subdirectories (i386, x86_64, ppc, ...) of $RPM_TOPDIR/RPMS/.&lt;br /&gt;
&lt;br /&gt;
These are:&lt;br /&gt;
* codeblocks: main package&lt;br /&gt;
* codeblocks-contrib: contrib plugins&lt;br /&gt;
* codeblocks-devel: SDK headers&lt;br /&gt;
* codeblocks-debuginfo: stripped debug information&lt;br /&gt;
&lt;br /&gt;
=== Install the RPM package ===&lt;br /&gt;
&lt;br /&gt;
Install as root the packages you want (usually codeblocks and codeblocks-contrib) and enjoy Code::Blocks!&lt;br /&gt;
 sudo rpm -Uvh codeblocks-1.0*.i386.rpm&lt;/div&gt;</summary>
		<author><name>Afb</name></author>
	</entry>
	<entry>
		<id>https://wiki.codeblocks.org/index.php?title=Installing_Code::Blocks_from_source_on_RPM_based_distributions&amp;diff=4513</id>
		<title>Installing Code::Blocks from source on RPM based distributions</title>
		<link rel="alternate" type="text/html" href="https://wiki.codeblocks.org/index.php?title=Installing_Code::Blocks_from_source_on_RPM_based_distributions&amp;diff=4513"/>
		<updated>2007-03-26T07:53:13Z</updated>

		<summary type="html">&lt;p&gt;Afb: /* Install the RPM package */&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;
&lt;br /&gt;
== Install Requirements ==&lt;br /&gt;
&lt;br /&gt;
Note: Code::Blocks requires GTK+ 2.x. Older distributions might only support GTK+ 1.x.&lt;br /&gt;
&lt;br /&gt;
=== Install Development Tools ===&lt;br /&gt;
&lt;br /&gt;
This has to be installed before starting:&lt;br /&gt;
* zip&lt;br /&gt;
* update-desktop-files (only on SUSE)&lt;br /&gt;
* make&lt;br /&gt;
* gettext&lt;br /&gt;
* autoconf &amp;gt;= 2.5&lt;br /&gt;
* automake &amp;gt;= 1.7&lt;br /&gt;
* libtool &amp;gt;= 1.4&lt;br /&gt;
* m4&lt;br /&gt;
* intltool&lt;br /&gt;
* gcc-c++&lt;br /&gt;
* libstdc++-devel&lt;br /&gt;
&lt;br /&gt;
In Fedora/CentOS, this can be done with:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
su -c 'yum groupinstall &amp;quot;Development Tools&amp;quot;'&lt;br /&gt;
su -c 'yum install intltool'&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Install newer autotools versions (if needed) ====&lt;br /&gt;
&lt;br /&gt;
If you have CentOS 3 or RHEL 3, you will need to rebuild &amp;quot;automake17&amp;quot; to use instead of automake-1.6:&lt;br /&gt;
* ftp://ftp.redhat.com/pub/redhat/linux/enterprise/4/en/os/i386/SRPMS/automake17-1.7.9-5.src.rpm&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
rpmbuild --rebuild automake17-1.7.9-5.src.rpm&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then you need to invoke bootstrap like this, both on the commandline and in codeblocks.spec:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
AUTOMAKE=automake-1.7 ACLOCAL=aclocal-1.7 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;
=== Setup RPM environment ===&lt;br /&gt;
&lt;br /&gt;
This has to be installed before starting:&lt;br /&gt;
* rpm-build&lt;br /&gt;
&lt;br /&gt;
The top work directory for RPM varies between distributions and setups, but you can find your RPM top dir by setting a variable like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
RPM_TOPDIR=`rpm --eval %{_topdir}`&lt;br /&gt;
echo $RPM_TOPDIR&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Non-root rpmbuild environment (recommended) ====&lt;br /&gt;
&lt;br /&gt;
It is recommended that you don't use the root account to build packages, here is how you set up a minimal user build environment:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd&lt;br /&gt;
mkdir rpm&lt;br /&gt;
echo &amp;quot;%_topdir $HOME/rpm&amp;quot; &amp;gt;&amp;gt; .rpmmacros&lt;br /&gt;
mkdir /tmp/$USER/rpm&lt;br /&gt;
echo &amp;quot;%_tmppath /tmp/$USER/rpm&amp;quot; &amp;gt;&amp;gt; .rpmmacros&lt;br /&gt;
cd rpm&lt;br /&gt;
mkdir SPECS SOURCES BUILD RPMS SRPMS&lt;br /&gt;
RPM_TOPDIR=`rpm --eval %{_topdir}`&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can now build packages without being root (assuming that the spec files are correct). You will still need root access to install.&lt;br /&gt;
&lt;br /&gt;
=== Install wxWidgets 2.6.x ===&lt;br /&gt;
&lt;br /&gt;
The build requirements in the source RPM are set to a minimum. So it isn't checked whether wxGTK is installed or not. So you have to take a look at it yourself.&lt;br /&gt;
&lt;br /&gt;
This has to be installed:&lt;br /&gt;
# wxGTK &amp;gt;= 2.6.0 and its devel package (see [http://wxwidgets.org wxwidgets.org])&lt;br /&gt;
# wxGTK-xrc and its devel package (in some distributions included in the packages of point 1)&lt;br /&gt;
&lt;br /&gt;
In later Fedora, this can be done with:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
su -c 'yum install wxGTK-devel'&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Build the wxGTK RPM from source (if needed) ====&lt;br /&gt;
&lt;br /&gt;
TODO&lt;br /&gt;
&lt;br /&gt;
* http://prdownloads.sourceforge.net/wxwindows/wxGTK-2.6.3.tar.gz&lt;br /&gt;
* ftp://biolpc22.york.ac.uk/pub/2.6.3/wxWidgets-2.6.3-Patch-2.tar.gz&lt;br /&gt;
* http://www.algonet.se/~afb/wx/wxGTK.spec&lt;br /&gt;
&lt;br /&gt;
RPMS&lt;br /&gt;
&lt;br /&gt;
* wx-base-unicode-2.6.3.0.2-1.i386.rpm&lt;br /&gt;
* wx-base-unicode-devel-2.6.3.0.2-1.i386.rpm&lt;br /&gt;
* wx-gtk2-unicode-2.6.3.0.2-1.i386.rpm&lt;br /&gt;
* wx-gtk2-unicode-devel-2.6.3.0.2-1.i386.rpm&lt;br /&gt;
* wx-gtk2-unicode-gl-2.6.3.0.2-1.i386.rpm&lt;br /&gt;
* wx-gtk2-unicode-contrib-2.6.3.0.2-1.i386.rpm&lt;br /&gt;
* wx-gtk2-unicode-contrib-devel-2.6.3.0.2-1.i386.rpm&lt;br /&gt;
* wx-gtk2-unicode-debuginfo-2.6.3.0.2-1.i386.rpm&lt;br /&gt;
* wx-i18n-2.6.3.0.2-1.i386.rpm&lt;br /&gt;
&lt;br /&gt;
=== Install Subversion client ===&lt;br /&gt;
&lt;br /&gt;
This has to be installed before starting:&lt;br /&gt;
* subversion &amp;gt;= 1.4.0, (see [http://subversion.tigris.org subversion.tigris.org])&lt;br /&gt;
&lt;br /&gt;
Binary packages for Red Hat Linux 9, Fedora Core 1, CentOS 3, CentOS 4 at:&lt;br /&gt;
&lt;br /&gt;
http://the.earth.li/pub/subversion/summersoft.fay.ar.us/pub/subversion/latest/&lt;br /&gt;
&lt;br /&gt;
In later Fedora, this can be done with:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
su -c 'yum install subversion'&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Build Subversion RPM from source (if needed) ====&lt;br /&gt;
&lt;br /&gt;
TODO&lt;br /&gt;
&lt;br /&gt;
* http://subversion.tigris.org/downloads/subversion-1.4.2.tar.gz&lt;br /&gt;
* packages/rpm/rhel-3/subversion.spec (CentOS 3)&lt;br /&gt;
* packages/rpm/rhel-4/subversion.spec (CentOS 4)&lt;br /&gt;
&lt;br /&gt;
RPMS&lt;br /&gt;
&lt;br /&gt;
* subversion-1.4.2-1.i386.rpm&lt;br /&gt;
* subversion-devel-1.4.2-1.i386.rpm&lt;br /&gt;
* subversion-perl-1.4.2-1.i386.rpm&lt;br /&gt;
* subversion-python-1.4.2-1.i386.rpm&lt;br /&gt;
* subversion-tools-1.4.2-1.i386.rpm&lt;br /&gt;
* subversion-debuginfo-1.4.2-1.i386.rpm&lt;br /&gt;
&lt;br /&gt;
== Install Code::Blocks ==&lt;br /&gt;
&lt;br /&gt;
=== Download the Source RPM ===&lt;br /&gt;
&lt;br /&gt;
1. Download the Source RPM from [https://www.codeblocks.org/downloads.shtml www.codeblocks.org/downloads.shtml]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;Note: the SRPM is currently unavailable (latest version being the old RC2), use SVN:&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Prepare SRPM package from SVN (if needed) ====&lt;br /&gt;
&lt;br /&gt;
1. You need to get the latest sources from SVN [https://www.codeblocks.org/source_code.shtml www.codeblocks.org/source_code.shtml]&lt;br /&gt;
&lt;br /&gt;
 svn checkout svn://svn.berlios.de/codeblocks/trunk&lt;br /&gt;
&lt;br /&gt;
2. go into ''trunk'', if you haven't already done it.&lt;br /&gt;
&lt;br /&gt;
3. run these three commands in this order&lt;br /&gt;
 ./bootstrap&lt;br /&gt;
 ./configure --enable-contrib&lt;br /&gt;
 make dist&lt;br /&gt;
the last one will create a .tar.gz archive that contains the sources.&lt;br /&gt;
&lt;br /&gt;
4. copy the archive to the directory $RPM_TOPDIR/SOURCES &lt;br /&gt;
 sudo mv codeblocks-trunk-r*.tar.gz $RPM_TOPDIR/SOURCES&lt;br /&gt;
&lt;br /&gt;
5. build the source RPM, or copy spec to $RPM_TOPDIR/SPECS&lt;br /&gt;
 rpmbuild -bs codeblocks.spec&lt;br /&gt;
&lt;br /&gt;
This will create a source package in the directory $RPM_TOPDIR/SRPMS/.&lt;br /&gt;
&lt;br /&gt;
=== Build the RPM package ===&lt;br /&gt;
&lt;br /&gt;
1. Build the binary package&lt;br /&gt;
 rpmbuild --rebuild codeblocks-1.0*.src.rpm&lt;br /&gt;
&lt;br /&gt;
This will create several packages in one of the architecture specific subdirectories (i386, x86_64, ppc, ...) of $RPM_TOPDIR/RPMS/.&lt;br /&gt;
&lt;br /&gt;
These are:&lt;br /&gt;
* codeblocks: main package&lt;br /&gt;
* codeblocks-contrib: contrib plugins&lt;br /&gt;
* codeblocks-devel: SDK headers&lt;br /&gt;
* codeblocks-debuginfo: stripped debug information&lt;br /&gt;
&lt;br /&gt;
=== Install the RPM package ===&lt;br /&gt;
&lt;br /&gt;
Install as root the packages you want (usually codeblocks and codeblocks-contrib) and enjoy Code::Blocks!&lt;br /&gt;
 sudo rpm -Uvh codeblocks-1.0*.i386.rpm&lt;/div&gt;</summary>
		<author><name>Afb</name></author>
	</entry>
	<entry>
		<id>https://wiki.codeblocks.org/index.php?title=Installing_Code::Blocks_from_source_on_RPM_based_distributions&amp;diff=4512</id>
		<title>Installing Code::Blocks from source on RPM based distributions</title>
		<link rel="alternate" type="text/html" href="https://wiki.codeblocks.org/index.php?title=Installing_Code::Blocks_from_source_on_RPM_based_distributions&amp;diff=4512"/>
		<updated>2007-03-26T07:51:31Z</updated>

		<summary type="html">&lt;p&gt;Afb: /* Prepare SRPM package from SVN (if needed) */&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;
&lt;br /&gt;
== Install Requirements ==&lt;br /&gt;
&lt;br /&gt;
Note: Code::Blocks requires GTK+ 2.x. Older distributions might only support GTK+ 1.x.&lt;br /&gt;
&lt;br /&gt;
=== Install Development Tools ===&lt;br /&gt;
&lt;br /&gt;
This has to be installed before starting:&lt;br /&gt;
* zip&lt;br /&gt;
* update-desktop-files (only on SUSE)&lt;br /&gt;
* make&lt;br /&gt;
* gettext&lt;br /&gt;
* autoconf &amp;gt;= 2.5&lt;br /&gt;
* automake &amp;gt;= 1.7&lt;br /&gt;
* libtool &amp;gt;= 1.4&lt;br /&gt;
* m4&lt;br /&gt;
* intltool&lt;br /&gt;
* gcc-c++&lt;br /&gt;
* libstdc++-devel&lt;br /&gt;
&lt;br /&gt;
In Fedora/CentOS, this can be done with:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
su -c 'yum groupinstall &amp;quot;Development Tools&amp;quot;'&lt;br /&gt;
su -c 'yum install intltool'&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Install newer autotools versions (if needed) ====&lt;br /&gt;
&lt;br /&gt;
If you have CentOS 3 or RHEL 3, you will need to rebuild &amp;quot;automake17&amp;quot; to use instead of automake-1.6:&lt;br /&gt;
* ftp://ftp.redhat.com/pub/redhat/linux/enterprise/4/en/os/i386/SRPMS/automake17-1.7.9-5.src.rpm&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
rpmbuild --rebuild automake17-1.7.9-5.src.rpm&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then you need to invoke bootstrap like this, both on the commandline and in codeblocks.spec:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
AUTOMAKE=automake-1.7 ACLOCAL=aclocal-1.7 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;
=== Setup RPM environment ===&lt;br /&gt;
&lt;br /&gt;
This has to be installed before starting:&lt;br /&gt;
* rpm-build&lt;br /&gt;
&lt;br /&gt;
The top work directory for RPM varies between distributions and setups, but you can find your RPM top dir by setting a variable like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
RPM_TOPDIR=`rpm --eval %{_topdir}`&lt;br /&gt;
echo $RPM_TOPDIR&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Non-root rpmbuild environment (recommended) ====&lt;br /&gt;
&lt;br /&gt;
It is recommended that you don't use the root account to build packages, here is how you set up a minimal user build environment:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd&lt;br /&gt;
mkdir rpm&lt;br /&gt;
echo &amp;quot;%_topdir $HOME/rpm&amp;quot; &amp;gt;&amp;gt; .rpmmacros&lt;br /&gt;
mkdir /tmp/$USER/rpm&lt;br /&gt;
echo &amp;quot;%_tmppath /tmp/$USER/rpm&amp;quot; &amp;gt;&amp;gt; .rpmmacros&lt;br /&gt;
cd rpm&lt;br /&gt;
mkdir SPECS SOURCES BUILD RPMS SRPMS&lt;br /&gt;
RPM_TOPDIR=`rpm --eval %{_topdir}`&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can now build packages without being root (assuming that the spec files are correct). You will still need root access to install.&lt;br /&gt;
&lt;br /&gt;
=== Install wxWidgets 2.6.x ===&lt;br /&gt;
&lt;br /&gt;
The build requirements in the source RPM are set to a minimum. So it isn't checked whether wxGTK is installed or not. So you have to take a look at it yourself.&lt;br /&gt;
&lt;br /&gt;
This has to be installed:&lt;br /&gt;
# wxGTK &amp;gt;= 2.6.0 and its devel package (see [http://wxwidgets.org wxwidgets.org])&lt;br /&gt;
# wxGTK-xrc and its devel package (in some distributions included in the packages of point 1)&lt;br /&gt;
&lt;br /&gt;
In later Fedora, this can be done with:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
su -c 'yum install wxGTK-devel'&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Build the wxGTK RPM from source (if needed) ====&lt;br /&gt;
&lt;br /&gt;
TODO&lt;br /&gt;
&lt;br /&gt;
* http://prdownloads.sourceforge.net/wxwindows/wxGTK-2.6.3.tar.gz&lt;br /&gt;
* ftp://biolpc22.york.ac.uk/pub/2.6.3/wxWidgets-2.6.3-Patch-2.tar.gz&lt;br /&gt;
* http://www.algonet.se/~afb/wx/wxGTK.spec&lt;br /&gt;
&lt;br /&gt;
RPMS&lt;br /&gt;
&lt;br /&gt;
* wx-base-unicode-2.6.3.0.2-1.i386.rpm&lt;br /&gt;
* wx-base-unicode-devel-2.6.3.0.2-1.i386.rpm&lt;br /&gt;
* wx-gtk2-unicode-2.6.3.0.2-1.i386.rpm&lt;br /&gt;
* wx-gtk2-unicode-devel-2.6.3.0.2-1.i386.rpm&lt;br /&gt;
* wx-gtk2-unicode-gl-2.6.3.0.2-1.i386.rpm&lt;br /&gt;
* wx-gtk2-unicode-contrib-2.6.3.0.2-1.i386.rpm&lt;br /&gt;
* wx-gtk2-unicode-contrib-devel-2.6.3.0.2-1.i386.rpm&lt;br /&gt;
* wx-gtk2-unicode-debuginfo-2.6.3.0.2-1.i386.rpm&lt;br /&gt;
* wx-i18n-2.6.3.0.2-1.i386.rpm&lt;br /&gt;
&lt;br /&gt;
=== Install Subversion client ===&lt;br /&gt;
&lt;br /&gt;
This has to be installed before starting:&lt;br /&gt;
* subversion &amp;gt;= 1.4.0, (see [http://subversion.tigris.org subversion.tigris.org])&lt;br /&gt;
&lt;br /&gt;
Binary packages for Red Hat Linux 9, Fedora Core 1, CentOS 3, CentOS 4 at:&lt;br /&gt;
&lt;br /&gt;
http://the.earth.li/pub/subversion/summersoft.fay.ar.us/pub/subversion/latest/&lt;br /&gt;
&lt;br /&gt;
In later Fedora, this can be done with:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
su -c 'yum install subversion'&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Build Subversion RPM from source (if needed) ====&lt;br /&gt;
&lt;br /&gt;
TODO&lt;br /&gt;
&lt;br /&gt;
* http://subversion.tigris.org/downloads/subversion-1.4.2.tar.gz&lt;br /&gt;
* packages/rpm/rhel-3/subversion.spec (CentOS 3)&lt;br /&gt;
* packages/rpm/rhel-4/subversion.spec (CentOS 4)&lt;br /&gt;
&lt;br /&gt;
RPMS&lt;br /&gt;
&lt;br /&gt;
* subversion-1.4.2-1.i386.rpm&lt;br /&gt;
* subversion-devel-1.4.2-1.i386.rpm&lt;br /&gt;
* subversion-perl-1.4.2-1.i386.rpm&lt;br /&gt;
* subversion-python-1.4.2-1.i386.rpm&lt;br /&gt;
* subversion-tools-1.4.2-1.i386.rpm&lt;br /&gt;
* subversion-debuginfo-1.4.2-1.i386.rpm&lt;br /&gt;
&lt;br /&gt;
== Install Code::Blocks ==&lt;br /&gt;
&lt;br /&gt;
=== Download the Source RPM ===&lt;br /&gt;
&lt;br /&gt;
1. Download the Source RPM from [https://www.codeblocks.org/downloads.shtml www.codeblocks.org/downloads.shtml]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;Note: the SRPM is currently unavailable (latest version being the old RC2), use SVN:&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Prepare SRPM package from SVN (if needed) ====&lt;br /&gt;
&lt;br /&gt;
1. You need to get the latest sources from SVN [https://www.codeblocks.org/source_code.shtml www.codeblocks.org/source_code.shtml]&lt;br /&gt;
&lt;br /&gt;
 svn checkout svn://svn.berlios.de/codeblocks/trunk&lt;br /&gt;
&lt;br /&gt;
2. go into ''trunk'', if you haven't already done it.&lt;br /&gt;
&lt;br /&gt;
3. run these three commands in this order&lt;br /&gt;
 ./bootstrap&lt;br /&gt;
 ./configure --enable-contrib&lt;br /&gt;
 make dist&lt;br /&gt;
the last one will create a .tar.gz archive that contains the sources.&lt;br /&gt;
&lt;br /&gt;
4. copy the archive to the directory $RPM_TOPDIR/SOURCES &lt;br /&gt;
 sudo mv codeblocks-trunk-r*.tar.gz $RPM_TOPDIR/SOURCES&lt;br /&gt;
&lt;br /&gt;
5. build the source RPM, or copy spec to $RPM_TOPDIR/SPECS&lt;br /&gt;
 rpmbuild -bs codeblocks.spec&lt;br /&gt;
&lt;br /&gt;
This will create a source package in the directory $RPM_TOPDIR/SRPMS/.&lt;br /&gt;
&lt;br /&gt;
=== Build the RPM package ===&lt;br /&gt;
&lt;br /&gt;
1. Build the binary package&lt;br /&gt;
 rpmbuild --rebuild codeblocks-1.0*.src.rpm&lt;br /&gt;
&lt;br /&gt;
This will create several packages in one of the architecture specific subdirectories (i386, x86_64, ppc, ...) of $RPM_TOPDIR/RPMS/.&lt;br /&gt;
&lt;br /&gt;
These are:&lt;br /&gt;
* codeblocks: main package&lt;br /&gt;
* codeblocks-contrib: contrib plugins&lt;br /&gt;
* codeblocks-devel: SDK headers&lt;br /&gt;
* codeblocks-debuginfo: stripped debug information&lt;br /&gt;
&lt;br /&gt;
=== Install the RPM package ===&lt;br /&gt;
&lt;br /&gt;
Install as root the packages you want (usually codeblocks and codeblocks-contrib) and enjoy Code::Blocks!&lt;/div&gt;</summary>
		<author><name>Afb</name></author>
	</entry>
	<entry>
		<id>https://wiki.codeblocks.org/index.php?title=Installing_Code::Blocks_from_source_on_RPM_based_distributions&amp;diff=4511</id>
		<title>Installing Code::Blocks from source on RPM based distributions</title>
		<link rel="alternate" type="text/html" href="https://wiki.codeblocks.org/index.php?title=Installing_Code::Blocks_from_source_on_RPM_based_distributions&amp;diff=4511"/>
		<updated>2007-03-26T07:50:50Z</updated>

		<summary type="html">&lt;p&gt;Afb: /* Install Code::Blocks */&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;
&lt;br /&gt;
== Install Requirements ==&lt;br /&gt;
&lt;br /&gt;
Note: Code::Blocks requires GTK+ 2.x. Older distributions might only support GTK+ 1.x.&lt;br /&gt;
&lt;br /&gt;
=== Install Development Tools ===&lt;br /&gt;
&lt;br /&gt;
This has to be installed before starting:&lt;br /&gt;
* zip&lt;br /&gt;
* update-desktop-files (only on SUSE)&lt;br /&gt;
* make&lt;br /&gt;
* gettext&lt;br /&gt;
* autoconf &amp;gt;= 2.5&lt;br /&gt;
* automake &amp;gt;= 1.7&lt;br /&gt;
* libtool &amp;gt;= 1.4&lt;br /&gt;
* m4&lt;br /&gt;
* intltool&lt;br /&gt;
* gcc-c++&lt;br /&gt;
* libstdc++-devel&lt;br /&gt;
&lt;br /&gt;
In Fedora/CentOS, this can be done with:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
su -c 'yum groupinstall &amp;quot;Development Tools&amp;quot;'&lt;br /&gt;
su -c 'yum install intltool'&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Install newer autotools versions (if needed) ====&lt;br /&gt;
&lt;br /&gt;
If you have CentOS 3 or RHEL 3, you will need to rebuild &amp;quot;automake17&amp;quot; to use instead of automake-1.6:&lt;br /&gt;
* ftp://ftp.redhat.com/pub/redhat/linux/enterprise/4/en/os/i386/SRPMS/automake17-1.7.9-5.src.rpm&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
rpmbuild --rebuild automake17-1.7.9-5.src.rpm&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then you need to invoke bootstrap like this, both on the commandline and in codeblocks.spec:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
AUTOMAKE=automake-1.7 ACLOCAL=aclocal-1.7 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;
=== Setup RPM environment ===&lt;br /&gt;
&lt;br /&gt;
This has to be installed before starting:&lt;br /&gt;
* rpm-build&lt;br /&gt;
&lt;br /&gt;
The top work directory for RPM varies between distributions and setups, but you can find your RPM top dir by setting a variable like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
RPM_TOPDIR=`rpm --eval %{_topdir}`&lt;br /&gt;
echo $RPM_TOPDIR&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Non-root rpmbuild environment (recommended) ====&lt;br /&gt;
&lt;br /&gt;
It is recommended that you don't use the root account to build packages, here is how you set up a minimal user build environment:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd&lt;br /&gt;
mkdir rpm&lt;br /&gt;
echo &amp;quot;%_topdir $HOME/rpm&amp;quot; &amp;gt;&amp;gt; .rpmmacros&lt;br /&gt;
mkdir /tmp/$USER/rpm&lt;br /&gt;
echo &amp;quot;%_tmppath /tmp/$USER/rpm&amp;quot; &amp;gt;&amp;gt; .rpmmacros&lt;br /&gt;
cd rpm&lt;br /&gt;
mkdir SPECS SOURCES BUILD RPMS SRPMS&lt;br /&gt;
RPM_TOPDIR=`rpm --eval %{_topdir}`&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can now build packages without being root (assuming that the spec files are correct). You will still need root access to install.&lt;br /&gt;
&lt;br /&gt;
=== Install wxWidgets 2.6.x ===&lt;br /&gt;
&lt;br /&gt;
The build requirements in the source RPM are set to a minimum. So it isn't checked whether wxGTK is installed or not. So you have to take a look at it yourself.&lt;br /&gt;
&lt;br /&gt;
This has to be installed:&lt;br /&gt;
# wxGTK &amp;gt;= 2.6.0 and its devel package (see [http://wxwidgets.org wxwidgets.org])&lt;br /&gt;
# wxGTK-xrc and its devel package (in some distributions included in the packages of point 1)&lt;br /&gt;
&lt;br /&gt;
In later Fedora, this can be done with:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
su -c 'yum install wxGTK-devel'&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Build the wxGTK RPM from source (if needed) ====&lt;br /&gt;
&lt;br /&gt;
TODO&lt;br /&gt;
&lt;br /&gt;
* http://prdownloads.sourceforge.net/wxwindows/wxGTK-2.6.3.tar.gz&lt;br /&gt;
* ftp://biolpc22.york.ac.uk/pub/2.6.3/wxWidgets-2.6.3-Patch-2.tar.gz&lt;br /&gt;
* http://www.algonet.se/~afb/wx/wxGTK.spec&lt;br /&gt;
&lt;br /&gt;
RPMS&lt;br /&gt;
&lt;br /&gt;
* wx-base-unicode-2.6.3.0.2-1.i386.rpm&lt;br /&gt;
* wx-base-unicode-devel-2.6.3.0.2-1.i386.rpm&lt;br /&gt;
* wx-gtk2-unicode-2.6.3.0.2-1.i386.rpm&lt;br /&gt;
* wx-gtk2-unicode-devel-2.6.3.0.2-1.i386.rpm&lt;br /&gt;
* wx-gtk2-unicode-gl-2.6.3.0.2-1.i386.rpm&lt;br /&gt;
* wx-gtk2-unicode-contrib-2.6.3.0.2-1.i386.rpm&lt;br /&gt;
* wx-gtk2-unicode-contrib-devel-2.6.3.0.2-1.i386.rpm&lt;br /&gt;
* wx-gtk2-unicode-debuginfo-2.6.3.0.2-1.i386.rpm&lt;br /&gt;
* wx-i18n-2.6.3.0.2-1.i386.rpm&lt;br /&gt;
&lt;br /&gt;
=== Install Subversion client ===&lt;br /&gt;
&lt;br /&gt;
This has to be installed before starting:&lt;br /&gt;
* subversion &amp;gt;= 1.4.0, (see [http://subversion.tigris.org subversion.tigris.org])&lt;br /&gt;
&lt;br /&gt;
Binary packages for Red Hat Linux 9, Fedora Core 1, CentOS 3, CentOS 4 at:&lt;br /&gt;
&lt;br /&gt;
http://the.earth.li/pub/subversion/summersoft.fay.ar.us/pub/subversion/latest/&lt;br /&gt;
&lt;br /&gt;
In later Fedora, this can be done with:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
su -c 'yum install subversion'&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Build Subversion RPM from source (if needed) ====&lt;br /&gt;
&lt;br /&gt;
TODO&lt;br /&gt;
&lt;br /&gt;
* http://subversion.tigris.org/downloads/subversion-1.4.2.tar.gz&lt;br /&gt;
* packages/rpm/rhel-3/subversion.spec (CentOS 3)&lt;br /&gt;
* packages/rpm/rhel-4/subversion.spec (CentOS 4)&lt;br /&gt;
&lt;br /&gt;
RPMS&lt;br /&gt;
&lt;br /&gt;
* subversion-1.4.2-1.i386.rpm&lt;br /&gt;
* subversion-devel-1.4.2-1.i386.rpm&lt;br /&gt;
* subversion-perl-1.4.2-1.i386.rpm&lt;br /&gt;
* subversion-python-1.4.2-1.i386.rpm&lt;br /&gt;
* subversion-tools-1.4.2-1.i386.rpm&lt;br /&gt;
* subversion-debuginfo-1.4.2-1.i386.rpm&lt;br /&gt;
&lt;br /&gt;
== Install Code::Blocks ==&lt;br /&gt;
&lt;br /&gt;
=== Download the Source RPM ===&lt;br /&gt;
&lt;br /&gt;
1. Download the Source RPM from [https://www.codeblocks.org/downloads.shtml www.codeblocks.org/downloads.shtml]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;Note: the SRPM is currently unavailable (latest version being the old RC2), use SVN:&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Prepare SRPM package from SVN (if needed) ====&lt;br /&gt;
&lt;br /&gt;
1. You need to get the latest sources from SVN [https://www.codeblocks.org/source_code.shtml www.codeblocks.org/source_code.shtml]&lt;br /&gt;
&lt;br /&gt;
 svn checkout svn://svn.berlios.de/codeblocks/trunk&lt;br /&gt;
&lt;br /&gt;
2. go into ''trunk'', if you haven't already done it.&lt;br /&gt;
&lt;br /&gt;
3. run these three commands in this order&lt;br /&gt;
 ./bootstrap&lt;br /&gt;
 ./configure --enable-contrib&lt;br /&gt;
 make dist&lt;br /&gt;
the last one will create a .tar.gz archive that contains the sources.&lt;br /&gt;
&lt;br /&gt;
4. copy the archive to the directory $RPM_TOPDIR/SOURCES &lt;br /&gt;
 sudo mv codeblocks-trunk-r$REVISION.tar.gz $RPM_TOPDIR/SOURCES&lt;br /&gt;
&lt;br /&gt;
5. build the source RPM, or copy spec to $RPM_TOPDIR/SPECS&lt;br /&gt;
 rpmbuild -bs codeblocks.spec&lt;br /&gt;
&lt;br /&gt;
This will create a source package in the directory $RPM_TOPDIR/SRPMS/.&lt;br /&gt;
&lt;br /&gt;
=== Build the RPM package ===&lt;br /&gt;
&lt;br /&gt;
1. Build the binary package&lt;br /&gt;
 rpmbuild --rebuild codeblocks-1.0*.src.rpm&lt;br /&gt;
&lt;br /&gt;
This will create several packages in one of the architecture specific subdirectories (i386, x86_64, ppc, ...) of $RPM_TOPDIR/RPMS/.&lt;br /&gt;
&lt;br /&gt;
These are:&lt;br /&gt;
* codeblocks: main package&lt;br /&gt;
* codeblocks-contrib: contrib plugins&lt;br /&gt;
* codeblocks-devel: SDK headers&lt;br /&gt;
* codeblocks-debuginfo: stripped debug information&lt;br /&gt;
&lt;br /&gt;
=== Install the RPM package ===&lt;br /&gt;
&lt;br /&gt;
Install as root the packages you want (usually codeblocks and codeblocks-contrib) and enjoy Code::Blocks!&lt;/div&gt;</summary>
		<author><name>Afb</name></author>
	</entry>
	<entry>
		<id>https://wiki.codeblocks.org/index.php?title=Installing_Code::Blocks_from_source_on_Mac_OS_X&amp;diff=4510</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=4510"/>
		<updated>2007-03-22T10:57:10Z</updated>

		<summary type="html">&lt;p&gt;Afb: /* Install with DarwinPorts */&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://darwinports.opendarwin.org DarwinPorts],&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 DarwinPorts 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:&lt;br /&gt;
&lt;br /&gt;
http://developer.apple.com/tools/&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. For Mac OS X 10.1-10.2, the latest Dev Tools.&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 /usr/local/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;
=== 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/2.6/wx_unicode.html#unicodeandansi&lt;br /&gt;
&lt;br /&gt;
== Build wxWidgets 2.6 ==&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/#previous_stable&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;
For Intel Macintosh, you will need this additional patch:&lt;br /&gt;
&lt;br /&gt;
* http://www.algonet.se/~afb/wx/wxWidgets-killpoll.patch&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
patch -p1 -i wxWidgets-killpoll.patch&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note: this patch is not needed for wxWidgets 2.6.4 and later&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.3+)&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.3.1.dylib&lt;br /&gt;
/usr/local/lib/libwx_macu-2.6.0.3.1.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.3.1.dylib&lt;br /&gt;
/Library/Frameworks/wx.framework/Versions/2.6/libwx_macu-2.6.0.3.1.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 necessary patches, see below under &amp;quot;DarwinPorts&amp;quot;, or:&lt;br /&gt;
&lt;br /&gt;
http://developer.berlios.de/patch/?group_id=5358&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
patch -p0 -i codeblocks-rev3656_pluginslib.patch&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You might need to convert the line endings from DOS to Unix first.&lt;br /&gt;
&lt;br /&gt;
Hopefully most of these should be merged upstream, before release:&lt;br /&gt;
&lt;br /&gt;
* http://developer.berlios.de/patch/?func=detailpatch&amp;amp;patch_id=1395&amp;amp;group_id=5358&lt;br /&gt;
&lt;br /&gt;
(when they are, the above stand-alone patches might fail to apply)&lt;br /&gt;
&lt;br /&gt;
=== Bootstrap with Autotools ===&lt;br /&gt;
&lt;br /&gt;
You need to use the newer version of automake, for the &amp;quot;bootstrap&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
AUTOMAKE=automake-1.7 ACLOCAL=aclocal-1.7 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;
See above for how to compile and install automake-1.7 on Mac OS X.&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;
DarwinPorts: &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;
== 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 DarwinPorts ==&lt;br /&gt;
&lt;br /&gt;
=== Set up a local DarwinPorts tree ===&lt;br /&gt;
&lt;br /&gt;
Set up a local DarwinPorts tree (usually in &amp;lt;tt&amp;gt;~/dports&amp;lt;/tt&amp;gt; - set up in &amp;lt;tt&amp;gt;/opt/local/etc/ports/sources.conf&amp;lt;/tt&amp;gt;, create the directory if needed), as e.g. &amp;lt;tt&amp;gt;dports/devel/codeblocks/Portfile&amp;lt;/tt&amp;gt; and download any helper files to e.g. &amp;lt;tt&amp;gt;dports/devel/codeblocks/files&amp;lt;/tt&amp;gt;. (then do a chdir to &amp;lt;tt&amp;gt;dports&amp;lt;/tt&amp;gt;, and run the &amp;lt;tt&amp;gt;/opt/local/bin/portindex&amp;lt;/tt&amp;gt; command)&lt;br /&gt;
&lt;br /&gt;
The tree might look something like:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dports&lt;br /&gt;
|-- PortIndex&lt;br /&gt;
|-- devel&lt;br /&gt;
|   `-- codeblocks&lt;br /&gt;
|       |-- Portfile&lt;br /&gt;
|       `-- files&lt;br /&gt;
|           |-- codeblocks.plist&lt;br /&gt;
|           |-- codeblocks.sh.in&lt;br /&gt;
|           |-- codeblocks-rev3656_pluginslib.patch&lt;br /&gt;
|           |-- codeblocks-wxauigtk.patch&lt;br /&gt;
|           `-- dos2unix.sh&lt;br /&gt;
`-- graphics&lt;br /&gt;
   |-- wxGTK&lt;br /&gt;
   |    |-- Portfile&lt;br /&gt;
   |    `-- files&lt;br /&gt;
   |       `-- patch-soundsdl.diff&lt;br /&gt;
   `-- wxMac&lt;br /&gt;
        |-- Portfile&lt;br /&gt;
        `-- files&lt;br /&gt;
            `-- patch-polling.diff&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Install wxWidgets ===&lt;br /&gt;
&lt;br /&gt;
You will need these custom wxWidgets ports:&lt;br /&gt;
&lt;br /&gt;
* http://www.algonet.se/~afb/wx/wxMac.Portfile&lt;br /&gt;
* http://www.algonet.se/~afb/wx/patch-polling.diff&lt;br /&gt;
* http://www.algonet.se/~afb/wx/wxGTK.Portfile&lt;br /&gt;
* http://www.algonet.se/~afb/wx/patch-soundsdl.diff&lt;br /&gt;
&lt;br /&gt;
The optional wxWidgets file go in &amp;lt;tt&amp;gt;graphics/wx{Mac,GTK}/Portfile&amp;lt;/tt&amp;gt;. 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 [http://trac.macports.org/projects/macports/browser/trunk/dports/graphics/wxWidgets wxWidgets] port is now upgraded to 2.8, and the alternative [http://trac.macports.org/projects/macports/browser/trunk/dports/graphics/wxWidgets26 wxWidgets26] port doesn't yet have all the needed patches)&lt;br /&gt;
&lt;br /&gt;
After the set up has been done, you can install it with:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo port install wxMac&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;
To build and install Code::Blocks, you will need:&lt;br /&gt;
&lt;br /&gt;
* http://www.algonet.se/~afb/wx/codeblocks.Portfile&lt;br /&gt;
&lt;br /&gt;
The following need to go in the &amp;quot;files&amp;quot; directory:&lt;br /&gt;
&lt;br /&gt;
* http://www.algonet.se/~afb/wx/codeblocks.plist&lt;br /&gt;
* http://www.algonet.se/~afb/wx/codeblocks.sh.in&lt;br /&gt;
* http://www.algonet.se/~afb/wx/dos2unix.sh&lt;br /&gt;
* http://www.algonet.se/~afb/wx/codeblocks-rev3656_pluginslib.patch&lt;br /&gt;
* http://www.algonet.se/~afb/wx/codeblocks-wxauigtk.patch&lt;br /&gt;
&lt;br /&gt;
After the set up has been done, you can install it with:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo port install codeblocks&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 -macosx+puredarwin&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&lt;br /&gt;
---&amp;gt;  Verifying checksum(s) for codeblocks&lt;br /&gt;
---&amp;gt;  Extracting codeblocks&lt;br /&gt;
---&amp;gt;  Applying patches to codeblocks&lt;br /&gt;
---&amp;gt;  Configuring codeblocks&lt;br /&gt;
---&amp;gt;  Building codeblocks with target all&lt;br /&gt;
---&amp;gt;  Staging codeblocks into destroot&lt;br /&gt;
---&amp;gt;  Packaging tgz archive for codeblocks 1.0_0+macosx&lt;br /&gt;
---&amp;gt;  Installing codeblocks 1.0_0+macosx&lt;br /&gt;
---&amp;gt;  Activating codeblocks 1.0_0+macosx&lt;br /&gt;
---&amp;gt;  Cleaning codeblocks&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&lt;br /&gt;
sudo port clean codeblocks&lt;br /&gt;
sudo port install codeblocks&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;+macosx&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/DarwinPorts/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;DarwinPorts&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 --prefix=/opt/local&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Running &amp;lt;tt&amp;gt;+puredarwin&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 --prefix=/opt/local&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There is also a wxGTK startup command in &amp;quot;DarwinPorts&amp;quot;,&lt;br /&gt;
that will first start up X11.app and then launch C::B:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
open /Applications/DarwinPorts/CodeBlocks.command&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Afb</name></author>
	</entry>
	<entry>
		<id>https://wiki.codeblocks.org/index.php?title=Installing_Code::Blocks_from_source_on_Mac_OS_X&amp;diff=4509</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=4509"/>
		<updated>2007-03-22T10:37:15Z</updated>

		<summary type="html">&lt;p&gt;Afb: /* Mono Fix */&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://darwinports.opendarwin.org DarwinPorts],&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 DarwinPorts 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:&lt;br /&gt;
&lt;br /&gt;
http://developer.apple.com/tools/&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. For Mac OS X 10.1-10.2, the latest Dev Tools.&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 /usr/local/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;
=== 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/2.6/wx_unicode.html#unicodeandansi&lt;br /&gt;
&lt;br /&gt;
== Build wxWidgets 2.6 ==&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/#previous_stable&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;
For Intel Macintosh, you will need this additional patch:&lt;br /&gt;
&lt;br /&gt;
* http://www.algonet.se/~afb/wx/wxWidgets-killpoll.patch&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
patch -p1 -i wxWidgets-killpoll.patch&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note: this patch is not needed for wxWidgets 2.6.4 and later&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.3+)&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.3.1.dylib&lt;br /&gt;
/usr/local/lib/libwx_macu-2.6.0.3.1.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.3.1.dylib&lt;br /&gt;
/Library/Frameworks/wx.framework/Versions/2.6/libwx_macu-2.6.0.3.1.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 necessary patches, see below under &amp;quot;DarwinPorts&amp;quot;, or:&lt;br /&gt;
&lt;br /&gt;
http://developer.berlios.de/patch/?group_id=5358&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
patch -p0 -i codeblocks-rev3656_pluginslib.patch&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You might need to convert the line endings from DOS to Unix first.&lt;br /&gt;
&lt;br /&gt;
Hopefully most of these should be merged upstream, before release:&lt;br /&gt;
&lt;br /&gt;
* http://developer.berlios.de/patch/?func=detailpatch&amp;amp;patch_id=1395&amp;amp;group_id=5358&lt;br /&gt;
&lt;br /&gt;
(when they are, the above stand-alone patches might fail to apply)&lt;br /&gt;
&lt;br /&gt;
=== Bootstrap with Autotools ===&lt;br /&gt;
&lt;br /&gt;
You need to use the newer version of automake, for the &amp;quot;bootstrap&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
AUTOMAKE=automake-1.7 ACLOCAL=aclocal-1.7 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;
See above for how to compile and install automake-1.7 on Mac OS X.&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;
DarwinPorts: &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;
== 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 DarwinPorts ==&lt;br /&gt;
&lt;br /&gt;
To build and install Code::Blocks, you will need:&lt;br /&gt;
&lt;br /&gt;
* http://www.algonet.se/~afb/wx/codeblocks.Portfile&lt;br /&gt;
&lt;br /&gt;
The following need to go in the &amp;quot;files&amp;quot; directory:&lt;br /&gt;
&lt;br /&gt;
* http://www.algonet.se/~afb/wx/codeblocks.plist&lt;br /&gt;
* http://www.algonet.se/~afb/wx/codeblocks.sh.in&lt;br /&gt;
* http://www.algonet.se/~afb/wx/dos2unix.sh&lt;br /&gt;
* http://www.algonet.se/~afb/wx/codeblocks-rev3656_pluginslib.patch&lt;br /&gt;
* http://www.algonet.se/~afb/wx/codeblocks-wxauigtk.patch&lt;br /&gt;
&lt;br /&gt;
Put the Portfile in your local DarwinPorts tree (usually in &amp;lt;tt&amp;gt;~/dports&amp;lt;/tt&amp;gt; - set up in &amp;lt;tt&amp;gt;/opt/local/etc/ports/sources.conf&amp;lt;/tt&amp;gt;, create the directory if needed), as &amp;lt;tt&amp;gt;dports/devel/codeblocks/Portfile&amp;lt;/tt&amp;gt; and download the helper files to &amp;lt;tt&amp;gt;dports/devel/codeblocks/files&amp;lt;/tt&amp;gt;. (then do a chdir to &amp;lt;tt&amp;gt;dports&amp;lt;/tt&amp;gt;, and run the &amp;lt;tt&amp;gt;/opt/local/bin/portindex&amp;lt;/tt&amp;gt; command)&lt;br /&gt;
&lt;br /&gt;
You will also need these custom wxWidgets ports:&lt;br /&gt;
&lt;br /&gt;
* http://www.algonet.se/~afb/wx/wxMac.Portfile&lt;br /&gt;
* http://www.algonet.se/~afb/wx/patch-polling.diff&lt;br /&gt;
* http://www.algonet.se/~afb/wx/wxGTK.Portfile&lt;br /&gt;
* http://www.algonet.se/~afb/wx/patch-soundsdl.diff&lt;br /&gt;
&lt;br /&gt;
The optional wxWidgets file go in &amp;lt;tt&amp;gt;graphics/wx{Mac,GTK}/Portfile&amp;lt;/tt&amp;gt;. 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 [http://trac.macports.org/projects/macports/browser/trunk/dports/graphics/wxWidgets wxWidgets] port is now upgraded to 2.8, and the alternative [http://trac.macports.org/projects/macports/browser/trunk/dports/graphics/wxWidgets26 wxWidgets26] port doesn't yet have all the needed patches)&lt;br /&gt;
&lt;br /&gt;
After that set up has been done, you can install it with:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo port install codeblocks&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 -macosx+puredarwin&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&lt;br /&gt;
---&amp;gt;  Verifying checksum(s) for codeblocks&lt;br /&gt;
---&amp;gt;  Extracting codeblocks&lt;br /&gt;
---&amp;gt;  Applying patches to codeblocks&lt;br /&gt;
---&amp;gt;  Configuring codeblocks&lt;br /&gt;
---&amp;gt;  Building codeblocks with target all&lt;br /&gt;
---&amp;gt;  Staging codeblocks into destroot&lt;br /&gt;
---&amp;gt;  Packaging tgz archive for codeblocks 1.0_0+macosx&lt;br /&gt;
---&amp;gt;  Installing codeblocks 1.0_0+macosx&lt;br /&gt;
---&amp;gt;  Activating codeblocks 1.0_0+macosx&lt;br /&gt;
---&amp;gt;  Cleaning codeblocks&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&lt;br /&gt;
sudo port clean codeblocks&lt;br /&gt;
sudo port install codeblocks&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;+macosx&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/DarwinPorts/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;DarwinPorts&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 --prefix=/opt/local&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Running &amp;lt;tt&amp;gt;+puredarwin&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 --prefix=/opt/local&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There is also a wxGTK startup command in &amp;quot;DarwinPorts&amp;quot;,&lt;br /&gt;
that will first start up X11.app and then launch C::B:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
open /Applications/DarwinPorts/CodeBlocks.command&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Afb</name></author>
	</entry>
	<entry>
		<id>https://wiki.codeblocks.org/index.php?title=Installing_Code::Blocks_from_source_on_Mac_OS_X&amp;diff=4508</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=4508"/>
		<updated>2007-03-22T10:17:04Z</updated>

		<summary type="html">&lt;p&gt;Afb: /* FYI: Darwin vs. Mac OS X */&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://darwinports.opendarwin.org DarwinPorts],&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 DarwinPorts 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:&lt;br /&gt;
&lt;br /&gt;
http://developer.apple.com/tools/&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. For Mac OS X 10.1-10.2, the latest Dev Tools.&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 /usr/local/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;
=== 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/2.6/wx_unicode.html#unicodeandansi&lt;br /&gt;
&lt;br /&gt;
== Build wxWidgets 2.6 ==&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/#previous_stable&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;
For Intel Macintosh, you will need this additional patch:&lt;br /&gt;
&lt;br /&gt;
* http://www.algonet.se/~afb/wx/wxWidgets-killpoll.patch&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
patch -p1 -i wxWidgets-killpoll.patch&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note: this patch is not needed for wxWidgets 2.6.4 and later&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.3+)&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.3.1.dylib&lt;br /&gt;
/usr/local/lib/libwx_macu-2.6.0.3.1.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.3.1.dylib&lt;br /&gt;
/Library/Frameworks/wx.framework/Versions/2.6/libwx_macu-2.6.0.3.1.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 necessary patches, see below under &amp;quot;DarwinPorts&amp;quot;, or:&lt;br /&gt;
&lt;br /&gt;
http://developer.berlios.de/patch/?group_id=5358&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
patch -p0 -i codeblocks-rev3656_pluginslib.patch&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You might need to convert the line endings from DOS to Unix first.&lt;br /&gt;
&lt;br /&gt;
Hopefully most of these should be merged upstream, before release:&lt;br /&gt;
&lt;br /&gt;
* http://developer.berlios.de/patch/?func=detailpatch&amp;amp;patch_id=1395&amp;amp;group_id=5358&lt;br /&gt;
&lt;br /&gt;
(when they are, the above stand-alone patches might fail to apply)&lt;br /&gt;
&lt;br /&gt;
=== Bootstrap with Autotools ===&lt;br /&gt;
&lt;br /&gt;
You need to use the newer version of automake, for the &amp;quot;bootstrap&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
AUTOMAKE=automake-1.7 ACLOCAL=aclocal-1.7 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;
See above for how to compile and install automake-1.7 on Mac OS X.&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; 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;
DarwinPorts: &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;
== 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 DarwinPorts ==&lt;br /&gt;
&lt;br /&gt;
To build and install Code::Blocks, you will need:&lt;br /&gt;
&lt;br /&gt;
* http://www.algonet.se/~afb/wx/codeblocks.Portfile&lt;br /&gt;
&lt;br /&gt;
The following need to go in the &amp;quot;files&amp;quot; directory:&lt;br /&gt;
&lt;br /&gt;
* http://www.algonet.se/~afb/wx/codeblocks.plist&lt;br /&gt;
* http://www.algonet.se/~afb/wx/codeblocks.sh.in&lt;br /&gt;
* http://www.algonet.se/~afb/wx/dos2unix.sh&lt;br /&gt;
* http://www.algonet.se/~afb/wx/codeblocks-rev3656_pluginslib.patch&lt;br /&gt;
* http://www.algonet.se/~afb/wx/codeblocks-wxauigtk.patch&lt;br /&gt;
&lt;br /&gt;
Put the Portfile in your local DarwinPorts tree (usually in &amp;lt;tt&amp;gt;~/dports&amp;lt;/tt&amp;gt; - set up in &amp;lt;tt&amp;gt;/opt/local/etc/ports/sources.conf&amp;lt;/tt&amp;gt;, create the directory if needed), as &amp;lt;tt&amp;gt;dports/devel/codeblocks/Portfile&amp;lt;/tt&amp;gt; and download the helper files to &amp;lt;tt&amp;gt;dports/devel/codeblocks/files&amp;lt;/tt&amp;gt;. (then do a chdir to &amp;lt;tt&amp;gt;dports&amp;lt;/tt&amp;gt;, and run the &amp;lt;tt&amp;gt;/opt/local/bin/portindex&amp;lt;/tt&amp;gt; command)&lt;br /&gt;
&lt;br /&gt;
You will also need these custom wxWidgets ports:&lt;br /&gt;
&lt;br /&gt;
* http://www.algonet.se/~afb/wx/wxMac.Portfile&lt;br /&gt;
* http://www.algonet.se/~afb/wx/patch-polling.diff&lt;br /&gt;
* http://www.algonet.se/~afb/wx/wxGTK.Portfile&lt;br /&gt;
* http://www.algonet.se/~afb/wx/patch-soundsdl.diff&lt;br /&gt;
&lt;br /&gt;
The optional wxWidgets file go in &amp;lt;tt&amp;gt;graphics/wx{Mac,GTK}/Portfile&amp;lt;/tt&amp;gt;. 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 [http://trac.macports.org/projects/macports/browser/trunk/dports/graphics/wxWidgets wxWidgets] port is now upgraded to 2.8, and the alternative [http://trac.macports.org/projects/macports/browser/trunk/dports/graphics/wxWidgets26 wxWidgets26] port doesn't yet have all the needed patches)&lt;br /&gt;
&lt;br /&gt;
After that set up has been done, you can install it with:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo port install codeblocks&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 -macosx+puredarwin&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&lt;br /&gt;
---&amp;gt;  Verifying checksum(s) for codeblocks&lt;br /&gt;
---&amp;gt;  Extracting codeblocks&lt;br /&gt;
---&amp;gt;  Applying patches to codeblocks&lt;br /&gt;
---&amp;gt;  Configuring codeblocks&lt;br /&gt;
---&amp;gt;  Building codeblocks with target all&lt;br /&gt;
---&amp;gt;  Staging codeblocks into destroot&lt;br /&gt;
---&amp;gt;  Packaging tgz archive for codeblocks 1.0_0+macosx&lt;br /&gt;
---&amp;gt;  Installing codeblocks 1.0_0+macosx&lt;br /&gt;
---&amp;gt;  Activating codeblocks 1.0_0+macosx&lt;br /&gt;
---&amp;gt;  Cleaning codeblocks&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&lt;br /&gt;
sudo port clean codeblocks&lt;br /&gt;
sudo port install codeblocks&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;+macosx&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/DarwinPorts/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;DarwinPorts&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 --prefix=/opt/local&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Running &amp;lt;tt&amp;gt;+puredarwin&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 --prefix=/opt/local&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There is also a wxGTK startup command in &amp;quot;DarwinPorts&amp;quot;,&lt;br /&gt;
that will first start up X11.app and then launch C::B:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
open /Applications/DarwinPorts/CodeBlocks.command&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Afb</name></author>
	</entry>
	<entry>
		<id>https://wiki.codeblocks.org/index.php?title=Installing_Code::Blocks_from_source_on_Mac_OS_X&amp;diff=4507</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=4507"/>
		<updated>2007-03-22T10:14:51Z</updated>

		<summary type="html">&lt;p&gt;Afb: /* Install into Destination */&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://darwinports.opendarwin.org DarwinPorts],&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 DarwinPorts 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:&lt;br /&gt;
&lt;br /&gt;
http://developer.apple.com/tools/&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. For Mac OS X 10.1-10.2, the latest Dev Tools.&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 /usr/local/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;
=== 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/2.6/wx_unicode.html#unicodeandansi&lt;br /&gt;
&lt;br /&gt;
== Build wxWidgets 2.6 ==&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/#previous_stable&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;
For Intel Macintosh, you will need this additional patch:&lt;br /&gt;
&lt;br /&gt;
* http://www.algonet.se/~afb/wx/wxWidgets-killpoll.patch&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
patch -p1 -i wxWidgets-killpoll.patch&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note: this patch is not needed for wxWidgets 2.6.4 and later&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.3+)&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.3.1.dylib&lt;br /&gt;
/usr/local/lib/libwx_macu-2.6.0.3.1.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.3.1.dylib&lt;br /&gt;
/Library/Frameworks/wx.framework/Versions/2.6/libwx_macu-2.6.0.3.1.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 necessary patches, see below under &amp;quot;DarwinPorts&amp;quot;, or:&lt;br /&gt;
&lt;br /&gt;
http://developer.berlios.de/patch/?group_id=5358&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
patch -p0 -i codeblocks-rev3656_pluginslib.patch&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You might need to convert the line endings from DOS to Unix first.&lt;br /&gt;
&lt;br /&gt;
Hopefully most of these should be merged upstream, before release:&lt;br /&gt;
&lt;br /&gt;
* http://developer.berlios.de/patch/?func=detailpatch&amp;amp;patch_id=1395&amp;amp;group_id=5358&lt;br /&gt;
&lt;br /&gt;
(when they are, the above stand-alone patches might fail to apply)&lt;br /&gt;
&lt;br /&gt;
=== Bootstrap with Autotools ===&lt;br /&gt;
&lt;br /&gt;
You need to use the newer version of automake, for the &amp;quot;bootstrap&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
AUTOMAKE=automake-1.7 ACLOCAL=aclocal-1.7 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;
See above for how to compile and install automake-1.7 on Mac OS X.&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; 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;
DarwinPorts: &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;
== 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;
(that is: Darwin using X11 instead of Aqua for the user interface)&lt;br /&gt;
&lt;br /&gt;
== Install with DarwinPorts ==&lt;br /&gt;
&lt;br /&gt;
To build and install Code::Blocks, you will need:&lt;br /&gt;
&lt;br /&gt;
* http://www.algonet.se/~afb/wx/codeblocks.Portfile&lt;br /&gt;
&lt;br /&gt;
The following need to go in the &amp;quot;files&amp;quot; directory:&lt;br /&gt;
&lt;br /&gt;
* http://www.algonet.se/~afb/wx/codeblocks.plist&lt;br /&gt;
* http://www.algonet.se/~afb/wx/codeblocks.sh.in&lt;br /&gt;
* http://www.algonet.se/~afb/wx/dos2unix.sh&lt;br /&gt;
* http://www.algonet.se/~afb/wx/codeblocks-rev3656_pluginslib.patch&lt;br /&gt;
* http://www.algonet.se/~afb/wx/codeblocks-wxauigtk.patch&lt;br /&gt;
&lt;br /&gt;
Put the Portfile in your local DarwinPorts tree (usually in &amp;lt;tt&amp;gt;~/dports&amp;lt;/tt&amp;gt; - set up in &amp;lt;tt&amp;gt;/opt/local/etc/ports/sources.conf&amp;lt;/tt&amp;gt;, create the directory if needed), as &amp;lt;tt&amp;gt;dports/devel/codeblocks/Portfile&amp;lt;/tt&amp;gt; and download the helper files to &amp;lt;tt&amp;gt;dports/devel/codeblocks/files&amp;lt;/tt&amp;gt;. (then do a chdir to &amp;lt;tt&amp;gt;dports&amp;lt;/tt&amp;gt;, and run the &amp;lt;tt&amp;gt;/opt/local/bin/portindex&amp;lt;/tt&amp;gt; command)&lt;br /&gt;
&lt;br /&gt;
You will also need these custom wxWidgets ports:&lt;br /&gt;
&lt;br /&gt;
* http://www.algonet.se/~afb/wx/wxMac.Portfile&lt;br /&gt;
* http://www.algonet.se/~afb/wx/patch-polling.diff&lt;br /&gt;
* http://www.algonet.se/~afb/wx/wxGTK.Portfile&lt;br /&gt;
* http://www.algonet.se/~afb/wx/patch-soundsdl.diff&lt;br /&gt;
&lt;br /&gt;
The optional wxWidgets file go in &amp;lt;tt&amp;gt;graphics/wx{Mac,GTK}/Portfile&amp;lt;/tt&amp;gt;. 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 [http://trac.macports.org/projects/macports/browser/trunk/dports/graphics/wxWidgets wxWidgets] port is now upgraded to 2.8, and the alternative [http://trac.macports.org/projects/macports/browser/trunk/dports/graphics/wxWidgets26 wxWidgets26] port doesn't yet have all the needed patches)&lt;br /&gt;
&lt;br /&gt;
After that set up has been done, you can install it with:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo port install codeblocks&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 -macosx+puredarwin&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&lt;br /&gt;
---&amp;gt;  Verifying checksum(s) for codeblocks&lt;br /&gt;
---&amp;gt;  Extracting codeblocks&lt;br /&gt;
---&amp;gt;  Applying patches to codeblocks&lt;br /&gt;
---&amp;gt;  Configuring codeblocks&lt;br /&gt;
---&amp;gt;  Building codeblocks with target all&lt;br /&gt;
---&amp;gt;  Staging codeblocks into destroot&lt;br /&gt;
---&amp;gt;  Packaging tgz archive for codeblocks 1.0_0+macosx&lt;br /&gt;
---&amp;gt;  Installing codeblocks 1.0_0+macosx&lt;br /&gt;
---&amp;gt;  Activating codeblocks 1.0_0+macosx&lt;br /&gt;
---&amp;gt;  Cleaning codeblocks&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&lt;br /&gt;
sudo port clean codeblocks&lt;br /&gt;
sudo port install codeblocks&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;+macosx&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/DarwinPorts/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;DarwinPorts&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 --prefix=/opt/local&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Running &amp;lt;tt&amp;gt;+puredarwin&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 --prefix=/opt/local&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There is also a wxGTK startup command in &amp;quot;DarwinPorts&amp;quot;,&lt;br /&gt;
that will first start up X11.app and then launch C::B:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
open /Applications/DarwinPorts/CodeBlocks.command&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Afb</name></author>
	</entry>
	<entry>
		<id>https://wiki.codeblocks.org/index.php?title=Installing_Code::Blocks_from_source_on_Mac_OS_X&amp;diff=4506</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=4506"/>
		<updated>2007-03-22T10:13:51Z</updated>

		<summary type="html">&lt;p&gt;Afb: /* (GNU) Make */&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://darwinports.opendarwin.org DarwinPorts],&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 DarwinPorts 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:&lt;br /&gt;
&lt;br /&gt;
http://developer.apple.com/tools/&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. For Mac OS X 10.1-10.2, the latest Dev Tools.&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 /usr/local/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;
=== 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/2.6/wx_unicode.html#unicodeandansi&lt;br /&gt;
&lt;br /&gt;
== Build wxWidgets 2.6 ==&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/#previous_stable&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;
For Intel Macintosh, you will need this additional patch:&lt;br /&gt;
&lt;br /&gt;
* http://www.algonet.se/~afb/wx/wxWidgets-killpoll.patch&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
patch -p1 -i wxWidgets-killpoll.patch&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note: this patch is not needed for wxWidgets 2.6.4 and later&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.3+)&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.3.1.dylib&lt;br /&gt;
/usr/local/lib/libwx_macu-2.6.0.3.1.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.3.1.dylib&lt;br /&gt;
/Library/Frameworks/wx.framework/Versions/2.6/libwx_macu-2.6.0.3.1.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 necessary patches, see below under &amp;quot;DarwinPorts&amp;quot;, or:&lt;br /&gt;
&lt;br /&gt;
http://developer.berlios.de/patch/?group_id=5358&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
patch -p0 -i codeblocks-rev3656_pluginslib.patch&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You might need to convert the line endings from DOS to Unix first.&lt;br /&gt;
&lt;br /&gt;
Hopefully most of these should be merged upstream, before release:&lt;br /&gt;
&lt;br /&gt;
* http://developer.berlios.de/patch/?func=detailpatch&amp;amp;patch_id=1395&amp;amp;group_id=5358&lt;br /&gt;
&lt;br /&gt;
(when they are, the above stand-alone patches might fail to apply)&lt;br /&gt;
&lt;br /&gt;
=== Bootstrap with Autotools ===&lt;br /&gt;
&lt;br /&gt;
You need to use the newer version of automake, for the &amp;quot;bootstrap&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
AUTOMAKE=automake-1.7 ACLOCAL=aclocal-1.7 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;
See above for how to compile and install automake-1.7 on Mac OS X.&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; 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;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;
DarwinPorts: &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;
== 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;
(that is: Darwin using X11 instead of Aqua for the user interface)&lt;br /&gt;
&lt;br /&gt;
== Install with DarwinPorts ==&lt;br /&gt;
&lt;br /&gt;
To build and install Code::Blocks, you will need:&lt;br /&gt;
&lt;br /&gt;
* http://www.algonet.se/~afb/wx/codeblocks.Portfile&lt;br /&gt;
&lt;br /&gt;
The following need to go in the &amp;quot;files&amp;quot; directory:&lt;br /&gt;
&lt;br /&gt;
* http://www.algonet.se/~afb/wx/codeblocks.plist&lt;br /&gt;
* http://www.algonet.se/~afb/wx/codeblocks.sh.in&lt;br /&gt;
* http://www.algonet.se/~afb/wx/dos2unix.sh&lt;br /&gt;
* http://www.algonet.se/~afb/wx/codeblocks-rev3656_pluginslib.patch&lt;br /&gt;
* http://www.algonet.se/~afb/wx/codeblocks-wxauigtk.patch&lt;br /&gt;
&lt;br /&gt;
Put the Portfile in your local DarwinPorts tree (usually in &amp;lt;tt&amp;gt;~/dports&amp;lt;/tt&amp;gt; - set up in &amp;lt;tt&amp;gt;/opt/local/etc/ports/sources.conf&amp;lt;/tt&amp;gt;, create the directory if needed), as &amp;lt;tt&amp;gt;dports/devel/codeblocks/Portfile&amp;lt;/tt&amp;gt; and download the helper files to &amp;lt;tt&amp;gt;dports/devel/codeblocks/files&amp;lt;/tt&amp;gt;. (then do a chdir to &amp;lt;tt&amp;gt;dports&amp;lt;/tt&amp;gt;, and run the &amp;lt;tt&amp;gt;/opt/local/bin/portindex&amp;lt;/tt&amp;gt; command)&lt;br /&gt;
&lt;br /&gt;
You will also need these custom wxWidgets ports:&lt;br /&gt;
&lt;br /&gt;
* http://www.algonet.se/~afb/wx/wxMac.Portfile&lt;br /&gt;
* http://www.algonet.se/~afb/wx/patch-polling.diff&lt;br /&gt;
* http://www.algonet.se/~afb/wx/wxGTK.Portfile&lt;br /&gt;
* http://www.algonet.se/~afb/wx/patch-soundsdl.diff&lt;br /&gt;
&lt;br /&gt;
The optional wxWidgets file go in &amp;lt;tt&amp;gt;graphics/wx{Mac,GTK}/Portfile&amp;lt;/tt&amp;gt;. 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 [http://trac.macports.org/projects/macports/browser/trunk/dports/graphics/wxWidgets wxWidgets] port is now upgraded to 2.8, and the alternative [http://trac.macports.org/projects/macports/browser/trunk/dports/graphics/wxWidgets26 wxWidgets26] port doesn't yet have all the needed patches)&lt;br /&gt;
&lt;br /&gt;
After that set up has been done, you can install it with:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo port install codeblocks&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 -macosx+puredarwin&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&lt;br /&gt;
---&amp;gt;  Verifying checksum(s) for codeblocks&lt;br /&gt;
---&amp;gt;  Extracting codeblocks&lt;br /&gt;
---&amp;gt;  Applying patches to codeblocks&lt;br /&gt;
---&amp;gt;  Configuring codeblocks&lt;br /&gt;
---&amp;gt;  Building codeblocks with target all&lt;br /&gt;
---&amp;gt;  Staging codeblocks into destroot&lt;br /&gt;
---&amp;gt;  Packaging tgz archive for codeblocks 1.0_0+macosx&lt;br /&gt;
---&amp;gt;  Installing codeblocks 1.0_0+macosx&lt;br /&gt;
---&amp;gt;  Activating codeblocks 1.0_0+macosx&lt;br /&gt;
---&amp;gt;  Cleaning codeblocks&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&lt;br /&gt;
sudo port clean codeblocks&lt;br /&gt;
sudo port install codeblocks&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;+macosx&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/DarwinPorts/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;DarwinPorts&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 --prefix=/opt/local&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Running &amp;lt;tt&amp;gt;+puredarwin&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 --prefix=/opt/local&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There is also a wxGTK startup command in &amp;quot;DarwinPorts&amp;quot;,&lt;br /&gt;
that will first start up X11.app and then launch C::B:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
open /Applications/DarwinPorts/CodeBlocks.command&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Afb</name></author>
	</entry>
	<entry>
		<id>https://wiki.codeblocks.org/index.php?title=Installing_Code::Blocks_from_source_on_Mac_OS_X&amp;diff=4505</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=4505"/>
		<updated>2007-03-22T10:11:58Z</updated>

		<summary type="html">&lt;p&gt;Afb: /* Configure and (GNU) Make */&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://darwinports.opendarwin.org DarwinPorts],&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 DarwinPorts 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:&lt;br /&gt;
&lt;br /&gt;
http://developer.apple.com/tools/&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. For Mac OS X 10.1-10.2, the latest Dev Tools.&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 /usr/local/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;
=== 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/2.6/wx_unicode.html#unicodeandansi&lt;br /&gt;
&lt;br /&gt;
== Build wxWidgets 2.6 ==&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/#previous_stable&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;
For Intel Macintosh, you will need this additional patch:&lt;br /&gt;
&lt;br /&gt;
* http://www.algonet.se/~afb/wx/wxWidgets-killpoll.patch&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
patch -p1 -i wxWidgets-killpoll.patch&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note: this patch is not needed for wxWidgets 2.6.4 and later&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.3+)&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.3.1.dylib&lt;br /&gt;
/usr/local/lib/libwx_macu-2.6.0.3.1.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.3.1.dylib&lt;br /&gt;
/Library/Frameworks/wx.framework/Versions/2.6/libwx_macu-2.6.0.3.1.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 necessary patches, see below under &amp;quot;DarwinPorts&amp;quot;, or:&lt;br /&gt;
&lt;br /&gt;
http://developer.berlios.de/patch/?group_id=5358&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
patch -p0 -i codeblocks-rev3656_pluginslib.patch&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You might need to convert the line endings from DOS to Unix first.&lt;br /&gt;
&lt;br /&gt;
Hopefully most of these should be merged upstream, before release:&lt;br /&gt;
&lt;br /&gt;
* http://developer.berlios.de/patch/?func=detailpatch&amp;amp;patch_id=1395&amp;amp;group_id=5358&lt;br /&gt;
&lt;br /&gt;
(when they are, the above stand-alone patches might fail to apply)&lt;br /&gt;
&lt;br /&gt;
=== Bootstrap with Autotools ===&lt;br /&gt;
&lt;br /&gt;
You need to use the newer version of automake, for the &amp;quot;bootstrap&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
AUTOMAKE=automake-1.7 ACLOCAL=aclocal-1.7 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;
See above for how to compile and install automake-1.7 on Mac OS X.&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; 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;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;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;
DarwinPorts: &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;
== 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;
(that is: Darwin using X11 instead of Aqua for the user interface)&lt;br /&gt;
&lt;br /&gt;
== Install with DarwinPorts ==&lt;br /&gt;
&lt;br /&gt;
To build and install Code::Blocks, you will need:&lt;br /&gt;
&lt;br /&gt;
* http://www.algonet.se/~afb/wx/codeblocks.Portfile&lt;br /&gt;
&lt;br /&gt;
The following need to go in the &amp;quot;files&amp;quot; directory:&lt;br /&gt;
&lt;br /&gt;
* http://www.algonet.se/~afb/wx/codeblocks.plist&lt;br /&gt;
* http://www.algonet.se/~afb/wx/codeblocks.sh.in&lt;br /&gt;
* http://www.algonet.se/~afb/wx/dos2unix.sh&lt;br /&gt;
* http://www.algonet.se/~afb/wx/codeblocks-rev3656_pluginslib.patch&lt;br /&gt;
* http://www.algonet.se/~afb/wx/codeblocks-wxauigtk.patch&lt;br /&gt;
&lt;br /&gt;
Put the Portfile in your local DarwinPorts tree (usually in &amp;lt;tt&amp;gt;~/dports&amp;lt;/tt&amp;gt; - set up in &amp;lt;tt&amp;gt;/opt/local/etc/ports/sources.conf&amp;lt;/tt&amp;gt;, create the directory if needed), as &amp;lt;tt&amp;gt;dports/devel/codeblocks/Portfile&amp;lt;/tt&amp;gt; and download the helper files to &amp;lt;tt&amp;gt;dports/devel/codeblocks/files&amp;lt;/tt&amp;gt;. (then do a chdir to &amp;lt;tt&amp;gt;dports&amp;lt;/tt&amp;gt;, and run the &amp;lt;tt&amp;gt;/opt/local/bin/portindex&amp;lt;/tt&amp;gt; command)&lt;br /&gt;
&lt;br /&gt;
You will also need these custom wxWidgets ports:&lt;br /&gt;
&lt;br /&gt;
* http://www.algonet.se/~afb/wx/wxMac.Portfile&lt;br /&gt;
* http://www.algonet.se/~afb/wx/patch-polling.diff&lt;br /&gt;
* http://www.algonet.se/~afb/wx/wxGTK.Portfile&lt;br /&gt;
* http://www.algonet.se/~afb/wx/patch-soundsdl.diff&lt;br /&gt;
&lt;br /&gt;
The optional wxWidgets file go in &amp;lt;tt&amp;gt;graphics/wx{Mac,GTK}/Portfile&amp;lt;/tt&amp;gt;. 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 [http://trac.macports.org/projects/macports/browser/trunk/dports/graphics/wxWidgets wxWidgets] port is now upgraded to 2.8, and the alternative [http://trac.macports.org/projects/macports/browser/trunk/dports/graphics/wxWidgets26 wxWidgets26] port doesn't yet have all the needed patches)&lt;br /&gt;
&lt;br /&gt;
After that set up has been done, you can install it with:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo port install codeblocks&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 -macosx+puredarwin&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&lt;br /&gt;
---&amp;gt;  Verifying checksum(s) for codeblocks&lt;br /&gt;
---&amp;gt;  Extracting codeblocks&lt;br /&gt;
---&amp;gt;  Applying patches to codeblocks&lt;br /&gt;
---&amp;gt;  Configuring codeblocks&lt;br /&gt;
---&amp;gt;  Building codeblocks with target all&lt;br /&gt;
---&amp;gt;  Staging codeblocks into destroot&lt;br /&gt;
---&amp;gt;  Packaging tgz archive for codeblocks 1.0_0+macosx&lt;br /&gt;
---&amp;gt;  Installing codeblocks 1.0_0+macosx&lt;br /&gt;
---&amp;gt;  Activating codeblocks 1.0_0+macosx&lt;br /&gt;
---&amp;gt;  Cleaning codeblocks&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&lt;br /&gt;
sudo port clean codeblocks&lt;br /&gt;
sudo port install codeblocks&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;+macosx&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/DarwinPorts/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;DarwinPorts&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 --prefix=/opt/local&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Running &amp;lt;tt&amp;gt;+puredarwin&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 --prefix=/opt/local&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There is also a wxGTK startup command in &amp;quot;DarwinPorts&amp;quot;,&lt;br /&gt;
that will first start up X11.app and then launch C::B:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
open /Applications/DarwinPorts/CodeBlocks.command&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Afb</name></author>
	</entry>
	<entry>
		<id>https://wiki.codeblocks.org/index.php?title=Installing_Code::Blocks_from_source_on_Mac_OS_X&amp;diff=4504</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=4504"/>
		<updated>2007-03-22T10:11:03Z</updated>

		<summary type="html">&lt;p&gt;Afb: /* Apply necessary patches */&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://darwinports.opendarwin.org DarwinPorts],&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 DarwinPorts 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:&lt;br /&gt;
&lt;br /&gt;
http://developer.apple.com/tools/&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. For Mac OS X 10.1-10.2, the latest Dev Tools.&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 /usr/local/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;
=== 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/2.6/wx_unicode.html#unicodeandansi&lt;br /&gt;
&lt;br /&gt;
== Build wxWidgets 2.6 ==&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/#previous_stable&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;
For Intel Macintosh, you will need this additional patch:&lt;br /&gt;
&lt;br /&gt;
* http://www.algonet.se/~afb/wx/wxWidgets-killpoll.patch&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
patch -p1 -i wxWidgets-killpoll.patch&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note: this patch is not needed for wxWidgets 2.6.4 and later&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 --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.3+)&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.3.1.dylib&lt;br /&gt;
/usr/local/lib/libwx_macu-2.6.0.3.1.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.3.1.dylib&lt;br /&gt;
/Library/Frameworks/wx.framework/Versions/2.6/libwx_macu-2.6.0.3.1.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 necessary patches, see below under &amp;quot;DarwinPorts&amp;quot;, or:&lt;br /&gt;
&lt;br /&gt;
http://developer.berlios.de/patch/?group_id=5358&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
patch -p0 -i codeblocks-rev3656_pluginslib.patch&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You might need to convert the line endings from DOS to Unix first.&lt;br /&gt;
&lt;br /&gt;
Hopefully most of these should be merged upstream, before release:&lt;br /&gt;
&lt;br /&gt;
* http://developer.berlios.de/patch/?func=detailpatch&amp;amp;patch_id=1395&amp;amp;group_id=5358&lt;br /&gt;
&lt;br /&gt;
(when they are, the above stand-alone patches might fail to apply)&lt;br /&gt;
&lt;br /&gt;
=== Bootstrap with Autotools ===&lt;br /&gt;
&lt;br /&gt;
You need to use the newer version of automake, for the &amp;quot;bootstrap&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
AUTOMAKE=automake-1.7 ACLOCAL=aclocal-1.7 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;
See above for how to compile and install automake-1.7 on Mac OS X.&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; 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;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;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;
DarwinPorts: &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;
== 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;
(that is: Darwin using X11 instead of Aqua for the user interface)&lt;br /&gt;
&lt;br /&gt;
== Install with DarwinPorts ==&lt;br /&gt;
&lt;br /&gt;
To build and install Code::Blocks, you will need:&lt;br /&gt;
&lt;br /&gt;
* http://www.algonet.se/~afb/wx/codeblocks.Portfile&lt;br /&gt;
&lt;br /&gt;
The following need to go in the &amp;quot;files&amp;quot; directory:&lt;br /&gt;
&lt;br /&gt;
* http://www.algonet.se/~afb/wx/codeblocks.plist&lt;br /&gt;
* http://www.algonet.se/~afb/wx/codeblocks.sh.in&lt;br /&gt;
* http://www.algonet.se/~afb/wx/dos2unix.sh&lt;br /&gt;
* http://www.algonet.se/~afb/wx/codeblocks-rev3656_pluginslib.patch&lt;br /&gt;
* http://www.algonet.se/~afb/wx/codeblocks-wxauigtk.patch&lt;br /&gt;
&lt;br /&gt;
Put the Portfile in your local DarwinPorts tree (usually in &amp;lt;tt&amp;gt;~/dports&amp;lt;/tt&amp;gt; - set up in &amp;lt;tt&amp;gt;/opt/local/etc/ports/sources.conf&amp;lt;/tt&amp;gt;, create the directory if needed), as &amp;lt;tt&amp;gt;dports/devel/codeblocks/Portfile&amp;lt;/tt&amp;gt; and download the helper files to &amp;lt;tt&amp;gt;dports/devel/codeblocks/files&amp;lt;/tt&amp;gt;. (then do a chdir to &amp;lt;tt&amp;gt;dports&amp;lt;/tt&amp;gt;, and run the &amp;lt;tt&amp;gt;/opt/local/bin/portindex&amp;lt;/tt&amp;gt; command)&lt;br /&gt;
&lt;br /&gt;
You will also need these custom wxWidgets ports:&lt;br /&gt;
&lt;br /&gt;
* http://www.algonet.se/~afb/wx/wxMac.Portfile&lt;br /&gt;
* http://www.algonet.se/~afb/wx/patch-polling.diff&lt;br /&gt;
* http://www.algonet.se/~afb/wx/wxGTK.Portfile&lt;br /&gt;
* http://www.algonet.se/~afb/wx/patch-soundsdl.diff&lt;br /&gt;
&lt;br /&gt;
The optional wxWidgets file go in &amp;lt;tt&amp;gt;graphics/wx{Mac,GTK}/Portfile&amp;lt;/tt&amp;gt;. 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 [http://trac.macports.org/projects/macports/browser/trunk/dports/graphics/wxWidgets wxWidgets] port is now upgraded to 2.8, and the alternative [http://trac.macports.org/projects/macports/browser/trunk/dports/graphics/wxWidgets26 wxWidgets26] port doesn't yet have all the needed patches)&lt;br /&gt;
&lt;br /&gt;
After that set up has been done, you can install it with:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo port install codeblocks&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 -macosx+puredarwin&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&lt;br /&gt;
---&amp;gt;  Verifying checksum(s) for codeblocks&lt;br /&gt;
---&amp;gt;  Extracting codeblocks&lt;br /&gt;
---&amp;gt;  Applying patches to codeblocks&lt;br /&gt;
---&amp;gt;  Configuring codeblocks&lt;br /&gt;
---&amp;gt;  Building codeblocks with target all&lt;br /&gt;
---&amp;gt;  Staging codeblocks into destroot&lt;br /&gt;
---&amp;gt;  Packaging tgz archive for codeblocks 1.0_0+macosx&lt;br /&gt;
---&amp;gt;  Installing codeblocks 1.0_0+macosx&lt;br /&gt;
---&amp;gt;  Activating codeblocks 1.0_0+macosx&lt;br /&gt;
---&amp;gt;  Cleaning codeblocks&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&lt;br /&gt;
sudo port clean codeblocks&lt;br /&gt;
sudo port install codeblocks&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;+macosx&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/DarwinPorts/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;DarwinPorts&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 --prefix=/opt/local&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Running &amp;lt;tt&amp;gt;+puredarwin&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 --prefix=/opt/local&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There is also a wxGTK startup command in &amp;quot;DarwinPorts&amp;quot;,&lt;br /&gt;
that will first start up X11.app and then launch C::B:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
open /Applications/DarwinPorts/CodeBlocks.command&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Afb</name></author>
	</entry>
	<entry>
		<id>https://wiki.codeblocks.org/index.php?title=Installing_Code::Blocks_from_source_on_Mac_OS_X&amp;diff=4503</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=4503"/>
		<updated>2007-03-22T10:09:51Z</updated>

		<summary type="html">&lt;p&gt;Afb: /* Check Autotools versions */&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://darwinports.opendarwin.org DarwinPorts],&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 DarwinPorts 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:&lt;br /&gt;
&lt;br /&gt;
http://developer.apple.com/tools/&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. For Mac OS X 10.1-10.2, the latest Dev Tools.&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 /usr/local/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;
=== 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/2.6/wx_unicode.html#unicodeandansi&lt;br /&gt;
&lt;br /&gt;
== Build wxWidgets 2.6 ==&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/#previous_stable&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;
For Intel Macintosh, you will need this additional patch:&lt;br /&gt;
&lt;br /&gt;
* http://www.algonet.se/~afb/wx/wxWidgets-killpoll.patch&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
patch -p1 -i wxWidgets-killpoll.patch&lt;br /&gt;
&amp;lt;/pre&amp;gt;&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 --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.3+)&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.3.1.dylib&lt;br /&gt;
/usr/local/lib/libwx_macu-2.6.0.3.1.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.3.1.dylib&lt;br /&gt;
/Library/Frameworks/wx.framework/Versions/2.6/libwx_macu-2.6.0.3.1.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 necessary patches, see below under &amp;quot;DarwinPorts&amp;quot;, or:&lt;br /&gt;
&lt;br /&gt;
http://developer.berlios.de/patch/?group_id=5358&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
patch -p0 -i codeblocks-rev3656_pluginslib.patch&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You might need to convert the line endings from DOS to Unix first.&lt;br /&gt;
&lt;br /&gt;
Hopefully most of these should be merged upstream, before release:&lt;br /&gt;
&lt;br /&gt;
* http://developer.berlios.de/patch/?func=detailpatch&amp;amp;patch_id=1395&amp;amp;group_id=5358&lt;br /&gt;
&lt;br /&gt;
(when they are, the above stand-alone patches might fail to apply)&lt;br /&gt;
&lt;br /&gt;
=== Bootstrap with Autotools ===&lt;br /&gt;
&lt;br /&gt;
You need to use the newer version of automake, for the &amp;quot;bootstrap&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
AUTOMAKE=automake-1.7 ACLOCAL=aclocal-1.7 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;
See above for how to compile and install automake-1.7 on Mac OS X.&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; 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;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;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;
DarwinPorts: &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;
== 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;
(that is: Darwin using X11 instead of Aqua for the user interface)&lt;br /&gt;
&lt;br /&gt;
== Install with DarwinPorts ==&lt;br /&gt;
&lt;br /&gt;
To build and install Code::Blocks, you will need:&lt;br /&gt;
&lt;br /&gt;
* http://www.algonet.se/~afb/wx/codeblocks.Portfile&lt;br /&gt;
&lt;br /&gt;
The following need to go in the &amp;quot;files&amp;quot; directory:&lt;br /&gt;
&lt;br /&gt;
* http://www.algonet.se/~afb/wx/codeblocks.plist&lt;br /&gt;
* http://www.algonet.se/~afb/wx/codeblocks.sh.in&lt;br /&gt;
* http://www.algonet.se/~afb/wx/dos2unix.sh&lt;br /&gt;
* http://www.algonet.se/~afb/wx/codeblocks-rev3656_pluginslib.patch&lt;br /&gt;
* http://www.algonet.se/~afb/wx/codeblocks-wxauigtk.patch&lt;br /&gt;
&lt;br /&gt;
Put the Portfile in your local DarwinPorts tree (usually in &amp;lt;tt&amp;gt;~/dports&amp;lt;/tt&amp;gt; - set up in &amp;lt;tt&amp;gt;/opt/local/etc/ports/sources.conf&amp;lt;/tt&amp;gt;, create the directory if needed), as &amp;lt;tt&amp;gt;dports/devel/codeblocks/Portfile&amp;lt;/tt&amp;gt; and download the helper files to &amp;lt;tt&amp;gt;dports/devel/codeblocks/files&amp;lt;/tt&amp;gt;. (then do a chdir to &amp;lt;tt&amp;gt;dports&amp;lt;/tt&amp;gt;, and run the &amp;lt;tt&amp;gt;/opt/local/bin/portindex&amp;lt;/tt&amp;gt; command)&lt;br /&gt;
&lt;br /&gt;
You will also need these custom wxWidgets ports:&lt;br /&gt;
&lt;br /&gt;
* http://www.algonet.se/~afb/wx/wxMac.Portfile&lt;br /&gt;
* http://www.algonet.se/~afb/wx/patch-polling.diff&lt;br /&gt;
* http://www.algonet.se/~afb/wx/wxGTK.Portfile&lt;br /&gt;
* http://www.algonet.se/~afb/wx/patch-soundsdl.diff&lt;br /&gt;
&lt;br /&gt;
The optional wxWidgets file go in &amp;lt;tt&amp;gt;graphics/wx{Mac,GTK}/Portfile&amp;lt;/tt&amp;gt;. 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 [http://trac.macports.org/projects/macports/browser/trunk/dports/graphics/wxWidgets wxWidgets] port is now upgraded to 2.8, and the alternative [http://trac.macports.org/projects/macports/browser/trunk/dports/graphics/wxWidgets26 wxWidgets26] port doesn't yet have all the needed patches)&lt;br /&gt;
&lt;br /&gt;
After that set up has been done, you can install it with:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo port install codeblocks&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 -macosx+puredarwin&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&lt;br /&gt;
---&amp;gt;  Verifying checksum(s) for codeblocks&lt;br /&gt;
---&amp;gt;  Extracting codeblocks&lt;br /&gt;
---&amp;gt;  Applying patches to codeblocks&lt;br /&gt;
---&amp;gt;  Configuring codeblocks&lt;br /&gt;
---&amp;gt;  Building codeblocks with target all&lt;br /&gt;
---&amp;gt;  Staging codeblocks into destroot&lt;br /&gt;
---&amp;gt;  Packaging tgz archive for codeblocks 1.0_0+macosx&lt;br /&gt;
---&amp;gt;  Installing codeblocks 1.0_0+macosx&lt;br /&gt;
---&amp;gt;  Activating codeblocks 1.0_0+macosx&lt;br /&gt;
---&amp;gt;  Cleaning codeblocks&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&lt;br /&gt;
sudo port clean codeblocks&lt;br /&gt;
sudo port install codeblocks&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;+macosx&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/DarwinPorts/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;DarwinPorts&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 --prefix=/opt/local&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Running &amp;lt;tt&amp;gt;+puredarwin&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 --prefix=/opt/local&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There is also a wxGTK startup command in &amp;quot;DarwinPorts&amp;quot;,&lt;br /&gt;
that will first start up X11.app and then launch C::B:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
open /Applications/DarwinPorts/CodeBlocks.command&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Afb</name></author>
	</entry>
	<entry>
		<id>https://wiki.codeblocks.org/index.php?title=Installing_Code::Blocks_from_source_on_Mac_OS_X&amp;diff=4502</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=4502"/>
		<updated>2007-03-22T10:08:37Z</updated>

		<summary type="html">&lt;p&gt;Afb: /* Libtool example */&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://darwinports.opendarwin.org DarwinPorts],&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 DarwinPorts 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:&lt;br /&gt;
&lt;br /&gt;
http://developer.apple.com/tools/&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. For Mac OS X 10.1-10.2, the latest Dev Tools.&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+&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 /usr/local/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;
=== 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/2.6/wx_unicode.html#unicodeandansi&lt;br /&gt;
&lt;br /&gt;
== Build wxWidgets 2.6 ==&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/#previous_stable&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;
For Intel Macintosh, you will need this additional patch:&lt;br /&gt;
&lt;br /&gt;
* http://www.algonet.se/~afb/wx/wxWidgets-killpoll.patch&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
patch -p1 -i wxWidgets-killpoll.patch&lt;br /&gt;
&amp;lt;/pre&amp;gt;&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 --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.3+)&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.3.1.dylib&lt;br /&gt;
/usr/local/lib/libwx_macu-2.6.0.3.1.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.3.1.dylib&lt;br /&gt;
/Library/Frameworks/wx.framework/Versions/2.6/libwx_macu-2.6.0.3.1.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 necessary patches, see below under &amp;quot;DarwinPorts&amp;quot;, or:&lt;br /&gt;
&lt;br /&gt;
http://developer.berlios.de/patch/?group_id=5358&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
patch -p0 -i codeblocks-rev3656_pluginslib.patch&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You might need to convert the line endings from DOS to Unix first.&lt;br /&gt;
&lt;br /&gt;
Hopefully most of these should be merged upstream, before release:&lt;br /&gt;
&lt;br /&gt;
* http://developer.berlios.de/patch/?func=detailpatch&amp;amp;patch_id=1395&amp;amp;group_id=5358&lt;br /&gt;
&lt;br /&gt;
(when they are, the above stand-alone patches might fail to apply)&lt;br /&gt;
&lt;br /&gt;
=== Bootstrap with Autotools ===&lt;br /&gt;
&lt;br /&gt;
You need to use the newer version of automake, for the &amp;quot;bootstrap&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
AUTOMAKE=automake-1.7 ACLOCAL=aclocal-1.7 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;
See above for how to compile and install automake-1.7 on Mac OS X.&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; 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;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;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;
DarwinPorts: &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;
== 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;
(that is: Darwin using X11 instead of Aqua for the user interface)&lt;br /&gt;
&lt;br /&gt;
== Install with DarwinPorts ==&lt;br /&gt;
&lt;br /&gt;
To build and install Code::Blocks, you will need:&lt;br /&gt;
&lt;br /&gt;
* http://www.algonet.se/~afb/wx/codeblocks.Portfile&lt;br /&gt;
&lt;br /&gt;
The following need to go in the &amp;quot;files&amp;quot; directory:&lt;br /&gt;
&lt;br /&gt;
* http://www.algonet.se/~afb/wx/codeblocks.plist&lt;br /&gt;
* http://www.algonet.se/~afb/wx/codeblocks.sh.in&lt;br /&gt;
* http://www.algonet.se/~afb/wx/dos2unix.sh&lt;br /&gt;
* http://www.algonet.se/~afb/wx/codeblocks-rev3656_pluginslib.patch&lt;br /&gt;
* http://www.algonet.se/~afb/wx/codeblocks-wxauigtk.patch&lt;br /&gt;
&lt;br /&gt;
Put the Portfile in your local DarwinPorts tree (usually in &amp;lt;tt&amp;gt;~/dports&amp;lt;/tt&amp;gt; - set up in &amp;lt;tt&amp;gt;/opt/local/etc/ports/sources.conf&amp;lt;/tt&amp;gt;, create the directory if needed), as &amp;lt;tt&amp;gt;dports/devel/codeblocks/Portfile&amp;lt;/tt&amp;gt; and download the helper files to &amp;lt;tt&amp;gt;dports/devel/codeblocks/files&amp;lt;/tt&amp;gt;. (then do a chdir to &amp;lt;tt&amp;gt;dports&amp;lt;/tt&amp;gt;, and run the &amp;lt;tt&amp;gt;/opt/local/bin/portindex&amp;lt;/tt&amp;gt; command)&lt;br /&gt;
&lt;br /&gt;
You will also need these custom wxWidgets ports:&lt;br /&gt;
&lt;br /&gt;
* http://www.algonet.se/~afb/wx/wxMac.Portfile&lt;br /&gt;
* http://www.algonet.se/~afb/wx/patch-polling.diff&lt;br /&gt;
* http://www.algonet.se/~afb/wx/wxGTK.Portfile&lt;br /&gt;
* http://www.algonet.se/~afb/wx/patch-soundsdl.diff&lt;br /&gt;
&lt;br /&gt;
The optional wxWidgets file go in &amp;lt;tt&amp;gt;graphics/wx{Mac,GTK}/Portfile&amp;lt;/tt&amp;gt;. 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 [http://trac.macports.org/projects/macports/browser/trunk/dports/graphics/wxWidgets wxWidgets] port is now upgraded to 2.8, and the alternative [http://trac.macports.org/projects/macports/browser/trunk/dports/graphics/wxWidgets26 wxWidgets26] port doesn't yet have all the needed patches)&lt;br /&gt;
&lt;br /&gt;
After that set up has been done, you can install it with:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo port install codeblocks&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 -macosx+puredarwin&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&lt;br /&gt;
---&amp;gt;  Verifying checksum(s) for codeblocks&lt;br /&gt;
---&amp;gt;  Extracting codeblocks&lt;br /&gt;
---&amp;gt;  Applying patches to codeblocks&lt;br /&gt;
---&amp;gt;  Configuring codeblocks&lt;br /&gt;
---&amp;gt;  Building codeblocks with target all&lt;br /&gt;
---&amp;gt;  Staging codeblocks into destroot&lt;br /&gt;
---&amp;gt;  Packaging tgz archive for codeblocks 1.0_0+macosx&lt;br /&gt;
---&amp;gt;  Installing codeblocks 1.0_0+macosx&lt;br /&gt;
---&amp;gt;  Activating codeblocks 1.0_0+macosx&lt;br /&gt;
---&amp;gt;  Cleaning codeblocks&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&lt;br /&gt;
sudo port clean codeblocks&lt;br /&gt;
sudo port install codeblocks&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;+macosx&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/DarwinPorts/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;DarwinPorts&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 --prefix=/opt/local&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Running &amp;lt;tt&amp;gt;+puredarwin&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 --prefix=/opt/local&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There is also a wxGTK startup command in &amp;quot;DarwinPorts&amp;quot;,&lt;br /&gt;
that will first start up X11.app and then launch C::B:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
open /Applications/DarwinPorts/CodeBlocks.command&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Afb</name></author>
	</entry>
	<entry>
		<id>https://wiki.codeblocks.org/index.php?title=Installing_Code::Blocks_from_source_on_Mac_OS_X&amp;diff=4501</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=4501"/>
		<updated>2007-03-22T10:01:10Z</updated>

		<summary type="html">&lt;p&gt;Afb: /* Install with DarwinPorts */&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://darwinports.opendarwin.org DarwinPorts],&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 DarwinPorts 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:&lt;br /&gt;
&lt;br /&gt;
http://developer.apple.com/tools/&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. For Mac OS X 10.1-10.2, the latest Dev Tools.&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+&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 /usr/local/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;
=== 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-dir/&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;
== 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/2.6/wx_unicode.html#unicodeandansi&lt;br /&gt;
&lt;br /&gt;
== Build wxWidgets 2.6 ==&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/#previous_stable&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;
For Intel Macintosh, you will need this additional patch:&lt;br /&gt;
&lt;br /&gt;
* http://www.algonet.se/~afb/wx/wxWidgets-killpoll.patch&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
patch -p1 -i wxWidgets-killpoll.patch&lt;br /&gt;
&amp;lt;/pre&amp;gt;&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 --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.3+)&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.3.1.dylib&lt;br /&gt;
/usr/local/lib/libwx_macu-2.6.0.3.1.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.3.1.dylib&lt;br /&gt;
/Library/Frameworks/wx.framework/Versions/2.6/libwx_macu-2.6.0.3.1.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 necessary patches, see below under &amp;quot;DarwinPorts&amp;quot;, or:&lt;br /&gt;
&lt;br /&gt;
http://developer.berlios.de/patch/?group_id=5358&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
patch -p0 -i codeblocks-rev3656_pluginslib.patch&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You might need to convert the line endings from DOS to Unix first.&lt;br /&gt;
&lt;br /&gt;
Hopefully most of these should be merged upstream, before release:&lt;br /&gt;
&lt;br /&gt;
* http://developer.berlios.de/patch/?func=detailpatch&amp;amp;patch_id=1395&amp;amp;group_id=5358&lt;br /&gt;
&lt;br /&gt;
(when they are, the above stand-alone patches might fail to apply)&lt;br /&gt;
&lt;br /&gt;
=== Bootstrap with Autotools ===&lt;br /&gt;
&lt;br /&gt;
You need to use the newer version of automake, for the &amp;quot;bootstrap&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
AUTOMAKE=automake-1.7 ACLOCAL=aclocal-1.7 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;
See above for how to compile and install automake-1.7 on Mac OS X.&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; 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;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;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;
DarwinPorts: &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;
== 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;
(that is: Darwin using X11 instead of Aqua for the user interface)&lt;br /&gt;
&lt;br /&gt;
== Install with DarwinPorts ==&lt;br /&gt;
&lt;br /&gt;
To build and install Code::Blocks, you will need:&lt;br /&gt;
&lt;br /&gt;
* http://www.algonet.se/~afb/wx/codeblocks.Portfile&lt;br /&gt;
&lt;br /&gt;
The following need to go in the &amp;quot;files&amp;quot; directory:&lt;br /&gt;
&lt;br /&gt;
* http://www.algonet.se/~afb/wx/codeblocks.plist&lt;br /&gt;
* http://www.algonet.se/~afb/wx/codeblocks.sh.in&lt;br /&gt;
* http://www.algonet.se/~afb/wx/dos2unix.sh&lt;br /&gt;
* http://www.algonet.se/~afb/wx/codeblocks-rev3656_pluginslib.patch&lt;br /&gt;
* http://www.algonet.se/~afb/wx/codeblocks-wxauigtk.patch&lt;br /&gt;
&lt;br /&gt;
Put the Portfile in your local DarwinPorts tree (usually in &amp;lt;tt&amp;gt;~/dports&amp;lt;/tt&amp;gt; - set up in &amp;lt;tt&amp;gt;/opt/local/etc/ports/sources.conf&amp;lt;/tt&amp;gt;, create the directory if needed), as &amp;lt;tt&amp;gt;dports/devel/codeblocks/Portfile&amp;lt;/tt&amp;gt; and download the helper files to &amp;lt;tt&amp;gt;dports/devel/codeblocks/files&amp;lt;/tt&amp;gt;. (then do a chdir to &amp;lt;tt&amp;gt;dports&amp;lt;/tt&amp;gt;, and run the &amp;lt;tt&amp;gt;/opt/local/bin/portindex&amp;lt;/tt&amp;gt; command)&lt;br /&gt;
&lt;br /&gt;
You will also need these custom wxWidgets ports:&lt;br /&gt;
&lt;br /&gt;
* http://www.algonet.se/~afb/wx/wxMac.Portfile&lt;br /&gt;
* http://www.algonet.se/~afb/wx/patch-polling.diff&lt;br /&gt;
* http://www.algonet.se/~afb/wx/wxGTK.Portfile&lt;br /&gt;
* http://www.algonet.se/~afb/wx/patch-soundsdl.diff&lt;br /&gt;
&lt;br /&gt;
The optional wxWidgets file go in &amp;lt;tt&amp;gt;graphics/wx{Mac,GTK}/Portfile&amp;lt;/tt&amp;gt;. 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 [http://trac.macports.org/projects/macports/browser/trunk/dports/graphics/wxWidgets wxWidgets] port is now upgraded to 2.8, and the alternative [http://trac.macports.org/projects/macports/browser/trunk/dports/graphics/wxWidgets26 wxWidgets26] port doesn't yet have all the needed patches)&lt;br /&gt;
&lt;br /&gt;
After that set up has been done, you can install it with:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo port install codeblocks&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 -macosx+puredarwin&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&lt;br /&gt;
---&amp;gt;  Verifying checksum(s) for codeblocks&lt;br /&gt;
---&amp;gt;  Extracting codeblocks&lt;br /&gt;
---&amp;gt;  Applying patches to codeblocks&lt;br /&gt;
---&amp;gt;  Configuring codeblocks&lt;br /&gt;
---&amp;gt;  Building codeblocks with target all&lt;br /&gt;
---&amp;gt;  Staging codeblocks into destroot&lt;br /&gt;
---&amp;gt;  Packaging tgz archive for codeblocks 1.0_0+macosx&lt;br /&gt;
---&amp;gt;  Installing codeblocks 1.0_0+macosx&lt;br /&gt;
---&amp;gt;  Activating codeblocks 1.0_0+macosx&lt;br /&gt;
---&amp;gt;  Cleaning codeblocks&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&lt;br /&gt;
sudo port clean codeblocks&lt;br /&gt;
sudo port install codeblocks&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;+macosx&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/DarwinPorts/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;DarwinPorts&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 --prefix=/opt/local&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Running &amp;lt;tt&amp;gt;+puredarwin&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 --prefix=/opt/local&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There is also a wxGTK startup command in &amp;quot;DarwinPorts&amp;quot;,&lt;br /&gt;
that will first start up X11.app and then launch C::B:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
open /Applications/DarwinPorts/CodeBlocks.command&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Afb</name></author>
	</entry>
	<entry>
		<id>https://wiki.codeblocks.org/index.php?title=Installing_Code::Blocks_from_source_on_Mac_OS_X&amp;diff=4500</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=4500"/>
		<updated>2007-03-22T09:51:34Z</updated>

		<summary type="html">&lt;p&gt;Afb: /* FYI: ANSI or UNICODE */&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://darwinports.opendarwin.org DarwinPorts],&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 DarwinPorts 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:&lt;br /&gt;
&lt;br /&gt;
http://developer.apple.com/tools/&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. For Mac OS X 10.1-10.2, the latest Dev Tools.&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+&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 /usr/local/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;
=== 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-dir/&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;
== 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/2.6/wx_unicode.html#unicodeandansi&lt;br /&gt;
&lt;br /&gt;
== Build wxWidgets 2.6 ==&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/#previous_stable&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;
For Intel Macintosh, you will need this additional patch:&lt;br /&gt;
&lt;br /&gt;
* http://www.algonet.se/~afb/wx/wxWidgets-killpoll.patch&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
patch -p1 -i wxWidgets-killpoll.patch&lt;br /&gt;
&amp;lt;/pre&amp;gt;&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 --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.3+)&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.3.1.dylib&lt;br /&gt;
/usr/local/lib/libwx_macu-2.6.0.3.1.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.3.1.dylib&lt;br /&gt;
/Library/Frameworks/wx.framework/Versions/2.6/libwx_macu-2.6.0.3.1.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 necessary patches, see below under &amp;quot;DarwinPorts&amp;quot;, or:&lt;br /&gt;
&lt;br /&gt;
http://developer.berlios.de/patch/?group_id=5358&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
patch -p0 -i codeblocks-rev3656_pluginslib.patch&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You might need to convert the line endings from DOS to Unix first.&lt;br /&gt;
&lt;br /&gt;
Hopefully most of these should be merged upstream, before release:&lt;br /&gt;
&lt;br /&gt;
* http://developer.berlios.de/patch/?func=detailpatch&amp;amp;patch_id=1395&amp;amp;group_id=5358&lt;br /&gt;
&lt;br /&gt;
(when they are, the above stand-alone patches might fail to apply)&lt;br /&gt;
&lt;br /&gt;
=== Bootstrap with Autotools ===&lt;br /&gt;
&lt;br /&gt;
You need to use the newer version of automake, for the &amp;quot;bootstrap&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
AUTOMAKE=automake-1.7 ACLOCAL=aclocal-1.7 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;
See above for how to compile and install automake-1.7 on Mac OS X.&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; 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;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;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;
DarwinPorts: &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;
== 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;
(that is: Darwin using X11 instead of Aqua for the user interface)&lt;br /&gt;
&lt;br /&gt;
== Install with DarwinPorts ==&lt;br /&gt;
&lt;br /&gt;
To build and install Code::Blocks, you will need:&lt;br /&gt;
&lt;br /&gt;
* http://www.algonet.se/~afb/wx/codeblocks.Portfile&lt;br /&gt;
&lt;br /&gt;
The following need to go in the &amp;quot;files&amp;quot; directory:&lt;br /&gt;
&lt;br /&gt;
* http://www.algonet.se/~afb/wx/codeblocks.plist&lt;br /&gt;
* http://www.algonet.se/~afb/wx/codeblocks.sh.in&lt;br /&gt;
* http://www.algonet.se/~afb/wx/dos2unix.sh&lt;br /&gt;
* http://www.algonet.se/~afb/wx/codeblocks-rev3656_pluginslib.patch&lt;br /&gt;
* http://www.algonet.se/~afb/wx/codeblocks-wxauigtk.patch&lt;br /&gt;
&lt;br /&gt;
Put the Portfile in your local DarwinPorts tree (usually in &amp;lt;tt&amp;gt;~/dports&amp;lt;/tt&amp;gt; - set up in &amp;lt;tt&amp;gt;/opt/local/etc/ports/sources.conf&amp;lt;/tt&amp;gt;, create the directory if needed), as &amp;lt;tt&amp;gt;dports/devel/codeblocks/Portfile&amp;lt;/tt&amp;gt; and download the helper files to &amp;lt;tt&amp;gt;dports/devel/codeblocks/files&amp;lt;/tt&amp;gt;. (then do a chdir to &amp;lt;tt&amp;gt;dports&amp;lt;/tt&amp;gt;, and run the &amp;lt;tt&amp;gt;/opt/local/bin/portindex&amp;lt;/tt&amp;gt; command)&lt;br /&gt;
&lt;br /&gt;
You will also need these custom wxWidgets ports:&lt;br /&gt;
&lt;br /&gt;
* http://www.algonet.se/~afb/wx/wxMac.Portfile&lt;br /&gt;
* http://www.algonet.se/~afb/wx/patch-polling.diff&lt;br /&gt;
* http://www.algonet.se/~afb/wx/wxGTK.Portfile&lt;br /&gt;
* http://www.algonet.se/~afb/wx/patch-soundsdl.diff&lt;br /&gt;
&lt;br /&gt;
The optional wxWidgets file go in &amp;lt;tt&amp;gt;graphics/wx{Mac,GTK}/Portfile&amp;lt;/tt&amp;gt;. 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])&lt;br /&gt;
&lt;br /&gt;
After that set up has been done, you can install it with:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo port install codeblocks&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 -macosx+puredarwin&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&lt;br /&gt;
---&amp;gt;  Verifying checksum(s) for codeblocks&lt;br /&gt;
---&amp;gt;  Extracting codeblocks&lt;br /&gt;
---&amp;gt;  Applying patches to codeblocks&lt;br /&gt;
---&amp;gt;  Configuring codeblocks&lt;br /&gt;
---&amp;gt;  Building codeblocks with target all&lt;br /&gt;
---&amp;gt;  Staging codeblocks into destroot&lt;br /&gt;
---&amp;gt;  Packaging tgz archive for codeblocks 1.0_0+macosx&lt;br /&gt;
---&amp;gt;  Installing codeblocks 1.0_0+macosx&lt;br /&gt;
---&amp;gt;  Activating codeblocks 1.0_0+macosx&lt;br /&gt;
---&amp;gt;  Cleaning codeblocks&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&lt;br /&gt;
sudo port clean codeblocks&lt;br /&gt;
sudo port install codeblocks&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;+macosx&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/DarwinPorts/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;DarwinPorts&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 --prefix=/opt/local&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Running &amp;lt;tt&amp;gt;+puredarwin&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 --prefix=/opt/local&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There is also a wxGTK startup command in &amp;quot;DarwinPorts&amp;quot;,&lt;br /&gt;
that will first start up X11.app and then launch C::B:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
open /Applications/DarwinPorts/CodeBlocks.command&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Afb</name></author>
	</entry>
	<entry>
		<id>https://wiki.codeblocks.org/index.php?title=Installing_Code::Blocks_from_source_on_Mac_OS_X&amp;diff=4499</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=4499"/>
		<updated>2007-03-22T09:51:09Z</updated>

		<summary type="html">&lt;p&gt;Afb: /* Way Two: Framework (bundle) */&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://darwinports.opendarwin.org DarwinPorts],&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 DarwinPorts 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:&lt;br /&gt;
&lt;br /&gt;
http://developer.apple.com/tools/&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. For Mac OS X 10.1-10.2, the latest Dev Tools.&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+&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 /usr/local/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;
=== 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-dir/&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;
== 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/2.6.3/wx_unicode.html#unicodeandansi&lt;br /&gt;
&lt;br /&gt;
== Build wxWidgets 2.6 ==&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/#previous_stable&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;
For Intel Macintosh, you will need this additional patch:&lt;br /&gt;
&lt;br /&gt;
* http://www.algonet.se/~afb/wx/wxWidgets-killpoll.patch&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
patch -p1 -i wxWidgets-killpoll.patch&lt;br /&gt;
&amp;lt;/pre&amp;gt;&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 --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.3+)&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.3.1.dylib&lt;br /&gt;
/usr/local/lib/libwx_macu-2.6.0.3.1.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.3.1.dylib&lt;br /&gt;
/Library/Frameworks/wx.framework/Versions/2.6/libwx_macu-2.6.0.3.1.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 necessary patches, see below under &amp;quot;DarwinPorts&amp;quot;, or:&lt;br /&gt;
&lt;br /&gt;
http://developer.berlios.de/patch/?group_id=5358&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
patch -p0 -i codeblocks-rev3656_pluginslib.patch&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You might need to convert the line endings from DOS to Unix first.&lt;br /&gt;
&lt;br /&gt;
Hopefully most of these should be merged upstream, before release:&lt;br /&gt;
&lt;br /&gt;
* http://developer.berlios.de/patch/?func=detailpatch&amp;amp;patch_id=1395&amp;amp;group_id=5358&lt;br /&gt;
&lt;br /&gt;
(when they are, the above stand-alone patches might fail to apply)&lt;br /&gt;
&lt;br /&gt;
=== Bootstrap with Autotools ===&lt;br /&gt;
&lt;br /&gt;
You need to use the newer version of automake, for the &amp;quot;bootstrap&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
AUTOMAKE=automake-1.7 ACLOCAL=aclocal-1.7 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;
See above for how to compile and install automake-1.7 on Mac OS X.&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; 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;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;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;
DarwinPorts: &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;
== 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;
(that is: Darwin using X11 instead of Aqua for the user interface)&lt;br /&gt;
&lt;br /&gt;
== Install with DarwinPorts ==&lt;br /&gt;
&lt;br /&gt;
To build and install Code::Blocks, you will need:&lt;br /&gt;
&lt;br /&gt;
* http://www.algonet.se/~afb/wx/codeblocks.Portfile&lt;br /&gt;
&lt;br /&gt;
The following need to go in the &amp;quot;files&amp;quot; directory:&lt;br /&gt;
&lt;br /&gt;
* http://www.algonet.se/~afb/wx/codeblocks.plist&lt;br /&gt;
* http://www.algonet.se/~afb/wx/codeblocks.sh.in&lt;br /&gt;
* http://www.algonet.se/~afb/wx/dos2unix.sh&lt;br /&gt;
* http://www.algonet.se/~afb/wx/codeblocks-rev3656_pluginslib.patch&lt;br /&gt;
* http://www.algonet.se/~afb/wx/codeblocks-wxauigtk.patch&lt;br /&gt;
&lt;br /&gt;
Put the Portfile in your local DarwinPorts tree (usually in &amp;lt;tt&amp;gt;~/dports&amp;lt;/tt&amp;gt; - set up in &amp;lt;tt&amp;gt;/opt/local/etc/ports/sources.conf&amp;lt;/tt&amp;gt;, create the directory if needed), as &amp;lt;tt&amp;gt;dports/devel/codeblocks/Portfile&amp;lt;/tt&amp;gt; and download the helper files to &amp;lt;tt&amp;gt;dports/devel/codeblocks/files&amp;lt;/tt&amp;gt;. (then do a chdir to &amp;lt;tt&amp;gt;dports&amp;lt;/tt&amp;gt;, and run the &amp;lt;tt&amp;gt;/opt/local/bin/portindex&amp;lt;/tt&amp;gt; command)&lt;br /&gt;
&lt;br /&gt;
You will also need these custom wxWidgets ports:&lt;br /&gt;
&lt;br /&gt;
* http://www.algonet.se/~afb/wx/wxMac.Portfile&lt;br /&gt;
* http://www.algonet.se/~afb/wx/patch-polling.diff&lt;br /&gt;
* http://www.algonet.se/~afb/wx/wxGTK.Portfile&lt;br /&gt;
* http://www.algonet.se/~afb/wx/patch-soundsdl.diff&lt;br /&gt;
&lt;br /&gt;
The optional wxWidgets file go in &amp;lt;tt&amp;gt;graphics/wx{Mac,GTK}/Portfile&amp;lt;/tt&amp;gt;. 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])&lt;br /&gt;
&lt;br /&gt;
After that set up has been done, you can install it with:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo port install codeblocks&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 -macosx+puredarwin&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&lt;br /&gt;
---&amp;gt;  Verifying checksum(s) for codeblocks&lt;br /&gt;
---&amp;gt;  Extracting codeblocks&lt;br /&gt;
---&amp;gt;  Applying patches to codeblocks&lt;br /&gt;
---&amp;gt;  Configuring codeblocks&lt;br /&gt;
---&amp;gt;  Building codeblocks with target all&lt;br /&gt;
---&amp;gt;  Staging codeblocks into destroot&lt;br /&gt;
---&amp;gt;  Packaging tgz archive for codeblocks 1.0_0+macosx&lt;br /&gt;
---&amp;gt;  Installing codeblocks 1.0_0+macosx&lt;br /&gt;
---&amp;gt;  Activating codeblocks 1.0_0+macosx&lt;br /&gt;
---&amp;gt;  Cleaning codeblocks&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&lt;br /&gt;
sudo port clean codeblocks&lt;br /&gt;
sudo port install codeblocks&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;+macosx&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/DarwinPorts/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;DarwinPorts&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 --prefix=/opt/local&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Running &amp;lt;tt&amp;gt;+puredarwin&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 --prefix=/opt/local&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There is also a wxGTK startup command in &amp;quot;DarwinPorts&amp;quot;,&lt;br /&gt;
that will first start up X11.app and then launch C::B:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
open /Applications/DarwinPorts/CodeBlocks.command&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Afb</name></author>
	</entry>
	<entry>
		<id>https://wiki.codeblocks.org/index.php?title=Installing_Code::Blocks_from_source_on_Mac_OS_X&amp;diff=4498</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=4498"/>
		<updated>2007-03-22T09:49:18Z</updated>

		<summary type="html">&lt;p&gt;Afb: /* Download the source code */&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://darwinports.opendarwin.org DarwinPorts],&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 DarwinPorts 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:&lt;br /&gt;
&lt;br /&gt;
http://developer.apple.com/tools/&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. For Mac OS X 10.1-10.2, the latest Dev Tools.&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+&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 /usr/local/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;
=== 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-dir/&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;
== 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/2.6.3/wx_unicode.html#unicodeandansi&lt;br /&gt;
&lt;br /&gt;
== Build wxWidgets 2.6 ==&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/#previous_stable&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;
For Intel Macintosh, you will need this additional patch:&lt;br /&gt;
&lt;br /&gt;
* http://www.algonet.se/~afb/wx/wxWidgets-killpoll.patch&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
patch -p1 -i wxWidgets-killpoll.patch&lt;br /&gt;
&amp;lt;/pre&amp;gt;&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 --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.3+)&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.3.1.dylib&lt;br /&gt;
/usr/local/lib/libwx_macu-2.6.0.3.1.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.3&lt;br /&gt;
/Library/Frameworks/wx.framework/Versions/2.6.3/Headers/wx.h&lt;br /&gt;
/Library/Frameworks/wx.framework/Versions/2.6.3/wx  -&amp;gt; libwx_macu-2.6.0.dylib&lt;br /&gt;
/Library/Frameworks/wx.framework/Versions/2.6.3/libwx_macu-2.6.0.dylib  -&amp;gt; libwx_macu-2.6.0.3.1.dylib&lt;br /&gt;
/Library/Frameworks/wx.framework/Versions/2.6.3/libwx_macu-2.6.0.3.1.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.3/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 necessary patches, see below under &amp;quot;DarwinPorts&amp;quot;, or:&lt;br /&gt;
&lt;br /&gt;
http://developer.berlios.de/patch/?group_id=5358&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
patch -p0 -i codeblocks-rev3656_pluginslib.patch&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You might need to convert the line endings from DOS to Unix first.&lt;br /&gt;
&lt;br /&gt;
Hopefully most of these should be merged upstream, before release:&lt;br /&gt;
&lt;br /&gt;
* http://developer.berlios.de/patch/?func=detailpatch&amp;amp;patch_id=1395&amp;amp;group_id=5358&lt;br /&gt;
&lt;br /&gt;
(when they are, the above stand-alone patches might fail to apply)&lt;br /&gt;
&lt;br /&gt;
=== Bootstrap with Autotools ===&lt;br /&gt;
&lt;br /&gt;
You need to use the newer version of automake, for the &amp;quot;bootstrap&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
AUTOMAKE=automake-1.7 ACLOCAL=aclocal-1.7 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;
See above for how to compile and install automake-1.7 on Mac OS X.&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; 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;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;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;
DarwinPorts: &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;
== 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;
(that is: Darwin using X11 instead of Aqua for the user interface)&lt;br /&gt;
&lt;br /&gt;
== Install with DarwinPorts ==&lt;br /&gt;
&lt;br /&gt;
To build and install Code::Blocks, you will need:&lt;br /&gt;
&lt;br /&gt;
* http://www.algonet.se/~afb/wx/codeblocks.Portfile&lt;br /&gt;
&lt;br /&gt;
The following need to go in the &amp;quot;files&amp;quot; directory:&lt;br /&gt;
&lt;br /&gt;
* http://www.algonet.se/~afb/wx/codeblocks.plist&lt;br /&gt;
* http://www.algonet.se/~afb/wx/codeblocks.sh.in&lt;br /&gt;
* http://www.algonet.se/~afb/wx/dos2unix.sh&lt;br /&gt;
* http://www.algonet.se/~afb/wx/codeblocks-rev3656_pluginslib.patch&lt;br /&gt;
* http://www.algonet.se/~afb/wx/codeblocks-wxauigtk.patch&lt;br /&gt;
&lt;br /&gt;
Put the Portfile in your local DarwinPorts tree (usually in &amp;lt;tt&amp;gt;~/dports&amp;lt;/tt&amp;gt; - set up in &amp;lt;tt&amp;gt;/opt/local/etc/ports/sources.conf&amp;lt;/tt&amp;gt;, create the directory if needed), as &amp;lt;tt&amp;gt;dports/devel/codeblocks/Portfile&amp;lt;/tt&amp;gt; and download the helper files to &amp;lt;tt&amp;gt;dports/devel/codeblocks/files&amp;lt;/tt&amp;gt;. (then do a chdir to &amp;lt;tt&amp;gt;dports&amp;lt;/tt&amp;gt;, and run the &amp;lt;tt&amp;gt;/opt/local/bin/portindex&amp;lt;/tt&amp;gt; command)&lt;br /&gt;
&lt;br /&gt;
You will also need these custom wxWidgets ports:&lt;br /&gt;
&lt;br /&gt;
* http://www.algonet.se/~afb/wx/wxMac.Portfile&lt;br /&gt;
* http://www.algonet.se/~afb/wx/patch-polling.diff&lt;br /&gt;
* http://www.algonet.se/~afb/wx/wxGTK.Portfile&lt;br /&gt;
* http://www.algonet.se/~afb/wx/patch-soundsdl.diff&lt;br /&gt;
&lt;br /&gt;
The optional wxWidgets file go in &amp;lt;tt&amp;gt;graphics/wx{Mac,GTK}/Portfile&amp;lt;/tt&amp;gt;. 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])&lt;br /&gt;
&lt;br /&gt;
After that set up has been done, you can install it with:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo port install codeblocks&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 -macosx+puredarwin&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&lt;br /&gt;
---&amp;gt;  Verifying checksum(s) for codeblocks&lt;br /&gt;
---&amp;gt;  Extracting codeblocks&lt;br /&gt;
---&amp;gt;  Applying patches to codeblocks&lt;br /&gt;
---&amp;gt;  Configuring codeblocks&lt;br /&gt;
---&amp;gt;  Building codeblocks with target all&lt;br /&gt;
---&amp;gt;  Staging codeblocks into destroot&lt;br /&gt;
---&amp;gt;  Packaging tgz archive for codeblocks 1.0_0+macosx&lt;br /&gt;
---&amp;gt;  Installing codeblocks 1.0_0+macosx&lt;br /&gt;
---&amp;gt;  Activating codeblocks 1.0_0+macosx&lt;br /&gt;
---&amp;gt;  Cleaning codeblocks&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&lt;br /&gt;
sudo port clean codeblocks&lt;br /&gt;
sudo port install codeblocks&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;+macosx&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/DarwinPorts/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;DarwinPorts&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 --prefix=/opt/local&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Running &amp;lt;tt&amp;gt;+puredarwin&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 --prefix=/opt/local&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There is also a wxGTK startup command in &amp;quot;DarwinPorts&amp;quot;,&lt;br /&gt;
that will first start up X11.app and then launch C::B:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
open /Applications/DarwinPorts/CodeBlocks.command&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Afb</name></author>
	</entry>
	<entry>
		<id>https://wiki.codeblocks.org/index.php?title=Installing_Code::Blocks_from_source_on_Mac_OS_X&amp;diff=4497</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=4497"/>
		<updated>2007-03-22T09:47:51Z</updated>

		<summary type="html">&lt;p&gt;Afb: mono workaround&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://darwinports.opendarwin.org DarwinPorts],&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 DarwinPorts 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:&lt;br /&gt;
&lt;br /&gt;
http://developer.apple.com/tools/&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. For Mac OS X 10.1-10.2, the latest Dev Tools.&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+&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 /usr/local/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;
=== 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-dir/&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;
== 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/2.6.3/wx_unicode.html#unicodeandansi&lt;br /&gt;
&lt;br /&gt;
== Build wxWidgets 2.6 ==&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/#latest_stable&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;
For Intel Macintosh, you will need this additional patch:&lt;br /&gt;
&lt;br /&gt;
* http://www.algonet.se/~afb/wx/wxWidgets-killpoll.patch&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
patch -p1 -i wxWidgets-killpoll.patch&lt;br /&gt;
&amp;lt;/pre&amp;gt;&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 --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.3+)&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.3.1.dylib&lt;br /&gt;
/usr/local/lib/libwx_macu-2.6.0.3.1.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.3&lt;br /&gt;
/Library/Frameworks/wx.framework/Versions/2.6.3/Headers/wx.h&lt;br /&gt;
/Library/Frameworks/wx.framework/Versions/2.6.3/wx  -&amp;gt; libwx_macu-2.6.0.dylib&lt;br /&gt;
/Library/Frameworks/wx.framework/Versions/2.6.3/libwx_macu-2.6.0.dylib  -&amp;gt; libwx_macu-2.6.0.3.1.dylib&lt;br /&gt;
/Library/Frameworks/wx.framework/Versions/2.6.3/libwx_macu-2.6.0.3.1.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.3/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 necessary patches, see below under &amp;quot;DarwinPorts&amp;quot;, or:&lt;br /&gt;
&lt;br /&gt;
http://developer.berlios.de/patch/?group_id=5358&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
patch -p0 -i codeblocks-rev3656_pluginslib.patch&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You might need to convert the line endings from DOS to Unix first.&lt;br /&gt;
&lt;br /&gt;
Hopefully most of these should be merged upstream, before release:&lt;br /&gt;
&lt;br /&gt;
* http://developer.berlios.de/patch/?func=detailpatch&amp;amp;patch_id=1395&amp;amp;group_id=5358&lt;br /&gt;
&lt;br /&gt;
(when they are, the above stand-alone patches might fail to apply)&lt;br /&gt;
&lt;br /&gt;
=== Bootstrap with Autotools ===&lt;br /&gt;
&lt;br /&gt;
You need to use the newer version of automake, for the &amp;quot;bootstrap&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
AUTOMAKE=automake-1.7 ACLOCAL=aclocal-1.7 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;
See above for how to compile and install automake-1.7 on Mac OS X.&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; 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;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;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;
DarwinPorts: &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;
== 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;
(that is: Darwin using X11 instead of Aqua for the user interface)&lt;br /&gt;
&lt;br /&gt;
== Install with DarwinPorts ==&lt;br /&gt;
&lt;br /&gt;
To build and install Code::Blocks, you will need:&lt;br /&gt;
&lt;br /&gt;
* http://www.algonet.se/~afb/wx/codeblocks.Portfile&lt;br /&gt;
&lt;br /&gt;
The following need to go in the &amp;quot;files&amp;quot; directory:&lt;br /&gt;
&lt;br /&gt;
* http://www.algonet.se/~afb/wx/codeblocks.plist&lt;br /&gt;
* http://www.algonet.se/~afb/wx/codeblocks.sh.in&lt;br /&gt;
* http://www.algonet.se/~afb/wx/dos2unix.sh&lt;br /&gt;
* http://www.algonet.se/~afb/wx/codeblocks-rev3656_pluginslib.patch&lt;br /&gt;
* http://www.algonet.se/~afb/wx/codeblocks-wxauigtk.patch&lt;br /&gt;
&lt;br /&gt;
Put the Portfile in your local DarwinPorts tree (usually in &amp;lt;tt&amp;gt;~/dports&amp;lt;/tt&amp;gt; - set up in &amp;lt;tt&amp;gt;/opt/local/etc/ports/sources.conf&amp;lt;/tt&amp;gt;, create the directory if needed), as &amp;lt;tt&amp;gt;dports/devel/codeblocks/Portfile&amp;lt;/tt&amp;gt; and download the helper files to &amp;lt;tt&amp;gt;dports/devel/codeblocks/files&amp;lt;/tt&amp;gt;. (then do a chdir to &amp;lt;tt&amp;gt;dports&amp;lt;/tt&amp;gt;, and run the &amp;lt;tt&amp;gt;/opt/local/bin/portindex&amp;lt;/tt&amp;gt; command)&lt;br /&gt;
&lt;br /&gt;
You will also need these custom wxWidgets ports:&lt;br /&gt;
&lt;br /&gt;
* http://www.algonet.se/~afb/wx/wxMac.Portfile&lt;br /&gt;
* http://www.algonet.se/~afb/wx/patch-polling.diff&lt;br /&gt;
* http://www.algonet.se/~afb/wx/wxGTK.Portfile&lt;br /&gt;
* http://www.algonet.se/~afb/wx/patch-soundsdl.diff&lt;br /&gt;
&lt;br /&gt;
The optional wxWidgets file go in &amp;lt;tt&amp;gt;graphics/wx{Mac,GTK}/Portfile&amp;lt;/tt&amp;gt;. 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])&lt;br /&gt;
&lt;br /&gt;
After that set up has been done, you can install it with:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo port install codeblocks&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 -macosx+puredarwin&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&lt;br /&gt;
---&amp;gt;  Verifying checksum(s) for codeblocks&lt;br /&gt;
---&amp;gt;  Extracting codeblocks&lt;br /&gt;
---&amp;gt;  Applying patches to codeblocks&lt;br /&gt;
---&amp;gt;  Configuring codeblocks&lt;br /&gt;
---&amp;gt;  Building codeblocks with target all&lt;br /&gt;
---&amp;gt;  Staging codeblocks into destroot&lt;br /&gt;
---&amp;gt;  Packaging tgz archive for codeblocks 1.0_0+macosx&lt;br /&gt;
---&amp;gt;  Installing codeblocks 1.0_0+macosx&lt;br /&gt;
---&amp;gt;  Activating codeblocks 1.0_0+macosx&lt;br /&gt;
---&amp;gt;  Cleaning codeblocks&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&lt;br /&gt;
sudo port clean codeblocks&lt;br /&gt;
sudo port install codeblocks&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;+macosx&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/DarwinPorts/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;DarwinPorts&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 --prefix=/opt/local&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Running &amp;lt;tt&amp;gt;+puredarwin&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 --prefix=/opt/local&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There is also a wxGTK startup command in &amp;quot;DarwinPorts&amp;quot;,&lt;br /&gt;
that will first start up X11.app and then launch C::B:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
open /Applications/DarwinPorts/CodeBlocks.command&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Afb</name></author>
	</entry>
	<entry>
		<id>https://wiki.codeblocks.org/index.php?title=Installing_Code::Blocks_from_source_on_RPM_based_distributions&amp;diff=4480</id>
		<title>Installing Code::Blocks from source on RPM based distributions</title>
		<link rel="alternate" type="text/html" href="https://wiki.codeblocks.org/index.php?title=Installing_Code::Blocks_from_source_on_RPM_based_distributions&amp;diff=4480"/>
		<updated>2007-03-05T11:02:56Z</updated>

		<summary type="html">&lt;p&gt;Afb: /* Non-root rpmbuild environment (recommended) */&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;
&lt;br /&gt;
== Install Requirements ==&lt;br /&gt;
&lt;br /&gt;
Note: Code::Blocks requires GTK+ 2.x. Older distributions might only support GTK+ 1.x.&lt;br /&gt;
&lt;br /&gt;
=== Install Development Tools ===&lt;br /&gt;
&lt;br /&gt;
This has to be installed before starting:&lt;br /&gt;
* zip&lt;br /&gt;
* update-desktop-files (only on SUSE)&lt;br /&gt;
* make&lt;br /&gt;
* gettext&lt;br /&gt;
* autoconf &amp;gt;= 2.5&lt;br /&gt;
* automake &amp;gt;= 1.7&lt;br /&gt;
* libtool &amp;gt;= 1.4&lt;br /&gt;
* m4&lt;br /&gt;
* intltool&lt;br /&gt;
* gcc-c++&lt;br /&gt;
* libstdc++-devel&lt;br /&gt;
&lt;br /&gt;
In Fedora/CentOS, this can be done with:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
su -c 'yum groupinstall &amp;quot;Development Tools&amp;quot;'&lt;br /&gt;
su -c 'yum install intltool'&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Install newer autotools versions (if needed) ====&lt;br /&gt;
&lt;br /&gt;
If you have CentOS 3 or RHEL 3, you will need to rebuild &amp;quot;automake17&amp;quot; to use instead of automake-1.6:&lt;br /&gt;
* ftp://ftp.redhat.com/pub/redhat/linux/enterprise/4/en/os/i386/SRPMS/automake17-1.7.9-5.src.rpm&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
rpmbuild --rebuild automake17-1.7.9-5.src.rpm&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then you need to invoke bootstrap like this, both on the commandline and in codeblocks.spec:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
AUTOMAKE=automake-1.7 ACLOCAL=aclocal-1.7 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;
=== Setup RPM environment ===&lt;br /&gt;
&lt;br /&gt;
This has to be installed before starting:&lt;br /&gt;
* rpm-build&lt;br /&gt;
&lt;br /&gt;
The top work directory for RPM varies between distributions and setups, but you can find your RPM top dir by setting a variable like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
RPM_TOPDIR=`rpm --eval %{_topdir}`&lt;br /&gt;
echo $RPM_TOPDIR&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Non-root rpmbuild environment (recommended) ====&lt;br /&gt;
&lt;br /&gt;
It is recommended that you don't use the root account to build packages, here is how you set up a minimal user build environment:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd&lt;br /&gt;
mkdir rpm&lt;br /&gt;
echo &amp;quot;%_topdir $HOME/rpm&amp;quot; &amp;gt;&amp;gt; .rpmmacros&lt;br /&gt;
mkdir /tmp/$USER/rpm&lt;br /&gt;
echo &amp;quot;%_tmppath /tmp/$USER/rpm&amp;quot; &amp;gt;&amp;gt; .rpmmacros&lt;br /&gt;
cd rpm&lt;br /&gt;
mkdir SPECS SOURCES BUILD RPMS SRPMS&lt;br /&gt;
RPM_TOPDIR=`rpm --eval %{_topdir}`&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can now build packages without being root (assuming that the spec files are correct). You will still need root access to install.&lt;br /&gt;
&lt;br /&gt;
=== Install wxWidgets 2.6.x ===&lt;br /&gt;
&lt;br /&gt;
The build requirements in the source RPM are set to a minimum. So it isn't checked whether wxGTK is installed or not. So you have to take a look at it yourself.&lt;br /&gt;
&lt;br /&gt;
This has to be installed:&lt;br /&gt;
# wxGTK &amp;gt;= 2.6.0 and its devel package (see [http://wxwidgets.org wxwidgets.org])&lt;br /&gt;
# wxGTK-xrc and its devel package (in some distributions included in the packages of point 1)&lt;br /&gt;
&lt;br /&gt;
In later Fedora, this can be done with:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
su -c 'yum install wxGTK-devel'&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Build the wxGTK RPM from source (if needed) ====&lt;br /&gt;
&lt;br /&gt;
TODO&lt;br /&gt;
&lt;br /&gt;
* http://prdownloads.sourceforge.net/wxwindows/wxGTK-2.6.3.tar.gz&lt;br /&gt;
* ftp://biolpc22.york.ac.uk/pub/2.6.3/wxWidgets-2.6.3-Patch-2.tar.gz&lt;br /&gt;
* http://www.algonet.se/~afb/wx/wxGTK.spec&lt;br /&gt;
&lt;br /&gt;
RPMS&lt;br /&gt;
&lt;br /&gt;
* wx-base-unicode-2.6.3.0.2-1.i386.rpm&lt;br /&gt;
* wx-base-unicode-devel-2.6.3.0.2-1.i386.rpm&lt;br /&gt;
* wx-gtk2-unicode-2.6.3.0.2-1.i386.rpm&lt;br /&gt;
* wx-gtk2-unicode-devel-2.6.3.0.2-1.i386.rpm&lt;br /&gt;
* wx-gtk2-unicode-gl-2.6.3.0.2-1.i386.rpm&lt;br /&gt;
* wx-gtk2-unicode-contrib-2.6.3.0.2-1.i386.rpm&lt;br /&gt;
* wx-gtk2-unicode-contrib-devel-2.6.3.0.2-1.i386.rpm&lt;br /&gt;
* wx-gtk2-unicode-debuginfo-2.6.3.0.2-1.i386.rpm&lt;br /&gt;
* wx-i18n-2.6.3.0.2-1.i386.rpm&lt;br /&gt;
&lt;br /&gt;
=== Install Subversion client ===&lt;br /&gt;
&lt;br /&gt;
This has to be installed before starting:&lt;br /&gt;
* subversion &amp;gt;= 1.4.0, (see [http://subversion.tigris.org subversion.tigris.org])&lt;br /&gt;
&lt;br /&gt;
Binary packages for Red Hat Linux 9, Fedora Core 1, CentOS 3, CentOS 4 at:&lt;br /&gt;
&lt;br /&gt;
http://the.earth.li/pub/subversion/summersoft.fay.ar.us/pub/subversion/latest/&lt;br /&gt;
&lt;br /&gt;
In later Fedora, this can be done with:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
su -c 'yum install subversion'&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Build Subversion RPM from source (if needed) ====&lt;br /&gt;
&lt;br /&gt;
TODO&lt;br /&gt;
&lt;br /&gt;
* http://subversion.tigris.org/downloads/subversion-1.4.2.tar.gz&lt;br /&gt;
* packages/rpm/rhel-3/subversion.spec (CentOS 3)&lt;br /&gt;
* packages/rpm/rhel-4/subversion.spec (CentOS 4)&lt;br /&gt;
&lt;br /&gt;
RPMS&lt;br /&gt;
&lt;br /&gt;
* subversion-1.4.2-1.i386.rpm&lt;br /&gt;
* subversion-devel-1.4.2-1.i386.rpm&lt;br /&gt;
* subversion-perl-1.4.2-1.i386.rpm&lt;br /&gt;
* subversion-python-1.4.2-1.i386.rpm&lt;br /&gt;
* subversion-tools-1.4.2-1.i386.rpm&lt;br /&gt;
* subversion-debuginfo-1.4.2-1.i386.rpm&lt;br /&gt;
&lt;br /&gt;
== Install Code::Blocks ==&lt;br /&gt;
&lt;br /&gt;
=== Download the Source RPM ===&lt;br /&gt;
&lt;br /&gt;
1. Download the Source RPM from [https://www.codeblocks.org/downloads.shtml www.codeblocks.org/downloads.shtml]&lt;br /&gt;
&lt;br /&gt;
==== Prepare SRPM package from SVN (if needed) ====&lt;br /&gt;
&lt;br /&gt;
1. You need to get the latest sources from SVN [https://www.codeblocks.org/source_code.shtml www.codeblocks.org/source_code.shtml]&lt;br /&gt;
&lt;br /&gt;
2. go into ''trunk'', if you haven't already done it.&lt;br /&gt;
&lt;br /&gt;
3. run these three commands in this order&lt;br /&gt;
 ./bootstrap&lt;br /&gt;
 ./configure --enable-contrib&lt;br /&gt;
 make dist&lt;br /&gt;
the last one will create a .tar.gz archive that contains the sources.&lt;br /&gt;
&lt;br /&gt;
4. copy the archive to the directory $RPM_TOPDIR/SOURCES &lt;br /&gt;
 sudo mv codeblocks-trunk-r$REVISION.tar.gz $RPM_TOPDIR/SOURCES&lt;br /&gt;
&lt;br /&gt;
5. build the source RPM, or copy spec to $RPM_TOPDIR/SPECS&lt;br /&gt;
 rpmbuild -bs codeblocks.spec&lt;br /&gt;
&lt;br /&gt;
This will create a source package in the directory $RPM_TOPDIR/SRPMS/.&lt;br /&gt;
&lt;br /&gt;
=== Build the RPM package ===&lt;br /&gt;
&lt;br /&gt;
1. Build the binary package&lt;br /&gt;
 rpmbuild --rebuild codeblocks-1.0*.src.rpm&lt;br /&gt;
&lt;br /&gt;
This will create several packages in one of the architecture specific subdirectories (i386, x86_64, ppc, ...) of $RPM_TOPDIR/RPMS/.&lt;br /&gt;
&lt;br /&gt;
These are:&lt;br /&gt;
* codeblocks: main package&lt;br /&gt;
* codeblocks-contrib: contrib plugins&lt;br /&gt;
* codeblocks-devel: SDK headers&lt;br /&gt;
* codeblocks-debuginfo: stripped debug information&lt;br /&gt;
&lt;br /&gt;
=== Install the RPM package ===&lt;br /&gt;
&lt;br /&gt;
Install as root the packages you want (usually codeblocks and codeblocks-contrib) and enjoy Code::Blocks!&lt;/div&gt;</summary>
		<author><name>Afb</name></author>
	</entry>
</feed>