Blame Configurations/README.design

Packit c4476c
Design document for the unified scheme data
Packit c4476c
===========================================
Packit c4476c
Packit c4476c
How are things connected?
Packit c4476c
-------------------------
Packit c4476c
Packit c4476c
The unified scheme takes all its data from the build.info files seen
Packit c4476c
throughout the source tree.  These files hold the minimum information
Packit c4476c
needed to build end product files from diverse sources.  See the
Packit c4476c
section on build.info files below.
Packit c4476c
Packit c4476c
From the information in build.info files, Configure builds up an
Packit c4476c
information database as a hash table called %unified_info, which is
Packit c4476c
stored in configdata.pm, found at the top of the build tree (which may
Packit c4476c
or may not be the same as the source tree).
Packit c4476c
Packit c4476c
Configurations/common.tmpl uses the data from %unified_info to
Packit c4476c
generate the rules for building end product files as well as
Packit c4476c
intermediary files with the help of a few functions found in the
Packit c4476c
build-file templates.  See the section on build-file templates further
Packit c4476c
down for more information.
Packit c4476c
Packit c4476c
build.info files
Packit c4476c
----------------
Packit c4476c
Packit c4476c
As mentioned earlier, build.info files are meant to hold the minimum
Packit c4476c
information needed to build output files, and therefore only (with a
Packit c4476c
few possible exceptions [1]) have information about end products (such
Packit c4476c
as scripts, library files and programs) and source files (such as C
Packit c4476c
files, C header files, assembler files, etc).  Intermediate files such
Packit c4476c
as object files are rarely directly referred to in build.info files (and
Packit c4476c
when they are, it's always with the file name extension .o), they are
Packit c4476c
inferred by Configure.  By the same rule of minimalism, end product
Packit c4476c
file name extensions (such as .so, .a, .exe, etc) are never mentioned
Packit c4476c
in build.info.  Their file name extensions will be inferred by the
Packit c4476c
build-file templates, adapted for the platform they are meant for (see
Packit c4476c
sections on %unified_info and build-file templates further down).
Packit c4476c
Packit c4476c
The variables PROGRAMS, LIBS, ENGINES and SCRIPTS are used to declare
Packit c4476c
end products.  There are variants for them with '_NO_INST' as suffix
Packit c4476c
(PROGRAM_NO_INST etc) to specify end products that shouldn't get
Packit c4476c
installed.
Packit c4476c
Packit c4476c
The variables SOURCE, DEPEND and INCLUDE are indexed by a produced
Packit c4476c
file, and their values are the source used to produce that particular
Packit c4476c
produced file, extra dependencies, and include directories needed.
Packit c4476c
Packit c4476c
All their values in all the build.info throughout the source tree are
Packit c4476c
collected together and form a set of programs, libraries, engines and
Packit c4476c
scripts to be produced, source files, dependencies, etc etc etc.
Packit c4476c
Packit c4476c
Let's have a pretend example, a very limited contraption of OpenSSL,
Packit c4476c
composed of the program 'apps/openssl', the libraries 'libssl' and
Packit c4476c
'libcrypto', an engine 'engines/ossltest' and their sources and
Packit c4476c
dependencies.
Packit c4476c
Packit c4476c
    # build.info
Packit c4476c
    LIBS=libcrypto libssl
Packit c4476c
    INCLUDE[libcrypto]=include
Packit c4476c
    INCLUDE[libssl]=include
Packit c4476c
    DEPEND[libssl]=libcrypto
Packit c4476c
Packit c4476c
This is the top directory build.info file, and it tells us that two
Packit c4476c
libraries are to be built, the include directory 'include/' shall be
Packit c4476c
used throughout when building anything that will end up in each
Packit c4476c
library, and that the library 'libssl' depend on the library
Packit c4476c
'libcrypto' to function properly.
Packit c4476c
Packit c4476c
    # apps/build.info
Packit c4476c
    PROGRAMS=openssl
Packit c4476c
    SOURCE[openssl]=openssl.c
Packit c4476c
    INCLUDE[openssl]=.. ../include
Packit c4476c
    DEPEND[openssl]=../libssl
Packit c4476c
Packit c4476c
This is the build.info file in 'apps/', one may notice that all file
Packit c4476c
paths mentioned are relative to the directory the build.info file is
Packit c4476c
located in.  This one tells us that there's a program to be built
Packit c4476c
called 'apps/openssl' (the file name extension will depend on the
Packit c4476c
platform and is therefore not mentioned in the build.info file).  It's
Packit c4476c
built from one source file, 'apps/openssl.c', and building it requires
Packit c4476c
the use of '.' and 'include' include directories (both are declared
Packit c4476c
from the point of view of the 'apps/' directory), and that the program
Packit c4476c
depends on the library 'libssl' to function properly.
Packit c4476c
Packit c4476c
    # crypto/build.info
Packit c4476c
    LIBS=../libcrypto
Packit c4476c
    SOURCE[../libcrypto]=aes.c evp.c cversion.c
Packit c4476c
    DEPEND[cversion.o]=buildinf.h
Packit c4476c
Packit c4476c
    GENERATE[buildinf.h]=../util/mkbuildinf.pl "$(CC) $(CFLAGS)" "$(PLATFORM)"
Packit c4476c
    DEPEND[buildinf.h]=../Makefile
Packit c4476c
    DEPEND[../util/mkbuildinf.pl]=../util/Foo.pm
Packit c4476c
Packit c4476c
This is the build.info file in 'crypto', and it tells us a little more
Packit c4476c
about what's needed to produce 'libcrypto'.  LIBS is used again to
Packit c4476c
declare that 'libcrypto' is to be produced.  This declaration is
Packit c4476c
really unnecessary as it's already mentioned in the top build.info
Packit c4476c
file, but can make the info file easier to understand.  This is to
Packit c4476c
show that duplicate information isn't an issue.
Packit c4476c
Packit c4476c
This build.info file informs us that 'libcrypto' is built from a few
Packit c4476c
source files, 'crypto/aes.c', 'crypto/evp.c' and 'crypto/cversion.c'.
Packit c4476c
It also shows us that building the object file inferred from
Packit c4476c
'crypto/cversion.c' depends on 'crypto/buildinf.h'.  Finally, it
Packit c4476c
also shows the possibility to declare how some files are generated
Packit c4476c
using some script, in this case a perl script, and how such scripts
Packit c4476c
can be declared to depend on other files, in this case a perl module.
Packit c4476c
Packit c4476c
Two things are worth an extra note:
Packit c4476c
Packit c4476c
'DEPEND[cversion.o]' mentions an object file.  DEPEND indexes is the
Packit c4476c
only location where it's valid to mention them
Packit c4476c
Packit c4476c
Lines in 'BEGINRAW'..'ENDRAW' sections must always mention files as
Packit c4476c
seen from the top directory, no exception.
Packit c4476c
Packit c4476c
    # ssl/build.info
Packit c4476c
    LIBS=../libssl
Packit c4476c
    SOURCE[../libssl]=tls.c
Packit c4476c
Packit c4476c
This is the build.info file in 'ssl/', and it tells us that the
Packit c4476c
library 'libssl' is built from the source file 'ssl/tls.c'.
Packit c4476c
Packit c4476c
    # engines/build.info
Packit c4476c
    ENGINES=dasync
Packit c4476c
    SOURCE[dasync]=e_dasync.c
Packit c4476c
    DEPEND[dasync]=../libcrypto
Packit c4476c
    INCLUDE[dasync]=../include
Packit c4476c
Packit c4476c
    ENGINES_NO_INST=ossltest
Packit c4476c
    SOURCE[ossltest]=e_ossltest.c
Packit c4476c
    DEPEND[ossltest]=../libcrypto.a
Packit c4476c
    INCLUDE[ossltest]=../include
Packit c4476c
Packit c4476c
This is the build.info file in 'engines/', telling us that two engines
Packit c4476c
called 'engines/dasync' and 'engines/ossltest' shall be built, that
Packit c4476c
dasync's source is 'engines/e_dasync.c' and ossltest's source is
Packit c4476c
'engines/e_ossltest.c' and that the include directory 'include/' may
Packit c4476c
be used when building anything that will be part of these engines.
Packit c4476c
Also, both engines depend on the library 'libcrypto' to function
Packit c4476c
properly.  ossltest is explicitly linked with the static variant of
Packit c4476c
the library 'libcrypto'.  Finally, only dasync is being installed, as
Packit c4476c
ossltest is only for internal testing.
Packit c4476c
Packit c4476c
When Configure digests these build.info files, the accumulated
Packit c4476c
information comes down to this:
Packit c4476c
Packit c4476c
    LIBS=libcrypto libssl
Packit c4476c
    SOURCE[libcrypto]=crypto/aes.c crypto/evp.c crypto/cversion.c
Packit c4476c
    DEPEND[crypto/cversion.o]=crypto/buildinf.h
Packit c4476c
    INCLUDE[libcrypto]=include
Packit c4476c
    SOURCE[libssl]=ssl/tls.c
Packit c4476c
    INCLUDE[libssl]=include
Packit c4476c
    DEPEND[libssl]=libcrypto
Packit c4476c
Packit c4476c
    PROGRAMS=apps/openssl
Packit c4476c
    SOURCE[apps/openssl]=apps/openssl.c
Packit c4476c
    INCLUDE[apps/openssl]=. include
Packit c4476c
    DEPEND[apps/openssl]=libssl
Packit c4476c
Packit c4476c
    ENGINES=engines/dasync
Packit c4476c
    SOURCE[engines/dasync]=engines/e_dasync.c
Packit c4476c
    DEPEND[engines/dasync]=libcrypto
Packit c4476c
    INCLUDE[engines/dasync]=include
Packit c4476c
Packit c4476c
    ENGINES_NO_INST=engines/ossltest
Packit c4476c
    SOURCE[engines/ossltest]=engines/e_ossltest.c
Packit c4476c
    DEPEND[engines/ossltest]=libcrypto.a
Packit c4476c
    INCLUDE[engines/ossltest]=include
Packit c4476c
Packit c4476c
    GENERATE[crypto/buildinf.h]=util/mkbuildinf.pl "$(CC) $(CFLAGS)" "$(PLATFORM)"
Packit c4476c
    DEPEND[crypto/buildinf.h]=Makefile
Packit c4476c
    DEPEND[util/mkbuildinf.pl]=util/Foo.pm
Packit c4476c
Packit c4476c
Packit c4476c
A few notes worth mentioning:
Packit c4476c
Packit c4476c
LIBS may be used to declare routine libraries only.
Packit c4476c
Packit c4476c
PROGRAMS may be used to declare programs only.
Packit c4476c
Packit c4476c
ENGINES may be used to declare engines only.
Packit c4476c
Packit c4476c
The indexes for SOURCE must only be end product files, such as
Packit c4476c
libraries, programs or engines.  The values of SOURCE variables must
Packit c4476c
only be source files (possibly generated).
Packit c4476c
Packit c4476c
INCLUDE and DEPEND shows a relationship between different files
Packit c4476c
(usually produced files) or between files and directories, such as a
Packit c4476c
program depending on a library, or between an object file and some
Packit c4476c
extra source file.
Packit c4476c
Packit c4476c
When Configure processes the build.info files, it will take it as
Packit c4476c
truth without question, and will therefore perform very few checks.
Packit c4476c
If the build tree is separate from the source tree, it will assume
Packit c4476c
that all built files and up in the build directory and that all source
Packit c4476c
files are to be found in the source tree, if they can be found there.
Packit c4476c
Configure will assume that source files that can't be found in the
Packit c4476c
source tree (such as 'crypto/bildinf.h' in the example above) are
Packit c4476c
generated and will be found in the build tree.
Packit c4476c
Packit c4476c
Packit c4476c
The %unified_info database
Packit c4476c
--------------------------
Packit c4476c
Packit c4476c
The information in all the build.info get digested by Configure and
Packit c4476c
collected into the %unified_info database, divided into the following
Packit c4476c
indexes:
Packit c4476c
Packit c4476c
  depends   => a hash table containing 'file' => [ 'dependency' ... ]
Packit c4476c
               pairs.  These are directly inferred from the DEPEND
Packit c4476c
               variables in build.info files.
Packit c4476c
Packit c4476c
  engines   => a list of engines.  These are directly inferred from
Packit c4476c
               the ENGINES variable in build.info files.
Packit c4476c
Packit c4476c
  generate  => a hash table containing 'file' => [ 'generator' ... ]
Packit c4476c
               pairs.  These are directly inferred from the GENERATE
Packit c4476c
               variables in build.info files.
Packit c4476c
Packit c4476c
  includes  => a hash table containing 'file' => [ 'include' ... ]
Packit c4476c
               pairs.  These are directly inferred from the INCLUDE
Packit c4476c
               variables in build.info files.
Packit c4476c
Packit c4476c
  install   => a hash table containing 'type' => [ 'file' ... ] pairs.
Packit c4476c
               The types are 'programs', 'libraries', 'engines' and
Packit c4476c
               'scripts', and the array of files list the files of
Packit c4476c
               that type that should be installed.
Packit c4476c
Packit c4476c
  libraries => a list of libraries.  These are directly inferred from
Packit c4476c
               the LIBS variable in build.info files.
Packit c4476c
Packit c4476c
  programs  => a list of programs.  These are directly inferred from
Packit c4476c
               the PROGRAMS variable in build.info files.
Packit c4476c
Packit c4476c
  rawlines  => a list of build-file lines.  These are a direct copy of
Packit c4476c
               the BEGINRAW..ENDRAW lines in build.info files.  Note:
Packit c4476c
               only the BEGINRAW..ENDRAW section for the current
Packit c4476c
               platform are copied, the rest are ignored.
Packit c4476c
Packit c4476c
  scripts   => a list of scripts.  There are directly inferred from
Packit c4476c
               the SCRIPTS variable in build.info files.
Packit c4476c
Packit c4476c
  sources   => a hash table containing 'file' => [ 'sourcefile' ... ]
Packit c4476c
               pairs.  These are indirectly inferred from the SOURCE
Packit c4476c
               variables in build.info files.  Object files are
Packit c4476c
               mentioned in this hash table, with source files from
Packit c4476c
               SOURCE variables, and AS source files for programs and
Packit c4476c
               libraries.
Packit c4476c
Packit c4476c
  shared_sources =>
Packit c4476c
               a hash table just like 'sources', but only as source
Packit c4476c
               files (object files) for building shared libraries.
Packit c4476c
Packit c4476c
As an example, here is how the build.info files example from the
Packit c4476c
section above would be digested into a %unified_info table:
Packit c4476c
Packit c4476c
    our %unified_info = (
Packit c4476c
        "depends" =>
Packit c4476c
            {
Packit c4476c
                "apps/openssl" =>
Packit c4476c
                    [
Packit c4476c
                        "libssl",
Packit c4476c
                    ],
Packit c4476c
                "crypto/buildinf.h" =>
Packit c4476c
                    [
Packit c4476c
                        "Makefile",
Packit c4476c
                    ],
Packit c4476c
                "crypto/cversion.o" =>
Packit c4476c
                    [
Packit c4476c
                        "crypto/buildinf.h",
Packit c4476c
                    ],
Packit c4476c
                "engines/dasync" =>
Packit c4476c
                    [
Packit c4476c
                        "libcrypto",
Packit c4476c
                    ],
Packit c4476c
                "engines/ossltest" =>
Packit c4476c
                    [
Packit c4476c
                        "libcrypto.a",
Packit c4476c
                    ],
Packit c4476c
                "libssl" =>
Packit c4476c
                    [
Packit c4476c
                        "libcrypto",
Packit c4476c
                    ],
Packit c4476c
                "util/mkbuildinf.pl" =>
Packit c4476c
                    [
Packit c4476c
                        "util/Foo.pm",
Packit c4476c
                    ],
Packit c4476c
            },
Packit c4476c
        "engines" =>
Packit c4476c
            [
Packit c4476c
                "engines/dasync",
Packit c4476c
                "engines/ossltest",
Packit c4476c
            ],
Packit c4476c
        "generate" =>
Packit c4476c
            {
Packit c4476c
                "crypto/buildinf.h" =>
Packit c4476c
                    [
Packit c4476c
                        "util/mkbuildinf.pl",
Packit c4476c
                        "\"\$(CC)",
Packit c4476c
                        "\$(CFLAGS)\"",
Packit c4476c
                        "\"$(PLATFORM)\"",
Packit c4476c
                    ],
Packit c4476c
            },
Packit c4476c
        "includes" =>
Packit c4476c
            {
Packit c4476c
                "apps/openssl" =>
Packit c4476c
                    [
Packit c4476c
                        ".",
Packit c4476c
                        "include",
Packit c4476c
                    ],
Packit c4476c
                "engines/ossltest" =>
Packit c4476c
                    [
Packit c4476c
                        "include"
Packit c4476c
                    ],
Packit c4476c
                "libcrypto" =>
Packit c4476c
                    [
Packit c4476c
                        "include",
Packit c4476c
                    ],
Packit c4476c
                "libssl" =>
Packit c4476c
                    [
Packit c4476c
                        "include",
Packit c4476c
                    ],
Packit c4476c
                "util/mkbuildinf.pl" =>
Packit c4476c
                    [
Packit c4476c
                        "util",
Packit c4476c
                    ],
Packit c4476c
            }
Packit c4476c
        "install" =>
Packit c4476c
            {
Packit c4476c
                "engines" =>
Packit c4476c
                    [
Packit c4476c
                        "engines/dasync",
Packit c4476c
                    ],
Packit c4476c
                "libraries" =>
Packit c4476c
                    [
Packit c4476c
                        "libcrypto",
Packit c4476c
                        "libssl",
Packit c4476c
                    ],
Packit c4476c
                "programs" =>
Packit c4476c
                    [
Packit c4476c
                        "apps/openssl",
Packit c4476c
                    ],
Packit c4476c
           },
Packit c4476c
        "libraries" =>
Packit c4476c
            [
Packit c4476c
                "libcrypto",
Packit c4476c
                "libssl",
Packit c4476c
            ],
Packit c4476c
        "programs" =>
Packit c4476c
            [
Packit c4476c
                "apps/openssl",
Packit c4476c
            ],
Packit c4476c
        "rawlines" =>
Packit c4476c
            [
Packit c4476c
            ],
Packit c4476c
        "sources" =>
Packit c4476c
            {
Packit c4476c
                "apps/openssl" =>
Packit c4476c
                    [
Packit c4476c
                        "apps/openssl.o",
Packit c4476c
                    ],
Packit c4476c
                "apps/openssl.o" =>
Packit c4476c
                    [
Packit c4476c
                        "apps/openssl.c",
Packit c4476c
                    ],
Packit c4476c
                "crypto/aes.o" =>
Packit c4476c
                    [
Packit c4476c
                        "crypto/aes.c",
Packit c4476c
                    ],
Packit c4476c
                "crypto/cversion.o" =>
Packit c4476c
                    [
Packit c4476c
                        "crypto/cversion.c",
Packit c4476c
                    ],
Packit c4476c
                "crypto/evp.o" =>
Packit c4476c
                    [
Packit c4476c
                        "crypto/evp.c",
Packit c4476c
                    ],
Packit c4476c
                "engines/e_dasync.o" =>
Packit c4476c
                    [
Packit c4476c
                        "engines/e_dasync.c",
Packit c4476c
                    ],
Packit c4476c
                "engines/dasync" =>
Packit c4476c
                    [
Packit c4476c
                        "engines/e_dasync.o",
Packit c4476c
                    ],
Packit c4476c
                "engines/e_ossltest.o" =>
Packit c4476c
                    [
Packit c4476c
                        "engines/e_ossltest.c",
Packit c4476c
                    ],
Packit c4476c
                "engines/ossltest" =>
Packit c4476c
                    [
Packit c4476c
                        "engines/e_ossltest.o",
Packit c4476c
                    ],
Packit c4476c
                "libcrypto" =>
Packit c4476c
                    [
Packit c4476c
                        "crypto/aes.c",
Packit c4476c
                        "crypto/cversion.c",
Packit c4476c
                        "crypto/evp.c",
Packit c4476c
                    ],
Packit c4476c
                "libssl" =>
Packit c4476c
                    [
Packit c4476c
                        "ssl/tls.c",
Packit c4476c
                    ],
Packit c4476c
                "ssl/tls.o" =>
Packit c4476c
                    [
Packit c4476c
                        "ssl/tls.c",
Packit c4476c
                    ],
Packit c4476c
            },
Packit c4476c
    );
Packit c4476c
Packit c4476c
As can be seen, everything in %unified_info is fairly simple suggest
Packit c4476c
of information.  Still, it tells us that to build all programs, we
Packit c4476c
must build 'apps/openssl', and to build the latter, we will need to
Packit c4476c
build all its sources ('apps/openssl.o' in this case) and all the
Packit c4476c
other things it depends on (such as 'libssl').  All those dependencies
Packit c4476c
need to be built as well, using the same logic, so to build 'libssl',
Packit c4476c
we need to build 'ssl/tls.o' as well as 'libcrypto', and to build the
Packit c4476c
latter...
Packit c4476c
Packit c4476c
Packit c4476c
Build-file templates
Packit c4476c
--------------------
Packit c4476c
Packit c4476c
Build-file templates are essentially build-files (such as Makefile on
Packit c4476c
Unix) with perl code fragments mixed in.  Those perl code fragment
Packit c4476c
will generate all the configuration dependent data, including all the
Packit c4476c
rules needed to build end product files and intermediary files alike.
Packit c4476c
At a minimum, there must be a perl code fragment that defines a set of
Packit c4476c
functions that are used to generates specific build-file rules, to
Packit c4476c
build static libraries from object files, to build shared libraries
Packit c4476c
from static libraries, to programs from object files and libraries,
Packit c4476c
etc.
Packit c4476c
Packit c4476c
    generatesrc - function that produces build file lines to generate
Packit c4476c
                  a source file from some input.
Packit c4476c
Packit c4476c
                  It's called like this:
Packit c4476c
Packit c4476c
                        generatesrc(src => "PATH/TO/tobegenerated",
Packit c4476c
                                    generator => [ "generatingfile", ... ]
Packit c4476c
                                    generator_incs => [ "INCL/PATH", ... ]
Packit c4476c
                                    generator_deps => [ "dep1", ... ]
Packit c4476c
                                    incs => [ "INCL/PATH", ... ],
Packit c4476c
                                    deps => [ "dep1", ... ],
Packit c4476c
                                    intent => one of "libs", "dso", "bin" );
Packit c4476c
Packit c4476c
                  'src' has the name of the file to be generated.
Packit c4476c
                  'generator' is the command or part of command to
Packit c4476c
                  generate the file, of which the first item is
Packit c4476c
                  expected to be the file to generate from.
Packit c4476c
                  generatesrc() is expected to analyse and figure out
Packit c4476c
                  exactly how to apply that file and how to capture
Packit c4476c
                  the result.  'generator_incs' and 'generator_deps'
Packit c4476c
                  are include directories and files that the generator
Packit c4476c
                  file itself depends on.  'incs' and 'deps' are
Packit c4476c
                  include directories and files that are used if $(CC)
Packit c4476c
                  is used as an intermediary step when generating the
Packit c4476c
                  end product (the file indicated by 'src').  'intent'
Packit c4476c
                  indicates what the generated file is going to be
Packit c4476c
                  used for.
Packit c4476c
Packit c4476c
    src2obj     - function that produces build file lines to build an
Packit c4476c
                  object file from source files and associated data.
Packit c4476c
Packit c4476c
                  It's called like this:
Packit c4476c
Packit c4476c
                        src2obj(obj => "PATH/TO/objectfile",
Packit c4476c
                                srcs => [ "PATH/TO/sourcefile", ... ],
Packit c4476c
                                deps => [ "dep1", ... ],
Packit c4476c
                                incs => [ "INCL/PATH", ... ]
Packit c4476c
                                intent => one of "lib", "dso", "bin" );
Packit c4476c
Packit c4476c
                  'obj' has the intended object file *without*
Packit c4476c
                  extension, src2obj() is expected to add that.
Packit c4476c
                  'srcs' has the list of source files to build the
Packit c4476c
                  object file, with the first item being the source
Packit c4476c
                  file that directly corresponds to the object file.
Packit c4476c
                  'deps' is a list of explicit dependencies.  'incs'
Packit c4476c
                  is a list of include file directories.  Finally,
Packit c4476c
                  'intent' indicates what this object file is going
Packit c4476c
                  to be used for.
Packit c4476c
Packit c4476c
    obj2lib     - function that produces build file lines to build a
Packit c4476c
                  static library file ("libfoo.a" in Unix terms) from
Packit c4476c
                  object files.
Packit c4476c
Packit c4476c
                  called like this:
Packit c4476c
Packit c4476c
                        obj2lib(lib => "PATH/TO/libfile",
Packit c4476c
                                objs => [ "PATH/TO/objectfile", ... ]);
Packit c4476c
Packit c4476c
                  'lib' has the intended library file name *without*
Packit c4476c
                  extension, obj2lib is expected to add that.  'objs'
Packit c4476c
                  has the list of object files (also *without*
Packit c4476c
                  extension) to build this library.
Packit c4476c
Packit c4476c
    libobj2shlib - function that produces build file lines to build a
Packit c4476c
                  shareable object library file ("libfoo.so" in Unix
Packit c4476c
                  terms) from the corresponding static library file
Packit c4476c
                  or object files.
Packit c4476c
Packit c4476c
                  called like this:
Packit c4476c
Packit c4476c
                        libobj2shlib(shlib => "PATH/TO/shlibfile",
Packit c4476c
                                     lib => "PATH/TO/libfile",
Packit c4476c
                                     objs => [ "PATH/TO/objectfile", ... ],
Packit c4476c
                                     deps => [ "PATH/TO/otherlibfile", ... ]);
Packit c4476c
Packit c4476c
                  'lib' has the intended library file name *without*
Packit c4476c
                  extension, libobj2shlib is expected to add that.
Packit c4476c
                  'shlib' has the corresponding shared library name
Packit c4476c
                  *without* extension.  'deps' has the list of other
Packit c4476c
                  libraries (also *without* extension) this library
Packit c4476c
                  needs to be linked with.  'objs' has the list of
Packit c4476c
                  object files (also *without* extension) to build
Packit c4476c
                  this library.
Packit c4476c
Packit c4476c
                  This function has a choice; it can use the
Packit c4476c
                  corresponding static library as input to make the
Packit c4476c
                  shared library, or the list of object files.
Packit c4476c
Packit c4476c
    obj2dynlib  - function that produces build file lines to build a
Packit c4476c
                  dynamically loadable library file ("libfoo.so" on
Packit c4476c
                  Unix) from object files.
Packit c4476c
Packit c4476c
                  called like this:
Packit c4476c
Packit c4476c
                        obj2dynlib(lib => "PATH/TO/libfile",
Packit c4476c
                                   objs => [ "PATH/TO/objectfile", ... ],
Packit c4476c
                                   deps => [ "PATH/TO/otherlibfile",
Packit c4476c
                                   ... ]);
Packit c4476c
Packit c4476c
                  This is almost the same as libobj2shlib, but the
Packit c4476c
                  intent is to build a shareable library that can be
Packit c4476c
                  loaded in runtime (a "plugin"...).  The differences
Packit c4476c
                  are subtle, one of the most visible ones is that the
Packit c4476c
                  resulting shareable library is produced from object
Packit c4476c
                  files only.
Packit c4476c
Packit c4476c
    obj2bin     - function that produces build file lines to build an
Packit c4476c
                  executable file from object files.
Packit c4476c
Packit c4476c
                  called like this:
Packit c4476c
Packit c4476c
                        obj2bin(bin => "PATH/TO/binfile",
Packit c4476c
                                objs => [ "PATH/TO/objectfile", ... ],
Packit c4476c
                                deps => [ "PATH/TO/libfile", ... ]);
Packit c4476c
Packit c4476c
                  'bin' has the intended executable file name
Packit c4476c
                  *without* extension, obj2bin is expected to add
Packit c4476c
                  that.  'objs' has the list of object files (also
Packit c4476c
                  *without* extension) to build this library.  'deps'
Packit c4476c
                  has the list of library files (also *without*
Packit c4476c
                  extension) that the programs needs to be linked
Packit c4476c
                  with.
Packit c4476c
Packit c4476c
    in2script   - function that produces build file lines to build a
Packit c4476c
                  script file from some input.
Packit c4476c
Packit c4476c
                  called like this:
Packit c4476c
Packit c4476c
                        in2script(script => "PATH/TO/scriptfile",
Packit c4476c
                                  sources => [ "PATH/TO/infile", ... ]);
Packit c4476c
Packit c4476c
                  'script' has the intended script file name.
Packit c4476c
                  'sources' has the list of source files to build the
Packit c4476c
                  resulting script from.
Packit c4476c
Packit c4476c
Along with the build-file templates is the driving engine
Packit c4476c
Configurations/common.tmpl, which looks through all the information in
Packit c4476c
%unified_info and generates all the rulesets to build libraries,
Packit c4476c
programs and all intermediate files, using the rule generating
Packit c4476c
functions defined in the build-file template.
Packit c4476c
Packit c4476c
As an example with the smaller build.info set we've seen as an
Packit c4476c
example, producing the rules to build 'libcrypto' would result in the
Packit c4476c
following calls:
Packit c4476c
Packit c4476c
    # Note: libobj2shlib will only be called if shared libraries are
Packit c4476c
    # to be produced.
Packit c4476c
    # Note 2: libobj2shlib gets both the name of the static library
Packit c4476c
    # and the names of all the object files that go into it.  It's up
Packit c4476c
    # to the implementation to decide which to use as input.
Packit c4476c
    # Note 3: common.tmpl peals off the ".o" extension from all object
Packit c4476c
    # files, as the platform at hand may have a different one.
Packit c4476c
    libobj2shlib(shlib => "libcrypto",
Packit c4476c
                 lib => "libcrypto",
Packit c4476c
                 objs => [ "crypto/aes", "crypto/evp", "crypto/cversion" ],
Packit c4476c
                 deps => [  ]);
Packit c4476c
Packit c4476c
    obj2lib(lib => "libcrypto"
Packit c4476c
            objs => [ "crypto/aes", "crypto/evp", "crypto/cversion" ]);
Packit c4476c
Packit c4476c
    src2obj(obj => "crypto/aes"
Packit c4476c
            srcs => [ "crypto/aes.c" ],
Packit c4476c
            deps => [ ],
Packit c4476c
            incs => [ "include" ],
Packit c4476c
            intent => "lib");
Packit c4476c
Packit c4476c
    src2obj(obj => "crypto/evp"
Packit c4476c
            srcs => [ "crypto/evp.c" ],
Packit c4476c
            deps => [ ],
Packit c4476c
            incs => [ "include" ],
Packit c4476c
            intent => "lib");
Packit c4476c
Packit c4476c
    src2obj(obj => "crypto/cversion"
Packit c4476c
            srcs => [ "crypto/cversion.c" ],
Packit c4476c
            deps => [ "crypto/buildinf.h" ],
Packit c4476c
            incs => [ "include" ],
Packit c4476c
            intent => "lib");
Packit c4476c
Packit c4476c
    generatesrc(src => "crypto/buildinf.h",
Packit c4476c
                generator => [ "util/mkbuildinf.pl", "\"$(CC)",
Packit c4476c
                               "$(CFLAGS)\"", "\"$(PLATFORM)\"" ],
Packit c4476c
                generator_incs => [ "util" ],
Packit c4476c
                generator_deps => [ "util/Foo.pm" ],
Packit c4476c
                incs => [ ],
Packit c4476c
                deps => [ ],
Packit c4476c
                intent => "lib");
Packit c4476c
Packit c4476c
The returned strings from all those calls are then concatenated
Packit c4476c
together and written to the resulting build-file.