]>
git.saurik.com Git - bison.git/blob - bootstrap
3 # Bootstrap this package from CVS.
5 # Copyright (C) 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
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)
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.
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., 51 Franklin Street, Fifth Floor, Boston, MA
22 # Written by Paul Eggert.
27 # Ensure file names are sorted consistently across platforms.
28 # Also, ensure diagnostics are in English, e.g., "wget --help" below.
35 Bootstrap this package from the checked-out sources.
38 --gnulib-srcdir=DIRNAME Specify the local directory where gnulib
39 sources reside. Use this if you already
40 have gnulib sources on your machine, and
41 do not want to waste your bandwidth dowloading
43 --copy Copy files instead of creating symbolic links.
44 --force Attempt to bootstrap even if the sources seem
45 not to have been checked out.
46 --skip-po Do not download po files.
47 --cvs-user=USERNAME Set the CVS username to be used when accessing
48 the gnulib repository.
50 If the file .bootstrap.conf exists in the current working directory, its
51 contents are read as shell variables to configure the bootstrap.
53 Running without arguments will suffice in most cases.
59 # List of gnulib modules needed.
62 # Any gnulib files needed that are not in modules.
65 # Translation Project URL, for the registry of all projects
66 # and for the translation-team master directory.
67 TP_URL
='http://www.iro.umontreal.ca/translation/registry.cgi?domain='
68 TP_PO_URL
='http://www.iro.umontreal.ca/translation/teams/PO/'
70 extract_package_name
='
81 y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/
86 package
=`sed -n "$extract_package_name" configure.ac` || exit
88 # Extra files from gnulib, which override files from other sources.
90 build-aux/announce-gen
96 build-aux/config.guess
101 # Other locale categories that need message catalogs.
102 EXTRA_LOCALE_CATEGORIES
=
104 # Additional xgettext options to use. Use "\\\newline" to break lines.
105 XGETTEXT_OPTIONS
='\\\
106 --flag=_:1:pass-c-format\\\
107 --flag=N_:1:pass-c-format\\\
108 --flag=error:3:c-format --flag=error_at_line:5:c-format\\\
111 # Files we don't want to import.
114 # File that should exist in the top directory of a checked out hierarchy,
115 # but not in a distribution tarball.
116 CVS_only_file
=README
-cvs
118 # Whether to use copies instead of symlinks.
121 # Override the default configuration, if necessary.
122 test -r bootstrap.conf
&& . .
/bootstrap.conf
124 # Translate configuration into internal form.
135 GNULIB_SRCDIR
=`expr "$option" : '--gnulib-srcdir=\(.*\)'`;;
137 CVS_USER
=`expr "$option" : '--cvs-user=\(.*\)'`;;
145 echo >&2 "$0: $option: unknown option"
150 if test -n "$CVS_only_file" && test ! -r "$CVS_only_file"; then
151 echo "$0: Bootstrapping from a non-checked-out distribution is risky." >&2
155 echo "$0: Bootstrapping CVS $package..."
165 case ${GNULIB_SRCDIR--} in
167 if [ ! -d gnulib
]; then
168 echo "$0: getting gnulib files..."
170 case ${CVS_AUTH-pserver} in
172 CVS_PREFIX
=':pserver:anonymous@';;
174 CVS_PREFIX
="$CVS_USER${CVS_USER+@}";;
176 echo "$0: $CVS_AUTH: Unknown CVS access method" >&2
181 '') CVS_RSH
=ssh; export CVS_RSH
;;
184 trap cleanup_gnulib
1 2 13 15
186 cvs
-z3 -q -d ${CVS_PREFIX}cvs.savannah.gnu.org
:/cvsroot
/gnulib co gnulib
||
194 gnulib_tool
=$GNULIB_SRCDIR/gnulib
-tool
195 <$gnulib_tool || exit
203 case $WGET_COMMAND in
205 echo "$0: wget not available; skipping translations";;
207 echo "$0: getting translations into $subdir for $domain..." &&
209 (cd $subdir && rm -f dummy
`ls | sed -n '/\.gmo$/p; /\.po/p'`) &&
210 $WGET_COMMAND -O "$subdir/$domain.html" "$TP_URL$domain" &&
212 sed -n 's|.*"http://[^"]*/translation/teams/PO/\([^/"]*\)/'"$domain"'-\([^/"]*\)\.[^."]*\.po".*|\1.\2|p' <"$subdir/$domain.html" |
213 sort -k 1,1 -k 2,2n
-k2,2 -k3,3n
-k3,3 -k4,4n
-k4,4 -k5,5n
-k5.5
|
215 { if (lang && $1 != lang) print lang, ver }
216 { lang = $1; ver = substr($0, index($0, ".") + 1) }
217 END { if (lang) print lang, ver }
218 ' | awk -v domain
="$domain" -v subdir
="$subdir" '
223 printf "{ $WGET_COMMAND -O %s/%s.po '\'"$TP_PO_URL"'/%s/%s-%s.%s.po'\'' &&\n", subdir, lang, lang, domain, ver, lang
224 printf " msgfmt -c -o /dev/null %s/%s.po || {\n", subdir, lang
225 printf " echo >&2 '\'"$0"': omitting translation for %s'\''\n", lang
226 printf " rm -f %s/%s.po; }; } &&\n", subdir, lang
229 ' | WGET_COMMAND
="$WGET_COMMAND" sh
;;
231 ls "$subdir"/*.po
2>/dev
/null
|
232 sed 's|.*/||; s|\.po$||' >"$subdir/LINGUAS" &&
233 rm -f "$subdir/$domain.html"
238 case `wget --help` in
240 WGET_COMMAND
='wget -nv --no-cache';;
242 WGET_COMMAND
='wget -nv --cache=off';;
244 WGET_COMMAND
='wget -nv';;
249 get_translations po
$package || exit
251 if test -d runtime
-po; then
252 get_translations runtime
-po $package-runtime || exit
258 src
=$GNULIB_SRCDIR/$1
264 test ! -h "$dst" || {
265 echo "$0: rm -f $dst" &&
270 cmp -s "$src" "$dst" || {
271 echo "$0: cp -fp $src $dst" &&
276 src_ls
=`ls -diL "$src" 2>/dev/null` && set $src_ls && src_i
=$1 &&
277 dst_ls
=`ls -diL "$dst" 2>/dev/null` && set $dst_ls && dst_i
=$1 &&
278 test "$src_i" = "$dst_i" || {
284 *//* | */..
/* | */.
/* | /*/*/*/*/*/)
285 echo >&2 "$0: invalid symlink calculation: $src -> $dst"
287 /*/*/*/*/) dot_dots
=..
/..
/..
/;;
288 /*/*/*/) dot_dots
=..
/..
/;;
289 /*/*/) dot_dots
=..
/;;
293 echo "$0: ln -fs $dot_dots$src $dst" &&
294 ln -fs "$dot_dots$src" "$dst"
300 cp_mark_as_generated
()
305 if cmp -s "$cp_src" "$GNULIB_SRCDIR/$cp_dst"; then
306 symlink_to_gnulib
"$cp_dst"
309 *.
[ch
]) c1
='/* '; c2
=' */';;
310 *.texi
) c1
='@c '; c2
= ;;
311 *.
m4|*/Make
*|Make
*) c1
='# ' ; c2
= ;;
315 if test -z "$c1"; then
316 cmp -s "$cp_src" "$cp_dst" || {
317 echo "$0: cp -f $cp_src $cp_dst" &&
318 sed 's/\.#bootmp\///g' "$cp_src" > "$cp_dst"
321 # Copy the file first to get proper permissions if it
322 # doesn't already exist. Then overwrite the copy.
323 cp "$cp_src" "$cp_dst-t" &&
325 echo "$c1-*- buffer-read-only: t -*- vi: set ro:$c2" &&
326 echo "${c1}DO NOT EDIT! GENERATED AUTOMATICALLY!$c2" &&
327 sed 's/\.#bootmp\///g' "$cp_src"
329 if cmp -s "$cp_dst-t" "$cp_dst"; then
332 echo "$0: cp $cp_src $cp_dst # with edits" &&
333 mv -f "$cp_dst-t" "$cp_dst"
339 version_controlled_file
() {
344 grep -F "/$file/" $dir/CVS
/Entries
2>/dev
/null
|
345 grep '^/[^/]*/[0-9]' > /dev
/null
&& found
=yes
346 elif test -d .git
; then
347 git
-rm -n "$dir/$file" > /dev
/null
2>&1 && found
=yes
349 echo "$0: no version control for $dir/$file?" >&2
355 for dir
in .
`(cd $1 && find * -type d -print)`; do
358 for file in `ls $1/$dir`; do
359 test -d $1/$dir/$file && continue
360 for excluded_file
in $excluded_files; do
361 test "$dir/$file" = "$excluded_file" && continue 2
363 if test $file = Makefile.am
; then
364 copied
=$copied${sep}gnulib.mk
; sep
=$nl
365 remove_intl
='/^[^#].*\/intl/s/^/#/'
366 sed "$remove_intl" $1/$dir/$file | cmp -s - $dir/gnulib.mk
|| {
367 echo "$0: Copying $1/$dir/$file to $dir/gnulib.mk ..." &&
368 rm -f $dir/gnulib.mk
&&
369 sed "$remove_intl" $1/$dir/$file >$dir/gnulib.mk
371 elif { test "${2+set}" = set && test -r $2/$dir/$file; } ||
372 version_controlled_file
$dir $file; then
373 echo "$0: $dir/$file overrides $1/$dir/$file"
375 copied
=$copied$sep$file; sep
=$nl
376 if test $file = gettext.
m4; then
377 echo "$0: patching m4/gettext.m4 to remove need for intl/* ..."
380 /^AC_DEFUN(\[AM_INTL_SUBDIR],/,/^]/c\
381 AC_DEFUN([AM_INTL_SUBDIR], [
382 /^AC_DEFUN(\[gt_INTL_SUBDIR_CORE],/,/^]/c\
383 AC_DEFUN([gt_INTL_SUBDIR_CORE], [])
385 AC_DEFUN([gl_LOCK_EARLY], [])
386 ' $1/$dir/$file >$dir/$file
388 cp_mark_as_generated
$1/$dir/$file $dir/$file
393 for dot_ig
in .cvsignore .gitignore
; do
395 if test -n "$copied" && test -f $ig; then
396 echo "$copied" | sort -u - $ig | cmp -s - $ig ||
397 echo "$copied" | sort -u - $ig -o $ig || exit
404 # Create boot temporary directories to import from gnulib and gettext.
409 mkdir $bt $bt2 || exit
411 # Import from gnulib.
413 gnulib_tool_options
="\
416 --aux-dir $bt/build-aux\
420 --source-base $bt/lib/\
421 --tests-base $bt/tests\
424 echo "$0: $gnulib_tool $gnulib_tool_options --import ..."
425 $gnulib_tool $gnulib_tool_options --import $gnulib_modules &&
428 for file in $gnulib_files; do
429 symlink_to_gnulib
$file || exit
433 # Import from gettext.
435 echo "$0: (cd $bt2; autopoint) ..."
436 cp configure.ac
$bt2 &&
437 (cd $bt2 && autopoint
&& rm configure.ac
) &&
438 slurp
$bt2 $bt || exit
440 rm -fr $bt $bt2 || exit
443 # Reconfigure, getting other files.
446 'aclocal --force -I m4' \
448 'autoheader --force' \
449 'automake --add-missing --copy --force-missing';
451 echo "$0: $command ..."
456 # Get some extra files from gnulib, overriding existing files.
458 for file in $gnulib_extra_files; do
460 */INSTALL
) dst
=INSTALL
;;
463 symlink_to_gnulib
$file $dst || exit
467 # Create gettext configuration.
468 echo "$0: Creating po/Makevars from po/Makevars.template ..."
471 /^EXTRA_LOCALE_CATEGORIES *=/s/=.*/= '"$EXTRA_LOCALE_CATEGORIES"'/
472 /^MSGID_BUGS_ADDRESS *=/s/=.*/= bug-'"$package"'@gnu.org/
473 /^XGETTEXT_OPTIONS *=/{
476 '"$XGETTEXT_OPTIONS"' $${end_of_xgettext_options+}
478 ' po
/Makevars.template
>po
/Makevars
480 if test -d runtime
-po; then
481 # Likewise for runtime-po/Makevars, except also change a few other parameters.
482 rm -f runtime
-po/Makevars
484 s/^\(DOMAIN\) *=.*/\1 = '"$package"'-runtime/
485 s/^\(subdir\) *=.*/\1 = runtime-po/
486 s/^\(XGETTEXT_OPTIONS\) *=.*/\1 = '"$XGETTEXT_OPTIONS_RUNTIME"'/
487 ' <po
/Makevars
>runtime
-po/Makevars
489 # Copy identical files from po to runtime-po.
490 (cd po
&& cp -p Makefile.
in.
in *-quot *.header
*.
sed *.sin ..
/runtime
-po)
493 echo "$0: done. Now you can run './configure'."