Menu

[r13166]: / branches / release-17.12 / src / mac_pack  Maximize  Restore  History

Download this file

180 lines (168 with data), 10.4 kB

THE_ROOT=/Users/martin/Documents/CodeBlocks_src/src
APP_ROOT=$THE_ROOT/CodeBlocks.app
CONT_ROOT=$APP_ROOT/Contents
MACOS_ROOT=$CONT_ROOT/MacOS
RES_ROOT=$CONT_ROOT/Resources
BIN_ROOT=$THE_ROOT/output
SHR_ROOT=$BIN_ROOT/share/codeblocks
LIB_ROOT=$THE_ROOT/devel
ICO_ROOT=$THE_ROOT/src/resources/icons
WX_ROOT=/usr/lib
PLIST_ROOT=$THE_ROOT/build_tools

echo Removing old App package...
if [ -d "$APP_ROOT" ]
then
  rm -r $APP_ROOT
fi
echo Making directories...
mkdir -p $APP_ROOT
mkdir -p $MACOS_ROOT
mkdir -p $RES_ROOT
mkdir -p $RES_ROOT/share/codeblocks

echo MAC root is $MACOS_ROOT
echo WX  root is $WX_ROOT
echo BIN root is $BIN_ROOT
echo SHR root is $SHR_ROOT
echo LIB root is $LIB_ROOT

echo Copying files...
cp -f $PLIST_ROOT/Info.plist        $CONT_ROOT
cp -f $WX_ROOT/libwx_macu-2.8.dylib $MACOS_ROOT
cp -f $BIN_ROOT/codeblocks          $MACOS_ROOT/CodeBlocks
cp -f $BIN_ROOT/cb_console_runner   $MACOS_ROOT
# Optional executables:
if [ -f "$BIN_ROOT/cb_share_config" ]
then
  cp -f $BIN_ROOT/cb_share_config   $MACOS_ROOT
fi
if [ -f "$BIN_ROOT/codesnippets" ]
then
  cp -f $BIN_ROOT/codesnippets      $MACOS_ROOT
