Hi,
I want to help with the development of Code::Blocks on Mac osx. I've been using
Code::Blocks on windows for a while and I just love it. Though on Mac it's not really
stable. As I'll be developing a lot on a Mac (I recently switched over totally) I want
to start fixing some things.
I'm wondering if there is someone else, hopefully the lead developer, with whom I can
start this. I've been downloading the SVN trunk a couple of times this week and each
time I try to compile it on my Mac the compilation breaks at some point. Most of these
errors are because of Mac related issues with wxWidgets. I've been able to fix most
of them and got it compiled.
I would love to help and create a compilable version of the trunk on MacOS. I'm often on
irc, so just msg me when you've got some time or to make an appointment to fix some things!
Roxlu
Quote from: roxlu on January 24, 2010, 11:27:54 PM
I want to help with the development of Code::Blocks on Mac osx.
That is
great news! A user with the nickname "afb" (http://forums.next.codeblocks.org/index.php?action=profile;u=1384) in this forum may help you with starting. Any patches concerning MAC are welcome and will be prioritised (as most of the core team does not have a MAC). Hence please make sure you follow our code style and comment what and why you changed so we can understand and don't remove it in the code later again. ;-) Also (if possible) cross-check your modifications with another OS (Windows or Linux), hence it's not a must as other people can do that, too.
The build procedure is outlined, although a bit outdated on the Wiki:
Installing_Code::Blocks_from_source_on_Mac_OS_X (http://wiki.codeblocks.org/index.php?title=Installing_Code::Blocks_from_source_on_Mac_OS_X)
That page should be updated for Mac OS X 10.6 and wxWidgets 2.8,
as it's currently covering 10.4 and 2.6. No major differences, though.
Basically it's just ./configure && make just like everywhere else...
I haven't used C::B to rebuild itself, although that is a possibility ?
PS. Most people do have a MAC (http://en.wikipedia.org/wiki/MAC_address), even if not everyone has a Mac. ;-)
I won't get started on the OSX name, other than that I don't use it.
Quote from: afb on January 25, 2010, 09:19:38 AM
PS. Most people do have a MAC (http://en.wikipedia.org/wiki/MAC_address), even if not everyone has a Mac. ;-)
Right. :lol:
Quote from: roxlu on January 24, 2010, 11:27:54 PM
I'm wondering if there is someone else, hopefully the lead developer, with whom I can
start this. I've been downloading the SVN trunk a couple of times this week and each
time I try to compile it on my Mac the compilation breaks at some point. Most of these
errors are because of Mac related issues with wxWidgets. I've been able to fix most
of them and got it compiled.
I'm not aware of any major compilation issues, other than that
you need to use wxMac and
-m32 rather than wxCocoa and
-m64.
But any bug reports or code patches are most welcome, as always...
(Some bugs are on http://developer.berlios.de/bugs/?group_id=5358)
Hi afb,
I want to create a development environment like this:
codeblocks_dev\wxwidgets_svn
codeblocks_dev\codeblocks_svn
and link codeblocks_svn against the wxwdigets_svn. I've tried to use the wxWidgets trunk but that did not work. I used this configure command:
./configure --enable-shared --enable-monolithic --enable-unicode --with-osx_cocoa --with-png=builtin --with-jpeg=builtin --with-tiff=builtin --with-expat=builtin/configure --enable-shared --enable-monolithic --enable-unicode --with-osx_cocoa --with-png=builtin --with-jpeg=builtin --with-tiff=builtin --with-expat=builtin --prefix=/Users/roxlu/Documents/programming/c++/codeblocks_dev/wxwidgets_svn/wxwidgets_build
Now, I want to build C::B against this wxwidgets compilation. But each time I tried I got different errors (from redefinition to incorrent function arguments). The errors I got were probably due to the fact I used the latest svn from wxWidgets. Do you have any idea how I can build C::B against a custom compiled wxWidgets?
Roxlu
Quote from: roxlu on January 25, 2010, 10:21:41 AM
Hi afb,
I want to create a development environment like this:
codeblocks_dev\wxwidgets_svn
codeblocks_dev\codeblocks_svn
and link codeblocks_svn against the wxwdigets_svn. I've tried to use the wxWidgets trunk but that did not work. I used this configure command:
./configure --enable-shared --enable-monolithic --enable-unicode --with-osx_cocoa --with-png=builtin --with-jpeg=builtin --with-tiff=builtin --with-expat=builtin/configure --enable-shared --enable-monolithic --enable-unicode --with-osx_cocoa --with-png=builtin --with-jpeg=builtin --with-tiff=builtin --with-expat=builtin --prefix=/Users/roxlu/Documents/programming/c++/codeblocks_dev/wxwidgets_svn/wxwidgets_build
Now, I want to build C::B against this wxwidgets compilation. But each time I tried I got different errors (from redefinition to incorrent function arguments). The errors I got were probably due to the fact I used the latest svn from wxWidgets. Do you have any idea how I can build C::B against a custom compiled wxWidgets?
Roxlu
wxWidgets trunk is not (yet) compatible with C::B.
You have to use wxWidgets 2.8 .
Okay nice! I'll try that tonight!
Quote from: roxlu on January 25, 2010, 10:21:41 AM
The errors I got were probably due to the fact I used the latest svn from wxWidgets.
Yes, "wrong" version (3.0) and "wrong" platform (wxOSX/Cocoa) of wxWidgets...
I suppose you could have used the
WX_2_8_BRANCH in the svn too, but not the trunk.
You'll need 2.8 and wxMac for Code::Blocks to work "out of the box". Otherwise
it (and deps) needs updating to support the newer version and the new platform.
First it needs to be made to work against the (preliminary) API of the 2.9 versions,
and then it needs something like:
#if defined(__WXMAC__) || defined(__WXCOCOA__)PS. Note that wxMac only works in 32-bit mode, which is what I was saying above.
Not a major problem, as GUI doesn't need 64-bit and wxCocoa is in an "alpha" stage.
It's
possible to make a Code::Blocks version that works with 2.9.0 wxCocoa as well,
but there are more important and useful things to add to the Mac OS X version I think ?
Hi afb!
Thanks for your reply! Tonight I'll try and get a compilation working!
And indeed there are more important things to fix! I'm not sure, but I noticed some
shortcut key differences but I'll look into that.
Roxlu
Hi Afb,
I've tried to compile codeblocks against the wxWidgets 2.8 trunk but I get some errors.
I've compiled wxWidgets 2.8 w/o problems and used this configure:
./configure --enable-shared \
--enable-monolithic \
--enable-unicode \
--with-png=builtin \
--with-jpeg=builtin \
--with-tiff=builtin \
--with-expat=builtin/configure \
--enable-shared \
--enable-monolithic \
--enable-unicode \
--with-mac \
--with-expat=builtin \
--prefix=/Users/roxlu/Documents/programming/c++/codeblocks_with_wxidgets28/wxwidets_from_svn/build/ \
CFLAGS="-arch i386" CXXFLAGS="-arch i386" CPPFLAGS="-arch i386" \
LDFLAGS="-arch i386" OBJCFLAGS="-arch i386" OBJCXXFLAGS="-arch i386"
I configured Code::Blocks using:
./configure --prefix=${PWD}/build --with-wxdir=../wxwidets_from_svn/build/ --with-wx-config=../wxwidets_from_svn/build/bin/wx-config CFLAGS="-arch i386" CXXFLAGS="-arch i386" CPPFLAGS="-arch i386" LDFLAGS="-arch i386" OBJCFLAGS="-arch i386" OBJCXXFLAGS="-arch i386"
But I got this error:
/bin/sh ../../../libtool --tag=CXX --mode=compile g++ -DHAVE_CONFIG_H -I. -I../../../src/include -I/Users/roxlu/Documents/programming/c++/codeblocks_with_wxidgets28/wxwidets_from_svn/build//lib/wx/include/mac-unicode-release-2.8 -I/Users/roxlu/Documents/programming/c++/codeblocks_with_wxidgets28/wxwidets_from_svn/build//include/wx-2.8 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -D__WXMAC__ -I./include -I./src/scintilla/include -I./src/scintilla/src -DSCI_LEXER -DLINK_LEXERS -DGTK -D__WX__ -arch i386 -Ulinux -Uunix -O2 -ffast-math -DCB_AUTOCONF -arch i386 -DCB_PRECOMP -Winvalid-pch -fPIC -DPIC -fexceptions -MT ScintillaWX.lo -MD -MP -MF .deps/ScintillaWX.Tpo -c -o ScintillaWX.lo `test -f 'src/ScintillaWX.cpp' || echo './'`src/ScintillaWX.cpp
libtool: compile: g++ -DHAVE_CONFIG_H -I. -I../../../src/include -I/Users/roxlu/Documents/programming/c++/codeblocks_with_wxidgets28/wxwidets_from_svn/build//lib/wx/include/mac-unicode-release-2.8 -I/Users/roxlu/Documents/programming/c++/codeblocks_with_wxidgets28/wxwidets_from_svn/build//include/wx-2.8 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -D__WXMAC__ -I./include -I./src/scintilla/include -I./src/scintilla/src -DSCI_LEXER -DLINK_LEXERS -DGTK -D__WX__ -arch i386 -Ulinux -Uunix -O2 -ffast-math -DCB_AUTOCONF -arch i386 -DCB_PRECOMP -Winvalid-pch -fPIC -DPIC -fexceptions -MT ScintillaWX.lo -MD -MP -MF .deps/ScintillaWX.Tpo -c src/ScintillaWX.cpp -fno-common -DPIC -o .libs/ScintillaWX.o
In file included from src/ScintillaWX.cpp:31:
./src/scintilla/src/ExternalLexer.h:72: error: field 'm_sModuleName' has incomplete type
make[3]: *** [ScintillaWX.lo] Error 1
make[2]: *** [all-recursive] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all-recursive] Error 1
Scintilla?
The m_sModuleName is defined/used in:
src/sdk/wxscintilla/src/scintilla/src/ExternalLexer.cxx: m_sModuleName = ModuleName;
src/sdk/wxscintilla/src/scintilla/src/ExternalLexer.h: std::string m_sModuleName;
Any suggestions?
Quote from: roxlu on January 25, 2010, 11:12:11 PM
Any suggestions?
Place:
#include <string>on top of the
ExternalLexer.h file. Just before these lines:
#ifdef SCI_NAMESPACE
namespace Scintilla {
#endif
This should work. BTW: I've resolved many of such compiler errors in scintilla. If this works, please tell me and I'll apply it in trunk.
Quote from: MortenMacFly on January 26, 2010, 06:57:03 AM
If this works, please tell me and I'll apply it in trunk.
Fix works for me.
There's another error in infowindow.h, but that's another story.
../../../../src/include/infowindow.h:29: error: 'wxScrollingDialog' does not name a type
Missing an
#include "scrollingdialog.h". But these are "generic",
and not specific to the Mac OS X build or to the wxMac platform...
Quote from: afb on January 26, 2010, 09:03:51 AM
Quote from: MortenMacFly on January 26, 2010, 06:57:03 AM
If this works, please tell me and I'll apply it in trunk.
Fix works for me.
There's another error in infowindow.h, but that's another story.
../../../../src/include/infowindow.h:29: error: 'wxScrollingDialog' does not name a type
Missing an #include "scrollingdialog.h". But these are "generic",
and not specific to the Mac OS X build or to the wxMac platform...
There might be some more of the missing, if compiled without precompiled-headers, I try to find the missing includes and fix it.
If you use pch on mac, try to delete them manually and see if it works.
Not a pch-problem, but caused if wxUSE_POPUPWIN is not defined.
Should be fixed in svn r6115.
Quote from: jens on January 26, 2010, 09:16:08 AM
If you use pch on mac, try to delete them manually and see if it works.
Precompiled headers is the default, yes, unless using
--disable-pch.
(There's also an old bug that it keeps the .gch files in the
source dir,
instead of in the proper
build directories but I've patched that locally
as I'm doing Universal Binary builds and thus doing more than one build)
But it built with these modifications:
Index: src/sdk/wxscintilla/src/scintilla/src/ExternalLexer.h
===================================================================
--- src/sdk/wxscintilla/src/scintilla/src/ExternalLexer.h (revision 6113)
+++ src/sdk/wxscintilla/src/scintilla/src/ExternalLexer.h (arbetskopia)
@@ -14,6 +14,8 @@
#define EXT_LEXER_DECL
#endif
+#include <string>
+
#ifdef SCI_NAMESPACE
namespace Scintilla {
#endif
Index: src/include/infowindow.h
===================================================================
--- src/include/infowindow.h (revision 6113)
+++ src/include/infowindow.h (arbetskopia)
@@ -26,6 +26,7 @@
#include <wx/popupwin.h>
typedef wxPopupWindow wxInfoWindowBase;
#else
+ #include "scrollingdialog.h"
typedef wxScrollingDialog wxInfoWindowBase;
#endif
Index: src/plugins/contrib/wxSmith/propgrid/Makefile.am
===================================================================
--- src/plugins/contrib/wxSmith/propgrid/Makefile.am (revision 6113)
+++ src/plugins/contrib/wxSmith/propgrid/Makefile.am (arbetskopia)
@@ -1,4 +1,5 @@
INCLUDES = $(WX_CXXFLAGS) \
+ -I$(top_srcdir)/src/include \
-I$(srcdir)/contrib/include
AM_CPPFLAGS = -DWXMAKINGLIB_PROPGRID -DwxPG_USE_WXMODULE=0
Index: src/plugins/contrib/wxSmith/propgrid/contrib/src/propgrid/odcombo.cpp
===================================================================
--- src/plugins/contrib/wxSmith/propgrid/contrib/src/propgrid/odcombo.cpp (revision 6113)
+++ src/plugins/contrib/wxSmith/propgrid/contrib/src/propgrid/odcombo.cpp (arbetskopia)
@@ -104,6 +104,7 @@
#else
#undef USE_TRANSIENT_POPUP
#define USE_TRANSIENT_POPUP 0
+ #include "scrollingdialog.h"
#endif
// For versions < 2.6.2, don't enable transient popup. There may be
Quote from: afb on January 26, 2010, 10:00:57 AM
But it built with these modifications:
...
Jens and I have committed the modification to trunk. Can you please try again?
Hi Jens and others!
I finally build Codeblocks from source on a Mac 10.6.2!
1)
Though it can't get focus when I run it which is a wxWidgets problem because I did not create a bundle for my codeblocks executable yet. I'm reading about bundles but am I correct when I say that I can but libraries in the codeblocks.app/Contents/MacOS dir? And I've also seen the comment about this on http://wiki.codeblocks.org/index.php?title=Installing_Code::Blocks_from_source_on_Mac_OS_X#FYI:_Universal_Binaries where they use the install_name_tool. Now I'm wondering what this install_name_tool actually does and if there is a build/make script which does this for you in the Code::Blocks repository?
- snip -
2)
I just copied some things and created my own codeblocks.app directory and now I can run codeblocks!
Though it still crashes when I try to open the File > New Project wizard. I haven't used the install_name_tool and Code::Blocks still runs, why?
3)
And in the CodeBlocks.app file I downloaded from www.codeblocks.org there are some Icon files in the bundle. Are they part of the repository?
Roxlu
Quote from: roxlu on January 26, 2010, 10:11:38 PM
I haven't used the install_name_tool and Code::Blocks still runs, why?
Because all the paths exists under your local machine. AFAIR, the install_name_tool replaces the replaces the hard coded absolute path with something like
(Assuming you copies the dylib to be located under the same path as the exe)
install_name_tool -change /some/abs/path/wx-some-dylib @executable_path/wx-some-dylib ${file}but since you compiled the binary on your machine the absolute paths will work OK as well - but they will probably fail on another Mac machine
Eran
Quote from: roxlu on January 26, 2010, 10:11:38 PM
Hi Jens and others!
I finally build Codeblocks from source on a Mac 10.6.2!
Congratulations :-) As you might have noticed I'm using the 10.4u SDK for portability.
Quote
1)
Though it can't get focus when I run it which is a wxWidgets problem because I did not create a bundle for my codeblocks executable yet. I'm reading about bundles but am I correct when I say that I can but libraries in the codeblocks.app/Contents/MacOS dir?
Yeah, this is a generic problem with Mac OS X and not something specific to wxWidgets. For instance when you are running a Python program that wants an Aqua graphic user interface you have to use "pythonw" (which is a symlink into such a bundle) rather than just "python" which is a regular program. There's some hacks around it (as noted on the Wiki page), but the "easiest" (only supported) way is to make an app bundle. BTW, it should be called "CodeBlocks.app" as you are now allowed case sensitivity...
Quote
And I've also seen the comment about this on http://wiki.codeblocks.org/index.php?title=Installing_Code::Blocks_from_source_on_Mac_OS_X#FYI:_Universal_Binaries where they use the install_name_tool. Now I'm wondering what this install_name_tool actually does and if there is a build/make script which does this for you in the Code::Blocks repository?
The
install_name_tool part is so that it can run from /Developer/Applications or ~/Applications or wherever the user wants it, instead of having to be installed under
/usr/local which is hidden by the Finder and thus most users. There is a build script that does it, but not in the repository (yet) - at least not the latest version. I'll try to put it up after the next "nightly", when I've fixed some extra helper libraries needed by wxSmith.
Quote
- snip -
2)
I just copied some things and created my own codeblocks.app directory and now I can run codeblocks!
Though it still crashes when I try to open the File > New Project wizard. I haven't used the install_name_tool and Code::Blocks still runs, why?
Presumably it can still find some things in
/usr/local ? You'll need to copy the resources into the bundle, though.
Quote
3)
And in the CodeBlocks.app file I downloaded from www.codeblocks.org there are some Icon files in the bundle. Are they part of the repository?
The icons are hidden under
./src/src/resources/*.icns. They need to be located in Resources in the app bundle.
Hi afb,
Thanks for your clear answer! Could you maybe share the script witch creates the bundle?
Though i'm not sure if I can use it as I'm compiling against a local (as in same directory and not the default installation in /usr/local/...) wxWidgets installation. If I understood it correctly I can use the install_name_tool to tell MacOS to use the libs in the MacOS directory of application bundle?
Thanks
roxlu
Quote from: roxlu on January 27, 2010, 07:12:46 PM
Thanks for your clear answer! Could you maybe share the script witch creates the bundle?
Will do, just have to clear it up a bit for general use and add the wxSmithContribItems directory...
QuoteThough i'm not sure if I can use it as I'm compiling against a local (as in same directory and not the default installation in /usr/local/...) wxWidgets installation. If I understood it correctly I can use the install_name_tool to tell MacOS to use the libs in the MacOS directory of application bundle?
Sure, I can change it to use two different prefixes for wxWidgets and for Code::Blocks, if needed.
Currently I'm using
/usr/local for all the "
before", but it does use
@executable_path for the "
after"...
Then Mac OS X will replace this magic string with the current value for the executable's directory.
This is similar to using
GetModuleFilename on Windows or BinReloc (http://www.autopackage.org/docs/binreloc/) on Linux, to make relocatable apps.
Hi Afb!
Great! I cant wait to try out your script! Then I'll finally have a nice clean build environment for C::B on Mac! I think
lot's of people will enjoy using the newest version from SVN! I'm using the openFrameworks libraries (www.openframeworks.cc) which has a quite big community. Most of the users of openFrameworks will love a stable C::B on Mac!
Roxlu
Afb, could you maybe upload the script which creates the CodeBlocks.app file for Mac?
Hi everyone!
I'm almost done with compiling Code::Blocks from svn (so from source and the latest version) from mac and create an application bundle form it. There are still two strange things :
1) When I compile C::B against my custom build of wxWidgets 2.8, and everything is ready, I see,using "otool -L bin/codeblocks" that the libwx_macu_**.dylib to which is linked is / usr/local/lib/libwx_macu... which is strange as I specified '--with-wxdir' and '--with-wx-config' to be pointing to my custom build.
2) Although C::B links to my system installation of wxWidgets I can run C::B w/o problems. The only thing which is strange, is that when I want to create a new project, I don't see any projects (or icons) in the project type selection window. Why is that?
Thanks,
Roxlu
Quote from: roxlu on January 30, 2010, 10:37:23 AM
Afb, could you maybe upload the script which creates the CodeBlocks.app file for Mac?
Sent as a PM, haven't gotten time to update it for wxContribItems just yet.
Hi everyone!,
I finally finished the script I was working on. When you run it, you'll be asked a couple of questions. You need to download the svn versions of codeblocks and wxwidgets once before you can do anything.
It will compile wxWidgets for Mac 10.6 (with XCode installed previously) and C::B with all plugins (this will take a while). When everyting has been build it will create an application bundle and reset all the dynamic link locations using install_name_tool.
There is only one tiny thing left. When I try to create a new project, there are no projects to select from? (no icons maybe??)
update: Everything works now! I've got all the plugins!
(http://i50.tinypic.com/ek251j.png)
The script can be found here:
note that it's create for my needs and needs to be tested/tweaked when other people want to use it.
#!/bin/sh
#set -x
root_dir=${PWD}
if [ -d wxwidgets_svn ]
then
read -p "Remove wxWidgets 2.8 directory to start clean install? [y/n]: " continue
if test "${continue}" == "y" ; then
rm -r wxwidgets_svn
mkdir wxwidgets_svn
fi
else
mkdir wxwidgets_svn
fi
if [ -d codeblocks_svn ]
then
read -p "Remove CodeBlocks directory to start clean install? [y/n]: " continue
if test "${continue}" == "y"; then
rm -r codeblocks_svn
mkdir codeblocks_svn
fi
else
mkdir codeblocks_svn
fi
read -p "Download CodeBlocks from svn? [y/n]: " continue
if test "${continue}" == "y"; then
cd codeblocks_svn
svn co http://svn.berlios.de/svnroot/repos/codeblocks/trunk .
cd ..
fi
read -p "Download wxWidgets 2.8 from svn? [y/n]: " continue
if test "${continue}" == "y"; then
cd wxwidgets_svn
svn co http://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH .
fi
#------------------------- wxWidgets ---------------------------------------
read -p "Configure wxWidgets 2.8? [y/n]: " continue
if test "${continue}" == "y"; then
if [ ! -d ${root_dir}/wxwidgets_svn ]; then
echo "No wxWidgets directory found"
exit
fi
cd ${root_dir}/wxwidgets_svn
if [ -d build_custom ]; then
rm -r build_custom
fi
mkdir build_custom
cd build_custom
./../configure --enable-shared \
--enable-monolithic \
--enable-unicode \
--with-png=builtin \
--with-jpeg=builtin \
--with-tiff=builtin \
--with-expat=builtin/configure \
--enable-shared \
--enable-monolithic \
--enable-unicode \
--with-mac \
--with-expat=builtin \
CFLAGS="-arch i386" CXXFLAGS="-arch i386" CPPFLAGS="-arch i386" \
LDFLAGS="-arch i386" OBJCFLAGS="-arch i386" OBJCXXFLAGS="-arch i386"
fi
read -p "Compile wxWidgets 2.8 [y/n]: " continue
if test "${continue}" == "y"; then
cd ${root_dir}/wxwidgets_svn/build_custom
make
fi
read -p "Bootstrap Code::Blocks [y/n]: " continue
if test "${continue}" == "y"; then
cd ${root_dir}/codeblocks_svn
./bootstrap
fi
read -p "Configure Code::Blocks [y/n]: " continue
if test "${continue}" == "y"; then
if [ ! -d ${root_dir}/codeblocks_svn ]; then
echo "No CodeBlocks directory found"
exit
fi
cd ${root_dir}/codeblocks_svn
if [ -d custom_build ]; then
rm -r custom_build
fi
mkdir custom_build
cd custom_build
./../configure \
--prefix=${root_dir}/codeblocks_svn/custom_build/ \
--with-wxdir=./../../wxwidgets28_from_svn/custom_build/ \
CFLAGS="-arch i386" CXXFLAGS="-arch i386" \
CPPFLAGS="-arch i386" LDFLAGS="-arch i386" \
OBJCFLAGS="-arch i386" \
OBJCXXFLAGS="-arch i386" \
--with-contrib-plugins=all \
--enable-static \
--enable-debug \
--with-macosx \
--with-wxdir=${root_dir}/wxwidgets_svn/build_custom/ \
--with-wx-config=${root_dir}/wxwidgets_svn/build_custom/wx-config \
--with-wx-prefix=${root_dir}/wxwidgets_svn/build_custom/
fi
read -p "Compile and make Code::Blocks [y/n]: " continue
if test "${continue}" == "y"; then
cd ${root_dir}/codeblocks_svn/custom_build
make
fi
read -p "Create CodeBlocks.app bundle? [y/n]: " continue
if test "${continue}" == "y"; then
if [ -d ${root_dir}/app/CodeBlocks.app ]; then
read -p "An Codeblocks.app bundle already exists, remove first? [y/n]: " continue
if test "${continue}" == "y"; then
rm -r ${root_dir}/app/CodeBlocks.app
fi
fi
app_dir=${root_dir}/app/CodeBlocks.app
cb_dir=${root_dir}/codeblocks_svn
wx_dir=${root_dir}/wxwidgets_svn
mkdir -p ${app_dir}/Contents/MacOS
mkdir -p ${app_dir}/Contents/Resources/share/codeblocks
cp ${cb_dir}/custom_build/codeblocks.plist ${app_dir}/Contents/Info.plist
cp ${cb_dir}/src/src/resources/icons/*.icns ${app_dir}/Contents/Resources/
cp -r ${cb_dir}/custom_build/share/codeblocks/* ${app_dir}/Contents/Resources/share/codeblocks/
cp ${cb_dir}/custom_build/bin/codeblocks ${app_dir}/Contents/MacOS/CodeBlocks
cp ${cb_dir}/custom_build/lib/libcodeblocks.0.dylib ${app_dir}/Contents/MacOS/
cp ${cb_dir}/custom_build/lib/libwxsmithlib.0.dylib ${app_dir}/Contents/MacOS/
cp ${wx_dir}/build_custom/lib/libwx_macu-2.8.0.dylib ${app_dir}/Contents/MacOS/
chmod 777 ${app_dir}/Contents/MacOS/CodeBlocks
fi
read -p "Change dynamic lib paths? [y/n]: " continue
if test "${continue}" == "y"; then
# copy the plugins
cd ${root_dir}/codeblocks_svn/custom_build/src/plugins
mkdir -p ${root_dir}/app/CodeBlocks.app/Contents/Resources/share/codeblocks/plugins/
for dir in `find -type d . -mindepth 1 -maxdepth 1`; do
name=${dir##*/}
plugin=${root_dir}/codeblocks_svn/custom_build/src/plugins/${name}/.libs/lib${name}.so
if [ -f ${plugin} ]; then
cp ${plugin} ${root_dir}/app/CodeBlocks.app/Contents/Resources/share/codeblocks/
fi
done
cd ${root_dir}/app/CodeBlocks.app/Contents
install_name_tool -id @executable_path/libcodeblocks.0.dylib MacOS/libcodeblocks.0.dylib
install_name_tool -id @executable_path/libwxsmith.0.dylib MacOS/libwxsmithlib.0.dylib
install_name_tool -change ${root_dir}/codeblocks_svn/custom_build/lib/libcodeblocks.0.dylib @executable_path/libcodeblocks.0.dylib MacOS/CodeBlocks
install_name_tool -change ${root_dir}/codeblocks_svn/custom_build//lib/libcodeblocks.0.dylib @executable_path/libcodeblocks.0.dylib MacOS/CodeBlocks
install_name_tool -change /usr/local/lib/libcodeblocks.0.dylib @executable_path/libcodeblocks.0.dylib 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 MacOS/CodeBlocks
install_name_tool -change /usr/local/lib/libwx_macu-2.8.0.dylib @executable_path/libwx_macu-2.8.0.dylib MacOS/libcodeblocks.0.dylib
install_name_tool -change /usr/local/lib/libwx_macu-2.8.0.dylib @executable_path/libwx_macu-2.8.0.dylib MacOS/libwxsmithlib.0.dylib
for so in Resources/share/codeblocks/*.so; do
libcodeblocks=$(otool -L ${so} | grep libcodeblocks)
libcodeblocks=${libcodeblocks%%(*}
install_name_tool -change ${libcodeblocks} @executable_path/libcodeblocks.0.dylib ${so}
libwxsmith=$(otool -L ${so} | grep libwxsmithlib)
libwxsmith=${libwxsmith%%(*}
if test "${libwxsmith}" != ""; then
install_name_tool -change ${libwxsmith} @executable_path/libwxsmithlib.0.dylib ${so}
fi
libwx=$(otool -L ${so} | grep libwx_macu)
libwx=${libwx%%(*}
if test "${libwx}" != ""}; then
install_name_tool -change ${libwx} @executable_path/libwx_macu-2.8.0.dylib ${so}
fi
#install_name_tool -change /usr/local/lib/libcodeblocks.0.dylib @executable_path/libcodeblocks.0.dylib ${so}
#install_name_tool -change /usr/local/lib/libwxsmithlib.0.dylib @executable_path/libwxsmithlib.0.dylib ${so}
#install_name_tool -change /usr/local/lib/libwx_macu-2.8.0.dylib @executable_path/libwx_macu-2.8.0.dylib ${so}
done
fi
Roxlu