From a20342ed485319b39f99013c46d4047dee25e334 Mon Sep 17 00:00:00 2001
From: Florent Rougon <f.rougon@free.fr>
Date: Thu, 11 Oct 2018 13:26:59 +0200
Subject: [PATCH] download_and_compile.sh: cleaner log output, code
 simplification

The "DIRECTORY=..." was printed too late in the log file (after the apt
stuff). Fix that and make some code a bit easier to follow (e.g.,
LOGFILE is assigned only once now).
---
 download_and_compile.sh | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/download_and_compile.sh b/download_and_compile.sh
index 097da27..bab5fc7 100755
--- a/download_and_compile.sh
+++ b/download_and_compile.sh
@@ -321,7 +321,8 @@ function _usage() {
 # set script to stop if an error occours
 set -e
 
-LOGFILE=compilation_log.txt
+CBD="$PWD"
+LOGFILE="$CBD/compilation_log.txt"
 
 # Available values for WHATTOBUILD and WHATTOBUILDALL:
 declare -a WHATTOBUILD_AVAIL=(
@@ -550,6 +551,7 @@ _log "DOWNLOAD=$DOWNLOAD"
 _log "JOPTION=$JOPTION"
 _log "OOPTION=$OOPTION"
 _log "BUILD_TYPE=$BUILD_TYPE"
+_log "DIRECTORY=$CBD"
 _logSep
 
 #######################################################
@@ -618,22 +620,18 @@ fi
 #######################################################
 #######################################################
 
-CBD=$(pwd)
-LOGFILE="$CBD/$LOGFILE"
-_log "DIRECTORY=$CBD"
-_logSep
-mkdir -p install
 SUB_INSTALL_DIR=install
 INSTALL_DIR="$CBD/$SUB_INSTALL_DIR"
 cd "$CBD"
-mkdir -p build
+mkdir -p build install
 
 #######################################################
 # BACKWARD COMPATIBILITY WITH 1.9.14a
 #######################################################
 
 if [ -d "$CBD"/fgfs/flightgear ]; then
-  echo "Move to the new folder structure"
+  _logSep
+  _printLog "Move to the new folder structure"
   rm -rf OpenSceneGraph
   rm -rf plib
   rm -rf build
@@ -651,6 +649,8 @@ if [ -d "$CBD"/fgfs/flightgear ]; then
   echo "Done"
 fi
 
+_printLog
+
 #######################################################
 # cmake
 #######################################################