fi
# all libs (including the ones processed below)
cp -f $LIB_ROOT/*.dylib $MACOS_ROOT

echo Running install_name_tool...
install_name_tool -id                                   @executable_path/libwx_macu-2.8.dylib     $MACOS_ROOT/libwx_macu-2.8.dylib
install_name_tool -id                                   @executable_path/libcodeblocks.dylib      $MACOS_ROOT/libcodeblocks.dylib
install_name_tool -id                                   @executable_path/libwxpropgrid.dylib      $MACOS_ROOT/libwxpropgrid.dylib
install_name_tool -id                                   @executable_path/libwxsmithlib.dylib      $MACOS_ROOT/libwxsmithlib.dylib
if [ -f "$MACOS_ROOT/libwxchartctrl.dylib" ]
then
  install_name_tool -id                                 @executable_path/libwxchartctrl.dylib     $MACOS_ROOT/libwxchartctrl.dylib
fi
if [ -f "$MACOS_ROOT/libwxcustombutton.dylib" ]
then
  install_name_tool -id                                 @executable_path/libwxcustombutton.dylib  $MACOS_ROOT/libwxcustombutton.dylib
fi
if [ -f "$MACOS_ROOT/libwxflatnotebook.dylib" ]
then
  install_name_tool -id                                 @executable_path/libwxflatnotebook.dylib  $MACOS_ROOT/libwxflatnotebook.dylib
fi
if [ -f "$MACOS_ROOT/libwximagepanel.dylib" ]
then
  install_name_tool -id                                 @executable_path/libwximagepanel.dylib    $MACOS_ROOT/libwximagepanel.dylib
fi
if [ -f "$MACOS_ROOT/libwxkwic.dylib" ]
then
  install_name_tool -id                                 @executable_path/libwxkwic.dylib          $MACOS_ROOT/libwxkwic.dylib
fi
if [ -f "$MACOS_ROOT/libwxled.dylib" ]
then
  install_name_tool -id                                 @executable_path/libwxled.dylib           $MACOS_ROOT/libwxled.dylib
fi
if [ -f "$MACOS_ROOT/libwxspeedbutton.dylib" ]
then
  install_name_tool -id                                 @executable_path/libwxspeedbutton.dylib   $MACOS_ROOT/libwxspeedbutton.dylib
fi
if [ -f "$MACOS_ROOT/libwxtreelist.dylib" ]
then
  install_name_tool -id                                 @executable_path/libwxtreelist.dylib      $MACOS_ROOT/libwxtreelist.dylib
fi

install_name_tool -change $WX_ROOT/libwx_macu-2.8.0.dylib @executable_path/libwx_macu-2.8.dylib   $MACOS_ROOT/CodeBlocks
install_name_tool -change $LIB_ROOT/libcodeblocks.dylib   @executable_path/libcodeblocks.dylib    $MACOS_ROOT/CodeBlocks
install_name_tool -change devel/libcodeblocks.dylib       @executable_path/libcodeblocks.dylib    $MACOS_ROOT/CodeBlocks
install_name_tool -change $LIB_ROOT/libwxpropgrid.dylib   @executable_path/libwxpropgrid.dylib    $MACOS_ROOT/CodeBlocks
install_name_tool -change devel/libwxpropgrid.dylib       @executable_path/libwxpropgrid.dylib    $MACOS_ROOT/CodeBlocks

if [ -f "$MACOS_ROOT/codesnippets" ]
then
  install_name_tool -change $WX_ROOT/libwx_macu-2.8.0.dylib @executable_path/libwx_macu-2.8.dylib $MACOS_ROOT/codesnippets
  install_name_tool -change $LIB_ROOT/libcodeblocks.dylib   @executable_path/libcodeblocks.dylib  $MACOS_ROOT/codesnippets
  install_name_tool -change devel/libcodeblocks.dylib       @executable_path/libcodeblocks.dylib  $MACOS_ROOT/codesnippets
  install_name_tool -change $LIB_ROOT/libwxsmithlib.dylib   @executable_path/libwxsmithlib.dylib  $MACOS_ROOT/codesnippets
  install_name_tool -change devel/libwxpropgrid.dylib       @executable_path/libwxpropgrid.dylib  $MACOS_ROOT/codesnippets
fi

if [ -f "$MACOS_ROOT/cb_share_config" ]
then
  install_name_tool -change $WX_ROOT/libwx_macu-2.8.0.dylib @executable_path/libwx_macu-2.8.dylib $MACOS_ROOT/cb_share_config
  install_name_tool -change $LIB_ROOT/libcodeblocks.dylib   @executable_path/libcodeblocks.dylib  $MACOS_ROOT/cb_share_config
  install_name_tool -change devel/libcodeblocks.dylib       @executable_path/libcodeblocks.dylib  $MACOS_ROOT/cb_share_config
  install_name_tool -change $LIB_ROOT/libwxpropgrid.dylib   @executable_path/libwxpropgrid.dylib  $MACOS_ROOT/cb_share_config
  install_name_tool -change devel/libwxpropgrid.dylib       @executable_path/libwxpropgrid.dylib  $MACOS_ROOT/cb_share_config
fi

echo Looping lib*.dylib files in MacOS...
for dy_lib in $MACOS_ROOT/lib*.dylib
do
  install_name_tool -change $WX_ROOT/libwx_macu-2.8.0.dylib @executable_path/libwx_macu-2.8.dylib $dy_lib
  install_name_tool -change $LIB_ROOT/libcodeblocks.dylib   @executable_path/libcodeblocks.dylib  $dy_lib
  install_name_tool -change devel/libcodeblocks.dylib       @executable_path/libcodeblocks.dylib  $dy_lib
  install_name_tool -change $LIB_ROOT/libwxpropgrid.dylib   @executable_path/libwxpropgrid.dylib  $dy_lib
  install_name_tool -change devel/libwxpropgrid.dylib       @executable_path/libwxpropgrid.dylib  $dy_lib
done

echo Copying shared files...
cp -fR $SHR_ROOT/       $RES_ROOT/share/codeblocks
echo Copying icons...
cp -f  $ICO_ROOT/*.icns $RES_ROOT

echo Looping *.dylib files...
# This is actually a bug in plugin manager:
# Under MacOS it does not look into the plugin folder, but codeblocks.
# So move the plugins to a place where they will be found
#mv $RES_ROOT/share/codeblocks/plugins/*.dylib $RES_ROOT/share/codeblocks
#for dy_lib in $RES_ROOT/share/codeblocks/*.dylib
for dy_lib in $RES_ROOT/share/codeblocks/plugins/*.dylib
do
#  echo Processing $dy_lib
  install_name_tool -change $WX_ROOT/libwx_macu-2.8.0.dylib        @executable_path/libwx_macu-2.8.dylib    $dy_lib
  install_name_tool -change $LIB_ROOT/libcodeblocks.dylib          @executable_path/libcodeblocks.dylib     $dy_lib
  install_name_tool -change devel/libcodeblocks.dylib              @executable_path/libcodeblocks.dylib     $dy_lib
  install_name_tool -change ../../../devel/libcodeblocks.dylib     @executable_path/libcodeblocks.dylib     $dy_lib
  install_name_tool -change $LIB_ROOT/libwxpropgrid.dylib          @executable_path/libwxpropgrid.dylib     $dy_lib
  install_name_tool -change devel/libwxpropgrid.dylib              @executable_path/libwxpropgrid.dylib     $dy_lib
  install_name_tool -change ../../../devel/libwxpropgrid.dylib     @executable_path/libwxpropgrid.dylib     $dy_lib
  install_name_tool -change $LIB_ROOT/libwxsmithlib.dylib          @executable_path/libwxsmithlib.dylib     $dy_lib
  install_name_tool -change devel/libwxsmithlib.dylib              @executable_path/libwxsmithlib.dylib     $dy_lib
  install_name_tool -change ../../../devel/libwxsmithlib.dylib     @executable_path/libwxsmithlib.dylib     $dy_lib
  install_name_tool -change $LIB_ROOT/libwxchartctrl.dylib         @executable_path/libwxchartctrl.dylib    $dy_lib
  install_name_tool -change devel/libwxchartctrl.dylib             @executable_path/libwxchartctrl.dylib    $dy_lib
  install_name_tool -change ../../../devel/libwxchartctrl.dylib    @executable_path/libwxchartctrl.dylib    $dy_lib
  install_name_tool -change $LIB_ROOT/libwxcustombutton.dylib      @executable_path/libwxcustombutton.dylib $dy_lib
  install_name_tool -change devel/libwxcustombutton.dylib          @executable_path/libwxcustombutton.dylib $dy_lib
  install_name_tool -change ../../../devel/libwxcustombutton.dylib @executable_path/libwxcustombutton.dylib $dy_lib
  install_name_tool -change $LIB_ROOT/libwxflatnotebook.dylib      @executable_path/libwxflatnotebook.dylib $dy_lib
  install_name_tool -change devel/libwxflatnotebook.dylib          @executable_path/libwxflatnotebook.dylib $dy_lib
  install_name_tool -change ../../../devel/libwxflatnotebook.dylib @executable_path/libwxflatnotebook.dylib $dy_lib
  install_name_tool -change $LIB_ROOT/libwximagepanel.dylib        @executable_path/libwximagepanel.dylib   $dy_lib
  install_name_tool -change devel/libwximagepanel.dylib            @executable_path/libwximagepanel.dylib   $dy_lib
  install_name_tool -change ../../../devel/libwximagepanel.dylib   @executable_path/libwximagepanel.dylib   $dy_lib
  install_name_tool -change $LIB_ROOT/libwxkwic.dylib              @executable_path/libwxkwic.dylib         $dy_lib
  install_name_tool -change devel/libwxkwic.dylib                  @executable_path/libwxkwic.dylib         $dy_lib
  install_name_tool -change ../../../devel/libwxkwic.dylib         @executable_path/libwxkwic.dylib         $dy_lib
  install_name_tool -change $LIB_ROOT/libwxled.dylib               @executable_path/libwxled.dylib          $dy_lib
  install_name_tool -change devel/libwxled.dylib                   @executable_path/libwxled.dylib          $dy_lib
  install_name_tool -change ../../../devel/libwxled.dylib          @executable_path/libwxled.dylib          $dy_lib
  install_name_tool -change $LIB_ROOT/libwxspeedbutton.dylib       @executable_path/libwxspeedbutton.dylib  $dy_lib
  install_name_tool -change devel/libwxspeedbutton.dylib           @executable_path/libwxspeedbutton.dylib  $dy_lib
  install_name_tool -change ../../../devel/libwxspeedbutton.dylib  @executable_path/libwxspeedbutton.dylib  $dy_lib
  install_name_tool -change $LIB_ROOT/libwxtreelist.dylib          @executable_path/libwxtreelist.dylib     $dy_lib
  install_name_tool -change devel/libwxtreelist.dylib              @executable_path/libwxtreelist.dylib     $dy_lib
  install_name_tool -change ../../../devel/libwxtreelist.dylib     @executable_path/libwxtreelist.dylib     $dy_lib
done

THE_ROOT=
APP_ROOT=
CONT_ROOT=
MACOS_ROOT=
RES_ROOT=
BIN_ROOT=
SHR_ROOT=
LIB_ROOT=
ICO_ROOT=
WX_ROOT=
PLIST_ROOT=
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.