]> Dogcows Code - chaz/tar/blob - bootstrap
Updated
[chaz/tar] / bootstrap
1 #! /bin/sh
2
3 # Bootstrap 'tar' from CVS.
4
5 # Copyright (C) 2003, 2004 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., 59 Temple Place - Suite 330, Boston, MA
20 # 02111-1307, 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://www2.iro.umontreal.ca/~gnutra/po/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 Running without arguments will suffice in most cases. It is equivalent
56 to
57
58 ./bootstrap --cvs-auth=ext --cvs-user=anoncvs
59
60 EOF
61 }
62
63 update_po() {
64 if [ $# = 1 ]; then
65 case $1 in
66 *.po) POFILE=$1;;
67 *) POFILE=${1}.po;;
68 esac
69 echo "$0: getting translation for $1..."
70 wget -C off $TP_URL/$POFILE
71 else
72 echo "$0: getting translations into po..."
73 (cd po &&
74 rm -f dummy `ls | sed -n '/\.gmo$/p; /\.po/p'` &&
75 wget -nv -nd -r -l 1 -A .po -C off $TP_URL &&
76 ls *.po | sed 's/\.po$//' >LINGUAS
77 ) || exit
78 fi
79 }
80
81 # Parse options.
82
83 DOWNLOAD_PO=yes
84 for option
85 do
86 case $option in
87 --help)
88 usage
89 exit;;
90 --gnulib-srcdir=*)
91 GNULIB_SRCDIR=`expr "$option" : '--gnulib-srcdir=\(.*\)'`;;
92 --paxutils-srcdir=*)
93 PAXUTILS_SRCDIR=`expr "$option" : '--paxutils-srcdir=\(.*\)'`;;
94 --cvs-auth=*)
95 CVS_AUTH=`expr "$option" : '--cvs-auth=\(.*\)'`;;
96 --cvs-user=*)
97 CVS_USER=`expr "$option" : '--cvs-user=\(.*\)'`;;
98 --no-po)
99 DOWNLOAD_PO=no;;
100 --update-po=*)
101 DOWNLOAD_PO=`expr "$option" : '--update-po=\(.*\)'`;;
102 --update-po)
103 DOWNLOAD_PO=only;;
104 *)
105 echo >&2 "$0: $option: unknown option"
106 exit 1;;
107 esac
108 done
109
110 case $DOWNLOAD_PO in
111 only) update_po
112 exit 0
113 ;;
114 no|yes) ;;
115 *) update_po $DOWNLOAD_PO
116 exit 0
117 esac
118
119 echo "$0: Bootstrapping CVS tar..."
120
121 build_cvs_prefix() {
122 CVS_PREFIX=:${1}:
123 if [ "${2}" != - ]; then
124 CVS_PREFIX=${CVS_PREFIX}${2}@
125 fi
126 if [ "$1" = "ext" ]; then
127 if [ -z "${CVS_RSH}" ]; then
128 CVS_RSH=ssh
129 export CVS_RSH
130 fi
131 fi
132 }
133
134 # checkout package
135 checkout() {
136 if [ ! -d $1 ]; then
137 echo "$0: getting $1 files..."
138
139 trap exit 1 2 13 15
140 trap 'rm -fr $1; exit 1' 0
141
142 case "${CVS_AUTH--}" in
143 -) build_cvs_prefix ext anoncvs
144 ;;
145 pserver) build_cvs_prefix $CVS_AUTH ${CVS_USER:-anoncvs}
146 ;;
147 gserver|server)
148 build_cvs_prefix $CVS_AUTH ${CVS_USER--}
149 ;;
150 ext) build_cvs_prefix $CVS_AUTH ${CVS_USER--}
151 ;;
152 *) echo "$0: Unknown CVS access method" >&2
153 exit 1;;
154 esac
155 if [ "${CVS_AUTH--}" = "pserver" ]; then
156 cvs -d ${CVS_PREFIX}subversions.gnu.org:/cvsroot/$1 login || exit
157 fi
158 cvs -q -d ${CVS_PREFIX}subversions.gnu.org:/cvsroot/$1 co $1 || exit
159
160 trap 0
161 fi
162 }
163
164 # Get gnulib files.
165
166 case ${GNULIB_SRCDIR--} in
167 -) checkout gnulib
168 GNULIB_SRCDIR=gnulib
169 esac
170
171 <$GNULIB_SRCDIR/gnulib-tool || exit
172
173 gnulib_modules='
174 alloca
175 argmatch
176 argp
177 backupfile
178 dirname
179 error
180 exclude
181 fileblocks
182 fnmatch-gnu
183 ftruncate
184 full-write
185 getdate
186 getline
187 getopt
188 getpagesize
189 gettext
190 gettime
191 hash
192 human
193 lchown
194 localcharset
195 memset
196 modechange
197 obstack
198 quote
199 quotearg
200 rmdir
201 safe-read
202 save-cwd
203 savedir
204 stdbool
205 stpcpy
206 strtol
207 strtoul
208 timespec
209 unlocked-io
210 utime
211 xalloc
212 xalloc-die
213 xgetcwd
214 xstrtoumax
215 '
216
217 previous_gnulib_modules=
218 while [ "$gnulib_modules" != "$previous_gnulib_modules" ]; do
219 previous_gnulib_modules=$gnulib_modules
220 gnulib_modules=`
221 (echo "$gnulib_modules"
222 for gnulib_module in $gnulib_modules; do
223 $GNULIB_SRCDIR/gnulib-tool --extract-dependencies $gnulib_module
224 done) | sort -u
225 `
226 done
227
228 gnulib_files=`
229 (for gnulib_module in $gnulib_modules; do
230 $GNULIB_SRCDIR/gnulib-tool --extract-filelist $gnulib_module
231 done) | sort -u
232 `
233
234 gnulib_dirs=`echo "$gnulib_files" | sed 's,/[^/]*$,,' | sort -u`
235 mkdir -p $gnulib_dirs || exit
236
237 for gnulib_file in $gnulib_files; do
238 dest=$gnulib_file
239
240 case $gnulib_file in
241 m4/codeset.m4) continue;;
242 m4/intdiv0.m4) continue;;
243 m4/inttypes-pri.m4) continue;;
244 m4/isc-posix.m4) continue;;
245 m4/lcmessage.m4) continue;;
246 m4/onceonly_2_57.m4) dest=m4/onceonly.m4;;
247 # These will be overwritten by autopoint, which still uses
248 # old jm_.* macro names, so we have to keep both copies.
249 m4/gettext.m4 | m4/glibc21.m4 | m4/inttypes_h.m4 | m4/lib-ld.m4 | \
250 m4/lib-prefix.m4 | m4/po.m4 | m4/stdint_h.m4 | m4/uintmax_t.m4 | \
251 m4/ulonglong.m4)
252 dest=`expr $gnulib_file : '\(.*\).m4'`_gl.m4;;
253 esac
254
255 rm -f $dest &&
256 echo "$0: Copying file $GNULIB_SRCDIR/$gnulib_file" &&
257 cp -p $GNULIB_SRCDIR/$gnulib_file $dest || exit
258 done
259
260 echo "$0: Creating m4/gnulib.m4"
261 (echo "# This file is generated automatically. Please, do not edit."
262 echo "#"
263 echo "AC_DEFUN([tar_GNULIB],["
264 for gnulib_module in $gnulib_modules; do
265 echo "# $gnulib_module"
266 $GNULIB_SRCDIR/gnulib-tool --extract-autoconf-snippet $gnulib_module
267 done | sed '/AM_GNU_GETTEXT/d'
268 echo "])") > ./m4/gnulib.m4
269
270 echo "$0: Creating lib/Makefile.am"
271 (cat lib/Makefile.tmpl
272
273 for gnulib_module in $gnulib_modules; do
274 echo "# $gnulib_module"
275 $GNULIB_SRCDIR/gnulib-tool --extract-automake-snippet $gnulib_module
276 done | sed 's/lib_SOURCES/libtar_a_SOURCES/g' ) > lib/Makefile.am
277
278 # Get paxutils files
279 case ${PAXUTILS_SRCDIR--} in
280 -) checkout paxutils
281 PAXUTILS_SRCDIR=paxutils
282 esac
283
284 # copy_files srcdir dstdir
285 copy_files() {
286 for file in `cat $1/DISTFILES`
287 do
288 case $file in
289 "#*") continue;;
290 esac
291 echo "$0: Copying file $1/$file"
292 cp -p $1/$file $2/`expr $file : '.*/\(.*\)'`
293 done
294 }
295
296 copy_files ${PAXUTILS_SRCDIR}/m4 m4
297
298 if [ -d rmt ]; then
299 :
300 else
301 mkdir rmt
302 fi
303
304 copy_files ${PAXUTILS_SRCDIR}/rmt rmt
305
306 copy_files ${PAXUTILS_SRCDIR}/lib lib
307
308 copy_files ${PAXUTILS_SRCDIR}/tests tests
309
310 # Get translations.
311 if test "$DOWNLOAD_PO" = "yes"; then
312 update_po
313 fi
314
315 # Reconfigure, getting other files.
316
317 echo "$0: autoreconf --verbose --install --force ..."
318 autoreconf --verbose --install --force
319
320
321 echo "$0: done. Now you can run './configure'."
This page took 0.047404 seconds and 4 git commands to generate.