Advertisement
Guest User

Untitled

a guest
Apr 6th, 2014
581
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 58.66 KB | None | 0 0
  1. #!/bin/bash
  2. #* Written by Francesco Angelo Brisa, started January 2008.
  3. #
  4. # Copyright (C) 2013 Francesco Angelo Brisa
  5. #
  6. # This program is free software: you can redistribute it and/or modify
  7. # it under the terms of the GNU General Public License as published by
  8. # the Free Software Foundation, either version 3 of the License, or
  9. # (at your option) any later version.
  10. #
  11. # This program is distributed in the hope that it will be useful,
  12. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. # GNU General Public License for more details.
  15. #
  16. # You should have received a copy of the GNU General Public License
  17. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  18.  
  19. # Setting up for download_and_compile.sh is documented
  20. # on
  21.  
  22. VERSION="1.9-14a"
  23. # See change log below
  24. #
  25. # Changes in 1.9.14a
  26. #
  27. # fixed distribution detection.
  28. #
  29. # Changes in 1.9.14
  30. # 1. Version bump for 2.99.9 now 3.0.0
  31. # 2. changed logging to log entire output of a sub-process
  32. # rather than write individual lines of output to a logfile.
  33. # 3. logs are versioned.
  34. # 4. fix to support a change in fgdata version when fgdata is a symlink
  35. # 5. Automatic j option # of cores + 1
  36. # 6. fixed stable fgrun build
  37. # 7. stable is now 2.12.0 for fgfs & simgear, 2.12.1 for fgdata
  38. # 8. fixed broken stable build for 2.12.0
  39. # 9. Added section on setup
  40. # 10. once built, unless specifically requested by parameter OSG or PLIB:
  41. # Don't rebuild OSG or plib
  42. # Don't update OSG or plib sources
  43. # 12. self testing with ./download_and_compile.sh test.
  44. #
  45. # Note: using the self test multiple times can cause problems. Only so much bandwidth is allocated
  46. # to you when downloading OSG. Use it up and you will be shut off for a while. As an alternative
  47. # provide copies of the OSG sources in the same directory as download_and_compile.sh
  48. # the copy should be labeled with the version of OSG it contains. OpenSceneGraph-3.0.1 and OpenSceneGraph-3.2.0
  49. # plib is handled the same way, but only one version of it exists so its just plib.
  50. #
  51. # the symptom of overuse of svn.openscenegraph.org is:
  52. # svn: E175002: OPTIONS of 'http://svn.openscenegraph.org/osg/OpenSceneGraph/tags/OpenSceneGraph-3.0.1':
  53. # could not connect to server (http://svn.openscenegraph.org)
  54. #
  55. # setup and minimal instructions:
  56. # see http://wiki.flightgear.org/Scripted_Compilation_on_Linux_Debian/Ubuntu#Cut_to_the_Chase:_for_the_impatient
  57. #
  58.  
  59. #######################################################
  60. # THANKS TO
  61. #######################################################
  62. # Special thanks to Alessandro Garosi for FGComGui and
  63. # other patches
  64. # Thanks to "Pat Callahan" for patches for fgrun compilation
  65. # Thanks to "F-JJTH" for bug fixes and suggestions
  66. # Thanks again to "F-JJTH" for OpenRTI and FGX
  67. # Thanks to André, ( taureau89_9 ) for debian stable packages fixes
  68.  
  69. # ---------------------------------------------------------
  70. # Script Section: Self Test
  71. # ---------------------------------------------------------
  72.  
  73. function self_test_one(){
  74. test_dir="$1$3"
  75. test_options_and_parameters="$2"
  76. test_sub_dir="$3"
  77. mkdir -p ${test_dir}${test_sub_dir}
  78. if [[ "$test_sub_dir" != "" ]]
  79. then
  80. cp -f download_and_compile.sh ${test_dir}/../
  81. fi
  82.  
  83. cd ${test_dir}
  84. $test_start_dir/download_and_compile.sh $test_options_and_parameters
  85.  
  86. cd $test_start_dir
  87. if [[ -e $test_dir/install/fgfs/bin/fgfs && -e $test_dir/install/fgrun/bin/fgrun ]]
  88. then
  89. test_dir="$1"
  90. touch ${test_dir}_ok
  91. ls -lah ${test_dir}/install/fgfs
  92. else
  93. test_dir="$1"
  94. touch ${test_dir}_failed
  95. fi
  96. echo '----------------------------------------------------------'
  97. echo '----------------------------------------------------------'
  98. echo '----------------------------------------------------------'
  99. echo Finished test build in ${test_dir}
  100. echo '----------------------------------------------------------'
  101. echo '----------------------------------------------------------'
  102. echo '----------------------------------------------------------'
  103.  
  104. }
  105. if [[ "$1" = "selftest" || "$1" = "test" ]]
  106. then
  107. # this takes a LOT of disk space.
  108. set -x
  109. set -v
  110. test_start_dir=$(pwd)
  111. pwd
  112. ls
  113. if [[ "$2" = "reset" ]]
  114. then
  115. rm -rf b_stable
  116. rm -rf b_next
  117. rm -rf b_master
  118. rm -rf b_3.0.0
  119. rm -rf b_2.12.1
  120. rm -rf b_selftest
  121. fi
  122. if test -n "$(find . -maxdepth 1 -name 'b_*_ok' -print -quit)"
  123. then
  124. rm b_*_ok
  125. fi
  126. if test -n "$(find . -maxdepth 1 -name 'b_*_failed' -print -quit)"
  127. then
  128. rm b_*_failed
  129. fi
  130. mkdir -p fgsrc
  131. mkdir -p othersrc
  132.  
  133. # fgdata_2.12.0 and fgdata_3.0.0 contain complete copies of fgdata
  134. # so multiple versions can be built and then tested.
  135. # the fgdata_ directories can exist in ../, ../../ or ../../..
  136. # if you already have an fgdata downloaded for 2.12.0, 2.12.1 or 3.0.0,
  137. # you can copy the entire fgdata folder to any empty fgdata_ folder in the
  138. # same folder as download_and_compile.sh is being tested from The script will use these
  139. # where appropriate. If you choose not to put an fgdata in the fgdata_${version} directories,
  140. # fgdata will be downloaded and place there for future use.
  141.  
  142. # mv $path_to_fgdata_2.12/fgdata -R fgdata_2.12.0/
  143. # mv $path_to_fgdata_3.0.0/fgdata -R fgdata_3.0.0/
  144.  
  145. self_test_one b_stable "-sxvp n"
  146. self_test_one b_next "-xvp n -G 3.2.0"
  147. self_test_one b_2.12.1 "-xvp n -B release/2.12.1 -G 3.2.0"
  148. self_test_one b_3.0.0 "-xvp n -B release/3.0.0 -G 3.2.0"
  149. self_test_one b_master "-xvp n -B master -G 3.2.0"
  150. self_test_one b_selftest "-xvp n -G 3.2.0" "/selftest/selftest"
  151.  
  152. # note the b_selftest is guaranteed to download everything but OSG and plib.
  153.  
  154. echo "Test Results:"
  155.  
  156. ls -l |grep ' b_*'
  157. exit 0
  158. fi
  159.  
  160. # ---------------------------------------------------------
  161. # Script Section: Script and Option Initialization
  162. # ---------------------------------------------------------
  163. function write_log(){
  164. if [[ "$1" = "separator" ]]
  165. then
  166. echo "" | tee -a download_and_compile_summary.log
  167. echo "-----------------------------------------------------------------------------------" \
  168. | tee -a download_and_compile_summary.log
  169. echo "" | tee -a download_and_compile_summary.log
  170. else
  171. echo "$(date) $1"| tee -a download_and_compile_summary.log
  172. fi
  173. }
  174. function write_log_and_exec(){
  175. write_log "$1 $2"
  176. $1
  177. }
  178. function write_log_and_exec_subprocess(){
  179. write_log "$1 $2"
  180. if [[ "$3" = "noerror" ]]
  181. then
  182. $1 2>/dev/null || true
  183. else
  184. $1
  185. fi
  186. }
  187. function git_check_branch_or_tag(){
  188. if [[ "$1" != "" ]]
  189. then
  190. branch="$(git branch |sed "s/* //" |grep $1)"
  191. tag="$(git tag |sed "s/* //" |grep $1)"
  192. echo $branch$tag
  193. fi
  194. }
  195. function SET_WINDOW_TITLE(){
  196. echo -ne "\033]0;Build Flightgear: - ${current_build_dir} - $1\007"
  197. }
  198. function check_build(){
  199. #
  200. # which directories have flightgear installations
  201. #
  202.  
  203.  
  204. cd $1
  205. pwd=$(pwd)
  206. for fgfs_install_dir in $(find $1 -type d -regex '.*install/fgfs')
  207. do
  208. write_log; write_log;
  209.  
  210. cd $pwd
  211.  
  212. cd "${fgfs_install_dir}/.."
  213. install_dir=$(pwd)
  214. exe_fgfs=""
  215. exe_fgrun=""
  216. exe_fgcom=""
  217. exe_fgcomgui=""
  218. INSTALL_DIR_FGFS=""
  219. install_dir_fgrun=""
  220. install_dir_fgcom=""
  221. install_dir_fgcomgui=""
  222. no_exe_fgfs=""
  223. no_exe_fgrun=""
  224. no_exe_fgcom=""
  225. no_exe_fgcomgui=""
  226. no_INSTALL_DIR_FGFS=""
  227. no_install_dir_fgrun=""
  228. no_install_dir_fgcom=""
  229. no_install_dir_fgcomgui=""
  230.  
  231. if [[ -e ${install_dir}/fgfs/bin/fgfs ]]
  232. then
  233. exe_fgfs="fgfs"
  234. else
  235. no_exe_fgfs="fgfs"
  236. fi
  237.  
  238. if [[ -e "${install_dir}/fgrun/bin/fgrun" ]]
  239. then
  240. exe_fgrun="fgrun"
  241. else
  242. no_exe_fgrun="fgrun"
  243. fi
  244.  
  245. if [[ -e "${install_dir}/fgcom/bin/fgcom" ]]
  246. then
  247. exe_fgcom="fgcom"
  248. else
  249. no_exe_fgcom="fgcom"
  250. fi
  251.  
  252. if [[ -e "${install_dir}/fgcomgui/bin/fgcomgui" ]]
  253. then
  254. exe_fgcomgui="fgcomgui"
  255. else
  256. no_exe_fgcomgui="fgcomgui"
  257. fi
  258.  
  259. if [[ -e ${install_dir}/fgfs ]]
  260. then
  261. INSTALL_DIR_FGFS="fgfs"
  262. else
  263. no_INSTALL_DIR_FGFS="fgfs"
  264. fi
  265.  
  266. if [[ -e "${install_dir}/fgrun" ]]
  267. then
  268. install_dir_fgrun="fgrun"
  269. else
  270. no_install_dir_fgrun="fgrun"
  271. fi
  272.  
  273. if [[ -e "${install_dir}/fgcom" ]]
  274. then
  275. install_dir_fgcom="fgcom"
  276. else
  277. no_install_dir_fgcom="fgcom"
  278. fi
  279.  
  280. if [[ -e "${install_dir}/fgcomgui" ]]
  281. then
  282. install_dir_fgcomgui="fgcomgui"
  283. else
  284. no_install_dir_fgcomgui="fgcomgui"
  285. fi
  286.  
  287.  
  288. found_exe="$exe_fgfs $exe_fgrun $exe_fgcom $exe_fgcomgui"
  289. no_exe="$no_exe_fgfs $no_exe_fgrun $no_exe_fgcom $no_exe_fgcomgui"
  290. found_install_dir="$INSTALL_DIR_FGFS $install_dir_fgrun $install_dir_fgcom $install_dir_fgcomgui"
  291. no_install_dir="$no_INSTALL_DIR_FGFS $no_install_dir_fgrun $no_install_dir_fgcom $no_install_dir_fgcomgui"
  292. found_exe=${found_exe=## }
  293. found_install_dir=${found_install_dir=##}
  294. no_exe=${no_exe##}
  295. no_install_dir=${no_install_dir##}
  296.  
  297. cd $pwd
  298.  
  299. write_log separator
  300. write_log "Install dir: ${install_dir}"
  301. write_log separator
  302.  
  303. write_log "Found fgdata: $(cat $install_dir/fgfs/fgdata/version)"
  304. write_log "Found Executables: $found_exe"
  305. write_log "Found Install Dir: $found_install_dir"
  306. write_log "Found No Executables: $no_exe"
  307. write_log "Found No Install Dir: $no_install_dir"
  308. write_log ""
  309. write_log separator
  310. write_log separator
  311. write_log ""
  312. done
  313. }
  314. set -x
  315. if [[ "$DOWNLOAD_AND_COMPILE_LOG" == "" ]]
  316. then
  317. log_version=0
  318. if test -n "$(find . -maxdepth 1 -name 'download_and_compile.log:*' -print -quit)"
  319. then
  320. for f in download_and_compile.log:*
  321. do
  322. log_version_found=$(( 10#${f##*:} ))
  323. if [[ $log_version_found -gt $log_version ]]
  324. then
  325. log_version=$log_version_found
  326. fi
  327. done
  328.  
  329. fi
  330. if [[ -e download_and_compile.log ]]
  331. then
  332. let log_version=$(( $log_version + 1))
  333. if [[ $log_version -lt 10 ]]
  334. then
  335. log_version='0'$log_version
  336. fi
  337. mv download_and_compile.log download_and_compile.log:$log_version
  338. fi
  339. export DOWNLOAD_AND_COMPILE_LOG=download_and_compile.log
  340. bash $0 $* 2>&1 |tee $DOWNLOAD_AND_COMPILE_LOG
  341. exit
  342. fi
  343.  
  344. rebuild_command="$0 $*"
  345.  
  346. echo $0 $*
  347. echo " started building in $(pwd)"
  348. echo " at $(date)"
  349.  
  350. LOGSEP="***********************************"
  351. UPDATE=
  352. STABLE=
  353. STOP_AFTER_ONE_MODULE=false
  354.  
  355. APT_GET_UPDATE="y"
  356. DOWNLOAD_PACKAGES="y"
  357.  
  358. COMPILE="y"
  359. RECONFIGURE="y"
  360. DOWNLOAD="y"
  361.  
  362. JOPTION="-j $(( $(nproc) + 1))"
  363. OOPTION=""
  364. DEBUG=""
  365. WITH_EVENT_INPUT=""
  366. WITH_OPENRTI=""
  367. FGSG_BRANCH="next"
  368. FGSG_REVISION="HEAD"
  369. osg_version="3.0.1"
  370. # ---------------------------------------------------------
  371. # Script Section: Option Interpretation
  372. # ---------------------------------------------------------
  373. SET_WINDOW_TITLE "Script and Option Initialization"
  374.  
  375. while getopts "zsuhgeixvwc:p:a:d:r:j:O:B:R:G:" OPTION
  376. do
  377. echo $OPTION
  378. case $OPTION in
  379. s)
  380. STABLE="STABLE"
  381. FGSG_BRANCH="2.12.1"
  382. FGSG_REVISION="HEAD"
  383. ;;
  384. B)
  385. FGSG_BRANCH=$OPTARG
  386. ;;
  387. R)
  388. FGSG_REVISION=$OPTARG
  389. ;;
  390. G)
  391. osg_version=${OPTARG^^} #3.0.1, 3.0.1d 3.1.9 3.1.9d, 3.2.0 next nextd, etc
  392. OSG_DEBUG_OR_RELEASE='Release'
  393. if [[ ${osg_version%d} != ${osg_version} ]]
  394. then
  395. OSG_DEBUG_OR_RELEASE='Debug'
  396. osg_version= ${osg_version%d}
  397. fi
  398. ;;
  399. u)
  400. UPDATE="UPDATE"
  401. ;;
  402. h)
  403. HELP="HELP"
  404. ;;
  405. a)
  406. APT_GET_UPDATE=$OPTARG
  407. ;;
  408. c)
  409. COMPILE=$OPTARG
  410. ;;
  411. p)
  412. DOWNLOAD_PACKAGES=$OPTARG
  413. ;;
  414. d)
  415. DOWNLOAD=$OPTARG
  416. ;;
  417. r)
  418. RECONFIGURE=$OPTARG
  419. ;;
  420. j)
  421. JOPTION=" -j"$OPTARG" "
  422. ;;
  423. O)
  424. OOPTION=" -O"$OPTARG" "
  425. ;;
  426. g)
  427. DEBUG="CXXFLAGS=-g"
  428. ;;
  429. e)
  430. WITH_EVENT_INPUT="--with-eventinput"
  431. ;;
  432. i)
  433. WITH_OPENRTI="-D ENABLE_RTI=ON"
  434. ;;
  435. x)
  436. set -x
  437. ;;
  438. v)
  439. set -v
  440. ;;
  441. w)
  442. VERBOSE_MAKEFILE="-D CMAKE_VERBOSE_MAKEFILE=ON"
  443. ;;
  444. z)
  445. STOP_AFTER_ONE_MODULE=true
  446. ;;
  447. ?)
  448. echo "error"
  449. HELP="HELP"
  450. #exit
  451. ;;
  452. esac
  453. done
  454.  
  455. opts=$-
  456.  
  457. # ---------------------------------------------------------
  458. # Script Section: Set Source Archive Version Variables
  459. # ---------------------------------------------------------
  460.  
  461. # Last stable revision: currently FlightGear 2.10.0 with 3.0.1
  462. PLIB_STABLE_REVISION="2172"
  463. OSG_SVN="http://svn.openscenegraph.org/osg/OpenSceneGraph/tags/OpenSceneGraph-${osg_version}/"
  464.  
  465. declare -A OPENRTI_MAP
  466. declare -A FGSG_MAP
  467. declare -A FGRUN_MAP
  468. declare -A fgdata_map
  469. FGSG_MAP=( [next]="next HEAD" \
  470. [master]="master HEAD " \
  471. [3.0.0]="release/3.0.0 HEAD" \
  472. [2.12.1]="release/2.12.0 HEAD" \
  473. [2.12.0]="release/2.12.0 HEAD" \
  474. [2.10.0]="release/2.10.0 HEAD " \
  475. [2.8.0]="release/2.8.0 version/2.8.0-final" )
  476. FGRUN_MAP=( [next]="next HEAD" \
  477. [master]="master HEAD " \
  478. [3.0.0]="release/3.0.0 HEAD " \
  479. [2.12.1]="release/2.12 HEAD" \
  480. [2.12.0]="release/2.12 HEAD" \
  481. [2.10.0]="release/2.12 HEAD " \
  482. [2.8.0]="release/2.12 HEAD" )
  483. fgdata_map=([next]="master HEAD 3.0.0" \
  484. [master]="master HEAD 3.0.0" \
  485. [3.0.0]="release/3.0.0 HEAD 3.0.0" \
  486. [2.12.1]="release/2.12.0 HEAD 2.12.1 " \
  487. [2.12.0]="release/2.12.0 HEAD 2.12.1" \
  488. [2.10.0]="release/2.10.0 HEAD 2.10.0" \
  489. [2.8.0]="release/2.8.0 HEAD 2.8.0" )
  490.  
  491. OPENRTI_MAP=( [next]="master HEAD" \
  492. [master]="master HEAD" \
  493. [2.12.1]="master HEAD" \
  494. [2.12.0]="master HEAD" \
  495. [2.10.0]="master HEAD" \
  496. [2.8.0]="release-0.3 OpenRTI-0.3.0" )
  497.  
  498. FG_SG_VERSION=${FGSG_BRANCH##*/}
  499.  
  500. MAP_ITEM=( ${FGSG_MAP[${FG_SG_VERSION}]} )
  501. FGSG_BRANCH=${MAP_ITEM[0]}
  502. FGSG_REVISION=${MAP_ITEM[1]}
  503.  
  504. MAP_ITEM=( ${FGRUN_MAP[${FG_SG_VERSION}]} )
  505. FGRUN_BRANCH=${MAP_ITEM[0]}
  506. FGRUN_REVISION=${MAP_ITEM[1]}
  507.  
  508. MAP_ITEM=( ${fgdata_map[${FG_SG_VERSION}]} )
  509. fgdata_branch=${MAP_ITEM[0]}
  510. fgdata_revision=${MAP_ITEM[1]}
  511. fgdata_version=${MAP_ITEM[2]}
  512.  
  513. MAP_ITEM=( ${OPENRTI_MAP[${FG_SG_VERSION}]} )
  514. OPENRTI_BRANCH=${MAP_ITEM[0]}
  515. OPENRTI_REVISION=${MAP_ITEM[1]}
  516.  
  517.  
  518. # FGCOM
  519. FGCOM_BRANCH="master"
  520. FGCOMGUI_STABLE_REVISION="46"
  521.  
  522. #OpenRadar
  523. OR_STABLE_RELEASE="http://wagnerw.de/OpenRadar.zip"
  524.  
  525. fgdata_git="git://gitorious.org/fg/fgdata.git"
  526. echo $(pwd)
  527.  
  528. # ---------------------------------------------------------
  529. # Script Section: Display Script Help
  530. # ---------------------------------------------------------
  531. set +x
  532. if [ "$HELP" = "HELP" ]
  533. then
  534. echo "$0 Version $VERSION"
  535. echo "Usage:"
  536. echo "./$0 [-u] [-h] [-s] [-e] [-i] [-g] [-a y|n] [-c y|n] [-p y|n] [-d y|n] [-r y|n] [ALL|PLIB|OSG|OPENRTI|SIMGEAR|FGFS|FGO|FGX|FGRUN|FGCOM|FGCOMGUI|ATLAS] [UPDATE]"
  537. echo "* without options it recompiles: PLIB,OSG,OPENRTI,SIMGEAR,FGFS,FGRUN"
  538. echo "* Using ALL compiles everything"
  539. echo "* Adding UPDATE it does not rebuild all (faster but to use only after one successfull first compile)"
  540. echo "Switches:"
  541. echo "* -u such as using UPDATE"
  542. echo "* -h show this help"
  543. echo "* -e compile FlightGear with --with-eventinput option (experimental)"
  544. echo "* -i compile SimGear and FlightGear with -D ENABLE_RTI=ON option (experimental)"
  545. echo "* -g compile with debug info for gcc"
  546. echo "* -a y|n y=do an apt-get update n=skip apt-get update default=y"
  547. echo "* -p y|n y=download packages n=skip download packages default=y"
  548. echo "* -c y|n y=compile programs n=do not compile programs default=y"
  549. echo "* -d y|n y=fetch programs from internet (cvs, svn, etc...) n=do not fetch default=y"
  550. echo "* -j X Add -jX to the make compilation default=None"
  551. echo "* -O X Add -OX to the make compilation default=None"
  552. echo "* -r y|n y=reconfigure programs before compiling them n=do not reconfigure default=y"
  553. echo "* -s compile only last stable known versions default=y"
  554. echo "* -w cmake verbose option"
  555. echo "* -x set -x bash option"
  556. echo "* -v set -v bash option"
  557. echo "* -B branch"
  558. echo "* -R revision"
  559. echo "* -G osg version"
  560.  
  561. exit
  562. fi
  563.  
  564. # --------------------------------------------
  565. # Warning about compilation time and size
  566. # Idea from Jester
  567. echo "**************************************"
  568. echo "* *"
  569. echo "* Warning, the compilation process *"
  570. echo "* is going to use 12 or more Gbytes *"
  571. echo "* of space and at least a couple of *"
  572. echo "* hours to download and build FG. *"
  573. echo "* *"
  574. echo "* Please, be patient ...... *"
  575. echo "* *"
  576. echo "**************************************"
  577.  
  578.  
  579. # ---------------------------------------------------------
  580. # Script Section: Debian Backports
  581. # ---------------------------------------------------------
  582.  
  583.  
  584. # Debian 4.0rX (Etch) backports.org
  585. # From D-HUND
  586.  
  587. ISSUE=$(cat /etc/issue)
  588.  
  589. # Uncomment following line to confirm backports.org is in sources.list:
  590. #ISSUE=""
  591.  
  592. if [ "$ISSUE" = "Debian GNU/Linux 4.0 \n \l" ]; then
  593. clear
  594. echo "*****************************************************"
  595. echo "* Note to users of Debian Etch (Stable 4.0rX) *"
  596. echo "*****************************************************"
  597. echo
  598. echo "Since autumn 2008 it is not possible anymore to easily install fgfs"
  599. echo "cvs by using standard repositry. Therefore it is necessary to have"
  600. echo "backports.org in the apt sources.list to run this script."
  601. echo
  602. echo "If you're using synaptic you may follow these steps:"
  603. echo " - Open synaptics menu 'Settings' --> 'Repositories'"
  604. echo " - Click 'Add' and do"
  605. echo " select 'Binaries (deb)'"
  606. echo " enter Address: 'www.backports.org/backports.org/'"
  607. echo " enter Distribution: 'etch-backports'"
  608. echo " enter Section(s): 'main contrib non-free'"
  609. echo " - Close Repositries window using 'OK'"
  610. echo " - Click 'Reload' to update database."
  611. echo
  612. echo "If you have backports.org in your apt-repositries and want to get"
  613. echo "rid of this message have a look at the script."
  614. echo -n "[c] to continue or just [ENTER] to exit script: "
  615. if [ "$(read GOON)" != "c" ]; then
  616. echo "Script aborted!"
  617. exit 0
  618. fi
  619. fi
  620.  
  621. # ---------------------------------------------------------
  622. # Script Section: Display Options Chosen
  623. # ---------------------------------------------------------
  624.  
  625.  
  626.  
  627. echo $0 $*
  628.  
  629. echo "APT_GET_UPDATE=$APT_GET_UPDATE"
  630. echo "DOWNLOAD_PACKAGES=$DOWNLOAD_PACKAGES"
  631. echo "COMPILE=$COMPILE"
  632. echo "RECONFIGURE=$RECONFIGURE"
  633. echo "DOWNLOAD=$DOWNLOAD"
  634. echo "JOPTION=$JOPTION"
  635. echo "OOPTION=$OOPTION"
  636. echo "DEBUG=$DEBUG"
  637. echo "FGSG_VERSION=$FGSG_VERSION"
  638. echo "FGSG_REVISION=$FGSG_REVISION"
  639. echo "fgdata_branch=$fgdata_branch"
  640. echo "fgdata_revision=$fgdata_revision"
  641. echo "fgdata_version=$fgdata_version"
  642.  
  643. echo "$LOGSEP"
  644. set -$opts
  645.  
  646. # ---------------------------------------------------------
  647. # Script Section: Determine Linux Distribution
  648. # ---------------------------------------------------------
  649.  
  650. if [ -e /etc/lsb-release ]
  651. then
  652. . /etc/lsb-release
  653. fi
  654.  
  655. # default is hardy
  656. DISTRO_PACKAGES="openscenegraph git fltk plib cmake svn lib32-openal cvs freealut libpng scons python-imaging freeglut abs gettext boost libpng12 openexr ogre"
  657.  
  658. UBUNTU_PACKAGES="freeglut3-dev libjpeg62-dev libjpeg62 libapr1-dev libfltk1.3-dev libfltk1.3"
  659.  
  660. if [[ ( "$DISTRIB_ID" = "Ubuntu" || "$DISTRIB_ID" = "LinuxMint" ) && "$DISTRIB_RELEASE" < "13.10" ]]
  661. then
  662. UBUNTU_PACKAGES="$UBUNTU_PACKAGES libhal-dev"
  663. fi
  664. DEBIAN_PACKAGES_STABLE="freeglut3-dev libjpeg8-dev libjpeg8 libfltk1.1-dev libfltk1.1"
  665. DEBIAN_PACKAGES_TESTING="freeglut3-dev libjpeg8-dev libjpeg8 libfltk1.3-dev libfltk1.3"
  666. DEBIAN_PACKAGES_UNSTABLE="freeglut3-dev libjpeg8-dev libjpeg8 libfltk1.3-dev libfltk1.3"
  667.  
  668. if [ "$DISTRIB_ID" = "Ubuntu" -o "$DISTRIB_ID" = "LinuxMint" ]
  669. then
  670. echo "$DISTRIB_ID $DISTRIB_RELEASE"
  671. DISTRO_PACKAGES="$DISTRO_PACKAGES $UBUNTU_PACKAGES"
  672. else
  673. echo "DEBIAN I SUPPOUSE"
  674.  
  675. DEBIAN_PACKAGES=$DEBIAN_PACKAGES_STABLE
  676. if [ ! "$(apt-cache search libfltk1.3)" = "" ]
  677. then
  678. #TESTING MAYBE
  679. DEBIAN_PACKAGES=$DEBIAN_PACKAGES_TESTING
  680. fi
  681.  
  682. DISTRO_PACKAGES="$DISTRO_PACKAGES $DEBIAN_PACKAGES"
  683. fi
  684. echo "$LOGSEP"
  685.  
  686. # ---------------------------------------------------------
  687. # Script Section: Install Prerequisite Development Packages
  688. # ---------------------------------------------------------
  689. SET_WINDOW_TITLE "Install Prerequisite Development Packages"
  690.  
  691.  
  692. if [ "$DOWNLOAD_PACKAGES" = "y" ]
  693. then
  694. echo -n "PACKAGE INSTALLATION ... "
  695.  
  696. LIBOPENALPACKAGE=$(apt-cache search libopenal | grep "libopenal. " | sed s/\ .*//)
  697. DISTRO_PACKAGES=$DISTRO_PACKAGES" "$LIBOPENALPACKAGE
  698.  
  699. # checking linux distro and version to differ needed packages
  700. if [ "$DISTRIB_ID" = "Ubuntu" ]
  701. then
  702.  
  703. if [ "$APT_GET_UPDATE" = "y" ]
  704. then
  705. echo "Asking your password to perform a system update"
  706. sudo pacman -Syu
  707. fi
  708.  
  709.  
  710. echo "Asking your password to install required packages... "
  711. sudo pacman -S $DISTRO_PACKAGES
  712. else
  713. # WE ARE USING DEBIAN
  714.  
  715. if [ "$APT_GET_UPDATE" = "y" ]
  716. then
  717. echo "Asking root password to perform a system update"
  718. su -c "pacman -Syu"
  719. fi
  720. echo "Asking root password to install required packages ... "
  721. su -c "pacman -S $DISTRO_PACKAGES"
  722. fi
  723.  
  724. echo " OK"
  725. fi
  726.  
  727.  
  728. # -------------------------------------------------------------
  729. # Script Section: Create Required Build and install Directories
  730. # -------------------------------------------------------------
  731. SET_WINDOW_TITLE "Create Required Build and install Directories"
  732.  
  733. COMPILE_BASE_DIR=.
  734.  
  735. #cd into compile base directory
  736. cd "$COMPILE_BASE_DIR"
  737.  
  738. #get absolute path
  739. current_build_dir=$(pwd)
  740. current_build_dir=$(pwd)
  741. # ----------------------------------------------------------------------------------------
  742. # Special handling for plib and OpenSceneGraph
  743. #
  744. # These container, src, install and build directories support
  745. # doing a single download, configure and build for osg versions and plib-1.8.5
  746. # This means that src, build and install directories for OSG can be separate from
  747. # the build and install directories for openrti, simgear, flightgear, fgrun and fgcom
  748. # this is optional and is conditioned on the existence of certain directories in the parent
  749. # of where you are building. The scheme supports as many osg versions as you care to download.
  750. # it should also support debug versions of the osg libraries, but this has not been tried yet.
  751. # care to build.
  752.  
  753. # handling plib and OSG in this way will save
  754. # time
  755. # network bandwidth
  756. # disk space
  757. #
  758. # To trigger this option, two things are required:
  759. # 1. create a folder othersrc in the directory containing download_and_compile.sh
  760. # 2. always build in a subdirectory of the one containing download_and_compile.sh
  761. #
  762.  
  763. # Directory Scheme:
  764. # download_and_compile.sh
  765. # othersrc
  766. # plib-1.8.5
  767. # plib
  768. # osg${osg_version1}
  769. # osg${osg_version2}
  770. # install
  771. # plib
  772. # osg${osg_version}
  773. # build
  774. # plib
  775. # osg${osg_version1}
  776. # next
  777. # master
  778. # stable
  779. # 2.12.0
  780. # 3.0.0
  781. # to build, cd into one of next, master, stable, 2.12.0 or 3.0.0
  782. # and run ../download_and_compile.sh with appropriate parameters.
  783.  
  784. # first the defaults
  785. plib_src_container=$current_build_dir
  786. osg_src_container=$current_build_dir
  787. install_dir_osg=
  788.  
  789. # then override with the optional scheme for othersrc
  790. if [[ -e ../othersrc ]]
  791. then
  792. mkdir -p ../othersrc/plib-1.8.5
  793. mkdir -p ../build/plib
  794. mkdir -p ../install/plib
  795. plib_src_container=$(cd ../othersrc/plib-1.8.5; pwd;)
  796. build_dir_plib=$(cd ../build/plib; pwd;)
  797. install_dir_plib=$(cd ../install/plib; pwd;)
  798.  
  799. mkdir -p ../othersrc/OpensceneGraph-${osg_version}
  800. mkdir -p ../build/osg-${osg_version}
  801. mkdir -p ../install/osg-${osg_version}
  802. osg_src_container=$(cd ../othersrc/OpensceneGraph-${osg_version}; pwd;)
  803. install_dir_osg=$(cd ../install/osg-${osg_version}; pwd;)
  804. build_dir_osg=$(cd ../build/osg-${osg_version}; pwd;)
  805. fi
  806. if [[ "${install_dir_osg}" = "" ]]
  807. then
  808. mkdir -p build/plib
  809. mkdir -p install/plib
  810. mkdir -p build/osg
  811. mkdir -p install/osg
  812. install_dir_osg=$(cd build/plib; pwd;)
  813. install_dir_plib=$(cd install/plib; pwd;)
  814. build_dir_osg=$(cd build/osg; pwd;)
  815. build_dir_plib=$(cd install/osg; pwd;)
  816. fi
  817. # set it all up ahead of time:
  818. mkdir -p ${plib_src_container}
  819. mkdir -p ${osg_src_container}
  820. mkdir -p ${install_dir_osg}
  821. mkdir -p ${install_dir_plib}
  822. mkdir -p ${build_dir_osg}
  823. mkdir -p ${build_dir_plib}
  824. plib_src=$plib_src_container/plib
  825. osg_src=$osg_src_container/OpenSceneGraph
  826.  
  827. # ---------------------------------------------------------
  828. # Script Section: Build Argument Interpretation
  829. # ---------------------------------------------------------
  830. #SET_WINDOW_TITLE "Option Interpretation"
  831.  
  832.  
  833. shift $(($OPTIND - 1))
  834.  
  835. WHATTOBUILD=
  836. # supress build of plib and osg if the libraries are in place
  837. if [[ ! -e ${install_dir_plib}/lib/libplibsg.a ]]
  838. then
  839. build_plib=PLIB
  840. fi
  841. if [[ ! -e ${install_dir_osg}/lib/libosgWidget.so.${osg_version} ]]
  842. then
  843. build_osg=OSG
  844. fi
  845.  
  846. WHATTOBUILDALL=( $build_plib $build_osg OPENRTI SIMGEAR FGFS DATA FGRUN FGCOM )
  847.  
  848. #printf "Remaining arguments are: %s\n" "$*"
  849. #printf "Num: %d\n" "$#"
  850.  
  851. if [ ! "$#" = "0" ]
  852. then
  853. for arg in $*
  854. do
  855. #echo "$arg"
  856. if [ "${arg^^}" == "UPDATE" ]
  857. then
  858. UPDATE="UPDATE"
  859. else
  860. WHATTOBUILD=( "${WHATTOBUILD[@]}" "${arg^^}" )
  861. fi
  862. done
  863. else
  864. WHATTOBUILD=( "${WHATTOBUILDALL[@]}" )
  865. fi
  866.  
  867. if [[ "$(declare -p WHATTOBUILD)" =~ '['([0-9]+)']="ALL"' ]]
  868. then
  869. WHATTOBUILD=( "${WHATTOBUILDALL[@]}" )
  870. fi
  871.  
  872. #
  873. #
  874.  
  875. printf "%s\n" "${WHATTOBUILD[@]}"
  876.  
  877.  
  878. echo "DIRECTORY= $current_build_dir"
  879. echo "$LOGSEP"
  880.  
  881. mkdir -p install
  882.  
  883. SUB_INSTALL_DIR=install
  884. INSTALL_DIR=$current_build_dir/$SUB_INSTALL_DIR
  885.  
  886.  
  887. cd "$current_build_dir"
  888. mkdir -p build
  889.  
  890. # ---------------------------------------------------------
  891. # Script Section: set script to stop if an error occours
  892. # ---------------------------------------------------------
  893.  
  894. set -e
  895.  
  896. # ---------------------------------------------------------
  897. # Script Section: Build Components
  898. # ---------------------------------------------------------
  899.  
  900. #######################################################
  901. # PLIB
  902. #######################################################
  903. export INSTALL_DIR_PLIB=${install_dir_plib}
  904. if [[ "$(declare -p WHATTOBUILD)" =~ '['([0-9]+)']="PLIB"' ]]
  905. then
  906. if [ ! "$UPDATE" = "UPDATE" ]
  907. then
  908. set +x
  909. echo "****************************************"
  910. echo "**************** PLIB ******************"
  911. echo "****************************************"
  912. SET_WINDOW_TITLE "Building PLIB"
  913.  
  914. echo "BUILDING PLIB"
  915. echo "plib_src_container:$plib_src_container"
  916. echo "plib_src: $install_dir_plib"
  917. echo "install_dir_plib: $install_dir_plib"
  918. set -$opts
  919.  
  920. if [ "$DOWNLOAD" = "y" ]
  921. then
  922. if [ -d "${plib_src_dir}/.svn" ]
  923. then
  924. echo -n "updating plib svn"
  925. cd ${plib_src}
  926. svn update
  927. else
  928. echo -n "DOWNLOADING FROM http://svn.code.sf.net/p/plib/code/trunk/ ..."
  929. cd ${plib_src_container}
  930. svn co http://svn.code.sf.net/p/plib/code/trunk/ plib
  931. echo " OK"
  932. fi
  933. fi
  934.  
  935. if [ "$RECONFIGURE" = "y" ]
  936. then
  937. cd ${plib_src}
  938.  
  939. echo "AUTOGEN plib"
  940. ./autogen.sh
  941. echo "CONFIGURING plib"
  942. cd ${build_dir_plib}
  943.  
  944. ${plib_src}/configure --disable-pw --disable-sl --disable-psl --disable-ssg --disable-ssgaux --prefix="$INSTALL_DIR_PLIB" --exec-prefix="$INSTALL_DIR_PLIB"
  945. echo "CONFIGURE/RECONFIGURE OSG DONE."
  946. else
  947. echo "NO RECONFIGURE FOR plib"
  948. fi
  949.  
  950. if [ "$COMPILE" = "y" ]
  951. then
  952.  
  953. echo "MAKE plib"
  954. echo "make $JOPTION $OOPTION"
  955.  
  956. cd $build_dir_plib
  957. make $JOPTION $OOPTION
  958. echo "INSTALL plib"
  959. echo "make install"
  960. make install
  961. fi
  962. fi
  963. if [[ $STOP_AFTER_ONE_MODULE = true ]]; then exit; fi
  964. fi
  965.  
  966. #######################################################
  967. # OpenSceneGraph
  968. #######################################################
  969. SET_WINDOW_TITLE "Building OpenSceneGraph"
  970. export INSTALL_DIR_OSG=${install_dir_osg}
  971.  
  972. if [[ "$(declare -p WHATTOBUILD)" =~ '['([0-9]+)']="OSG"' ]]
  973. then
  974. set +x
  975. echo "****************************************"
  976. echo "**************** OSG *******************"
  977. echo "****************************************"
  978. echo "BUILDING PLIB"
  979. echo "osg_src_container:$osg_src_container"
  980. echo "osg_src: $install_dir_osg"
  981. echo "install_dir_osg: $install_dir_osg"
  982. set -$opts
  983.  
  984. if [ "$DOWNLOAD" = "y" ]
  985. then
  986.  
  987. echo -n "SVN FROM $OSG_SVN ... "
  988. if [ -d "${osg_src}/.svn" ]
  989. then
  990. echo -n "updating OpenSceneGraph svn"
  991. cd ${osg_src}
  992. svn update
  993. else
  994. echo -n "downloadING FROM $OSG_SVN ..."
  995. cd $osg_src_container
  996. svn co "$OSG_SVN" OpenSceneGraph
  997. fi
  998. fi
  999. if [ ! "$UPDATE" = "UPDATE" ]
  1000. then
  1001. if [ "$RECONFIGURE" = "y" ]
  1002. then
  1003.  
  1004. cd ${build_dir_osg}
  1005. echo -n "RECONFIGURE OSG ... "
  1006. rm -f CMakeCache.txt ${osg_src}/CMakeCache.txt CMakeCache.txt
  1007. cmake ${osg_src}
  1008. cmake ${VERBOSE_MAKEFILE} -D CMAKE_BUILD_TYPE="Release" -D CMAKE_CXX_FLAGS="-O3 -D__STDC_CONSTANT_MACROS" -D CMAKE_C_FLAGS="-O3" -D CMAKE_INSTALL_PREFIX:PATH="$INSTALL_DIR_OSG" $osg_src
  1009.  
  1010. echo "RECONFIGURE OSG DONE."
  1011. fi
  1012. fi
  1013.  
  1014. if [ "$COMPILE" = "y" ]
  1015. then
  1016. echo "COMPILING OSG"
  1017. cd ${build_dir_osg}
  1018. make $JOPTION $OOPTION
  1019. echo "INSTALLING OSG"
  1020. make install
  1021. fi
  1022.  
  1023. #FIX FOR 64 BIT COMPILATION
  1024. if [ -d "$INSTALL_DIR_OSG/lib64" ]
  1025. then
  1026. if [ -L "$INSTALL_DIR_OSG/lib" ]
  1027. then
  1028. echo "link already done"
  1029. else
  1030. ln -s "$INSTALL_DIR_OSG/lib64" "$INSTALL_DIR_OSG/lib"
  1031. fi
  1032. fi
  1033. if [[ $STOP_AFTER_ONE_MODULE = true ]]; then exit; fi
  1034. fi
  1035.  
  1036. #######################################################
  1037. # OPENRTI
  1038. #######################################################
  1039. SET_WINDOW_TITLE "Building OPENRTI"
  1040. OPENRTI_INSTALL_DIR=openrti
  1041. INSTALL_DIR_OPENRTI=$INSTALL_DIR/$OPENRTI_INSTALL_DIR
  1042. cd "$current_build_dir"
  1043.  
  1044. if [ ! -d "openrti" ]
  1045. then
  1046. mkdir "openrti"
  1047. fi
  1048.  
  1049. if [[ "$(declare -p WHATTOBUILD)" =~ '['([0-9]+)']="OPENRTI"' ]]
  1050. then
  1051. echo "****************************************"
  1052. echo "**************** OPENRTI ***************"
  1053. echo "****************************************"
  1054.  
  1055.  
  1056. if [ "$DOWNLOAD" = "y" ]
  1057. then
  1058. cd openrti
  1059.  
  1060. echo -n "git FROM git://gitorious.org/openrti/openrti.git ... "
  1061.  
  1062. if [ -d "openrti" ]
  1063. then
  1064. echo "openrti exists already."
  1065. else
  1066. git clone git://gitorious.org/openrti/openrti.git
  1067. fi
  1068.  
  1069. cd openrti
  1070.  
  1071. git fetch origin
  1072. if [ "$STABLE" = "STABLE" ]
  1073. then
  1074. # switch to stable branch
  1075. # create local stable branch, ignore errors if it exists
  1076. git branch -f $OPENRTI_BRANCH origin/$OPENRTI_BRANCH 2> /dev/null || true
  1077. # switch to stable branch. No error is reported if we're already on the branch.
  1078. git checkout -f $OPENRTI_BRANCH
  1079. # get indicated stable version
  1080. git reset --hard $OPENRTI_REVISION
  1081. else
  1082. # switch to unstable branch
  1083. # create local unstable branch, ignore errors if it exists
  1084. git branch -f $OPENRTI_BRANCH origin/$OPENRTI_BRANCH 2> /dev/null || true
  1085. # switch to unstable branch. No error is reported if we're already on the branch.
  1086. git checkout -f $OPENRTI_BRANCH
  1087. # pull latest version from the unstable branch
  1088. git pull
  1089. fi
  1090.  
  1091. cd ..
  1092.  
  1093. echo " OK"
  1094. cd ..
  1095.  
  1096. fi
  1097.  
  1098. cd "openrti/openrti"
  1099.  
  1100. if [ ! "$UPDATE" = "UPDATE" ]
  1101. then
  1102. if [ "$RECONFIGURE" = "y" ]
  1103. then
  1104.  
  1105. cd "$current_build_dir"
  1106. mkdir -p build/openrti
  1107. cd "$current_build_dir"/build/openrti
  1108. echo -n "RECONFIGURE OPENRTI ... "
  1109. rm -f ../../openrti/openrti/CMakeCache.txt
  1110. cmake ${VERBOSE_MAKEFILE} -D CMAKE_BUILD_TYPE="Release" -D CMAKE_CXX_FLAGS="-O3 -D__STDC_CONSTANT_MACROS" -D CMAKE_INSTALL_PREFIX:PATH="$INSTALL_DIR_OPENRTI" ../../openrti/openrti/
  1111. echo " OK"
  1112.  
  1113.  
  1114.  
  1115. fi
  1116. fi
  1117.  
  1118. if [ "$COMPILE" = "y" ]
  1119. then
  1120.  
  1121.  
  1122. cd "$current_build_dir"/build/openrti
  1123. echo "MAKE OPENRTI"
  1124. echo "make $JOPTION $OOPTION "
  1125. make $JOPTION $OOPTION
  1126.  
  1127. echo "INSTALL OPENRTI"
  1128. make install
  1129. fi
  1130. cd -
  1131. if [[ $STOP_AFTER_ONE_MODULE = true ]]; then exit; fi
  1132. fi
  1133.  
  1134. #######################################################
  1135. # SIMGEAR
  1136. #######################################################
  1137. SET_WINDOW_TITLE "Building Simgear"
  1138. SIMGEAR_INSTALL_DIR=simgear
  1139. INSTALL_DIR_SIMGEAR=$INSTALL_DIR/$SIMGEAR_INSTALL_DIR
  1140. cd "$current_build_dir"
  1141.  
  1142. if [ ! -d "simgear" ]
  1143. then
  1144. mkdir "simgear"
  1145. fi
  1146.  
  1147. if [[ "$(declare -p WHATTOBUILD)" =~ '['([0-9]+)']="SIMGEAR"' ]]
  1148. then
  1149. echo "****************************************"
  1150. echo "**************** SIMGEAR ***************"
  1151. echo "****************************************"
  1152.  
  1153.  
  1154. if [ "$DOWNLOAD" = "y" ]
  1155. then
  1156. cd simgear
  1157. echo -n "git FROM git://gitorious.org/fg/simgear.git ... "
  1158.  
  1159. if [ -d "simgear" ]
  1160. then
  1161. echo "simgear exists already."
  1162. else
  1163. git clone git://gitorious.org/fg/simgear.git
  1164. fi
  1165.  
  1166. cd simgear
  1167.  
  1168. git fetch origin
  1169. if [ "$STABLE" = "STABLE" ]
  1170. then
  1171. # switch to stable branch
  1172. # create local stable branch, ignore errors if it exists
  1173. git branch -f $FGSG_BRANCH origin/$FGSG_BRANCH 2> /dev/null || true
  1174. # switch to stable branch. No error is reported if we're already on the branch.
  1175. git checkout -f $FGSG_BRANCH
  1176. # get indicated stable version
  1177. git reset --hard $SIMGEAR_STABLE_REVISION
  1178. else
  1179. # switch to unstable branch
  1180. # create local unstable branch, ignore errors if it exists
  1181. git branch -f $FGSG_BRANCH origin/$FGSG_BRANCH 2> /dev/null || true
  1182. # switch to unstable branch. No error is reported if we're already on the branch.
  1183. git checkout -f $FGSG_BRANCH
  1184. # pull latest version from the unstable branch
  1185. git pull
  1186. fi
  1187.  
  1188. cd ..
  1189.  
  1190. echo " OK"
  1191. cd ..
  1192.  
  1193. fi
  1194.  
  1195.  
  1196. cd "simgear/simgear"
  1197.  
  1198. if [ ! "$UPDATE" = "UPDATE" ]
  1199. then
  1200. if [ "$RECONFIGURE" = "y" ]
  1201. then
  1202.  
  1203. cd "$current_build_dir"
  1204. mkdir -p build/simgear
  1205. cd "$current_build_dir"/build/simgear
  1206. echo -n "RECONFIGURE SIMGEAR ... "
  1207. rm -f ../../simgear/simgear/CMakeCache.txt
  1208. rm -f CMakeCache.txt
  1209. cmake ${VERBOSE_MAKEFILE} -D CMAKE_BUILD_TYPE="Release" $WITH_OPENRTI -D CMAKE_CXX_FLAGS="-O3 -D__STDC_CONSTANT_MACROS" -D CMAKE_C_FLAGS="-O3" -D CMAKE_INSTALL_PREFIX:PATH="$INSTALL_DIR_SIMGEAR" -D "CMAKE_PREFIX_PATH=$INSTALL_DIR_OSG;$INSTALL_DIR_OPENRTI" ../../simgear/simgear/
  1210. echo " OK"
  1211.  
  1212.  
  1213.  
  1214. fi
  1215. fi
  1216.  
  1217. if [ "$COMPILE" = "y" ]
  1218. then
  1219.  
  1220.  
  1221. cd "$current_build_dir"/build/simgear
  1222. echo "MAKE SIMGEAR"
  1223. echo "make $JOPTION $OOPTION "
  1224. make $JOPTION $OOPTION
  1225.  
  1226. echo "INSTALL SIMGEAR"
  1227. make install
  1228. fi
  1229. cd -
  1230. if [[ $STOP_AFTER_ONE_MODULE = true ]]; then exit; fi
  1231. fi
  1232.  
  1233. #######################################################
  1234. # FGFS
  1235. #######################################################
  1236. SET_WINDOW_TITLE "Building Flightgear"
  1237. FGFS_INSTALL_DIR=fgfs
  1238. INSTALL_DIR_FGFS=$INSTALL_DIR/$FGFS_INSTALL_DIR
  1239. cd "$current_build_dir"
  1240.  
  1241. if [ ! -d "fgfs" ]
  1242. then
  1243. mkdir "fgfs"
  1244. fi
  1245.  
  1246. #if [ "$WHATTOBUILD" = "" -o "$WHATTOBUILD" = "FGFS" -o "$WHATTOBUILD" = "DATA" -o "$WHATTOBUILD" = "ALL" ]
  1247. if [[ "$(declare -p WHATTOBUILD)" =~ '['([0-9]+)']="FGFS"' || "$(declare -p WHATTOBUILD)" =~ '['([0-9]+)']="DATA"' ]]
  1248. then
  1249.  
  1250. echo "****************************************"
  1251. echo "**************** FGFS ******************"
  1252. echo "****************************************"
  1253.  
  1254. cd fgfs
  1255.  
  1256. if [[ "$(declare -p WHATTOBUILD)" =~ '['([0-9]+)']="FGFS"' ]]
  1257. then
  1258. if [ "$DOWNLOAD" = "y" ]
  1259. then
  1260.  
  1261. echo -n "GIT FROM git://gitorious.org/fg/flightgear.git ... "
  1262.  
  1263.  
  1264. if [ -d "flightgear" ]
  1265. then
  1266. echo "flightgear exists already."
  1267. else
  1268. git clone git://gitorious.org/fg/flightgear.git
  1269. fi
  1270.  
  1271. cd flightgear
  1272. # fix for CMakeLists.txt broken by fltk issues on Ubuntu 13.10
  1273.  
  1274. git fetch origin
  1275. if [ "$STABLE" = "STABLE" ]
  1276. then
  1277. # switch to stable branch
  1278. # create local stable branch, ignore errors if it exists
  1279. git branch -f $FGSG_BRANCH origin/$FGSG_BRANCH 2> /dev/null || true
  1280. # switch to stable branch. No error is reported if we're already on the branch.
  1281. git checkout -f $FGSG_BRANCH
  1282. # get indicated stable version
  1283. git reset --hard $FGFS_STABLE_REVISION
  1284. else
  1285. # switch to unstable branch
  1286. # create local unstable branch, ignore errors if it exists
  1287. git branch -f $FGSG_BRANCH origin/$FGSG_BRANCH 2> /dev/null || true
  1288. # switch to unstable branch. No error is reported if we're already on the branch.
  1289. git checkout -f $FGSG_BRANCH
  1290. # pull latest version from the unstable branch
  1291. git pull
  1292. fi
  1293.  
  1294. cd ..
  1295.  
  1296. echo " OK"
  1297.  
  1298. fi
  1299.  
  1300. cd flightgear
  1301. if [[ $(grep -L 'list(APPEND FLTK_LIBRARIES ${CMAKE_DL_LIBS})' CMakeLists.txt) != "" ]]
  1302. then
  1303. patch CMakeLists.txt <<\EOF
  1304. --- fgfs/flightgear/CMakeLists.txt_old 2013-08-04 08:59:00.614104454 -0400
  1305. +++ fgfs/flightgear/CMakeLists.txt_new 2013-08-04 09:03:32.430104979 -0400
  1306. @@ -203,6 +203,10 @@
  1307. list(APPEND FLTK_LIBRARIES ${X11_Xft_LIB})
  1308. endif()
  1309.  
  1310. + if ( CMAKE_DL_LIBS )
  1311. + list(APPEND FLTK_LIBRARIES ${CMAKE_DL_LIBS})
  1312. + endif()
  1313. +
  1314. message(STATUS "Using FLTK_LIBRARIES for fgadmin: ${FLTK_LIBRARIES}")
  1315. endif ( FLTK_FOUND )
  1316. endif(ENABLE_FGADMIN)
  1317. EOF
  1318. fi
  1319. if [ ! "$UPDATE" = "UPDATE" ]
  1320. then
  1321. if [ "$RECONFIGURE" = "y" ]
  1322. then
  1323. cd "$current_build_dir"
  1324. mkdir -p build/fgfs
  1325. cd "$current_build_dir"/build/fgfs
  1326.  
  1327. echo -n "RECONFIGURE FGFS ... "
  1328. rm -f ../../fgfs/flightgear/CMakeCache.txt
  1329. rm -f CMakeCache.txt
  1330.  
  1331. # REMOVING BAD LINES IN CMakeLists.txt
  1332. #echo "REMOVING BAD LINES IN CMakeLists.txt"
  1333. #cat utils/fgadmin/src/CMakeLists.txt | sed /X11_Xft_LIB/d | sed /X11_Xinerama_LIB/d > utils/fgadmin/src/CMakeLists_without_err.txt
  1334. #cp -f utils/fgadmin/src/CMakeLists_without_err.txt utils/fgadmin/src/CMakeLists.txt
  1335.  
  1336.  
  1337. cmake ${VERBOSE_MAKEFILE} -D CMAKE_BUILD_TYPE="Release" $WITH_OPENRTI -D "WITH_FGPANEL=OFF" -D CMAKE_CXX_FLAGS="-O3 -D__STDC_CONSTANT_MACROS" -D CMAKE_C_FLAGS="-O3" -D CMAKE_INSTALL_PREFIX:PATH="$INSTALL_DIR_FGFS" -D "CMAKE_PREFIX_PATH=$INSTALL_DIR_OSG;$INSTALL_DIR_PLIB;$INSTALL_DIR_SIMGEAR;$INSTALL_DIR_OPENRTI" ../../fgfs/flightgear
  1338.  
  1339. echo " OK"
  1340. fi
  1341. fi
  1342.  
  1343. if [ "$COMPILE" = "y" ]
  1344. then
  1345. cd "$current_build_dir"
  1346. mkdir -p build/fgfs
  1347. cd "$current_build_dir"/build/fgfs
  1348.  
  1349. echo "MAKE FGFS"
  1350. echo "make $JOPTION $OOPTION"
  1351. make $JOPTION $OOPTION
  1352.  
  1353. echo "INSTALL FGFS"
  1354. make install
  1355. fi
  1356.  
  1357. fi
  1358.  
  1359.  
  1360. #
  1361. # Use a scheme similar to the one for osg and plib for fgdata
  1362. #
  1363. #fgdata-2.12.1
  1364. # fgdata
  1365. #fgdata-3.0.0
  1366. # fgdata
  1367. if [[ "$(declare -p WHATTOBUILD)" =~ '['([0-9]+)']="DATA"' ]]
  1368. then
  1369. if [ ! "$UPDATE" = "UPDATE" ]
  1370. then
  1371. if [ "$DOWNLOAD" = "y" ]
  1372. then
  1373. cd $current_build_dir
  1374. fgdata_container=
  1375. echo "fgdata_version: ${fgdata_version}"
  1376. for f in ../../../fgdata[-_]${fgdata_version} \
  1377. ../../fgdata[-_]${fgdata_version} \
  1378. ../fgdata[-_]${fgdata_version} \
  1379. ./fgdata[-_]${fgdata_version}
  1380. do
  1381. if [[ -e $f ]]
  1382. then
  1383.  
  1384. echo checking $f
  1385. fgdata_container=$(cd ${f}; pwd;)
  1386. fgdata_directory=$fgdata_container/fgdata
  1387. if [[ -L $INSTALL_DIR_FGFS/fgdata ]]
  1388. then
  1389. rm $INSTALL_DIR_FGFS/fgdata
  1390. fi
  1391. if [[ -d $INSTALL_DIR_FGFS/fgdata ]]
  1392. then
  1393. rm -rf $INSTALL_DIR_FGFS/fgdata
  1394. fi
  1395. ln -s -T $fgdata_directory $INSTALL_DIR_FGFS/fgdata
  1396. echo "$INSTALL_DIR_FGFS/fgdata is a symbolic link"
  1397. echo "It points to $(readlink -f $INSTALL_DIR_FGFS/fgdata)"
  1398. fi
  1399. done
  1400. if [[ "$fgdata_container" = "" ]]
  1401. then
  1402. fgdata_container=$(cd $INSTALL_DIR_FGFS; pwd;)
  1403. fgdata_directory=${f}/fgdata
  1404. if [[ -e $INSTALL_DIR_FGFS/fgdata ]]
  1405. then
  1406. echo "$fgdata_directory is a directory"
  1407. echo "fgdata has been downloaded"
  1408. fi
  1409. fi
  1410. if [[ -e $INSTALL_DIR_FGFS/fgdata ]]
  1411. then
  1412. echo "fgdata version $fgdata_version has been downloaded"
  1413. else
  1414. echo "fgdata version $fgdata_version will be downloaded."
  1415. fi
  1416. SET_WINDOW_TITLE " FGDATA"
  1417. EXDIR=$(pwd)
  1418. cd $INSTALL_DIR_FGFS
  1419. echo "GIT DATA FROM $fgdata_git ... "
  1420.  
  1421. if [ ! -e "fgdata" ]
  1422. then
  1423. # no repository yet - need to clone a fresh one
  1424. git clone $fgdata_git fgdata
  1425. fi
  1426.  
  1427. cd $INSTALL_DIR_FGFS/fgdata
  1428. git remote set-url origin $fgdata_git
  1429. git fetch origin
  1430. if [ "$STABLE" = "STABLE" ]
  1431. then
  1432. # switch to stable branch
  1433. # create local stable branch, ignore errors if it exists
  1434. if [[ "$(git_check_branch_or_tag $fgdata_branch)" = "" ]]
  1435. then
  1436. write_log_and_exec \
  1437. "git branch -f $fgdata_branch origin/$fgdata_branch"
  1438. fi
  1439. # switch to stable branch. No error is reported if we're already on the branch.
  1440. write_log_and_exec "git checkout -f $fgdata_branch"
  1441.  
  1442. # get indicated stable version
  1443.  
  1444. write_log_and_exec "git reset --hard $fgdata_branch"
  1445. else
  1446. # switch to unstable branch
  1447. # create local unstable branch, ignore errors if it exists
  1448. $(git_check_branch_or_tag)
  1449. if [[ "$(git_check_branch_or_tag $fgdata_branch)" = "" ]]
  1450. then
  1451. write_log_and_exec \
  1452. "git branch -f $fgdata_branch origin/$fgdata_branch"
  1453. fi
  1454. # switch to unstable branch. No error is reported if we're already on the branch.
  1455. write_log_and_exec "git checkout -f $fgdata_branch"
  1456. # pull latest version from the unstable branch
  1457. write_log_and_exec "git pull"
  1458. fi
  1459. fi
  1460. fi
  1461. fi
  1462.  
  1463. cd "$current_build_dir"
  1464.  
  1465. # IF SEPARATED FOLDER FOR AIRCRAFTS
  1466. # --fg-aircraft=\$PWD/../aircrafts
  1467. cat > run_fgfs.sh << ENDOFALL
  1468. #!/bin/sh
  1469. cd \$(dirname \$0)
  1470. cd $SUB_INSTALL_DIR/$FGFS_INSTALL_DIR/bin
  1471. export LD_LIBRARY_PATH=$install_dir_plib/lib:$install_dir_osg/lib:../../$SIMGEAR_INSTALL_DIR/lib:../../$OPENRTI_INSTALL_DIR/lib
  1472. ./fgfs --fg-root=\$PWD/../fgdata/ \$@
  1473. ENDOFALL
  1474. chmod 755 run_fgfs.sh
  1475.  
  1476. cat > run_fgfs_debug.sh << ENDOFALL2
  1477. #!/bin/sh
  1478. cd \$(dirname \$0)
  1479. P1=\$PWD
  1480. cd $SUB_INSTALL_DIR/$FGFS_INSTALL_DIR/bin
  1481. export LD_LIBRARY_PATH=$install_dir_plib/lib:$install_dir_osg/lib:../../$SIMGEAR_INSTALL_DIR/lib:../../$OPENRTI_INSTALL_DIR/lib
  1482. gdb --directory="\$P1"/fgfs/source/src/ --args fgfs --fg-root=\$PWD/../fgdata/ \$@
  1483. ENDOFALL2
  1484. chmod 755 run_fgfs_debug.sh
  1485.  
  1486. SCRIPT=run_terrasync.sh
  1487. echo "#!/bin/sh" > $SCRIPT
  1488. echo "cd \$(dirname \$0)" >> $SCRIPT
  1489. echo "cd $SUB_INSTALL_DIR/$FGFS_INSTALL_DIR/bin" >> $SCRIPT
  1490. echo "export LD_LIBRARY_PATH=$install_dir_plib/lib:$install_dir_osg/lib:../../$SIMGEAR_INSTALL_DIR/lib" >> $SCRIPT
  1491. echo "./terrasync \$@" >> $SCRIPT
  1492. chmod 755 $SCRIPT
  1493.  
  1494. if [[ $STOP_AFTER_ONE_MODULE = true ]]; then exit; fi
  1495. fi
  1496.  
  1497. #######################################################
  1498. # FGO!
  1499. #######################################################
  1500. SET_WINDOW_TITLE "Building FGO"
  1501. FGO_INSTALL_DIR=fgo
  1502. INSTALL_DIR_FGO=$INSTALL_DIR/$FGO_INSTALL_DIR
  1503. cd "$current_build_dir"
  1504. if [[ "$(declare -p WHATTOBUILD)" =~ '['([0-9]+)']="FGO"' ]]
  1505. then
  1506. echo "****************************************"
  1507. echo "***************** FGO ******************"
  1508. echo "****************************************"
  1509.  
  1510. if [ "$DOWNLOAD" = "y" ]
  1511. then
  1512. wget http://sites.google.com/site/erobosprojects/flightgear/add-ons/fgo/download/fgo-1-3-1.tar.gz?attredirects=0 -O fgo-1-3-1.tar.gz
  1513. cd install
  1514. tar zxvf ../fgo-1-3-1.tar.gz
  1515.  
  1516. cat fgo/src/gui.py | sed s/"self.process = subprocess.Popen".*/"self.process = subprocess.Popen(self.options, cwd=self.FG_working_dir,env=os.environ)"/g > fgo/src/gui.py-new
  1517. mv fgo/src/gui.py-new fgo/src/gui.py
  1518. cd ..
  1519.  
  1520. fi
  1521.  
  1522. SCRIPT=run_fgo.sh
  1523. echo "#!/bin/sh" > $SCRIPT
  1524. echo "cd \$(dirname \$0)" >> $SCRIPT
  1525. echo "cd $SUB_INSTALL_DIR" >> $SCRIPT
  1526. echo "p=\$(pwd)" >> $SCRIPT
  1527. echo "cd $FGO_INSTALL_DIR" >> $SCRIPT
  1528. echo "export LD_LIBRARY_PATH=\$p/plib/lib:\$p/OpenSceneGraph/lib:\$p/simgear/lib" >> $SCRIPT
  1529. echo "python fgo" >> $SCRIPT
  1530. chmod 755 $SCRIPT
  1531.  
  1532. if [[ $STOP_AFTER_ONE_MODULE = true ]]; then exit; fi
  1533. fi
  1534.  
  1535. #######################################################
  1536. # FGx
  1537. #######################################################
  1538. SET_WINDOW_TITLE "Building FGX"
  1539. FGX_INSTALL_DIR=fgx
  1540. INSTALL_DIR_FGX=$INSTALL_DIR/$FGX_INSTALL_DIR
  1541. cd "$current_build_dir"
  1542. if [[ "$(declare -p WHATTOBUILD)" =~ '['([0-9]+)']="FGX"' ]]
  1543. then
  1544. echo "****************************************"
  1545. echo "***************** FGX ******************"
  1546. echo "****************************************"
  1547.  
  1548. if [ "$DOWNLOAD" = "y" ]
  1549. then
  1550.  
  1551. echo -n "git clone git://gitorious.org/fgx/fgx.git ... "
  1552.  
  1553. if [ -d "fgx" ]
  1554. then
  1555. echo "fgx exists already."
  1556. else
  1557. git clone git://gitorious.org/fgx/fgx.git fgx
  1558. fi
  1559.  
  1560. echo " OK"
  1561.  
  1562. fi
  1563.  
  1564. cd fgx/
  1565.  
  1566. git branch -f $FGX_BRANCH origin/$FGX_BRANCH 2> /dev/null || true
  1567. git checkout -f $FGX_BRANCH
  1568. git pull
  1569.  
  1570. cd ..
  1571.  
  1572. cd fgx/src/
  1573.  
  1574. #Patch in order to pre-setting paths
  1575. cd resources/default/
  1576. cp x_default.ini x_default.ini.orig
  1577. cat x_default.ini | sed s/\\/usr\\/bin\\/fgfs/INSTALL_DIR_FGXMY_SLASH_HERE..MY_SLASH_HEREfgfsMY_SLASH_HEREbinMY_SLASH_HEREfgfs/g > tmp1
  1578. cat tmp1 | sed s/\\/usr\\/share\\/flightgear/INSTALL_DIR_FGXMY_SLASH_HERE..MY_SLASH_HEREfgfsMY_SLASH_HEREfgdata/g > tmp2
  1579. cat tmp2 | sed s/\\/usr\\/bin\\/terrasync/INSTALL_DIR_FGXMY_SLASH_HERE..MY_SLASH_HEREfgfsMY_SLASH_HEREbinMY_SLASH_HEREterrasync/g > tmp3
  1580. cat tmp3 | sed s/\\/usr\\/bin\\/fgcom/INSTALL_DIR_FGXMY_SLASH_HERE..MY_SLASH_HEREfgcomMY_SLASH_HEREbinMY_SLASH_HEREfgcom/g > tmp4
  1581. cat tmp4 | sed s/\\/usr\\/bin\\/js_demo/INSTALL_DIR_FGXMY_SLASH_HERE..MY_SLASH_HEREfgfsMY_SLASH_HEREbinMY_SLASH_HEREjs_demo/g > tmp5
  1582.  
  1583. INSTALL_DIR_FGX_NO_SLASHS=$(echo "$INSTALL_DIR_FGX" | sed -e 's/\//MY_SLASH_HERE/g')
  1584. cat tmp5 | sed s/INSTALL_DIR_FGX/"$INSTALL_DIR_FGX_NO_SLASHS"/g > tmp
  1585. cat tmp | sed s/MY_SLASH_HERE/\\//g > x_default.ini
  1586. rm tmp*
  1587.  
  1588. cd ..
  1589.  
  1590.  
  1591. if [ ! "$UPDATE" = "UPDATE" ]
  1592. then
  1593. if [ "$RECONFIGURE" = "y" ]
  1594. then
  1595.  
  1596. echo -n "RECONFIGURE FGX ... "
  1597.  
  1598. mkdir -p $INSTALL_DIR_FGX
  1599. cd $INSTALL_DIR_FGX
  1600.  
  1601. qmake ../../fgx/src
  1602.  
  1603. echo " OK"
  1604. fi
  1605. fi
  1606.  
  1607. if [ "$COMPILE" = "y" ]
  1608. then
  1609. cd $INSTALL_DIR_FGX
  1610. echo "MAKE AND INSTALL FGX"
  1611. echo "make $JOPTION $OOPTION "
  1612. make $JOPTION $OOPTION
  1613. cd ..
  1614. fi
  1615.  
  1616. cd "$current_build_dir"
  1617.  
  1618. SCRIPT=run_fgx.sh
  1619. echo "#!/bin/sh" > $SCRIPT
  1620. echo "cd \$(dirname \$0)" >> $SCRIPT
  1621. echo "cd $SUB_INSTALL_DIR" >> $SCRIPT
  1622. echo "p=\$(pwd)" >> $SCRIPT
  1623. echo "cd $FGX_INSTALL_DIR" >> $SCRIPT
  1624. echo "export LD_LIBRARY_PATH=\$p/plib/lib:\$p/OpenSceneGraph/lib:\$p/simgear/lib" >> $SCRIPT
  1625. echo "./fgx" >> $SCRIPT
  1626. chmod 755 $SCRIPT
  1627.  
  1628. if [[ $STOP_AFTER_ONE_MODULE = true ]]; then exit; fi
  1629. fi
  1630.  
  1631. #######################################################
  1632. # FGRUN
  1633. #######################################################
  1634. SET_WINDOW_TITLE "Building FGRUN"
  1635. FGRUN_INSTALL_DIR=fgrun
  1636. INSTALL_DIR_FGRUN=$INSTALL_DIR/$FGRUN_INSTALL_DIR
  1637. cd "$current_build_dir"
  1638.  
  1639. if [[ "$(declare -p WHATTOBUILD)" =~ '['([0-9]+)']="FGRUN"' ]]
  1640. then
  1641. echo "****************************************"
  1642. echo "**************** FGRUN *****************"
  1643. echo "****************************************"
  1644.  
  1645.  
  1646. if [ "$DOWNLOAD" = "y" ]
  1647. then
  1648. echo -n "GIT FROM git://gitorious.org/fg/fgrun.git ... "
  1649.  
  1650. if [ -d "fgrun" ]
  1651. then
  1652. echo "fgrun exists already."
  1653. else
  1654. git clone git://gitorious.org/fg/fgrun.git fgrun
  1655. fi
  1656.  
  1657. cd fgrun
  1658. if [[ $(grep -L 'list(APPEND FLTK_LIBRARIES ${CMAKE_DL_LIBS})' CMakeLists.txt) != "" ]]
  1659. then
  1660. patch CMakeLists.txt <<\EOD
  1661. --- master/fgrun/CMakeLists.txt 2013-05-25 06:37:31.882942339 -0400
  1662. +++ next/fgrun/CMakeLists.txt 2013-08-04 07:54:59.274097042 -0400
  1663. @@ -212,6 +212,10 @@ if ( FLTK_FOUND )
  1664. list(APPEND FLTK_LIBRARIES ${X11_Xft_LIB})
  1665. endif()
  1666.  
  1667. + if ( CMAKE_DL_LIBS )
  1668. + list(APPEND FLTK_LIBRARIES ${CMAKE_DL_LIBS})
  1669. + endif()
  1670. +
  1671. set( CMAKE_REQUIRED_INCLUDES ${FLTK_INCLUDE_DIR} )
  1672. set( CMAKE_REQUIRED_LIBRARIES ${FLTK_LIBRARIES} )
  1673. message(STATUS "Using FLTK_LIBRARIES for fgrun: ${FLTK_LIBRARIES}")
  1674. EOD
  1675. fi
  1676. git fetch origin
  1677. if [ "$STABLE" = "STABLE" ]
  1678. then
  1679. # switch to stable branch
  1680. # create local stable branch, ignore errors if it exists
  1681. ls
  1682. git branch -f $FGRUN_BRANCH origin/$FGRUN_BRANCH 2> /dev/null || true
  1683. # switch to stable branch. No error is reported if we're already on the branch.
  1684. git checkout -f $FGRUN_BRANCH
  1685. # get indicated stable version
  1686. git reset --hard $FGRUN_BRANCH
  1687. else
  1688. # switch to unstable branch
  1689. # create local unstable branch, ignore errors if it exists
  1690. git branch -f $FGRUN_BRANCH origin/$FGRUN_BRANCH 2> /dev/null || true
  1691. # switch to unstable branch. No error is reported if we're already on the branch.
  1692. git checkout -f $FGRUN_BRANCH
  1693. # pull latest version from the unstable branch
  1694. git pull
  1695. fi
  1696.  
  1697. cd ..
  1698.  
  1699. echo " OK"
  1700.  
  1701. fi
  1702.  
  1703. cd fgrun
  1704.  
  1705.  
  1706. if [ ! "$UPDATE" = "UPDATE" ]
  1707. then
  1708. if [ "$RECONFIGURE" = "y" ]
  1709. then
  1710. cd "$current_build_dir"
  1711. mkdir -p build/fgrun
  1712. cd "$current_build_dir"/build/fgrun
  1713.  
  1714. echo -n "RECONFIGURE FGRUN ... "
  1715. rm -f ../../fgrun/CMakeCache.txt
  1716. rm -f CMakeCache.txt
  1717.  
  1718. cmake ${VERBOSE_MAKEFILE} -D CMAKE_BUILD_TYPE="Release" -D CMAKE_CXX_FLAGS="-O3 -D__STDC_CONSTANT_MACROS" -D CMAKE_C_FLAGS="-O3" -D CMAKE_INSTALL_PREFIX:PATH="$INSTALL_DIR_FGRUN" -D "CMAKE_PREFIX_PATH=$INSTALL_DIR_OSG;$INSTALL_DIR_PLIB;$INSTALL_DIR_SIMGEAR" ../../fgrun/
  1719.  
  1720. echo " OK"
  1721. fi
  1722. fi
  1723.  
  1724. if [ "$COMPILE" = "y" ]
  1725. then
  1726. cd "$current_build_dir"/build/fgrun
  1727.  
  1728. echo "MAKE FGRUN"
  1729. echo "make $JOPTION $OOPTION"
  1730. make $JOPTION $OOPTION 2>1
  1731.  
  1732. echo "INSTALL FGRUN"
  1733. make install
  1734. fi
  1735.  
  1736. cd "$current_build_dir"
  1737.  
  1738. SCRIPT=run_fgrun.sh
  1739. echo "#!/bin/sh" > $SCRIPT
  1740. echo "cd \$(dirname \$0)" >> $SCRIPT
  1741. echo "cd $SUB_INSTALL_DIR/$FGRUN_INSTALL_DIR/bin" >> $SCRIPT
  1742. echo "export LD_LIBRARY_PATH=$install_dir_plib/lib:$install_dir_osg/lib:../../$SIMGEAR_INSTALL_DIR/lib" >> $SCRIPT
  1743. #echo "export FG_AIRCRAFTS=\$PWD/../../$FGFS_INSTALL_DIR/aircrafts" >> $SCRIPT
  1744. echo "./fgrun --fg-exe=\$PWD/../../$FGFS_INSTALL_DIR/bin/fgfs --fg-root=\$PWD/../../$FGFS_INSTALL_DIR/fgdata \$@" >> $SCRIPT
  1745. chmod 755 $SCRIPT
  1746.  
  1747.  
  1748. if [[ $STOP_AFTER_ONE_MODULE = true ]]; then exit; fi
  1749. fi
  1750.  
  1751. #######################################################
  1752. # FGCOM
  1753. #######################################################
  1754. SET_WINDOW_TITLE "Building FGCOM"
  1755. FGCOM_INSTALL_DIR=fgcom
  1756. INSTALL_DIR_FGCOM=$INSTALL_DIR/$FGCOM_INSTALL_DIR
  1757. cd "$current_build_dir"
  1758.  
  1759. if [[ "$(declare -p WHATTOBUILD)" =~ '['([0-9]+)']="FGCOM"' ]]
  1760. then
  1761. echo "****************************************"
  1762. echo "**************** FGCOM *****************"
  1763. echo "****************************************"
  1764.  
  1765.  
  1766. #svn checkout svn://svn.dfn.de:/fgcom/trunk fgcom
  1767. if [ "$DOWNLOAD" = "y" ]
  1768. then
  1769. echo -n "git://gitorious.org/fg/fgcom.git ... "
  1770.  
  1771. if [ -d "fgcom" ]
  1772. then
  1773. echo "fgcom exists already."
  1774. else
  1775. git clone git://gitorious.org/fg/fgcom.git
  1776. fi
  1777.  
  1778. cd fgcom
  1779. git fetch origin
  1780.  
  1781. # create local unstable branch, ignore errors if it exists
  1782. git branch -f $FGCOM_UNSTABLE_GIT_BRANCH origin/$FGCOM_UNSTABLE_GIT_BRANCH 2> /dev/null || true
  1783. # switch to unstable branch. No error is reported if we're already on the branch.
  1784. git checkout -f $FGCOM_UNSTABLE_GIT_BRANCH
  1785. # pull latest version from the unstable branch
  1786. git pull
  1787.  
  1788. echo " OK"
  1789. cd ..
  1790.  
  1791. #patch for new netdb.h version.
  1792. cat fgcom/iaxclient/lib/libiax2/src/iax.c | sed s/hp-\>h_addr,/hp-\>h_addr_list[0],/g > fgcom/iaxclient/lib/libiax2/src/iax_ok.c
  1793. mv fgcom/iaxclient/lib/libiax2/src/iax_ok.c fgcom/iaxclient/lib/libiax2/src/iax.c
  1794. fi
  1795.  
  1796. cd "$current_build_dir"
  1797. if [ -d "fgcom" ]
  1798. then
  1799. if [ "$RECONFIGURE" = "y" ]
  1800. then
  1801. cd "$current_build_dir"/fgcom
  1802.  
  1803. cd "$current_build_dir"
  1804. mkdir -p build/fgcom
  1805.  
  1806. cd "$current_build_dir"/build/fgcom
  1807. echo -n "RECONFIGURE FGCOM ... "
  1808. rm -f CMakeCache.txt
  1809. # add -lpthread for UNIX
  1810. cmake ${VERBOSE_MAKEFILE} -DCMAKE_SKIP_INSTALL_RPATH:BOOL=TRUE -DCMAKE_SKIP_RPATH:BOOL=TRUE -DFIND_PTHREAD_LIB:BOOL=TRUE -D CMAKE_BUILD_TYPE="Release" -D "CMAKE_PREFIX_PATH=$INSTALL_DIR_PLIB" -D "CMAKE_INSTALL_PREFIX:PATH=$INSTALL_DIR_FGCOM" "$current_build_dir"/fgcom 2>&1
  1811.  
  1812. echo " OK"
  1813.  
  1814. cd "$current_build_dir"/fgcom/src/
  1815. fi
  1816.  
  1817. cd "$current_build_dir"/build/fgcom
  1818.  
  1819. mkdir -p "$INSTALL_DIR_FGCOM"/bin
  1820.  
  1821. if [ "$COMPILE" = "y" ]
  1822. then
  1823. echo "MAKE FGCOM"
  1824. echo "cmake --build . --config Release"
  1825. cmake --build . --config Release
  1826.  
  1827. echo "INSTALL FGCOM"
  1828. cmake ${VERBOSE_MAKEFILE} -DBUILD_TYPE=Release -P cmake_install.cmake
  1829. fi
  1830. cd "$current_build_dir"
  1831.  
  1832. echo "#!/bin/sh" > run_fgcom.sh
  1833. echo "cd \$(dirname \$0)" >> run_fgcom.sh
  1834. echo "cd $SUB_INSTALL_DIR/$FGCOM_INSTALL_DIR/bin" >> run_fgcom.sh
  1835. echo "export LD_LIBRARY_PATH=$install_dir_plib/lib:$install_dir_osg/lib:../../$SIMGEAR_INSTALL_DIR/lib" >> run_fgcom.sh
  1836. echo "./fgcom -Sfgcom.flightgear.org.uk \$@" >> run_fgcom.sh
  1837. chmod 755 run_fgcom.sh
  1838. fi
  1839. if [[ $STOP_AFTER_ONE_MODULE = true ]]; then exit; fi
  1840. fi
  1841.  
  1842. #######################################################
  1843. # FGCOMGUI
  1844. #######################################################
  1845. SET_WINDOW_TITLE "Building FGCOMGUI"
  1846. FGCOMGUI_INSTALL_DIR=fgcomgui
  1847. INSTALL_DIR_FGCOMGUI=$INSTALL_DIR/$FGCOMGUI_INSTALL_DIR
  1848. cd "$current_build_dir"
  1849.  
  1850. if [[ "$(declare -p WHATTOBUILD)" =~ '['([0-9]+)']="FGCOMGUI"' ]]
  1851. then
  1852. echo "****************************************"
  1853. echo "*************** FGCOMGUI ***************"
  1854. echo "****************************************"
  1855.  
  1856.  
  1857. #svn checkout svn://svn.dfn.de:/fgcom/trunk fgcom
  1858. if [ "$DOWNLOAD" = "y" ]
  1859. then
  1860. FGCOMGUI_STABLE_REVISION_=""
  1861. if [ "$STABLE" = "STABLE" ]
  1862. then
  1863. FGCOMGUI_STABLE_REVISION_=" -r $FGCOMGUI_STABLE_REVISION"
  1864. fi
  1865.  
  1866. echo -n "SVN FROM https://fgcomgui.googlecode.com/svn/trunk ... "
  1867. svn $FGCOMGUI_STABLE_REVISION_ co https://fgcomgui.googlecode.com/svn/trunk fgcomgui
  1868. echo " OK"
  1869.  
  1870. fi
  1871.  
  1872. if [ -d "fgcomgui" ]
  1873. then
  1874. cd fgcomgui/
  1875.  
  1876. mkdir -p "$INSTALL_DIR_FGCOMGUI"
  1877.  
  1878. if [ "$COMPILE" = "y" ]
  1879. then
  1880. echo "SCONS FGCOMGUI"
  1881. echo "scons prefix=\"$INSTALL_DIR_FGCOMGUI\" $JOPTION"
  1882. scons prefix="$INSTALL_DIR_FGCOMGUI" $JOPTION
  1883. echo "INSTALL FGCOM"
  1884. scons install
  1885. fi
  1886. cd "$current_build_dir"
  1887.  
  1888. echo "#!/bin/sh" > run_fgcomgui.sh
  1889. echo "cd \$(dirname \$0)" >> run_fgcomgui.sh
  1890. echo "cd $SUB_INSTALL_DIR/$FGCOMGUI_INSTALL_DIR/bin" >> run_fgcomgui.sh
  1891. echo "export LD_LIBRARY_PATH=$install_dir_plib/lib:$install_dir_osg/lib:../../$SIMGEAR_INSTALL_DIR/lib" >> run_fgcomgui.sh
  1892. echo "export PATH=../../fgcom/bin/:$PATH" >> run_fgcomgui.sh
  1893. echo "./fgcomgui \$@" >> run_fgcomgui.sh
  1894. chmod 755 run_fgcomgui.sh
  1895. fi
  1896.  
  1897. if [[ $STOP_AFTER_ONE_MODULE = true ]]; then exit; fi
  1898. fi
  1899. #######################################################
  1900. # OPENRADAR
  1901. #######################################################
  1902. SET_WINDOW_TITLE "Building OPENRADAR"
  1903. OR_INSTALL_DIR=openradar
  1904. INSTALL_DIR_OR=$INSTALL_DIR/$OR_INSTALL_DIR
  1905. cd "$current_build_dir"
  1906.  
  1907. if [[ "$(declare -p WHATTOBUILD)" =~ '['([0-9]+)']="OPENRADAR"' ]]
  1908. then
  1909. echo "****************************************"
  1910. echo "************** OPENRADAR ***************"
  1911. echo "****************************************"
  1912.  
  1913.  
  1914. if [ "$DOWNLOAD" = "y" ]
  1915. then
  1916. wget $OR_STABLE_RELEASE -O OpenRadar.zip
  1917. cd install
  1918. unzip ../OpenRadar.zip
  1919. cd ..
  1920. fi
  1921.  
  1922. echo "#!/bin/sh" > run_openradar.sh
  1923. echo "cd \$(dirname \$0)" >> run_openradar.sh
  1924. echo "cd install/OpenRadar" >> run_openradar.sh
  1925. echo "java -jar OpenRadar.jar" >> run_openradar.sh
  1926. chmod 755 run_openradar.sh
  1927. if [[ $STOP_AFTER_ONE_MODULE = true ]]; then exit; fi
  1928. fi
  1929.  
  1930. #######################################################
  1931. # ATLAS
  1932. #######################################################
  1933. SET_WINDOW_TITLE "Building ATLAS"
  1934. ATLAS_INSTALL_DIR=atlas
  1935. INSTALL_DIR_ATLAS=$INSTALL_DIR/$ATLAS_INSTALL_DIR
  1936. cd "$current_build_dir"
  1937.  
  1938. if [[ "$(declare -p WHATTOBUILD)" =~ '['([0-9]+)']="ATLAS"' ]]
  1939. then
  1940. echo "****************************************"
  1941. echo "**************** ATLAS *****************"
  1942. echo "****************************************"
  1943.  
  1944. if [ "$DOWNLOAD" = "y" ]
  1945. then
  1946. echo -n "CSV FROM atlas.cvs.sourceforge.net:/cvsroot/atlas ... "
  1947. cvs -z3 -d:pserver:[email protected]:/cvsroot/atlas co Atlas
  1948. echo " OK"
  1949.  
  1950. echo "fixing old function name \".get_gbs_center2(\" in Subbucket.cxx"
  1951. cd Atlas/src
  1952. cp Subbucket.cxx Subbucket.cxx.original
  1953. cat Subbucket.cxx.original | sed s/\.get_gbs_center2\(/\.get_gbs_center\(/g > Subbucket.cxx
  1954. cd "$current_build_dir"
  1955. fi
  1956.  
  1957. if [ -d "Atlas" ]
  1958. then
  1959. cd Atlas
  1960.  
  1961. if [ ! "$UPDATE" = "UPDATE" ]
  1962. then
  1963. if [ "$RECONFIGURE" = "y" ]
  1964. then
  1965.  
  1966. cd "$current_build_dir"
  1967. mkdir -p build/atlas
  1968.  
  1969. cd Atlas
  1970. echo "AUTOGEN ATLAS"
  1971. ./autogen.sh
  1972. echo "CONFIGURE ATLAS"
  1973. cd "$current_build_dir"/build/atlas
  1974. ../../Atlas/configure --prefix=$INSTALL_DIR_ATLAS --exec-prefix=$INSTALL_DIR_ATLAS --with-plib=$INSTALL_DIR_PLIB --with-simgear="$INSTALL_DIR_SIMGEAR" --with-fgbase="$INSTALL_DIR_FGFS/fgdata" CXXFLAGS="$CXXFLAGS -I$current_build_dir/OpenSceneGraph/include"
  1975. make clean
  1976. fi
  1977. fi
  1978. if [ "$COMPILE" = "y" ]
  1979. then
  1980. echo "MAKE ATLAS"
  1981. echo "make $JOPTION $OOPTION"
  1982.  
  1983. cd "$current_build_dir"/build/atlas
  1984. make $JOPTION $OOPTION
  1985.  
  1986. echo "INSTALL ATLAS"
  1987. make install
  1988. fi
  1989. cd "$current_build_dir"
  1990.  
  1991. echo "#!/bin/sh" > run_atlas.sh
  1992. echo "cd \$(dirname \$0)" >> run_atlas.sh
  1993. echo "cd $SUB_INSTALL_DIR/$ATLAS_INSTALL_DIR/bin" >> run_atlas.sh
  1994. echo "export LD_LIBRARY_PATH=$install_dir_plib/lib:$install_dir_osg/lib:../../$SIMGEAR_INSTALL_DIR/lib" >> run_atlas.sh
  1995. echo "./Atlas --fg-root=\$PWD/../../$FGFS_INSTALL_DIR/fgdata \$@" >> run_atlas.sh
  1996. chmod 755 run_atlas.sh
  1997. fi
  1998. fi
  1999. SET_WINDOW_TITLE "Finished Building"
  2000. echo " finished at $(date)" >>download_and_compile_summary.log
  2001. echo "" >>download_and_compile_summary.log
  2002.  
  2003. check_build "$current_build_dir"
  2004.  
  2005. echo "To start fgfs, run the run_fgfs.sh file"
  2006. echo "To start terrasync, run the run_terrasync.sh file"
  2007. echo "To start fgrun, run the run_fgrun.sh file"
  2008. echo "To start fgcom, run the run_fgcom.sh file"
  2009. echo "To start fgcom GUI, run the run_fgcomgui.sh file"
  2010. echo "To start atlas, run the run_atlas.sh file"
  2011.  
  2012. if [ "$HELP" = "HELP" ]
  2013. then
  2014. echo ""
  2015. else
  2016. echo "Usage: $0 -h"
  2017. echo "for help"
  2018. echo "$rebuild_command" >rebuild
  2019. chmod +x rebuild
  2020. fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement