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