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.
26 # Translation Project URL, for the registry of all projects.
27 TP_URL
='http://www.iro.umontreal.ca/translation/registry.cgi?domain='
29 # Ensure file names are sorted consistently across platforms.
30 # Also, ensure diagnostics are in English, e.g., "wget --help" below.
36 usage: $0 [--gnulib-srcdir=DIR][--paxutils-srcdir=DIR][--cvs-auth=AUTH-METHOD][--cvs-user=USERNAME][--no-po]
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 --cvs-auth=METHOD Set the CVS access method used for downloading
49 gnulib files. METHOD is one of the keywords
50 accepted by cvs -d option (see info cvs
52 --cvs-user=USERNAME Set the CVS username to be used when accessing
53 the gnulib repository.
54 --no-po Do not download po files.
55 --update-po[=LANG] Update po file(s) and exit.
57 If the file \`.bootstrap' exists in the current working directory, its
58 contents is read, comments and empty lines removed, shell variables expanded
59 and the result is prepended to the command line options.
61 Running without arguments will suffice in most cases. It is equivalent
64 ./bootstrap --cvs-auth=pserver
69 # Read configuration file
70 if [ -r .bootstrap
]; then
71 echo "$0: Reading configuration file .bootstrap"
72 eval set -- "`sed 's/#.*$//;/^$/d' .bootstrap | tr '\n' ' '` $*"
85 GNULIB_SRCDIR
=`expr "$option" : '--gnulib-srcdir=\(.*\)'`;;
87 PAXUTILS_SRCDIR
=`expr "$option" : '--paxutils-srcdir=\(.*\)'`;;
89 CVS_AUTH
=`expr "$option" : '--cvs-auth=\(.*\)'`;;
91 CVS_USER
=`expr "$option" : '--cvs-user=\(.*\)'`;;
95 DOWNLOAD_PO
=`expr "$option" : '--update-po=\(.*\)'`;;
99 echo >&2 "$0: $option: unknown option"
111 echo "$0: getting translations into $subdir for $domain..."
114 '') (cd $subdir && rm -f dummy
`ls | sed -n '/\.gmo$/p; /\.po/p'`);;
117 $WGET_COMMAND -O "$subdir/$domain.html" "$TP_URL$domain" &&
119 sed -n 's|.*"http://[^"]*/translation/teams/PO/\([^/"]*\)/'"$domain"'-\([^/"]*\)\.[^."]*\.po".*|\1.\2|p' <"$subdir/$domain.html" |
120 sort -k 1,1 -k 2,2n
-k2,2 -k3,3n
-k3,3 -k4,4n
-k4,4 -k5,5n
-k5.5
|
122 { if (lang && $1 != lang) print lang, ver }
123 { lang = $1; ver = substr($0, index($0, ".") + 1) }
124 END { if (lang) print lang, ver }
126 awk -v domain
="$domain" -v po_file
="$po_file" -v subdir
="$subdir" '
129 if (po_file && po_file != (lang ".po")) next
131 # Work around bugs in translations uncovered by gettext 0.15.
132 # This workaround can be removed once the translations are fixed.
133 if (lang == "hu" || lang == "zh_TW") next
137 printf "$WGET_COMMAND -O %s/%s.po 'http
://www.iro.umontreal.ca
/translation
/teams
/PO
/%s
/%s
-%s.
%s.po
' &&\n", subdir, lang, lang, domain, ver, lang
142 ls "$subdir"/*.po
| sed 's|.*/||; s|\.po$||' >"$subdir/LINGUAS" &&
143 rm "$subdir/$domain.html"
152 get_translations po
$package "$POFILE"
154 get_translations po
$package
161 case `wget --help` in
163 no_cache
='--no-cache';;
165 no_cache
='--cache=off';;
170 WGET_COMMAND
="wget -nv $no_cache"
179 *) update_po
$DOWNLOAD_PO
184 echo "$0: Bootstrapping CVS $package..."
188 if [ "${2}" != - ]; then
189 CVS_PREFIX
=${CVS_PREFIX}${2}@
191 if [ "$1" = "ext" ]; then
192 if [ -z "${CVS_RSH}" ]; then
202 echo "$0: getting $1 files..."
205 trap 'rm -fr $1; exit 1' 0
207 case "${CVS_AUTH-pserver}" in
208 pserver
) build_cvs_prefix pserver
${CVS_USER:-anonymous}
211 build_cvs_prefix
$CVS_AUTH ${CVS_USER--}
213 ext
) build_cvs_prefix
$CVS_AUTH ${CVS_USER--}
215 *) echo "$0: Unknown CVS access method" >&2
218 cvs
-q -d ${CVS_PREFIX}cvs.sv.gnu.org
:/cvsroot
/$1 co
$1 || exit
229 new_gnulib_modules
=`sed '/^[ ]*#/d; /^[ ]*$/d' $*`
230 case $gnulib_modules,$new_gnulib_modules in
231 ?
*,?
*) new_gnulib_modules
=$newline$new_gnulib_modules;;
233 gnulib_modules
=$gnulib_modules$new_gnulib_modules
237 case ${PAXUTILS_SRCDIR--} in
239 PAXUTILS_SRCDIR
=paxutils
242 if [ -r $PAXUTILS_SRCDIR/gnulib.modules
]; then
243 get_modules
$PAXUTILS_SRCDIR/gnulib.modules
246 # copy_files srcdir dstdir
248 for file in `cat $1/DISTFILES`
253 dst
=`echo $file | sed 's^.*/^^'`
254 if [ $# -eq 3 ]; then
260 echo "$0: Copying file $1/$file to $2/$dst"
261 cp -p $1/$file $2/$dst
265 copy_files
${PAXUTILS_SRCDIR}/m4 m4
266 echo "$0: Creating m4/paxutils.m4"
267 (echo "# This file is generated automatically. Please, do not edit."
269 echo "AC_DEFUN([${package}_PAXUTILS],["
270 cat ${PAXUTILS_SRCDIR}/m
4/DISTFILES
| sed '/^#/d;s/\(.*\)\.m4/pu_\1/' | tr a
-z A
-Z
271 echo "])") > .
/m
4/paxutils.
m4
279 for dir
in doc rmt lib tests
281 copy_files
${PAXUTILS_SRCDIR}/$dir $dir
284 copy_files
${PAXUTILS_SRCDIR}/paxlib lib pax
288 case ${GNULIB_SRCDIR--} in
293 gnulib_tool
=$GNULIB_SRCDIR/gnulib
-tool
294 <$gnulib_tool || exit
296 get_modules gnulib.modules
298 gnulib_modules
=`echo "$gnulib_modules" | sort -u`
299 previous_gnulib_modules
=
300 while [ "$gnulib_modules" != "$previous_gnulib_modules" ]; do
301 previous_gnulib_modules
=$gnulib_modules
303 (echo "$gnulib_modules"
304 for gnulib_module in $gnulib_modules; do
305 $gnulib_tool --extract-dependencies $gnulib_module
311 (for gnulib_module in $gnulib_modules; do
312 $gnulib_tool --extract-filelist $gnulib_module
316 gnulib_dirs
=`echo "$gnulib_files" | sed 's,/[^/]*$,,' | sort -u`
317 mkdir -p $gnulib_dirs || exit
319 for gnulib_file
in $gnulib_files; do
322 echo "$0: Copying file $GNULIB_SRCDIR/$gnulib_file" &&
323 cp -p $GNULIB_SRCDIR/$gnulib_file $dest || exit
326 # This suppresses a bogus diagnostic
327 # "warning: macro `AM_LANGINFO_CODESET' not found in library".
328 echo "$0: patching m4/gettext.m4 to remove need for intl/* ..."
330 /^AC_DEFUN(\[AM_INTL_SUBDIR],/,/^]/c\
331 AC_DEFUN([AM_INTL_SUBDIR], [])
332 /^AC_DEFUN(\[gt_INTL_SUBDIR_CORE],/,/^]/c\
333 AC_DEFUN([gt_INTL_SUBDIR_CORE], [])
334 ' m
4/gettext.
m4 >m
4/gettext_gl.
m4 || exit
336 echo "$0: Creating m4/gnulib.m4"
337 (echo "# This file is generated automatically. Please, do not edit."
339 echo "AC_DEFUN([${package}_GNULIB],["
340 for gnulib_module
in $gnulib_modules; do
341 echo "# $gnulib_module"
342 $gnulib_tool --extract-autoconf-snippet $gnulib_module
343 done | sed '/AM_GNU_GETTEXT/d'
344 echo "])") > .
/m
4/gnulib.
m4
346 echo "$0: Creating lib/Makefile.am"
347 (echo "# This file is generated automatically. Do not edit!"
348 cat lib
/Makefile.tmpl
350 for gnulib_module
in $gnulib_modules; do
351 echo "# $gnulib_module"
352 $gnulib_tool --extract-automake-snippet $gnulib_module
353 done | sed "s/lib_SOURCES/lib${package}_a_SOURCES/g" ) > lib
/Makefile.am
356 if test "$DOWNLOAD_PO" = "yes"; then
360 # Reconfigure, getting other files.
362 echo "$0: autopoint --force ..."
363 autopoint
--force || exit
365 # We don't need intl, so remove it.
366 intl_files_to_remove
='
377 echo $0: rm -fr $intl_files_to_remove ...
378 rm -fr $intl_files_to_remove || exit
381 # Undo changes to gnulib files that autoreconf made.
383 for gnulib_file
in $gnulib_files; do
384 test ! -f $gnulib_file || cmp -s $gnulib_file $GNULIB_SRCDIR/$gnulib_file || {
385 rm -f $gnulib_file &&
386 echo "$0: Copying file $GNULIB_SRCDIR/$gnulib_file again" &&
387 cp -p $GNULIB_SRCDIR/$gnulib_file $gnulib_file || exit
391 # Make sure aclocal.m4 is not older than input files.
395 'aclocal --force -I m4' \
397 'autoheader --force' \
398 'automake --add-missing --copy --force-missing';
400 echo "$0: $command ..."
405 # Create gettext configuration.
406 echo "$0: Creating po/Makevars from po/Makevars.template ..."
408 /^MSGID_BUGS_ADDRESS *=/s/=.*/= bug-'"$package"'@gnu.org/
409 /^XGETTEXT_OPTIONS *=/{
412 --flag=_:1:pass-c-format \\\
413 --flag=N_:1:pass-c-format \\\
414 --flag=error:3:c-format --flag=error_at_line:5:c-format \\\
415 --flag=asnprintf:3:c-format --flag=vasnprintf:3:c-format \\\
416 --flag=argp_error:2:c-format \\\
417 --flag=__argp_error:2:c-format \\\
418 --flag=argp_failure:4:c-format \\\
419 --flag=__argp_failure:4:c-format \\\
420 --flag=argp_fmtstream_printf:2:c-format \\\
421 --flag=__argp_fmtstream_printf:2:c-format
423 ' po
/Makevars.template
>po
/Makevars
426 echo "$0: done. Now you can run './configure'."