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 3, 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 and Sergey Poznyakoff.
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 --paxutils-srcdir=DIRNAME Specify the local directory where paxutils
39 sources reside. Use this if you already
40 have paxutils sources on your machine, and
41 do not want to waste your bandwidth dowloading
43 --gnulib-srcdir=DIRNAME Specify the local directory where gnulib
44 sources reside. Use this if you already
45 have gnulib sources on your machine, and
46 do not want to waste your bandwidth dowloading
48 --copy Copy files instead of creating symbolic links.
49 --force Attempt to bootstrap even if the sources seem
50 not to have been checked out.
51 --skip-po Do not download po files.
52 --update-po[=LANG] Update po file(s) and exit.
53 --cvs-user=USERNAME Set the CVS username to be used when accessing
54 the gnulib repository.
56 If the file bootstrap.conf exists in the current working directory, its
57 contents are read as shell variables to configure the bootstrap.
59 Local defaults can be provided by placing the file \`.bootstrap' in the
60 current working directory. The file is read after bootstrap.conf, comments
61 and empty lines are removed, shell variables expanded and the result is
62 prepended to the command line options.
64 Running without arguments will suffice in most cases.
70 echo "$0: getting $1 files..."
72 case ${CVS_AUTH-pserver} in
74 CVS_PREFIX
=':pserver:anonymous@';;
76 CVS_PREFIX
="$CVS_USER${CVS_USER+@}";;
78 echo "$0: $CVS_AUTH: Unknown CVS access method" >&2
83 '') CVS_RSH
=ssh; export CVS_RSH
;;
86 trap "cleanup $1" 1 2 13 15
88 cvs
-z3 -q -d ${CVS_PREFIX}cvs.savannah.gnu.org
:/cvsroot
/"$1" co
$1 ||
103 # List of gnulib modules needed.
106 # Any gnulib files needed that are not in modules.
109 # Translation Project URL, for the registry of all projects
110 # and for the translation-team master directory.
112 echo "http://translationproject.org/domain/$1.html"
115 extract_package_name
='
126 y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/
131 package
=`sed -n "$extract_package_name" configure.ac` ||
exit
133 # Extra files from gnulib, which override files from other sources.
135 build-aux/announce-gen
139 build-aux/texinfo.tex
141 build-aux/config.guess
146 # Other locale categories that need message catalogs.
147 EXTRA_LOCALE_CATEGORIES
=
149 # Additional xgettext options to use. Use "\\\newline" to break lines.
150 XGETTEXT_OPTIONS
='\\\
151 --flag=_:1:pass-c-format\\\
152 --flag=N_:1:pass-c-format\\\
153 --flag=error:3:c-format --flag=error_at_line:5:c-format\\\
156 # Files we don't want to import.
159 # File that should exist in the top directory of a checked out hierarchy,
160 # but not in a distribution tarball.
161 CVS_only_file
=README-cvs
163 # Whether to use copies instead of symlinks.
166 # Override the default configuration, if necessary.
167 test -r bootstrap.conf
&& . .
/bootstrap.conf
169 # Read local configuration file
170 if [ -r .bootstrap
]; then
171 echo "$0: Reading configuration file .bootstrap"
172 eval set -- "`sed 's/#.*$//;/^$/d' .bootstrap | tr '\n' ' '` $*"
175 # Translate configuration into internal form.
186 PAXUTILS_SRCDIR
=`expr "$option" : '--paxutils-srcdir=\(.*\)'`;;
188 GNULIB_SRCDIR
=`expr "$option" : '--gnulib-srcdir=\(.*\)'`;;
190 CVS_USER
=`expr "$option" : '--cvs-user=\(.*\)'`;;
191 --skip-po |
--no-po) # --no-po is for compatibility with 'tar' tradition.
194 DOWNLOAD_PO
=`expr "$option" : '--update-po=\(.*\)'`;;
202 echo >&2 "$0: $option: unknown option"
207 if test -n "$CVS_only_file" && test ! -r "$CVS_only_file"; then
208 echo "$0: Bootstrapping from a non-checked-out distribution is risky." >&2
212 echo "$0: Bootstrapping CVS $package..."
221 case $WGET_COMMAND in
223 echo "$0: wget not available; skipping translations";;
226 baseurl
=`expr "$url" : '\(.*\)/.*'`
227 echo "$0: getting translations into $subdir for $domain..." &&
229 '') (cd $subdir && rm -f dummy
`ls | sed -n '/\.gmo$/p; /\.po/p'`);;
232 $WGET_COMMAND -O "$subdir/$domain.html" "$url" &&
234 sed -n 's|.*href="\(.*\)/\([^/][^/]*\)/'"$domain"'-\([^/"]*\)\.[^."]*\.po".*|\2:\3:\1|p' <"$subdir/$domain.html" |
235 sort -t: -k 1,1 -k 2,2n
-k2,2 -k3,3n
-k3,3 -k4,4n
-k4,4 -k5,5n
-k5.5 |
237 { if (lang && $1 != lang) print lang, ver, $3 }
238 { lang = $1; ver = $2 }
239 END { if (lang) print lang, ver, $3 }
240 ' |
awk -v domain
="$domain" -v baseurl
="$baseurl" -v subdir
="$subdir" \
241 -v po_file
="$po_file" '
244 if (po_file && po_file != (lang ".po")) next
246 printf "{ $WGET_COMMAND -O %s/%s.po %s/%s/%s/%s-%s.%s.po &&\n", subdir, lang, baseurl, $3, lang, domain, ver, lang
247 printf " msgfmt -c -o /dev/null %s/%s.po || {\n", subdir, lang
248 printf " echo >&2 '\'"$0"': omitting translation for %s'\''\n", lang
249 printf " rm -f %s/%s.po; }; } &&\n", subdir, lang
252 ' | WGET_COMMAND
="$WGET_COMMAND" sh
255 ls "$subdir"/*.po
2>/dev
/null |
256 sed 's|.*/||; s|\.po$||' >"$subdir/LINGUAS" &&
257 rm -f "$subdir/$domain.html"
260 case `wget --help` in
262 WGET_COMMAND
='wget -nv --no-cache';;
264 WGET_COMMAND
='wget -nv --cache=off';;
266 WGET_COMMAND
='wget -nv';;
275 get_translations po
$package ||
exit
278 get_translations po
$package
282 get_translations po
$package "$DOWNLOAD_PO"
286 get_translations po
$package "${DOWNLOAD_PO}.po"
290 # Get paxutils files.
292 case ${PAXUTILS_SRCDIR--} in
294 PAXUTILS_SRCDIR
=paxutils
297 if [ -r $PAXUTILS_SRCDIR/gnulib.modules
]; then
299 (echo "$gnulib_modules"; grep '^[^#]' $PAXUTILS_SRCDIR/gnulib.modules) |
306 test -n "$ignore_file_list" && rm -f $ignore_file_list
309 trap 'cleanup_ifl' 1 2 3 15
311 # ignorefile DIR FILE
312 # add FILE to the temporary ignorelist in the directory DIR
316 if `echo $ignore_list | grep -qv $file`; then
317 ignore_file_list
="$ignore_file_list
322 # copy_files srcdir dstdir
324 for file in `cat $1/DISTFILES`
329 dst
=`echo $file | sed 's^.*/^^'`
330 if [ $# -eq 3 ]; then
336 echo "$0: Copying file $1/$file to $2/$dst"
337 cp -p $1/$file $2/$dst
344 case ${GNULIB_SRCDIR--} in
350 gnulib_tool
=$GNULIB_SRCDIR/gnulib-tool
351 <$gnulib_tool ||
exit
356 test -d "$d" || mkdir
-p -- "$d"
361 src
=$GNULIB_SRCDIR/$1
367 test ! -h "$dst" ||
{
368 echo "$0: rm -f $dst" &&
373 cmp -s "$src" "$dst" ||
{
374 echo "$0: cp -fp $src $dst" &&
375 ensure_dir_exists
$dst &&
380 src_ls
=`ls -diL "$src" 2>/dev/null` && set $src_ls && src_i
=$1 &&
381 dst_ls
=`ls -diL "$dst" 2>/dev/null` && set $dst_ls && dst_i
=$1 &&
382 test "$src_i" = "$dst_i" ||
{
388 *//* |
*/..
/* |
*/.
/* |
/*/*/*/*/*/)
389 echo >&2 "$0: invalid symlink calculation: $src -> $dst"
391 /*/*/*/*/) dot_dots
=..
/..
/..
/;;
392 /*/*/*/) dot_dots
=..
/..
/;;
393 /*/*/) dot_dots
=..
/;;
397 echo "$0: ln -fs $dot_dots$src $dst" &&
398 ensure_dir_exists
$dst &&
399 ln -fs "$dot_dots$src" "$dst"
405 cp_mark_as_generated
()
410 if cmp -s "$cp_src" "$GNULIB_SRCDIR/$cp_dst"; then
411 symlink_to_gnulib
"$cp_dst"
414 *.
[ch
]) c1
='/* '; c2
=' */';;
415 *.texi
) c1
='@c '; c2
= ;;
416 *.
m4|
*/Make
*|Make
*) c1
='# ' ; c2
= ;;
420 if test -z "$c1"; then
421 cmp -s "$cp_src" "$cp_dst" ||
{
422 echo "$0: cp -f $cp_src $cp_dst" &&
423 cp -f "$cp_src" "$cp_dst"
426 # Copy the file first to get proper permissions if it
427 # doesn't already exist. Then overwrite the copy.
428 cp "$cp_src" "$cp_dst-t" &&
430 echo "$c1-*- buffer-read-only: t -*- vi: set ro:$c2" &&
431 echo "${c1}DO NOT EDIT! GENERATED AUTOMATICALLY!$c2" &&
434 if cmp -s "$cp_dst-t" "$cp_dst"; then
437 echo "$0: cp $cp_src $cp_dst # with edits" &&
438 mv -f "$cp_dst-t" "$cp_dst"
444 version_controlled_file
() {
449 grep -F "/$file/" $dir/CVS
/Entries
2>/dev
/null |
450 grep '^/[^/]*/[0-9]' > /dev
/null
&& found
=yes
451 elif test -d .git
; then
452 git-rm
-n "$dir/$file" > /dev
/null
2>&1 && found
=yes
454 echo "$0: no version control for $dir/$file?" >&2
460 for dir
in .
`(cd $1 && find * -type d -print)`; do
463 for file in `ls $1/$dir`; do
464 test -d $1/$dir/$file && continue
465 for excluded_file
in $excluded_files; do
466 test "$dir/$file" = "$excluded_file" && continue 2
468 if test $file = Makefile.am
; then
469 copied
=$copied${sep}gnulib.mk
; sep
=$nl
470 remove_intl
='/^[^#].*\/intl/s/^/#/;'"s,/$bt,,g"
471 sed "$remove_intl" $1/$dir/$file |
cmp -s - $dir/gnulib.mk ||
{
472 echo "$0: Copying $1/$dir/$file to $dir/gnulib.mk ..." &&
473 rm -f $dir/gnulib.mk
&&
474 sed "$remove_intl" $1/$dir/$file >$dir/gnulib.mk
476 elif { test "${2+set}" = set && test -r $2/$dir/$file; } ||
477 version_controlled_file
$dir $file; then
478 echo "$0: $dir/$file overrides $1/$dir/$file"
480 copied
=$copied$sep$file; sep
=$nl
481 if test $file = gettext.
m4; then
482 echo "$0: patching m4/gettext.m4 to remove need for intl/* ..."
485 /^AC_DEFUN(\[AM_INTL_SUBDIR],/,/^]/c\
486 AC_DEFUN([AM_INTL_SUBDIR], [
487 /^AC_DEFUN(\[gt_INTL_SUBDIR_CORE],/,/^]/c\
488 AC_DEFUN([gt_INTL_SUBDIR_CORE], [])
490 AC_DEFUN([gl_LOCK_EARLY], [])
491 ' $1/$dir/$file >$dir/$file
493 cp_mark_as_generated
$1/$dir/$file $dir/$file
498 if test -n "$copied"; then
509 if [ -f $dir/.ignore.$$
]; then
510 tfile
=$dir/.ignore.$$
515 echo "$copied" |
sort -u - $ig |
cmp -s - $ig ||
516 echo "$copied" |
sort -u - $ig $tfile -o $ig
520 if [ "$dir" = "po" ]; then
532 echo "$copied" |
sort -u - $tfile -o $ig
539 # Create boot temporary directories to import from gnulib and gettext.
544 mkdir
$bt $bt2 ||
exit
546 # Import from gnulib.
548 test -d build-aux ||
{
549 echo "$0: mkdir build-aux ..." &&
552 gnulib_tool_options
="\
555 --aux-dir $bt/build-aux\
559 --source-base $bt/lib/\
560 --tests-base $bt/tests\
563 echo "$0: $gnulib_tool $gnulib_tool_options --import ..."
564 $gnulib_tool $gnulib_tool_options --import $gnulib_modules &&
567 for file in $gnulib_files; do
568 symlink_to_gnulib
$file ||
exit
572 # Import from gettext.
574 echo "$0: (cd $bt2; autopoint) ..."
575 cp configure.ac
$bt2 &&
576 (cd $bt2 && autopoint
&& rm configure.ac
) &&
577 slurp
$bt2 $bt ||
exit
579 rm -fr $bt $bt2 ||
exit
581 # Import from paxutils
582 copy_files
${PAXUTILS_SRCDIR}/m4 m4
583 echo "$0: Creating m4/paxutils.m4"
584 (echo "# This file is generated automatically. Please, do not edit."
586 echo "AC_DEFUN([${package}_PAXUTILS],["
587 cat ${PAXUTILS_SRCDIR}/m
4/DISTFILES |
sed '/^#/d;s/\(.*\)\.m4/pu_\1/' |
tr a-z A-Z
588 echo "])") > .
/m
4/paxutils.
m4
589 ignorefile
m4 paxutils.
m4
597 for dir
in doc rmt lib tests
599 copy_files
${PAXUTILS_SRCDIR}/$dir $dir
602 copy_files
${PAXUTILS_SRCDIR}/paxlib lib pax
604 # Reconfigure, getting other files.
607 'aclocal --force -I m4' \
609 'autoheader --force' \
610 'automake --add-missing --copy --force-missing';
612 echo "$0: $command ..."
617 # Get some extra files from gnulib, overriding existing files.
619 for file in $gnulib_extra_files; do
621 */INSTALL
) dst
=INSTALL
;;
624 symlink_to_gnulib
$file $dst ||
exit
628 # Create gettext configuration.
629 echo "$0: Creating po/Makevars from po/Makevars.template ..."
632 /^EXTRA_LOCALE_CATEGORIES *=/s/=.*/= '"$EXTRA_LOCALE_CATEGORIES"'/
633 /^MSGID_BUGS_ADDRESS *=/s/=.*/= bug-'"$package"'@gnu.org/
634 /^XGETTEXT_OPTIONS *=/{
637 '"$XGETTEXT_OPTIONS"' $${end_of_xgettext_options+}
639 ' po
/Makevars.template
>po
/Makevars
641 if test -d runtime-po
; then
642 # Similarly for runtime-po/Makevars, but not quite the same.
643 rm -f runtime-po
/Makevars
645 /^DOMAIN *=.*/s/=.*/= '"$package"'-runtime/
646 /^subdir *=.*/s/=.*/= runtime-po/
647 /^MSGID_BUGS_ADDRESS *=/s/=.*/= bug-'"$package"'@gnu.org/
648 /^XGETTEXT_OPTIONS *=/{
651 '"$XGETTEXT_OPTIONS_RUNTIME"' $${end_of_xgettext_options+}
653 ' <po
/Makevars.template
>runtime-po
/Makevars
655 # Copy identical files from po to runtime-po.
656 (cd po
&& cp -p Makefile.
in.
in *-quot *.header
*.
sed *.sin ..
/runtime-po
)
659 echo "$0: done. Now you can run './configure'."