]> git.saurik.com Git - bison.git/blob - bootstrap
* bootstrap (gnulib_modules): Add verify.
[bison.git] / bootstrap
1 #! /bin/sh
2
3 # Bootstrap this package from CVS.
4
5 # Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
6
7 # This program is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 2, or (at your option)
10 # any later version.
11
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
16
17 # You should have received a copy of the GNU General Public License
18 # along with this program; if not, write to the Free Software
19 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
20 # 02110-1301, USA.
21
22 # Written by Paul Eggert.
23
24 package=bison
25
26 # Ensure file names are sorted consistently across platforms;
27 # e.g., m4/ulonglong_gl.m4 should follow m4/ulonglong.m4.
28 # Also, ensure diagnostics are in English, e.g., "wget --help" below.
29 LC_ALL=C
30 export LC_ALL
31
32 # Parse options.
33
34 for option
35 do
36 case $option in
37 --help)
38 echo "$0: usage: $0 [--gnulib-srcdir=DIR] [--cvs-user=USERNAME] [--skip-po]"
39 exit;;
40 --gnulib-srcdir=*)
41 GNULIB_SRCDIR=`expr "$option" : '--gnulib-srcdir=\(.*\)'`;;
42 --cvs-user=*)
43 CVS_USER=`expr "$option" : '--cvs-user=\(.*\)'`;;
44 --skip-po)
45 SKIP_PO=t;;
46 *)
47 echo >&2 "$0: $option: unknown option"
48 exit 1;;
49 esac
50 done
51
52 echo "$0: Bootstrapping CVS $package..."
53
54 build_cvs_prefix() {
55 CVS_PREFIX=:${1}:
56 if [ "${2}" != - ]; then
57 CVS_PREFIX=${CVS_PREFIX}${2}@
58 fi
59 }
60
61 # Get gnulib files.
62
63 case ${GNULIB_SRCDIR--} in
64 -)
65 if [ ! -d gnulib ]; then
66 echo "$0: getting gnulib files..."
67
68 trap exit 1 2 13 15
69 trap 'rm -fr gnulib; exit 1' 0
70
71 case ${CVS_AUTH-anoncvs} in
72 anoncvs)
73 CVS_PREFIX='anoncvs@';;
74 ssh)
75 CVS_PREFIX="$CVS_USER${CVS_USER+@}";;
76 *)
77 echo "$0: $CVS_AUTH: Unknown CVS access method" >&2
78 exit 1;;
79 esac
80
81 case $CVS_RSH in
82 '') export CVS_RSH=ssh;;
83 esac
84
85 cvs -z3 -q -d ${CVS_PREFIX}subversions.gnu.org:/cvsroot/gnulib co gnulib || exit
86
87 trap - 0
88 fi
89 GNULIB_SRCDIR=gnulib
90 esac
91
92 <$GNULIB_SRCDIR/gnulib-tool || exit
93
94 gnulib_modules='
95 argmatch
96 dirname
97 error
98 extensions
99 getopt
100 gettext
101 hard-locale
102 hash
103 malloc
104 mbswidth
105 obstack
106 quote
107 quotearg
108 stdbool
109 stdio-safer
110 stpcpy
111 unistd-safer
112 verify
113 xalloc
114 xalloc-die
115 xstrndup
116 '
117
118 previous_gnulib_modules=
119 while [ "$gnulib_modules" != "$previous_gnulib_modules" ]; do
120 previous_gnulib_modules=$gnulib_modules
121 gnulib_modules=`
122 (echo "$gnulib_modules"
123 for gnulib_module in $gnulib_modules; do
124 $GNULIB_SRCDIR/gnulib-tool --extract-dependencies $gnulib_module
125 done) | sort -u
126 `
127 done
128
129 gnulib_files=`
130 (for gnulib_module in $gnulib_modules; do
131 $GNULIB_SRCDIR/gnulib-tool --extract-filelist $gnulib_module
132 done) | sort -u
133 `
134
135 gnulib_dirs=`echo "$gnulib_files" | sed 's,/[^/]*$,,' | sort -u`
136 mkdir -p $gnulib_dirs || exit
137
138 for gnulib_file in $gnulib_files; do
139 dest=$gnulib_file
140
141 case $gnulib_file in
142 m4/onceonly_2_57.m4) dest=m4/onceonly.m4;;
143 # These will be overwritten by autopoint, which still uses
144 # old jm_.* macro names, so we have to keep both copies.
145 # m4/gettext.m4 isn't mentioned here, since it's patched below.
146 m4/glibc21.m4 | m4/inttypes_h.m4 | m4/lib-ld.m4 | \
147 m4/lib-prefix.m4 | m4/po.m4 | m4/stdint_h.m4 | m4/uintmax_t.m4 | \
148 m4/ulonglong.m4)
149 dest=`expr $gnulib_file : '\(.*\).m4'`_gl.m4;;
150 esac
151
152 rm -f $dest &&
153 echo "$0: Copying file $GNULIB_SRCDIR/$gnulib_file" &&
154 cp -p $GNULIB_SRCDIR/$gnulib_file $dest || exit
155 done
156
157 # This suppresses a bogus diagnostic
158 # "warning: macro `AM_LANGINFO_CODESET' not found in library".
159 echo "$0: patching m4/gettext.m4 so that AM_INTL_SUBDIR is empty ..."
160 sed '
161 /^AC_DEFUN(\[AM_INTL_SUBDIR],/,/^]/c\
162 AC_DEFUN([AM_INTL_SUBDIR], [])
163 ' m4/gettext.m4 >m4/gettext_gl.m4 || exit
164
165
166 # Get translations.
167
168 case $SKIP_PO in
169 '')
170 case `wget --help` in
171 *'--no-cache'*)
172 no_cache='--no-cache';;
173 *'--cache=on/off'*)
174 no_cache='--cache=off';;
175 *)
176 no_cache='';;
177 esac
178
179 echo "$0: getting translations into po (please ignore the robots.txt ERROR 404)..."
180 (cd po &&
181 rm -f dummy `ls | sed -n '/\.gmo$/p; /\.po/p'` &&
182 wget -nv -nd -r -l 1 -A .po $no_cache \
183 http://www.iro.umontreal.ca/translation/maint/$package/ &&
184 ls *.po | sed 's/\.po$//' >LINGUAS
185 ) || exit
186
187 case $package in
188 bison)
189 echo "$0: getting translations into po (please ignore the robots.txt ERROR 404)..."
190 (cd runtime-po &&
191 rm -f dummy `ls | sed -n '/\.gmo$/p; /\.po$/p'` &&
192 wget -nv -nd -r -l 1 -A .po $no_cache \
193 http://www.iro.umontreal.ca/translation/maint/$package-runtime/ &&
194
195 # For translations that have not yet been upgraded to the new
196 # runtime-po domain, prime the pump by extracting the relevant
197 # strings from the obsolete translations.
198 # This code can be removed once the bison-runtime domain
199 # has been translated by each team.
200 for po in ../po/*.po; do
201 test -f "$po" || continue
202 runpo=`basename $po`
203 test -f $runpo || {
204 msggrep -K \
205 -e 'memory exhausted' \
206 -e 'syntax error' \
207 $po 2>/dev/null |
208 sed '
209 s/^#~ //
210 /^msgid "syntax error; also memory exhausted"$/,/^$/d
211 /^$/,${ /^#/d; }
212 ' >$runpo-
213 if cmp -s $runpo- $runpo; then
214 rm $runpo-
215 else
216 mv $runpo- $runpo
217 fi
218 test -s $runpo || rm -f $runpo
219 } || exit
220 done &&
221
222 ls *.po | sed 's/\.po$//' >LINGUAS
223 ) || exit
224 esac;;
225 esac
226
227
228 # Generate autoconf and automake snippets.
229
230 (echo '# This file is generated automatically by "bootstrap".' &&
231 echo 'AC_DEFUN([GNULIB_AUTOCONF_SNIPPET],[' &&
232 $GNULIB_SRCDIR/gnulib-tool --extract-autoconf-snippet $gnulib_modules &&
233 echo '])'
234 ) >m4/gnulib.m4 || exit
235
236 (echo '# This file is generated automatically by "bootstrap".' &&
237 $GNULIB_SRCDIR/gnulib-tool --extract-automake-snippet $gnulib_modules
238 ) >lib/gnulib.mk || exit
239
240
241 # Reconfigure, getting other files.
242
243 echo "$0: autoreconf --verbose --install --force ..."
244 autoreconf --verbose --install --force || exit
245
246
247 # We don't need intl, so remove it.
248 # Remove aclocal.m4 too, so that it gets rebuilt.
249 intl_files_to_remove='
250 aclocal.m4
251 intl
252 m4/codeset.m4
253 m4/gettext.m4
254 m4/glibc2.m4
255 m4/glibc21.m4
256 m4/intdiv0.m4
257 m4/intmax.m4
258 m4/inttypes_h.m4
259 m4/inttypes.m4
260 m4/inttypes-pri.m4
261 m4/isc-posix.m4
262 m4/lcmessage.m4
263 m4/lib-ld.m4
264 m4/lib-prefix.m4
265 m4/longdouble.m4
266 m4/longlong.m4
267 m4/po.m4
268 m4/printf-posix.m4
269 m4/signed.m4
270 m4/size_max.m4
271 m4/stdint_h.m4
272 m4/uintmax_t.m4
273 m4/ulonglong.m4
274 m4/wchar_t.m4
275 m4/wint_t.m4
276 m4/xsize.m4
277 '
278 echo $0: rm -fr $intl_files_to_remove ...
279 rm -fr $intl_files_to_remove || exit
280
281 # Put bug-reporting address into po/Makevars.
282 echo "$0: sed '/^MSGID_BUGS_ADDRESS *=/s/=.*/= bug-bison@gnu.org/' po/Makevars.template >po/Makevars ..."
283 sed '/^MSGID_BUGS_ADDRESS *=/s/=.*/= bug-bison@gnu.org/' po/Makevars.template >po/Makevars
284
285 # Likewise for runtime-po/Makevars, except also change a few other parameters.
286 sed '
287 s/^\(DOMAIN\) *=.*/\1 = bison-runtime/
288 s/^\(subdir\) *=.*/\1 = runtime-po/
289 s/^\(XGETTEXT_OPTIONS\) *=.*/\1 = --keyword=YY_/
290 ' <po/Makevars >runtime-po/Makevars
291
292 # Copy identical files from po to runtime-po.
293 (cd po && cp -p Makefile.in.in *-quot *.header *.sed *.sin ../runtime-po)
294
295 # if src/parse-gram.[ch] are out of date, rebuild them.
296 parse_gram_y=`find src/parse-gram.y \
297 '(' -newer src/parse-gram.c -o -newer src/parse-gram.h ')' \
298 -print` || exit
299 case $parse_gram_y in
300 ?*)
301 echo "$0: warning: bootstrapping with old src/parse-gram.[ch] files."
302
303 echo "$0: touch -c src/parse-gram.[ch] ... "
304 touch -c src/parse-gram.[ch] || exit
305
306 echo "$0: ./configure --disable-nls ..."
307 ./configure --disable-nls || exit
308
309 echo "$0: (cd lib && make) ..."
310 (cd lib && make) || exit
311
312 echo "$0: (cd src && make) ..."
313 (cd src && make) || exit
314
315 echo "$0: rm -f src/parse-gram.c src/parse-gram.h ..."
316 rm -f src/parse-gram.c src/parse-gram.h || exit
317
318 echo "$0: (cd src && make parse-gram.c parse-gram.h) ..."
319 (cd src && make parse-gram.c parse-gram.h) || exit
320
321 echo "$0: make distclean ..."
322 make distclean || exit;;
323 esac
324
325 echo "$0: done. Now you can run './configure'."