799 lines
20 KiB
Bash
799 lines
20 KiB
Bash
#!/bin/sh
|
|
# install.bash - untar files and run make for
|
|
# various software packages
|
|
#
|
|
# 04/19/05 M. Spiekermann
|
|
# 04/22/09 M. Spiekermann, error handling for starting xterm &
|
|
# 05/16/02 M. Spiekermann, MSYS-Mingw and Linux script merged into this version
|
|
# 05/12/10 M. Spiekermann, Compilation of 3rd party packages improved and un-install function added
|
|
# 05/18/10 M. Spiekermann, Code restructured into many new functions. Easier to test and maintain.
|
|
# 06/27/09 M. Spiekermann, tools version check implemented and new packages
|
|
# added in order to support Mac-OSX.
|
|
# 07/02/04 C. Duentgen, Added Package GSL - GNU Scientific Library, which is needed by the new
|
|
# GSL-Algebra
|
|
# 07/08/07 M. Spiekermann, Integration of new platform linux64
|
|
|
|
startDir=$PWD
|
|
|
|
# include function definitions
|
|
libFile="./scripts/libutil.sh"
|
|
if ! source $libFile; then
|
|
printf "%s\n" "This script needs routines from the file $libFile"
|
|
exit 1;
|
|
fi
|
|
|
|
if [ "$opt_platform" == "win32" ]; then
|
|
shProfile="./scripts/profile"
|
|
if [ -f $shProfile ]; then
|
|
source $shProfile
|
|
fi
|
|
fi
|
|
|
|
function showBashrcMsg {
|
|
|
|
printx "\n"
|
|
showMsg "em" "Note: Before compiling SECONDO you need to define the environment variables SECONDO_SDK,
|
|
SECONDO_PLATFORM, SECONDO_BUILD_DIR, then run \"source \$SECONDO_SDK/secondorc\" \n\
|
|
otherwise the environment will not be suitable for compiling \n\
|
|
and make will abort with an error."
|
|
}
|
|
|
|
# The next two function are used to set checkpoints
|
|
# for successful installation steps
|
|
|
|
# $1 name
|
|
function checkPoint {
|
|
|
|
local file="$sdk/_DONE_$1"
|
|
if [ -e "$file" ]; then
|
|
return 0
|
|
fi
|
|
return 1
|
|
}
|
|
|
|
# $1 name
|
|
function setCheckPoint {
|
|
|
|
local file="$sdk/_DONE_$1"
|
|
checkCmd touch $file
|
|
showMsg "info" "-> OK!"
|
|
}
|
|
|
|
|
|
# $1 name
|
|
function rmCheckPoint {
|
|
|
|
local file="$sdk/_DONE_$1"
|
|
checkCmd rm $file
|
|
showMsg "checkpoint $file removed!"
|
|
}
|
|
|
|
# $1 = package info
|
|
# $2 = package dir
|
|
# $3 = package file
|
|
# $4 = make targets
|
|
# $5 = configure options
|
|
# $6 = optional configure cmd
|
|
#
|
|
function installPackage {
|
|
|
|
local pckgInfo=$1
|
|
local subDir=$2
|
|
local pckgFiles=$3
|
|
local compileDir=$4
|
|
local targets=$5
|
|
local confOpt=$6
|
|
local confCmd=$7
|
|
|
|
local conf="./configure"
|
|
|
|
# There's a posix fix in bash 3.0 which breaks older script code.
|
|
# bash 2.05 accepts command "trap 0", but version 3.0 needs
|
|
# "trap - 0". As a result some configure scripts stop with
|
|
# an error, e.g. for gcc 3.2.3. A solution is to start the
|
|
# configure script with bash which turns off posix compatibility mode.
|
|
if [ "$opt_platform" != "win32" ]; then
|
|
#local bashCmd="linux32 bash --login"
|
|
local bashCmd="bash"
|
|
fi
|
|
|
|
local file=${pckgFiles##*/}
|
|
local cp1="PCKG_${file}_uncompressed"
|
|
local cp2="PCKG_${file}_installed"
|
|
|
|
if [ "$confCmd" != "" ]; then
|
|
if [ "$confCmd" != "-noCheckPoint" ]; then
|
|
conf=$confCmd
|
|
else
|
|
conf="configure"
|
|
local nocp="true"
|
|
fi
|
|
fi
|
|
|
|
printx "%s\n" "Installing package \"$pckgInfo\" ..."
|
|
|
|
if ! checkPoint "$cp1"; then
|
|
|
|
# extract files for package
|
|
printx "%s\n" "Uncompressing $pckgFiles"
|
|
uncompressFiles $temp $pckgFiles
|
|
if [ $? -ne 0 ]; then
|
|
return 1
|
|
fi
|
|
setCheckPoint "$cp1"
|
|
else
|
|
showMsg "info" "-> $file already uncompressed!"
|
|
fi
|
|
|
|
if ! checkPoint "$cp2"; then
|
|
# compile package if necessary
|
|
if [ "$compileDir" != "" ]; then
|
|
printx "%s\n" "Compiling package ..."
|
|
printf "%s\n" "cd $compileDir"
|
|
assert cd $compileDir
|
|
printf "%s\n" "$bashCmd $conf --prefix=$sdk/$subDir $confOpt --disable-nls $configureFlags"
|
|
checkCmd $bashCmd $conf --prefix=$sdk/$subDir $confOpt --disable-nls $configureFlags
|
|
if [ $? -ne 0 ]; then
|
|
return 1;
|
|
fi
|
|
for target in $targets; do
|
|
makeCmd="make"
|
|
if [ "$target" != "all" ]; then
|
|
makeCmd="make $target"
|
|
fi
|
|
printf "%s\n" "$makeCmd"
|
|
checkCmd $makeCmd
|
|
rc=$?
|
|
if [ $rc -ne 0 ]; then
|
|
return 1;
|
|
fi
|
|
done
|
|
fi
|
|
if [ "$nocp" != "true" ]; then
|
|
setCheckPoint "$cp2"
|
|
fi
|
|
else
|
|
showMsg "info" "-> already installed!"
|
|
fi
|
|
|
|
return 0
|
|
}
|
|
|
|
|
|
# $1 package info
|
|
# $2 mode = [ dir, files, file ]
|
|
# $3 [ $* ] files or dir
|
|
function uncompressPackage {
|
|
|
|
if [ $# -le 2 ]; then
|
|
return 1;
|
|
fi
|
|
|
|
local pckgInfo=$1
|
|
local mode=$2
|
|
shift
|
|
shift
|
|
|
|
printx "%s\n" "Installing package \"$pckgInfo\" ..."
|
|
|
|
# uncompress all zip files of a given directory
|
|
if [ "$mode" == "dir" ]; then
|
|
local dir="$*"
|
|
local folder=${dir##*/}
|
|
local name="UNCOMP_DIR_$folder"
|
|
if ! checkPoint "$name"; then
|
|
uncompressFolders $dir
|
|
if [ $? -eq 0 ]; then
|
|
setCheckPoint "$name"
|
|
return 0
|
|
else
|
|
return 1
|
|
fi
|
|
else
|
|
showMsg "info" "-> already done"
|
|
fi
|
|
return 0
|
|
fi
|
|
|
|
# uncompress all given files
|
|
if [ "$mode" == "files" ]; then
|
|
local file=${1##*/}
|
|
local name="UNCOMP_FILES_$file"
|
|
if ! checkPoint "$name"; then
|
|
uncompressFiles $PWD $*
|
|
if [ $? -eq 0 ]; then
|
|
setCheckPoint "$name"
|
|
return 0
|
|
else
|
|
return 1
|
|
fi
|
|
else
|
|
showMsg "info" "-> already done!"
|
|
fi
|
|
return 0
|
|
fi
|
|
|
|
# uncompress a single file
|
|
if [ "$mode" == "file" ]; then
|
|
local file=${1##*/}
|
|
local name="UNCOMP_FILE_$file"
|
|
if ! checkPoint "$name"; then
|
|
uncompressFiles $PWD $*
|
|
if [ $? -eq 0 ]; then
|
|
setCheckPoint "$name"
|
|
return 0
|
|
else
|
|
return 1
|
|
fi
|
|
else
|
|
showMsg "info" "-> already done"
|
|
fi
|
|
return 0
|
|
else
|
|
showMsg "err" "uncompressPackge - Unknown mode \"$mode\""
|
|
return 1
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
function unInstall {
|
|
|
|
local dirs="$sdk $temp $build"
|
|
if [ "$opt_platform" == "win32" ]; then
|
|
showMsg "warn" "We assume that you have removed MinGW by using windows' system \n\
|
|
control software installation utility and SWI-Prolog by its \n\
|
|
uninstall tool unwise.exe!"
|
|
if [ -e $mingwdir ]; then
|
|
dirs="$dirs $mingwdir"
|
|
fi
|
|
fi
|
|
printx "%s\n" "About to delete the following directories and files:"
|
|
local delDir=""
|
|
for xdir in $dirs $HOME/.secondo*; do
|
|
printx "%s\n" " $xdir"
|
|
delDir="$delDir $xdir"
|
|
done
|
|
|
|
local opt1="Delete"
|
|
local opt2="Abort"
|
|
select choice in "$opt1" "$opt2"; do
|
|
if [ "$choice" == "$opt1" ]; then
|
|
break
|
|
else
|
|
abort
|
|
fi
|
|
done
|
|
|
|
for xdir in $delDir; do
|
|
printf "%s\n" "Deleting $xdir ..."
|
|
rm -rf $xdir
|
|
LU_LOG_INIT=""
|
|
done
|
|
|
|
if [ "$opt_platform" == "win32" ]; then
|
|
printx "\n"
|
|
showMsg "em" "If Java 2 has been installed remove it with it's uninstall program or \n\
|
|
window's system control."
|
|
showMsg "em" "Now you can remove the MSYS installation by using window's system \n\
|
|
control. If the directory /c/msys will not be deleted, \n\
|
|
delete it with a file manager."
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
function abort {
|
|
|
|
if isRunning $xtermPID; then
|
|
killProcess $xtermPID
|
|
fi
|
|
if isRunning $j2XtermPID; then
|
|
printx "\n%s\n" "Waiting for child process $j2XtermPID"
|
|
wait $j2XtermPID
|
|
fi
|
|
exit $?
|
|
}
|
|
|
|
function copyConfigFiles {
|
|
|
|
printSep "Copying configuration files"
|
|
local check="COPY_RCFILES"
|
|
assert cd $cdpath/scripts
|
|
let LU_ERRORS=0
|
|
if ! checkPoint "$check"; then
|
|
|
|
printx "%s\n" "Creating \$sdk/secondo* files"
|
|
local cmdfiles="libutil.sh bashrc_example secondorc secondo.*"
|
|
if [ "$opt_platform" == "win32" ]; then
|
|
checkCmd cp profile $HOME/.profile
|
|
fi
|
|
for file in $cmdfiles; do
|
|
checkCmd cp $file $sdk
|
|
done
|
|
else
|
|
showMsg "info" "-> already done!"
|
|
return 0
|
|
fi
|
|
|
|
if [ $LU_ERRORS -eq 0 ]; then
|
|
setCheckPoint "$check"
|
|
return 0
|
|
fi
|
|
return 1
|
|
}
|
|
|
|
# $1 directory
|
|
function checkInstDir {
|
|
|
|
if [ ! -d "$1" ]; then
|
|
showMsg "warn" "Recommended installation directory \"$1\" \n\
|
|
not found. You need to modify file \"$sdk/secondo.config.$opt_platform\"."
|
|
return 1
|
|
fi
|
|
return 0
|
|
}
|
|
|
|
function installJava {
|
|
|
|
if [ "$opt_platform" == "win32" ]; then
|
|
assert cd $j2dir
|
|
jdk*windows*.exe
|
|
checkInstDir $javaInstDir
|
|
else
|
|
assert cd $sdk
|
|
local j2file=$j2dir/j*i586*.bin
|
|
if [ "$opt_platform" == "linux64" ]; then
|
|
j2file=$j2dir/j*amd64*.bin
|
|
fi
|
|
startupXterm "JAVA 2 SDK Installation" $j2file
|
|
if [ $? -ne 0 ]; then
|
|
printx "Running $j2file directly"
|
|
$j2file
|
|
else
|
|
j2XtermPID=$LU_xPID
|
|
fi
|
|
fi
|
|
}
|
|
|
|
|
|
function finish {
|
|
|
|
copyConfigFiles
|
|
showBashrcMsg
|
|
abort
|
|
}
|
|
|
|
##########################################################
|
|
###
|
|
### Start of the Script
|
|
###
|
|
##########################################################
|
|
|
|
#default options
|
|
testMode="false"
|
|
sdkName="secondo-sdk"
|
|
|
|
declare -i numOfArgs=$#
|
|
let numOfArgs++
|
|
opt_platform=""
|
|
opt_gcc="yes"
|
|
|
|
function usageMsg {
|
|
|
|
printf "\n%s\n" "Usage of ${0##*/}:"
|
|
printf "%s\n" " -h print this message and exit."
|
|
printf "%s\n" " -t test mode installing below directory /tmp"
|
|
printf "%s\n" " -d name of the the sdk root directory [default = $sdkName]"
|
|
printf "%s\n" " -p platform name, one of {linux, linux64, win32, mac_osx}."
|
|
printf "%s\n" " -s Use the system's gcc, don't install the provided one."
|
|
printf "%s\n" "The script installs or compiles all 3rd party tools"
|
|
printf "%s\n\n" "which are needed to compile SECONDO."
|
|
}
|
|
|
|
|
|
|
|
while [ $numOfArgs -ne $OPTIND ]; do
|
|
|
|
getopts "d:p:hts" optKey
|
|
if [ "$optKey" == "?" ]; then
|
|
optKey="h"
|
|
fi
|
|
|
|
case $optKey in
|
|
|
|
h) showGPL
|
|
usageMsg
|
|
exit 0;;
|
|
|
|
d) sdkName=$OPTARG;;
|
|
|
|
p) opt_platform=$OPTARG;;
|
|
|
|
s) opt_gcc="no";;
|
|
|
|
t) testMode="true"
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
if [ "$opt_platform" != "linux" ]; then
|
|
if [ "$opt_platform" != "linux64" ]; then
|
|
if [ "$opt_platform" != "mac_osx" ]; then
|
|
if [ "$opt_platform" != "win32" ]; then
|
|
showMsg "err" "Option -p must be set to one of {linux, linux64, mac_osx or win32}!"
|
|
usageMsg
|
|
exit 1
|
|
fi
|
|
fi
|
|
fi
|
|
fi
|
|
|
|
|
|
printf "\n"
|
|
showGPL
|
|
|
|
|
|
if [ "$testMode" == "true" ]; then
|
|
printf "\n"
|
|
showMsg "info" "Running in test mode: \$HOME set to \"$HOME\""
|
|
mkdir -p $HOME
|
|
mkdir -p $instpath
|
|
fi
|
|
|
|
# check if $USER is defined
|
|
if [ "$USER" == "" ]; then
|
|
if [ "$LOGNAME" == "" ]; then
|
|
showMsg "warn" "The variable \$USER and \$LOGNAME are empty. \$USER will be set to \"nobody\"."
|
|
USER="nobody"
|
|
else
|
|
USER="$LOGNAME"
|
|
fi
|
|
fi
|
|
|
|
# init log file
|
|
temp=$LU_TMP/secondo-tmp-$USER/$sdkName
|
|
mkdir -p $temp
|
|
logfile="$temp/installsdk.log"
|
|
initLogFile $logfile
|
|
if [ $? -ne 0 ]; then
|
|
showMsg "err" "Could not create log file. Giving up!"
|
|
abort
|
|
fi
|
|
logfile=$LU_LOG
|
|
|
|
# check if $HOME exists
|
|
if [ ! -w "$HOME" ]; then
|
|
showMsg "err" "Directory \$HOME=\"$HOME\" does not exist or you have no write access."
|
|
HOME2=/home/$USER
|
|
if [ "$HOME2" != "$HOME" ]; then
|
|
showMsg "warn" "Trying to create \$HOME=\"$HOME2\""
|
|
assert mkdir -p $HOME2
|
|
HOME=$HOME2
|
|
else
|
|
abort
|
|
fi
|
|
fi
|
|
|
|
|
|
# Set up variables for important directories
|
|
# Do some OS-specific settings
|
|
if [ "$opt_platform" == "win32" ]; then
|
|
|
|
instpath=/c
|
|
if [ "$testMode" == "true" ]; then
|
|
instpath=$temp/C
|
|
msysdir="$instpath/msys/1.0"
|
|
HOME=$msysdir/home/$USER
|
|
fi
|
|
msysdir="$instpath/msys/1.0"
|
|
mingwdir="$instpath/mingw"
|
|
platformdir=$startDir/win32
|
|
encoding="CP1252"
|
|
|
|
else
|
|
|
|
if [ "$testMode" == "true" ]; then
|
|
HOME=/tmp/installsdk/$USER
|
|
fi
|
|
instpath=$HOME
|
|
platformdir=$startDir/linux
|
|
encoding="LAT1"
|
|
|
|
fi
|
|
|
|
# set variables for important directories
|
|
cdpath=$startDir
|
|
sdk=$instpath/$sdkName
|
|
build=$HOME/secondo
|
|
prologdir=$sdk/swi
|
|
|
|
|
|
|
|
|
|
printx "\n%s\n" "*** Installation of the SECONDO DEVELOPMENT TOOLKIT ***"
|
|
printx "\n%s\n" " Installation source: $cdpath"
|
|
printx "%s\n" " Target for tools : $sdk"
|
|
printx "%s\n" " Target for SECONDO : $build"
|
|
printx "%s\n" " Temporary directory: $temp"
|
|
printx "%s\n\n" " Used platform : $opt_platform"
|
|
|
|
for xdir in "$sdk" "$prologdir" "$build"; do
|
|
if [ -d "$xdir" ]; then
|
|
showMsg "warn" "Directory $xdir already exists."
|
|
fi
|
|
done
|
|
|
|
if [ "$opt_platform" == "linux64" ]; then
|
|
showMsg "em" "Note: Platform linux64 can use only the system's compiler!"
|
|
opt_gcc="no"
|
|
fi
|
|
|
|
printx "\n%s\n" "This procedure will install various 3rd party tools on your computer."
|
|
printx "%s\n" "We assume that you have read the installation guide. What would you like to do now?"
|
|
|
|
opt1="Install"
|
|
opt2="Uninstall"
|
|
opt3="Abort"
|
|
select choice in "$opt1" "$opt2" "$opt3"; do
|
|
|
|
if [ "$choice" == "$opt1" ]; then
|
|
break;
|
|
else
|
|
if [ "$choice" == "$opt2" ]; then
|
|
unInstall;
|
|
exit $?
|
|
else
|
|
exit $?;
|
|
fi
|
|
fi
|
|
done
|
|
|
|
showMsg "info" "Starting installation! Log information will be written to \n\
|
|
$logfile"
|
|
|
|
if [ "$testMode" == "true" ]; then
|
|
assert mkdir -p $HOME
|
|
if [ "$opt_platform" == "win32" ]; then
|
|
assert mkdir -p $instpath
|
|
fi
|
|
fi
|
|
|
|
# create sdk directory
|
|
assert mkdir -p $sdk
|
|
|
|
# On windows we need to install unzip first
|
|
if [ "$opt_platform" == "win32" ]; then
|
|
assert mkdir -p $sdk/auxtools/bin
|
|
export PATH="$sdk/auxtools/bin:$sdk/auxtools/lib:/c/mingw/bin:$PATH"
|
|
|
|
if [ ! -e $sdk/auxtools/bin/unzip.exe ]; then
|
|
printSep "Installing unzip ..."
|
|
assert cd $sdk/auxtools/bin
|
|
checkCmd "$platformdir/non-gnu/unzip/unz550xN.exe"
|
|
checkCmd "unzip -q -o $platformdir/non-gnu/unzip/zip23xN.zip"
|
|
fi
|
|
fi
|
|
|
|
printSep "Installing SECONDO's source files"
|
|
if [ ! -d $HOME/secondo ]; then
|
|
printx "%s\n" "Uncompressing source files ..."
|
|
srcfile=$cdpath/secondo-*${encoding}.*
|
|
if [ ! -e $srcfile ]; then
|
|
showMsg "warn" "Can't extract Secondo's sources. Please download them from \n\
|
|
\"www.informatik.fernuni-hagen.de/secondo\" and extract the zip or tar.gz archive \n\
|
|
into directory \$HOME/secondo."
|
|
else
|
|
if uncompress $srcfile $HOME; then
|
|
showMsg "info" "-> OK!"
|
|
fi
|
|
fi
|
|
else
|
|
showMsg "info" "-> Source directory is already present!"
|
|
fi
|
|
|
|
if [ "$opt_platform" != "mac_osx" ]; then
|
|
|
|
printSep "JAVA SDK"
|
|
javaVersion=
|
|
|
|
if [ "$opt_platform" == "win32" ]; then
|
|
javaInstDir="$sdk/jdk1.5.0"
|
|
else
|
|
javaVersion="jdk1.5.0_12"
|
|
fi
|
|
javaInstDir="$sdk/$javaVersion"
|
|
|
|
if [ ! -d $javaInstDir ]; then
|
|
|
|
j2dir=$cdpath/j2sdk
|
|
if [ ! -e $j2dir ]; then
|
|
showMsg "warn" "The script needs Sun's J2SDK installation kit in directory \n\
|
|
\"$j2dir\" \n\
|
|
But this directory is not present. Hence this script will not install \n\
|
|
a JAVA-SDK. Please install it later manually. Depending on which version \n\
|
|
will be installed adjust the variable \$J2SDK_ROOT in the file \n\
|
|
\$sdk/secondo.config"
|
|
else
|
|
printx "%s\n" "Installing Java SDK. If you don't want to install it since "
|
|
printx "%s\n" "you have already a SDK of an appropriate version omit this step."
|
|
opt1="Install Java 2 SDK"
|
|
opt2="Don't install"
|
|
|
|
select choice in "$opt1" "$opt2"; do
|
|
if [ "$choice" == "$opt1" ]; then
|
|
installJava
|
|
break
|
|
else
|
|
break
|
|
fi
|
|
done
|
|
fi
|
|
else
|
|
showMsg "info" "-> J2SDK seems to be already installed!"
|
|
fi
|
|
fi
|
|
|
|
##
|
|
## WINDOWS - INSTALLATION
|
|
##
|
|
|
|
if [ "$opt_platform" == "win32" ]; then
|
|
|
|
printSep "MinGW (GCC 3.2 windows port) Installation"
|
|
assert cd $platformdir/mingw
|
|
check="INST_MINGW"
|
|
if ! checkPoint "$check"; then
|
|
checkCmd Min*.exe
|
|
if checkInstDir "$mingwdir"; then
|
|
setCheckPoint "$check"
|
|
fi
|
|
else
|
|
showMsg "info" "-> MinGW seems to be already installed!"
|
|
fi
|
|
|
|
|
|
printSep "SWI-Prolog Installation"
|
|
assert cd $platformdir/prolog
|
|
check="INST_SWIPROLOG"
|
|
if ! checkPoint "$check"; then
|
|
checkCmd w32pl*.exe
|
|
if checkInstDir "$prologdir"; then
|
|
setCheckPoint "$check"
|
|
fi
|
|
else
|
|
showMsg "info" "-> SWI-Prolog seems to be already installed!"
|
|
fi
|
|
|
|
|
|
printSep "Installation of Tools from the gnuwin32 project ..."
|
|
assert cd $sdk
|
|
for dir in "auxtools flex bison"; do
|
|
assert mkdir -p $dir
|
|
done
|
|
assert cd auxtools
|
|
uncompressPackage "GNU Tools" "dir" $platformdir/gnu
|
|
uncompressPackage "JPEG-Library" "files" $platformdir/non-gnu/jpeg-*
|
|
uncompressPackage "CVS console client" "file" $platformdir/non-gnu/cvs-*
|
|
assert cd $sdk/flex
|
|
uncompressPackage "Flex, a scanner generator" "file" $platformdir/non-gnu/flex-*
|
|
assert cd $sdk/bison
|
|
uncompressPackage "Bison, a parser generator" "dir" $platformdir/bison
|
|
|
|
if ! startupXterm "Messages from make" tail -f $logfile; then
|
|
printx "%s\n" "Messages from make are kept in $logfile"
|
|
else
|
|
xtermPID=$LU_xPID
|
|
fi
|
|
|
|
printSep "Installation of Berkeley-DB"
|
|
installPackage "Berkeley-DB" bdb $platformdir/non-gnu/db-* $temp/db-*/build_unix install "--enable-cxx --enable-mingw" ../dist/configure
|
|
|
|
finish
|
|
|
|
fi
|
|
|
|
##
|
|
## LINUX / UNIX - INSTALLATION
|
|
##
|
|
|
|
if ! startupXterm "Messages from make" tail -f $logfile; then
|
|
printx "%s\n" "Messages from make are kept in $logfile"
|
|
else
|
|
xtermPID=$LU_xPID
|
|
fi
|
|
|
|
#
|
|
# GCC installation
|
|
#
|
|
|
|
# define lists of include, lib and bin paths
|
|
|
|
cFlags=""
|
|
ldFlags=""
|
|
binPaths=""
|
|
libPaths=""
|
|
incPaths=""
|
|
SEP=""
|
|
for dir in gcc auxtools bison flex bdb; do
|
|
cFlags=$cFlags"-I$sdk/$dir/include "
|
|
ldFlags=$ldFlags"-L$sdk/$dir/lib "
|
|
binPaths=$binPaths$SEP"$sdk/$dir/bin"
|
|
libPaths=$libPaths$SEP"$sdk/$dir/lib"
|
|
incPaths=$incPaths$SEP"$sdk/$dir/include"
|
|
SEP=":"
|
|
done
|
|
|
|
jlib="$javaInstDir/jre/lib/amd64"
|
|
jbin="$javaInstDir/bin"
|
|
export PATH=".:$binPaths:$jbin:$PATH"
|
|
export LD_LIBRARY_PATH="$libPaths:$jlib:$LD_LIBRARY_PATH"
|
|
export LIBRARY_PATH=$libPaths
|
|
export C_INCLUDE_PATH=$incPaths
|
|
export CPLUS_INCLUDE_PATH=$incPaths
|
|
|
|
|
|
printSep "Installation of GCC"
|
|
echo "PATH: $PATH" >> $logfile
|
|
echo "LD_LIBRARY_PATH: $LD_LIBRARY_PATH" >> $logfile
|
|
echo "LIBRARY_PATH: $LIBRARY_PATH" >> $logfile
|
|
echo "C_INCLUDE_PATH: $C_INLCUDE_PATH" >> $logfile
|
|
echo "CPLUS_INCLUDE_PATH: $CPLUS_INCLUDE_PATH" >> $logfile
|
|
checkCmd "gcc --version >> $logfile"
|
|
checkCmd "gcc --print-search-dirs >> $logfile"
|
|
checkCmd "flex --version >> $logfile"
|
|
checkCmd "bison --version >> $logfile"
|
|
|
|
#install gcc if necessary
|
|
if [ "$opt_gcc" = "yes" ]; then
|
|
gccCoreFile=$(ls $platformdir/gnu/gcc-core*)
|
|
gccfiles=$platformdir/gnu/gcc-*
|
|
objDir=$temp/gcc.objects
|
|
assert mkdir -p $objDir
|
|
installPackage "GCC with C++ support" gcc "$gccfiles" $objDir "all install" --disable-nls ../gcc-*/configure
|
|
assert hash -r
|
|
if ! checkVersion "gcc --version" $gccCoreFile; then
|
|
showMsg "err" "Something went wrong! gcc --version: ($LU_Version1 < \
|
|
$LU_Version2) does not report the version of the package file. Retry with
|
|
option -c
|
|
\"$gccCoreFile\""
|
|
abort
|
|
fi
|
|
else
|
|
showMsg "info" "The system's gcc will be used"
|
|
echo "gcc --version: " $(gcc --version)
|
|
fi
|
|
|
|
configureFlags="CFLAGS=\"$cFlags\" LDFLAGS=\"$ldFlags\""
|
|
|
|
printSep "Compiling auxiliary packages ..."
|
|
|
|
installPackage "Lib curses" auxtools $platformdir/gnu/ncurses-* $temp/ncurses-* "all install" --with-shared
|
|
installPackage "Lib readline" auxtools $platformdir/gnu/readline-* $temp/readline-* "all install" --with-curses
|
|
installPackage "Lib jpeg" auxtools $platformdir/non-gnu/jpeg* $temp/jpeg* "all install install-lib"
|
|
installPackage "Lib gsl" auxtools $platformdir/gnu/gsl-* $temp/gsl-* "all install"
|
|
if [ "$opt_platform" == "mac_osx" ]; then
|
|
installPackage "Findutils" auxtools $platformdir/gnu/findutils-* $temp/findutils-* "all install"
|
|
fi
|
|
|
|
installPackage "Bison, a parser generator" bison $platformdir/gnu/bison-* $temp/bison-* install
|
|
|
|
configureFlags=""
|
|
installPackage "Flex, a scanner generator" flex $platformdir/non-gnu/flex-* $temp/flex-* install
|
|
|
|
printSep "Compiling Berkeley-DB"
|
|
|
|
configureFlags="CFLAGS=\"$cFlags\" LDFLAGS=\"$ldFlags\""
|
|
installPackage "Berkeley-DB" bdb $platformdir/non-gnu/db-* $temp/db-*/build_unix "all install" --enable-cxx ../dist/configure
|
|
|
|
printSep "Compiling SWI-Prolog"
|
|
|
|
configureFlags="CFLAGS=\"-I$sdk/auxtools/include\" LDFLAGS=\"-L$sdk/auxtools/lib\""
|
|
if [ "$opt_platform" != "mac_osx" ]; then
|
|
installPackage "SWI-Prolog 1/2" swi $platformdir/prolog/pl-* $temp/pl-* "all install" "" -noCheckPoint
|
|
installPackage "SWI-Prolog 2/2" swi $platformdir/prolog/pl-* $temp/pl-*/packages "all install" "--without-xpce --without-zlib"
|
|
fi
|
|
|
|
finish
|