diff --git a/download_and_compile.sh b/download_and_compile.sh index e789955..469554c 100755 --- a/download_and_compile.sh +++ b/download_and_compile.sh @@ -17,7 +17,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -VERSION="1.9-11" +VERSION="1.9-12" #COMPILE GIT FGFS @@ -34,14 +34,153 @@ VERSION="1.9-11" # --------------------------------------------------------- # Script Section: Script and Option Initialization # --------------------------------------------------------- +function write_log(){ + if [[ "$1" = "separator" ]] + then + echo "" | tee -a download_and_compile_summary.log + echo "-----------------------------------------------------------------------------------" \ + | tee -a download_and_compile_summary.log + echo "" | tee -a download_and_compile_summary.log + else + echo "$(date) $1"| tee -a download_and_compile_summary.log + fi +} +function write_log_and_exec(){ + write_log "$1 $2" + $1 +} +function SET_WINDOW_TITLE(){ + echo -ne "\033]0;Build Flightgear: - ${CBD} - $1\007" +} +function check_build(){ +# +# which directories have flightgear installations +# + + +cd $1 +pwd=$(pwd) +for fgfs_install_dir in $(find $1 -type d -regex '.*install/fgfs') +do + write_log; write_log; + + cd $pwd + + cd "${fgfs_install_dir}/.." + install_dir=$(pwd) + exe_fgfs="" + exe_fgrun="" + exe_fgcom="" + exe_fgcomgui="" + install_dir_fgfs="" + install_dir_fgrun="" + install_dir_fgcom="" + install_dir_fgcomgui="" + no_exe_fgfs="" + no_exe_fgrun="" + no_exe_fgcom="" + no_exe_fgcomgui="" + no_install_dir_fgfs="" + no_install_dir_fgrun="" + no_install_dir_fgcom="" + no_install_dir_fgcomgui="" + + if [[ -e ${install_dir}/fgfs/bin/fgfs ]] + then + exe_fgfs="fgfs" + else + no_exe_fgfs="fgfs" + fi + + if [[ -e "${install_dir}/fgrun/bin/fgrun" ]] + then + exe_fgrun="fgrun" + else + no_exe_fgrun="fgrun" + fi + + if [[ -e "${install_dir}/fgcom/bin/fgcom" ]] + then + exe_fgcom="fgcom" + else + no_exe_fgcom="fgcom" + fi + + if [[ -e "${install_dir}/fgcomgui/bin/fgcomgui" ]] + then + exe_fgcomgui="fgcomgui" + else + no_exe_fgcomgui="fgcomgui" + fi + + if [[ -e ${install_dir}/fgfs ]] + then + install_dir_fgfs="fgfs" + else + no_install_dir_fgfs="fgfs" + fi + + if [[ -e "${install_dir}/fgrun" ]] + then + install_dir_fgrun="fgrun" + else + no_install_dir_fgrun="fgrun" + fi + + if [[ -e "${install_dir}/fgcom" ]] + then + install_dir_fgcom="fgcom" + else + no_install_dir_fgcom="fgcom" + fi + + if [[ -e "${install_dir}/fgcomgui" ]] + then + install_dir_fgcomgui="fgcomgui" + else + no_install_dir_fgcomgui="fgcomgui" + fi + + + found_exe="$exe_fgfs $exe_fgrun $exe_fgcom $exe_fgcomgui" + no_exe="$no_exe_fgfs $no_exe_fgrun $no_exe_fgcom $no_exe_fgcomgui" + found_install_dir="$install_dir_fgfs $install_dir_fgrun $install_dir_fgcom $install_dir_fgcomgui" + no_install_dir="$no_install_dir_fgfs $no_install_dir_fgrun $no_install_dir_fgcom $no_install_dir_fgcomgui" + found_exe=${found_exe=## } + found_install_dir=${found_install_dir=##} + no_exe=${no_exe##} + no_install_dir=${no_install_dir##} + + cd $pwd + + write_log separator + write_log "Install dir: ${install_dir}" + write_log separator + + write_log "Found fgdata: $(cat $install_dir/fgfs/fgdata/version)" + write_log "Found Executables: $found_exe" + write_log "Found Install Dir: $found_install_dir" + write_log "Found No Executables: $no_exe" + write_log "Found No Install Dir: $no_install_dir" + write_log "" + write_log separator + write_log separator + write_log "" +done +} +rebuild_command="$0 $*" +echo $0 $* >>download_and_compile.log +echo " started building in $(pwd)" >>download_and_compile.log +echo " at $(date)" >>download_and_compile.log LOGFILE=compilation_log.txt LOGSEP="***********************************" WHATTOBUILD= -WHATTOBUILDALL=( PLIB OSG OPENRTI SIMGEAR FGFS DATA FGRUN FGCOM FGCOMGUI) +WHATTOBUILDALL=( PLIB OSG OPENRTI SIMGEAR FGFS DATA FGRUN FGCOM ) UPDATE= STABLE= +STOP_AFTER_ONE_MODULE=false APT_GET_UPDATE="y" DOWNLOAD_PACKAGES="y" @@ -55,18 +194,39 @@ OOPTION="" DEBUG="" WITH_EVENT_INPUT="" WITH_OPENRTI="" - +FGSG_BRANCH="next" +FGSG_REVISION="HEAD" +OSG_VERSION="3.0.1" # --------------------------------------------------------- # Script Section: Option Interpretation # --------------------------------------------------------- +SET_WINDOW_TITLE "Script and Option Initialization" -while getopts "suhgeixvwc:p:a:d:r:j:O:" OPTION +while getopts "zsuhgeixvwc:p:a:d:r:j:O:B:R:G:" OPTION do + echo $OPTION case $OPTION in s) - STABLE="STABLE" + STABLE="STABLE" + FGSG_BRANCH="2.10.0" + FGSG_REVISION="HEAD" ;; - u) + B) + FGSG_BRANCH=$OPTARG + ;; + R) + FGSG_REVISION=$OPTARG + ;; + G) + OSG_VERSION=${OPTARG^^} #3.0.1, 3.0.1d 3.1.9 3.1.9d, next nextd, etc + OSG_DEBUG_OR_RELEASE='Release' + if [[ ${OSG_VERSION%d} != ${OSG_VERSION} ]] + then + OSG_DEBUG_OR_RELEASE='Debug' + OSG_VERSION= ${OSG_VERSION%d} + fi + ;; + u) UPDATE="UPDATE" ;; h) @@ -111,6 +271,9 @@ do w) VERBOSE_MAKEFILE="-D CMAKE_VERBOSE_MAKEFILE=ON" ;; + z) + STOP_AFTER_ONE_MODULE=true + ;; ?) echo "error" HELP="HELP" @@ -123,6 +286,7 @@ done # --------------------------------------------------------- # Script Section: Build Argument Interpretation # --------------------------------------------------------- +SET_WINDOW_TITLE "Option Interpretation" shift $(($OPTIND - 1)) @@ -150,7 +314,7 @@ then WHATTOBUILD=( "${WHATTOBUILDALL[@]}" ) fi -#printf "%s\n" "${WHATTOBUILD[@]}" +printf "%s\n" "${WHATTOBUILD[@]}" # --------------------------------------------------------- # Script Section: Set Source Archive Version Variables @@ -158,38 +322,56 @@ fi # Last stable revision: currently FlightGear 2.10.0 with 3.0.1 PLIB_STABLE_REVISION="2172" -OSG_STABLE_REVISION="http://svn.openscenegraph.org/osg/OpenSceneGraph/tags/OpenSceneGraph-3.0.1/" +OSG_SVN="http://svn.openscenegraph.org/osg/OpenSceneGraph/tags/OpenSceneGraph-${OSG_VERSION}/" -# common stable branch for flightgear, simgear and fgdata -FGSG_STABLE_GIT_BRANCH="release/2.8.0" -FGRUN_STABLE_GIT_BRANCH="master" -OPENRTI_STABLE_GIT_BRANCH="release-0.3" +declare -A OPENRTI_MAP +declare -A FGSG_MAP +declare -A FGDATA_MAP +FGSG_MAP=( [next]="next HEAD" \ + [master]="master HEAD " \ + [2.12.1]="release/2.12.1 HEAD" \ + [2.12.0]="release/2.12.0 HEAD" \ + [2.10.0]="release/2.10.0 HEAD " \ + [2.8.0]="release/2.8.0 version/2.8.0-final" ) +FGDATA_MAP=([next]="next HEAD 2.99.9" \ + [master]="master HEAD 2.12.1" \ + [master]="master HEAD 2.12.0" \ + [2.12.0]="release/2.12.0 HEAD 2.12.0" \ + [2.10.0]="release/2.10.0 HEAD 2.10.0" \ + [2.8.0]="release/2.8.0 HEAD 2.8.0" ) -# unstable branch: next for sg/fg, master for fgdata -FGSG_UNSTABLE_GIT_BRANCH="next" -FGDATA_UNSTABLE_GIT_BRANCH="master" -FGRUN_UNSTABLE_GIT_BRANCH="master" -OPENRTI_UNSTABLE_GIT_BRANCH="master" +OPENRTI_MAP=( [next]="master HEAD" \ + [master]="master HEAD" \ + [2.12.1]="master HEAD" \ + [2.12.0]="master HEAD" \ + [2.10.0]="master HEAD" \ + [2.8.0]="release-0.3 OpenRTI-0.3.0" ) + +FG_SG_VERSION=${FGSG_BRANCH##*/} + +MAP_ITEM=( ${FGSG_MAP[${FG_SG_VERSION}]} ) +FGSG_BRANCH=${MAP_ITEM[0]} +FGSG_REVISION=${MAP_ITEM[1]} + +MAP_ITEM=( ${FGDATA_MAP[${FG_SG_VERSION}]} ) +FGDATA_BRANCH=${MAP_ITEM[1]} +FGDATA_REVISION=${MAP_ITEM[2]} +FGDATA_VERSION=${MAP_ITEM[3]} + +MAP_ITEM=( ${OPENRTI_MAP[${FG_SG_VERSION}]} ) +OPENRTI_BRANCH=${MAP_ITEM[0]} +OPENRTI_REVISION=${MAP_ITEM[1]} -# stable GIT revision: release tag -SIMGEAR_STABLE_REVISION="version/2.8.0-final" -FGFS_STABLE_REVISION="version/2.8.0-final" -FGFS_DATA_STABLE_REVISION="version/2.8.0-final" -OPENRTI_STABLE_REVISION="OpenRTI-0.3.0" # FGCOM -FGCOM_UNSTABLE_GIT_BRANCH="master" +FGCOM_BRANCH="master" FGCOMGUI_STABLE_REVISION="46" -# Current developer revision: latest FlightGear GIT (2.11.0) with OSG 3.0.1 -OSG_UNSTABLE_REVISION="http://svn.openscenegraph.org/osg/OpenSceneGraph/tags/OpenSceneGraph-3.0.1/" +#OpenRadar +OR_STABLE_RELEASE="http://wagnerw.de/OpenRadar.zip" - -# --------------------------------------------------------- -# Script Section: set script to stop if an error occours -# --------------------------------------------------------- - -set -e +fgdata_git="git://gitorious.org/fg/fgdata.git" +echo $(pwd) # --------------------------------------------------------- # Script Section: Display Script Help @@ -220,6 +402,9 @@ then echo "* -w cmake verbose option" echo "* -x set -x bash option" echo "* -v set -v bash option" + echo "* -B branch" + echo "* -R revision" + echo "* -G osg version" exit fi @@ -288,16 +473,22 @@ fi echo $0 $* > $LOGFILE -echo "APT_GET_UPDATE=$APT_GET_UPDATE" >> $LOGFILE -echo "DOWNLOAD_PACKAGES=$DOWNLOAD_PACKAGES" >> $LOGFILE -echo "COMPILE=$COMPILE" >> $LOGFILE -echo "RECONFIGURE=$RECONFIGURE" >> $LOGFILE -echo "DOWNLOAD=$DOWNLOAD" >> $LOGFILE -echo "JOPTION=$JOPTION" >> $LOGFILE -echo "OOPTION=$OOPTION" >> $LOGFILE -echo "DEBUG=$DEBUG" >> $LOGFILE +echo "APT_GET_UPDATE=$APT_GET_UPDATE" |tee -a $LOGFILE +echo "DOWNLOAD_PACKAGES=$DOWNLOAD_PACKAGES" |tee -a $LOGFILE +echo "COMPILE=$COMPILE" |tee -a $LOGFILE +echo "RECONFIGURE=$RECONFIGURE" |tee -a $LOGFILE +echo "DOWNLOAD=$DOWNLOAD" |tee -a $LOGFILE +echo "JOPTION=$JOPTION" |tee -a $LOGFILE +echo "OOPTION=$OOPTION" |tee -a $LOGFILE +echo "DEBUG=$DEBUG" |tee -a $LOGFILE +echo "FGSG_VERSION=$FGSG_VERSION" |tee -a LOGFILE +echo "FGSG_REVISION=$FGSG_REVISION" |tee -a LOGFILE +echo "FGDATA_BRANCH=$FGDATA_BRANCH" |tee -a LOGFILE +echo "FGDATA_REVISION=$FGDATA_REVISION" |tee -a LOGFILE +echo "FGDATA_VERSION=$FGDATA_VERSION" |tee -a LOGFILE + +echo "$LOGSEP" |tee -a $LOGFILE -echo "$LOGSEP" >> $LOGFILE # --------------------------------------------------------- # Script Section: Determine Linux Distribution # --------------------------------------------------------- @@ -316,9 +507,8 @@ DEBIAN_PACKAGES_STABLE="freeglut3-dev libjpeg8-dev libjpeg8 libfltk1.1-dev libfl DEBIAN_PACKAGES_TESTING="freeglut3-dev libjpeg8-dev libjpeg8 libfltk1.3-dev libfltk1.3" DEBIAN_PACKAGES_UNSTABLE="freeglut3-dev libjpeg8-dev libjpeg8 libfltk1.3-dev libfltk1.3" -# checking linux distro and version to differ needed packages if [ "$DISTRIB_ID" = "Ubuntu" -o "$DISTRIB_ID" = "LinuxMint" ] -then +then echo "$DISTRIB_ID $DISTRIB_RELEASE" >> $LOGFILE DISTRO_PACKAGES="$DISTRO_PACKAGES $UBUNTU_PACKAGES" else @@ -338,6 +528,7 @@ echo "$LOGSEP" >> $LOGFILE # --------------------------------------------------------- # Script Section: Install Prerequisite Development Packages # --------------------------------------------------------- +SET_WINDOW_TITLE "Install Prerequisite Development Packages" if [ "$DOWNLOAD_PACKAGES" = "y" ] @@ -379,6 +570,7 @@ fi # ------------------------------------------------------------- # Script Section: Create Required Build and install Directories # ------------------------------------------------------------- +SET_WINDOW_TITLE "Create Required Build and install Directories" COMPILE_BASE_DIR=. @@ -402,6 +594,11 @@ INSTALL_DIR=$CBD/$SUB_INSTALL_DIR cd "$CBD" mkdir -p build +# --------------------------------------------------------- +# Script Section: set script to stop if an error occours +# --------------------------------------------------------- + +set -e # --------------------------------------------------------- # Script Section: Build Components @@ -415,8 +612,6 @@ INSTALL_DIR_PLIB=$INSTALL_DIR/$PLIB_INSTALL_DIR cd "$CBD" -#svn co http://plib.svn.sourceforge.net/svnroot/plib/trunk/ plib - if [[ "$(declare -p WHATTOBUILD)" =~ '['([0-9]+)']="PLIB"' ]] then if [ ! "$UPDATE" = "UPDATE" ] @@ -424,6 +619,7 @@ then echo "****************************************" | tee -a $LOGFILE echo "**************** PLIB ******************" | tee -a $LOGFILE echo "****************************************" | tee -a $LOGFILE + SET_WINDOW_TITLE "Building PLIB" echo "COMPILING PLIB" >> $LOGFILE echo "INSTALL_DIR_PLIB=$INSTALL_DIR_PLIB" >> $LOGFILE @@ -445,10 +641,8 @@ then svn update $PLIB_STABLE_REVISION_ cd - else - echo -n "DOWNLOADING FROM http://plib.svn.sourceforge.net ..." >> $LOGFILE - svn $PLIB_STABLE_REVISION_ co http://plib.svn.sourceforge.net/svnroot/plib/trunk/ plib - #cat plib/src/util/ul.h | sed s/"PLIB_TINY_VERSION 5"/"PLIB_TINY_VERSION 6"/g > ul.h-v1.8.6 - #mv ul.h-v1.8.6 plib/src/util/ul.h + echo -n "DOWNLOADING FROM http://svn.code.sf.net/p/plib/code/trunk/ ..." >> $LOGFILE + svn $PLIB_STABLE_REVISION_ co http://svn.code.sf.net/p/plib/code/trunk/ plib echo " OK" >> $LOGFILE fi fi @@ -495,11 +689,13 @@ then cd "$CBD" fi + if [[ $STOP_AFTER_ONE_MODULE = true ]]; then exit; fi fi ####################################################### # OpenSceneGraph ####################################################### +SET_WINDOW_TITLE "Building OpenSceneGraph" OSG_INSTALL_DIR=OpenSceneGraph INSTALL_DIR_OSG=$INSTALL_DIR/$OSG_INSTALL_DIR cd "$CBD" @@ -510,13 +706,6 @@ then echo "**************** OSG *******************" | tee -a $LOGFILE echo "****************************************" | tee -a $LOGFILE - OSG_SVN=$OSG_UNSTABLE_REVISION - if [ "$STABLE" = "STABLE" ] - then - OSG_SVN=$OSG_STABLE_REVISION - fi - - if [ "$DOWNLOAD" = "y" ] then echo -n "SVN FROM $OSG_SVN ... " >> $LOGFILE @@ -533,7 +722,7 @@ then mkdir -p build/osg cd "$CBD"/build/osg echo -n "RECONFIGURE OSG ... " >> $LOGFILE - rm -f ../../OpenSceneGraph/CMakeCache.txt + rm -f CMakeCache.txt ../../OpenSceneGraph/CMakeCache.txt cmake ../../OpenSceneGraph/ echo " OK" >> $LOGFILE @@ -573,11 +762,13 @@ then fi cd - + if [[ $STOP_AFTER_ONE_MODULE = true ]]; then exit; fi fi ####################################################### # OPENRTI ####################################################### +SET_WINDOW_TITLE "Building OPENRTI" OPENRTI_INSTALL_DIR=openrti INSTALL_DIR_OPENRTI=$INSTALL_DIR/$OPENRTI_INSTALL_DIR cd "$CBD" @@ -614,17 +805,17 @@ then then # switch to stable branch # create local stable branch, ignore errors if it exists - git branch -f $OPENRTI_STABLE_GIT_BRANCH origin/$OPENRTI_STABLE_GIT_BRANCH 2> /dev/null || true + git branch -f $OPENRTI_BRANCH origin/$OPENRTI_BRANCH 2> /dev/null || true # switch to stable branch. No error is reported if we're already on the branch. - git checkout -f $OPENRTI_STABLE_GIT_BRANCH + git checkout -f $OPENRTI_BRANCH # get indicated stable version - git reset --hard $OPENRTI_STABLE_REVISION + git reset --hard $OPENRTI_REVISION else # switch to unstable branch # create local unstable branch, ignore errors if it exists - git branch -f $OPENRTI_UNSTABLE_GIT_BRANCH origin/$OPENRTI_UNSTABLE_GIT_BRANCH 2> /dev/null || true + git branch -f $OPENRTI_BRANCH origin/$OPENRTI_BRANCH 2> /dev/null || true # switch to unstable branch. No error is reported if we're already on the branch. - git checkout -f $OPENRTI_UNSTABLE_GIT_BRANCH + git checkout -f $OPENRTI_BRANCH # pull latest version from the unstable branch git pull fi @@ -669,11 +860,13 @@ then make install 2>&1 | tee -a $LOGFILE fi cd - + if [[ $STOP_AFTER_ONE_MODULE = true ]]; then exit; fi fi ####################################################### # SIMGEAR ####################################################### +SET_WINDOW_TITLE "Building Simgear" SIMGEAR_INSTALL_DIR=simgear INSTALL_DIR_SIMGEAR=$INSTALL_DIR/$SIMGEAR_INSTALL_DIR cd "$CBD" @@ -714,17 +907,17 @@ then then # switch to stable branch # create local stable branch, ignore errors if it exists - git branch -f $FGSG_STABLE_GIT_BRANCH origin/$FGSG_STABLE_GIT_BRANCH 2> /dev/null || true + git branch -f $FGSG_BRANCH origin/$FGSG_BRANCH 2> /dev/null || true # switch to stable branch. No error is reported if we're already on the branch. - git checkout -f $FGSG_STABLE_GIT_BRANCH + git checkout -f $FGSG_BRANCH # get indicated stable version git reset --hard $SIMGEAR_STABLE_REVISION else # switch to unstable branch # create local unstable branch, ignore errors if it exists - git branch -f $FGSG_UNSTABLE_GIT_BRANCH origin/$FGSG_UNSTABLE_GIT_BRANCH 2> /dev/null || true + git branch -f $FGSG_BRANCH origin/$FGSG_BRANCH 2> /dev/null || true # switch to unstable branch. No error is reported if we're already on the branch. - git checkout -f $FGSG_UNSTABLE_GIT_BRANCH + git checkout -f $FGSG_BRANCH # pull latest version from the unstable branch git pull fi @@ -736,6 +929,7 @@ then fi + cd "simgear/simgear" if [ ! "$UPDATE" = "UPDATE" ] @@ -748,6 +942,7 @@ then cd "$CBD"/build/simgear echo -n "RECONFIGURE SIMGEAR ... " >> $LOGFILE rm -f ../../simgear/simgear/CMakeCache.txt + rm -f CMakeCache.txt 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/ 2>&1 | tee -a $LOGFILE echo " OK" >> $LOGFILE @@ -769,11 +964,13 @@ then make install 2>&1 | tee -a $LOGFILE fi cd - + if [[ $STOP_AFTER_ONE_MODULE = true ]]; then exit; fi fi ####################################################### # FGFS ####################################################### +SET_WINDOW_TITLE "Building Flightgear" FGFS_INSTALL_DIR=fgfs INSTALL_DIR_FGFS=$INSTALL_DIR/$FGFS_INSTALL_DIR cd "$CBD" @@ -812,23 +1009,24 @@ then fi cd flightgear + # fix for CMakeLists.txt broken by fltk issues on Ubuntu 13.10 git fetch origin if [ "$STABLE" = "STABLE" ] then # switch to stable branch # create local stable branch, ignore errors if it exists - git branch -f $FGSG_STABLE_GIT_BRANCH origin/$FGSG_STABLE_GIT_BRANCH 2> /dev/null || true + git branch -f $FGSG_BRANCH origin/$FGSG_BRANCH 2> /dev/null || true # switch to stable branch. No error is reported if we're already on the branch. - git checkout -f $FGSG_STABLE_GIT_BRANCH + git checkout -f $FGSG_BRANCH # get indicated stable version git reset --hard $FGFS_STABLE_REVISION else # switch to unstable branch # create local unstable branch, ignore errors if it exists - git branch -f $FGSG_UNSTABLE_GIT_BRANCH origin/$FGSG_UNSTABLE_GIT_BRANCH 2> /dev/null || true + git branch -f $FGSG_BRANCH origin/$FGSG_BRANCH 2> /dev/null || true # switch to unstable branch. No error is reported if we're already on the branch. - git checkout -f $FGSG_UNSTABLE_GIT_BRANCH + git checkout -f $FGSG_BRANCH # pull latest version from the unstable branch git pull fi @@ -840,7 +1038,24 @@ then fi cd flightgear - + if [[ $(grep -L 'list(APPEND FLTK_LIBRARIES ${CMAKE_DL_LIBS})' CMakeLists.txt) != "" ]] + then + patch CMakeLists.txt <<\EOF +--- fgfs/flightgear/CMakeLists.txt_old 2013-08-04 08:59:00.614104454 -0400 ++++ fgfs/flightgear/CMakeLists.txt_new 2013-08-04 09:03:32.430104979 -0400 +@@ -203,6 +203,10 @@ + list(APPEND FLTK_LIBRARIES ${X11_Xft_LIB}) + endif() + ++ if ( CMAKE_DL_LIBS ) ++ list(APPEND FLTK_LIBRARIES ${CMAKE_DL_LIBS}) ++ endif() ++ + message(STATUS "Using FLTK_LIBRARIES for fgadmin: ${FLTK_LIBRARIES}") + endif ( FLTK_FOUND ) + endif(ENABLE_FGADMIN) +EOF +fi if [ ! "$UPDATE" = "UPDATE" ] then if [ "$RECONFIGURE" = "y" ] @@ -859,6 +1074,7 @@ then echo -n "RECONFIGURE FGFS ... " >> $LOGFILE rm -f ../../fgfs/flightgear/CMakeCache.txt + rm -f CMakeCache.txt # REMOVING BAD LINES IN CMakeLists.txt #echo "REMOVING BAD LINES IN CMakeLists.txt" @@ -895,36 +1111,50 @@ then then if [ "$DOWNLOAD" = "y" ] then + SET_WINDOW_TITLE " FGDATA" + if [[ -e ../fgdata_${FGDATA_VERSION} ]] + then + FGDATA_DIR=../fgdata_${FGDATA_VERSION} + fi + if [[ -e ../../fgdata_${FGDATA_VERSION} ]] + then + FGDATA_DIR=../../fgdata_${FGDATA_VERSION} + fi + if [[ ! -e $INSTALL_DIR_FGFS/fgdata && -e ${FGDATA_DIR} ]] + then + ln -s ${FGDATA_DIR} $INSTALL_DIR_FGFS/fgdata + ls -lah $INSTALL_DIR_FGFS/fgdata + fi EXDIR=$(pwd) cd $INSTALL_DIR_FGFS - echo -n "GIT DATA FROM git://gitorious.org/fg/fgdata.git ... " >> $LOGFILE + echo -n "GIT DATA FROM $fgdata_git ... " |tee -a $LOGFILE if [ -d "fgdata" ] then echo "fgdata exists already." else # no repository yet - need to clone a fresh one - git clone git://gitorious.org/fg/fgdata.git fgdata + git clone $fgdata_git fgdata fi - cd fgdata - + cd $INSTALL_DIR_FGFS/fgdata + git remote set-url origin $fgdata_git git fetch origin if [ "$STABLE" = "STABLE" ] then # switch to stable branch # create local stable branch, ignore errors if it exists - git branch -f $FGSG_STABLE_GIT_BRANCH origin/$FGSG_STABLE_GIT_BRANCH 2> /dev/null || true + git branch -f $FGSG_BRANCH origin/$FGSG_BRANCH 2> /dev/null || true # switch to stable branch. No error is reported if we're already on the branch. - git checkout -f $FGSG_STABLE_GIT_BRANCH + git checkout -f $FGSG_BRANCH # get indicated stable version - git reset --hard $FGFS_DATA_STABLE_REVISION + git reset --hard $FGSG_BRANCH else # switch to unstable branch # create local unstable branch, ignore errors if it exists - git branch -f $FGDATA_UNSTABLE_GIT_BRANCH origin/$FGDATA_UNSTABLE_GIT_BRANCH 2> /dev/null || true + git branch -f $FGDATA_BRANCH origin/$FGDATA_BRANCH 2> /dev/null || true # switch to unstable branch. No error is reported if we're already on the branch. - git checkout -f $FGDATA_UNSTABLE_GIT_BRANCH + git checkout -f $FGDATA_BRANCH # pull latest version from the unstable branch git pull fi @@ -968,11 +1198,13 @@ ENDOFALL2 echo "./terrasync \$@" >> $SCRIPT chmod 755 $SCRIPT + if [[ $STOP_AFTER_ONE_MODULE = true ]]; then exit; fi fi ####################################################### # FGO! ####################################################### +SET_WINDOW_TITLE "Building FGO" FGO_INSTALL_DIR=fgo INSTALL_DIR_FGO=$INSTALL_DIR/$FGO_INSTALL_DIR cd "$CBD" @@ -1004,11 +1236,13 @@ then echo "python fgo" >> $SCRIPT chmod 755 $SCRIPT + if [[ $STOP_AFTER_ONE_MODULE = true ]]; then exit; fi fi ####################################################### # FGx ####################################################### +SET_WINDOW_TITLE "Building FGX" FGX_INSTALL_DIR=fgx INSTALL_DIR_FGX=$INSTALL_DIR/$FGX_INSTALL_DIR cd "$CBD" @@ -1036,8 +1270,8 @@ then cd fgx/ - git branch -f $FGX_STABLE_GIT_BRANCH origin/$FGX_STABLE_GIT_BRANCH 2> /dev/null || true - git checkout -f $FGX_STABLE_GIT_BRANCH + git branch -f $FGX_BRANCH origin/$FGX_BRANCH 2> /dev/null || true + git checkout -f $FGX_BRANCH git pull cd .. @@ -1098,11 +1332,13 @@ then echo "./fgx" >> $SCRIPT chmod 755 $SCRIPT + if [[ $STOP_AFTER_ONE_MODULE = true ]]; then exit; fi fi ####################################################### # FGRUN ####################################################### +SET_WINDOW_TITLE "Building FGRUN" FGRUN_INSTALL_DIR=fgrun INSTALL_DIR_FGRUN=$INSTALL_DIR/$FGRUN_INSTALL_DIR cd "$CBD" @@ -1131,24 +1367,41 @@ then fi cd fgrun - +if [[ $(grep -L 'list(APPEND FLTK_LIBRARIES ${CMAKE_DL_LIBS})' CMakeLists.txt) != "" ]] +then +patch CMakeLists.txt <<\EOD +--- master/fgrun/CMakeLists.txt 2013-05-25 06:37:31.882942339 -0400 ++++ next/fgrun/CMakeLists.txt 2013-08-04 07:54:59.274097042 -0400 +@@ -212,6 +212,10 @@ if ( FLTK_FOUND ) + list(APPEND FLTK_LIBRARIES ${X11_Xft_LIB}) + endif() + ++ if ( CMAKE_DL_LIBS ) ++ list(APPEND FLTK_LIBRARIES ${CMAKE_DL_LIBS}) ++ endif() ++ + set( CMAKE_REQUIRED_INCLUDES ${FLTK_INCLUDE_DIR} ) + set( CMAKE_REQUIRED_LIBRARIES ${FLTK_LIBRARIES} ) + message(STATUS "Using FLTK_LIBRARIES for fgrun: ${FLTK_LIBRARIES}") +EOD +fi git fetch origin if [ "$STABLE" = "STABLE" ] then # switch to stable branch # create local stable branch, ignore errors if it exists ls - git branch -f $FGRUN_STABLE_GIT_BRANCH origin/$FGRUN_STABLE_GIT_BRANCH 2> /dev/null || true + git branch -f $FGRUN_BRANCH origin/$FGRUN_BRANCH 2> /dev/null || true # switch to stable branch. No error is reported if we're already on the branch. - git checkout -f $FGRUN_STABLE_GIT_BRANCH + git checkout -f $FGRUN_BRANCH # get indicated stable version - git reset --hard $FGRUN_STABLE_GIT_BRANCH + git reset --hard $FGRUN_BRANCH else # switch to unstable branch # create local unstable branch, ignore errors if it exists - git branch -f $FGRUN_UNSTABLE_GIT_BRANCH origin/$FGRUN_UNSTABLE_GIT_BRANCH 2> /dev/null || true + git branch -f $FGRUN_BRANCH origin/$FGRUN_BRANCH 2> /dev/null || true # switch to unstable branch. No error is reported if we're already on the branch. - git checkout -f $FGRUN_UNSTABLE_GIT_BRANCH + git checkout -f $FGRUN_BRANCH # pull latest version from the unstable branch git pull fi @@ -1172,6 +1425,7 @@ then echo -n "RECONFIGURE FGRUN ... " >> $LOGFILE rm -f ../../fgrun/CMakeCache.txt + rm -f CMakeCache.txt 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/ 2>&1 | tee -a $LOGFILE @@ -1203,11 +1457,13 @@ then chmod 755 $SCRIPT + if [[ $STOP_AFTER_ONE_MODULE = true ]]; then exit; fi fi ####################################################### # FGCOM ####################################################### +SET_WINDOW_TITLE "Building FGCOM" FGCOM_INSTALL_DIR=fgcom INSTALL_DIR_FGCOM=$INSTALL_DIR/$FGCOM_INSTALL_DIR cd "$CBD" @@ -1222,13 +1478,6 @@ then #svn checkout svn://svn.dfn.de:/fgcom/trunk fgcom if [ "$DOWNLOAD" = "y" ] then - - FGCOM_STABLE_REVISION_="" - if [ "$STABLE" = "STABLE" ] - then - FGCOM_STABLE_REVISION_=" -r $FGCOM_STABLE_REVISION" - fi - echo -n "git://gitorious.org/fg/fgcom.git ... " >> $LOGFILE if [ -d "fgcom" ] @@ -1240,24 +1489,14 @@ then cd fgcom git fetch origin - if [ "$STABLE" = "STABLE" ] - then - # switch to stable branch - # create local stable branch, ignore errors if it exists - git branch -f $FGCOM_STABLE_FGOM_BRANCH origin/$FGCOM_STABLE_FGCOM_BRANCH 2> /dev/null || true - # switch to stable branch. No error is reported if we're already on the branch. - git checkout -f $FGCOM_STABLE_FGCOM_BRANCH - # get indicated stable version - git reset --hard $FGCOM_STABLE_REVISION - else - # switch to unstable branch - # create local unstable branch, ignore errors if it exists - git branch -f $FGCOM_UNSTABLE_GIT_BRANCH origin/$FGCOM_UNSTABLE_GIT_BRANCH 2> /dev/null || true - # switch to unstable branch. No error is reported if we're already on the branch. - git checkout -f $FGCOM_UNSTABLE_GIT_BRANCH - # pull latest version from the unstable branch - git pull - fi + + # create local unstable branch, ignore errors if it exists + git branch -f $FGCOM_UNSTABLE_GIT_BRANCH origin/$FGCOM_UNSTABLE_GIT_BRANCH 2> /dev/null || true + # switch to unstable branch. No error is reported if we're already on the branch. + git checkout -f $FGCOM_UNSTABLE_GIT_BRANCH + # pull latest version from the unstable branch + git pull + echo " OK" >> $LOGFILE cd .. @@ -1272,56 +1511,21 @@ then then if [ "$RECONFIGURE" = "y" ] then + cd "$CBD"/fgcom + cd "$CBD" mkdir -p build/fgcom cd "$CBD"/build/fgcom echo -n "RECONFIGURE FGCOM ... " >> $LOGFILE rm -f CMakeCache.txt - cmake ${VERBOSE_MAKEFILE} -D CMAKE_BUILD_TYPE="Release" -D "CMAKE_PREFIX_PATH=$INSTALL_DIR_PLIB;$INSTALL_DIR_SIMGEAR" -D "CMAKE_INSTALL_PREFIX:PATH=$INSTALL_DIR_FGCOM" "$CBD"/fgcom 2>&1 | tee -a $LOGFILE + # add -lpthread for UNIX + 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" "$CBD"/fgcom 2>&1 | tee -a $LOGFILE echo " OK" >> $LOGFILE cd "$CBD"/fgcom/src/ - cp Makefile Makefile.original - cat Makefile | sed s/\\//MY_SLASH_HERE/g > Makefile_NOSLASHES - - # 1 - INSTALL_DIR_PLIB_NO_SLASHES=$(echo "$INSTALL_DIR_PLIB" | sed -e 's/\//MY_SLASH_HERE/g') - cat Makefile_NOSLASHES | sed s/PLIB_PREFIX\ *:=\ *MY_SLASH_HEREusrMY_SLASH_HERElocalMY_SLASH_HEREsrcMY_SLASH_HEREfgfs-builderMY_SLASH_HEREinstall/PLIB_PREFIX\ :=\ $INSTALL_DIR_PLIB_NO_SLASHES/g > Makefile_temp - mv -f Makefile_temp Makefile_NOSLASHES - - #2 - CXXFLAGS=$(cat Makefile_NOSLASHES | grep ^CXXFLAGS | head -n 1) - CXXFLAGS2=$CXXFLAGS" -I $INSTALL_DIR_SIMGEAR/include -I $INSTALL_DIR_OSG/include" - CXXFLAGS3=$(echo $CXXFLAGS2 | sed s/\\//MY_SLASH_HERE/g) - - cat Makefile_NOSLASHES | sed s/^CXXFLAGS\ *:=.*/"$CXXFLAGS3"/g > Makefile_temp - mv -f Makefile_temp Makefile_NOSLASHES - - #3 - LDFLAGS=$(cat Makefile_NOSLASHES | grep ^LDFLAGS | head -n 1) - LDFLAGS2=$LDFLAGS" -L $INSTALL_DIR_SIMGEAR/lib" - LDFLAGS3=$(echo $LDFLAGS2 | sed s/\\//MY_SLASH_HERE/g) - - cat Makefile_NOSLASHES | sed s/^LDFLAGS.*/"$LDFLAGS3"/g > Makefile_temp - mv -f Makefile_temp Makefile_NOSLASHES - - #4 - INSTALL_DIR_FGCOM_NO_SLASHS=$(echo "$INSTALL_DIR_FGCOM" | sed -e 's/\//MY_SLASH_HERE/g') - INSTALL_BIN_FGCOM_NO_SLASHS="$INSTALL_DIR_FGCOM_NO_SLASHS""MY_SLASH_HEREbin" - - cat Makefile_NOSLASHES | sed s/INSTALL_BIN\ *:=\ *MY_SLASH_HEREusrMY_SLASH_HERElocalMY_SLASH_HEREbin/INSTALL_BIN\ :=\ $INSTALL_BIN_FGCOM_NO_SLASHS/g > Makefile_temp - mv -f Makefile_temp Makefile_NOSLASHES - - cat Makefile_NOSLASHES | sed s/INSTALL_DIR\ *:=\ *MY_SLASH_HEREusrMY_SLASH_HERElocal/INSTALL_DIR\ :=\ $INSTALL_DIR_FGCOM_NO_SLASHS/g > Makefile_temp - mv -f Makefile_temp Makefile_NOSLASHES - - - #last - cat Makefile_NOSLASHES | sed s/MY_SLASH_HERE/\\//g > Makefile - fi cd "$CBD"/build/fgcom @@ -1346,11 +1550,13 @@ then echo "./fgcom -Sfgcom.flightgear.org.uk \$@" >> run_fgcom.sh chmod 755 run_fgcom.sh fi + if [[ $STOP_AFTER_ONE_MODULE = true ]]; then exit; fi fi ####################################################### # FGCOMGUI ####################################################### +SET_WINDOW_TITLE "Building FGCOMGUI" FGCOMGUI_INSTALL_DIR=fgcomgui INSTALL_DIR_FGCOMGUI=$INSTALL_DIR/$FGCOMGUI_INSTALL_DIR cd "$CBD" @@ -1401,12 +1607,44 @@ then echo "./fgcomgui \$@" >> run_fgcomgui.sh chmod 755 run_fgcomgui.sh fi -fi + if [[ $STOP_AFTER_ONE_MODULE = true ]]; then exit; fi +fi +####################################################### +# OPENRADAR +####################################################### +SET_WINDOW_TITLE "Building OPENRADAR" +OR_INSTALL_DIR=openradar +INSTALL_DIR_OR=$INSTALL_DIR/$OR_INSTALL_DIR +cd "$CBD" + +if [[ "$(declare -p WHATTOBUILD)" =~ '['([0-9]+)']="OPENRADAR"' ]] +then + echo "****************************************" + echo "************** OPENRADAR ***************" + echo "****************************************" + + + if [ "$DOWNLOAD" = "y" ] + then + wget $OR_STABLE_RELEASE -O OpenRadar.zip + cd install + unzip ../OpenRadar.zip + cd .. + fi + + echo "#!/bin/sh" > run_openradar.sh + echo "cd \$(dirname \$0)" >> run_openradar.sh + echo "cd install/OpenRadar" >> run_openradar.sh + echo "java -jar OpenRadar.jar" >> run_openradar.sh + chmod 755 run_openradar.sh + if [[ $STOP_AFTER_ONE_MODULE = true ]]; then exit; fi +fi ####################################################### # ATLAS ####################################################### +SET_WINDOW_TITLE "Building ATLAS" ATLAS_INSTALL_DIR=atlas INSTALL_DIR_ATLAS=$INSTALL_DIR/$ATLAS_INSTALL_DIR cd "$CBD" @@ -1472,6 +1710,11 @@ then chmod 755 run_atlas.sh fi fi +SET_WINDOW_TITLE "Finished Building" +echo " finished at $(date)" >>download_and_compile.log +echo "" >>download_and_compile.log + +check_build "$CBD" echo "To start fgfs, run the run_fgfs.sh file" echo "To start terrasync, run the run_terrasync.sh file" @@ -1486,4 +1729,10 @@ then else echo "Usage: $0 -h" echo "for help" + echo "$rebuild" >rebuild + chmod +x rebuild fi + + + +