File: doinstall

package info (click to toggle)
gprbuild 2011-2
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 10,396 kB
  • sloc: ada: 94,726; sh: 2,818; xml: 2,225; makefile: 471; ansic: 240; cpp: 89; fortran: 62; asm: 27
file content (159 lines) | stat: -rwxr-xr-x 3,481 bytes parent folder | download | duplicates (2)
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
#!/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
    prefix=`type $ggd_prog | cut -d' ' -f3 | sed 's%/bin.*$%%'`
    machine=`$prefix/bin/gcc -dumpmachine || true`
fi

gprbuild="gprbuild"

clear
cat << EOF


  This script is provided to simplify the installation of the $machine
  binary distribution of $gprbuild - the multi languages project builder.
  This includes the $gprbuild binary as well as the corresponding
  documentation and examples.

  For more information about the commercial support of $gprbuild, please
  contact sales@adacore.com.

  This script will ask a few questions regarding the $gprbuild installation.

  Running this configuration script will not modify anything anywhere
  else in your system.  You can break out of it or run it multiple times
  before doing the actual installation.

  Hit 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 share libexec | (cd $installdir && tar xf -) ; then

   # --------------------------- End of the script -----------------------
   clear
   echo " "
   echo "$gprbuild has have 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