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