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