-
Notifications
You must be signed in to change notification settings - Fork 3
/
install-gprbuild.sh
199 lines (157 loc) · 4.56 KB
/
install-gprbuild.sh
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
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
#! /bin/bash
# ------------------------------------------------------------------------------
# -- --
# -- GPRBUILD iNSTALLER --
# -- --
# -- Copyright (C) 2023 Mario Blunk, Blunk electronic --
# -- --
# -- This program is free software: you can redistribute it and/or modify --
# -- it under the terms of the GNU General Public License as published by --
# -- the Free Software Foundation, either version 3 of the License, or --
# -- (at your option) any later version. --
# -- --
# -- This program is distributed in the hope that it will be useful, --
# -- but WITHOUT ANY WARRANTY; without even the implied warranty of --
# -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the --
# -- GNU General Public License for more details. --
# -- --
# -- You should have received a copy of the GNU General Public License --
# -- along with this program. If not, see <http://www.gnu.org/licenses/>. --
# ------------------------------------------------------------------------------
#
# -- For correct displaying set tab width in your editor to 4.
#
# -- The two letters "CS" indicate a "construction site" where things are not
# -- finished yet or intended for the future.
#
# -- Please send your questions and comments to:
# --
# -- [email protected]
# -- or visit <http://www.blunk-electronic.de> for more contact information
# --
# -- history of changes:
# --
# exit this script on error:
set -e
install_dir=gprbuild_tmp
download_required=no
proc_confirmation()
{
read -p "Press ENTER to continue. Otherwise press CTRL-C to abort. "
}
proc_make_install_dir()
{
if [ -e $install_dir ]; then
{
echo "deleting existing" $install_dir
rm -rf $install_dir
}
fi
echo "creating install directory" $install_dir "..."
mkdir $install_dir
}
proc_dowload_xmlada()
{
echo "downloading and unpacking xmlada ..."
wget --no-netrc https://github.com/AdaCore/xmlada/archive/refs/tags/v23.0.0.tar.gz
tar -xf v23.0.0.tar.gz
rm v23.0.0.tar.gz
# There is no need to build xmlada.
}
proc_download_gprconfig_kb()
{
echo "downloading gprconfig_kb ..."
git clone https://github.com/AdaCore/gprconfig_kb.git
}
proc_download_gprbuild()
{
echo "downloading gprbuild ..."
#git clone https://github.com/AdaCore/gprbuild.git
wget --no-netrc https://github.com/AdaCore/gprbuild/archive/refs/tags/v23.0.0.tar.gz
tar -xf v23.0.0.tar.gz
rm v23.0.0.tar.gz
}
proc_bootstrap_gprbuild()
{
echo "bootstrapping gprbuild ..."
cd gprbuild-23.0.0
./bootstrap.sh --with-xmlada=../xmlada-23.0.0 --with-kb=../gprconfig_kb --prefix=./bootstrap
export PATH=$PATH:$PWD/bootstrap/bin/
cd ..
}
proc_build_xmlada()
{
echo "building xmlada ..."
cd xmlada-23.0.0
./configure --prefix=$PWD/install
make all
make install
export GPR_PROJECT_PATH=$PWD/install/share/gpr/
cd ..
}
proc_build_gprbuild()
{
echo "building gprbuild ..."
cd gprbuild-23.0.0
make all
make install
cd ..
}
proc_install_warning()
{
echo "WARNING: YOU LAUNCH THIS SCRIPT ON YOUR OWN RISK !!"
echo "Make sure you have a backup of your system !!"
proc_confirmation
}
proc_clean_up ()
{
echo "removing $install_dir"
rm -rf $install_dir
}
############ MAIN BEGIN #####################################################################
# Test arguments. If argument is "no-download", then no downloading will take place.
if [ $# -eq 0 ]; then
{
download_required=yes
}
else
{
case "$1" in
no-download)
download_required=no
;;
# remove)
# proc_remove
# exit
# ;;
clean-up)
proc_clean_up
exit
;;
*) echo "ERROR: invalid argument:" $1 ;;
esac
}
fi
proc_install_warning
if [ "$download_required" = "yes" ]; then
{
proc_make_install_dir
cd $install_dir
proc_dowload_xmlada
proc_download_gprconfig_kb
proc_download_gprbuild
}
else
{
cd $install_dir
}
fi
proc_bootstrap_gprbuild
proc_build_xmlada
proc_build_gprbuild
# change back to base directory
cd ../../
echo "gprbuild installation complete."
echo "run command 'gprconfig' to see if gprbuild works."
echo "Exit gprconfig with CTRL-C."
exit