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 # List of gnulib modules needed.
38 # Any extra gnulib files needed.
41 # Translation Project URL, for the registry of all projects
42 # and for the translation-team master directory.
43 TP_URL='http://www.iro.umontreal.ca/translation/registry.cgi?domain='
44 TP_PO_URL='http://www.iro.umontreal.ca/translation/teams/PO/'
46 extract_package_name='
57 y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/
62 package=`sed -n "$extract_package_name" configure.ac` || exit
64 # Extra files from gnulib, which are not part of any module yet.
71 build-aux/config.guess
76 # Other locale categories that need message catalogs.
77 EXTRA_LOCALE_CATEGORIES=
79 # Additional xgettext options to use. Use "\\\newline" to break lines.
81 --flag=_:1:pass-c-format\\\
82 --flag=N_:1:pass-c-format\\\
83 --flag=error:3:c-format --flag=error_at_line:5:c-format\\\
86 # Files we don't want to import.
89 # Override the default configuration, if necessary.
90 test -r bootstrap.conf && . ./bootstrap.conf
92 # Translate configuration into internal form.
100 echo "$0: usage: $0 [--gnulib-srcdir=DIR] [--cvs-user=USERNAME] [--skip-po]"
103 GNULIB_SRCDIR=`expr "$option" : '--gnulib-srcdir=\(.*\)'`;;
105 CVS_USER=`expr "$option" : '--cvs-user=\(.*\)'`;;
109 echo >&2 "$0: $option: unknown option"
114 echo "$0: Bootstrapping CVS $package..."
124 case ${GNULIB_SRCDIR--} in
126 if [ ! -d gnulib ]; then
127 echo "$0: getting gnulib files..."
129 case ${CVS_AUTH-pserver} in
131 CVS_PREFIX=':pserver:anonymous@';;
133 CVS_PREFIX="$CVS_USER${CVS_USER+@}";;
135 echo "$0: $CVS_AUTH: Unknown CVS access method" >&2
140 '') export CVS_RSH=ssh;;
143 trap cleanup_gnulib 1 2 13 15
145 cvs -z3 -q -d ${CVS_PREFIX}cvs.savannah.gnu.org:/cvsroot/gnulib co gnulib ||
153 gnulib_tool=$GNULIB_SRCDIR/gnulib-tool
154 <$gnulib_tool || exit
162 case $WGET_COMMAND in
164 echo "$0: wget not available; skipping translations";;
166 echo "$0: getting translations into $subdir for $domain..." &&
168 (cd $subdir && rm -f dummy `ls | sed -n '/\.gmo$/p; /\.po/p'`) &&
169 $WGET_COMMAND -O "$subdir/$domain.html" "$TP_URL$domain" &&
171 sed -n 's|.*"http://[^"]*/translation/teams/PO/\([^/"]*\)/'"$domain"'-\([^/"]*\)\.[^."]*\.po".*|\1.\2|p' <"$subdir/$domain.html" |
172 sort -k 1,1 -k 2,2n -k2,2 -k3,3n -k3,3 -k4,4n -k4,4 -k5,5n -k5.5 |
174 { if (lang && $1 != lang) print lang, ver }
175 { lang = $1; ver = substr($0, index($0, ".") + 1) }
176 END { if (lang) print lang, ver }
177 ' | awk -v domain="$domain" -v subdir="$subdir" '
182 printf "{ $WGET_COMMAND -O %s/%s.po '\'"$TP_PO_URL"'/%s/%s-%s.%s.po'\'' &&\n", subdir, lang, lang, domain, ver, lang
183 printf " msgfmt -c -o /dev/null %s/%s.po || {\n", subdir, lang
184 printf " echo >&2 '\'"$0"': omitting translation for %s'\''\n", lang
185 printf " rm -f %s/%s.po; }; } &&\n", subdir, lang
188 ' | WGET_COMMAND="$WGET_COMMAND" sh;;
190 ls "$subdir"/*.po 2>/dev/null |
191 sed 's|.*/||; s|\.po$||' >"$subdir/LINGUAS" &&
192 rm -f "$subdir/$domain.html"
197 case `wget --help` in
199 WGET_COMMAND='wget -nv --no-cache';;
201 WGET_COMMAND='wget -nv --cache=off';;
203 WGET_COMMAND='wget -nv';;
208 get_translations po $package || exit
210 if test -d runtime-po; then
211 get_translations runtime-po $package-runtime || exit
218 # Ensure that files created herein are read-only, to indicate that
219 # they are generated, and hence should not be modified directly.
221 for dir in . `(cd $1 && find * -type d -print)`; do
224 for file in `ls $1/$dir`; do
225 test -d $1/$dir/$file && continue
226 for excluded_file in $excluded_files; do
227 test "$dir/$file" = "$excluded_file" && continue 2
229 if test $file = Makefile.am; then
230 copied=$copied${sep}gnulib.mk; sep=$nl
231 echo "$0: Copying $1/$dir/$file to $dir/gnulib.mk ..." &&
233 sed '/^[^#].*\/intl/s/^/#/' $1/$dir/$file >$dir/gnulib.mk
234 elif test -r ${2-no/such/dir}/$dir/$file ||
235 grep -F "/$file/" $dir/CVS/Entries 2>/dev/null |
236 grep -q '^/[^/]*/[0-9]'; then
237 echo "$0: $dir/$file overrides $1/$dir/$file"
239 copied=$copied$sep$file; sep=$nl
240 if test $file = gettext.m4; then
241 echo "$0: patching m4/gettext.m4 to remove need for intl/* ..."
244 /^AC_DEFUN(\[AM_INTL_SUBDIR],/,/^]/c\
245 AC_DEFUN([AM_INTL_SUBDIR], [
246 /^AC_DEFUN(\[gt_INTL_SUBDIR_CORE],/,/^]/c\
247 AC_DEFUN([gt_INTL_SUBDIR_CORE], [])
249 AC_DEFUN([gl_LOCK_EARLY], [])
250 ' $1/$dir/$file >$dir/$file
253 cp $1/$dir/$file $dir/$file
259 if test -n "$copied" && test -f $ig; then
260 echo "$copied" | sort -u - $ig | cmp -s - $ig ||
261 echo "$copied" | sort -u - $ig -o $ig || exit
268 # Create boot temporary directories to import from gnulib and gettext.
273 mkdir $bt $bt2 || exit
275 # Import from gnulib.
277 gnulib_tool_options="\
280 --aux-dir $bt/build-aux\
284 --source-base $bt/lib/\
285 --tests-base $bt/tests\
287 echo "$0: $gnulib_tool $gnulib_tool_options --import ..."
288 $gnulib_tool $gnulib_tool_options --import $gnulib_modules &&
292 # Import from gettext.
294 echo "$0: (cd $bt2; autopoint) ..."
295 cp configure.ac $bt2 &&
296 (cd $bt2 && autopoint && rm configure.ac) &&
297 slurp $bt2 $bt || exit
299 rm -fr $bt $bt2 || exit
302 # Reconfigure, getting other files.
305 'aclocal --force -I m4' \
307 'autoheader --force' \
308 'automake --add-missing --copy --force-missing';
310 echo "$0: $command ..."
315 # Get some extra files from gnulib, overriding existing files.
317 for file in $gnulib_extra_files; do
318 src=$GNULIB_SRCDIR/$file
323 echo "$0: cp -fp $GNULIB_SRCDIR/$file $dest" &&
324 cp -fp $GNULIB_SRCDIR/$file $dest || exit
328 # Create gettext configuration.
329 echo "$0: Creating po/Makevars from po/Makevars.template ..."
332 /^EXTRA_LOCALE_CATEGORIES *=/s/=.*/= '"$EXTRA_LOCALE_CATEGORIES"'/
333 /^MSGID_BUGS_ADDRESS *=/s/=.*/= bug-'"$package"'@gnu.org/
334 /^XGETTEXT_OPTIONS *=/{
337 '"$XGETTEXT_OPTIONS"' $${end_of_xgettext_options+}
339 ' po/Makevars.template >po/Makevars
340 chmod a-w po/Makevars
342 if test -d runtime-po; then
343 # Likewise for runtime-po/Makevars, except also change a few other parameters.
344 rm -f runtime-po/Makevars
346 s/^\(DOMAIN\) *=.*/\1 = '"$package"'-runtime/
347 s/^\(subdir\) *=.*/\1 = runtime-po/
348 s/^\(XGETTEXT_OPTIONS\) *=.*/\1 = '"$XGETTEXT_OPTIONS_RUNTIME"'/
349 ' <po/Makevars >runtime-po/Makevars
350 chmod a-w runtime-po/Makevars
352 # Copy identical files from po to runtime-po.
353 (cd po && cp -p Makefile.in.in *-quot *.header *.sed *.sin ../runtime-po)
356 echo "$0: done. Now you can run './configure'."