aboutsummaryrefslogtreecommitdiff
path: root/bootstrap
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2008-02-26 13:42:41 +0000
committerSergey Poznyakoff <gray@gnu.org.ua>2008-02-26 13:42:41 +0000
commitf439e7de17824c8c22c6cbbd80ac78eb6877f2cd (patch)
tree8ef85bbcc6da98f378ea2d99ed27271204db0772 /bootstrap
downloadpies-f439e7de17824c8c22c6cbbd80ac78eb6877f2cd.tar.gz
pies-f439e7de17824c8c22c6cbbd80ac78eb6877f2cd.tar.bz2
* pies/pies.c: New configuration statement "chdir".
* pies/progman.c (struct prog.v.p): New member `dir'. (register_prog): Initialize newp->v.p.dir; (prog_start): Change to the working directory, if required by config.
Diffstat (limited to 'bootstrap')
-rwxr-xr-xbootstrap312
1 files changed, 312 insertions, 0 deletions
diff --git a/bootstrap b/bootstrap
new file mode 100755
index 0000000..51d94b2
--- /dev/null
+++ b/bootstrap
@@ -0,0 +1,312 @@
1#! /bin/sh
2############################
3## Configuration
4############################
5
6GNULIB_DATE=2007-05-12
7GNU_SOURCE_BASE=gnu
8
9MODLIST="argp\
10 fprintftime\
11 getline\
12 gettext\
13 malloc\
14 memrchr\
15 mkdtemp\
16 obstack\
17 realloc\
18 regex\
19 save-cwd\
20 snprintf\
21 strtok_r\
22 vasprintf"
23
24MODAVOID="xalloc-die openat-die"
25
26# Other locale categories that need message catalogs.
27EXTRA_LOCALE_CATEGORIES=
28
29NLS_MARKERS="\
30 MF_THROW:2\
31 MF_ASSERT:3\
32 parse_error:1\
33 parse_error_locus:2\
34 mu_error:1\
35 gacopyz_io_log:3\
36 gacopyz_logmsg:2\
37 gacopyz_log:3"
38
39# Additional xgettext options to use. Use "\\\newline" to break lines.
40XGETTEXT_OPTIONS='\\\
41 --flag=_:1:pass-c-format\\\
42 --flag=N_:1:pass-c-format\\\
43 --flag=error:3:c-format --flag=error_at_line:5:c-format\\\
44'
45
46COPYRIGHT_HOLDER="Sergey Poznyakoff"
47
48# Translation Project URL, for the registry of all projects
49# and for the translation-team master directory.
50# (for future use)
51tp_url() {
52 echo "http://translationproject.org/domain/$1.html"
53}
54
55############################
56## Implementation
57############################
58
59usage() {
60 echo >&2 "\
61Usage: $0 [OPTION]... GNULIB_DIR
62Bootstrap this package from the checked-out sources.
63
64 --copy Copy files instead of creating symbolic links.
65 --force Attempt to bootstrap even if the sources seem
66 not to have been checked out.
67 --skip-po Do not download po files.
68 --update-po[=LANG] Update po file(s) and exit.
69
70The only argument specifes the file name of the directory were gnulib
71sources are located. You will have to check out them beforehand, \`bootstrap'
72won't do this for you.
73
74Local defaults can be provided by placing the file \`.bootstrap' in the
75current working directory. The file is read, comments and empty lines are
76removed, shell variables expanded and the result is prepended to the command
77line options.
78
79Running without arguments will suffice in most cases.
80"
81}
82
83# Read local configuration file
84if [ -r .bootstrap ]; then
85 echo "$0: Reading configuration file .bootstrap"
86 eval set -- "`sed 's/#.*$//;/^$/d' .bootstrap | tr '\n' ' '` $*"
87fi
88
89extract_package_name='
90 /^AC_INIT(/{
91 /.*,.*,.*,/{
92 s///
93 s/[][]//g
94 p
95 q
96 }
97 s/AC_INIT(\[*//
98 s/]*,.*//
99 s/^GNU //
100 y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/
101 s/[^A-Za-z0-9_]/-/g
102 p
103 }
104'
105package=`sed -n "$extract_package_name" configure.ac` || exit
106
107extract_bug_address='
108 /^AC-INIT-BUG-ADDRESS/{
109 s/[][]//g
110 s/.*=//p
111 }
112'
113bug_address=`m4 -D'AC_INIT=AC-INIT-BUG-ADDRESS=$3' configure.ac | sed -n "$extract_bug_address"`
114if test -z "$bug_address"; then
115 bug_address="bug-${package}@gnu.org.ua"
116fi
117
118# Whether to use copies instead of symlinks.
119copy=false
120
121GNULIB_OPTION=
122DOWNLOAD_PO=
123
124for option
125do
126 case $option in
127 --help)
128 usage
129 exit;;
130 --skip-po | --no-po) # --no-po is for compatibility with 'tar' tradition.
131 DOWNLOAD_PO=skip;;
132 --update-po=*)
133 DOWNLOAD_PO=`expr "$option" : '--update-po=\(.*\)'`;;
134 --update-po)
135 DOWNLOAD_PO=only;;
136 --copy)
137 copy=true;;
138 -*)
139 echo >&2 "$0: $option: unknown option"
140 exit 1;;
141 *)
142 if [ -n "$NULIB_OPTION" ]; then
143 echo "$0: gnulib directory specified twice">&2
144 exit 1
145 fi
146 GNULIB_DIR=$option;;
147 esac
148done
149
150datecmp() {
151 test `echo "1 $1
1522 $2" | tr '-' ' ' | sort -n -k2 -k3 -k4 -k1 | sed -n '1s/ .*//p'` -eq 1
153}
154
155if [ -n "$GNULIB_DIR" ]; then
156 if [ -d "$GNULIB_DIR" ]; then
157 PATH="$GNULIB_DIR:$PATH"
158 if [ -r "$GNULIB_DIR/ChangeLog" ]; then
159 GNULIB_REV=`sed '/^[0-9]\{4\}-[0-9]\{2\}-[0-9]\{2\}/q' "$GNULIB_DIR/ChangeLog"`
160 if datecmp "$GNULIB_DATE" "$GNULIB_REV"; then :;
161 else
162 echo "$0: Gnulib version is too old: $GNULIB_REV">&2
163 echo "$0: It should not be older than $GNULIB_DATE">&2
164 echo "$0: Please, update gnulib and retry">&2
165 exit
166 fi
167 else
168 echo "$0: No $GNULIB_DIR/ChangeLog file found">&2
169 fi
170 else
171 echo "$0: specified gnulib location is not a directory">&2
172 fi
173else
174 echo "$0: warning: gnulib source directory not specified">&2
175 echo "$0: warning: looking for gnulib-tool in PATH...">&2
176fi
177
178gnulib-tool --version >/dev/null 2>&1
179if [ $? -ne 0 ]; then
180 echo "$0: Cannot run gnulib-tool. Try \`$0 --help' for more info.">&2
181 exit 1
182fi
183
184echo "$0: Bootstrapping $package"
185
186echo "$0: Running autopoint"
187autopoint -f || exit 1
188
189# Create gettext configuration.
190echo "$0: Creating po/Makevars from po/Makevars.template ..."
191rm -f po/Makevars
192
193if [ -n "$NLS_MARKERS" ]; then
194 XGETTEXT_OPTIONS="$XGETTEXT_OPTIONS "`echo $NLS_MARKERS | tr ' ' '\n' | sed 's/.*/ --flag=&:pass-c-format\\\\\\\\\\\\/'`"
195"
196fi
197
198sed '
199 1i\
200# -*- buffer-read-only: t -*- vi: set ro:\
201# DO NOT EDIT! GENERATED AUTOMATICALLY!
202
203 /^COPYRIGHT_HOLDER *=/s/=.*/= '"$COPYRIGHT_HOLDER"'/
204 /^EXTRA_LOCALE_CATEGORIES *=/s/=.*/= '"$EXTRA_LOCALE_CATEGORIES"'/
205 /^MSGID_BUGS_ADDRESS *=/s/=.*/= '"$bug_address"'/
206 /^XGETTEXT_OPTIONS *=/{
207 s/$/ \\/
208 a\
209 '"$XGETTEXT_OPTIONS"' $${end_of_xgettext_options+}
210 }
211' po/Makevars.template >po/Makevars
212
213# Get translations.
214
215get_translations() {
216 subdir=$1
217 domain=$2
218 po_file=$3
219
220 case $WGET_COMMAND in
221 '')
222 echo "$0: wget not available; skipping translations";;
223 ?*)
224 url=`tp_url $domain`
225 baseurl=`expr "$url" : '\(.*\)/.*'`
226 echo "$0: getting translations into $subdir for $domain..." &&
227 case $po_file in
228 '') (cd $subdir && rm -f dummy `ls | sed -n '/\.gmo$/p; /\.po/p'`);;
229 esac &&
230
231 $WGET_COMMAND -O "$subdir/$domain.html" "$url" &&
232
233 sed -n 's|.*href="\(.*\)/\([^/][^/]*\)/'"$domain"'-\([^/"]*\)\.[^."]*\.po".*|\2:\3:\1|p' <"$subdir/$domain.html" |
234 sort -t: -k 1,1 -k 2,2n -k2,2 -k3,3n -k3,3 -k4,4n -k4,4 -k5,5n -k5.5 |
235 awk -F: '
236 { if (lang && $1 != lang) print lang, ver, $3 }
237 { lang = $1; ver = $2 }
238 END { if (lang) print lang, ver, $3 }
239 ' | awk -v domain="$domain" -v baseurl="$baseurl" -v subdir="$subdir" \
240 -v po_file="$po_file" '
241 {
242 lang = $1
243 if (po_file && po_file != (lang ".po")) next
244 ver = $2
245 printf "{ $WGET_COMMAND -O %s/%s.po %s/%s/%s/%s-%s.%s.po &&\n", subdir, lang, baseurl, $3, lang, domain, ver, lang
246 printf " msgfmt -c -o /dev/null %s/%s.po || {\n", subdir, lang
247 printf " echo >&2 '\'"$0"': omitting translation for %s'\''\n", lang
248 printf " rm -f %s/%s.po; }; } &&\n", subdir, lang
249 }
250 END { print ":" }
251 ' | WGET_COMMAND="$WGET_COMMAND" sh
252 ;;
253 esac &&
254 ls "$subdir"/*.po 2>/dev/null |
255 sed 's|.*/||; s|\.po$||' >"$subdir/LINGUAS" &&
256 rm -f "$subdir/$domain.html"
257}
258
259save_LC_ALL="$LC_ALL"
260LC_ALL=C
261case `wget --help` in
262*'--no-cache'*)
263 WGET_COMMAND='wget -nv --no-cache';;
264*'--cache=on/off'*)
265 WGET_COMMAND='wget -nv --cache=off';;
266*'--non-verbose'*)
267 WGET_COMMAND='wget -nv';;
268*)
269 WGET_COMMAND='';;
270esac
271LC_ALL="$save_LC_ALL"
272
273case $DOWNLOAD_PO in
274'skip')
275 ;;
276'')
277 get_translations po $package || exit
278 ;;
279'only')
280 get_translations po $package
281 exit
282 ;;
283*.po)
284 get_translations po $package "$DOWNLOAD_PO"
285 exit
286 ;;
287*)
288 get_translations po $package "${DOWNLOAD_PO}.po"
289 exit
290esac
291
292echo "$0: Importing gnulib files ..."
293if [ -n "$MODAVOID" ]; then
294 gnulib_tool_options="`echo $MODAVOID | sed 's/\([^ ][^ ]*\)/--avoid &/g'`"
295fi
296
297test -d $GNU_SOURCE_BASE || mkdir $GNU_SOURCE_BASE
298gnulib-tool --import --source-base=$GNU_SOURCE_BASE $gnulib_tool_options $MODLIST
299
300echo "$0: Reconfiguring ..."
301
302for command in \
303 'aclocal --force -I m4' \
304 'autoconf --force' \
305 'autoheader --force' \
306 'automake --add-missing --copy --force-missing';
307do
308 echo "$0: $command ..."
309 $command || exit
310done
311
312echo "$0: done. Now you can run './configure'."

Return to:

Send suggestions and report system problems to the System administrator.