| 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 | if [ ! -e "${aScriptPath}/env.sh" ]; then |
| 13 | cat ${aScriptPath}/adm/templates/env.sh | sed -e '/__CASROOT__/d' > ${aScriptPath}/env.sh |
| 14 | fi |
| 15 | |
| 16 | aSystem=`uname -s` |
| 17 | aTarget="$1" |
| 18 | anOpt2=$2 |
| 19 | anOpt3=$3 |
| 20 | anOpt4=$4 |
| 21 | anOpt5=$5 |
| 22 | if [ "$aTarget" == "" ]; then |
| 23 | aTarget="cbp" |
| 24 | if [ "$aSystem" == "Darwin" ]; then aTarget="xcd"; fi; |
| 25 | fi |
| 26 | |
| 27 | if [ ! -e "${aScriptPath}/custom.sh" ]; then |
| 28 | tclsh "${aScriptPath}/adm/genconf.tcl" |
| 29 | fi |
| 30 | |
| 31 | if [ ! -e "${aScriptPath}/custom.sh" ]; then |
| 32 | echo "Error: custom.sh is not present." |
| 33 | echo "Run the script again to generate custom.sh, or create it manually" |
| 34 | exit 1 |
| 35 | fi |
| 36 | source "${aScriptPath}/custom.sh" |
| 37 | |
| 38 | if [ -e "${aScriptPath}/env.sh" ]; then source "${aScriptPath}/env.sh"; fi |
| 39 | |
| 40 | cd $aScriptPath |
| 41 | tclsh "./adm/start.tcl" genproj ${aTarget} $anOpt2 $anOpt3 $anOpt4 $anOpt5 |
| 42 | |
| 43 | export PATH="$anOldPath" |
| 44 | export LD_LIBRARY_PATH="$anOldLd" |
| 45 | export DYLD_LIBRARY_PATH="$anOldDyLd" |