]>
Commit | Line | Data |
---|---|---|
01c56de4 AD |
1 | #! /bin/sh |
2 | ||
1f65350a | 3 | # Bootstrap this package from CVS. |
01c56de4 | 4 | |
727e8b0b | 5 | # Copyright (C) 2003, 2004, 2005 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. | |
28 | LC_ALL=C | |
29 | export LC_ALL | |
30 | ||
1f65350a PE |
31 | # Parse options. |
32 | ||
33 | for option | |
34 | do | |
35 | case $option in | |
36 | --help) | |
37 | echo "$0: usage: $0 [--gnulib-srcdir=DIR] [--cvs-user=USERNAME] [--skip-po]" | |
38 | exit;; | |
39 | --gnulib-srcdir=*) | |
e23d0dd7 | 40 | GNULIB_SRCDIR=`expr "$option" : '--gnulib-srcdir=\(.*\)'`;; |
1f65350a | 41 | --cvs-user=*) |
e23d0dd7 | 42 | CVS_USER=`expr "$option" : '--cvs-user=\(.*\)'`;; |
1f65350a PE |
43 | --skip-po) |
44 | SKIP_PO=t;; | |
45 | *) | |
46 | echo >&2 "$0: $option: unknown option" | |
47 | exit 1;; | |
48 | esac | |
49 | done | |
50 | ||
51 | echo "$0: Bootstrapping CVS $package..." | |
52 | ||
53 | build_cvs_prefix() { | |
54 | CVS_PREFIX=:${1}: | |
55 | if [ "${2}" != - ]; then | |
56 | CVS_PREFIX=${CVS_PREFIX}${2}@ | |
57 | fi | |
58 | } | |
59 | ||
60 | # Get gnulib files. | |
61 | ||
62 | case ${GNULIB_SRCDIR--} in | |
63 | -) | |
64 | if [ ! -d gnulib ]; then | |
65 | echo "$0: getting gnulib files..." | |
66 | ||
67 | trap exit 1 2 13 15 | |
68 | trap 'rm -fr gnulib; exit 1' 0 | |
69 | ||
70 | case ${CVS_AUTH-anoncvs} in | |
71 | anoncvs) | |
72 | CVS_PREFIX='anoncvs@';; | |
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 | ||
84 | cvs -z3 -q -d ${CVS_PREFIX}subversions.gnu.org:/cvsroot/gnulib co gnulib || exit | |
85 | ||
727e8b0b | 86 | trap - 0 |
1f65350a PE |
87 | fi |
88 | GNULIB_SRCDIR=gnulib | |
89 | esac | |
90 | ||
91 | <$GNULIB_SRCDIR/gnulib-tool || exit | |
92 | ||
93 | gnulib_modules=' | |
94 | alloca | |
95 | argmatch | |
96 | dirname | |
97 | error | |
42e826a4 | 98 | extensions |
1f65350a PE |
99 | getopt |
100 | hard-locale | |
101 | hash | |
102 | malloc | |
103 | mbswidth | |
104 | obstack | |
105 | quote | |
106 | quotearg | |
107 | stdbool | |
3ea5f0ec | 108 | stdio-safer |
1f65350a | 109 | stpcpy |
3ea5f0ec | 110 | unistd-safer |
1f65350a | 111 | xalloc |
a9f027b9 | 112 | xalloc-die |
1f65350a PE |
113 | xstrndup |
114 | ' | |
115 | ||
116 | previous_gnulib_modules= | |
117 | while [ "$gnulib_modules" != "$previous_gnulib_modules" ]; do | |
118 | previous_gnulib_modules=$gnulib_modules | |
119 | gnulib_modules=` | |
120 | (echo "$gnulib_modules" | |
121 | for gnulib_module in $gnulib_modules; do | |
122 | $GNULIB_SRCDIR/gnulib-tool --extract-dependencies $gnulib_module | |
123 | done) | sort -u | |
124 | ` | |
125 | done | |
126 | ||
127 | gnulib_files=` | |
128 | (for gnulib_module in $gnulib_modules; do | |
129 | $GNULIB_SRCDIR/gnulib-tool --extract-filelist $gnulib_module | |
130 | done) | sort -u | |
131 | ` | |
132 | ||
133 | gnulib_dirs=`echo "$gnulib_files" | sed 's,/[^/]*$,,' | sort -u` | |
134 | mkdir -p $gnulib_dirs || exit | |
135 | ||
136 | for gnulib_file in $gnulib_files; do | |
137 | dest=$gnulib_file | |
138 | ||
139 | case $gnulib_file in | |
140 | m4/onceonly_2_57.m4) dest=m4/onceonly.m4;; | |
a9f027b9 PE |
141 | # These will be overwritten by autopoint, which still uses |
142 | # old jm_.* macro names, so we have to keep both copies. | |
143 | # m4/gettext.m4 isn't mentioned here, since it's patched below. | |
144 | m4/glibc21.m4 | m4/inttypes_h.m4 | m4/lib-ld.m4 | \ | |
145 | m4/lib-prefix.m4 | m4/po.m4 | m4/stdint_h.m4 | m4/uintmax_t.m4 | \ | |
146 | m4/ulonglong.m4) | |
147 | dest=`expr $gnulib_file : '\(.*\).m4'`_gl.m4;; | |
1f65350a PE |
148 | esac |
149 | ||
150 | rm -f $dest && | |
151 | echo "$0: Copying file $GNULIB_SRCDIR/$gnulib_file" && | |
152 | cp -p $GNULIB_SRCDIR/$gnulib_file $dest || exit | |
153 | done | |
154 | ||
a9f027b9 PE |
155 | echo "$0: patching m4/gettext.m4 so that AM_INTL_SUBDIR is empty ..." |
156 | sed ' | |
157 | /^AC_DEFUN(\[AM_INTL_SUBDIR],/,/^]/c\ | |
158 | AC_DEFUN([AM_INTL_SUBDIR], []) | |
159 | ' m4/gettext.m4 >m4/gettext_gl.m4 || exit | |
160 | ||
1f65350a PE |
161 | |
162 | # Get translations. | |
163 | ||
164 | case $SKIP_PO in | |
165 | '') | |
6712933e | 166 | echo "$0: getting translations into po (please ignore the robots.txt ERROR 404)..." |
1f65350a PE |
167 | (cd po && |
168 | rm -f dummy `ls | sed -n '/\.gmo$/p; /\.po/p'` && | |
169 | wget -nv -nd -r -l 1 -A .po -C off \ | |
ff498c4a | 170 | http://www.iro.umontreal.ca/translation/maint/$package/ && |
1f65350a PE |
171 | ls *.po | sed 's/\.po$//' >LINGUAS |
172 | ) || exit;; | |
173 | esac | |
174 | ||
175 | ||
176 | # Generate autoconf and automake snippets. | |
177 | ||
178 | (echo '# This file is generated automatically by "bootstrap".' && | |
179 | echo 'AC_DEFUN([GNULIB_AUTOCONF_SNIPPET],[' && | |
180 | $GNULIB_SRCDIR/gnulib-tool --extract-autoconf-snippet $gnulib_modules && | |
181 | echo '])' | |
182 | ) >m4/gnulib.m4 || exit | |
183 | ||
184 | (echo '# This file is generated automatically by "bootstrap".' && | |
185 | $GNULIB_SRCDIR/gnulib-tool --extract-automake-snippet $gnulib_modules | |
186 | ) >lib/gnulib.mk || exit | |
187 | ||
188 | ||
189 | # Reconfigure, getting other files. | |
190 | ||
191 | echo "$0: autoreconf --verbose --install --force ..." | |
192 | autoreconf --verbose --install --force || exit | |
193 | ||
e23d0dd7 | 194 | |
1f65350a | 195 | # We don't need intl, so remove it. |
e23d0dd7 PE |
196 | # Remove aclocal.m4 too, so that it gets rebuilt. |
197 | intl_files_to_remove=' | |
198 | aclocal.m4 | |
199 | intl | |
200 | m4/codeset.m4 | |
a9f027b9 | 201 | m4/gettext.m4 |
3ea5f0ec | 202 | m4/glibc2.m4 |
e23d0dd7 PE |
203 | m4/glibc21.m4 |
204 | m4/intdiv0.m4 | |
205 | m4/intmax.m4 | |
206 | m4/inttypes_h.m4 | |
207 | m4/inttypes.m4 | |
208 | m4/inttypes-pri.m4 | |
209 | m4/isc-posix.m4 | |
210 | m4/lcmessage.m4 | |
a9f027b9 PE |
211 | m4/lib-ld.m4 |
212 | m4/lib-prefix.m4 | |
e23d0dd7 PE |
213 | m4/longdouble.m4 |
214 | m4/longlong.m4 | |
a9f027b9 | 215 | m4/po.m4 |
e23d0dd7 PE |
216 | m4/printf-posix.m4 |
217 | m4/signed.m4 | |
218 | m4/size_max.m4 | |
219 | m4/stdint_h.m4 | |
220 | m4/uintmax_t.m4 | |
221 | m4/ulonglong.m4 | |
222 | m4/wchar_t.m4 | |
223 | m4/wint_t.m4 | |
224 | m4/xsize.m4 | |
225 | ' | |
226 | echo $0: rm -fr $intl_files_to_remove ... | |
227 | rm -fr $intl_files_to_remove || exit | |
228 | ||
1f65350a PE |
229 | # Patch what appears to be a bug in gettext 0.14.1; |
230 | # remove this once the bug is fixed. | |
231 | grep @top_builddir@ po/Makefile.in.in >/dev/null || { | |
232 | echo "$0: prepending 'top_builddir=@top_builddir@' to po/Makefile.in.in ... " | |
b9c85d5c | 233 | old_contents=`cat po/Makefile.in.in` || exit |
1f65350a PE |
234 | cat >po/Makefile.in.in <<EOF |
235 | top_builddir=@top_builddir@ | |
236 | $old_contents | |
237 | EOF | |
238 | } | |
239 | ||
240 | # Put bug-reporting address into po/Makevars. | |
241 | echo "$0: sed '/^MSGID_BUGS_ADDRESS *=/s/=.*/= bug-bison@gnu.org/' po/Makevars.template >po/Makevars ..." | |
242 | sed '/^MSGID_BUGS_ADDRESS *=/s/=.*/= bug-bison@gnu.org/' po/Makevars.template >po/Makevars | |
243 | ||
244 | ||
245 | # if src/parse-gram.[ch] are out of date, rebuild them. | |
b9c85d5c | 246 | parse_gram_y=`find src/parse-gram.y \ |
1f65350a | 247 | '(' -newer src/parse-gram.c -o -newer src/parse-gram.h ')' \ |
b9c85d5c | 248 | -print` || exit |
1f65350a PE |
249 | case $parse_gram_y in |
250 | ?*) | |
251 | echo "$0: warning: bootstrapping with old src/parse-gram.[ch] files." | |
252 | ||
253 | echo "$0: touch -c src/parse-gram.[ch] ... " | |
254 | touch -c src/parse-gram.[ch] || exit | |
255 | ||
256 | echo "$0: ./configure --disable-nls ..." | |
257 | ./configure --disable-nls || exit | |
258 | ||
259 | echo "$0: (cd lib && make) ..." | |
260 | (cd lib && make) || exit | |
261 | ||
262 | echo "$0: (cd src && make) ..." | |
263 | (cd src && make) || exit | |
264 | ||
265 | echo "$0: rm -f src/parse-gram.c src/parse-gram.h ..." | |
266 | rm -f src/parse-gram.c src/parse-gram.h || exit | |
267 | ||
268 | echo "$0: (cd src && make parse-gram.c parse-gram.h) ..." | |
269 | (cd src && make parse-gram.c parse-gram.h) || exit | |
270 | ||
271 | echo "$0: make distclean ..." | |
272 | make distclean || exit;; | |
273 | esac | |
274 | ||
275 | echo "$0: done. Now you can run './configure'." |