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