1*e0c4386eSCy SchubertIntro
2*e0c4386eSCy Schubert=====
3*e0c4386eSCy Schubert
4*e0c4386eSCy SchubertThis directory contains a few sets of files that are used for
5*e0c4386eSCy Schubertconfiguration in diverse ways:
6*e0c4386eSCy Schubert
7*e0c4386eSCy Schubert    *.conf      Target platform configurations, please read
8*e0c4386eSCy Schubert                'Configurations of OpenSSL target platforms' for more
9*e0c4386eSCy Schubert                information.
10*e0c4386eSCy Schubert    *.tmpl      Build file templates, please read 'Build-file
11*e0c4386eSCy Schubert                programming with the "unified" build system' as well
12*e0c4386eSCy Schubert                as 'Build info files' for more information.
13*e0c4386eSCy Schubert    *.pm        Helper scripts / modules for the main `Configure`
14*e0c4386eSCy Schubert                script.  See 'Configure helper scripts for more
15*e0c4386eSCy Schubert                information.
16*e0c4386eSCy Schubert
17*e0c4386eSCy SchubertConfigurations of OpenSSL target platforms
18*e0c4386eSCy Schubert==========================================
19*e0c4386eSCy Schubert
20*e0c4386eSCy SchubertConfiguration targets are a collection of facts that we know about
21*e0c4386eSCy Schubertdifferent platforms and their capabilities.  We organise them in a
22*e0c4386eSCy Schuberthash table, where each entry represent a specific target.
23*e0c4386eSCy Schubert
24*e0c4386eSCy SchubertNote that configuration target names must be unique across all config
25*e0c4386eSCy Schubertfiles.  The Configure script does check that a config file doesn't
26*e0c4386eSCy Schuberthave config targets that shadow config targets from other files.
27*e0c4386eSCy Schubert
28*e0c4386eSCy SchubertIn each table entry, the following keys are significant:
29*e0c4386eSCy Schubert
30*e0c4386eSCy Schubert        inherit_from    => Other targets to inherit values from.
31*e0c4386eSCy Schubert                           Explained further below. [1]
32*e0c4386eSCy Schubert        template        => Set to 1 if this isn't really a platform
33*e0c4386eSCy Schubert                           target.  Instead, this target is a template
34*e0c4386eSCy Schubert                           upon which other targets can be built.
35*e0c4386eSCy Schubert                           Explained further below.  [1]
36*e0c4386eSCy Schubert
37*e0c4386eSCy Schubert        sys_id          => System identity for systems where that
38*e0c4386eSCy Schubert                           is difficult to determine automatically.
39*e0c4386eSCy Schubert
40*e0c4386eSCy Schubert        enable          => Enable specific configuration features.
41*e0c4386eSCy Schubert                           This MUST be an array of words.
42*e0c4386eSCy Schubert        disable         => Disable specific configuration features.
43*e0c4386eSCy Schubert                           This MUST be an array of words.
44*e0c4386eSCy Schubert                           Note: if the same feature is both enabled
45*e0c4386eSCy Schubert                           and disabled, disable wins.
46*e0c4386eSCy Schubert
47*e0c4386eSCy Schubert        as              => The assembler command.  This is not always
48*e0c4386eSCy Schubert                           used (for example on Unix, where the C
49*e0c4386eSCy Schubert                           compiler is used instead).
50*e0c4386eSCy Schubert        asflags         => Default assembler command flags [4].
51*e0c4386eSCy Schubert        cpp             => The C preprocessor command, normally not
52*e0c4386eSCy Schubert                           given, as the build file defaults are
53*e0c4386eSCy Schubert                           usually good enough.
54*e0c4386eSCy Schubert        cppflags        => Default C preprocessor flags [4].
55*e0c4386eSCy Schubert        defines         => As an alternative, macro definitions may be
56*e0c4386eSCy Schubert                           given here instead of in 'cppflags' [4].
57*e0c4386eSCy Schubert                           If given here, they MUST be as an array of
58*e0c4386eSCy Schubert                           the string such as "MACRO=value", or just
59*e0c4386eSCy Schubert                           "MACRO" for definitions without value.
60*e0c4386eSCy Schubert        includes        => As an alternative, inclusion directories
61*e0c4386eSCy Schubert                           may be given here instead of in 'cppflags'
62*e0c4386eSCy Schubert                           [4].  If given here, the MUST be an array
63*e0c4386eSCy Schubert                           of strings, one directory specification
64*e0c4386eSCy Schubert                           each.
65*e0c4386eSCy Schubert        cc              => The C compiler command, usually one of "cc",
66*e0c4386eSCy Schubert                           "gcc" or "clang".  This command is normally
67*e0c4386eSCy Schubert                           also used to link object files and
68*e0c4386eSCy Schubert                           libraries into the final program.
69*e0c4386eSCy Schubert        cxx             => The C++ compiler command, usually one of
70*e0c4386eSCy Schubert                           "c++", "g++" or "clang++".  This command is
71*e0c4386eSCy Schubert                           also used when linking a program where at
72*e0c4386eSCy Schubert                           least one of the object file is made from
73*e0c4386eSCy Schubert                           C++ source.
74*e0c4386eSCy Schubert        cflags          => Defaults C compiler flags [4].
75*e0c4386eSCy Schubert        cxxflags        => Default  C++ compiler flags [4].  If unset,
76*e0c4386eSCy Schubert                           it gets the same value as cflags.
77*e0c4386eSCy Schubert
78*e0c4386eSCy Schubert        (linking is a complex thing, see [3] below)
79*e0c4386eSCy Schubert        ld              => Linker command, usually not defined
80*e0c4386eSCy Schubert                           (meaning the compiler command is used
81*e0c4386eSCy Schubert                           instead).
82*e0c4386eSCy Schubert                           (NOTE: this is here for future use, it's
83*e0c4386eSCy Schubert                           not implemented yet)
84*e0c4386eSCy Schubert        lflags          => Default flags used when linking apps,
85*e0c4386eSCy Schubert                           shared libraries or DSOs [4].
86*e0c4386eSCy Schubert        ex_libs         => Extra libraries that are needed when
87*e0c4386eSCy Schubert                           linking shared libraries, DSOs or programs.
88*e0c4386eSCy Schubert                           The value is also assigned to Libs.private
89*e0c4386eSCy Schubert                           in $(libdir)/pkgconfig/libcrypto.pc.
90*e0c4386eSCy Schubert
91*e0c4386eSCy Schubert        shared_cppflags => Extra C preprocessor flags used when
92*e0c4386eSCy Schubert                           processing C files for shared libraries.
93*e0c4386eSCy Schubert        shared_cflag    => Extra C compiler flags used when compiling
94*e0c4386eSCy Schubert                           for shared libraries, typically something
95*e0c4386eSCy Schubert                           like "-fPIC".
96*e0c4386eSCy Schubert        shared_ldflag   => Extra linking flags used when linking
97*e0c4386eSCy Schubert                           shared libraries.
98*e0c4386eSCy Schubert        module_cppflags
99*e0c4386eSCy Schubert        module_cflags
100*e0c4386eSCy Schubert        module_ldflags  => Has the same function as the corresponding
101*e0c4386eSCy Schubert                           'shared_' attributes, but for building DSOs.
102*e0c4386eSCy Schubert                           When unset, they get the same values as the
103*e0c4386eSCy Schubert                           corresponding 'shared_' attributes.
104*e0c4386eSCy Schubert
105*e0c4386eSCy Schubert        ar              => The library archive command, the default is
106*e0c4386eSCy Schubert                           "ar".
107*e0c4386eSCy Schubert                           (NOTE: this is here for future use, it's
108*e0c4386eSCy Schubert                           not implemented yet)
109*e0c4386eSCy Schubert        arflags         => Flags to be used with the library archive
110*e0c4386eSCy Schubert                           command.  On Unix, this includes the
111*e0c4386eSCy Schubert                           command letter, 'r' by default.
112*e0c4386eSCy Schubert
113*e0c4386eSCy Schubert        ranlib          => The library archive indexing command, the
114*e0c4386eSCy Schubert                           default is 'ranlib' it it exists.
115*e0c4386eSCy Schubert
116*e0c4386eSCy Schubert        unistd          => An alternative header to the typical
117*e0c4386eSCy Schubert                           '<unistd.h>'.  This is very rarely needed.
118*e0c4386eSCy Schubert
119*e0c4386eSCy Schubert        shared_extension => File name extension used for shared
120*e0c4386eSCy Schubert                            libraries.
121*e0c4386eSCy Schubert        obj_extension   => File name extension used for object files.
122*e0c4386eSCy Schubert                           On unix, this defaults to ".o" (NOTE: this
123*e0c4386eSCy Schubert                           is here for future use, it's not
124*e0c4386eSCy Schubert                           implemented yet)
125*e0c4386eSCy Schubert        exe_extension   => File name extension used for executable
126*e0c4386eSCy Schubert                           files.  On unix, this defaults to "" (NOTE:
127*e0c4386eSCy Schubert                           this is here for future use, it's not
128*e0c4386eSCy Schubert                           implemented yet)
129*e0c4386eSCy Schubert        shlib_variant   => A "variant" identifier inserted between the base
130*e0c4386eSCy Schubert                           shared library name and the extension.  On "unixy"
131*e0c4386eSCy Schubert                           platforms (BSD, Linux, Solaris, MacOS/X, ...) this
132*e0c4386eSCy Schubert                           supports installation of custom OpenSSL libraries
133*e0c4386eSCy Schubert                           that don't conflict with other builds of OpenSSL
134*e0c4386eSCy Schubert                           installed on the system.  The variant identifier
135*e0c4386eSCy Schubert                           becomes part of the SONAME of the library and also
136*e0c4386eSCy Schubert                           any symbol versions (symbol versions are not used or
137*e0c4386eSCy Schubert                           needed with MacOS/X).  For example, on a system
138*e0c4386eSCy Schubert                           where a default build would normally create the SSL
139*e0c4386eSCy Schubert                           shared library as 'libssl.so -> libssl.so.1.1' with
140*e0c4386eSCy Schubert                           the value of the symlink as the SONAME, a target
141*e0c4386eSCy Schubert                           definition that sets 'shlib_variant => "-abc"' will
142*e0c4386eSCy Schubert                           create 'libssl.so -> libssl-abc.so.1.1', again with
143*e0c4386eSCy Schubert                           an SONAME equal to the value of the symlink.  The
144*e0c4386eSCy Schubert                           symbol versions associated with the variant library
145*e0c4386eSCy Schubert                           would then be 'OPENSSL_ABC_<version>' rather than
146*e0c4386eSCy Schubert                           the default 'OPENSSL_<version>'. The string inserted
147*e0c4386eSCy Schubert                           into symbol versions is obtained by mapping all
148*e0c4386eSCy Schubert                           letters in the "variant" identifier to upper case
149*e0c4386eSCy Schubert                           and all non-alphanumeric characters to '_'.
150*e0c4386eSCy Schubert
151*e0c4386eSCy Schubert        thread_scheme   => The type of threads is used on the
152*e0c4386eSCy Schubert                           configured platform.  Currently known
153*e0c4386eSCy Schubert                           values are "(unknown)", "pthreads",
154*e0c4386eSCy Schubert                           "uithreads" (a.k.a solaris threads) and
155*e0c4386eSCy Schubert                           "winthreads".  Except for "(unknown)", the
156*e0c4386eSCy Schubert                           actual value is currently ignored but may
157*e0c4386eSCy Schubert                           be used in the future.  See further notes
158*e0c4386eSCy Schubert                           below [2].
159*e0c4386eSCy Schubert        dso_scheme      => The type of dynamic shared objects to build
160*e0c4386eSCy Schubert                           for.  This mostly comes into play with
161*e0c4386eSCy Schubert                           modules, but can be used for other purposes
162*e0c4386eSCy Schubert                           as well.  Valid values are "DLFCN"
163*e0c4386eSCy Schubert                           (dlopen() et al), "DLFCN_NO_H" (for systems
164*e0c4386eSCy Schubert                           that use dlopen() et al but do not have
165*e0c4386eSCy Schubert                           fcntl.h), "DL" (shl_load() et al), "WIN32"
166*e0c4386eSCy Schubert                           and "VMS".
167*e0c4386eSCy Schubert        asm_arch        => The architecture to be used for compiling assembly
168*e0c4386eSCy Schubert                           source.  This acts as a selector in build.info files.
169*e0c4386eSCy Schubert        uplink_arch     => The architecture to be used for compiling uplink
170*e0c4386eSCy Schubert                           source.  This acts as a selector in build.info files.
171*e0c4386eSCy Schubert                           This is separate from asm_arch because it's compiled
172*e0c4386eSCy Schubert                           even when 'no-asm' is given, even though it contains
173*e0c4386eSCy Schubert                           assembler source.
174*e0c4386eSCy Schubert        perlasm_scheme  => The perlasm method used to create the
175*e0c4386eSCy Schubert                           assembler files used when compiling with
176*e0c4386eSCy Schubert                           assembler implementations.
177*e0c4386eSCy Schubert        shared_target   => The shared library building method used.
178*e0c4386eSCy Schubert                           This serves multiple purposes:
179*e0c4386eSCy Schubert                           - as index for targets found in shared_info.pl.
180*e0c4386eSCy Schubert                           - as linker script generation selector.
181*e0c4386eSCy Schubert                           To serve both purposes, the index for shared_info.pl
182*e0c4386eSCy Schubert                           should end with '-shared', and this suffix will be
183*e0c4386eSCy Schubert                           removed for use as a linker script generation
184*e0c4386eSCy Schubert                           selector.  Note that the latter is only used if
185*e0c4386eSCy Schubert                           'shared_defflag' is defined.
186*e0c4386eSCy Schubert        build_scheme    => The scheme used to build up a Makefile.
187*e0c4386eSCy Schubert                           In its simplest form, the value is a string
188*e0c4386eSCy Schubert                           with the name of the build scheme.
189*e0c4386eSCy Schubert                           The value may also take the form of a list
190*e0c4386eSCy Schubert                           of strings, if the build_scheme is to have
191*e0c4386eSCy Schubert                           some options.  In this case, the first
192*e0c4386eSCy Schubert                           string in the list is the name of the build
193*e0c4386eSCy Schubert                           scheme.
194*e0c4386eSCy Schubert                           Currently recognised build scheme is "unified".
195*e0c4386eSCy Schubert                           For the "unified" build scheme, this item
196*e0c4386eSCy Schubert                           *must* be an array with the first being the
197*e0c4386eSCy Schubert                           word "unified" and the second being a word
198*e0c4386eSCy Schubert                           to identify the platform family.
199*e0c4386eSCy Schubert
200*e0c4386eSCy Schubert        multilib        => On systems that support having multiple
201*e0c4386eSCy Schubert                           implementations of a library (typically a
202*e0c4386eSCy Schubert                           32-bit and a 64-bit variant), this is used
203*e0c4386eSCy Schubert                           to have the different variants in different
204*e0c4386eSCy Schubert                           directories.
205*e0c4386eSCy Schubert
206*e0c4386eSCy Schubert        bn_ops          => Building options (was just bignum options in
207*e0c4386eSCy Schubert                           the earlier history of this option, hence the
208*e0c4386eSCy Schubert                           name). This is a string of words that describe
209*e0c4386eSCy Schubert                           algorithms' implementation parameters that
210*e0c4386eSCy Schubert                           are optimal for the designated target platform,
211*e0c4386eSCy Schubert                           such as the type of integers used to build up
212*e0c4386eSCy Schubert                           the bignum, different ways to implement certain
213*e0c4386eSCy Schubert                           ciphers and so on. To fully comprehend the
214*e0c4386eSCy Schubert                           meaning, the best is to read the affected
215*e0c4386eSCy Schubert                           source.
216*e0c4386eSCy Schubert                           The valid words are:
217*e0c4386eSCy Schubert
218*e0c4386eSCy Schubert                           THIRTY_TWO_BIT       bignum limbs are 32 bits,
219*e0c4386eSCy Schubert                                                this is default if no
220*e0c4386eSCy Schubert                                                option is specified, it
221*e0c4386eSCy Schubert                                                works on any supported
222*e0c4386eSCy Schubert                                                system [unless "wider"
223*e0c4386eSCy Schubert                                                limb size is implied in
224*e0c4386eSCy Schubert                                                assembly code];
225*e0c4386eSCy Schubert                           BN_LLONG             bignum limbs are 32 bits,
226*e0c4386eSCy Schubert                                                but 64-bit 'unsigned long
227*e0c4386eSCy Schubert                                                long' is used internally
228*e0c4386eSCy Schubert                                                in calculations;
229*e0c4386eSCy Schubert                           SIXTY_FOUR_BIT_LONG  bignum limbs are 64 bits
230*e0c4386eSCy Schubert                                                and sizeof(long) is 8;
231*e0c4386eSCy Schubert                           SIXTY_FOUR_BIT       bignums limbs are 64 bits,
232*e0c4386eSCy Schubert                                                but execution environment
233*e0c4386eSCy Schubert                                                is ILP32;
234*e0c4386eSCy Schubert                           RC4_CHAR             RC4 key schedule is made
235*e0c4386eSCy Schubert                                                up of 'unsigned char's;
236*e0c4386eSCy Schubert                                                Note: should not be used
237*e0c4386eSCy Schubert                                                for new configuration
238*e0c4386eSCy Schubert                                                targets
239*e0c4386eSCy Schubert                           RC4_INT              RC4 key schedule is made
240*e0c4386eSCy Schubert                                                up of 'unsigned int's;
241*e0c4386eSCy Schubert                                                Note: should not be used
242*e0c4386eSCy Schubert                                                for new configuration
243*e0c4386eSCy Schubert                                                targets
244*e0c4386eSCy Schubert
245*e0c4386eSCy Schubert[1] as part of the target configuration, one can have a key called
246*e0c4386eSCy Schubert  `inherit_from` that indicates what other configurations to inherit
247*e0c4386eSCy Schubert  data from.  These are resolved recursively.
248*e0c4386eSCy Schubert
249*e0c4386eSCy Schubert  Inheritance works as a set of default values that can be overridden
250*e0c4386eSCy Schubert  by corresponding key values in the inheriting configuration.
251*e0c4386eSCy Schubert
252*e0c4386eSCy Schubert  Note 1: any configuration table can be used as a template.
253*e0c4386eSCy Schubert  Note 2: pure templates have the attribute `template => 1` and
254*e0c4386eSCy Schubert          cannot be used as build targets.
255*e0c4386eSCy Schubert
256*e0c4386eSCy Schubert  If several configurations are given in the `inherit_from` array,
257*e0c4386eSCy Schubert  the values of same attribute are concatenated with space
258*e0c4386eSCy Schubert  separation.  With this, it's possible to have several smaller
259*e0c4386eSCy Schubert  templates for different configuration aspects that can be combined
260*e0c4386eSCy Schubert  into a complete configuration.
261*e0c4386eSCy Schubert
262*e0c4386eSCy Schubert  Instead of a scalar value or an array, a value can be a code block
263*e0c4386eSCy Schubert  of the form `sub { /* your code here */ }`.  This code block will
264*e0c4386eSCy Schubert  be called with the list of inherited values for that key as
265*e0c4386eSCy Schubert  arguments.  In fact, the concatenation of strings is really done
266*e0c4386eSCy Schubert  by using `sub { join(" ",@_) }` on the list of inherited values.
267*e0c4386eSCy Schubert
268*e0c4386eSCy Schubert  An example:
269*e0c4386eSCy Schubert
270*e0c4386eSCy Schubert        "foo" => {
271*e0c4386eSCy Schubert                template => 1,
272*e0c4386eSCy Schubert                haha => "ha ha",
273*e0c4386eSCy Schubert                hoho => "ho",
274*e0c4386eSCy Schubert                ignored => "This should not appear in the end result",
275*e0c4386eSCy Schubert        },
276*e0c4386eSCy Schubert        "bar" => {
277*e0c4386eSCy Schubert                template => 1,
278*e0c4386eSCy Schubert                haha => "ah",
279*e0c4386eSCy Schubert                hoho => "haho",
280*e0c4386eSCy Schubert                hehe => "hehe"
281*e0c4386eSCy Schubert        },
282*e0c4386eSCy Schubert        "laughter" => {
283*e0c4386eSCy Schubert                inherit_from => [ "foo", "bar" ],
284*e0c4386eSCy Schubert                hehe => sub { join(" ",(@_,"!!!")) },
285*e0c4386eSCy Schubert                ignored => "",
286*e0c4386eSCy Schubert        }
287*e0c4386eSCy Schubert
288*e0c4386eSCy Schubert        The entry for "laughter" will become as follows after processing:
289*e0c4386eSCy Schubert
290*e0c4386eSCy Schubert        "laughter" => {
291*e0c4386eSCy Schubert                haha => "ha ha ah",
292*e0c4386eSCy Schubert                hoho => "ho haho",
293*e0c4386eSCy Schubert                hehe => "hehe !!!",
294*e0c4386eSCy Schubert                ignored => ""
295*e0c4386eSCy Schubert        }
296*e0c4386eSCy Schubert
297*e0c4386eSCy Schubert[2] OpenSSL is built with threading capabilities unless the user
298*e0c4386eSCy Schubert  specifies `no-threads`.  The value of the key `thread_scheme` may
299*e0c4386eSCy Schubert  be `(unknown)`, in which case the user MUST give some compilation
300*e0c4386eSCy Schubert  flags to `Configure`.
301*e0c4386eSCy Schubert
302*e0c4386eSCy Schubert[3] OpenSSL has three types of things to link from object files or
303*e0c4386eSCy Schubert  static libraries:
304*e0c4386eSCy Schubert
305*e0c4386eSCy Schubert  - shared libraries; that would be libcrypto and libssl.
306*e0c4386eSCy Schubert  - shared objects (sometimes called dynamic libraries);  that would
307*e0c4386eSCy Schubert    be the modules.
308*e0c4386eSCy Schubert  - applications; those are apps/openssl and all the test apps.
309*e0c4386eSCy Schubert
310*e0c4386eSCy Schubert  Very roughly speaking, linking is done like this (words in braces
311*e0c4386eSCy Schubert  represent the configuration settings documented at the beginning
312*e0c4386eSCy Schubert  of this file):
313*e0c4386eSCy Schubert
314*e0c4386eSCy Schubert    shared libraries:
315*e0c4386eSCy Schubert        {ld} $(CFLAGS) {lflags} {shared_ldflag} -o libfoo.so \
316*e0c4386eSCy Schubert            foo/something.o foo/somethingelse.o {ex_libs}
317*e0c4386eSCy Schubert
318*e0c4386eSCy Schubert    shared objects:
319*e0c4386eSCy Schubert        {ld} $(CFLAGS) {lflags} {module_ldflags} -o libeng.so \
320*e0c4386eSCy Schubert            blah1.o blah2.o -lcrypto {ex_libs}
321*e0c4386eSCy Schubert
322*e0c4386eSCy Schubert    applications:
323*e0c4386eSCy Schubert        {ld} $(CFLAGS) {lflags} -o app \
324*e0c4386eSCy Schubert            app1.o utils.o -lssl -lcrypto {ex_libs}
325*e0c4386eSCy Schubert
326*e0c4386eSCy Schubert[4] There are variants of these attribute, prefixed with `lib_`,
327*e0c4386eSCy Schubert  `dso_` or `bin_`.  Those variants replace the unprefixed attribute
328*e0c4386eSCy Schubert  when building library, DSO or program modules specifically.
329*e0c4386eSCy Schubert
330*e0c4386eSCy SchubertHistorically, the target configurations came in form of a string with
331*e0c4386eSCy Schubertvalues separated by colons.  This use is deprecated.  The string form
332*e0c4386eSCy Schubertlooked like this:
333*e0c4386eSCy Schubert
334*e0c4386eSCy Schubert    "target" => "{cc}:{cflags}:{unistd}:{thread_cflag}:{sys_id}:{lflags}:
335*e0c4386eSCy Schubert                 {bn_ops}:{cpuid_obj}:{bn_obj}:{ec_obj}:{des_obj}:{aes_obj}:
336*e0c4386eSCy Schubert                 {bf_obj}:{md5_obj}:{sha1_obj}:{cast_obj}:{rc4_obj}:
337*e0c4386eSCy Schubert                 {rmd160_obj}:{rc5_obj}:{wp_obj}:{cmll_obj}:{modes_obj}:
338*e0c4386eSCy Schubert                 {padlock_obj}:{perlasm_scheme}:{dso_scheme}:{shared_target}:
339*e0c4386eSCy Schubert                 {shared_cflag}:{shared_ldflag}:{shared_extension}:{ranlib}:
340*e0c4386eSCy Schubert                 {arflags}:{multilib}"
341*e0c4386eSCy Schubert
342*e0c4386eSCy SchubertBuild info files
343*e0c4386eSCy Schubert================
344*e0c4386eSCy Schubert
345*e0c4386eSCy SchubertThe `build.info` files that are spread over the source tree contain the
346*e0c4386eSCy Schubertminimum information needed to build and distribute OpenSSL.  It uses a
347*e0c4386eSCy Schubertsimple and yet fairly powerful language to determine what needs to be
348*e0c4386eSCy Schubertbuilt, from what sources, and other relationships between files.
349*e0c4386eSCy Schubert
350*e0c4386eSCy SchubertFor every `build.info` file, all file references are relative to the
351*e0c4386eSCy Schubertdirectory of the `build.info` file for source files, and the
352*e0c4386eSCy Schubertcorresponding build directory for built files if the build tree
353*e0c4386eSCy Schubertdiffers from the source tree.
354*e0c4386eSCy Schubert
355*e0c4386eSCy SchubertWhen processed, every line is processed with the perl module
356*e0c4386eSCy SchubertText::Template, using the delimiters `{-` and `-}`.  The hashes
357*e0c4386eSCy Schubert`%config` and `%target` are passed to the perl fragments, along with
358*e0c4386eSCy Schubert$sourcedir and $builddir, which are the locations of the source
359*e0c4386eSCy Schubertdirectory for the current `build.info` file and the corresponding build
360*e0c4386eSCy Schubertdirectory, all relative to the top of the build tree.
361*e0c4386eSCy Schubert
362*e0c4386eSCy Schubert`Configure` only knows inherently about the top `build.info` file.  For
363*e0c4386eSCy Schubertany other directory that has one, further directories to look into
364*e0c4386eSCy Schubertmust be indicated like this:
365*e0c4386eSCy Schubert
366*e0c4386eSCy Schubert    SUBDIRS=something someelse
367*e0c4386eSCy Schubert
368*e0c4386eSCy SchubertOn to things to be built; they are declared by setting specific
369*e0c4386eSCy Schubertvariables:
370*e0c4386eSCy Schubert
371*e0c4386eSCy Schubert    PROGRAMS=foo bar
372*e0c4386eSCy Schubert    LIBS=libsomething
373*e0c4386eSCy Schubert    MODULES=libeng
374*e0c4386eSCy Schubert    SCRIPTS=myhack
375*e0c4386eSCy Schubert
376*e0c4386eSCy SchubertNote that the files mentioned for PROGRAMS, LIBS and MODULES *must* be
377*e0c4386eSCy Schubertwithout extensions.  The build file templates will figure them out.
378*e0c4386eSCy Schubert
379*e0c4386eSCy SchubertFor each thing to be built, it is then possible to say what sources
380*e0c4386eSCy Schubertthey are built from:
381*e0c4386eSCy Schubert
382*e0c4386eSCy Schubert    PROGRAMS=foo bar
383*e0c4386eSCy Schubert    SOURCE[foo]=foo.c common.c
384*e0c4386eSCy Schubert    SOURCE[bar]=bar.c extra.c common.c
385*e0c4386eSCy Schubert
386*e0c4386eSCy SchubertIt's also possible to tell some other dependencies:
387*e0c4386eSCy Schubert
388*e0c4386eSCy Schubert    DEPEND[foo]=libsomething
389*e0c4386eSCy Schubert    DEPEND[libbar]=libsomethingelse
390*e0c4386eSCy Schubert
391*e0c4386eSCy Schubert(it could be argued that 'libsomething' and 'libsomethingelse' are
392*e0c4386eSCy Schubertsource as well.  However, the files given through SOURCE are expected
393*e0c4386eSCy Schubertto be located in the source tree while files given through DEPEND are
394*e0c4386eSCy Schubertexpected to be located in the build tree)
395*e0c4386eSCy Schubert
396*e0c4386eSCy SchubertIt's also possible to depend on static libraries explicitly:
397*e0c4386eSCy Schubert
398*e0c4386eSCy Schubert    DEPEND[foo]=libsomething.a
399*e0c4386eSCy Schubert    DEPEND[libbar]=libsomethingelse.a
400*e0c4386eSCy Schubert
401*e0c4386eSCy SchubertThis should be rarely used, and care should be taken to make sure it's
402*e0c4386eSCy Schubertonly used when supported.  For example, native Windows build doesn't
403*e0c4386eSCy Schubertsupport building static libraries and DLLs at the same time, so using
404*e0c4386eSCy Schubertstatic libraries on Windows can only be done when configured
405*e0c4386eSCy Schubert`no-shared`.
406*e0c4386eSCy Schubert
407*e0c4386eSCy SchubertIn some cases, it's desirable to include some source files in the
408*e0c4386eSCy Schubertshared form of a library only:
409*e0c4386eSCy Schubert
410*e0c4386eSCy Schubert    SHARED_SOURCE[libfoo]=dllmain.c
411*e0c4386eSCy Schubert
412*e0c4386eSCy SchubertFor any file to be built, it's also possible to tell what extra
413*e0c4386eSCy Schubertinclude paths the build of their source files should use:
414*e0c4386eSCy Schubert
415*e0c4386eSCy Schubert    INCLUDE[foo]=include
416*e0c4386eSCy Schubert
417*e0c4386eSCy SchubertIt's also possible to specify C macros that should be defined:
418*e0c4386eSCy Schubert
419*e0c4386eSCy Schubert    DEFINE[foo]=FOO BAR=1
420*e0c4386eSCy Schubert
421*e0c4386eSCy SchubertIn some cases, one might want to generate some source files from
422*e0c4386eSCy Schubertothers, that's done as follows:
423*e0c4386eSCy Schubert
424*e0c4386eSCy Schubert    GENERATE[foo.s]=asm/something.pl $(CFLAGS)
425*e0c4386eSCy Schubert    GENERATE[bar.s]=asm/bar.S
426*e0c4386eSCy Schubert
427*e0c4386eSCy SchubertThe value of each GENERATE line is a command line or part of it.
428*e0c4386eSCy SchubertConfigure places no rules on the command line, except that the first
429*e0c4386eSCy Schubertitem must be the generator file.  It is, however, entirely up to the
430*e0c4386eSCy Schubertbuild file template to define exactly how those command lines should
431*e0c4386eSCy Schubertbe handled, how the output is captured and so on.
432*e0c4386eSCy Schubert
433*e0c4386eSCy SchubertSometimes, the generator file itself depends on other files, for
434*e0c4386eSCy Schubertexample if it is a perl script that depends on other perl modules.
435*e0c4386eSCy SchubertThis can be expressed using DEPEND like this:
436*e0c4386eSCy Schubert
437*e0c4386eSCy Schubert    DEPEND[asm/something.pl]=../perlasm/Foo.pm
438*e0c4386eSCy Schubert
439*e0c4386eSCy SchubertThere may also be cases where the exact file isn't easily specified,
440*e0c4386eSCy Schubertbut an inclusion directory still needs to be specified.  INCLUDE can
441*e0c4386eSCy Schubertbe used in that case:
442*e0c4386eSCy Schubert
443*e0c4386eSCy Schubert    INCLUDE[asm/something.pl]=../perlasm
444*e0c4386eSCy Schubert
445*e0c4386eSCy SchubertNOTE: GENERATE lines are limited to one command only per GENERATE.
446*e0c4386eSCy Schubert
447*e0c4386eSCy SchubertFinally, you can have some simple conditional use of the `build.info`
448*e0c4386eSCy Schubertinformation, looking like this:
449*e0c4386eSCy Schubert
450*e0c4386eSCy Schubert    IF[1]
451*e0c4386eSCy Schubert     something
452*e0c4386eSCy Schubert    ELSIF[2]
453*e0c4386eSCy Schubert     something other
454*e0c4386eSCy Schubert    ELSE
455*e0c4386eSCy Schubert     something else
456*e0c4386eSCy Schubert    ENDIF
457*e0c4386eSCy Schubert
458*e0c4386eSCy SchubertThe expression in square brackets is interpreted as a string in perl,
459*e0c4386eSCy Schubertand will be seen as true if perl thinks it is, otherwise false.  For
460*e0c4386eSCy Schubertexample, the above would have "something" used, since 1 is true.
461*e0c4386eSCy Schubert
462*e0c4386eSCy SchubertTogether with the use of Text::Template, this can be used as
463*e0c4386eSCy Schubertconditions based on something in the passed variables, for example:
464*e0c4386eSCy Schubert
465*e0c4386eSCy Schubert    IF[{- $disabled{shared} -}]
466*e0c4386eSCy Schubert      LIBS=libcrypto
467*e0c4386eSCy Schubert      SOURCE[libcrypto]=...
468*e0c4386eSCy Schubert    ELSE
469*e0c4386eSCy Schubert      LIBS=libfoo
470*e0c4386eSCy Schubert      SOURCE[libfoo]=...
471*e0c4386eSCy Schubert    ENDIF
472*e0c4386eSCy Schubert
473*e0c4386eSCy SchubertBuild-file programming with the "unified" build system
474*e0c4386eSCy Schubert======================================================
475*e0c4386eSCy Schubert
476*e0c4386eSCy Schubert"Build files" are called `Makefile` on Unix-like operating systems,
477*e0c4386eSCy Schubert`descrip.mms` for MMS on VMS, `makefile` for `nmake` on Windows, etc.
478*e0c4386eSCy Schubert
479*e0c4386eSCy SchubertTo use the "unified" build system, the target configuration needs to
480*e0c4386eSCy Schubertset the three items `build_scheme`, `build_file` and `build_command`.
481*e0c4386eSCy SchubertIn the rest of this section, we will assume that `build_scheme` is set
482*e0c4386eSCy Schubertto "unified" (see the configurations documentation above for the
483*e0c4386eSCy Schubertdetails).
484*e0c4386eSCy Schubert
485*e0c4386eSCy SchubertFor any name given by `build_file`, the "unified" system expects a
486*e0c4386eSCy Schuberttemplate file in `Configurations/` named like the build file, with
487*e0c4386eSCy Schubert`.tmpl` appended, or in case of possible ambiguity, a combination of
488*e0c4386eSCy Schubertthe second `build_scheme` list item and the `build_file` name.  For
489*e0c4386eSCy Schubertexample, if `build_file` is set to `Makefile`, the template could be
490*e0c4386eSCy Schubert`Configurations/Makefile.tmpl` or `Configurations/unix-Makefile.tmpl`.
491*e0c4386eSCy SchubertIn case both `Configurations/unix-Makefile.tmpl` and
492*e0c4386eSCy Schubert`Configurations/Makefile.tmpl` are present, the former takes precedence.
493*e0c4386eSCy Schubert
494*e0c4386eSCy SchubertThe build-file template is processed with the perl module
495*e0c4386eSCy SchubertText::Template, using `{-` and `-}` as delimiters that enclose the
496*e0c4386eSCy Schubertperl code fragments that generate configuration-dependent content.
497*e0c4386eSCy SchubertThose perl fragments have access to all the hash variables from
498*e0c4386eSCy Schubertconfigdata.pem.
499*e0c4386eSCy Schubert
500*e0c4386eSCy SchubertThe build-file template is expected to define at least the following
501*e0c4386eSCy Schubertperl functions in a perl code fragment enclosed with `{-` and `-}`.
502*e0c4386eSCy SchubertThey are all expected to return a string with the lines they produce.
503*e0c4386eSCy Schubert
504*e0c4386eSCy Schubert    generatesrc - function that produces build file lines to generate
505*e0c4386eSCy Schubert                  a source file from some input.
506*e0c4386eSCy Schubert
507*e0c4386eSCy Schubert                  It's called like this:
508*e0c4386eSCy Schubert
509*e0c4386eSCy Schubert                        generatesrc(src => "PATH/TO/tobegenerated",
510*e0c4386eSCy Schubert                                    generator => [ "generatingfile", ... ]
511*e0c4386eSCy Schubert                                    generator_incs => [ "INCL/PATH", ... ]
512*e0c4386eSCy Schubert                                    generator_deps => [ "dep1", ... ]
513*e0c4386eSCy Schubert                                    generator => [ "generatingfile", ... ]
514*e0c4386eSCy Schubert                                    incs => [ "INCL/PATH", ... ],
515*e0c4386eSCy Schubert                                    deps => [ "dep1", ... ],
516*e0c4386eSCy Schubert                                    intent => one of "libs", "dso", "bin" );
517*e0c4386eSCy Schubert
518*e0c4386eSCy Schubert                  'src' has the name of the file to be generated.
519*e0c4386eSCy Schubert                  'generator' is the command or part of command to
520*e0c4386eSCy Schubert                  generate the file, of which the first item is
521*e0c4386eSCy Schubert                  expected to be the file to generate from.
522*e0c4386eSCy Schubert                  generatesrc() is expected to analyse and figure out
523*e0c4386eSCy Schubert                  exactly how to apply that file and how to capture
524*e0c4386eSCy Schubert                  the result.  'generator_incs' and 'generator_deps'
525*e0c4386eSCy Schubert                  are include directories and files that the generator
526*e0c4386eSCy Schubert                  file itself depends on.  'incs' and 'deps' are
527*e0c4386eSCy Schubert                  include directories and files that are used if $(CC)
528*e0c4386eSCy Schubert                  is used as an intermediary step when generating the
529*e0c4386eSCy Schubert                  end product (the file indicated by 'src').  'intent'
530*e0c4386eSCy Schubert                  indicates what the generated file is going to be
531*e0c4386eSCy Schubert                  used for.
532*e0c4386eSCy Schubert
533*e0c4386eSCy Schubert    src2obj     - function that produces build file lines to build an
534*e0c4386eSCy Schubert                  object file from source files and associated data.
535*e0c4386eSCy Schubert
536*e0c4386eSCy Schubert                  It's called like this:
537*e0c4386eSCy Schubert
538*e0c4386eSCy Schubert                        src2obj(obj => "PATH/TO/objectfile",
539*e0c4386eSCy Schubert                                srcs => [ "PATH/TO/sourcefile", ... ],
540*e0c4386eSCy Schubert                                deps => [ "dep1", ... ],
541*e0c4386eSCy Schubert                                incs => [ "INCL/PATH", ... ]
542*e0c4386eSCy Schubert                                intent => one of "lib", "dso", "bin" );
543*e0c4386eSCy Schubert
544*e0c4386eSCy Schubert                  'obj' has the intended object file with '.o'
545*e0c4386eSCy Schubert                  extension, src2obj() is expected to change it to
546*e0c4386eSCy Schubert                  something more suitable for the platform.
547*e0c4386eSCy Schubert                  'srcs' has the list of source files to build the
548*e0c4386eSCy Schubert                  object file, with the first item being the source
549*e0c4386eSCy Schubert                  file that directly corresponds to the object file.
550*e0c4386eSCy Schubert                  'deps' is a list of explicit dependencies.  'incs'
551*e0c4386eSCy Schubert                  is a list of include file directories.  Finally,
552*e0c4386eSCy Schubert                  'intent' indicates what this object file is going
553*e0c4386eSCy Schubert                  to be used for.
554*e0c4386eSCy Schubert
555*e0c4386eSCy Schubert    obj2lib     - function that produces build file lines to build a
556*e0c4386eSCy Schubert                  static library file ("libfoo.a" in Unix terms) from
557*e0c4386eSCy Schubert                  object files.
558*e0c4386eSCy Schubert
559*e0c4386eSCy Schubert                  called like this:
560*e0c4386eSCy Schubert
561*e0c4386eSCy Schubert                        obj2lib(lib => "PATH/TO/libfile",
562*e0c4386eSCy Schubert                                objs => [ "PATH/TO/objectfile", ... ]);
563*e0c4386eSCy Schubert
564*e0c4386eSCy Schubert                  'lib' has the intended library file name *without*
565*e0c4386eSCy Schubert                  extension, obj2lib is expected to add that.  'objs'
566*e0c4386eSCy Schubert                  has the list of object files to build this library.
567*e0c4386eSCy Schubert
568*e0c4386eSCy Schubert    libobj2shlib - backward compatibility function that's used the
569*e0c4386eSCy Schubert                  same way as obj2shlib (described next), and was
570*e0c4386eSCy Schubert                  expected to build the shared library from the
571*e0c4386eSCy Schubert                  corresponding static library when that was suitable.
572*e0c4386eSCy Schubert                  NOTE: building a shared library from a static
573*e0c4386eSCy Schubert                  library is now DEPRECATED, as they no longer share
574*e0c4386eSCy Schubert                  object files.  Attempting to do this will fail.
575*e0c4386eSCy Schubert
576*e0c4386eSCy Schubert    obj2shlib   - function that produces build file lines to build a
577*e0c4386eSCy Schubert                  shareable object library file ("libfoo.so" in Unix
578*e0c4386eSCy Schubert                  terms) from the corresponding object files.
579*e0c4386eSCy Schubert
580*e0c4386eSCy Schubert                  called like this:
581*e0c4386eSCy Schubert
582*e0c4386eSCy Schubert                        obj2shlib(shlib => "PATH/TO/shlibfile",
583*e0c4386eSCy Schubert                                  lib => "PATH/TO/libfile",
584*e0c4386eSCy Schubert                                  objs => [ "PATH/TO/objectfile", ... ],
585*e0c4386eSCy Schubert                                  deps => [ "PATH/TO/otherlibfile", ... ]);
586*e0c4386eSCy Schubert
587*e0c4386eSCy Schubert                  'lib' has the base (static) library ffile name
588*e0c4386eSCy Schubert                  *without* extension.  This is useful in case
589*e0c4386eSCy Schubert                  supporting files are needed (such as import
590*e0c4386eSCy Schubert                  libraries on Windows).
591*e0c4386eSCy Schubert                  'shlib' has the corresponding shared library name
592*e0c4386eSCy Schubert                  *without* extension.  'deps' has the list of other
593*e0c4386eSCy Schubert                  libraries (also *without* extension) this library
594*e0c4386eSCy Schubert                  needs to be linked with.  'objs' has the list of
595*e0c4386eSCy Schubert                  object files to build this library.
596*e0c4386eSCy Schubert
597*e0c4386eSCy Schubert    obj2dso     - function that produces build file lines to build a
598*e0c4386eSCy Schubert                  dynamic shared object file from object files.
599*e0c4386eSCy Schubert
600*e0c4386eSCy Schubert                  called like this:
601*e0c4386eSCy Schubert
602*e0c4386eSCy Schubert                        obj2dso(lib => "PATH/TO/libfile",
603*e0c4386eSCy Schubert                                objs => [ "PATH/TO/objectfile", ... ],
604*e0c4386eSCy Schubert                                deps => [ "PATH/TO/otherlibfile",
605*e0c4386eSCy Schubert                                ... ]);
606*e0c4386eSCy Schubert
607*e0c4386eSCy Schubert                  This is almost the same as obj2shlib, but the
608*e0c4386eSCy Schubert                  intent is to build a shareable library that can be
609*e0c4386eSCy Schubert                  loaded in runtime (a "plugin"...).
610*e0c4386eSCy Schubert
611*e0c4386eSCy Schubert    obj2bin     - function that produces build file lines to build an
612*e0c4386eSCy Schubert                  executable file from object files.
613*e0c4386eSCy Schubert
614*e0c4386eSCy Schubert                  called like this:
615*e0c4386eSCy Schubert
616*e0c4386eSCy Schubert                        obj2bin(bin => "PATH/TO/binfile",
617*e0c4386eSCy Schubert                                objs => [ "PATH/TO/objectfile", ... ],
618*e0c4386eSCy Schubert                                deps => [ "PATH/TO/libfile", ... ]);
619*e0c4386eSCy Schubert
620*e0c4386eSCy Schubert                  'bin' has the intended executable file name
621*e0c4386eSCy Schubert                  *without* extension, obj2bin is expected to add
622*e0c4386eSCy Schubert                  that.  'objs' has the list of object files to build
623*e0c4386eSCy Schubert                  this library.  'deps' has the list of library files
624*e0c4386eSCy Schubert                  (also *without* extension) that the programs needs
625*e0c4386eSCy Schubert                  to be linked with.
626*e0c4386eSCy Schubert
627*e0c4386eSCy Schubert    in2script   - function that produces build file lines to build a
628*e0c4386eSCy Schubert                  script file from some input.
629*e0c4386eSCy Schubert
630*e0c4386eSCy Schubert                  called like this:
631*e0c4386eSCy Schubert
632*e0c4386eSCy Schubert                        in2script(script => "PATH/TO/scriptfile",
633*e0c4386eSCy Schubert                                  sources => [ "PATH/TO/infile", ... ]);
634*e0c4386eSCy Schubert
635*e0c4386eSCy Schubert                  'script' has the intended script file name.
636*e0c4386eSCy Schubert                  'sources' has the list of source files to build the
637*e0c4386eSCy Schubert                  resulting script from.
638*e0c4386eSCy Schubert
639*e0c4386eSCy SchubertIn all cases, file file paths are relative to the build tree top, and
640*e0c4386eSCy Schubertthe build file actions run with the build tree top as current working
641*e0c4386eSCy Schubertdirectory.
642*e0c4386eSCy Schubert
643*e0c4386eSCy SchubertMake sure to end the section with these functions with a string that
644*e0c4386eSCy Schubertyou thing is appropriate for the resulting build file.  If nothing
645*e0c4386eSCy Schubertelse, end it like this:
646*e0c4386eSCy Schubert
647*e0c4386eSCy Schubert      "";       # Make sure no lingering values end up in the Makefile
648*e0c4386eSCy Schubert    -}
649*e0c4386eSCy Schubert
650*e0c4386eSCy SchubertConfigure helper scripts
651*e0c4386eSCy Schubert========================
652*e0c4386eSCy Schubert
653*e0c4386eSCy SchubertConfigure uses helper scripts in this directory:
654*e0c4386eSCy Schubert
655*e0c4386eSCy SchubertChecker scripts
656*e0c4386eSCy Schubert---------------
657*e0c4386eSCy Schubert
658*e0c4386eSCy SchubertThese scripts are per platform family, to check the integrity of the
659*e0c4386eSCy Schuberttools used for configuration and building.  The checker script used is
660*e0c4386eSCy Schuberteither `{build_platform}-{build_file}-checker.pm` or
661*e0c4386eSCy Schubert`{build_platform}-checker.pm`, where `{build_platform}` is the second
662*e0c4386eSCy Schubert`build_scheme` list element from the configuration target data, and
663*e0c4386eSCy Schubert`{build_file}` is `build_file` from the same target data.
664*e0c4386eSCy Schubert
665*e0c4386eSCy SchubertIf the check succeeds, the script is expected to end with a non-zero
666*e0c4386eSCy Schubertexpression.  If the check fails, the script can end with a zero, or
667*e0c4386eSCy Schubertwith a `die`.
668