-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathBootstrap
More file actions
executable file
·198 lines (181 loc) · 7.14 KB
/
Bootstrap
File metadata and controls
executable file
·198 lines (181 loc) · 7.14 KB
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
198
#!/bin/sh
# $Source: bitbucket.org:berkeleylab/gasnet.git/Bootstrap $
# Description: GASNet developer Bootstrap script
# Copyright 2004, Dan Bonachea <bonachea@cs.berkeley.edu>
# Terms of use are as specified in license.txt
set -e
srcdir=`dirname $0`
TIME=
CONFIRM=${GASNET_BOOTSTRAP_CONFIRM:-0}
NOTOOLCHECK=0
TOOLSONLYMODE=0
autofilter="perl -0 -pe 's/^(autoheader.*?: )?WARN.+auxiliary files(.|\n)+WARN.+documentation.\n//m' \
| perl -pe 's/^.*?AC_PROG_LEX invoked multiple times.*?\n?$//g' \
| perl -pe 's/^.*docdir.*y defined (in condition TRUE|here).*?\n?$//' \
| perl -0 -pe 's/^((.*?AC_CONFIG_SUBDIRS.*?\n)+([^ ]* the top level\n)?)*//g'"
for arg in "$@"; do
case "$arg" in
-h) echo "Usage: $0 [options]"
echo " -v verbose mode: don't filter benign warnings from autotool output"
echo " -t time autotool commands"
echo " -y force a Bootstrap, even if it looks unnecessary"
echo " -n no checks for autotool presence and versions"
echo " -o Bootstrap for tools-only distribution (default is conduit-mode)"
echo " -T touch Bootstrap-generated files to make them appear up-to-date"
exit 1
;;
-T) DOTOUCH=1 ;;
-v) autofilter=cat ;;
-y) CONFIRM=1 ;;
y) CONFIRM=1 ;; # legacy
-n) NOTOOLCHECK=1 ;;
n) NOTOOLCHECK=1 ;; # legacy
-p) ;; # used by Titanium Bootstrap - ignore
-P) ;; # used by Titanium Bootstrap - ignore
-o) TOOLSONLYMODE=1 ;;
-t) TIME='/usr/bin/time'
if test ! -x "$TIME" ; then
TIME=
fi
;;
*) ;; # ignore unrecognized args
esac
done
if [ "$DOTOUCH" = 1 ]; then
if [ -r $srcdir/gasnet_config.h.in \
-a -r $srcdir/Makefile.in \
-a -r $srcdir/aclocal.m4 \
-a -r $srcdir/configure \
]; then
echo "Touching Bootstrap-generated files in $srcdir to make them appear up-to-date"
cd $srcdir
touch aclocal.m4
sleep 2
touch configure gasnet_config.h.in
sleep 2
perl -ane 'utime undef, undef, (grep {m/\bMakefile\.in$/ && -f $_} @F);' -- unBootstrap
exit 0;
else
echo "Can't touch generated files because this tree does not appear to be Bootstrapped"
exit 1;
fi
fi
DOIT='echo "+ $CMD | \$autofilter" ; ( eval $TIME $CMD 2>&1 || kill $$ ) | eval $autofilter'
if [ \
-r $srcdir/gasnet_config.h.in \
-a -r $srcdir/Makefile.in \
-a -r $srcdir/aclocal.m4 \
-a -r $srcdir/configure \
-a "$CONFIRM" != "1" \
]; then
echo 'The "Bootstrap" script need only be used on a'
echo 'completely clean, fresh source tree. After the'
echo 'first build, you should just use "make" or "gmake".'
echo
echo 'It looks as though you have already bootstrapped'
echo 'this source tree. You should only bootstrap it'
echo 'again if the makefiles or configuration files are'
echo 'broken and "make" or "gmake" do not work properly.'
echo
echo 'Are you sure you want to re-bootstrap this tree?'
echo
case `echo -n` in
'') n='-n' c='' ;;
*) n='' c='\c' ;;
esac
echo $n "[y/n]: $c"
read redo
case $redo in
y* ) ;;
* ) exit 1;
esac
fi
if test "$NOTOOLCHECK" != "1" ; then
missing=
for autotool in autoconf autoheader automake aclocal m4 ; do
info=`( $autotool --version 2>/dev/null < /dev/null || echo 'Not found' ) | head -1`
if test "$info" != "Not found" ; then
info="$info, in `which $autotool`"
elif test "$autotool" != "m4" ; then
missing="$missing$autotool "
fi
echo "$autotool: $info"
done
if test "$missing" != ""; then
echo "The following GNU autotools are missing from your PATH:"
echo " $missing"
if test -r $srcdir/gasnet_config.h.in \
-a -r $srcdir/Makefile.in \
-a -r $srcdir/aclocal.m4 \
-a -r $srcdir/configure ; then
echo "However, it appears this directory has already been Bootstrapped."
echo "You should skip Bootstrap and instead do: configure ; gmake"
else
echo "Please download them from ftp://ftp.gnu.org/gnu"
fi
exit 1
fi
fi
set -x
cd $srcdir
rm -Rf autom4te*.cache
set +x
TOOLSONLYFLAG=.gasnet_toolsonly_mode
TOOLSONLYFILES="configure.in Makefile.am other/Makefile.am"
if test "$TOOLSONLYMODE" = 1 -a ! -f "$TOOLSONLYFLAG" ; then
echo "+ Switching source archive to GASNet tools-only mode"
eval perl other/tools-toggle.pl -y $TOOLSONLYFILES
touch "$TOOLSONLYFLAG"
elif test "$TOOLSONLYMODE" = 0 -a -f "$TOOLSONLYFLAG" ; then
if test ! -d smp-conduit ; then
echo "+ WARNING: Attempted a conduit-mode Bootstrap, but conduit sources appear to be missing."
echo "+ WARNING: Assuming you meant to include the -o option for a tools-only distribution."
else
echo "+ Switching source archive back from GASNet tools-only mode to regular mode"
eval perl other/tools-toggle.pl -n $TOOLSONLYFILES
rm -f "$TOOLSONLYFLAG"
fi
fi
CMD="aclocal -I other/plpa/config" ; eval $DOIT
CMD="autoheader" ; eval $DOIT
set -x
# autoheader omits updating the header if it thinks nothing has changed,
# but automake's dependency checks are stronger (include aclocal.m4, which just changed)
# ensure the header looks up-to-date (autoheader -f option not version portable)
touch gasnet_config.h.in
set +x
CMD="autoconf" ; eval $DOIT
set -x
# Perform some postprocessing to fix bugs in the configure script:
# 1) caching:
# Our configure script requires caching, and autoconf 2.5 stupidly disables
# caching by default. Caching may open some dangers of stale values, but
# the alternative is worse - automake reconfiguring in the absence of
# precious environment variables leads to silent incorrect behavior that
# can't be detected or fixed because there's no cache!
# Restore ./config.cache as the default cache
# 2) recursive configure:
# When $top_builddir contains a space, the configure script tries to cd
# back to $top_builddir w/o quoting it.
# Add quotes around the offending command.
mv configure .configure-orig
perl -pe 's@^cache_file=/dev/null$@cache_file=./config.cache@; s/cd \$ac_popdir/cd "\$ac_popdir"/;' \
.configure-orig > configure
chmod +x configure
rm -f .configure-orig
set +x
CMD="automake -a" ; eval $DOIT
set -x
# Perform some postprocessing to fix bugs in automake:
# 1) Overrides: Automake is too stupid to notice several overrides we intentionally perform,
# leading to spam of harmless warnings of the form:
# warning: overriding commands for target X
# warning: ignoring old commands for target X
# Remove the earlier, overridden rule to silence the warning AND remove unwanted dependencies
# top-level: Makefile and distclean targets, remove all but the last rule (ours)
perl -0777 -i.bak -pe 's/^(distclean|Makefile):[^\n]*\n(?:\t[^\n]*\n)*(?=.*\n\1:)//msg' Makefile.in
# conduits: Makefile target defined in included other/Makefile-conduit.mak, just clear the automake one
perl -0777 -i.bak -pe 's/^Makefile:[^\n]*\n(?:\t[^\n]*\n)*//msg' *-conduit/Makefile.in
rm -f Makefile.in.bak *-conduit/Makefile.in.bak
rm -Rf autom4te*.cache
rm -f config.cache