diff options
Diffstat (limited to 'bootstrap')
-rwxr-xr-x | bootstrap | 807 |
1 files changed, 784 insertions, 23 deletions
@@ -1,23 +1,784 @@ | |||
1 | #! /bin/sh | 1 | #! /usr/bin/perl |
2 | 2 | # This file is part of GNU Dico | |
3 | chksrc() { | 3 | # Copyright (C) 2014, 2016 Sergey Poznyakoff |
4 | test -f modinc || return 1 | 4 | # |
5 | test -f stub.ac || return 1 | 5 | # GNU Dico is free software; you can redistribute it and/or modify |
6 | src=`sed -n 's/AC_CONFIG_SRCDIR(\[\(.*\)\]).*/\1/p' stub.ac` | 6 | # it under the terms of the GNU General Public License as published by |
7 | test -n "$src" || return 1 | 7 | # the Free Software Foundation; either version 3, or (at your option) |
8 | test -f $src | 8 | # any later version. |
9 | } | 9 | # |
10 | 10 | # GNU Dico is distributed in the hope that it will be useful, | |
11 | if ! chksrc; then | 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | echo "$0: must be run from the Dico source tree root directory" | 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | exit 1 | 13 | # GNU General Public License for more details. |
14 | fi | 14 | # |
15 | 15 | # You should have received a copy of the GNU General Public License | |
16 | set -e | 16 | # along with GNU Dico. If not, see <http://www.gnu.org/licenses/>. |
17 | git submodule init | 17 | |
18 | git submodule update | 18 | =head1 NAME |
19 | ./modinc | 19 | |
20 | set +e | 20 | bootstrap - Bootstrap the Dico project |
21 | gnulib=gnulibinit | 21 | |
22 | test -L $gnulib || ln -sf ./gnulib/build-aux/bootstrap $gnulib | 22 | =head1 SYNOPSIS |
23 | ./$gnulib | 23 | |
24 | B<bootstrap> | ||
25 | [B<-ahmnv>] | ||
26 | [B<--add>] | ||
27 | [B<--help>] | ||
28 | [B<--new>] | ||
29 | [B<--modules>] | ||
30 | [B<--dry-run>] | ||
31 | [B<--verbose>] | ||
32 | [I<NAME>...] | ||
33 | |||
34 | =head1 DESCRIPTION | ||
35 | |||
36 | Bootstrap the Dico project. This is the first command that should be run | ||
37 | after cloning the project from the repository in order to be able to built | ||
38 | it. | ||
39 | |||
40 | When run without arguments performs the following actions: | ||
41 | |||
42 | =over 4 | ||
43 | |||
44 | =item 1. Pulls in git submodules. | ||
45 | |||
46 | =item 2. Creates autoconf/automake sources for building Dico modules. | ||
47 | |||
48 | Recreates F<configure.ac> and F<modules/Makefile.am> from stub files | ||
49 | F<configure.boot> and F<modules/stub.am>. The list of modules is obtained | ||
50 | from the contents of the F<modules> directory -- each subdirectory | ||
51 | is supposed to contain one module. | ||
52 | |||
53 | Additional F<configure.ac> code for each module is obtained from | ||
54 | file F<module.ac> in each module directory. See the description of | ||
55 | this file in section B<FILES>. | ||
56 | |||
57 | =item 3. Bootstraps the B<gnulib> submodule. | ||
58 | |||
59 | =back | ||
60 | |||
61 | The program must be run from the Dico source tree topmost directory. | ||
62 | |||
63 | When given the B<-m> (B<--modules>) option, only the second step is | ||
64 | performed. | ||
65 | |||
66 | When run with B<-a> (B<--add>, B<--new>) option, the program creates | ||
67 | basic infrastructure for modules named in the command line. For each | ||
68 | I<NAME> it creates directory F<modules/I<NAME>>. Withih that directory, | ||
69 | it creates two files: F<Makefile.am> from F<modules/template.am>, and | ||
70 | F<I<NAME>.c>, which contains a stub code for the module. The new module | ||
71 | is then integrated into F<configure.ac> and F<modules/Makefile.am> files. | ||
72 | |||
73 | By default, the program prints only error diagnostics. That means that | ||
74 | upon success, it will terminate quietly, without producing a single line | ||
75 | on output. This can be changed using the B<-v> (or B<--verbose>) option. | ||
76 | When the option is given once, the program prints general description before | ||
77 | running each of the three steps described above. Two B<-v> options instruct | ||
78 | it to also print whatever output that was generated when running auxiliary | ||
79 | commands. Finally, three B<-v>'s produce additional debugging information. | ||
80 | |||
81 | The B<-n> (B<--dry-run>) option instructs the tool to print what would have | ||
82 | been done without actually doing it. | ||
83 | |||
84 | =head1 OPTIONS | ||
85 | |||
86 | =over 4 | ||
87 | |||
88 | =item B<-a>, B<--add>, B<--new> | ||
89 | |||
90 | Create basic infrastructure for modules named in the command line and | ||
91 | add them to F<configure.ac> and F<modules/Makefile.am> | ||
92 | |||
93 | =item B<-n>, B<--dry-run> | ||
94 | |||
95 | Don't do anything, just print what would have been done. | ||
96 | |||
97 | =item B<-m>, B<--modules> | ||
98 | |||
99 | Run only the second step: creation of autoconf/automake sources for | ||
100 | Dico modules. | ||
101 | |||
102 | =item B<-v>, B<--verbose> | ||
103 | |||
104 | Increase output verbosity. Multiple options accumulate. | ||
105 | |||
106 | =back | ||
107 | |||
108 | The following options are passed to the B<gnulib> bootstrap script | ||
109 | verbatim: | ||
110 | |||
111 | =over 4 | ||
112 | |||
113 | =item B<--gnulib-srcdir=>I<DIRNAME> | ||
114 | |||
115 | Specifies the local directory where B<gnulib> sources reside. Use this if | ||
116 | you already have gnulib sources on your machine, and do not want to waste | ||
117 | your bandwidth downloading them again. | ||
118 | |||
119 | =item B<--no-git> | ||
120 | |||
121 | Do not use git to update B<gnulib>. Requires that B<--gnulib-srcdir> point | ||
122 | to a correct gnulib snapshot. | ||
123 | |||
124 | =item B<--skip-po> | ||
125 | |||
126 | Do not download po files. | ||
127 | |||
128 | =back | ||
129 | |||
130 | The following options cause the program to display informative text and | ||
131 | exit: | ||
132 | |||
133 | =over 4 | ||
134 | |||
135 | =item B<-h> | ||
136 | |||
137 | Show a short usage summary. | ||
138 | |||
139 | =item B<--help> | ||
140 | |||
141 | Show man page. | ||
142 | |||
143 | =item B<--usage> | ||
144 | |||
145 | Show a concise command line syntax reminder. | ||
146 | |||
147 | =back | ||
148 | |||
149 | =head1 FILES | ||
150 | |||
151 | The following files are used as templates to create output files. When | ||
152 | creating output file, each line from the corresponding template is read, | ||
153 | I<macro expansion> is performed, and the resulting string is written to the | ||
154 | output file. | ||
155 | |||
156 | During macro expansion, each occurrence of B<< <I<NAME>> >> is replaced with | ||
157 | the contents of the macro variable I<NAME>, if it is defined. Expansion | ||
158 | of undefined variables leaves the text as is. | ||
159 | |||
160 | The construct B<< <I<NAME>#I<TEXT>> >> is expanded if it appears on a line | ||
161 | alone, possibly preceded by any string of characters. It works similarly | ||
162 | to B<< <I<NAME>> >>, except that if I<NAME> expands to multiple lines, the | ||
163 | second and subsequent lines of expansion are prefixed with I<TEXT> on output. | ||
164 | If I<TEXT> is empty, the content of the source line immediately preceding the | ||
165 | construct is used instead. This makes it possible to use expansions after a | ||
166 | comment character. E.g. if the variable B<HEADING> contains: | ||
167 | |||
168 | This file is generated automatically. | ||
169 | Please, do not edit. | ||
170 | See the docs for more info. | ||
171 | |||
172 | and the input file contains: | ||
173 | |||
174 | dnl <HEADING#> | ||
175 | |||
176 | Then, the resulting expansion will be: | ||
177 | |||
178 | dnl This file is generated automatically. | ||
179 | dnl Please, do not edit. | ||
180 | dnl See the docs for more info. | ||
181 | |||
182 | The macro variables are specific for each file, and are described below. | ||
183 | |||
184 | For each file, a special comment sequence is defined. Lines beginning | ||
185 | with that sequence are omitted from the output. | ||
186 | |||
187 | =over 4 | ||
188 | |||
189 | =item F<configure.boot> | ||
190 | |||
191 | Produces the F<configure.ac> file. Comment marker is B<##>. | ||
192 | The following variables are defined: | ||
193 | |||
194 | =over 8 | ||
195 | |||
196 | =item B<MODULES> | ||
197 | |||
198 | B<Autoconf> code for each module, obtained from the F<module.ac> | ||
199 | files. | ||
200 | |||
201 | =item B<HEADING> | ||
202 | |||
203 | Generates an initial header text, warning the reader that the file is | ||
204 | generated automatically and informing him about the ways to recreate | ||
205 | that file. | ||
206 | |||
207 | =item B<STATUS_OUTPUT> | ||
208 | |||
209 | A list of printable description for modules that can be disabled. Each | ||
210 | module is represented with a line | ||
211 | |||
212 | MODNAME ................ STATUS | ||
213 | |||
214 | where MODNAME is the module name and STATUS is the module status variable | ||
215 | (which produces B<yes> or B<no> at configure time, depending on whether | ||
216 | the module is enabled or not). | ||
217 | |||
218 | This is intended for use in B<AC_CONFIG_COMMANDS>. | ||
219 | |||
220 | =item B<STATUS_DEFN> | ||
221 | |||
222 | A list of assignments for module status variables, intended | ||
223 | for use in B<AC_CONFIG_COMMANDS>. | ||
224 | |||
225 | =back | ||
226 | |||
227 | The following code illustrates the use of the latter two variables: | ||
228 | |||
229 | AC_CONFIG_COMMANDS([status],[ | ||
230 | echo<STATUS_OUTPUT> | ||
231 | ], | ||
232 | [<STATUS_DEFN>]) | ||
233 | |||
234 | =item F<modules/*/module.ac> | ||
235 | |||
236 | This file is optional. If present, it contains the B<autoconf> code for | ||