xref: /freebsd-src/crypto/openssl/doc/internal/man7/build.info.pod (revision b077aed33b7b6aefca7b17ddb250cf521f938613)
1*b077aed3SPierre Pronchery=pod
2*b077aed3SPierre Pronchery
3*b077aed3SPierre Pronchery=head1 NAME
4*b077aed3SPierre Pronchery
5*b077aed3SPierre Proncherybuild.info - Building information files
6*b077aed3SPierre Pronchery
7*b077aed3SPierre Pronchery=head1 SYNOPSIS
8*b077aed3SPierre Pronchery
9*b077aed3SPierre ProncheryB<IF[>0|1B<]>
10*b077aed3SPierre Pronchery
11*b077aed3SPierre ProncheryB<ELSIF[>0|1B<]>
12*b077aed3SPierre Pronchery
13*b077aed3SPierre ProncheryB<ELSE>
14*b077aed3SPierre Pronchery
15*b077aed3SPierre ProncheryB<ENDIF>
16*b077aed3SPierre Pronchery
17*b077aed3SPierre ProncheryB<SUBDIRS=> I<dir> ...
18*b077aed3SPierre Pronchery
19*b077aed3SPierre ProncheryB<PROGRAMS=> I<name> ...
20*b077aed3SPierre Pronchery
21*b077aed3SPierre ProncheryB<LIBS=> I<name> ...
22*b077aed3SPierre Pronchery
23*b077aed3SPierre ProncheryB<MODULES=> I<name> ...
24*b077aed3SPierre Pronchery
25*b077aed3SPierre ProncheryB<SCRIPTS=> I<name> ...
26*b077aed3SPierre Pronchery
27*b077aed3SPierre ProncheryB<DEPEND[>I<items>B<]=> I<otheritem> ...
28*b077aed3SPierre Pronchery
29*b077aed3SPierre ProncheryB<GENERATE[>I<item>B<]=> I<generator> I<generator-args> ...
30*b077aed3SPierre Pronchery
31*b077aed3SPierre ProncheryB<SOURCE[>I<item>B<]=> I<file> ...
32*b077aed3SPierre Pronchery
33*b077aed3SPierre ProncheryB<SHARED_SOURCE[>I<item>B<]=> I<file> ...
34*b077aed3SPierre Pronchery
35*b077aed3SPierre ProncheryB<DEFINE[>I<items>B<]=> I<name>[B<=>I<value>] ...
36*b077aed3SPierre Pronchery
37*b077aed3SPierre ProncheryB<INCLUDE[>I<items>B<]=> I<dir> ...
38*b077aed3SPierre Pronchery
39*b077aed3SPierre ProncheryB<$>I<VARIABLE>B<=>I<value>
40*b077aed3SPierre Pronchery
41*b077aed3SPierre Pronchery=head1 DESCRIPTION
42*b077aed3SPierre Pronchery
43*b077aed3SPierre ProncheryOpenSSL's build system revolves around three questions:
44*b077aed3SPierre Pronchery
45*b077aed3SPierre Pronchery=over 4
46*b077aed3SPierre Pronchery
47*b077aed3SPierre Pronchery=item What to build for?
48*b077aed3SPierre Pronchery
49*b077aed3SPierre ProncheryThis is about choice of platform (combination of hardware, operating
50*b077aed3SPierre Proncherysystem, and toolchain).
51*b077aed3SPierre Pronchery
52*b077aed3SPierre Pronchery=item What to build?
53*b077aed3SPierre Pronchery
54*b077aed3SPierre ProncheryThis is about having all the information on what needs to be built and
55*b077aed3SPierre Proncheryfrom what.
56*b077aed3SPierre Pronchery
57*b077aed3SPierre Pronchery=item How to build it?
58*b077aed3SPierre Pronchery
59*b077aed3SPierre ProncheryThis is about build file generation.
60*b077aed3SPierre Pronchery
61*b077aed3SPierre Pronchery=back
62*b077aed3SPierre Pronchery
63*b077aed3SPierre ProncheryThis document is all about the second item, "What to build?", and most
64*b077aed3SPierre Proncheryof all, how to specify that information.
65*b077aed3SPierre Pronchery
66*b077aed3SPierre ProncheryFor some terms used in this document, please see the L</GLOSSARY> at
67*b077aed3SPierre Proncherythe end.
68*b077aed3SPierre Pronchery
69*b077aed3SPierre Pronchery=head2 F<build.info> files
70*b077aed3SPierre Pronchery
71*b077aed3SPierre ProncheryF<build.info> files are meta data files for OpenSSL's built file
72*b077aed3SPierre Proncherygenerators, and are used to specify exactly what end product files
73*b077aed3SPierre Pronchery(programs, libraries, modules or scripts) are to be produced, and from
74*b077aed3SPierre Proncherywhat sources.
75*b077aed3SPierre Pronchery
76*b077aed3SPierre ProncheryIntermediate files, such as object files, are seldom referred to at
77*b077aed3SPierre Proncheryall.  They sometimes can be, if there's a need, but this should happen
78*b077aed3SPierre Proncheryvery rarely, and support for that sort of thing is added on as-needed
79*b077aed3SPierre Proncherybasis.
80*b077aed3SPierre Pronchery
81*b077aed3SPierre ProncheryAny time a directory or file is expected in a statement value, Unix
82*b077aed3SPierre Proncherysyntax must be used, which means that the slash C</> must be used as
83*b077aed3SPierre Proncherythe directory separator.
84*b077aed3SPierre Pronchery
85*b077aed3SPierre Pronchery=head2 General syntax
86*b077aed3SPierre Pronchery
87*b077aed3SPierre Pronchery=head3 Comments
88*b077aed3SPierre Pronchery
89*b077aed3SPierre ProncheryComments are any line that start with a hash sign (C<#>).  The hash
90*b077aed3SPierre Proncherysign may be preceded by any number of horizontal spaces.
91*b077aed3SPierre Pronchery
92*b077aed3SPierre Pronchery=head3 Filenames
93*b077aed3SPierre Pronchery
94*b077aed3SPierre ProncheryF<build.info> files are platform agnostic.  This means that there is
95*b077aed3SPierre Proncherysome information in them that is representative rather than specific.
96*b077aed3SPierre Pronchery
97*b077aed3SPierre ProncheryThis is particularly visible with end product names, they work more
98*b077aed3SPierre Proncherylike a tag than as the actual filename that's going to be produced.
99*b077aed3SPierre ProncheryThis is because different platforms have different decorations on
100*b077aed3SPierre Proncherydifferent types of files.
101*b077aed3SPierre Pronchery
102*b077aed3SPierre ProncheryFor example, if we say that we want to produce a program C<foo>, it
103*b077aed3SPierre Proncherywould look like this:
104*b077aed3SPierre Pronchery
105*b077aed3SPierre Pronchery    PROGRAM=foo
106*b077aed3SPierre Pronchery
107*b077aed3SPierre ProncheryHowever, the program filename may end up being just C<foo> (typical
108*b077aed3SPierre Proncheryfor Unix), or C<foo.exe> (typical for Windows), or even C<BLAH$FOO.EXE>
109*b077aed3SPierre Pronchery(possible on VMS, depending on policy).
110*b077aed3SPierre Pronchery
111*b077aed3SPierre ProncheryThese platform specific decorations are not the concern of
112*b077aed3SPierre ProncheryF<build.info> files.  The build file generators are responsible for
113*b077aed3SPierre Proncherytransforming these platform agnostic names to their platform specific
114*b077aed3SPierre Proncherycounterparts.
115*b077aed3SPierre Pronchery
116*b077aed3SPierre Pronchery=head3 Statements
117*b077aed3SPierre Pronchery
118*b077aed3SPierre ProncheryWith the exception of variables and conditions, the general statement
119*b077aed3SPierre Proncherysyntax is one of:
120*b077aed3SPierre Pronchery
121*b077aed3SPierre Pronchery=over 4
122*b077aed3SPierre Pronchery
123*b077aed3SPierre Pronchery=item B<I<KEYWORD>> B<=> I<value> ...
124*b077aed3SPierre Pronchery
125*b077aed3SPierre Pronchery=item B<I<KEYWORD>[>I<items>B<]> B<=> I<value> ...
126*b077aed3SPierre Pronchery
127*b077aed3SPierre Pronchery=back
128*b077aed3SPierre Pronchery
129*b077aed3SPierre ProncheryEvery B<I<KEYWORD>> represents some particular type of information.
130*b077aed3SPierre Pronchery
131*b077aed3SPierre ProncheryThe first form (sometimes called "plain statement") is used to specify
132*b077aed3SPierre Proncheryinformation on what end products need to be built, for example:
133*b077aed3SPierre Pronchery
134*b077aed3SPierre Pronchery    PROGRAMS=foo bar
135*b077aed3SPierre Pronchery    LIBS=libpoly libcookie
136*b077aed3SPierre Pronchery    MODULES=awesome-plugin
137*b077aed3SPierre Pronchery    SCRIPTS=tool1 tool2
138*b077aed3SPierre Pronchery    SUBDIRS=dir1 dir2
139*b077aed3SPierre Pronchery
140*b077aed3SPierre ProncheryThis says that we want to build programs C<foo> and C<bar>, the
141*b077aed3SPierre Proncherylibraries C<libpoly> and C<libcookie>, an awesome plugin module
142*b077aed3SPierre ProncheryC<awesome-plugin>, a couple of scripts C<tool1> and C<tool2>, and
143*b077aed3SPierre Proncheryfinally that there are more F<build.info> files in subdirectories
144*b077aed3SPierre ProncheryC<dir1> and C<dir2>.
145*b077aed3SPierre Pronchery
146*b077aed3SPierre ProncheryThe second form (sometimes called "indexed statement") is used to
147*b077aed3SPierre Proncheryspecify further details for existing items, for example:
148*b077aed3SPierre Pronchery
149*b077aed3SPierre Pronchery    SOURCE[foo]=foo.c details.c
150*b077aed3SPierre Pronchery    DEPEND[foo]=libcookie
151*b077aed3SPierre Pronchery
152*b077aed3SPierre ProncheryThis says that the program C<foo> is built from the source files
153*b077aed3SPierre ProncheryF<foo.c> and F<details.c>, and that it depends on the library
154*b077aed3SPierre ProncheryC<libcookie> (in other words, the library will be included when
155*b077aed3SPierre Proncherylinking that program together).
156*b077aed3SPierre Pronchery
157*b077aed3SPierre ProncheryMultiple space separated items are allowed too:
158*b077aed3SPierre Pronchery
159*b077aed3SPierre Pronchery    SOURCE[foo]=foo.c
160*b077aed3SPierre Pronchery    SOURCE[details]=details.c
161*b077aed3SPierre Pronchery    DEPEND[foo details]=libcookie
162*b077aed3SPierre Pronchery
163*b077aed3SPierre ProncheryFor any indexed statement for which the items haven't been specified
164*b077aed3SPierre Proncherythrough any plain statement, or where the items exists but the indexed
165*b077aed3SPierre Proncherystatement does not apply, the value is simply ignored by the build
166*b077aed3SPierre Proncheryfile generators.
167*b077aed3SPierre Pronchery
168*b077aed3SPierre Pronchery=head3 Statement attributes
169*b077aed3SPierre Pronchery
170*b077aed3SPierre ProncherySome statements can have attributes added to them, to allow for
171*b077aed3SPierre Proncheryvariations on how they are treated.
172*b077aed3SPierre Pronchery
173*b077aed3SPierre Pronchery=over 4
174*b077aed3SPierre Pronchery
175*b077aed3SPierre Pronchery=item B<I<KEYWORD>{> I<attrib> | I<attrib>B<=>I<attrib-value> [,...]B<}>
176*b077aed3SPierre ProncheryB<=> I<value> ...
177*b077aed3SPierre Pronchery
178*b077aed3SPierre Pronchery=item B<I<KEYWORD>[>I<items>B<]{> I<attrib> | I<attrib>B<=>I<attrib-value>
179*b077aed3SPierre Pronchery[,...]B<}> B<=> I<value> ...
180*b077aed3SPierre Pronchery
181*b077aed3SPierre Pronchery=back
182*b077aed3SPierre Pronchery
183*b077aed3SPierre ProncheryAttributes are passed as they are to the build file generators, and
184*b077aed3SPierre Proncherythe exact interpretation of those attributes is entirely up to them
185*b077aed3SPierre Pronchery(see L</Known attributes> below for details).
186*b077aed3SPierre Pronchery
187*b077aed3SPierre ProncheryA current example:
188*b077aed3SPierre Pronchery
189*b077aed3SPierre Pronchery    LIBS{noinst,has_main}=libtestutil.a
190*b077aed3SPierre Pronchery
191*b077aed3SPierre ProncheryThis says that the static library C<libtestutil.a> should not be
192*b077aed3SPierre Proncheryinstalled (C<noinst>), and that it includes an object file that has
193*b077aed3SPierre Proncherythe C<main> symbol (C<has_main>).  Most platforms don't need to know
194*b077aed3SPierre Proncherythe latter, but there are some where the program linker will not look
195*b077aed3SPierre Proncheryfor C<main> in libraries unless it's explicitly told so, so this is
196*b077aed3SPierre Proncheryway to tell the build file generator to emit the necessary command
197*b077aed3SPierre Proncheryoptions to make that happen.
198*b077aed3SPierre Pronchery
199*b077aed3SPierre ProncheryAttributes are accumulated globally.  This means that a library could
200*b077aed3SPierre Proncherybe given like this in different places:
201*b077aed3SPierre Pronchery
202*b077aed3SPierre Pronchery    # Location 1
203*b077aed3SPierre Pronchery    LIBS=libwhatever
204*b077aed3SPierre Pronchery
205*b077aed3SPierre Pronchery    # Location 2
206*b077aed3SPierre Pronchery    LIBS{noinst}=libwhatever
207*b077aed3SPierre Pronchery
208*b077aed3SPierre Pronchery    # Location 3
209*b077aed3SPierre Pronchery    LIBS{has_main}=libwhatever
210*b077aed3SPierre Pronchery
211*b077aed3SPierre ProncheryThe end result is that the library C<libwhatever> will have the
212*b077aed3SPierre Proncheryattributes C<noinst> and C<has_main> attached to it.
213*b077aed3SPierre Pronchery
214*b077aed3SPierre Pronchery=head3 Quoting and tokens
215*b077aed3SPierre Pronchery
216*b077aed3SPierre ProncheryStatement values are normally split into a list of tokens, separated
217*b077aed3SPierre Proncheryby spaces.
218*b077aed3SPierre Pronchery
219*b077aed3SPierre ProncheryTo avoid having a value split up into several tokens, they may be
220*b077aed3SPierre Proncheryquoted with double (C<">) or single (C<'>) quotes.
221*b077aed3SPierre Pronchery
222*b077aed3SPierre ProncheryFor example:
223*b077aed3SPierre Pronchery
224*b077aed3SPierre Pronchery    PROGRAMS=foo "space cadet" bar
225*b077aed3SPierre Pronchery
226*b077aed3SPierre ProncheryThis says that we sant to build three programs, C<foo>, C<space cadet>
227*b077aed3SPierre Proncheryand C<bar>.
228*b077aed3SPierre Pronchery
229*b077aed3SPierre Pronchery=head3 Conditionals
230*b077aed3SPierre Pronchery
231*b077aed3SPierre ProncheryF<build.info> files include a very simple condition system, involving
232*b077aed3SPierre Proncherythe following keywords:
233*b077aed3SPierre Pronchery
234*b077aed3SPierre Pronchery=over 4
235*b077aed3SPierre Pronchery
236*b077aed3SPierre Pronchery=item B<IF[>0|1B<]>
237*b077aed3SPierre Pronchery
238*b077aed3SPierre Pronchery=item B<ELSIF[>0|1B<]>
239*b077aed3SPierre Pronchery
240*b077aed3SPierre Pronchery=item B<ELSE>
241*b077aed3SPierre Pronchery
242*b077aed3SPierre Pronchery=item B<ENDIF>
243*b077aed3SPierre Pronchery
244*b077aed3SPierre Pronchery=back
245*b077aed3SPierre Pronchery
246*b077aed3SPierre ProncheryThis works like any condition system with similar syntax, and the
247*b077aed3SPierre Proncherycondition value in B<IF> and B<ELSIF> can really be any literal value
248*b077aed3SPierre Proncherythat perl can interpret as true or false.
249*b077aed3SPierre Pronchery
250*b077aed3SPierre ProncheryConditional statements are nesting.
251*b077aed3SPierre Pronchery
252*b077aed3SPierre ProncheryIn itself, this is not very powerful, but together with L</Perl nuggets>,
253*b077aed3SPierre Proncheryit can be.
254*b077aed3SPierre Pronchery
255*b077aed3SPierre Pronchery=head3 Variables
256*b077aed3SPierre Pronchery
257*b077aed3SPierre ProncheryF<build.info> handles simple variables.  They are defined by
258*b077aed3SPierre Proncheryassignment:
259*b077aed3SPierre Pronchery
260*b077aed3SPierre Pronchery=over 4
261*b077aed3SPierre Pronchery
262*b077aed3SPierre Pronchery=item B<$>I<NAME> B<=> I<value>
263*b077aed3SPierre Pronchery
264*b077aed3SPierre Pronchery=back
265*b077aed3SPierre Pronchery
266*b077aed3SPierre ProncheryThese variables can then be used as part of any statement value or
267*b077aed3SPierre Proncheryindexed statement item.  This should be used with some care, as
268*b077aed3SPierre ProncheryI<variables are expanded into their values before the value they are
269*b077aed3SPierre Proncherypart of is tokenized>.
270*b077aed3SPierre Pronchery
271*b077aed3SPierre ProncheryI<Variable assignment values are not tokenized.>
272*b077aed3SPierre Pronchery
273*b077aed3SPierre ProncheryVariable references can be one of:
274*b077aed3SPierre Pronchery
275*b077aed3SPierre Pronchery=over 4
276*b077aed3SPierre Pronchery
277*b077aed3SPierre Pronchery=item B<$>I<NAME> or B<${>I<NAME>B<}>
278*b077aed3SPierre Pronchery
279*b077aed3SPierre ProncherySimple reference; the variable reference is replaced with its value,
280*b077aed3SPierre Proncheryverbatim.
281*b077aed3SPierre Pronchery
282*b077aed3SPierre Pronchery=item B<${>I<NAME>B</>I<str>B</>I<subst>B<}>
283*b077aed3SPierre Pronchery
284*b077aed3SPierre ProncherySubstitution reference; the variable reference is replaced with its
285*b077aed3SPierre Proncheryvalue, modified by replacing all occurrences of I<str> with I<subst>.
286*b077aed3SPierre Pronchery
287*b077aed3SPierre Pronchery=back
288*b077aed3SPierre Pronchery
289*b077aed3SPierre Pronchery=head2 Scope
290*b077aed3SPierre Pronchery
291*b077aed3SPierre ProncheryMost of the statement values are accumulated globally from all the
292*b077aed3SPierre ProncheryF<build.info> files that are digested.  There are two exceptions,
293*b077aed3SPierre ProncheryF<build.info> variables and B<SUBDIRS> statement, for which the scope
294*b077aed3SPierre Proncheryis the F<build.info> file they are in.
295*b077aed3SPierre Pronchery
296*b077aed3SPierre Pronchery=head2 Perl nuggets
297*b077aed3SPierre Pronchery
298*b077aed3SPierre ProncheryWhenever a F<build.info> file is read, it is passed through the Perl
299*b077aed3SPierre Proncherytemplate processor L<OpenSSL::Template>, which is a small extension of
300*b077aed3SPierre ProncheryL<Text::Template>.
301*b077aed3SPierre Pronchery
302*b077aed3SPierre ProncheryPerl nuggets are anything between C<{-> and C<-}>, and whatever the
303*b077aed3SPierre Proncheryresult from such a nugget is, that value will replace the nugget in
304*b077aed3SPierre Proncherytext form.  This is useful to get dynamically generated F<build.info>
305*b077aed3SPierre Proncherystatements, and is most often seen used together with the B<IF> and
306*b077aed3SPierre ProncheryB<ELSIF> conditional statements.
307*b077aed3SPierre Pronchery
308*b077aed3SPierre ProncheryFor example:
309*b077aed3SPierre Pronchery
310*b077aed3SPierre Pronchery    IF[{- $disabled{something} -}]
311*b077aed3SPierre Pronchery      # do whatever's needed when "something" is disabled
312*b077aed3SPierre Pronchery    ELSIF[{- $somethingelse eq 'blah' -}]
313*b077aed3SPierre Pronchery      # do whatever's needed to satisfy this condition
314*b077aed3SPierre Pronchery    ELSE
315*b077aed3SPierre Pronchery      # fallback
316*b077aed3SPierre Pronchery    ENDIF
317*b077aed3SPierre Pronchery
318*b077aed3SPierre ProncheryNormal Perl scope applies, so it's possible to have an initial perl
319*b077aed3SPierre Proncherynugget that sets diverse global variables that are used in later
320*b077aed3SPierre Proncherynuggets.  Each nugget is a Perl block of its own, so B<my> definitions
321*b077aed3SPierre Proncheryare only in scope within the same nugget, while B<our> definitions are
322*b077aed3SPierre Proncheryin scope within the whole F<build.info> file.
323*b077aed3SPierre Pronchery
324*b077aed3SPierre Pronchery=head1 REFERENCE
325*b077aed3SPierre Pronchery
326*b077aed3SPierre Pronchery=head2 Conditionals
327*b077aed3SPierre Pronchery
328*b077aed3SPierre Pronchery=over 4
329*b077aed3SPierre Pronchery
330*b077aed3SPierre Pronchery=item B<IF[>0|1B<]>
331*b077aed3SPierre Pronchery
332*b077aed3SPierre ProncheryIf the condition is true (represented as C<1> here), everything
333*b077aed3SPierre Proncherybetween this B<IF> and the next corresponding B<ELSIF> or B<ELSE>
334*b077aed3SPierre Proncheryapplies, and the rest until the corresponding B<ENDIF> is skipped
335*b077aed3SPierre Proncheryover.
336*b077aed3SPierre Pronchery
337*b077aed3SPierre ProncheryIf the condition is false (represented as C<0> here), everything
338*b077aed3SPierre Proncheryfrom this B<IF> is skipped over until the next corresponding B<ELSIF>
339*b077aed3SPierre Proncheryor B<ELSE>, at which point processing continues.
340*b077aed3SPierre Pronchery
341*b077aed3SPierre Pronchery=item B<ELSE>
342*b077aed3SPierre Pronchery
343*b077aed3SPierre ProncheryIf F<build.info> statements have been skipped over to this point since
344*b077aed3SPierre Proncherythe corresponding B<IF> or B<ELSIF>, F<build.info> processing starts
345*b077aed3SPierre Proncheryagain following this line.
346*b077aed3SPierre Pronchery
347*b077aed3SPierre Pronchery=item B<ELSIF[>0|1B<]>
348*b077aed3SPierre Pronchery
349*b077aed3SPierre ProncheryThis is B<ELSE> and B<IF> combined.
350*b077aed3SPierre Pronchery
351*b077aed3SPierre Pronchery=item B<ENDIF>
352*b077aed3SPierre Pronchery
353*b077aed3SPierre ProncheryMarks the end of a conditional.
354*b077aed3SPierre Pronchery
355*b077aed3SPierre Pronchery=back
356*b077aed3SPierre Pronchery
357*b077aed3SPierre Pronchery=head2 Plain statements
358*b077aed3SPierre Pronchery
359*b077aed3SPierre Pronchery=over 4
360*b077aed3SPierre Pronchery
361*b077aed3SPierre Pronchery=item B<SUBDIRS=> I<dir> ...
362*b077aed3SPierre Pronchery
363*b077aed3SPierre ProncheryThis instructs the F<build.info> reader to also read the F<build.info>
364*b077aed3SPierre Proncheryfile in every specified directory.  All directories should be given
365*b077aed3SPierre Proncheryrelative to the location of the current F<build.info> file.
366*b077aed3SPierre Pronchery
367*b077aed3SPierre Pronchery=item B<PROGRAMS=> I<name> ...
368*b077aed3SPierre Pronchery
369*b077aed3SPierre ProncheryCollects names of programs that should be built.
370*b077aed3SPierre Pronchery
371*b077aed3SPierre ProncheryB<PROGRAMS> statements may have attributes, which apply to all the
372*b077aed3SPierre Proncheryprograms given in such a statement.  For example:
373*b077aed3SPierre Pronchery
374*b077aed3SPierre Pronchery    PROGRAMS=foo
375*b077aed3SPierre Pronchery    PROGRAMS{noinst}=bar
376*b077aed3SPierre Pronchery
377*b077aed3SPierre ProncheryWith those two lines, the program C<foo> will not have the attribute
378*b077aed3SPierre ProncheryC<noinst>, while the program C<bar> will.
379*b077aed3SPierre Pronchery
380*b077aed3SPierre Pronchery=item B<LIBS=> I<name> ...
381*b077aed3SPierre Pronchery
382*b077aed3SPierre ProncheryCollects names of libraries that should be built.
383*b077aed3SPierre Pronchery
384*b077aed3SPierre ProncheryThe normal case is that libraries are built in both static and shared
385*b077aed3SPierre Proncheryform.  However, if a name ends with C<.a>, only the static form will
386*b077aed3SPierre Proncherybe produced.
387*b077aed3SPierre Pronchery
388*b077aed3SPierre ProncherySimilarly, libraries may be referred in indexed statements as just the
389*b077aed3SPierre Proncheryplain name, or the name including the ending C<.a>.  If given without
390*b077aed3SPierre Proncherythe ending C<.a>, any form available will be used, but if given with
391*b077aed3SPierre Proncherythe ending C<.a>, the static library form is used unconditionally.
392*b077aed3SPierre Pronchery
393*b077aed3SPierre ProncheryB<LIBS> statements may have attributes, which apply to all the
394*b077aed3SPierre Proncherylibraries given in such a statement.  For example:
395*b077aed3SPierre Pronchery
396*b077aed3SPierre Pronchery    LIBS=libfoo
397*b077aed3SPierre Pronchery    LIBS{noinst}=libbar
398*b077aed3SPierre Pronchery
399*b077aed3SPierre ProncheryWith those two lines, the library C<libfoo> will not have the
400*b077aed3SPierre Proncheryattribute C<noinst>, while the library C<libbar> will.
401*b077aed3SPierre Pronchery
402*b077aed3SPierre Pronchery=item B<MODULES=> I<name>
403*b077aed3SPierre Pronchery
404*b077aed3SPierre ProncheryCollects names of dynamically loadable modules that should be built.
405*b077aed3SPierre Pronchery
406*b077aed3SPierre ProncheryB<MODULES> statements may have attributes, which apply to all the
407*b077aed3SPierre Proncherymodules given in such a statement.  For example:
408*b077aed3SPierre Pronchery
409*b077aed3SPierre Pronchery    MODULES=foo
410*b077aed3SPierre Pronchery    MODULES{noinst}=bar
411*b077aed3SPierre Pronchery
412*b077aed3SPierre ProncheryWith those two lines, the module C<foo> will not have the attribute
413*b077aed3SPierre ProncheryC<noinst>, while the module C<bar> will.
414*b077aed3SPierre Pronchery
415*b077aed3SPierre Pronchery=item B<SCRIPTS=> I<name>
416*b077aed3SPierre Pronchery
417*b077aed3SPierre ProncheryCollects names of scripts that should be built, or that just exist.
418*b077aed3SPierre ProncheryThat is how they differ from programs, as programs are always expected
419*b077aed3SPierre Proncheryto be compiled from multiple sources.
420*b077aed3SPierre Pronchery
421*b077aed3SPierre ProncheryB<SCRIPTS> statements may have attributes, which apply to all the
422*b077aed3SPierre Proncheryscripts given in such a statement.  For example:
423*b077aed3SPierre Pronchery
424*b077aed3SPierre Pronchery    SCRIPTS=foo
425*b077aed3SPierre Pronchery    SCRIPTS{noinst}=bar
426*b077aed3SPierre Pronchery
427*b077aed3SPierre ProncheryWith those two lines, the script C<foo> will not have the attribute
428*b077aed3SPierre ProncheryC<noinst>, while the script C<bar> will.
429*b077aed3SPierre Pronchery
430*b077aed3SPierre Pronchery=back
431*b077aed3SPierre Pronchery
432*b077aed3SPierre Pronchery=head2 Indexed statements
433*b077aed3SPierre Pronchery
434*b077aed3SPierre Pronchery=over 4
435*b077aed3SPierre Pronchery
436*b077aed3SPierre Pronchery=item B<DEPEND[>I<items>B<]> B<=> I<file> ...
437*b077aed3SPierre Pronchery
438*b077aed3SPierre ProncheryCollects dependencies, where I<items> depend on the given I<file>s.
439*b077aed3SPierre Pronchery
440*b077aed3SPierre ProncheryAs a special case, the I<items> may be empty, for which the build file
441*b077aed3SPierre Proncherygenerators should make the whole build depend on the given I<file>s,
442*b077aed3SPierre Proncheryrather than the specific I<items>.
443*b077aed3SPierre Pronchery
444*b077aed3SPierre ProncheryThe I<items> may be any program, library, module, script, or any
445*b077aed3SPierre Proncheryfilename used as a value anywhere.
446*b077aed3SPierre Pronchery
447*b077aed3SPierre ProncheryThe I<items> may also be literal build file targets.  Those are
448*b077aed3SPierre Proncheryrecognised by being surrounded be vertical bars (also known as the
449*b077aed3SPierre Pronchery"pipe" character), C<|>.  For example:
450*b077aed3SPierre Pronchery
451*b077aed3SPierre Pronchery    DEPEND[|tests|]=fipsmodule.cnf
452*b077aed3SPierre Pronchery
453*b077aed3SPierre ProncheryB<DEPEND> statements may have attributes, which apply to each
454*b077aed3SPierre Proncheryindividual dependency in such a statement.  For example:
455*b077aed3SPierre Pronchery
456*b077aed3SPierre Pronchery    DEPEND[libfoo.a]=libmandatory.a
457*b077aed3SPierre Pronchery    DEPEND[libfoo.a]{weak}=libbar.a libcookie.a
458*b077aed3SPierre Pronchery
459*b077aed3SPierre ProncheryWith those statements, the dependency between C<libfoo.a> and
460*b077aed3SPierre ProncheryC<libmandatory.a> is strong, while the dependency between C<libfoo.a>
461*b077aed3SPierre Proncheryand C<libbar.a> and C<libcookie.a> is weak.  See the description of
462*b077aed3SPierre ProncheryB<weak> in L</Known attributes> for more information.
463*b077aed3SPierre Pronchery
464*b077aed3SPierre Pronchery=item B<GENERATE[>I<item>B<]> B<=> I<generator> I<generator-arg> ...
465*b077aed3SPierre Pronchery
466*b077aed3SPierre ProncheryThis specifies that the I<item> is generated using the I<generator>
467*b077aed3SPierre Proncherywith the I<generator-arg>s as arguments, plus the name of the output
468*b077aed3SPierre Proncheryfile as last argument.
469*b077aed3SPierre Pronchery
470*b077aed3SPierre ProncheryFor I<generator>s where this is applicable, any B<INCLUDE> statement
471*b077aed3SPierre Proncheryfor the same I<item> will be given to the I<generator> as its
472*b077aed3SPierre Proncheryinclusion directories.  Likewise, any B<DEPEND> statement for the same
473*b077aed3SPierre ProncheryI<item> will be given to the I<generator> as an extra file or module
474*b077aed3SPierre Proncheryto load, where this is applicable.
475*b077aed3SPierre Pronchery
476*b077aed3SPierre ProncheryThe build file generators must be able to recognise the I<generator>.
477*b077aed3SPierre ProncheryCurrently, they at least recognise files ending in C<.pl>, and will
478*b077aed3SPierre Proncheryexecute them to generate the I<item>, and files ending in C<.in>,
479*b077aed3SPierre Proncherywhich will be used as input for L<OpenSSL::Template> to generate
480*b077aed3SPierre ProncheryI<item> (in other words, we use the exact same style of
481*b077aed3SPierre ProncheryL</Perl nuggets> mechanism that is used to read F<build.info> files).
482*b077aed3SPierre Pronchery
483*b077aed3SPierre Pronchery=item B<SOURCE[>I<item>B<]> B<=> I<file> ...
484*b077aed3SPierre Pronchery
485*b077aed3SPierre ProncheryCollects filenames that will be used as source files for I<item>.
486*b077aed3SPierre Pronchery
487*b077aed3SPierre ProncheryThe I<item> must be a singular item, and may be any program, library,
488*b077aed3SPierre Proncherymodule or script given with B<PROGRAMS>, B<LIBS>, B<MODULES> and
489*b077aed3SPierre ProncheryB<SCRIPTS>.
490*b077aed3SPierre Pronchery
491*b077aed3SPierre ProncheryStatic libraries may be sources.  In that case, its object files are
492*b077aed3SPierre Proncheryused directly when building I<item> instead of relying on library
493*b077aed3SPierre Proncherydependency and symbol resolution (through B<DEPEND> statements).
494*b077aed3SPierre Pronchery
495*b077aed3SPierre ProncheryB<SOURCE> statements may have attributes, which apply to each
496*b077aed3SPierre Proncheryindividual dependency in such a statement.  For example:
497*b077aed3SPierre Pronchery
498*b077aed3SPierre Pronchery    SOURCE[prog]=prog_a.c
499*b077aed3SPierre Pronchery    SOURCE[prog]{check}=prog_b.c prog_c.c
500*b077aed3SPierre Pronchery
501*b077aed3SPierre ProncheryWith those statements, the association between C<prog> and C<prog_a.c>
502*b077aed3SPierre Proncherycomes with no extra attributes, while the association between C<prog>
503*b077aed3SPierre Proncheryand C<prog_b.c> as well as C<prog_c.c> comes with the extra attribute
504*b077aed3SPierre ProncheryC<check>.
505*b077aed3SPierre Pronchery
506*b077aed3SPierre Pronchery=item B<SHARED_SOURCE[>I<item>B<]> B<=> I<file> ...
507*b077aed3SPierre Pronchery
508*b077aed3SPierre ProncheryCollects filenames that will be used as source files for I<item>.
509*b077aed3SPierre Pronchery
510*b077aed3SPierre ProncheryThe I<item> must be a singular item, and may be any library or module
511*b077aed3SPierre Proncherygiven with B<LIBS> or B<MODULES>.  For libraries, the given filenames
512*b077aed3SPierre Proncheryare only used for their shared form, so if the item is a library name
513*b077aed3SPierre Proncheryending with C<.a>, the filenames will be ignored.
514*b077aed3SPierre Pronchery
515*b077aed3SPierre ProncheryB<SHARED_SOURCE> statements may have attributes, just as B<SOURCE>
516*b077aed3SPierre Proncherystatements.
517*b077aed3SPierre Pronchery
518*b077aed3SPierre Pronchery=item B<DEFINE[>I<items>B<]> B<=> I<name>[B<=>I<value>] ...
519*b077aed3SPierre Pronchery
520*b077aed3SPierre ProncheryCollects I<name> / I<value> pairs (or just I<name> with no defined
521*b077aed3SPierre Proncheryvalue if no I<value> is given) associated with I<items>.
522*b077aed3SPierre Pronchery
523*b077aed3SPierre ProncheryThe build file generators will decide what to do with them.  For
524*b077aed3SPierre Proncheryexample, these pairs should become C macro definitions whenever a
525*b077aed3SPierre ProncheryC<.c> file is built into an object file.
526*b077aed3SPierre Pronchery
527*b077aed3SPierre Pronchery=item B<INCLUDE[>I<items>B<]> B<=> I<dir> ...
528*b077aed3SPierre Pronchery
529*b077aed3SPierre ProncheryCollects inclusion directories that will be used when building the
530*b077aed3SPierre ProncheryI<items> components (object files and whatever else).  This is used at
531*b077aed3SPierre Proncherythe discretion of the build file generators.
532*b077aed3SPierre Pronchery
533*b077aed3SPierre Pronchery=back
534*b077aed3SPierre Pronchery
535*b077aed3SPierre Pronchery=head2 Known attributes
536*b077aed3SPierre Pronchery
537*b077aed3SPierre ProncheryNote: this will never be a complete list of attributes.
538*b077aed3SPierre Pronchery
539*b077aed3SPierre Pronchery=over 4
540*b077aed3SPierre Pronchery
541*b077aed3SPierre Pronchery=item B<noinst>
542*b077aed3SPierre Pronchery
543*b077aed3SPierre ProncheryThis is used to specify that the end products this is set for should
544*b077aed3SPierre Proncherynot be installed, that they are only internal.  This is applicable on
545*b077aed3SPierre Proncheryinternal static libraries, or on test programs.
546*b077aed3SPierre Pronchery
547*b077aed3SPierre Pronchery=item B<misc>
548*b077aed3SPierre Pronchery
549*b077aed3SPierre ProncheryThis is used with B<SCRIPTS>, to specify that some scripts should be
550*b077aed3SPierre Proncheryinstalled in the "misc" directory rather than the normal program
551*b077aed3SPierre Proncherydirectory.
552*b077aed3SPierre Pronchery
553*b077aed3SPierre Pronchery=item B<engine>
554*b077aed3SPierre Pronchery
555*b077aed3SPierre ProncheryThis is used with B<MODULES>, to specify what modules are engines and
556*b077aed3SPierre Proncheryshould be installed in the engines directory instead of the modules
557*b077aed3SPierre Proncherydirectory.
558*b077aed3SPierre Pronchery
559*b077aed3SPierre Pronchery=item B<weak>
560*b077aed3SPierre Pronchery
561*b077aed3SPierre ProncheryThis is used with B<DEPEND> where libraries are involved, to specify
562*b077aed3SPierre Proncherythat the dependency between two libraries is weak and is only there to
563*b077aed3SPierre Proncheryinfer order.
564*b077aed3SPierre Pronchery
565*b077aed3SPierre ProncheryWithout this attribute, a dependency between two libraries, expressed
566*b077aed3SPierre Proncherylike this, means that if C<libfoo.a> appears in a linking command
567*b077aed3SPierre Proncheryline, so will C<libmandatory.a>:
568*b077aed3SPierre Pronchery
569*b077aed3SPierre Pronchery    DEPEND[libfoo.a]=libmandatory.a
570*b077aed3SPierre Pronchery
571*b077aed3SPierre ProncheryWith this attribute, a dependency between two libraries, expressed
572*b077aed3SPierre Proncherylike this, means that if I<both> C<libfoo.a> and C<libmandatory.a>
573*b077aed3SPierre Proncheryappear in a linking command line (because of recursive dependencies
574*b077aed3SPierre Proncherythrough other libraries), they will be ordered in such a way that this
575*b077aed3SPierre Proncherydependency is maintained:
576*b077aed3SPierre Pronchery
577*b077aed3SPierre Pronchery    DEPEND[libfoo.a]{weak}=libfoo.a libcookie.a
578*b077aed3SPierre Pronchery
579*b077aed3SPierre ProncheryThis is useful in complex dependency trees where two libraries can be
580*b077aed3SPierre Proncheryused as alternatives for each other.  In this example, C<lib1.a> and
581*b077aed3SPierre ProncheryC<lib2.a> have alternative implementations of the same thing, and
582*b077aed3SPierre ProncheryC<libmandatory.a> has unresolved references to that same thing, and is
583*b077aed3SPierre Proncherytherefore depending on either of them, but not both at the same time:
584*b077aed3SPierre Pronchery
585*b077aed3SPierre Pronchery    DEPEND[program1]=libmandatory.a lib1.a
586*b077aed3SPierre Pronchery    DEPEND[program2]=libmandatory.a lib2.a
587*b077aed3SPierre Pronchery    DEPEND[libmandatory]{weak}=lib1.a lib2.a
588*b077aed3SPierre Pronchery
589*b077aed3SPierre Pronchery=back
590*b077aed3SPierre Pronchery
591*b077aed3SPierre Pronchery=head1 GLOSSARY
592*b077aed3SPierre Pronchery
593*b077aed3SPierre Pronchery=over 4
594*b077aed3SPierre Pronchery
595*b077aed3SPierre Pronchery=item "build file"
596*b077aed3SPierre Pronchery
597*b077aed3SPierre ProncheryThis is any platform specific file that describes the complete build,
598*b077aed3SPierre Proncherywith platform specific commands.  On Unix, this is typically
599*b077aed3SPierre ProncheryF<Makefile>; on VMS, this is typically F<descrip.mms>.
600*b077aed3SPierre Pronchery
601*b077aed3SPierre Pronchery=item "build file generator"
602*b077aed3SPierre Pronchery
603*b077aed3SPierre ProncheryPerl code that generates build files, given configuration data and
604*b077aed3SPierre Proncherydata collected from F<build.info> files.
605*b077aed3SPierre Pronchery
606*b077aed3SPierre Pronchery=item "plain statement"
607*b077aed3SPierre Pronchery
608*b077aed3SPierre ProncheryAny F<build.info> statement of the form B<I<KEYWORD>>=I<values>, with
609*b077aed3SPierre Proncherythe exception of conditional statements and variable assignments.
610*b077aed3SPierre Pronchery
611*b077aed3SPierre Pronchery=item "indexed statement"
612*b077aed3SPierre Pronchery
613*b077aed3SPierre ProncheryAny F<build.info> statement of the form B<I<KEYWORD>[>I<items>B<]=>I<values>,
614*b077aed3SPierre Proncherywith the exception of conditional statements.
615*b077aed3SPierre Pronchery
616*b077aed3SPierre Pronchery=item "intermediate file"
617*b077aed3SPierre Pronchery
618*b077aed3SPierre ProncheryAny file that's an intermediate between a source file and an end
619*b077aed3SPierre Proncheryproduct.
620*b077aed3SPierre Pronchery
621*b077aed3SPierre Pronchery=item "end product"
622*b077aed3SPierre Pronchery
623*b077aed3SPierre ProncheryAny file that is mentioned in the B<PROGRAMS>, B<LIBS>, B<MODULES> or
624*b077aed3SPierre ProncheryB<SCRIPTS>.
625*b077aed3SPierre Pronchery
626*b077aed3SPierre Pronchery=back
627*b077aed3SPierre Pronchery
628*b077aed3SPierre Pronchery=head1 SEE ALSO
629*b077aed3SPierre Pronchery
630*b077aed3SPierre ProncheryFor OpenSSL::Template documentation,
631*b077aed3SPierre ProncheryC<perldoc -o man util/perl/OpenSSL/Template.pm>
632*b077aed3SPierre Pronchery
633*b077aed3SPierre ProncheryL<Text::Template|https://metacpan.org/pod/Text::Template>
634*b077aed3SPierre Pronchery
635*b077aed3SPierre Pronchery=head1 COPYRIGHT
636*b077aed3SPierre Pronchery
637*b077aed3SPierre ProncheryCopyright 2019-2021 The OpenSSL Project Authors. All Rights Reserved.
638*b077aed3SPierre Pronchery
639*b077aed3SPierre ProncheryLicensed under the Apache License 2.0 (the "License").  You may not use this
640*b077aed3SPierre Proncheryfile except in compliance with the License.  You can obtain a copy in the file
641*b077aed3SPierre ProncheryLICENSE in the source distribution or at
642*b077aed3SPierre ProncheryL<https://www.openssl.org/source/license.html>.
643*b077aed3SPierre Pronchery
644*b077aed3SPierre Pronchery=cut
645