Advertisement
Guest User

Untitled

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