]>
Dogcows Code - chaz/tar/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 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 --cvs-user=USERNAME Set the CVS username to be used when accessing
53 the gnulib repository.
55 If the file .bootstrap.conf exists in the current working directory, its
56 contents are read as shell variables to configure the bootstrap.
58 Running without arguments will suffice in most cases.
64 echo "$0: getting $1 files..."
66 case ${CVS_AUTH-pserver} in
68 CVS_PREFIX
=':pserver:anonymous@';;
70 CVS_PREFIX
="$CVS_USER${CVS_USER+@}";;
72 echo "$0: $CVS_AUTH: Unknown CVS access method" >&2
77 '') CVS_RSH
=ssh; export CVS_RSH
;;
80 trap "cleanup $1" 1 2 13 15
82 cvs
-z3 -q -d ${CVS_PREFIX}cvs.savannah.gnu.org
:/cvsroot
/"$1" co
$1 ||
97 # List of gnulib modules needed.
100 # Any gnulib files needed that are not in modules.
103 # Translation Project URL, for the registry of all projects
104 # and for the translation-team master directory.
105 TP_URL
='http://www.iro.umontreal.ca/translation/registry.cgi?domain='
106 TP_PO_URL
='http://www.iro.umontreal.ca/translation/teams/PO/'
108 extract_package_name
='
119 y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/
124 package
=`sed -n "$extract_package_name" configure.ac` || exit
126 # Extra files from gnulib, which override files from other sources.
128 build-aux/announce-gen
132 build-aux/texinfo.tex
134 build-aux/config.guess
139 # Other locale categories that need message catalogs.
140 EXTRA_LOCALE_CATEGORIES
=
142 # Additional xgettext options to use. Use "\\\newline" to break lines.
143 XGETTEXT_OPTIONS
='\\\
144 --flag=_:1:pass-c-format\\\
145 --flag=N_:1:pass-c-format\\\
146 --flag=error:3:c-format --flag=error_at_line:5:c-format\\\
149 # Files we don't want to import.
152 # File that should exist in the top directory of a checked out hierarchy,
153 # but not in a distribution tarball.
154 CVS_only_file
=README
-cvs
156 # Whether to use copies instead of symlinks.
159 # Override the default configuration, if necessary.
160 test -r bootstrap.conf
&& . .
/bootstrap.conf
162 # Translate configuration into internal form.
173 PAXUTILS_SRCDIR
=`expr "$option" : '--paxutils-srcdir=\(.*\)'`;;
175 GNULIB_SRCDIR
=`expr "$option" : '--gnulib-srcdir=\(.*\)'`;;
177 CVS_USER
=`expr "$option" : '--cvs-user=\(.*\)'`;;
178 --skip-po | --no-po) # --no-po is for compatibility with 'tar' tradition.
185 echo >&2 "$0: $option: unknown option"
190 if test -n "$CVS_only_file" && test ! -r "$CVS_only_file"; then
191 echo "$0: Bootstrapping from a non-checked-out distribution is risky." >&2
195 echo "$0: Bootstrapping CVS $package..."
197 # Get paxutils files.
199 case ${PAXUTILS_SRCDIR--} in
201 PAXUTILS_SRCDIR
=paxutils
204 if [ -r $PAXUTILS_SRCDIR/gnulib.modules
]; then
206 (echo "$gnulib_modules"; grep '^[^#]' $PAXUTILS_SRCDIR/gnulib.modules) |
211 # copy_files srcdir dstdir
213 for file in `cat $1/DISTFILES`
218 dst
=`echo $file | sed 's^.*/^^'`
219 if [ $# -eq 3 ]; then
225 echo "$0: Copying file $1/$file to $2/$dst"
226 cp -p $1/$file $2/$dst
230 copy_files
${PAXUTILS_SRCDIR}/m4 m4
231 echo "$0: Creating m4/paxutils.m4"
232 (echo "# This file is generated automatically. Please, do not edit."
234 echo "AC_DEFUN([${package}_PAXUTILS],["
235 cat ${PAXUTILS_SRCDIR}/m
4/DISTFILES
| sed '/^#/d;s/\(.*\)\.m4/pu_\1/' | tr a
-z A
-Z
236 echo "])") > .
/m
4/paxutils.
m4
244 for dir
in doc rmt lib tests
246 copy_files
${PAXUTILS_SRCDIR}/$dir $dir
249 copy_files
${PAXUTILS_SRCDIR}/paxlib lib pax
253 case ${GNULIB_SRCDIR--} in
259 gnulib_tool
=$GNULIB_SRCDIR/gnulib
-tool
260 <$gnulib_tool || exit
268 case $WGET_COMMAND in
270 echo "$0: wget not available; skipping translations";;
272 echo "$0: getting translations into $subdir for $domain..." &&
274 (cd $subdir && rm -f dummy
`ls | sed -n '/\.gmo$/p; /\.po/p'`) &&
275 $WGET_COMMAND -O "$subdir/$domain.html" "$TP_URL$domain" &&
277 sed -n 's|.*"http://[^"]*/translation/teams/PO/\([^/"]*\)/'"$domain"'-\([^/"]*\)\.[^."]*\.po".*|\1.\2|p' <"$subdir/$domain.html" |
278 sort -k 1,1 -k 2,2n
-k2,2 -k3,3n
-k3,3 -k4,4n
-k4,4 -k5,5n
-k5.5
|
280 { if (lang && $1 != lang) print lang, ver }
281 { lang = $1; ver = substr($0, index($0, ".") + 1) }
282 END { if (lang) print lang, ver }
283 ' | awk -v domain
="$domain" -v subdir
="$subdir" '
288 printf "{ $WGET_COMMAND -O %s/%s.po '\'"$TP_PO_URL"'/%s/%s-%s.%s.po'\'' &&\n", subdir, lang, lang, domain, ver, lang
289 printf " msgfmt -c -o /dev/null %s/%s.po || {\n", subdir, lang
290 printf " echo >&2 '\'"$0"': omitting translation for %s'\''\n", lang
291 printf " rm -f %s/%s.po; }; } &&\n", subdir, lang
294 ' | WGET_COMMAND
="$WGET_COMMAND" sh
;;
296 ls "$subdir"/*.po
2>/dev
/null
|
297 sed 's|.*/||; s|\.po$||' >"$subdir/LINGUAS" &&
298 rm -f "$subdir/$domain.html"
303 case `wget --help` in
305 WGET_COMMAND
='wget -nv --no-cache';;
307 WGET_COMMAND
='wget -nv --cache=off';;
309 WGET_COMMAND
='wget -nv';;
314 get_translations po
$package || exit
316 if test -d runtime
-po; then
317 get_translations runtime
-po $package-runtime || exit
323 src
=$GNULIB_SRCDIR/$1
329 test ! -h "$dst" || {
330 echo "$0: rm -f $dst" &&
335 cmp -s "$src" "$dst" || {
336 echo "$0: cp -fp $src $dst" &&
341 src_ls
=`ls -diL "$src" 2>/dev/null` && set $src_ls && src_i
=$1 &&
342 dst_ls
=`ls -diL "$dst" 2>/dev/null` && set $dst_ls && dst_i
=$1 &&
343 test "$src_i" = "$dst_i" || {
349 *//* | */..
/* | */.
/* | /*/*/*/*/*/)
350 echo >&2 "$0: invalid symlink calculation: $src -> $dst"
352 /*/*/*/*/) dot_dots
=..
/..
/..
/;;
353 /*/*/*/) dot_dots
=..
/..
/;;
354 /*/*/) dot_dots
=..
/;;
358 echo "$0: ln -fs $dot_dots$src $dst" &&
359 ln -fs "$dot_dots$src" "$dst"
365 cp_mark_as_generated
()
370 if cmp -s "$cp_src" "$GNULIB_SRCDIR/$cp_dst"; then
371 symlink_to_gnulib
"$cp_dst"
374 *.
[ch
]) c1
='/* '; c2
=' */';;
375 *.texi
) c1
='@c '; c2
= ;;
376 *.
m4|*/Make
*|Make
*) c1
='# ' ; c2
= ;;
380 if test -z "$c1"; then
381 cmp -s "$cp_src" "$cp_dst" || {
382 echo "$0: cp -f $cp_src $cp_dst" &&
383 cp -f "$cp_src" "$cp_dst"
386 # Copy the file first to get proper permissions if it
387 # doesn't already exist. Then overwrite the copy.
388 cp "$cp_src" "$cp_dst-t" &&
390 echo "$c1-*- buffer-read-only: t -*- vi: set ro:$c2" &&
391 echo "${c1}DO NOT EDIT! GENERATED AUTOMATICALLY!$c2" &&
394 if cmp -s "$cp_dst-t" "$cp_dst"; then
397 echo "$0: cp $cp_src $cp_dst # with edits" &&
398 mv -f "$cp_dst-t" "$cp_dst"
404 version_controlled_file
() {
409 grep -F "/$file/" $dir/CVS
/Entries
2>/dev
/null
|
410 grep '^/[^/]*/[0-9]' > /dev
/null
&& found
=yes
411 elif test -d .git
; then
412 git
-rm -n "$dir/$file" > /dev
/null
2>&1 && found
=yes
414 echo "$0: no version control for $dir/$file?" >&2
420 for dir
in .
`(cd $1 && find * -type d -print)`; do
423 for file in `ls $1/$dir`; do
424 test -d $1/$dir/$file && continue
425 for excluded_file
in $excluded_files; do
426 test "$dir/$file" = "$excluded_file" && continue 2
428 if test $file = Makefile.am
; then
429 copied
=$copied${sep}gnulib.mk
; sep
=$nl
430 remove_intl
='/^[^#].*\/intl/s/^/#/'
431 sed "$remove_intl" $1/$dir/$file | cmp -s - $dir/gnulib.mk
|| {
432 echo "$0: Copying $1/$dir/$file to $dir/gnulib.mk ..." &&
433 rm -f $dir/gnulib.mk
&&
434 sed "$remove_intl" $1/$dir/$file >$dir/gnulib.mk
436 elif { test "${2+set}" = set && test -r $2/$dir/$file; } ||
437 version_controlled_file
$dir $file; then
438 echo "$0: $dir/$file overrides $1/$dir/$file"
440 copied
=$copied$sep$file; sep
=$nl
441 if test $file = gettext.
m4; then
442 echo "$0: patching m4/gettext.m4 to remove need for intl/* ..."
445 /^AC_DEFUN(\[AM_INTL_SUBDIR],/,/^]/c\
446 AC_DEFUN([AM_INTL_SUBDIR], [
447 /^AC_DEFUN(\[gt_INTL_SUBDIR_CORE],/,/^]/c\
448 AC_DEFUN([gt_INTL_SUBDIR_CORE], [])
450 AC_DEFUN([gl_LOCK_EARLY], [])
451 ' $1/$dir/$file >$dir/$file
453 cp_mark_as_generated
$1/$dir/$file $dir/$file
458 for dot_ig
in .cvsignore .gitignore
; do
460 if test -n "$copied" && test -f $ig; then
461 echo "$copied" | sort -u - $ig | cmp -s - $ig ||
462 echo "$copied" | sort -u - $ig -o $ig || exit
469 # Create boot temporary directories to import from gnulib and gettext.
474 mkdir $bt $bt2 || exit
476 # Import from gnulib.
478 test -d build
-aux || {
479 echo "$0: mkdir build-aux ..." &&
482 gnulib_tool_options
="\
485 --aux-dir $bt/build-aux\
489 --source-base $bt/lib/\
490 --tests-base $bt/tests\
493 echo "$0: $gnulib_tool $gnulib_tool_options --import ..."
494 $gnulib_tool $gnulib_tool_options --import $gnulib_modules &&
497 for file in $gnulib_files; do
498 symlink_to_gnulib
$file || exit
502 # Import from gettext.
504 echo "$0: (cd $bt2; autopoint) ..."
505 cp configure.ac
$bt2 &&
506 (cd $bt2 && autopoint
&& rm configure.ac
) &&
507 slurp
$bt2 $bt || exit
509 rm -fr $bt $bt2 || exit
512 # Reconfigure, getting other files.
515 'aclocal --force -I m4' \
517 'autoheader --force' \
518 'automake --add-missing --copy --force-missing';
520 echo "$0: $command ..."
525 # Get some extra files from gnulib, overriding existing files.
527 for file in $gnulib_extra_files; do
529 */INSTALL
) dst
=INSTALL
;;
532 symlink_to_gnulib
$file $dst || exit
536 # Create gettext configuration.
537 echo "$0: Creating po/Makevars from po/Makevars.template ..."
540 /^EXTRA_LOCALE_CATEGORIES *=/s/=.*/= '"$EXTRA_LOCALE_CATEGORIES"'/
541 /^MSGID_BUGS_ADDRESS *=/s/=.*/= bug-'"$package"'@gnu.org/
542 /^XGETTEXT_OPTIONS *=/{
545 '"$XGETTEXT_OPTIONS"' $${end_of_xgettext_options+}
547 ' po
/Makevars.template
>po
/Makevars
549 if test -d runtime
-po; then
550 # Similarly for runtime-po/Makevars, but not quite the same.
551 rm -f runtime
-po/Makevars
553 /^DOMAIN *=.*/s/=.*/= '"$package"'-runtime/
554 /^subdir *=.*/s/=.*/= runtime-po/
555 /^MSGID_BUGS_ADDRESS *=/s/=.*/= bug-'"$package"'@gnu.org/
556 /^XGETTEXT_OPTIONS *=/{
559 '"$XGETTEXT_OPTIONS_RUNTIME"' $${end_of_xgettext_options+}
561 ' <po
/Makevars.template
>runtime
-po/Makevars
563 # Copy identical files from po to runtime-po.
564 (cd po
&& cp -p Makefile.
in.
in *-quot *.header
*.
sed *.sin ..
/runtime
-po)
567 echo "$0: done. Now you can run './configure'."
This page took 0.065952 seconds and 4 git commands to generate.