diff options
Diffstat (limited to 'bootstrap')
-rwxr-xr-x | bootstrap | 618 |
1 files changed, 4 insertions, 614 deletions
@@ -1,615 +1,5 @@ | |||
1 | #! /bin/sh | 1 | #! /bin/sh |
2 | 2 | set -e | |
3 | # Bootstrap this package from checked-out sources. | 3 | git submodule init |
4 | 4 | git submodule update | |
5 | # Copyright (C) 2003-2008, 2009 Free Software Foundation, Inc. | 5 | autoreconf -f -i -s |
6 | |||
7 | # Dico 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 3 of the License, or | ||
10 | # (at your option) any later version. | ||
11 | |||
12 | # Dico 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 Dico. If not, see <http://www.gnu.org/licenses/>. | ||
19 | |||
20 | # Written by Paul Eggert. | ||
21 | |||
22 | nl=' | ||
23 | ' | ||
24 | |||
25 | # Ensure file names are sorted consistently across platforms. | ||
26 | LC_ALL=C | ||
27 | export LC_ALL | ||
28 | |||
29 | local_gl_dir=gl | ||
30 | |||
31 | # Temporary directory names. | ||
32 | bt='._bootmp' | ||
33 | bt_regex=`echo "$bt"| sed 's/\./[.]/g'` | ||
34 | bt2=${bt}2 | ||
35 | |||
36 | usage() { | ||
37 | echo >&2 "\ | ||
38 | Usage: $0 [OPTION]... | ||
39 | Bootstrap this package from the checked-out sources. | ||
40 | |||
41 | Options: | ||
42 | --gnulib-srcdir=DIRNAME Specify the local directory where gnulib | ||
43 | sources reside. Use this if you already | ||
44 | have gnulib sources on your machine, and | ||
45 | do not want to waste your bandwidth downloading | ||
46 | them again. | ||
47 | --copy Copy files instead of creating symbolic links. | ||
48 | --force Attempt to bootstrap even if the sources seem | ||
49 | not to have been checked out. | ||
50 | --skip-po Do not download po files. | ||
51 | |||
52 | If the file bootstrap.conf exists in the current working directory, its | ||
53 | contents are read as shell variables to configure the bootstrap. | ||
54 | |||
55 | Running without arguments will suffice in most cases. | ||
56 | " | ||
57 | } | ||
58 | |||
59 | # Configuration. | ||
60 | |||
61 | # Name of the Makefile.am | ||
62 | gnulib_mk=gnulib.mk | ||
63 | |||
64 | # List of gnulib modules needed. | ||
65 | gnulib_modules= | ||
66 | |||
67 | # Any gnulib files needed that are not in modules. | ||
68 | gnulib_files= | ||
69 | |||
70 | # The command to download all .po files for a specified domain into | ||
71 | # a specified directory. Fill in the first %s is the domain name, and | ||
72 | # the second with the destination directory. Use rsync's -L and -r | ||
73 | # options because the latest/%s directory and the .po files within are | ||
74 | # all symlinks. | ||
75 | po_download_command_format=\ | ||
76 | "rsync -Lrtvz 'translationproject.org::tp/latest/%s/' '%s'" | ||
77 | |||
78 | extract_package_name=' | ||
79 | /^AC_INIT(/{ | ||
80 | /.*,.*,.*, */{ | ||
81 | s/// | ||
82 | s/[][]//g | ||
83 | s/)$// | ||
84 | p | ||
85 | q | ||
86 | } | ||
87 | s/AC_INIT(\[*// | ||
88 | s/]*,.*// | ||
89 | s/^GNU // | ||
90 | y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ | ||
91 | s/[^A-Za-z0-9_]/-/g | ||
92 | p | ||
93 | } | ||
94 | ' | ||
95 | package=`sed -n "$extract_package_name" configure.ac` || exit | ||
96 | gnulib_name=lib$package | ||
97 | |||
98 | build_aux=build-aux | ||
99 | source_base=lib | ||
100 | m4_base=m4 | ||
101 | doc_base=doc | ||
102 | tests_base=tests | ||
103 | |||
104 | # Extra files from gnulib, which override files from other sources. | ||
105 | gnulib_extra_files=" | ||
106 | $build_aux/install-sh | ||
107 | $build_aux/missing | ||
108 | $build_aux/mdate-sh | ||
109 | $build_aux/texinfo.tex | ||
110 | $build_aux/depcomp | ||
111 | $build_aux/config.guess | ||
112 | $build_aux/config.sub | ||
113 | doc/INSTALL | ||
114 | " | ||
115 | |||
116 | # Additional gnulib-tool options to use. Use "\newline" to break lines. | ||
117 | gnulib_tool_option_extras= | ||
118 | |||
119 | # Other locale categories that need message catalogs. | ||
120 | EXTRA_LOCALE_CATEGORIES= | ||
121 | |||
122 | # Additional xgettext options to use. Use "\\\newline" to break lines. | ||
123 | XGETTEXT_OPTIONS='\\\ | ||
124 | --flag=_:1:pass-c-format\\\ | ||
125 | --flag=N_:1:pass-c-format\\\ | ||
126 | --flag=error:3:c-format --flag=error_at_line:5:c-format\\\ | ||
127 | ' | ||
128 | |||
129 | # Package bug report address for gettext files | ||
130 | MSGID_BUGS_ADDRESS=bug-$package@gnu.org | ||
131 | |||
132 | # Files we don't want to import. | ||
133 | excluded_files= | ||
134 | |||
135 | # File that should exist in the top directory of a checked out hierarchy, | ||
136 | # but not in a distribution tarball. | ||
137 | checkout_only_file=README-hacking | ||
138 | |||
139 | # Whether to use copies instead of symlinks. | ||
140 | copy=false | ||
141 | |||
142 | # Set this to '.cvsignore .gitignore' in bootstrap.conf if you want | ||
143 | # those files to be generated in directories like lib/, m4/, and po/. | ||
144 | # Or set it to 'auto' to make this script select which to use based | ||
145 | # on which version control system (if any) is used in the source directory. | ||
146 | vc_ignore=auto | ||
147 | |||
148 | # Override the default configuration, if necessary. | ||
149 | test -r bootstrap.conf && . ./bootstrap.conf | ||
150 | |||
151 | if test "$vc_ignore" = auto; then | ||
152 | vc_ignore= | ||
153 | test -d .git && vc_ignore=.gitignore | ||
154 | test -d CVS && vc_ignore="$vc_ignore .cvsignore" | ||
155 | fi | ||
156 | |||
157 | # Translate configuration into internal form. | ||
158 | |||
159 | # Parse options. | ||
160 | |||
161 | for option | ||
162 | do | ||
163 | case $option in | ||
164 | --help) | ||
165 | usage | ||
166 | exit;; | ||
167 | --gnulib-srcdir=*) | ||
168 | GNULIB_SRCDIR=`expr "$option" : '--gnulib-srcdir=\(.*\)'`;; | ||
169 | --skip-po) | ||
170 | SKIP_PO=t;; | ||
171 | --force) | ||
172 | checkout_only_file=;; | ||
173 | --copy) | ||
174 | copy=true;; | ||
175 | *) | ||
176 | echo >&2 "$0: $option: unknown option" | ||
177 | exit 1;; | ||
178 | esac | ||
179 | done | ||
180 | |||
181 | if test -n "$checkout_only_file" && test ! -r "$checkout_only_file"; then | ||
182 | echo "$0: Bootstrapping from a non-checked-out distribution is risky." >&2 | ||
183 | exit 1 | ||
184 | fi | ||
185 | |||
186 | # If $STR is not already on a line by itself in $FILE, insert it, | ||
187 | # sorting the new contents of the file and replacing $FILE with the result. | ||
188 | insert_sorted_if_absent() { | ||
189 | file=$1 | ||
190 | str=$2 | ||
191 | test -f $file || touch $file | ||
192 | echo "$str" | sort -u - $file | cmp -s - $file \ | ||
193 | || echo "$str" | sort -u - $file -o $file \ | ||
194 | || exit 1 | ||
195 | } | ||
196 | |||
197 | # Die if there is no AC_CONFIG_AUX_DIR($build_aux) line in configure.ac. | ||
198 | found_aux_dir=no | ||
199 | grep '^[ ]*AC_CONFIG_AUX_DIR(\['"$build_aux"'\])' configure.ac \ | ||
200 | >/dev/null && found_aux_dir=yes | ||
201 | grep '^[ ]*AC_CONFIG_AUX_DIR('"$build_aux"')' configure.ac \ | ||
202 | >/dev/null && found_aux_dir=yes | ||
203 | if test $found_aux_dir = no; then | ||
204 | echo "$0: expected line not found in configure.ac. Add the following:" >&2 | ||
205 | echo " AC_CONFIG_AUX_DIR([$build_aux])" >&2 | ||
206 | exit 1 | ||
207 | fi | ||
208 | |||
209 | # If $build_aux doesn't exist, create it now, otherwise some bits | ||
210 | # below will malfunction. If creating it, also mark it as ignored. | ||
211 | if test ! -d $build_aux; then | ||
212 | mkdir $build_aux | ||
213 | for dot_ig in x $vc_ignore; do | ||
214 | test $dot_ig = x && continue | ||
215 | insert_sorted_if_absent $dot_ig $build_aux | ||
216 | done | ||
217 | fi | ||
218 | |||
219 | echo "$0: Bootstrapping from checked-out $package sources..." | ||
220 | |||
221 | cleanup_gnulib() { | ||
222 | status=$? | ||
223 | rm -fr gnulib | ||
224 | exit $status | ||
225 | } | ||
226 | |||
227 | # Get gnulib files. | ||
228 | |||
229 | case ${GNULIB_SRCDIR--} in | ||
230 | -) | ||
231 | if [ ! -d gnulib ]; then | ||
232 | echo "$0: getting gnulib files..." | ||
233 | |||
234 | trap cleanup_gnulib 1 2 13 15 | ||
235 | |||
236 | git clone --depth 2 git://git.sv.gnu.org/gnulib || | ||
237 | cleanup_gnulib | ||
238 | |||
239 | trap - 1 2 13 15 | ||
240 | fi | ||
241 | GNULIB_SRCDIR=gnulib | ||
242 | esac | ||
243 | |||
244 | gnulib_tool=$GNULIB_SRCDIR/gnulib-tool | ||
245 | <$gnulib_tool || exit | ||