Developer forums (C::B DEVELOPMENT STRICTLY!) > Development
Some scripts to build C::B on Mac OSX Snow Leopard
PaulNavin:
Hi guys!
This is my first ever post, so I apologise for anything I mess up! But here are some scripts I've created to help me build and package C::B under Mac OSX Snow Leopard. They pull together a whole bunch of stuff from various bits of the Wiki and forums.
(1) Builds WxWidgets.
(2) Checks out/updates C::B and builds it.
(3) Bundles C::B into a proper Snow Leopard application.
The scripts make a few assumptions:
- You want to build C::B for 32 bit Mac OSX Snow Leopard with WxWidgets 2.8.12, for Unicode, with all plugins.
- You run all the scripts from the same directory.
- Script (1) creates a subdirectory "Dependencies" and builds WxWidgets there.
- Script (2) creates a subdirectory "Source" and checks out/updates and builds C::B there.
- Script (3) creates a subdirectory "Output" and bundles the app there.
- You download the file wxMac-2.8.12.tar.gz and put it in the same directory as the scripts before you start.
- You know the password for root (sudo is used for make install).
The scripts aren't perfect, there are a couple of hacks:
- There is a pause in the building of C::B to add a line to the configure.in file for m4_include[wxwin.m4].
- Maybe this should be checked into Subversion?
- All the plugins are built and not all of them always compile properly.
- FileManager, NassiShneiderman and Hunspell all seem to be broken on mine, so you might have to comment some stuff out.
If you have any comments/suggestions for improvement, please let me know! I'm hoping to do a bit of development on Mac in the coming few months, so any advice is very welcome. :-)
Cheers,
- Paul.
Script 1 (1_BuildAndInstallWxWidgets.sh):
--- Code: ---#!/bin/sh
if [ ! -d ./Dependencies ]
then
mkdir Dependencies
mv wxMac-2.8.12.tar.gz ./Dependencies
fi
cd Dependencies
tar xvf wxMac-2.8.12.tar.gz
cd wxMac-2.8.12
# For Mac OS X 10.5 or older or with a 32-bit processor, build Carbon like this:
mkdir build-carbon-debug
cd build-carbon-debug
arch_flags="-arch i386"
../configure --enable-shared --enable-monolithic --enable-unicode --with-mac --with-opengl --with-png=builtin --with-jpeg=builtin --with-tiff=builtin --with-expat=builtin CFLAGS="$arch_flags" CXXFLAGS="$arch_flags" CPPFLAGS="$arch_flags" LDFLAGS="$arch_flags" OBJCFLAGS="$arch_flags" OBJCXXFLAGS="$arch_flags"
make;
sudo make install
--- End code ---
Script 2 (2_GetAndBuildCodeBlocks.sh):
--- Code: ---#!/bin/sh
if [ ! -d ./Source ]
then
mkdir Source
fi
cd Source
if [ ! -d ./trunk ]
then
# Checkout SVN
svn checkout svn://svn.berlios.de/codeblocks/trunk
cd trunk
else
# Update SVN
cd trunk
svn update
fi
cp ../../Dependencies/wxMac-2.8.12/wxwin.m4 .
echo -----------------------------------------------------------
echo "Please add the following to your trunk/configure.in file:"
echo
echo " - After the line m4_include([revision.m4]), add:"
echo " m4_include([wxwin.m4])"
echo
echo "Once you have added this, press any key to continue..."
read
# Add m4_include[wxwin.m4] to configure.in.
ACLOCAL_FLAGS="-I /usr/share/aclocal"
./bootstrap
arch_flags="-arch i386"
./configure --with-contrib-plugins=all --enable-shared --enable-monolithic --enable-unicode --with-mac --with-opengl --with-png=builtin --with-jpeg=builtin --with-tiff=builtin --with-expat=builtin CFLAGS="$arch_flags" CXXFLAGS="$arch_flags" CPPFLAGS="$arch_flags" LDFLAGS="$arch_flags" OBJCFLAGS="$arch_flags" OBJCXXFLAGS="$arch_flags"
make
sudo make install
--- End code ---
Script 3 (3_BundleCodeBlocks.sh):
--- Code: ---#!/bin/sh
echo ===== Making Bundle Directories =====
mkdir ./Output
cd Output
mkdir ./CodeBlocksSVN.app
mkdir ./CodeBlocksSVN.app/Contents
mkdir ./CodeBlocksSVN.app/Contents/MacOS
mkdir ./CodeBlocksSVN.app/Contents/Resources
mkdir ./CodeBlocksSVN.app/Contents/Resources/share
mkdir ./CodeBlocksSVN.app/Contents/Resources/share/codeblocks
mkdir ./CodeBlocksSVN.app/Contents/Resources/lib
mkdir ./CodeBlocksSVN.app/Contents/Resources/lib/codeblocks
mkdir ./CodeBlocksSVN.app/Contents/Resources/English.lproj
echo ===== Copying Built Files =====
cp /usr/local/bin/codeblocks ./CodeBlocksSVN.app/Contents/MacOS/CodeBlocks
cp /usr/local/bin/cb_share_config ./CodeBlocksSVN.app/Contents/MacOS
cp /usr/local/bin/cb_console_runner ./CodeBlocksSVN.app/Contents/MacOS
cp /usr/local/bin/codesnippets ./CodeBlocksSVN.app/Contents/MacOS
cp /usr/local/lib/libwxsmithlib.0.dylib ./CodeBlocksSVN.app/Contents/MacOS
cp /usr/local/lib/libwx_macu-2.8.0.dylib ./CodeBlocksSVN.app/Contents/MacOS
cp /usr/local/lib/libcodeblocks.0.dylib ./CodeBlocksSVN.app/Contents/MacOS
echo ===== Copying Resources From Source =====
# Most of this section has been copied from the Wiki:http://wiki.wxwidgets.org/WxMac_Issues#Building_a_MacOSX_application_bundle
# I don't know how much of it is necessary though.
#cp /Applications/CodeBlocks.app/Contents/Info.plist ./CodeBlocksSVN.app/Contents/
cp ../Source/trunk/codeblocks.plist ./CodeBlocksSVN.app/Contents/Info.plist
# cp version.plist YourApp.app/Contents/
# cp InfoPlist.strings YourApp.app/Contents/Resources/English.lproj/
# echo -n 'APPL????' > YourApp.app/Contents/PkgInfo
# cp YourApp YourApp.app/Contents/MacOS/YourApp
cp ../Source/trunk/src/src/resources/icons/* ./CodeBlocksSVN.app/Contents/Resources/
echo ===== Doing install_name_tool stuff =====
install_name_tool -id @executable_path/libcodeblocks.0.dylib ./CodeBlocksSVN.app/Contents/MacOS/libcodeblocks.0.dylib
install_name_tool -id @executable_path/libwx_macu-2.8.0.dylib ./CodeBlocksSVN.app/Contents/MacOS/libwx_macu-2.8.0.dylib
install_name_tool -id @executable_path/libwxsmithlib.0.dylib ./CodeBlocksSVN.app/Contents/MacOS/libwxsmithlib.0.dylib
install_name_tool -change /usr/local/lib/libcodeblocks.0.dylib @executable_path/libcodeblocks.0.dylib ./CodeBlocksSVN.app/Contents/MacOS/CodeBlocks
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
install_name_tool -change /usr/local/lib/libwxsmithlib.0.dylib @executable_path/libwxsmithlib.0.dylib ./CodeBlocksSVN.app/Contents/MacOS/CodeBlocks
install_name_tool -change /usr/local/lib/libcodeblocks.0.dylib @executable_path/libcodeblocks.0.dylib ./CodeBlocksSVN.app/Contents/MacOS/codesnippets
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
install_name_tool -change /usr/local/lib/libwxsmithlib.0.dylib @executable_path/libwxsmithlib.0.dylib ./CodeBlocksSVN.app/Contents/MacOS/codesnippets
install_name_tool -change /usr/local/lib/libcodeblocks.0.dylib @executable_path/libcodeblocks.0.dylib ./CodeBlocksSVN.app/Contents/MacOS/cb_share_config
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
install_name_tool -change /usr/local/lib/libwxsmithlib.0.dylib @executable_path/libwxsmithlib.0.dylib ./CodeBlocksSVN.app/Contents/MacOS/cb_share_config
install_name_tool -change /usr/local/lib/libcodeblocks.0.dylib @executable_path/libcodeblocks.0.dylib ./CodeBlocksSVN.app/Contents/MacOS/cb_console_runner
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
install_name_tool -change /usr/local/lib/libwxsmithlib.0.dylib @executable_path/libwxsmithlib.0.dylib ./CodeBlocksSVN.app/Contents/MacOS/cb_console_runner
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
install_name_tool -change /usr/local/lib/libwxsmithlib.0.dylib @executable_path/libwxsmithlib.0.dylib ./CodeBlocksSVN.app/Contents/MacOS/libcodeblocks.0.dylib
install_name_tool -change /usr/local/lib/libcodeblocks.0.dylib @executable_path/libcodeblocks.0.dylib ./CodeBlocksSVN.app/Contents/MacOS/libwxsmithlib.0.dylib
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
echo ===== Finished install_name_tool stuff =====
cp -R /usr/local/share/codeblocks/ ./CodeBlocksSVN.app/Contents/Resources/share/codeblocks
cp -R /usr/local/lib/codeblocks/ ./CodeBlocksSVN.app/Contents/Resources/share/codeblocks
for dotso in ./CodeBlocksSVN.app/Contents/Resources/share/codeblocks/plugins/*.so
do
#echo $dotso
install_name_tool -change /usr/local/lib/libcodeblocks.0.dylib @executable_path/libcodeblocks.0.dylib $dotso
install_name_tool -change /usr/local/lib/libwx_macu-2.8.0.dylib @executable_path/libwx_macu-2.8.0.dylib $dotso
install_name_tool -change /usr/local/lib/libwxsmithlib.0.dylib @executable_path/libwxsmithlib.0.dylib $dotso
done
--- End code ---
MortenMacFly:
--- Quote from: PaulNavin on August 08, 2011, 03:42:57 pm ---If you have any comments/suggestions for improvement, please let me know! I'm hoping to do a bit of development on Mac in the coming few months, so any advice is very welcome. :-)
--- End quote ---
Well, I don't have a Mac and I cannot try, but thanks a bunch, that is definitely a good source for Mac'ers. :D
If you want to, you could also create an article in the WiKi with the same content, so that this doesn't get lost.
Ceniza:
Nice contribution, but it fails compiling wxWidgets in Lion :(
--- Quote ---../include/wx/mac/carbon/private.h: In function ‘Rect* wxMacGetPictureBounds(Picture**, Rect*)’:
../include/wx/mac/carbon/private.h:1375: error: ‘QDGetPictureBounds’ was not declared in this scope
../include/wx/mac/carbon/private.h: At global scope:
../include/wx/mac/carbon/private.h:1459: error: ‘Cursor’ does not name a type
../include/wx/mac/carbon/private.h:1488: error: ‘ClassicCursor’ does not name a type
make: *** [monodll_dynlib.o] Error 1
--- End quote ---
Looks like an issue to be solved by the wxWidgets guys.
PaulNavin:
Thanks guys! :-)
Sorry, I've only tried it in Snow Leopard, I don't have Lion yet.
I'll add a Wiki entry soon with the scripts and try and explain what they do. I'm just going through at the moment and working out how to build it for debug as well. Then hopefully I can start sorting out some of the crashes. :-) I'd like to keep contributing on the Mac side, but it depends on how much time I have here at work. ;-) I've been programming on Windows for the last 10 years and have only just started on Mac, so everything's taking me a while, but I'll get there... :-)
Cheers,
-Paul.
Calexus:
Didn't work for me. Codeblocks can't find any plugins and complains about the compiler plugin not being available. No plugins listed in the "Manage plugins" dialog so I guess none were built or cb cant find them. Haven't had time to investigate, yet, but I'm running 10.6.8 if thats any help. I don't think I did anything stupid, followed the descriptions in the first post.
Navigation
[0] Message Index
[#] Next page
Go to full version