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