| 1 | #!/bin/bash |
| 2 | |
| 3 | # Helper script to run generation of CBP/XCode projects on Linux / OS X. |
| 4 | # Running it requires that Tcl should be in the PATH |
| 5 | |
| 6 | anOldPath="$PATH" |
| 7 | anOldLd="$LD_LIBRARY_PATH" |
| 8 | anOldDyLd="$DYLD_LIBRARY_PATH" |
| 9 | |
| 10 | # go to the script directory |
| 11 | aScriptPath=${BASH_SOURCE%/*}; if [ -d "${aScriptPath}" ]; then cd "$aScriptPath"; fi; aScriptPath="$PWD"; |
| 12 | |
| 13 | aSystem=`uname -s` |
| 14 | aTarget="$1" |
| 15 | anOpt2=$2 |
| 16 | anOpt3=$3 |
| 17 | anOpt4=$4 |
| 18 | anOpt5=$5 |
| 19 | if [ "$aTarget" == "" ]; then |
| 20 | aTarget="cbp" |
| 21 | if [ "$aSystem" == "Darwin" ]; then aTarget="xcd"; fi; |
| 22 | fi |
| 23 | |
| 24 | if [ ! -e "${aScriptPath}/custom.sh" ]; then |
| 25 | tclsh "${aScriptPath}/adm/genconf.tcl" |
| 26 | fi |
| 27 | |
| 28 | if [ ! -e "${aScriptPath}/custom.sh" ]; then |
| 29 | echo custom.sh is not created. Run the script again and generate custom.sh |
| 30 | exit 1 |
| 31 | fi |
| 32 | source "${aScriptPath}/custom.sh" |
| 33 | |
| 34 | if [ -e "${aScriptPath}/env.sh" ]; then source "${aScriptPath}/env.sh"; fi |
| 35 | |
| 36 | tclsh "${aScriptPath}/adm/genproj.tcl" -path="${aScriptPath}" -target=${aTarget} $anOpt2 $anOpt3 $anOpt4 $anOpt5 |
| 37 | |
| 38 | export PATH="$anOldPath" |
| 39 | export LD_LIBRARY_PATH="$anOldLd" |
| 40 | export DYLD_LIBRARY_PATH="$anOldDyLd" |