]>
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 | ||
5a2baae7 PE |
26 | # Translation Project URL, for the registry of all projects. |
27 | TP_URL='http://www.iro.umontreal.ca/translation/registry.cgi?domain=' | |
28 | ||
62a9592d | 29 | # Ensure file names are sorted consistently across platforms. |
b5240ba5 | 30 | # Also, ensure diagnostics are in English, e.g., "wget --help" below. |
a9f027b9 PE |
31 | LC_ALL=C |
32 | export LC_ALL | |
33 | ||
1f65350a PE |
34 | # Parse options. |
35 | ||
36 | for option | |
37 | do | |
38 | case $option in | |
39 | --help) | |
40 | echo "$0: usage: $0 [--gnulib-srcdir=DIR] [--cvs-user=USERNAME] [--skip-po]" | |
41 | exit;; | |
42 | --gnulib-srcdir=*) | |
e23d0dd7 | 43 | GNULIB_SRCDIR=`expr "$option" : '--gnulib-srcdir=\(.*\)'`;; |
1f65350a | 44 | --cvs-user=*) |
e23d0dd7 | 45 | CVS_USER=`expr "$option" : '--cvs-user=\(.*\)'`;; |
1f65350a PE |
46 | --skip-po) |
47 | SKIP_PO=t;; | |
48 | *) | |
49 | echo >&2 "$0: $option: unknown option" | |
50 | exit 1;; | |
51 | esac | |
52 | done | |
53 | ||
54 | echo "$0: Bootstrapping CVS $package..." | |
55 | ||
e10a80ee PE |
56 | cleanup_gnulib() { |
57 | status=$? | |
58 | rm -fr gnulib | |
59 | exit $status | |
60 | } | |
61 | ||
1f65350a PE |
62 | # Get gnulib files. |
63 | ||
64 | case ${GNULIB_SRCDIR--} in | |
65 | -) | |
66 | if [ ! -d gnulib ]; then | |
67 | echo "$0: getting gnulib files..." | |
68 | ||
26546b42 PE |
69 | case ${CVS_AUTH-pserver} in |
70 | pserver) | |
71 | CVS_PREFIX=':pserver:anonymous@';; | |
1f65350a PE |
72 | ssh) |
73 | CVS_PREFIX="$CVS_USER${CVS_USER+@}";; | |
74 | *) | |
75 | echo "$0: $CVS_AUTH: Unknown CVS access method" >&2 | |
76 | exit 1;; | |
77 | esac | |
78 | ||
79 | case $CVS_RSH in | |
80 | '') export CVS_RSH=ssh;; | |
81 | esac | |
82 | ||
e10a80ee PE |
83 | trap cleanup_gnulib 1 2 13 15 |
84 | ||
26546b42 | 85 | cvs -z3 -q -d ${CVS_PREFIX}cvs.savannah.gnu.org:/cvsroot/gnulib co gnulib || |
e10a80ee | 86 | cleanup_gnulib |
1f65350a | 87 | |
e10a80ee | 88 | trap - 1 2 13 15 |
1f65350a PE |
89 | fi |
90 | GNULIB_SRCDIR=gnulib | |
91 | esac | |
92 | ||
284d8a13 PE |
93 | gnulib_tool=$GNULIB_SRCDIR/gnulib-tool |
94 | <$gnulib_tool || exit | |
1f65350a PE |
95 | |
96 | gnulib_modules=' | |
1f65350a PE |
97 | argmatch |
98 | dirname | |
99 | error | |
42e826a4 | 100 | extensions |
62a9592d | 101 | fopen-safer |
1f65350a | 102 | getopt |
c3d5a4a7 | 103 | gettext |
1f65350a PE |
104 | hash |
105 | malloc | |
106 | mbswidth | |
107 | obstack | |
108 | quote | |
109 | quotearg | |
110 | stdbool | |
cb48f191 | 111 | stdint |
1f65350a | 112 | stpcpy |
55f0c7b1 PE |
113 | strerror |
114 | strtoul | |
b50d2359 | 115 | strverscmp |
3ea5f0ec | 116 | unistd-safer |
fb9c0b33 | 117 | unlocked-io |
8a6f72f3 | 118 | verify |
1f65350a | 119 | xalloc |
a9f027b9 | 120 | xalloc-die |
1f65350a PE |
121 | xstrndup |
122 | ' | |
123 | ||
124 | previous_gnulib_modules= | |
125 | while [ "$gnulib_modules" != "$previous_gnulib_modules" ]; do | |
126 | previous_gnulib_modules=$gnulib_modules | |
127 | gnulib_modules=` | |
128 | (echo "$gnulib_modules" | |
129 | for gnulib_module in $gnulib_modules; do | |
10d6970f | 130 | $gnulib_tool --extract-dependencies $gnulib_module |
1f65350a PE |
131 | done) | sort -u |
132 | ` | |
133 | done | |
134 | ||
135 | gnulib_files=` | |
62a9592d PE |
136 | (echo m4/warning.m4 |
137 | for gnulib_module in $gnulib_modules; do | |
10d6970f | 138 | $gnulib_tool --extract-filelist $gnulib_module |
1f65350a PE |
139 | done) | sort -u |
140 | ` | |
141 | ||
142 | gnulib_dirs=`echo "$gnulib_files" | sed 's,/[^/]*$,,' | sort -u` | |
143 | mkdir -p $gnulib_dirs || exit | |
144 | ||
145 | for gnulib_file in $gnulib_files; do | |
146 | dest=$gnulib_file | |
1f65350a PE |
147 | rm -f $dest && |
148 | echo "$0: Copying file $GNULIB_SRCDIR/$gnulib_file" && | |
149 | cp -p $GNULIB_SRCDIR/$gnulib_file $dest || exit | |
150 | done | |
151 | ||
7e7b77c1 PE |
152 | # This suppresses a bogus diagnostic |
153 | # "warning: macro `AM_LANGINFO_CODESET' not found in library". | |
62a9592d | 154 | echo "$0: patching m4/gettext.m4 to remove need for intl/* ..." |
7e7b77c1 PE |
155 | sed ' |
156 | /^AC_DEFUN(\[AM_INTL_SUBDIR],/,/^]/c\ | |
157 | AC_DEFUN([AM_INTL_SUBDIR], []) | |
62a9592d PE |
158 | /^AC_DEFUN(\[gt_INTL_SUBDIR_CORE],/,/^]/c\ |
159 | AC_DEFUN([gt_INTL_SUBDIR_CORE], []) | |
7e7b77c1 PE |
160 | ' m4/gettext.m4 >m4/gettext_gl.m4 || exit |
161 | ||
1f65350a PE |
162 | |
163 | # Get translations. | |
164 | ||
5a2baae7 PE |
165 | get_translations() { |
166 | subdir=$1 | |
167 | domain=$2 | |
168 | ||
169 | echo "$0: getting translations into $subdir for $domain..." | |
170 | (cd $subdir && rm -f dummy `ls | sed -n '/\.gmo$/p; /\.po/p'`) && | |
171 | ||
172 | $WGET_COMMAND -O "$subdir/$domain.html" "$TP_URL$domain" && | |
173 | ||
174 | sed -n 's|.*"http://[^"]*/translation/teams/PO/\([^/"]*\)/'"$domain"'-\([^/"]*\)\.[^."]*\.po".*|\1.\2|p' <"$subdir/$domain.html" | | |
175 | sort -k 1,1 -k 2,2n -k2,2 -k3,3n -k3,3 -k4,4n -k4,4 -k5,5n -k5.5 | | |
176 | awk -F. ' | |
177 | { if (lang && $1 != lang) print lang, ver } | |
178 | { lang = $1; ver = substr($0, index($0, ".") + 1) } | |
179 | END { if (lang) print lang, ver } | |
180 | ' | awk -v domain="$domain" -v subdir="$subdir" ' | |
181 | { | |
182 | lang = $1 | |
62a9592d PE |
183 | |
184 | # Work around bugs in Bison 2.3 translations uncovered by gettext 0.15. | |
185 | # This workaround can be removed once the translations are fixed. | |
284d8a13 | 186 | if (lang == "id" || lang == "tr") next |
62a9592d | 187 | |
5a2baae7 PE |
188 | ver = $2 |
189 | urlfmt = "" | |
190 | printf "$WGET_COMMAND -O %s/%s.po 'http://www.iro.umontreal.ca/translation/teams/PO/%s/%s-%s.%s.po' &&\n", subdir, lang, lang, domain, ver, lang | |
191 | } | |
192 | END { print ":" } | |
193 | ' | sh && | |
194 | ls "$subdir"/*.po | sed 's|.*/||; s|\.po$||' >"$subdir/LINGUAS" && | |
195 | rm "$subdir/$domain.html" | |
196 | } | |
197 | ||
1f65350a PE |
198 | case $SKIP_PO in |
199 | '') | |
b5240ba5 PE |
200 | case `wget --help` in |
201 | *'--no-cache'*) | |
202 | no_cache='--no-cache';; | |
203 | *'--cache=on/off'*) | |
204 | no_cache='--cache=off';; | |
205 | *) | |
206 | no_cache='';; | |
207 | esac | |
208 | ||
5a2baae7 PE |
209 | WGET_COMMAND="wget -nv $no_cache" |
210 | export WGET_COMMAND | |
211 | ||
212 | get_translations po $package || exit | |
f7ab6a50 PE |
213 | |
214 | case $package in | |
215 | bison) | |
5a2baae7 | 216 | get_translations runtime-po $package-runtime || exit |
f7ab6a50 | 217 | esac;; |
1f65350a PE |
218 | esac |
219 | ||
220 | ||
221 | # Generate autoconf and automake snippets. | |
222 | ||
223 | (echo '# This file is generated automatically by "bootstrap".' && | |
224 | echo 'AC_DEFUN([GNULIB_AUTOCONF_SNIPPET],[' && | |
11daa4e7 PE |
225 | $gnulib_tool --extract-autoconf-snippet $gnulib_modules | |
226 | sed 's/AM_GNU_GETTEXT(\[external]/&, [need-ngettext]/' && | |
1f65350a PE |
227 | echo '])' |
228 | ) >m4/gnulib.m4 || exit | |
229 | ||
230 | (echo '# This file is generated automatically by "bootstrap".' && | |
10d6970f | 231 | $gnulib_tool --extract-automake-snippet $gnulib_modules | |
47671055 | 232 | sed 's/^[ ]*AM_CPPFLAGS[ ]*+=/# (commented out by bootstrap) &/' |
1f65350a PE |
233 | ) >lib/gnulib.mk || exit |
234 | ||
235 | ||
236 | # Reconfigure, getting other files. | |
237 | ||
62a9592d | 238 | echo "$0: autopoint --force ..." |
11daa4e7 | 239 | autopoint --force || exit |
e23d0dd7 | 240 | |
1f65350a | 241 | # We don't need intl, so remove it. |
e23d0dd7 | 242 | intl_files_to_remove=' |
e23d0dd7 PE |
243 | intl |
244 | m4/codeset.m4 | |
a9f027b9 | 245 | m4/gettext.m4 |
3ea5f0ec | 246 | m4/glibc2.m4 |
e23d0dd7 PE |
247 | m4/glibc21.m4 |
248 | m4/intdiv0.m4 | |
249 | m4/intmax.m4 | |
62a9592d | 250 | m4/inttypes-h.m4 |
e23d0dd7 | 251 | m4/inttypes-pri.m4 |
e23d0dd7 | 252 | m4/lcmessage.m4 |
62a9592d | 253 | m4/lock.m4 |
e23d0dd7 | 254 | m4/longdouble.m4 |
e23d0dd7 PE |
255 | m4/printf-posix.m4 |
256 | m4/signed.m4 | |
257 | m4/size_max.m4 | |
62a9592d | 258 | m4/visibility.m4 |
e23d0dd7 PE |
259 | m4/wint_t.m4 |
260 | m4/xsize.m4 | |
261 | ' | |
262 | echo $0: rm -fr $intl_files_to_remove ... | |
263 | rm -fr $intl_files_to_remove || exit | |
264 | ||
62a9592d | 265 | |
b4068c7c PE |
266 | # Undo changes to gnulib files that autoreconf made. |
267 | for gnulib_file in $gnulib_files; do | |
268 | test ! -f $gnulib_file || cmp -s $gnulib_file $GNULIB_SRCDIR/$gnulib_file || { | |
269 | rm -f $gnulib_file && | |
270 | echo "$0: Copying file $GNULIB_SRCDIR/$gnulib_file again" && | |
271 | cp -p $GNULIB_SRCDIR/$gnulib_file $gnulib_file || exit | |
272 | } | |
273 | done | |
274 | ||
62a9592d PE |
275 | # Make sure aclocal.m4 is not older than input files. |
276 | sleep 1 | |
277 | ||
278 | for command in \ | |
279 | 'aclocal --force -I m4' \ | |
280 | 'autoconf --force' \ | |
281 | 'autoheader --force' \ | |
282 | 'automake --add-missing --copy --force-missing'; | |
283 | do | |
284 | echo "$0: $command ..." | |
285 | $command || exit | |
286 | done | |
287 | ||
288 | ||
1f65350a | 289 | # Put bug-reporting address into po/Makevars. |
11daa4e7 PE |
290 | echo "$0: Creating po/Makevars from po/Makevars.template ..." |
291 | sed ' | |
292 | /^MSGID_BUGS_ADDRESS *=/s/=.*/= bug-bison@gnu.org/ | |
293 | /^XGETTEXT_OPTIONS *=/{ | |
294 | s/$/ \\/ | |
295 | a\ | |
296 | --flag=_:1:pass-c-format \\\ | |
297 | --flag=N_:1:pass-c-format \\\ | |
298 | --flag=error:3:c-format --flag=error_at_line:5:c-format \\\ | |
299 | --flag=warn:1:c-format --flag=warn_at:2:c-format \\\ | |
300 | --flag=complain:1:c-format --flag=complain_at:2:c-format \\\ | |
301 | --flag=fatal:1:c-format --flag=fatal_at:2:c-format | |
302 | } | |
303 | ' po/Makevars.template >po/Makevars | |
1f65350a | 304 | |
f7ab6a50 PE |
305 | # Likewise for runtime-po/Makevars, except also change a few other parameters. |
306 | sed ' | |
307 | s/^\(DOMAIN\) *=.*/\1 = bison-runtime/ | |
308 | s/^\(subdir\) *=.*/\1 = runtime-po/ | |
30757c8c | 309 | s/^\(XGETTEXT_OPTIONS\) *=.*/\1 = --keyword=YY_/ |
f7ab6a50 PE |
310 | ' <po/Makevars >runtime-po/Makevars |
311 | ||
312 | # Copy identical files from po to runtime-po. | |
30757c8c | 313 | (cd po && cp -p Makefile.in.in *-quot *.header *.sed *.sin ../runtime-po) |
1f65350a PE |
314 | |
315 | # if src/parse-gram.[ch] are out of date, rebuild them. | |
b9c85d5c | 316 | parse_gram_y=`find src/parse-gram.y \ |
1f65350a | 317 | '(' -newer src/parse-gram.c -o -newer src/parse-gram.h ')' \ |
b9c85d5c | 318 | -print` || exit |
1f65350a PE |
319 | case $parse_gram_y in |
320 | ?*) | |
321 | echo "$0: warning: bootstrapping with old src/parse-gram.[ch] files." | |
322 | ||
323 | echo "$0: touch -c src/parse-gram.[ch] ... " | |
324 | touch -c src/parse-gram.[ch] || exit | |
325 | ||
326 | echo "$0: ./configure --disable-nls ..." | |
327 | ./configure --disable-nls || exit | |
328 | ||
329 | echo "$0: (cd lib && make) ..." | |
330 | (cd lib && make) || exit | |
331 | ||
332 | echo "$0: (cd src && make) ..." | |
333 | (cd src && make) || exit | |
334 | ||
335 | echo "$0: rm -f src/parse-gram.c src/parse-gram.h ..." | |
336 | rm -f src/parse-gram.c src/parse-gram.h || exit | |
337 | ||
338 | echo "$0: (cd src && make parse-gram.c parse-gram.h) ..." | |
339 | (cd src && make parse-gram.c parse-gram.h) || exit | |
340 | ||
341 | echo "$0: make distclean ..." | |
342 | make distclean || exit;; | |
343 | esac | |
344 | ||
345 | echo "$0: done. Now you can run './configure'." |