1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165
|
#!/bin/sh
prefix=''
has_gnatpro=n
machine=''
ggd_prefix=''
if [ "x$ggd_prefix" = "x" ]; then
ggd_prog="gnatmake"
else
ggd_prog="$ggd_prefix-gnatmake"
fi
if type $ggd_prog > /dev/null 2>&1 &&
$ggd_prog -v 2>&1 | grep GNATMAKE | grep -q Pro;
then
has_gnatpro=y
saved_IFS="$IFS"
IFS=:
for d in $PATH; do
if [ -x "$d/$ggd_prog" ]; then
prefix=$d
break
fi
done
IFS="$saved_IFS"
machine=`$prefix/gcc -dumpmachine || true`
fi
gprbuild="gprbuild"
# remove last 'bin' from prefix as it's not expected
prefix=`echo $prefix | sed 's/\/bin$//'`
clear
cat << EOF
This script is provided to simplify the installation of the
$machine
binary distribution of $gprbuild - the multi languages project builder.
For information on commercial support, please contact sales@adacore.com.
This script will ask a few questions regarding the $gprbuild installation.
Confirmation is required before any write action is taken.
Please press RETURN to continue.
EOF
read x
# --------------------- Select installation option --------------------
clear
cat << EOF
There are 2 options for installation:
EOF
if [ "$has_gnatpro" = "y" ]; then
cat <<EOF
1) Install $gprbuild in the standard GNAT Pro location.
($prefix)
EOF
else
cat <<EOF
1) Install $gprbuild in /usr/local (must be root)
EOF
fi
cat <<EOF
2) Install $gprbuild in non-standard locations that you will
specify.
EOF
if [ "$has_gnatpro" = "y" ]; then
cat <<EOF
Option 1 provides simplest use of $gprbuild.
EOF
fi
while [ true ]; do
echo "Type 1, or 2 (then RETURN) to choose an option: "
read answer
case $answer in
# ------------------ Custom installation ---------------------------
2)
clear
cat << EOF
To install $gprbuild in a non-standard location you need to
specify a base directory. All the files will be installed in
subdirectories that are created under this directory.
Important Note: You should not use ~ or ~username wildcards
when specifying this directory name.
Specify the base directory you want to use for installation:
EOF
read basedir
while [ true ]; do
if [ "X" = "X`echo $basedir|sed -n -e 's%^/.*%/%p'`" ]; then
basedir=`pwd`/$basedir
fi
echo " " The base directory is $basedir
echo " " To accept this choice enter RETURN.
echo " " Otherwise type a new name.
read answer
if [ "X$answer" = "X" ]; then
break
fi
basedir=$answer
done
clear
installdir=$basedir
break
;;
# ------------------ Regular installation ---------------------------
1)
if [ "$has_gnatpro" = "y" ]; then
installdir=$prefix
else
installdir="/usr/local"
fi
break
;;
*)
echo "Incorrect choice"
;;
esac
done
# --------------------- Actual Installation of Gprbuild --------------
if [ ! -d $installdir ]; then
mkdir -p $installdir
fi
if tar cf - bin libexec share | (cd $installdir && tar xf -) ; then
# --------------------------- End of the script -----------------------
clear
echo " "
echo "$gprbuild has been installed in $installdir"
echo "Thank you for using $gprbuild !"
echo " "
else
echo
echo "$gprbuild failed to be installed. Please check error messages"
echo
fi
|