Commit 351d6bd3 authored by incardon's avatar incardon

Adding missing installation script

parent ee843717
#! /bin/bash
function detect_gcc_or_clang()
{
command -v $1 >/dev/null 2>&1
if [ $? -ne 0 ]; then
dgc_ret=0
return
fi
# First we try to understand if g++ command line is linked to clang
$1 --version | grep "Apple LLVM"
if [ $? == 0 ]; then
echo "Apple LLVM based g++"
# we try the detect the version
major=$(g++ --version | grep LLVM | sed 's/.*\([0-9][0-9]*\)\.\([0-9][0-9]*\)\.\([0-9][0-9]*\).*(.*/\1/g')
# we check if the detection is garbage
echo "$major" | egrep -q '^[0-9]+$'
if [ $? == 0 ]; then
dgc_major=$($1 --version | grep LLVM | sed 's/.*\([0-9][0-9]*\)\.\([0-9][0-9]*\)\.\([0-9][0-9]*\).*(.*/\1/g')
dgc_middle=$($1 --version | grep LLVM | sed 's/.*\([0-9][0-9]*\)\.\([0-9][0-9]*\)\.\([0-9][0-9]*\).*(.*/\2/g')
dgc_minor=$($1 --version | grep LLVM | sed 's/.*\([0-9][0-9]*\)\.\([0-9][0-9]*\)\.\([0-9][0-9]*\).*(.*/\3/g')
if [ $dgc_major -gt 6 ]; then
echo -e "clang++ $dgc_major.$dgc_middle.$dgc_minor \033[92;1m SUCCESS \033[0m"
dgc_compiler=clang++
dgc_ret=1
elif [ $dgc_major -lt 6 ]; then
echo -e "clang++ $dgc_major.$dgc_middle.$dgc_minor \033[91;5;1m FAILED \033[0m your Apple clang $major.middle;$minor is too old, 6.1.0 or higher is required"
dgc_ret=0
elif [ $dgc_middle -gt 1 ]; then
echo -e "clang++ $dgc_major.$dgc_middle.$dgc_minor \033[92;1m SUCCESS \033[0m"
dgc_compiler=clang++
dgc_ret=1
elif [ $dgc_minor -lt 1 ]; then
echo -e "clang++ $dgc_major.$dgc_middle.$dgc_minor \033[91;5;1m FAILED \033[0m your Apple clang $major.middle;$minor is too old, 6.1.0 or higher is required"
dgc_ret=0
else
echo -e "Apple clang++ version $dgc_major.$dgc_middle.$dgc_minor \033[92;1m SUCCESS \033[0m"
dgc_compiler=clang++
dgc_ret=1
fi
return
fi
dgc_ret=2
return
fi
$1 --version | grep $1
if [ $? == 0 -a x"$1" == x"gcc" ]; then
dgc_major=$($1 --version | grep $1 | sed 's/.*\([0-9][0-9]*\)\.\([0-9][0-9]*\)\.\([0-9][0-9]*\).*/\1/g')
dgc_middle=$($1 --version | grep $1 | sed 's/.*\([0-9][0-9]*\)\.\([0-9][0-9]*\)\.\([0-9][0-9]*\).*/\2/g')
dgc_minor=$($1 --version | grep $1 | sed 's/.*\([0-9][0-9]*\)\.\([0-9][0-9]*\)\.\([0-9][0-9]*\).*/\3/g')
if [ $dgc_major -gt 4 ]; then
echo -e "$1 $dgc_major.$dgc_middle.$dgc_minor \033[92;1m SUCCESS \033[0m"
dgc_compiler=g++
dgc_ret=1
elif [ $dgc_major -lt 4 ]; then
echo -e "$1 $dgc_major.$dgc_middle.$dgc_minor \033[91;5;1m FAILED \033[0m your g++ version is too old, 4.8.2 at least required"
dgc_ret=0
elif [ $dgc_middle -gt 8 ]; then
echo -e "$1 $dgc_major.$dgc_middle.$dgc_minor \033[92;1m SUCCESS \033[0m"
dgc_compiler=g++
dgc_ret=1
elif [ $dgc_middle -lt 8 ]; then
echo -e "$1 $dgc_major.$dgc_middle.$dgc_minor \033[91;5;1m FAILED \033[0m your g++ version is too old, 4.8.2 at least required"
dgc_ret=0
elif [ $dgc_minor -gt 1 ]; then
echo -e "$1 $dgc_major.$dgc_middle.$dgc_minor \033[92;1m SUCCESS \033[0m"
dgc_compiler=g++
dgc_ret=1
else
echo -e "$1 $dgc_major.$dgc_middle.$dgc_minor \033[92;1m FAILED \033[0m your g++ version is too old, 4.8.2 at least required"
dgc_ret=0
fi
return
fi
$1 --version | grep $1
if [ $? == 0 -a x"$1" == x"clang" ]; then
dgc_major=$($1 --version | grep $1 | sed 's/.*\([0-9][0-9]*\)\.\([0-9][0-9]*\)\.\([0-9][0-9]*\).*/\1/g')
dgc_middle=$($1 --version | grep $1 | sed 's/.*\([0-9][0-9]*\)\.\([0-9][0-9]*\)\.\([0-9][0-9]*\).*/\2/g')
dgc_minor=$($1 --version | grep $1 | sed 's/.*\([0-9][0-9]*\)\.\([0-9][0-9]*\)\.\([0-9][0-9]*\).*/\3/g')
if [ $dgc_major -gt 3 ]; then
echo -e "$1 $dgc_major.$dgc_middle.$dgc_minor \033[92;1m SUCCESS \033[0m"
dgc_compiler=clang++
dgc_ret=1
elif [ $dgc_major -lt 3 ]; then
echo -e "$1 $dgc_major.$dgc_middle.$dgc_minor \033[91;5;1m FAILED \033[0m your clang version is too old 3.6.0 at least required"
dgc_ret=0
elif [ $dgc_middle -gt 6 ]; then
echo -e "$1 $dgc_major.$dgc_middle.$dgc_minor \033[92;1m SUCCESS \033[0m"
dgc_compiler=clang++
dgc_ret=1
elif [ $dgc_middle -lt 6 ]; then
echo -e "$1 $dgc_major.$dgc_middle.$dgc_minor \033[91;5;1m FAILED \033[0m your clang version is too old 3.6.0 at least required"
dgc_ret=0
else
echo -e "$1 $dgc_major.$dgc_middle.$dgc_minor \033[92;1m SUCCESS \033[0m"
dgc_compiler=clang++
dgc_ret=0
fi
return
fi
dgc_ret=0
}
#! /bin/bash
function detect_osx()
{
if [ x"$1" != x"osx" ]; then
return
fi
# Try first pattern
version=$(sw_vers | grep ProductVersion | sed 's/.*\([0-9][0-9]\)\.\([0-9][0-9]*\)\.\([0-9][0-9]*\).*/\1/g')
echo "$version" | egrep -q '^[0-9]+$'
if [ $? == 0 ]; then
dosx_major=$(sw_vers | grep ProductVersion | sed 's/.*\([0-9][0-9]\)\.\([0-9][0-9]*\)\.\([0-9][0-9]*\).*/\1/g')
dosx_middle=$(sw_vers | grep ProductVersion | sed 's/.*\([0-9][0-9]\)\.\([0-9][0-9]*\)\.\([0-9][0-9]*\).*/\2/g')
dosx_minor=$(sw_vers | grep ProductVersion | sed 's/.*\([0-9][0-9]\)\.\([0-9][0-9]*\)\.\([0-9][0-9]*\).*/\3/g')
if [ $dosx_major -gt 10 ]; then
dosx_ret=1
elif [ $dosx_major -lt 10 ]; then
dosx_ret=0
elif [ $dosx_middle -gt 10 ]; then
dosx_ret=1
elif [ $dosx_middle -lt 10 ]; then
dosx_ret=1
else
dosx_ret=0
fi
fi
version=$(sw_vers | grep ProductVersion | sed 's/.*\([0-9][0-9]\)\.\([0-9][0-9]*\).*/\1/g')
echo "$version" | egrep -q '^[0-9]+$'
if [ $? == 0 ]; then
dosx_major=$(sw_vers | grep ProductVersion | sed 's/.*\([0-9][0-9]\)\.\([0-9][0-9]*\).*/\1/g')
dosx_middle=$(sw_vers | grep ProductVersion | sed 's/.*\([0-9][0-9]\)\.\([0-9][0-9]*\).*/\2/g')
if [ $dosx_major -gt 10 ]; then
dosx_ret=1
elif [ $dosx_major -lt 10 ]; then
dosx_ret=0
elif [ $dosx_middle -gt 10 ]; then
dosx_ret=1
elif [ $dosx_middle -lt 10 ]; then
dosx_ret=1
else
dosx_ret=0
fi
fi
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment