]> Dogcows Code - chaz/tar/blob - bootstrap
Set LC_ALL=C so that file names sort consistently.
[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.
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][--cvs-auth=AUTH-METHOD][--cvs-user=USERNAME][--no-po]
35 Options are:
36 --gnulib-srcdir=DIRNAME Specify the local directory where gnulib
37 sources reside. Use this if you already
38 have gnulib sources on your machine, and
39 do not want to waste your bandwidth dowloading
40 them again.
41 --cvs-auth=METHOD Set the CVS access method used for downloading
42 gnulib files. METHOD is one of the keywords
43 accepted by cvs -d option (see info cvs
44 repository).
45 --cvs-user=USERNAME Set the CVS username to be used when accessing
46 the gnulib repository.
47 --no-po Do not download po files.
48 --update-po[=LANG] Update po file(s) and exit.
49
50 Running without arguments will suffice in most cases. It is equivalent
51 to
52
53 ./bootstrap --cvs-auth=ext --cvs-user=anoncvs
54
55 EOF
56 }
57
58 update_po() {
59 if [ $# = 1 ]; then
60 case $1 in
61 *.po) POFILE=$1;;
62 *) POFILE=${1}.po;;
63 esac
64 echo "$0: getting translation for $1..."
65 wget -C off $TP_URL/$POFILE
66 else
67 echo "$0: getting translations into po..."
68 (cd po &&
69 rm -f dummy `ls | sed -n '/\.gmo$/p; /\.po/p'` &&
70 wget -nv -nd -r -l 1 -A .po -C off $TP_URL &&
71 ls *.po | sed 's/\.po$//' >LINGUAS
72 ) || exit
73 fi
74 }
75
76 # Parse options.
77
78 DOWNLOAD_PO=yes
79 for option
80 do
81 case $option in
82 --help)
83 usage
84 exit;;
85 --gnulib-srcdir=*)
86 GNULIB_SRCDIR=`expr "$option" : '--gnulib-srcdir=\(.*\)'`;;
87 --cvs-auth=*)
88 CVS_AUTH=`expr "$option" : '--cvs-auth=\(.*\)'`;;
89 --cvs-user=*)
90 CVS_USER=`expr "$option" : '--cvs-user=\(.*\)'`;;
91 --no-po)
92 DOWNLOAD_PO=no;;
93 --update-po=*)
94 DOWNLOAD_PO=`expr "$option" : '--update-po=\(.*\)'`;;
95 --update-po)
96 DOWNLOAD_PO=only;;
97 *)
98 echo >&2 "$0: $option: unknown option"
99 exit 1;;
100 esac
101 done
102
103 case $DOWNLOAD_PO in
104 only) update_po
105 exit 0
106 ;;
107 no|yes) ;;
108 *) update_po $DOWNLOAD_PO
109 exit 0
110 esac
111
112 echo "$0: Bootstrapping CVS tar..."
113
114 build_cvs_prefix() {
115 CVS_PREFIX=:${1}:
116 if [ "${2}" != - ]; then
117 CVS_PREFIX=${CVS_PREFIX}${2}@
118 fi
119 if [ "$1" = "ext" ]; then
120 if [ -z "${CVS_RSH}" ]; then
121 CVS_RSH=ssh
122 export CVS_RSH
123 fi
124 fi
125 }
126
127 # Get gnulib files.
128
129 case ${GNULIB_SRCDIR--} in
130 -)
131 if [ ! -d gnulib ]; then
132 echo "$0: getting gnulib files..."
133
134 trap exit 1 2 13 15
135 trap 'rm -fr gnulib; exit 1' 0
136
137 case "${CVS_AUTH--}" in
138 -) build_cvs_prefix ext anoncvs;;
139 pserver) build_cvs_prefix $CVS_AUTH ${CVS_USER:-anoncvs};;
140 gserver|server)
141 build_cvs_prefix $CVS_AUTH ${CVS_USER--};;
142 ext) build_cvs_prefix $CVS_AUTH ${CVS_USER--};;
143 *) echo "$0: Unknown CVS access method" >&2
144 exit 1;;
145 esac
146 if [ "${CVS_AUTH--}" = "pserver" ]; then
147 cvs -d ${CVS_PREFIX}subversions.gnu.org:/cvsroot/gnulib login || exit
148 fi
149 cvs -q -d ${CVS_PREFIX}subversions.gnu.org:/cvsroot/gnulib co gnulib || exit
150
151 trap 0
152 fi
153 GNULIB_SRCDIR=gnulib
154 esac
155
156 <$GNULIB_SRCDIR/gnulib-tool || exit
157
158 gnulib_modules='
159 alloca
160 argmatch
161 argp
162 backupfile
163 dirname
164 error
165 exclude
166 fileblocks
167 fnmatch-gnu
168 ftruncate
169 full-write
170 getdate
171 getline
172 getopt
173 getpagesize
174 gettext
175 gettime
176 hash
177 human
178 lchown
179 memset
180 modechange
181 obstack
182 quote
183 quotearg
184 rmdir
185 safe-read
186 save-cwd
187 savedir
188 stdbool
189 stpcpy
190 strtol
191 strtoul
192 timespec
193 unlocked-io
194 utime
195 xalloc
196 xalloc-die
197 xgetcwd
198 xstrtoumax
199 '
200
201 previous_gnulib_modules=
202 while [ "$gnulib_modules" != "$previous_gnulib_modules" ]; do
203 previous_gnulib_modules=$gnulib_modules
204 gnulib_modules=`
205 (echo "$gnulib_modules"
206 for gnulib_module in $gnulib_modules; do
207 $GNULIB_SRCDIR/gnulib-tool --extract-dependencies $gnulib_module
208 done) | sort -u
209 `
210 done
211
212 gnulib_files=`
213 (for gnulib_module in $gnulib_modules; do
214 $GNULIB_SRCDIR/gnulib-tool --extract-filelist $gnulib_module
215 done) | sort -u
216 `
217
218 gnulib_dirs=`echo "$gnulib_files" | sed 's,/[^/]*$,,' | sort -u`
219 mkdir -p $gnulib_dirs || exit
220
221 for gnulib_file in $gnulib_files; do
222 dest=$gnulib_file
223
224 case $gnulib_file in
225 m4/codeset.m4) continue;;
226 m4/intdiv0.m4) continue;;
227 m4/inttypes-pri.m4) continue;;
228 m4/isc-posix.m4) continue;;
229 m4/lcmessage.m4) continue;;
230 m4/onceonly_2_57.m4) dest=m4/onceonly.m4;;
231 # These will be overwritten by autopoint, which still uses
232 # old jm_.* macro names, so we have to keep both copies.
233 m4/gettext.m4 | m4/glibc21.m4 | m4/inttypes_h.m4 | m4/lib-ld.m4 | \
234 m4/lib-prefix.m4 | m4/po.m4 | m4/stdint_h.m4 | m4/uintmax_t.m4 | \
235 m4/ulonglong.m4)
236 dest=`expr $gnulib_file : '\(.*\).m4'`_gl.m4;;
237 esac
238
239 rm -f $dest &&
240 echo "$0: Copying file $GNULIB_SRCDIR/$gnulib_file" &&
241 cp -p $GNULIB_SRCDIR/$gnulib_file $dest || exit
242 done
243
244 echo "$0: Creating m4/gnulib.m4"
245 (echo "# This file is generated automatically. Please, do not edit."
246 echo "#"
247 echo "AC_DEFUN([tar_GNULIB],["
248 for gnulib_module in $gnulib_modules; do
249 echo "# $gnulib_module"
250 $GNULIB_SRCDIR/gnulib-tool --extract-autoconf-snippet $gnulib_module
251 done | sed '/AM_GNU_GETTEXT/d'
252 echo "])") > ./m4/gnulib.m4
253
254 echo "$0: Creating lib/Makefile.am"
255 (cat lib/Makefile.tmpl
256
257 for gnulib_module in $gnulib_modules; do
258 echo "# $gnulib_module"
259 $GNULIB_SRCDIR/gnulib-tool --extract-automake-snippet $gnulib_module
260 done | sed 's/lib_SOURCES/libtar_a_SOURCES/g' ) > lib/Makefile.am
261
262 # Get translations.
263 if test "$DOWNLOAD_PO" = "yes"; then
264 update_po
265 fi
266
267 # Reconfigure, getting other files.
268
269 echo "$0: autoreconf --verbose --install --force ..."
270 autoreconf --verbose --install --force
271
272
273 echo "$0: done. Now you can run './configure'."
This page took 0.048357 seconds and 5 git commands to generate.