1#!/bin/bash 2################################################## 3# aMule.app bundle creator. # 4################################################## 5 6## This file is part of the aMule Project 7## 8## Copyright (c) 2004-2011 Angel Vidal ( kry@amule.org ) 9## Copyright (c) 2003-2011 aMule Team ( http://www.amule-project.net ) 10## 11## This program is free software; you can redistribute it and/or 12## modify it under the terms of the GNU General Public License 13## as published by the Free Software Foundation; either 14## version 2 of the License, or (at your option) any later version. 15## 16## This program is distributed in the hope that it will be useful, 17## but WITHOUT ANY WARRANTY; without even the implied warranty of 18## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19## GNU General Public License for more details. 20## 21## You should have received a copy of the GNU General Public License 22## along with this program; if not, write to the Free Software 23## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA 24 25SRC_FOLDER=$1 26 27 28if [ -z $SRC_FOLDER ]; then 29 SRC_FOLDER="./" 30fi 31 32echo "" 33echo -n "Step 1: Cleaning bundle... " 34rm aMule.app/Contents/Frameworks/libwx_* aMule.app/Contents/MacOS/* 1> /dev/null 2> /dev/null 35rm -r aMule.app/Contents/Resources/webserver 1> /dev/null 2> /dev/null 36rm -r aMule.app/Contents/SharedSupport 1> /dev/null 2> /dev/null 37echo "Done" 38echo "" 39echo -n "Step 2: Copying aMule to app bundle... " 40cp ${SRC_FOLDER}/src/amule aMule.app/Contents/MacOS/ 41cp ${SRC_FOLDER}/src/webserver/src/amuleweb aMule.app/Contents/MacOS/ 42cp ${SRC_FOLDER}/src/ed2k aMule.app/Contents/MacOS/ 43cp ${SRC_FOLDER}/src/amulecmd aMule.app/Contents/MacOS/ 44cp ${SRC_FOLDER}/platforms/MacOSX/aMule-Xcode/amule.icns aMule.app/Contents/Resources/ 45cp -R ${SRC_FOLDER}/src/webserver aMule.app/Contents/Resources 46find aMule.app/Contents/Resources/webserver \( -name .svn -o -name "Makefile*" -o -name src \) -print0 | xargs -0 rm -rf 47echo "Done" 48echo "" 49echo -n "Step 3: Installing translations to app bundle... " 50orig_dir=`pwd` 51pushd ${SRC_FOLDER}/po 52make install datadir=$orig_dir/aMule.app/Contents/SharedSupport 1> /dev/null 2> /dev/null 53popd 54echo "Done" 55echo "" 56echo "Step 4: Copying libs to Framework" 57echo " wxWidgets..." 58# wxWidgets libs to frameworks 59for i in $( otool -L aMule.app/Contents/MacOS/amule \ 60 aMule.app/Contents/MacOS/amuleweb \ 61 aMule.app/Contents/MacOS/ed2k \ 62 aMule.app/Contents/MacOS/amulecmd \ 63 | sort -u | grep libwx_ | cut -d " " -f 1 ); do 64 cp $i aMule.app/Contents/Frameworks; 65done 66echo "Libs copy done." 67echo "" 68echo "Step 5: Update libs info" 69#then install_name_tool on them to fix the path on the shared lib 70pushd aMule.app/Contents/ 71for i in $( ls Frameworks | grep -v CVS); do 72 echo " Updating $i" 73 #update library id 74 install_name_tool -id @executable_path/../Frameworks/$i Frameworks/$i 75 #update library links 76 for j in $( otool -L Frameworks/$i | grep libwx_ | cut -d " " -f 1 ); do 77 install_name_tool -change \ 78 $j @executable_path/../Frameworks/`echo $j | rev | cut -d "/" -f 1 | rev` \ 79 Frameworks/$i 1> /dev/null 2> /dev/null 80 81 done 82 echo " Updating aMule lib info for $i" 83 #update amule executable 84 install_name_tool -change \ 85 `otool -L MacOS/amule | grep $i | cut -d " " -f 1` \ 86 @executable_path/../Frameworks/$i MacOS/amule 1> /dev/null 2> /dev/null 87 install_name_tool -change \ 88 `otool -L MacOS/amuleweb | grep $i | cut -d " " -f 1` \ 89 @executable_path/../Frameworks/$i MacOS/amuleweb 1> /dev/null 2> /dev/null 90 install_name_tool -change \ 91 `otool -L MacOS/ed2k | grep $i | cut -d " " -f 1` \ 92 @executable_path/../Frameworks/$i MacOS/ed2k 1> /dev/null 2> /dev/null 93 install_name_tool -change \ 94 `otool -L MacOS/amulecmd | grep $i | cut -d " " -f 1` \ 95 @executable_path/../Frameworks/$i MacOS/amulecmd 1> /dev/null 2> /dev/null 96done 97echo "Libs info updated, aMule.app is ready to package." 98echo "" 99popd 100echo -n "Creating aMule.zip... " 101zip -9 -r aMule.zip aMule.app/ > /dev/null 102zip -9 -j ${SRC_FOLDER}/docs/README.Mac.txt ${SRC_FOLDER}/docs/COPYING > /dev/null 103echo "Done" 104echo "" 105