Developer forums (C::B DEVELOPMENT STRICTLY!) > Development
Mac OS development
afb:
--- 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?
--- End quote ---
Sent as a PM, haven't gotten time to update it for wxContribItems just yet.
roxlu:
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!
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.
--- Code: ---#!/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
--- End code ---
Roxlu
Navigation
[0] Message Index
[*] Previous page
Go to full version