2011-02-07 03:44:11 +08:00
|
|
|
#!/bin/bash
|
|
|
|
#* Written by Francesco Angelo Brisa, started January 2008.
|
|
|
|
#
|
2013-06-06 08:41:01 +08:00
|
|
|
# Copyright (C) 2013 Francesco Angelo Brisa
|
2011-05-20 02:20:53 +08:00
|
|
|
# email: fbrisa@gmail.com - fbrisa@yahoo.it
|
2011-02-07 03:44:11 +08:00
|
|
|
#
|
|
|
|
# This program is free software: you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation, either version 3 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
2015-03-07 02:28:55 +08:00
|
|
|
VERSION="2.32"
|
|
|
|
FGVERSION="release/3.4.0"
|
2011-02-07 03:44:11 +08:00
|
|
|
|
|
|
|
#######################################################
|
|
|
|
# THANKS TO
|
|
|
|
#######################################################
|
|
|
|
# Special thanks to Alessandro Garosi for FGComGui and
|
|
|
|
# other patches
|
2012-11-01 20:28:51 +08:00
|
|
|
# Thanks to "Pat Callahan" for patches for fgrun compilation
|
2012-04-21 01:28:06 +08:00
|
|
|
# Thanks to "F-JJTH" for bug fixes and suggestions
|
2012-11-23 03:38:51 +08:00
|
|
|
# Thanks again to "F-JJTH" for OpenRTI and FGX
|
2015-03-07 02:28:55 +08:00
|
|
|
# Thanks to André, (taureau89_9) for debian stable packages fixes
|
2011-02-07 03:44:11 +08:00
|
|
|
|
2014-05-20 19:06:19 +08:00
|
|
|
LOGFILE=compilation_log.txt
|
|
|
|
WHATTOBUILD=
|
2015-03-07 02:28:55 +08:00
|
|
|
#AVAILABLE VALUES: PLIB OPENRTI SIMGEAR FGFS DATA FGRUN FGO FGX OPENRADAR ATCPIE TERRAGEAR TERRAGEARGUI
|
|
|
|
WHATTOBUILDALL=(SIMGEAR FGFS DATA)
|
2014-05-20 19:06:19 +08:00
|
|
|
STABLE=
|
|
|
|
APT_GET_UPDATE="y"
|
|
|
|
DOWNLOAD_PACKAGES="y"
|
|
|
|
COMPILE="y"
|
|
|
|
RECONFIGURE="y"
|
|
|
|
DOWNLOAD="y"
|
|
|
|
JOPTION=""
|
|
|
|
OOPTION=""
|
|
|
|
DEBUG=""
|
2014-03-04 17:10:52 +08:00
|
|
|
|
2015-03-07 02:28:55 +08:00
|
|
|
while getopts "shc:p:a:d:r:j:O:i" OPTION; do
|
|
|
|
case $OPTION in
|
|
|
|
s) STABLE="STABLE" ;;
|
|
|
|
h) HELP="HELP" ;;
|
|
|
|
a) APT_GET_UPDATE=$OPTARG ;;
|
|
|
|
c) COMPILE=$OPTARG ;;
|
|
|
|
p) DOWNLOAD_PACKAGES=$OPTARG ;;
|
|
|
|
d) DOWNLOAD=$OPTARG ;;
|
|
|
|
r) RECONFIGURE=$OPTARG ;;
|
|
|
|
j) JOPTION=" -j"$OPTARG" " ;;
|
|
|
|
O) OOPTION=" -O"$OPTARG" " ;;
|
|
|
|
?) HELP="HELP" ;;
|
|
|
|
esac
|
2014-05-20 19:06:19 +08:00
|
|
|
done
|
|
|
|
shift $(($OPTIND - 1))
|
2014-03-04 17:10:52 +08:00
|
|
|
|
2014-05-20 19:06:19 +08:00
|
|
|
if [ ! "$#" = "0" ]; then
|
2015-03-07 02:28:55 +08:00
|
|
|
for arg in $*
|
|
|
|
do
|
|
|
|
WHATTOBUILD=( "${WHATTOBUILD[@]}" "$arg" )
|
|
|
|
done
|
2014-05-20 19:06:19 +08:00
|
|
|
else
|
2015-03-07 02:28:55 +08:00
|
|
|
WHATTOBUILD=( "${WHATTOBUILDALL[@]}" )
|
2014-03-04 17:10:52 +08:00
|
|
|
fi
|
|
|
|
|
2014-05-20 19:06:19 +08:00
|
|
|
if [[ "$(declare -p WHATTOBUILD)" =~ '['([0-9]+)']="ALL"' ]]; then
|
2015-03-07 02:28:55 +08:00
|
|
|
WHATTOBUILD=( "${WHATTOBUILDALL[@]}" )
|
2014-05-20 19:06:19 +08:00
|
|
|
fi
|
2013-11-25 05:57:21 +08:00
|
|
|
|
2015-03-07 02:28:55 +08:00
|
|
|
|
|
|
|
if [ "$STABLE" = "STABLE" ]; then
|
|
|
|
FGVERSION=$FGVERSION
|
|
|
|
else
|
|
|
|
FGVERSION="next"
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-05-20 19:06:19 +08:00
|
|
|
#############################################################"
|
|
|
|
# Some helper for redundant task
|
2013-11-25 05:57:21 +08:00
|
|
|
|
2014-05-20 19:06:19 +08:00
|
|
|
function _logSep(){
|
2015-03-07 02:28:55 +08:00
|
|
|
echo "***********************************" >> $LOGFILE
|
2014-05-20 19:06:19 +08:00
|
|
|
}
|
2013-11-25 05:57:21 +08:00
|
|
|
|
2014-05-20 19:06:19 +08:00
|
|
|
function _gitUpdate(){
|
2015-03-07 02:28:55 +08:00
|
|
|
if [ "$DOWNLOAD" != "y" ]; then
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
branch=$1
|
|
|
|
set +e
|
|
|
|
git diff --exit-code 2>&1 > /dev/null
|
|
|
|
if [ $? != 1 ]; then
|
|
|
|
set -e
|
|
|
|
git checkout -f $branch
|
|
|
|
git pull -r
|
|
|
|
else
|
|
|
|
set -e
|
|
|
|
git stash save -u -q
|
|
|
|
git checkout -f $branch
|
|
|
|
git pull -r
|
|
|
|
git stash pop -q
|
|
|
|
fi
|
2014-05-20 19:06:19 +08:00
|
|
|
}
|
2013-11-25 05:57:21 +08:00
|
|
|
|
2014-05-20 19:06:19 +08:00
|
|
|
function _gitDownload(){
|
2015-03-07 02:28:55 +08:00
|
|
|
if [ "$DOWNLOAD" != "y" ]; then
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
repo=$1
|
|
|
|
if [ -f "README" -o -f "README.txt" ]; then
|
|
|
|
echo "$repo exists already"
|
|
|
|
else
|
|
|
|
git clone $repo .
|
|
|
|
fi
|
2013-11-25 05:57:21 +08:00
|
|
|
}
|
2014-03-04 17:10:52 +08:00
|
|
|
|
2014-05-20 19:06:19 +08:00
|
|
|
function _make(){
|
2015-03-07 02:28:55 +08:00
|
|
|
if [ "$COMPILE" = "y" ]; then
|
|
|
|
pkg=$1
|
|
|
|
cd "$CBD"/build/$pkg
|
|
|
|
echo "MAKE $pkg" >> $LOGFILE
|
|
|
|
make $JOPTION $OOPTION 2>&1 | tee -a $LOGFILE
|
|
|
|
echo "INSTALL $pkg" >> $LOGFILE
|
|
|
|
make install 2>&1 | tee -a $LOGFILE
|
|
|
|
fi
|
2014-05-20 19:06:19 +08:00
|
|
|
}
|
2011-08-17 03:42:51 +08:00
|
|
|
|
2014-05-20 19:06:19 +08:00
|
|
|
#######################################################
|
|
|
|
# set script to stop if an error occours
|
|
|
|
set -e
|
2011-02-07 03:44:11 +08:00
|
|
|
|
2014-05-20 19:06:19 +08:00
|
|
|
if [ "$HELP" = "HELP" ]; then
|
2015-03-07 02:28:55 +08:00
|
|
|
echo "$0 Version $VERSION"
|
|
|
|
echo "Usage:"
|
|
|
|
echo "./$0 [-h] [-s] [-e] [-f] [-i] [-g] [-a y|n] [-c y|n] [-p y|n] [-d y|n] [-r y|n] [ALL|PLIB|OPENRTI|SIMGEAR|FGFS|DATA|FGRUN|FGO|FGX|OPENRADAR|ATCPIE|TERRAGEAR|TERRAGEARGUI]"
|
|
|
|
echo "* without options or with ALL it recompiles the content of the WHATTOBUILDALL variable."
|
|
|
|
echo "* Feel you free to customize the WHATTOBUILDALL variable available on the top of this script"
|
|
|
|
echo "Switches:"
|
|
|
|
echo "* -h show this help"
|
|
|
|
echo "* -e compile FlightGear with --with-eventinput option (experimental)"
|
|
|
|
echo "* -g compile with debug info for gcc"
|
|
|
|
echo "* -a y|n y=do an apt-get update n=skip apt-get update default=y"
|
|
|
|
echo "* -p y|n y=download packages n=skip download packages default=y"
|
|
|
|
echo "* -c y|n y=compile programs n=do not compile programs default=y"
|
|
|
|
echo "* -d y|n y=fetch programs from internet (cvs, svn, etc...) n=do not fetch default=y"
|
|
|
|
echo "* -j X Add -jX to the make compilation default=None"
|
|
|
|
echo "* -O X Add -OX to the make compilation default=None"
|
|
|
|
echo "* -r y|n y=reconfigure programs before compiling them n=do not reconfigure default=y"
|
|
|
|
echo "* -s compile only last stable known versions default=y"
|
|
|
|
exit
|
2011-02-07 03:44:11 +08:00
|
|
|
fi
|
|
|
|
|
2014-05-20 19:06:19 +08:00
|
|
|
#######################################################
|
|
|
|
#######################################################
|
2011-02-07 03:44:11 +08:00
|
|
|
# Warning about compilation time and size
|
|
|
|
# Idea from Jester
|
|
|
|
echo "**************************************"
|
|
|
|
echo "* *"
|
|
|
|
echo "* Warning, the compilation process *"
|
2012-08-24 02:49:07 +08:00
|
|
|
echo "* is going to use 12 or more Gbytes *"
|
2011-02-07 03:44:11 +08:00
|
|
|
echo "* of space and at least a couple of *"
|
|
|
|
echo "* hours to download and build FG. *"
|
|
|
|
echo "* *"
|
|
|
|
echo "* Please, be patient ...... *"
|
|
|
|
echo "* *"
|
|
|
|
echo "**************************************"
|
|
|
|
|
2014-05-20 19:06:19 +08:00
|
|
|
#######################################################
|
|
|
|
#######################################################
|
2011-02-07 03:44:11 +08:00
|
|
|
|
2014-05-20 19:06:19 +08:00
|
|
|
echo $0 $* > $LOGFILE
|
2015-03-07 02:28:55 +08:00
|
|
|
echo "VERSION=$VERSION" >> $LOGFILE
|
2014-05-20 19:06:19 +08:00
|
|
|
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
|
|
|
|
_logSep
|
|
|
|
|
2015-03-07 02:28:55 +08:00
|
|
|
#######################################################
|
|
|
|
#######################################################
|
|
|
|
# Minimum
|
|
|
|
PKG="build-essential cmake git"
|
|
|
|
# TG
|
|
|
|
PKG="$PKG libcgal-dev libgdal-dev libtiff5-dev"
|
|
|
|
# TGGUI/OpenRTI
|
|
|
|
PKG="$PKG libqt4-dev"
|
|
|
|
# SG/FG
|
|
|
|
PKG="$PKG zlib1g-dev freeglut3-dev libboost-dev libopenscenegraph-dev"
|
|
|
|
# FG
|
|
|
|
PKG="$PKG libopenal-dev libudev-dev qt5-default libdbus-1-dev libpng12-dev libplib-dev"
|
|
|
|
# FGPanel
|
|
|
|
PKG="$PKG fluid libbz2-dev libfltk1.3-dev libxi-dev libxmu-dev"
|
|
|
|
# FGAdmin
|
|
|
|
PKG="$PKG libxinerama-dev libjpeg-dev libxft-dev"
|
|
|
|
# ATC-Pie
|
|
|
|
PKG="$PKG python3-pyqt5 python3-pyqt5.qtmultimedia libqt5multimedia5-plugins"
|
|
|
|
# FGo
|
|
|
|
PKG="$PKG python-tk"
|
|
|
|
# FGx (FGx is not compatible with Qt5, however we have installed Qt5 by default)
|
|
|
|
#PKG="$PKG libqt5xmlpatterns5-dev libqt5webkit5-dev"
|
2011-02-07 03:44:11 +08:00
|
|
|
|
2014-05-20 19:06:19 +08:00
|
|
|
if [ "$DOWNLOAD_PACKAGES" = "y" ]; then
|
2015-03-07 02:28:55 +08:00
|
|
|
echo "Asking password for apt-get operations..."
|
|
|
|
if [ "$APT_GET_UPDATE" = "y" ]; then
|
|
|
|
sudo apt-get update
|
|
|
|
fi
|
|
|
|
sudo apt-get install $PKG
|
2011-02-07 03:44:11 +08:00
|
|
|
fi
|
|
|
|
|
2015-03-07 02:28:55 +08:00
|
|
|
#######################################################
|
|
|
|
#######################################################
|
|
|
|
|
2014-05-20 19:06:19 +08:00
|
|
|
CBD=$(pwd)
|
|
|
|
LOGFILE=$CBD/$LOGFILE
|
|
|
|
echo "DIRECTORY= $CBD" >> $LOGFILE
|
|
|
|
_logSep
|
2013-07-30 10:06:20 +08:00
|
|
|
mkdir -p install
|
2011-02-07 03:44:11 +08:00
|
|
|
SUB_INSTALL_DIR=install
|
2014-05-20 19:06:19 +08:00
|
|
|
INSTALL_DIR=$CBD/$SUB_INSTALL_DIR
|
|
|
|
cd "$CBD"
|
2012-04-18 16:38:22 +08:00
|
|
|
mkdir -p build
|
|
|
|
|
2014-05-20 19:06:19 +08:00
|
|
|
#######################################################
|
|
|
|
# BACKWARD COMPATIBILITY WITH 1.9.14a
|
|
|
|
#######################################################
|
2013-07-30 10:06:20 +08:00
|
|
|
|
2014-05-20 19:06:19 +08:00
|
|
|
if [ -d "$CBD"/fgfs/flightgear ]; then
|
2015-03-07 02:28:55 +08:00
|
|
|
echo "Move to the new folder structure"
|
|
|
|
rm -rf OpenSceneGraph
|
|
|
|
rm -rf plib
|
|
|
|
rm -rf build
|
|
|
|
rm -rf install/fgo
|
|
|
|
rm -rf install/fgx
|
|
|
|
rm -rf install/osg
|
|
|
|
rm -rf install/plib
|
|
|
|
rm -rf install/simgear
|
|
|
|
rm -f *.log*
|
|
|
|
rm -f run_*.sh
|
|
|
|
mv openrti/openrti tmp && rm -rf openrti && mv tmp openrti
|
|
|
|
mv fgfs/flightgear tmp && rm -rf fgfs && mv tmp flightgear
|
|
|
|
mv simgear/simgear tmp && rm -rf simgear && mv tmp simgear
|
|
|
|
mkdir -p install/flightgear && mv install/fgfs/fgdata install/flightgear/fgdata
|
|
|
|
echo "Done"
|
2014-05-20 19:06:19 +08:00
|
|
|
fi
|
2013-07-30 10:06:20 +08:00
|
|
|
|
2011-02-07 03:44:11 +08:00
|
|
|
#######################################################
|
|
|
|
# PLIB
|
|
|
|
#######################################################
|
2014-05-20 19:06:19 +08:00
|
|
|
PLIB_INSTALL_DIR=plib
|
|
|
|
INSTALL_DIR_PLIB=$INSTALL_DIR/$PLIB_INSTALL_DIR
|
|
|
|
cd "$CBD"
|
|
|
|
if [[ "$(declare -p WHATTOBUILD)" =~ '['([0-9]+)']="PLIB"' ]]; then
|
2015-03-07 02:28:55 +08:00
|
|
|
echo "****************************************" | tee -a $LOGFILE
|
|
|
|
echo "**************** PLIB ******************" | tee -a $LOGFILE
|
|
|
|
echo "****************************************" | tee -a $LOGFILE
|
|
|
|
|
|
|
|
mkdir -p "plib"
|
|
|
|
cd "$CBD"/plib
|
2015-03-13 01:03:16 +08:00
|
|
|
_gitDownload git://git.code.sf.net/p/libplib/code
|
2015-03-07 02:28:55 +08:00
|
|
|
_gitUpdate master
|
|
|
|
|
|
|
|
if [ "$RECONFIGURE" = "y" ]; then
|
|
|
|
cd "$CBD"
|
|
|
|
mkdir -p build/plib
|
|
|
|
echo "CONFIGURING plib" >> $LOGFILE
|
|
|
|
cd "$CBD"/build/plib
|
|
|
|
cmake -DCMAKE_INSTALL_PREFIX:PATH="$INSTALL_DIR_PLIB" \
|
|
|
|
../../plib 2>&1 | tee -a $LOGFILE
|
|
|
|
fi
|
|
|
|
|
|
|
|
_make plib
|
2011-02-07 03:44:11 +08:00
|
|
|
fi
|
|
|
|
|
2012-11-23 03:38:51 +08:00
|
|
|
#######################################################
|
|
|
|
# OPENRTI
|
|
|
|
#######################################################
|
|
|
|
OPENRTI_INSTALL_DIR=openrti
|
|
|
|
INSTALL_DIR_OPENRTI=$INSTALL_DIR/$OPENRTI_INSTALL_DIR
|
2014-05-20 19:06:19 +08:00
|
|
|
cd "$CBD"
|
|
|
|
if [[ "$(declare -p WHATTOBUILD)" =~ '['([0-9]+)']="OPENRTI"' ]]; then
|
2015-03-07 02:28:55 +08:00
|
|
|
echo "****************************************" | tee -a $LOGFILE
|
|
|
|
echo "**************** OPENRTI ***************" | tee -a $LOGFILE
|
|
|
|
echo "****************************************" | tee -a $LOGFILE
|
|
|
|
|
|
|
|
mkdir -p "openrti"
|
|
|
|
cd "$CBD"/openrti
|
|
|
|
_gitDownload https://gitorious.org/openrti/openrti.git
|
|
|
|
|
|
|
|
if [ "$STABLE" = "STABLE" ]; then
|
|
|
|
_gitUpdate release-0.7
|
|
|
|
else
|
|
|
|
_gitUpdate master
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "$RECONFIGURE" = "y" ]; then
|
|
|
|
cd "$CBD"
|
|
|
|
mkdir -p build/openrti
|
|
|
|
cd "$CBD"/build/openrti
|
|
|
|
rm -f CMakeCache.txt
|
|
|
|
cmake -DCMAKE_BUILD_TYPE="Release" \
|
|
|
|
-DCMAKE_INSTALL_PREFIX:PATH="$INSTALL_DIR_OPENRTI" \
|
|
|
|
../../openrti 2>&1 | tee -a $LOGFILE
|
|
|
|
fi
|
2012-11-23 03:38:51 +08:00
|
|
|
|
2015-03-07 02:28:55 +08:00
|
|
|
_make openrti
|
2012-11-23 03:38:51 +08:00
|
|
|
fi
|
|
|
|
|
2011-02-07 03:44:11 +08:00
|
|
|
#######################################################
|
|
|
|
# SIMGEAR
|
|
|
|
#######################################################
|
|
|
|
SIMGEAR_INSTALL_DIR=simgear
|
|
|
|
INSTALL_DIR_SIMGEAR=$INSTALL_DIR/$SIMGEAR_INSTALL_DIR
|
2014-05-20 19:06:19 +08:00
|
|
|
cd "$CBD"
|
|
|
|
if [[ "$(declare -p WHATTOBUILD)" =~ '['([0-9]+)']="SIMGEAR"' ]]; then
|
2015-03-07 02:28:55 +08:00
|
|
|
echo "****************************************" | tee -a $LOGFILE
|
|
|
|
echo "**************** SIMGEAR ***************" | tee -a $LOGFILE
|
|
|
|
echo "****************************************" | tee -a $LOGFILE
|
|
|
|
|
|
|
|
mkdir -p "simgear"
|
|
|
|
cd "$CBD"/simgear
|
2015-03-13 01:03:16 +08:00
|
|
|
_gitDownload git://git.code.sf.net/p/flightgear/simgear
|
2015-03-07 02:28:55 +08:00
|
|
|
_gitUpdate $FGVERSION
|
2011-02-07 03:44:11 +08:00
|
|
|
|
2015-03-07 02:28:55 +08:00
|
|
|
if [ "$RECONFIGURE" = "y" ]; then
|
|
|
|
cd "$CBD"
|
|
|
|
mkdir -p build/simgear
|
|
|
|
cd "$CBD"/build/simgear
|
|
|
|
rm -f CMakeCache.txt
|
|
|
|
cmake -DCMAKE_BUILD_TYPE="Release" \
|
|
|
|
-DCMAKE_INSTALL_PREFIX:PATH="$INSTALL_DIR_SIMGEAR" \
|
|
|
|
-DCMAKE_PREFIX_PATH="$INSTALL_DIR_OSG;$INSTALL_DIR_OPENRTI" \
|
|
|
|
../../simgear 2>&1 | tee -a $LOGFILE
|
|
|
|
fi
|
2011-02-07 03:44:11 +08:00
|
|
|
|
2015-03-07 02:28:55 +08:00
|
|
|
_make simgear
|
2011-02-07 03:44:11 +08:00
|
|
|
fi
|
|
|
|
|
|
|
|
#######################################################
|
|
|
|
# FGFS
|
|
|
|
#######################################################
|
2014-05-20 19:06:19 +08:00
|
|
|
FGFS_INSTALL_DIR=flightgear
|
2011-02-07 03:44:11 +08:00
|
|
|
INSTALL_DIR_FGFS=$INSTALL_DIR/$FGFS_INSTALL_DIR
|
2014-05-20 19:06:19 +08:00
|
|
|
cd "$CBD"
|
|
|
|
if [[ "$(declare -p WHATTOBUILD)" =~ '['([0-9]+)']="FGFS"' || "$(declare -p WHATTOBUILD)" =~ '['([0-9]+)']="DATA"' ]]; then
|
2015-03-07 02:28:55 +08:00
|
|
|
echo "****************************************" | tee -a $LOGFILE
|
|
|
|
echo "************** FLIGHTGEAR **************" | tee -a $LOGFILE
|
|
|
|
echo "****************************************" | tee -a $LOGFILE
|
|
|
|
|
|
|
|
mkdir -p "flightgear"
|
|
|
|
cd "$CBD"/flightgear
|
|
|
|
|
|
|
|
if [[ "$(declare -p WHATTOBUILD)" =~ '['([0-9]+)']="FGFS"' ]]; then
|
2015-03-13 01:03:16 +08:00
|
|
|
_gitDownload git://git.code.sf.net/p/flightgear/flightgear
|
2015-03-07 02:28:55 +08:00
|
|
|
_gitUpdate $FGVERSION
|
|
|
|
|
|
|
|
if [ "$RECONFIGURE" = "y" ]; then
|
|
|
|
cd "$CBD"
|
|
|
|
mkdir -p build/flightgear
|
|
|
|
cd "$CBD"/build/flightgear
|
|
|
|
rm -f CMakeCache.txt
|
|
|
|
cmake -DCMAKE_BUILD_TYPE="Release" \
|
|
|
|
-DENABLE_FLITE=ON \
|
|
|
|
-DCMAKE_INSTALL_PREFIX:PATH="$INSTALL_DIR_FGFS" \
|
|
|
|
-DCMAKE_PREFIX_PATH="$INSTALL_DIR_SIMGEAR;$INSTALL_DIR_OPENRTI;$INSTALL_DIR_PLIB" \
|
|
|
|
../../flightgear 2>&1 | tee -a $LOGFILE
|
|
|
|
fi
|
|
|
|
|
|
|
|
_make flightgear
|
|
|
|
fi
|
|
|
|
|
|
|
|
mkdir -p $INSTALL_DIR_FGFS/fgdata
|
|
|
|
cd $INSTALL_DIR_FGFS/fgdata
|
|
|
|
|
|
|
|
if [[ "$(declare -p WHATTOBUILD)" =~ '['([0-9]+)']="DATA"' ]]; then
|
|
|
|
echo "****************************************" | tee -a $LOGFILE
|
|
|
|
echo "**************** DATA ******************" | tee -a $LOGFILE
|
|
|
|
echo "****************************************" | tee -a $LOGFILE
|
|
|
|
|
2015-03-08 06:58:58 +08:00
|
|
|
_gitDownload git://git.code.sf.net/p/flightgear/fgdata
|
|
|
|
_gitUpdate $FGVERSION
|
2015-03-07 02:28:55 +08:00
|
|
|
fi
|
|
|
|
cd "$CBD"
|
|
|
|
|
|
|
|
SCRIPT=run_fgfs.sh
|
|
|
|
echo "#!/bin/sh" > $SCRIPT
|
|
|
|
echo "cd \$(dirname \$0)" >> $SCRIPT
|
|
|
|
echo "cd $SUB_INSTALL_DIR/$FGFS_INSTALL_DIR/bin" >> $SCRIPT
|
|
|
|
echo "export LD_LIBRARY_PATH=../../$SIMGEAR_INSTALL_DIR/lib:../../$OPENRTI_INSTALL_DIR/lib:../../$PLIB_INSTALL_DIR/lib" >> $SCRIPT
|
|
|
|
echo "./fgfs --fg-root=\$PWD/../fgdata/ \$@" >> $SCRIPT
|
|
|
|
chmod 755 $SCRIPT
|
|
|
|
|
|
|
|
SCRIPT=run_fgfs_debug.sh
|
|
|
|
echo "#!/bin/sh" > $SCRIPT
|
|
|
|
echo "cd \$(dirname \$0)" >> $SCRIPT
|
|
|
|
echo "cd $SUB_INSTALL_DIR/$FGFS_INSTALL_DIR/bin" >> $SCRIPT
|
|
|
|
echo "export LD_LIBRARY_PATH=../../$SIMGEAR_INSTALL_DIR/lib:../../$OPENRTI_INSTALL_DIR/lib:../../$PLIB_INSTALL_DIR/lib" >> $SCRIPT
|
|
|
|
echo "gdb --directory="\$P1"/fgfs/source/src/ --args fgfs --fg-root=\$PWD/../fgdata/ \$@" >> $SCRIPT
|
|
|
|
chmod 755 $SCRIPT
|
|
|
|
|
|
|
|
SCRIPT=run_fgcom.sh
|
|
|
|
echo "#!/bin/sh" > $SCRIPT
|
|
|
|
echo "cd \$(dirname \$0)" >> $SCRIPT
|
|
|
|
echo "cd $SUB_INSTALL_DIR/$FGFS_INSTALL_DIR/bin" >> $SCRIPT
|
|
|
|
echo "./fgcom \$@" >> $SCRIPT
|
|
|
|
chmod 755 $SCRIPT
|
|
|
|
fi
|
|
|
|
|
|
|
|
#######################################################
|
|
|
|
# FGRUN
|
|
|
|
#######################################################
|
|
|
|
FGRUN_INSTALL_DIR=fgrun
|
|
|
|
INSTALL_DIR_FGRUN=$INSTALL_DIR/$FGRUN_INSTALL_DIR
|
|
|
|
cd "$CBD"
|
|
|
|
if [[ "$(declare -p WHATTOBUILD)" =~ '['([0-9]+)']="FGRUN"' ]]; then
|
|
|
|
echo "****************************************" | tee -a $LOGFILE
|
|
|
|
echo "**************** FGRUN *****************" | tee -a $LOGFILE
|
|
|
|
echo "****************************************" | tee -a $LOGFILE
|
|
|
|
|
|
|
|
mkdir -p "fgrun"
|
|
|
|
cd "$CBD"/fgrun
|
2015-03-13 01:03:16 +08:00
|
|
|
_gitDownload git://git.code.sf.net/p/flightgear/fgrun
|
2015-03-07 02:28:55 +08:00
|
|
|
_gitUpdate $FGVERSION
|
|
|
|
|
|
|
|
if [ "$RECONFIGURE" = "y" ]; then
|
|
|
|
cd "$CBD"
|
|
|
|
mkdir -p build/fgrun
|
|
|
|
cd "$CBD"/build/fgrun
|
|
|
|
rm -f CMakeCache.txt
|
|
|
|
cmake -DCMAKE_BUILD_TYPE="Release" \
|
|
|
|
-DCMAKE_INSTALL_PREFIX:PATH="$INSTALL_DIR_FGRUN" \
|
|
|
|
-DCMAKE_PREFIX_PATH="$INSTALL_DIR_SIMGEAR" \
|
|
|
|
../../fgrun/ 2>&1 | tee -a $LOGFILE
|
|
|
|
fi
|
|
|
|
|
|
|
|
_make fgrun
|
|
|
|
|
|
|
|
cd "$CBD"
|
|
|
|
|
|
|
|
SCRIPT=run_fgrun.sh
|
|
|
|
echo "#!/bin/sh" > $SCRIPT
|
|
|
|
echo "cd \$(dirname \$0)" >> $SCRIPT
|
|
|
|
echo "cd $SUB_INSTALL_DIR/$FGRUN_INSTALL_DIR/bin" >> $SCRIPT
|
|
|
|
echo "export LD_LIBRARY_PATH=$INSTALL_DIR_SIMGEAR/lib" >> $SCRIPT
|
|
|
|
echo "./fgrun --fg-exe=\$PWD/../../$FGFS_INSTALL_DIR/bin/fgfs --fg-root=\$PWD/../../$FGFS_INSTALL_DIR/fgdata \$@" >> $SCRIPT
|
|
|
|
chmod 755 $SCRIPT
|
2011-02-07 03:44:11 +08:00
|
|
|
fi
|
|
|
|
|
2011-08-25 02:34:30 +08:00
|
|
|
#######################################################
|
|
|
|
# FGO!
|
|
|
|
#######################################################
|
|
|
|
FGO_INSTALL_DIR=fgo
|
|
|
|
INSTALL_DIR_FGO=$INSTALL_DIR/$FGO_INSTALL_DIR
|
2014-05-20 19:06:19 +08:00
|
|
|
cd "$CBD"
|
|
|
|
if [[ "$(declare -p WHATTOBUILD)" =~ '['([0-9]+)']="FGO"' ]]; then
|
2015-03-07 02:28:55 +08:00
|
|
|
echo "****************************************" | tee -a $LOGFILE
|
|
|
|
echo "***************** FGO ******************" | tee -a $LOGFILE
|
|
|
|
echo "****************************************" | tee -a $LOGFILE
|
|
|
|
|
|
|
|
if [ "$DOWNLOAD" = "y" ]; then
|
|
|
|
rm -rf fgo*.tar.gz
|
|
|
|
wget https://sites.google.com/site/erobosprojects/flightgear/add-ons/fgo/download/fgo-1.5.5.tar.gz -O fgo.tar.gz
|
|
|
|
cd install
|
|
|
|
tar -zxvf ../fgo.tar.gz
|
|
|
|
cd ..
|
|
|
|
fi
|
|
|
|
|
|
|
|
cd "$CBD"
|
|
|
|
|
|
|
|
SCRIPT=run_fgo.sh
|
|
|
|
echo "#!/bin/sh" > $SCRIPT
|
|
|
|
echo "cd \$(dirname \$0)" >> $SCRIPT
|
|
|
|
echo "cd $SUB_INSTALL_DIR" >> $SCRIPT
|
|
|
|
echo "p=\$(pwd)" >> $SCRIPT
|
|
|
|
echo "cd $FGO_INSTALL_DIR" >> $SCRIPT
|
|
|
|
echo "python fgo" >> $SCRIPT
|
|
|
|
chmod 755 $SCRIPT
|
2011-08-25 02:34:30 +08:00
|
|
|
fi
|
2011-02-07 03:44:11 +08:00
|
|
|
|
2012-11-23 03:38:51 +08:00
|
|
|
#######################################################
|
|
|
|
# FGx
|
|
|
|
#######################################################
|
|
|
|
FGX_INSTALL_DIR=fgx
|
|
|
|
INSTALL_DIR_FGX=$INSTALL_DIR/$FGX_INSTALL_DIR
|
2014-05-20 19:06:19 +08:00
|
|
|
cd "$CBD"
|
|
|
|
if [[ "$(declare -p WHATTOBUILD)" =~ '['([0-9]+)']="FGX"' ]]; then
|
2015-03-07 02:28:55 +08:00
|
|
|
echo "****************************************" | tee -a $LOGFILE
|
|
|
|
echo "***************** FGX ******************" | tee -a $LOGFILE
|
|
|
|
echo "****************************************" | tee -a $LOGFILE
|
|
|
|
|
|
|
|
mkdir -p "fgx"
|
|
|
|
cd "$CBD"/fgx
|
|
|
|
_gitDownload https://gitorious.org/fgx/fgx.git
|
|
|
|
_gitUpdate master
|
|
|
|
|
|
|
|
cd "$CBD"/fgx/src/
|
|
|
|
#Patch in order to pre-setting paths
|
|
|
|
cd resources/default/
|
|
|
|
cp x_default.ini x_default.ini.orig
|
|
|
|
cat x_default.ini | sed s/\\/usr\\/bin\\/fgfs/INSTALL_DIR_FGXMY_SLASH_HERE..MY_SLASH_HEREfgfsMY_SLASH_HEREbinMY_SLASH_HEREfgfs/g > tmp1
|
|
|
|
cat tmp1 | sed s/\\/usr\\/share\\/flightgear/INSTALL_DIR_FGXMY_SLASH_HERE..MY_SLASH_HEREfgfsMY_SLASH_HEREfgdata/g > tmp2
|
|
|
|
cat tmp2 | sed s/\\/usr\\/bin\\/terrasync/INSTALL_DIR_FGXMY_SLASH_HERE..MY_SLASH_HEREfgfsMY_SLASH_HEREbinMY_SLASH_HEREterrasync/g > tmp3
|
|
|
|
cat tmp3 | sed s/\\/usr\\/bin\\/fgcom/INSTALL_DIR_FGXMY_SLASH_HERE..MY_SLASH_HEREfgcomMY_SLASH_HEREbinMY_SLASH_HEREfgcom/g > tmp4
|
|
|
|
cat tmp4 | sed s/\\/usr\\/bin\\/js_demo/INSTALL_DIR_FGXMY_SLASH_HERE..MY_SLASH_HEREfgfsMY_SLASH_HEREbinMY_SLASH_HEREjs_demo/g > tmp5
|
|
|
|
INSTALL_DIR_FGX_NO_SLASHS=$(echo "$INSTALL_DIR_FGX" | sed -e 's/\//MY_SLASH_HERE/g')
|
|
|
|
cat tmp5 | sed s/INSTALL_DIR_FGX/"$INSTALL_DIR_FGX_NO_SLASHS"/g > tmp
|
|
|
|
cat tmp | sed s/MY_SLASH_HERE/\\//g > x_default.ini
|
|
|
|
rm tmp*
|
|
|
|
|
|
|
|
cd ..
|
|
|
|
if [ "$RECONFIGURE" = "y" ]; then
|
|
|
|
mkdir -p $INSTALL_DIR_FGX
|
|
|
|
cd $INSTALL_DIR_FGX
|
|
|
|
qmake ../../fgx/src
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "$COMPILE" = "y" ]; then
|
|
|
|
cd $INSTALL_DIR_FGX
|
|
|
|
echo "MAKE AND INSTALL FGX" >> $LOGFILE
|
|
|
|
echo "make $JOPTION $OOPTION " >> $LOGFILE
|
|
|
|
make $JOPTION $OOPTION | tee -a $LOGFILE
|
|
|
|
cd ..
|
|
|
|
fi
|
|
|
|
|
|
|
|
cd "$CBD"
|
|
|
|
|
|
|
|
SCRIPT=run_fgx.sh
|
|
|
|
echo "#!/bin/sh" > $SCRIPT
|
|
|
|
echo "cd \$(dirname \$0)" >> $SCRIPT
|
|
|
|
echo "cd $ " >> $SCRIPT
|
|
|
|
echo "p=\$(pwd)" >> $SCRIPT
|
|
|
|
echo "cd $FGX_INSTALL_DIR" >> $SCRIPT
|
|
|
|
echo "./fgx" >> $SCRIPT
|
|
|
|
chmod 755 $SCRIPT
|
2012-11-23 03:38:51 +08:00
|
|
|
fi
|
|
|
|
|
2011-02-07 03:44:11 +08:00
|
|
|
#######################################################
|
2015-03-07 02:28:55 +08:00
|
|
|
# ATC-PIE
|
2011-02-07 03:44:11 +08:00
|
|
|
#######################################################
|
2015-03-07 02:28:55 +08:00
|
|
|
ATCPIE_INSTALL_DIR=atc-pie
|
|
|
|
INSTALL_DIR_ATCPIE=$INSTALL_DIR/$ATCPIE_INSTALL_DIR
|
2014-05-20 19:06:19 +08:00
|
|
|
cd "$CBD"
|
2015-03-07 02:28:55 +08:00
|
|
|
if [[ "$(declare -p WHATTOBUILD)" =~ '['([0-9]+)']="ATCPIE"' ]]; then
|
|
|
|
echo "****************************************" | tee -a $LOGFILE
|
|
|
|
echo "**************** ATCPIE ***************" | tee -a $LOGFILE
|
|
|
|
echo "****************************************" | tee -a $LOGFILE
|
|
|
|
|
|
|
|
mkdir -p "$INSTALL_DIR_ATCPIE"
|
|
|
|
cd $INSTALL_DIR_ATCPIE
|
|
|
|
_gitDownload https://gitorious.org/atc-pie/atc-pie.git
|
|
|
|
_gitUpdate master
|
|
|
|
|
|
|
|
cd "$CBD"
|
|
|
|
|
|
|
|
SCRIPT=run_atcpie.sh
|
|
|
|
echo "#!/bin/sh" > $SCRIPT
|
|
|
|
echo "cd \$(dirname \$0)" >> $SCRIPT
|
|
|
|
echo "cd $SUB_INSTALL_DIR/$ATCPIE_INSTALL_DIR" >> $SCRIPT
|
|
|
|
echo "./ATC-pie.py \$@" >> $SCRIPT
|
|
|
|
chmod 755 $SCRIPT
|
2011-02-07 03:44:11 +08:00
|
|
|
fi
|
|
|
|
|
2013-07-30 10:06:20 +08:00
|
|
|
#######################################################
|
|
|
|
# OPENRADAR
|
|
|
|
#######################################################
|
|
|
|
OR_INSTALL_DIR=openradar
|
|
|
|
INSTALL_DIR_OR=$INSTALL_DIR/$OR_INSTALL_DIR
|
2014-05-20 19:06:19 +08:00
|
|
|
cd "$CBD"
|
|
|
|
if [[ "$(declare -p WHATTOBUILD)" =~ '['([0-9]+)']="OPENRADAR"' ]]; then
|
2015-03-07 02:28:55 +08:00
|
|
|
echo "****************************************" | tee -a $LOGFILE
|
|
|
|
echo "************** OPENRADAR ***************" | tee -a $LOGFILE
|
|
|
|
echo "****************************************" | tee -a $LOGFILE
|
|
|
|
|
|
|
|
if [ "$DOWNLOAD" = "y" ]; then
|
|
|
|
wget http://wagnerw.de/OpenRadar.zip -O OpenRadar.zip
|
|
|
|
cd install
|
|
|
|
unzip -o ../OpenRadar.zip
|
|
|
|
cd ..
|
|
|
|
fi
|
|
|
|
|
|
|
|
SCRIPT=run_openradar.sh
|
|
|
|
echo "#!/bin/sh" > $SCRIPT
|
|
|
|
echo "cd \$(dirname \$0)" >> $SCRIPT
|
|
|
|
echo "cd install/OpenRadar" >> $SCRIPT
|
|
|
|
echo "java -jar OpenRadar.jar" >> $SCRIPT
|
|
|
|
chmod 755 $SCRIPT
|
2013-07-30 10:06:20 +08:00
|
|
|
fi
|
|
|
|
|
2011-02-07 03:44:11 +08:00
|
|
|
#######################################################
|
2014-05-20 19:06:19 +08:00
|
|
|
# TERRAGEAR
|
|
|
|
#######################################################
|
|
|
|
|
|
|
|
TG_INSTALL_DIR=terragear
|
|
|
|
INSTALL_DIR_TG=$INSTALL_DIR/$TG_INSTALL_DIR
|
|
|
|
cd "$CBD"
|
|
|
|
if [[ "$(declare -p WHATTOBUILD)" =~ '['([0-9]+)']="TERRAGEAR"' ]]; then
|
2015-03-07 02:28:55 +08:00
|
|
|
echo "****************************************" | tee -a $LOGFILE
|
|
|
|
echo "*************** TERRAGEAR **************" | tee -a $LOGFILE
|
|
|
|
echo "****************************************" | tee -a $LOGFILE
|
|
|
|
|
|
|
|
mkdir -p "terragear"
|
|
|
|
cd "$CBD"/terragear
|
2015-03-13 01:03:16 +08:00
|
|
|
_gitDownload git://git.code.sf.net/p/flightgear/terragear
|
2015-03-07 02:28:55 +08:00
|
|
|
_gitUpdate scenery/ws2.0
|
|
|
|
|
|
|
|
if [ "$RECONFIGURE" = "y" ]; then
|
|
|
|
cd "$CBD"
|
|
|
|
mkdir -p build/terragear
|
|
|
|
cd "$CBD"/build/terragear
|
|
|
|
rm -f CMakeCache.txt
|
|
|
|
cmake -DCMAKE_BUILD_TYPE="Debug" \
|
|
|
|
-DCMAKE_INSTALL_PREFIX:PATH="$INSTALL_DIR_TG" \
|
|
|
|
-DCMAKE_PREFIX_PATH="$INSTALL_DIR_SIMGEAR;$INSTALL_DIR_CGAL" \
|
|
|
|
../../terragear/ 2>&1 | tee -a $LOGFILE
|
|
|
|
fi
|
|
|
|
|
|
|
|
_make terragear
|
|
|
|
|
|
|
|
cd "$CBD"
|
|
|
|
echo "#!/bin/sh" > run_tg-construct.sh
|
|
|
|
echo "cd $(dirname $0)" >> run_tg-construct.sh
|
|
|
|
echo "cd install/terragear/bin" >> run_tg-construct.sh
|
|
|
|
echo "export LD_LIBRARY_PATH=$INSTALL_DIR_SIMGEAR/lib" >> run_tg-construct.sh
|
|
|
|
echo "./tg-construct \$@" >> run_tg-construct.sh
|
|
|
|
|
|
|
|
echo "#!/bin/sh" > run_ogr-decode.sh
|
|
|
|
echo "cd $(dirname $0)" >> run_ogr-decode.sh
|
|
|
|
echo "cd install/terragear/bin" >> run_ogr-decode.sh
|
|
|
|
echo "export LD_LIBRARY_PATH=$INSTALL_DIR_SIMGEAR/lib" >> run_ogr-decode.sh
|
|
|
|
echo "./ogr-decode \$@" >> run_ogr-decode.sh
|
|
|
|
|
|
|
|
echo "#!/bin/sh" > run_genapts850.sh
|
|
|
|
echo "cd $(dirname $0)" >> run_genapts850.sh
|
|
|
|
echo "cd install/terragear/bin" >> run_genapts850.sh
|
|
|
|
echo "export LD_LIBRARY_PATH=$INSTALL_DIR_SIMGEAR/lib" >> run_genapts850.sh
|
|
|
|
echo "./genapts850 \$@" >> run_genapts850.sh
|
2014-05-20 19:06:19 +08:00
|
|
|
fi
|
|
|
|
_logSep
|
|
|
|
|
|
|
|
#######################################################
|
|
|
|
# TERRAGEAR GUI
|
|
|
|
#######################################################
|
|
|
|
|
|
|
|
TGGUI_INSTALL_DIR=terrageargui
|
|
|
|
INSTALL_DIR_TGGUI=$INSTALL_DIR/$TGGUI_INSTALL_DIR
|
|
|
|
cd "$CBD"
|
|
|
|
if [[ "$(declare -p WHATTOBUILD)" =~ '['([0-9]+)']="TERRAGEARGUI"' ]]; then
|
2015-03-07 02:28:55 +08:00
|
|
|
echo "****************************************" | tee -a $LOGFILE
|
|
|
|
echo "************* TERRAGEAR GUI ************" | tee -a $LOGFILE
|
|
|
|
echo "****************************************" | tee -a $LOGFILE
|
|
|
|
|
|
|
|
mkdir -p "terrageargui"
|
|
|
|
cd "$CBD"/terrageargui
|
|
|
|
_gitDownload https://gitorious.org/fgscenery/terrageargui.git
|
|
|
|
_gitUpdate master
|
2013-06-06 08:41:01 +08:00
|
|
|
|
2013-11-25 05:57:21 +08:00
|
|
|
|
2015-03-07 02:28:55 +08:00
|
|
|
if [ "$RECONFIGURE" = "y" ]; then
|
|
|
|
cd "$CBD"
|
|
|
|
mkdir -p build/terrageargui
|
|
|
|
cd "$CBD"/build/terrageargui
|
|
|
|
rm -f ../../terrageargui/CMakeCache.txt
|
|
|
|
cmake -DCMAKE_BUILD_TYPE="Release" \
|
|
|
|
-DCMAKE_INSTALL_PREFIX="$INSTALL_DIR_TGGUI" \
|
|
|
|
../../terrageargui 2>&1 | tee -a $LOGFILE
|
|
|
|
fi
|
|
|
|
|
|
|
|
_make terrageargui
|
|
|
|
|
|
|
|
cd "$CBD"
|
|
|
|
# Fill TerraGear Root field
|
|
|
|
if [ ! -f ~/.config/TerraGear/TerraGearGUI.conf ]; then
|
|
|
|
echo "Fill TerraGear Root field" >> $LOGFILE
|
|
|
|
echo "[paths]" > TerraGearGUI.conf
|
|
|
|
echo "terragear=$INSTALL_DIR_TG/bin" >> TerraGearGUI.conf
|
|
|
|
mkdir -p ~/.config/TerraGear
|
|
|
|
mv TerraGearGUI.conf ~/.config/TerraGear
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "Create run_terrageargui.sh" >> $LOGFILE
|
|
|
|
echo "#!/bin/sh" > run_terrageargui.sh
|
|
|
|
echo "cd \$(dirname \$0)" >> run_terrageargui.sh
|
|
|
|
echo "cd install/terrageargui/bin" >> run_terrageargui.sh
|
|
|
|
echo "export LD_LIBRARY_PATH=$INSTALL_DIR_SIMGEAR/lib" >> run_terrageargui.sh
|
|
|
|
echo "./TerraGUI \$@" >> run_terrageargui.sh
|
|
|
|
fi
|
2013-11-25 05:57:21 +08:00
|
|
|
|
2015-03-07 02:28:55 +08:00
|
|
|
echo ""
|
2014-05-20 19:06:19 +08:00
|
|
|
echo "download_and_compile.sh has finished to work"
|
2013-11-25 05:57:21 +08:00
|
|
|
|
2014-05-20 19:06:19 +08:00
|
|
|
cd "$CBD"
|
2015-03-07 02:28:55 +08:00
|
|
|
|