Difference between revisions of "Installing Code::Blocks from source on Mac OS X"
m |
|||
Line 26: | Line 26: | ||
http://www.gnu.org/software/gdb/ | http://www.gnu.org/software/gdb/ | ||
http://www.gnu.org/software/make/ | http://www.gnu.org/software/make/ | ||
+ | |||
+ | Note: 2006/04 | ||
+ | Apple pulled all the old links in order to promote Mac OS X 10.4, but all the | ||
+ | old developer tools can be downloaded from ADC at http://connect.apple.com/ | ||
+ | |||
+ | You need a (free) developer registration with Apple first, in order to log in there. | ||
+ | For Mac OS X 10.3, you want Xcode 1.5. For Mac OS X 10.1-10.2, latest Dev Tools. | ||
== Check Autotools versions == | == Check Autotools versions == |
Revision as of 18:46, 4 April 2006
These are instructions on how to build Code::Blocks under Apple Mac OS X.
They have been tested under Mac OS X version 10.3, but should work under
Mac OS X 10.4 (PowerPC and Intel) and old Mac OS X 10.2 and 10.1 as well.
We will be building everything from scratch using the source code, and not use any available package managers like DarwinPorts, Fink, Gentoo or RPM. Packaging can be done later, once it has reached a more stable release.
Install Xcode Tools
If they didn't come bundled with Mac OS X, get the Xcode Tools (or Developer Tools for older Mac OS X) from:
This will install Apple versions of:
http://www.gnu.org/software/gcc/ http://www.gnu.org/software/gdb/ http://www.gnu.org/software/make/
Note: 2006/04 Apple pulled all the old links in order to promote Mac OS X 10.4, but all the old developer tools can be downloaded from ADC at http://connect.apple.com/
You need a (free) developer registration with Apple first, in order to log in there. For Mac OS X 10.3, you want Xcode 1.5. For Mac OS X 10.1-10.2, latest Dev Tools.
Check Autotools versions
Depending on your OS version, you might need to download and compile new versions of these:
http://www.gnu.org/software/autoconf/ http://www.gnu.org/software/automake/ http://www.gnu.org/software/libtool/
Currently Code::Blocks requires versions:
- autoconf 2.50+
- automake 1.7+
- libtool 1.4+
Check what you have, with --version (note that GNU libtool is called glibtool on Mac)
Build wxWidgets 2.6
Download the Mac release
http://wxwidgets.org/dl_mac2.htm
Configure and (GNU) Make
./configure --enable-shared --enable-monolithic --with-opengl --with-mac \ --with-png=builtin --with-tiff=builtin --with-jpeg=builtin && make
Install into Destination
sudo make install
Install Subversion client
Build CodeBlocks from SVN
Download the source code
https://www.codeblocks.org/source_code.shtml
Bootstrap with Autotools
glibtoolize --force --copy && \ aclocal-1.7 && \ autoheader && \ automake-1.7 --include-deps --add-missing --foreign --copy && \ autoconf
Configure and (GNU) Make
./configure && make
Install into Destination
sudo make install
Bundle application for Mac
After building codeblocks in the regular Unix way, you need to bundle it with the icons and various other info that it needs to make a regular stand-alone Macintosh application.
There are two ways of accomplishing this, old Mac OS-style resource or NeXT-style bundle. The old resources are handy while developing, while bundles are more suitable for release.
Way 1. Mac OS (resource)
http://developer.apple.com/documentation/Carbon/Reference/Resource_Manager/
Handy while developing, as you only need to add an icon.
Files needed:
- http://www.algonet.se/~afb/wx/CodeBlocks.r.gz (Rez icon, gzipped)
First we install the program to the PREFIX directory of your choice:
$PREFIX/bin $PREFIX/lib $PREFIX/share/codeblocks
Add a custom icon to the application, and make it receive events:
gunzip CodeBlocks.r.gz sudo /Developer/Tools/Rez -d __DARWIN__ -t APPL -d __WXMAC__ \ CodeBlocks.r Carbon.r -o $PREFIX/bin/codeblocks sudo /Developer/Tools/SetFile -a C $PREFIX/bin/codeblocks
Without the icon part, this could also have be written as just:
sudo `wx-config --rezflags` $PREFIX/bin/codeblocks
Start the application with a small prefix shell wrapper like this:
DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:$PREFIX/lib export DYLD_LIBRARY_PATH $PREFIX/bin/codeblocks --prefix=$PREFIX
Way 2. NeXT (bundle)
http://developer.apple.com/documentation/CoreFoundation/Conceptual/CFBundles/
This does not involve resources, and is more relocatable.
Files needed:
- http://www.algonet.se/~afb/wx/CodeBlocks.Info.plist
- http://www.algonet.se/~afb/wx/CodeBlocks.sh (shell wrapper)
- http://www.algonet.se/~afb/wx/CodeBlocks.icns (Mac OS X icon)
The MacOS program will just be a shell wrapper that calls "bin/codeblocks", like above. Traditionally the bundle would include Frameworks and Resources, but we'll just avoid those here and use the regular "lib" and "share/codeblocks" instead (just as with a regular install).
Setup a hierarchy like this, and copy the files from the regular build/install and the above file list to it:
CodeBlocks.app CodeBlocks.app/Contents/ CodeBlocks.app/Contents/Info.plist CodeBlocks.app/Contents/MacOS/ CodeBlocks.app/Contents/MacOS/CodeBlocks CodeBlocks.app/Contents/Resources/ CodeBlocks.app/Contents/Resources/CodeBlocks.icns CodeBlocks.app/Contents/bin/ CodeBlocks.app/Contents/lib/ CodeBlocks.app/Contents/share/codeblocks/
The CodeBlocks application can now be moved with the Finder, and started up like a regular Mac application.