]> git.saurik.com Git - bison.git/blame - bootstrap
Get files from the gnulib and po repositories, instead of relying
[bison.git] / bootstrap
CommitLineData
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
24package=bison
25
26# Parse options.
27
28for option
29do
30 case $option in
31 --help)
32 echo "$0: usage: $0 [--gnulib-srcdir=DIR] [--cvs-user=USERNAME] [--skip-po]"
33 exit;;
34 --gnulib-srcdir=*)
35 GNULIB_SRCDIR=`expr "$1" : '--gnulib-srcdir=\(.*\)'`;;
36 --cvs-user=*)
37 CVS_USER=`expr "$1" : '--cvs-user=\(.*\)'`;;
38 --skip-po)
39 SKIP_PO=t;;
40 *)
41 echo >&2 "$0: $option: unknown option"
42 exit 1;;
43 esac
44done
45
46echo "$0: Bootstrapping CVS $package..."
47
48build_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
57case ${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
84esac
85
86<$GNULIB_SRCDIR/gnulib-tool || exit
87
88gnulib_modules='
89alloca
90argmatch
91dirname
92error
93getopt
94hard-locale
95hash
96malloc
97mbswidth
98obstack
99quote
100quotearg
101stdbool
102stpcpy
103xalloc
104xstrndup
105'
106
107previous_gnulib_modules=
108while [ "$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 `
116done
117
118gnulib_files=`
119 (for gnulib_module in $gnulib_modules; do
120 $GNULIB_SRCDIR/gnulib-tool --extract-filelist $gnulib_module
121 done) | sort -u
122`
123
124gnulib_dirs=`echo "$gnulib_files" | sed 's,/[^/]*$,,' | sort -u`
125mkdir -p $gnulib_dirs || exit
126
127for 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
137done
138
139
140# Get translations.
141
142case $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;;
151esac
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
169echo "$0: autoreconf --verbose --install --force ..."
170autoreconf --verbose --install --force || exit
171
172# We don't need intl, so remove it.
173echo "$0: rm -fr intl ..."
174rm -fr intl || exit
175
176
177# Patch what appears to be a bug in gettext 0.14.1;
178# remove this once the bug is fixed.
179grep @top_builddir@ po/Makefile.in.in >/dev/null || {
180 echo "$0: prepending 'top_builddir=@top_builddir@' to po/Makefile.in.in ... "
181 old_contents=$(cat po/Makefile.in.in) || exit
182 cat >po/Makefile.in.in <<EOF
183top_builddir=@top_builddir@
184$old_contents
185EOF
186}
187
188# Put bug-reporting address into po/Makevars.
189echo "$0: sed '/^MSGID_BUGS_ADDRESS *=/s/=.*/= bug-bison@gnu.org/' po/Makevars.template >po/Makevars ..."
190sed '/^MSGID_BUGS_ADDRESS *=/s/=.*/= bug-bison@gnu.org/' po/Makevars.template >po/Makevars
191
192
193# if src/parse-gram.[ch] are out of date, rebuild them.
194parse_gram_y=$(find src/parse-gram.y \
195 '(' -newer src/parse-gram.c -o -newer src/parse-gram.h ')' \
196 -print) || exit
197case $parse_gram_y in
198?*)
199 echo "$0: warning: bootstrapping with old src/parse-gram.[ch] files."
200
201 echo "$0: touch -c src/parse-gram.[ch] ... "
202 touch -c src/parse-gram.[ch] || exit
203
204 echo "$0: ./configure --disable-nls ..."
205 ./configure --disable-nls || exit
206
207 echo "$0: (cd lib && make) ..."
208 (cd lib && make) || exit
209
210 echo "$0: (cd src && make) ..."
211 (cd src && make) || exit
212
213 echo "$0: rm -f src/parse-gram.c src/parse-gram.h ..."
214 rm -f src/parse-gram.c src/parse-gram.h || exit
215
216 echo "$0: (cd src && make parse-gram.c parse-gram.h) ..."
217 (cd src && make parse-gram.c parse-gram.h) || exit
218
219 echo "$0: make distclean ..."
220 make distclean || exit;;
221esac
222
223echo "$0: done. Now you can run './configure'."