]>
git.saurik.com Git - bison.git/blob - bootstrap
3 # Bootstrap this package from CVS.
5 # Copyright (C) 2003, 2004, 2005, 2006 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 CVS 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 Bootstrap even if the sources didn't come from CVS.
45 --skip-po Do not download po files.
46 --cvs-user=USERNAME Set the CVS username to be used when accessing
47 the gnulib repository.
49 If the file .bootstrap.conf exists in the current working directory, its
50 contents are read as shell variables to configure the bootstrap.
52 Running without arguments will suffice in most cases.
58 # List of gnulib modules needed.
61 # Any gnulib files needed that are not in modules.
64 # Translation Project URL, for the registry of all projects
65 # and for the translation-team master directory.
66 TP_URL
='http://www.iro.umontreal.ca/translation/registry.cgi?domain='
67 TP_PO_URL
='http://www.iro.umontreal.ca/translation/teams/PO/'
69 extract_package_name
='
80 y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/
85 package
=`sed -n "$extract_package_name" configure.ac` || exit
87 # Extra files from gnulib, which override files from other sources.
94 build-aux/config.guess
99 # Other locale categories that need message catalogs.
100 EXTRA_LOCALE_CATEGORIES
=
102 # Additional xgettext options to use. Use "\\\newline" to break lines.
103 XGETTEXT_OPTIONS
='\\\
104 --flag=_:1:pass-c-format\\\
105 --flag=N_:1:pass-c-format\\\
106 --flag=error:3:c-format --flag=error_at_line:5:c-format\\\
109 # Files we don't want to import.
112 # File that should exist with CVS checkout, but not with
113 # the distributed version.
116 # Whether to use copies instead of symlinks.
119 # Override the default configuration, if necessary.
120 test -r bootstrap.conf
&& . .
/bootstrap.conf
122 # Translate configuration into internal form.
133 GNULIB_SRCDIR
=`expr "$option" : '--gnulib-srcdir=\(.*\)'`;;
135 CVS_USER
=`expr "$option" : '--cvs-user=\(.*\)'`;;
143 echo >&2 "$0: $option: unknown option"
148 if test -n "$CVS_only_file" && test ! -r "$CVS_only_file"; then
149 echo "$0: Bootstrapping from a non-CVS distribution is a bit risky." >&2
153 echo "$0: Bootstrapping CVS $package..."
163 case ${GNULIB_SRCDIR--} in
165 if [ ! -d gnulib
]; then
166 echo "$0: getting gnulib files..."
168 case ${CVS_AUTH-pserver} in
170 CVS_PREFIX
=':pserver:anonymous@';;
172 CVS_PREFIX
="$CVS_USER${CVS_USER+@}";;
174 echo "$0: $CVS_AUTH: Unknown CVS access method" >&2
179 '') CVS_RSH
=ssh; export CVS_RSH
;;
182 trap cleanup_gnulib
1 2 13 15
184 cvs
-z3 -q -d ${CVS_PREFIX}cvs.savannah.gnu.org
:/cvsroot
/gnulib co gnulib
||
192 gnulib_tool
=$GNULIB_SRCDIR/gnulib
-tool
193 <$gnulib_tool || exit
201 case $WGET_COMMAND in
203 echo "$0: wget not available; skipping translations";;
205 echo "$0: getting translations into $subdir for $domain..." &&
207 (cd $subdir && rm -f dummy
`ls | sed -n '/\.gmo$/p; /\.po/p'`) &&
208 $WGET_COMMAND -O "$subdir/$domain.html" "$TP_URL$domain" &&
210 sed -n 's|.*"http://[^"]*/translation/teams/PO/\([^/"]*\)/'"$domain"'-\([^/"]*\)\.[^."]*\.po".*|\1.\2|p' <"$subdir/$domain.html" |
211 sort -k 1,1 -k 2,2n
-k2,2 -k3,3n
-k3,3 -k4,4n
-k4,4 -k5,5n
-k5.5
|
213 { if (lang && $1 != lang) print lang, ver }
214 { lang = $1; ver = substr($0, index($0, ".") + 1) }
215 END { if (lang) print lang, ver }
216 ' | awk -v domain
="$domain" -v subdir
="$subdir" '
221 printf "{ $WGET_COMMAND -O %s/%s.po '\'"$TP_PO_URL"'/%s/%s-%s.%s.po'\'' &&\n", subdir, lang, lang, domain, ver, lang
222 printf " msgfmt -c -o /dev/null %s/%s.po || {\n", subdir, lang
223 printf " echo >&2 '\'"$0"': omitting translation for %s'\''\n", lang
224 printf " rm -f %s/%s.po; }; } &&\n", subdir, lang
227 ' | WGET_COMMAND
="$WGET_COMMAND" sh
;;
229 ls "$subdir"/*.po
2>/dev
/null
|
230 sed 's|.*/||; s|\.po$||' >"$subdir/LINGUAS" &&
231 rm -f "$subdir/$domain.html"
236 case `wget --help` in
238 WGET_COMMAND
='wget -nv --no-cache';;
240 WGET_COMMAND
='wget -nv --cache=off';;
242 WGET_COMMAND
='wget -nv';;
247 get_translations po
$package || exit
249 if test -d runtime
-po; then
250 get_translations runtime
-po $package-runtime || exit
256 src
=$GNULIB_SRCDIR/$1
262 test ! -h "$dst" || {
263 echo "$0: rm -f $dst" &&
268 cmp -s "$src" "$dst" || {
269 echo "$0: cp -fp $src $dst" &&
274 src_ls
=`ls -diL "$src" 2>/dev/null` && set $src_ls && src_i
=$1 &&
275 dst_ls
=`ls -diL "$dst" 2>/dev/null` && set $dst_ls && dst_i
=$1 &&
276 test "$src_i" = "$dst_i" || {
282 *//* | */..
/* | */.
/* | /*/*/*/*/*/)
283 echo >&2 "$0: invalid symlink calculation: $src -> $dst"
285 /*/*/*/*/) dot_dots
=..
/..
/..
/;;
286 /*/*/*/) dot_dots
=..
/..
/;;
287 /*/*/) dot_dots
=..
/;;
291 echo "$0: ln -fs $dot_dots$src $dst" &&
292 ln -fs "$dot_dots$src" "$dst"
298 cp_mark_as_generated
()
303 if cmp -s "$cp_src" "$GNULIB_SRCDIR/$cp_dst"; then
304 symlink_to_gnulib
"$cp_dst"
307 *.
[ch
]) c1
='/* '; c2
=' */';;
308 *.texi
) c1
='@c '; c2
= ;;
309 *.
m4|*/Make
*|Make
*) c1
='# ' ; c2
= ;;
313 if test -z "$c1"; then
314 cmp -s "$cp_src" "$cp_dst" || {
315 echo "$0: cp -f $cp_src $cp_dst" &&
316 cp -f "$cp_src" "$cp_dst"
319 # Copy the file first to get proper permissions if it
320 # doesn't already exist. Then overwrite the copy.
321 cp "$cp_src" "$cp_dst-t" &&
323 echo "$c1-*- buffer-read-only: t -*- vi: set ro:$c2" &&
324 echo "${c1}DO NOT EDIT! GENERATED AUTOMATICALLY!$c2" &&
327 if cmp -s "$cp_dst-t" "$cp_dst"; then
330 echo "$0: cp $cp_src $cp_dst # with edits" &&
331 mv -f "$cp_dst-t" "$cp_dst"
338 for dir
in .
`(cd $1 && find * -type d -print)`; do
341 for file in `ls $1/$dir`; do
342 test -d $1/$dir/$file && continue
343 for excluded_file
in $excluded_files; do
344 test "$dir/$file" = "$excluded_file" && continue 2
346 if test $file = Makefile.am
; then
347 copied
=$copied${sep}gnulib.mk
; sep
=$nl
348 remove_intl
='/^[^#].*\/intl/s/^/#/'
349 sed "$remove_intl" $1/$dir/$file | cmp -s - $dir/gnulib.mk
|| {
350 echo "$0: Copying $1/$dir/$file to $dir/gnulib.mk ..." &&
351 rm -f $dir/gnulib.mk
&&
352 sed "$remove_intl" $1/$dir/$file >$dir/gnulib.mk
354 elif { test "${2+set}" = set && test -r $2/$dir/$file; } ||
355 grep -F "/$file/" $dir/CVS
/Entries
2>/dev
/null
|
356 grep -q '^/[^/]*/[0-9]'; then
357 echo "$0: $dir/$file overrides $1/$dir/$file"
359 copied
=$copied$sep$file; sep
=$nl
360 if test $file = gettext.
m4; then
361 echo "$0: patching m4/gettext.m4 to remove need for intl/* ..."
364 /^AC_DEFUN(\[AM_INTL_SUBDIR],/,/^]/c\
365 AC_DEFUN([AM_INTL_SUBDIR], [
366 /^AC_DEFUN(\[gt_INTL_SUBDIR_CORE],/,/^]/c\
367 AC_DEFUN([gt_INTL_SUBDIR_CORE], [])
369 AC_DEFUN([gl_LOCK_EARLY], [])
370 ' $1/$dir/$file >$dir/$file
372 cp_mark_as_generated
$1/$dir/$file $dir/$file
378 if test -n "$copied" && test -f $ig; then
379 echo "$copied" | sort -u - $ig | cmp -s - $ig ||
380 echo "$copied" | sort -u - $ig -o $ig || exit
386 # Create boot temporary directories to import from gnulib and gettext.
391 mkdir $bt $bt2 || exit
393 # Import from gnulib.
395 gnulib_tool_options
="\
398 --aux-dir $bt/build-aux\
402 --source-base $bt/lib/\
403 --tests-base $bt/tests\
406 echo "$0: $gnulib_tool $gnulib_tool_options --import ..."
407 $gnulib_tool $gnulib_tool_options --import $gnulib_modules &&
410 for file in $gnulib_files; do
411 symlink_to_gnulib
$file || exit
415 # Import from gettext.
417 echo "$0: (cd $bt2; autopoint) ..."
418 cp configure.ac
$bt2 &&
419 (cd $bt2 && autopoint
&& rm configure.ac
) &&
420 slurp
$bt2 $bt || exit
422 rm -fr $bt $bt2 || exit
425 # Reconfigure, getting other files.
428 'aclocal --force -I m4' \
430 'autoheader --force' \
431 'automake --add-missing --copy --force-missing';
433 echo "$0: $command ..."
438 # Get some extra files from gnulib, overriding existing files.
440 for file in $gnulib_extra_files; do
442 */INSTALL
) dst
=INSTALL
;;
445 symlink_to_gnulib
$file $dst || exit
449 # Create gettext configuration.
450 echo "$0: Creating po/Makevars from po/Makevars.template ..."
453 /^EXTRA_LOCALE_CATEGORIES *=/s/=.*/= '"$EXTRA_LOCALE_CATEGORIES"'/
454 /^MSGID_BUGS_ADDRESS *=/s/=.*/= bug-'"$package"'@gnu.org/
455 /^XGETTEXT_OPTIONS *=/{
458 '"$XGETTEXT_OPTIONS"' $${end_of_xgettext_options+}
460 ' po
/Makevars.template
>po
/Makevars
462 if test -d runtime
-po; then
463 # Similarly for runtime-po/Makevars, but not quite the same.
464 rm -f runtime
-po/Makevars
466 /^DOMAIN *=.*/s/=.*/= '"$package"'-runtime/
467 /^subdir *=.*/s/=.*/= runtime-po/
468 /^MSGID_BUGS_ADDRESS *=/s/=.*/= bug-'"$package"'@gnu.org/
469 /^XGETTEXT_OPTIONS *=/{
472 '"$XGETTEXT_OPTIONS_RUNTIME"' $${end_of_xgettext_options+}
474 ' <po
/Makevars.template
>runtime
-po/Makevars
476 # Copy identical files from po to runtime-po.
477 (cd po
&& cp -p Makefile.
in.
in *-quot *.header
*.
sed *.sin ..
/runtime
-po)
480 echo "$0: done. Now you can run './configure'."