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