]> Dogcows Code - chaz/tar/blob - bootstrap
(update_po): Fix single translation update
[chaz/tar] / bootstrap
1 #! /bin/sh
2
3 # Bootstrap 'tar' from CVS.
4
5 # Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
6
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)
10 # any later version.
11
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.
16
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
20 # 02110-1301, USA.
21
22 # Written by Paul Eggert and Sergey Poznyakoff.
23
24 # URL of our text domain page in Translation Project
25 TP_URL="http://www.iro.umontreal.ca/translation/maint/tar/"
26
27 # Ensure file names are sorted consistently across platforms;
28 # e.g., m4/ulonglong_gl.m4 should follow m4/ulonglong.m4.
29 LC_ALL=C
30 export LC_ALL
31
32 usage() {
33 cat <<EOF
34 usage: $0 [--gnulib-srcdir=DIR][--paxutils-srcdir=DIR][--cvs-auth=AUTH-METHOD][--cvs-user=USERNAME][--no-po]
35 Options are:
36 --paxutils-srcdir=DIRNAME Specify the local directory where paxutils
37 sources reside. Use this if you already
38 have paxutils sources on your machine, and
39 do not want to waste your bandwidth dowloading
40 them again.
41 --gnulib-srcdir=DIRNAME Specify the local directory where gnulib
42 sources reside. Use this if you already
43 have gnulib sources on your machine, and
44 do not want to waste your bandwidth dowloading
45 them again.
46 --cvs-auth=METHOD Set the CVS access method used for downloading
47 gnulib files. METHOD is one of the keywords
48 accepted by cvs -d option (see info cvs
49 repository).
50 --cvs-user=USERNAME Set the CVS username to be used when accessing
51 the gnulib repository.
52 --no-po Do not download po files.
53 --update-po[=LANG] Update po file(s) and exit.
54
55 If the file \`.bootstrap' exists in the current working directory, its
56 contents is read, comments and empty lines removed, shell variables expanded
57 and the result is prepended to the command line options.
58
59 Running without arguments will suffice in most cases. It is equivalent
60 to
61
62 ./bootstrap --cvs-auth=pserver
63
64 EOF
65 }
66
67 update_po() {
68 if [ $# = 1 ]; then
69 case $1 in
70 *.po) POFILE=$1;;
71 *) POFILE=${1}.po;;
72 esac
73 echo "$0: getting translation for $1..."
74 (cd po;
75 wget -r --cache=off -O $POFILE $TP_URL/$POFILE || exit
76 LANG=`expr $POFILE : '\(.*\)\.po'`
77 if ! grep -q $LANG LINGUAS; then
78 mv LINGUAS LINGUAS.$$
79 (echo $LANG; cat LINGUAS.$$) | sort > LINGUAS
80 fi)
81 else
82 echo "$0: getting translations into po..."
83 (cd po &&
84 rm -f dummy `ls | sed -n '/\.gmo$/p; /\.po/p'` &&
85 wget -nv -nd -r -l 1 -A .po --cache off $TP_URL &&
86 rm -f index.html index.html.[0-9]*
87 ls *.po | sed 's/\.po$//' >LINGUAS
88 ) || exit
89 fi
90 }
91
92 # Read configuration file
93 if [ -r .bootstrap ]; then
94 echo "$0: Reading configuration file .bootstrap"
95 eval set -- "`sed 's/#.*$//;/^$/d' .bootstrap | tr '\n' ' '` $*"
96 fi
97
98 # Parse options.
99
100 DOWNLOAD_PO=yes
101 for option
102 do
103 case $option in
104 --help)
105 usage
106 exit;;
107 --gnulib-srcdir=*)
108 GNULIB_SRCDIR=`expr "$option" : '--gnulib-srcdir=\(.*\)'`;;
109 --paxutils-srcdir=*)
110 PAXUTILS_SRCDIR=`expr "$option" : '--paxutils-srcdir=\(.*\)'`;;
111 --cvs-auth=*)
112 CVS_AUTH=`expr "$option" : '--cvs-auth=\(.*\)'`;;
113 --cvs-user=*)
114 CVS_USER=`expr "$option" : '--cvs-user=\(.*\)'`;;
115 --no-po)
116 DOWNLOAD_PO=no;;
117 --update-po=*)
118 DOWNLOAD_PO=`expr "$option" : '--update-po=\(.*\)'`;;
119 --update-po)
120 DOWNLOAD_PO=only;;
121 *)
122 echo >&2 "$0: $option: unknown option"
123 exit 1;;
124 esac
125 done
126
127 case $DOWNLOAD_PO in
128 only) update_po
129 exit 0
130 ;;
131 no|yes) ;;
132 *) update_po $DOWNLOAD_PO
133 exit 0
134 esac
135
136 echo "$0: Bootstrapping CVS tar..."
137
138 build_cvs_prefix() {
139 CVS_PREFIX=:${1}:
140 if [ "${2}" != - ]; then
141 CVS_PREFIX=${CVS_PREFIX}${2}@
142 fi
143 if [ "$1" = "ext" ]; then
144 if [ -z "${CVS_RSH}" ]; then
145 CVS_RSH=ssh
146 export CVS_RSH
147 fi
148 fi
149 }
150
151 # checkout package
152 checkout() {
153 if [ ! -d $1 ]; then
154 echo "$0: getting $1 files..."
155
156 trap exit 1 2 13 15
157 trap 'rm -fr $1; exit 1' 0
158
159 case "${CVS_AUTH-pserver}" in
160 pserver) build_cvs_prefix pserver ${CVS_USER:-anonymous}
161 ;;
162 gserver|server)
163 build_cvs_prefix $CVS_AUTH ${CVS_USER--}
164 ;;
165 ext) build_cvs_prefix $CVS_AUTH ${CVS_USER--}
166 ;;
167 *) echo "$0: Unknown CVS access method" >&2
168 exit 1;;
169 esac
170 cvs -q -d ${CVS_PREFIX}cvs.sv.gnu.org:/cvsroot/$1 co $1 || exit
171
172 trap - 0
173 fi
174 }
175
176 gnulib_modules=
177 newline='
178 '
179
180 get_modules() {
181 new_gnulib_modules=`sed '/^[ ]*#/d; /^[ ]*$/d' $*`
182 case $gnulib_modules,$new_gnulib_modules in
183 ?*,?*) new_gnulib_modules=$newline$new_gnulib_modules;;
184 esac
185 gnulib_modules=$gnulib_modules$new_gnulib_modules
186 }
187
188 # Get paxutils files
189 case ${PAXUTILS_SRCDIR--} in
190 -) checkout paxutils
191 PAXUTILS_SRCDIR=paxutils
192 esac
193
194 if [ -r $PAXUTILS_SRCDIR/gnulib.modules ]; then
195 get_modules $PAXUTILS_SRCDIR/gnulib.modules
196 fi
197
198 # copy_files srcdir dstdir
199 copy_files() {
200 for file in `cat $1/DISTFILES`
201 do
202 case $file in
203 "#*") continue;;
204 esac
205 dst=`echo $file | sed 's^.*/^^'`
206 if [ $# -eq 3 ]; then
207 case $dst in
208 ${3}*) ;;
209 *) dst=${3}$dst;;
210 esac
211 fi
212 echo "$0: Copying file $1/$file to $2/$dst"
213 cp -p $1/$file $2/$dst
214 done
215 }
216
217 copy_files ${PAXUTILS_SRCDIR}/m4 m4
218 echo "$0: Creating m4/paxutils.m4"
219 (echo "# This file is generated automatically. Please, do not edit."
220 echo "#"
221 echo "AC_DEFUN([tar_PAXUTILS],["
222 cat ${PAXUTILS_SRCDIR}/m4/DISTFILES | sed '/^#/d;s/\(.*\)\.m4/pu_\1/' | tr a-z A-Z
223 echo "])") > ./m4/paxutils.m4
224
225 if [ -d rmt ]; then
226 :
227 else
228 mkdir rmt
229 fi
230
231 for dir in doc rmt lib tests
232 do
233 copy_files ${PAXUTILS_SRCDIR}/$dir $dir
234 done
235
236 copy_files ${PAXUTILS_SRCDIR}/paxlib lib pax
237
238 # Get gnulib files.
239
240 case ${GNULIB_SRCDIR--} in
241 -) checkout gnulib
242 GNULIB_SRCDIR=gnulib
243 esac
244
245 <$GNULIB_SRCDIR/gnulib-tool || exit
246
247 get_modules gnulib.modules
248
249 gnulib_modules=`echo "$gnulib_modules" | sort -u`
250 previous_gnulib_modules=
251 while [ "$gnulib_modules" != "$previous_gnulib_modules" ]; do
252 previous_gnulib_modules=$gnulib_modules
253 gnulib_modules=`
254 (echo "$gnulib_modules"
255 for gnulib_module in $gnulib_modules; do
256 $GNULIB_SRCDIR/gnulib-tool --extract-dependencies $gnulib_module
257 done) | sort -u
258 `
259 done
260
261 gnulib_files=`
262 (for gnulib_module in $gnulib_modules; do
263 $GNULIB_SRCDIR/gnulib-tool --extract-filelist $gnulib_module
264 done) | sort -u
265 `
266
267 gnulib_dirs=`echo "$gnulib_files" | sed 's,/[^/]*$,,' | sort -u`
268 mkdir -p $gnulib_dirs || exit
269
270 for gnulib_file in $gnulib_files; do
271 dest=$gnulib_file
272
273 case $gnulib_file in
274 m4/codeset.m4) continue;;
275 m4/intdiv0.m4) continue;;
276 m4/inttypes-pri.m4) continue;;
277 m4/isc-posix.m4) continue;;
278 m4/lcmessage.m4) continue;;
279 m4/onceonly_2_57.m4) dest=m4/onceonly.m4;;
280 # These will be overwritten by autopoint, which still uses
281 # old jm_.* macro names, so we have to keep both copies.
282 m4/gettext.m4 | m4/glibc21.m4 | m4/inttypes_h.m4 | m4/lib-ld.m4 | \
283 m4/lib-prefix.m4 | m4/po.m4 | m4/stdint_h.m4 | m4/uintmax_t.m4 | \
284 m4/ulonglong.m4)
285 dest=`expr $gnulib_file : '\(.*\).m4'`_gl.m4;;
286 esac
287
288 rm -f $dest &&
289 echo "$0: Copying file $GNULIB_SRCDIR/$gnulib_file" &&
290 cp -p $GNULIB_SRCDIR/$gnulib_file $dest || exit
291 done
292
293 echo "$0: Creating m4/gnulib.m4"
294 (echo "# This file is generated automatically. Please, do not edit."
295 echo "#"
296 echo "AC_DEFUN([tar_GNULIB],["
297 for gnulib_module in $gnulib_modules; do
298 echo "# $gnulib_module"
299 $GNULIB_SRCDIR/gnulib-tool --extract-autoconf-snippet $gnulib_module
300 done | sed '/AM_GNU_GETTEXT/d'
301 echo "])") > ./m4/gnulib.m4
302
303 echo "$0: Creating lib/Makefile.am"
304 (echo "# This file is generated automatically. Do not edit!"
305 cat lib/Makefile.tmpl
306
307 for gnulib_module in $gnulib_modules; do
308 echo "# $gnulib_module"
309 $GNULIB_SRCDIR/gnulib-tool --extract-automake-snippet $gnulib_module
310 done | sed 's/lib_SOURCES/libtar_a_SOURCES/g' ) > lib/Makefile.am
311
312 # Get translations.
313 if test "$DOWNLOAD_PO" = "yes"; then
314 update_po
315 fi
316
317 # Reconfigure, getting other files.
318
319 echo "$0: autoreconf --verbose --install --force ..."
320 autoreconf --verbose --install --force || exit 1
321
322
323 echo "$0: done. Now you can run './configure'."
This page took 0.052527 seconds and 5 git commands to generate.