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