Blame Configurations/README

Packit c4476c
Intro
Packit c4476c
=====
Packit c4476c
Packit c4476c
This directory contains a few sets of files that are used for
Packit c4476c
configuration in diverse ways:
Packit c4476c
Packit c4476c
    *.conf      Target platform configurations, please read
Packit c4476c
                'Configurations of OpenSSL target platforms' for more
Packit c4476c
                information.
Packit c4476c
    *.tmpl      Build file templates, please read 'Build-file
Packit c4476c
                programming with the "unified" build system' as well
Packit c4476c
                as 'Build info files' for more information.
Packit c4476c
    *.pm        Helper scripts / modules for the main `Configure`
Packit c4476c
                script.  See 'Configure helper scripts for more
Packit c4476c
                information.
Packit c4476c
Packit c4476c
Packit c4476c
Configurations of OpenSSL target platforms
Packit c4476c
==========================================
Packit c4476c
Packit c4476c
Configuration targets are a collection of facts that we know about
Packit c4476c
different platforms and their capabilities.  We organise them in a
Packit c4476c
hash table, where each entry represent a specific target.
Packit c4476c
Packit c4476c
Note that configuration target names must be unique across all config
Packit c4476c
files.  The Configure script does check that a config file doesn't
Packit c4476c
have config targets that shadow config targets from other files.
Packit c4476c
Packit c4476c
In each table entry, the following keys are significant:
Packit c4476c
Packit c4476c
        inherit_from    => Other targets to inherit values from.
Packit c4476c
                           Explained further below. [1]
Packit c4476c
        template        => Set to 1 if this isn't really a platform
Packit c4476c
                           target.  Instead, this target is a template
Packit c4476c
                           upon which other targets can be built.
Packit c4476c
                           Explained further below.  [1]
Packit c4476c
Packit c4476c
        sys_id          => System identity for systems where that
Packit c4476c
                           is difficult to determine automatically.
Packit c4476c
Packit c4476c
        enable          => Enable specific configuration features.
Packit c4476c
                           This MUST be an array of words.
Packit c4476c
        disable         => Disable specific configuration features.
Packit c4476c
                           This MUST be an array of words.
Packit c4476c
                           Note: if the same feature is both enabled
Packit c4476c
                           and disabled, disable wins.
Packit c4476c
Packit c4476c
        as              => The assembler command.  This is not always
Packit c4476c
                           used (for example on Unix, where the C
Packit c4476c
                           compiler is used instead).
Packit c4476c
        asflags         => Default assembler command flags [4].
Packit c4476c
        cpp             => The C preprocessor command, normally not
Packit c4476c
                           given, as the build file defaults are
Packit c4476c
                           usually good enough.
Packit c4476c
        cppflags        => Default C preprocessor flags [4].
Packit c4476c
        defines         => As an alternative, macro definitions may be
Packit c4476c
                           given here instead of in `cppflags' [4].
Packit c4476c
                           If given here, they MUST be as an array of
Packit c4476c
                           the string such as "MACRO=value", or just
Packit c4476c
                           "MACRO" for definitions without value.
Packit c4476c
        includes        => As an alternative, inclusion directories
Packit c4476c
                           may be given here instead of in `cppflags'
Packit c4476c
                           [4].  If given here, the MUST be an array
Packit c4476c
                           of strings, one directory specification
Packit c4476c
                           each.
Packit c4476c
        cc              => The C compiler command, usually one of "cc",
Packit c4476c
                           "gcc" or "clang".  This command is normally
Packit c4476c
                           also used to link object files and
Packit c4476c
                           libraries into the final program.
Packit c4476c
        cxx             => The C++ compiler command, usually one of
Packit c4476c
                           "c++", "g++" or "clang++".  This command is
Packit c4476c
                           also used when linking a program where at
Packit c4476c
                           least one of the object file is made from
Packit c4476c
                           C++ source.
Packit c4476c
        cflags          => Defaults C compiler flags [4].
Packit c4476c
        cxxflags        => Default  C++ compiler flags [4].  If unset,
Packit c4476c
                           it gets the same value as cflags.
Packit c4476c
Packit c4476c
        (linking is a complex thing, see [3] below)
Packit c4476c
        ld              => Linker command, usually not defined
Packit c4476c
                           (meaning the compiler command is used
Packit c4476c
                           instead).
Packit c4476c
                           (NOTE: this is here for future use, it's
Packit c4476c
                           not implemented yet)
Packit c4476c
        lflags          => Default flags used when linking apps,
Packit c4476c
                           shared libraries or DSOs [4].
Packit c4476c
        ex_libs         => Extra libraries that are needed when
Packit c4476c
                           linking shared libraries, DSOs or programs.
Packit c4476c
                           The value is also assigned to Libs.private
Packit c4476c
                           in $(libdir)/pkgconfig/libcrypto.pc.
Packit c4476c
Packit c4476c
        shared_cppflags => Extra C preprocessor flags used when
Packit c4476c
                           processing C files for shared libraries.
Packit c4476c
        shared_cflag    => Extra C compiler flags used when compiling
Packit c4476c
                           for shared libraries, typically something
Packit c4476c
                           like "-fPIC".
Packit c4476c
        shared_ldflag   => Extra linking flags used when linking
Packit c4476c
                           shared libraries.
Packit c4476c
        module_cppflags
Packit c4476c
        module_cflags
Packit c4476c
        module_ldflags  => Has the same function as the corresponding
Packit c4476c
                           `shared_' attributes, but for building DSOs.
Packit c4476c
                           When unset, they get the same values as the
Packit c4476c
                           corresponding `shared_' attributes.
Packit c4476c
Packit c4476c
        ar              => The library archive command, the default is
Packit c4476c
                           "ar".
Packit c4476c
                           (NOTE: this is here for future use, it's
Packit c4476c
                           not implemented yet)
Packit c4476c
        arflags         => Flags to be used with the library archive
Packit c4476c
                           command.  On Unix, this includes the
Packit c4476c
                           command letter, 'r' by default.
Packit c4476c
Packit c4476c
        ranlib          => The library archive indexing command, the
Packit c4476c
                           default is 'ranlib' it it exists.
Packit c4476c
Packit c4476c
        unistd          => An alternative header to the typical
Packit c4476c
                           '<unistd.h>'.  This is very rarely needed.
Packit c4476c
Packit c4476c
        shared_extension => File name extension used for shared
Packit c4476c
                            libraries.
Packit c4476c
        obj_extension   => File name extension used for object files.
Packit c4476c
                           On unix, this defaults to ".o" (NOTE: this
Packit c4476c
                           is here for future use, it's not
Packit c4476c
                           implemented yet)
Packit c4476c
        exe_extension   => File name extension used for executable
Packit c4476c
                           files.  On unix, this defaults to "" (NOTE:
Packit c4476c
                           this is here for future use, it's not
Packit c4476c
                           implemented yet)
Packit c4476c
        shlib_variant   => A "variant" identifier inserted between the base
Packit c4476c
                           shared library name and the extension.  On "unixy"
Packit c4476c
                           platforms (BSD, Linux, Solaris, MacOS/X, ...) this
Packit c4476c
                           supports installation of custom OpenSSL libraries
Packit c4476c
                           that don't conflict with other builds of OpenSSL
Packit c4476c
                           installed on the system.  The variant identifier
Packit c4476c
                           becomes part of the SONAME of the library and also
Packit c4476c
                           any symbol versions (symbol versions are not used or
Packit c4476c
                           needed with MacOS/X).  For example, on a system
Packit c4476c
                           where a default build would normally create the SSL
Packit c4476c
                           shared library as 'libssl.so -> libssl.so.1.1' with
Packit c4476c
                           the value of the symlink as the SONAME, a target
Packit c4476c
                           definition that sets 'shlib_variant => "-abc"' will
Packit c4476c
                           create 'libssl.so -> libssl-abc.so.1.1', again with
Packit c4476c
                           an SONAME equal to the value of the symlink.  The
Packit c4476c
                           symbol versions associated with the variant library
Packit c4476c
                           would then be 'OPENSSL_ABC_<version>' rather than
Packit c4476c
                           the default 'OPENSSL_<version>'. The string inserted
Packit c4476c
                           into symbol versions is obtained by mapping all
Packit c4476c
                           letters in the "variant" identifier to upper case
Packit c4476c
                           and all non-alphanumeric characters to '_'.
Packit c4476c
Packit c4476c
        thread_scheme   => The type of threads is used on the
Packit c4476c
                           configured platform.  Currently known
Packit c4476c
                           values are "(unknown)", "pthreads",
Packit c4476c
                           "uithreads" (a.k.a solaris threads) and
Packit c4476c
                           "winthreads".  Except for "(unknown)", the
Packit c4476c
                           actual value is currently ignored but may
Packit c4476c
                           be used in the future.  See further notes
Packit c4476c
                           below [2].
Packit c4476c
        dso_scheme      => The type of dynamic shared objects to build
Packit c4476c
                           for.  This mostly comes into play with
Packit c4476c
                           engines, but can be used for other purposes
Packit c4476c
                           as well.  Valid values are "DLFCN"
Packit c4476c
                           (dlopen() et al), "DLFCN_NO_H" (for systems
Packit c4476c
                           that use dlopen() et al but do not have
Packit c4476c
                           fcntl.h), "DL" (shl_load() et al), "WIN32"
Packit c4476c
                           and "VMS".
Packit c4476c
        perlasm_scheme  => The perlasm method used to create the
Packit c4476c
                           assembler files used when compiling with
Packit c4476c
                           assembler implementations.
Packit c4476c
        shared_target   => The shared library building method used.
Packit c4476c
                           This is a target found in Makefile.shared.
Packit c4476c
        build_scheme    => The scheme used to build up a Makefile.
Packit c4476c
                           In its simplest form, the value is a string
Packit c4476c
                           with the name of the build scheme.
Packit c4476c
                           The value may also take the form of a list
Packit c4476c
                           of strings, if the build_scheme is to have
Packit c4476c
                           some options.  In this case, the first
Packit c4476c
                           string in the list is the name of the build
Packit c4476c
                           scheme.
Packit c4476c
                           Currently recognised build scheme is "unified".
Packit c4476c
                           For the "unified" build scheme, this item
Packit c4476c
                           *must* be an array with the first being the
Packit c4476c
                           word "unified" and the second being a word
Packit c4476c
                           to identify the platform family.
Packit c4476c
Packit c4476c
        multilib        => On systems that support having multiple
Packit c4476c
                           implementations of a library (typically a
Packit c4476c
                           32-bit and a 64-bit variant), this is used
Packit c4476c
                           to have the different variants in different
Packit c4476c
                           directories.
Packit c4476c
Packit c4476c
        bn_ops          => Building options (was just bignum options in
Packit c4476c
                           the earlier history of this option, hence the
Packit c4476c
                           name). This is a string of words that describe
Packit c4476c
                           algorithms' implementation parameters that
Packit c4476c
                           are optimal for the designated target platform,
Packit c4476c
                           such as the type of integers used to build up
Packit c4476c
                           the bignum, different ways to implement certain
Packit c4476c
                           ciphers and so on. To fully comprehend the
Packit c4476c
                           meaning, the best is to read the affected
Packit c4476c
                           source.
Packit c4476c
                           The valid words are:
Packit c4476c
Packit c4476c
                           THIRTY_TWO_BIT       bignum limbs are 32 bits,
Packit c4476c
                                                this is default if no
Packit c4476c
                                                option is specified, it
Packit c4476c
                                                works on any supported
Packit c4476c
                                                system [unless "wider"
Packit c4476c
                                                limb size is implied in
Packit c4476c
                                                assembly code];
Packit c4476c
                           BN_LLONG             bignum limbs are 32 bits,
Packit c4476c
                                                but 64-bit 'unsigned long
Packit c4476c
                                                long' is used internally
Packit c4476c
                                                in calculations;
Packit c4476c
                           SIXTY_FOUR_BIT_LONG  bignum limbs are 64 bits
Packit c4476c
                                                and sizeof(long) is 8;
Packit c4476c
                           SIXTY_FOUR_BIT       bignums limbs are 64 bits,
Packit c4476c
                                                but execution environment
Packit c4476c
                                                is ILP32;
Packit c4476c
                           RC4_CHAR             RC4 key schedule is made
Packit c4476c
                                                up of 'unsigned char's;
Packit c4476c
                           RC4_INT              RC4 key schedule is made
Packit c4476c
                                                up of 'unsigned int's;
Packit c4476c
                           EXPORT_VAR_AS_FN     for shared libraries,
Packit c4476c
                                                export vars as
Packit c4476c
                                                accessor functions.
Packit c4476c
Packit c4476c
        apps_aux_src    => Extra source to build apps/openssl and other
Packit c4476c
                           apps, as needed by the target and that can be
Packit c4476c
                           collected in a library.
Packit c4476c
        apps_init_src   => Init source to build apps/openssl and other
Packit c4476c
                           apps, as needed by the target.  This code
Packit c4476c
                           cannot be placed in a library, as the rest
Packit c4476c
                           of the code isn't expected to link to it
Packit c4476c
                           explicitly.
Packit c4476c
        cpuid_asm_src   => assembler implementation of cpuid code as
Packit c4476c
                           well as OPENSSL_cleanse().
Packit c4476c
                           Default to mem_clr.c
Packit c4476c
        bn_asm_src      => Assembler implementation of core bignum
Packit c4476c
                           functions.
Packit c4476c
                           Defaults to bn_asm.c
Packit c4476c
        ec_asm_src      => Assembler implementation of core EC
Packit c4476c
                           functions.
Packit c4476c
        des_asm_src     => Assembler implementation of core DES
Packit c4476c
                           encryption functions.
Packit c4476c
                           Defaults to 'des_enc.c fcrypt_b.c'
Packit c4476c
        aes_asm_src     => Assembler implementation of core AES
Packit c4476c
                           functions.
Packit c4476c
                           Defaults to 'aes_core.c aes_cbc.c'
Packit c4476c
        bf_asm_src      => Assembler implementation of core BlowFish
Packit c4476c
                           functions.
Packit c4476c
                           Defaults to 'bf_enc.c'
Packit c4476c
        md5_asm_src     => Assembler implementation of core MD5
Packit c4476c
                           functions.
Packit c4476c
        sha1_asm_src    => Assembler implementation of core SHA1,
Packit c4476c
                           functions, and also possibly SHA256 and
Packit c4476c
                           SHA512 ones.
Packit c4476c
        cast_asm_src    => Assembler implementation of core CAST
Packit c4476c
                           functions.
Packit c4476c
                           Defaults to 'c_enc.c'
Packit c4476c
        rc4_asm_src     => Assembler implementation of core RC4
Packit c4476c
                           functions.
Packit c4476c
                           Defaults to 'rc4_enc.c rc4_skey.c'
Packit c4476c
        rmd160_asm_src  => Assembler implementation of core RMD160
Packit c4476c
                           functions.
Packit c4476c
        rc5_asm_src     => Assembler implementation of core RC5
Packit c4476c
                           functions.
Packit c4476c
                           Defaults to 'rc5_enc.c'
Packit c4476c
        wp_asm_src      => Assembler implementation of core WHIRLPOOL
Packit c4476c
                           functions.
Packit c4476c
        cmll_asm_src    => Assembler implementation of core CAMELLIA
Packit c4476c
                           functions.
Packit c4476c
                           Defaults to 'camellia.c cmll_misc.c cmll_cbc.c'
Packit c4476c
        modes_asm_src   => Assembler implementation of cipher modes,
Packit c4476c
                           currently the functions gcm_gmult_4bit and
Packit c4476c
                           gcm_ghash_4bit.
Packit c4476c
        padlock_asm_src => Assembler implementation of core parts of
Packit c4476c
                           the padlock engine.  This is mandatory on
Packit c4476c
                           any platform where the padlock engine might
Packit c4476c
                           actually be built.
Packit c4476c
Packit c4476c
Packit c4476c
[1] as part of the target configuration, one can have a key called
Packit c4476c
    'inherit_from' that indicate what other configurations to inherit
Packit c4476c
    data from.  These are resolved recursively.
Packit c4476c
Packit c4476c
    Inheritance works as a set of default values that can be overridden
Packit c4476c
    by corresponding key values in the inheriting configuration.
Packit c4476c
Packit c4476c
    Note 1: any configuration table can be used as a template.
Packit c4476c
    Note 2: pure templates have the attribute 'template => 1' and
Packit c4476c
            cannot be used as build targets.
Packit c4476c
Packit c4476c
    If several configurations are given in the 'inherit_from' array,
Packit c4476c
    the values of same attribute are concatenated with space
Packit c4476c
    separation.  With this, it's possible to have several smaller
Packit c4476c
    templates for different configuration aspects that can be combined
Packit c4476c
    into a complete configuration.
Packit c4476c
Packit c4476c
    instead of a scalar value or an array, a value can be a code block
Packit c4476c
    of the form 'sub { /* your code here */ }'.  This code block will
Packit c4476c
    be called with the list of inherited values for that key as
Packit c4476c
    arguments.  In fact, the concatenation of strings is really done
Packit c4476c
    by using 'sub { join(" ",@_) }' on the list of inherited values.
Packit c4476c
Packit c4476c
    An example:
Packit c4476c
Packit c4476c
        "foo" => {
Packit c4476c
                template => 1,
Packit c4476c
                haha => "ha ha",
Packit c4476c
                hoho => "ho",
Packit c4476c
                ignored => "This should not appear in the end result",
Packit c4476c
        },
Packit c4476c
        "bar" => {
Packit c4476c
                template => 1,
Packit c4476c
                haha => "ah",
Packit c4476c
                hoho => "haho",
Packit c4476c
                hehe => "hehe"
Packit c4476c
        },
Packit c4476c
        "laughter" => {
Packit c4476c
                inherit_from => [ "foo", "bar" ],
Packit c4476c
                hehe => sub { join(" ",(@_,"!!!")) },
Packit c4476c
                ignored => "",
Packit c4476c
        }
Packit c4476c
Packit c4476c
        The entry for "laughter" will become as follows after processing:
Packit c4476c
Packit c4476c
        "laughter" => {
Packit c4476c
                haha => "ha ha ah",
Packit c4476c
                hoho => "ho haho",
Packit c4476c
                hehe => "hehe !!!",
Packit c4476c
                ignored => ""
Packit c4476c
        }
Packit c4476c
Packit c4476c
[2] OpenSSL is built with threading capabilities unless the user
Packit c4476c
    specifies 'no-threads'.  The value of the key 'thread_scheme' may
Packit c4476c
    be "(unknown)", in which case the user MUST give some compilation
Packit c4476c
    flags to Configure.
Packit c4476c
Packit c4476c
[3] OpenSSL has three types of things to link from object files or
Packit c4476c
    static libraries:
Packit c4476c
Packit c4476c
    - shared libraries; that would be libcrypto and libssl.
Packit c4476c
    - shared objects (sometimes called dynamic libraries);  that would
Packit c4476c
      be the engines.
Packit c4476c
    - applications; those are apps/openssl and all the test apps.
Packit c4476c
Packit c4476c
    Very roughly speaking, linking is done like this (words in braces
Packit c4476c
    represent the configuration settings documented at the beginning
Packit c4476c
    of this file):
Packit c4476c
Packit c4476c
    shared libraries:
Packit c4476c
        {ld} $(CFLAGS) {lflags} {shared_ldflag} -o libfoo.so \
Packit c4476c
            foo/something.o foo/somethingelse.o {ex_libs}
Packit c4476c
Packit c4476c
    shared objects:
Packit c4476c
        {ld} $(CFLAGS) {lflags} {module_ldflags} -o libeng.so \
Packit c4476c
            blah1.o blah2.o -lcrypto {ex_libs}
Packit c4476c
Packit c4476c
    applications:
Packit c4476c
        {ld} $(CFLAGS) {lflags} -o app \
Packit c4476c
            app1.o utils.o -lssl -lcrypto {ex_libs}
Packit c4476c
Packit c4476c
[4] There are variants of these attribute, prefixed with `lib_',
Packit c4476c
    `dso_' or `bin_'.  Those variants replace the unprefixed attribute
Packit c4476c
    when building library, DSO or program modules specifically.
Packit c4476c
Packit c4476c
Historically, the target configurations came in form of a string with
Packit c4476c
values separated by colons.  This use is deprecated.  The string form
Packit c4476c
looked like this:
Packit c4476c
Packit c4476c
   "target" => "{cc}:{cflags}:{unistd}:{thread_cflag}:{sys_id}:{lflags}:{bn_ops}:{cpuid_obj}:{bn_obj}:{ec_obj}:{des_obj}:{aes_obj}:{bf_obj}:{md5_obj}:{sha1_obj}:{cast_obj}:{rc4_obj}:{rmd160_obj}:{rc5_obj}:{wp_obj}:{cmll_obj}:{modes_obj}:{padlock_obj}:{perlasm_scheme}:{dso_scheme}:{shared_target}:{shared_cflag}:{shared_ldflag}:{shared_extension}:{ranlib}:{arflags}:{multilib}"
Packit c4476c
Packit c4476c
Packit c4476c
Build info files
Packit c4476c
================
Packit c4476c
Packit c4476c
The build.info files that are spread over the source tree contain the
Packit c4476c
minimum information needed to build and distribute OpenSSL.  It uses a
Packit c4476c
simple and yet fairly powerful language to determine what needs to be
Packit c4476c
built, from what sources, and other relationships between files.
Packit c4476c
Packit c4476c
For every build.info file, all file references are relative to the
Packit c4476c
directory of the build.info file for source files, and the
Packit c4476c
corresponding build directory for built files if the build tree
Packit c4476c
differs from the source tree.
Packit c4476c
Packit c4476c
When processed, every line is processed with the perl module
Packit c4476c
Text::Template, using the delimiters "{-" and "-}".  The hashes
Packit c4476c
%config and %target are passed to the perl fragments, along with
Packit c4476c
$sourcedir and $builddir, which are the locations of the source
Packit c4476c
directory for the current build.info file and the corresponding build
Packit c4476c
directory, all relative to the top of the build tree.
Packit c4476c
Packit c4476c
To begin with, things to be built are declared by setting specific
Packit c4476c
variables:
Packit c4476c
Packit c4476c
    PROGRAMS=foo bar
Packit c4476c
    LIBS=libsomething
Packit c4476c
    ENGINES=libeng
Packit c4476c
    SCRIPTS=myhack
Packit c4476c
    EXTRA=file1 file2
Packit c4476c
Packit c4476c
Note that the files mentioned for PROGRAMS, LIBS and ENGINES *must* be
Packit c4476c
without extensions.  The build file templates will figure them out.
Packit c4476c
Packit c4476c
For each thing to be built, it is then possible to say what sources
Packit c4476c
they are built from:
Packit c4476c
Packit c4476c
    PROGRAMS=foo bar
Packit c4476c
    SOURCE[foo]=foo.c common.c
Packit c4476c
    SOURCE[bar]=bar.c extra.c common.c
Packit c4476c
Packit c4476c
It's also possible to tell some other dependencies:
Packit c4476c
Packit c4476c
    DEPEND[foo]=libsomething
Packit c4476c
    DEPEND[libbar]=libsomethingelse
Packit c4476c
Packit c4476c
(it could be argued that 'libsomething' and 'libsomethingelse' are
Packit c4476c
source as well.  However, the files given through SOURCE are expected
Packit c4476c
to be located in the source tree while files given through DEPEND are
Packit c4476c
expected to be located in the build tree)
Packit c4476c
Packit c4476c
It's also possible to depend on static libraries explicitly:
Packit c4476c
Packit c4476c
    DEPEND[foo]=libsomething.a
Packit c4476c
    DEPEND[libbar]=libsomethingelse.a
Packit c4476c
Packit c4476c
This should be rarely used, and care should be taken to make sure it's
Packit c4476c
only used when supported.  For example, native Windows build doesn't
Packit c4476c
support building static libraries and DLLs at the same time, so using
Packit c4476c
static libraries on Windows can only be done when configured
Packit c4476c
'no-shared'.
Packit c4476c
Packit c4476c
One some platforms, shared libraries come with a name that's different
Packit c4476c
from their static counterpart.  That's declared as follows:
Packit c4476c
Packit c4476c
    SHARED_NAME[libfoo]=cygfoo-{- $config{shlibver} -}
Packit c4476c
Packit c4476c
The example is from Cygwin, which has a required naming convention.
Packit c4476c
Packit c4476c
Sometimes, it makes sense to rename an output file, for example a
Packit c4476c
library:
Packit c4476c
Packit c4476c
    RENAME[libfoo]=libbar
Packit c4476c
Packit c4476c
That line has "libfoo" renamed to "libbar".  While it makes no
Packit c4476c
sense at all to just have a rename like that (why not just use
Packit c4476c
"libbar" everywhere?), it does make sense when it can be used
Packit c4476c
conditionally.  See a little further below for an example.
Packit c4476c
Packit c4476c
In some cases, it's desirable to include some source files in the
Packit c4476c
shared form of a library only:
Packit c4476c
Packit c4476c
    SHARED_SOURCE[libfoo]=dllmain.c
Packit c4476c
Packit c4476c
For any file to be built, it's also possible to tell what extra
Packit c4476c
include paths the build of their source files should use:
Packit c4476c
Packit c4476c
    INCLUDE[foo]=include
Packit c4476c
Packit c4476c
In some cases, one might want to generate some source files from
Packit c4476c
others, that's done as follows:
Packit c4476c
Packit c4476c
    GENERATE[foo.s]=asm/something.pl $(CFLAGS)
Packit c4476c
    GENERATE[bar.s]=asm/bar.S
Packit c4476c
Packit c4476c
The value of each GENERATE line is a command line or part of it.
Packit c4476c
Configure places no rules on the command line, except that the first
Packit c4476c
item must be the generator file.  It is, however, entirely up to the
Packit c4476c
build file template to define exactly how those command lines should
Packit c4476c
be handled, how the output is captured and so on.
Packit c4476c
Packit c4476c
Sometimes, the generator file itself depends on other files, for
Packit c4476c
example if it is a perl script that depends on other perl modules.
Packit c4476c
This can be expressed using DEPEND like this:
Packit c4476c
Packit c4476c
    DEPEND[asm/something.pl]=../perlasm/Foo.pm
Packit c4476c
Packit c4476c
There may also be cases where the exact file isn't easily specified,
Packit c4476c
but an inclusion directory still needs to be specified.  INCLUDE can
Packit c4476c
be used in that case:
Packit c4476c
Packit c4476c
    INCLUDE[asm/something.pl]=../perlasm
Packit c4476c
Packit c4476c
NOTE: GENERATE lines are limited to one command only per GENERATE.
Packit c4476c
Packit c4476c
As a last resort, it's possible to have raw build file lines, between
Packit c4476c
BEGINRAW and ENDRAW lines as follows:
Packit c4476c
Packit c4476c
    BEGINRAW[Makefile(unix)]
Packit c4476c
    haha.h: {- $builddir -}/Makefile
Packit c4476c
        echo "/* haha */" > haha.h
Packit c4476c
    ENDRAW[Makefile(unix)]
Packit c4476c
Packit c4476c
The word within square brackets is the build_file configuration item
Packit c4476c
or the build_file configuration item followed by the second word in the
Packit c4476c
build_scheme configuration item for the configured target within
Packit c4476c
parenthesis as shown above.  For example, with the following relevant
Packit c4476c
configuration items:
Packit c4476c
Packit c4476c
   build_file   => "build.ninja"
Packit c4476c
   build_scheme => [ "unified", "unix" ]
Packit c4476c
Packit c4476c
... these lines will be considered:
Packit c4476c
Packit c4476c
   BEGINRAW[build.ninja]
Packit c4476c
   build haha.h: echo "/* haha */" > haha.h
Packit c4476c
   ENDRAW[build.ninja]
Packit c4476c
Packit c4476c
   BEGINRAW[build.ninja(unix)]
Packit c4476c
   build hoho.h: echo "/* hoho */" > hoho.h
Packit c4476c
   ENDRAW[build.ninja(unix)]
Packit c4476c
Packit c4476c
Should it be needed because the recipes within a RAW section might
Packit c4476c
clash with those generated by Configure, it's possible to tell it
Packit c4476c
not to generate them with the use of OVERRIDES, for example:
Packit c4476c
Packit c4476c
    SOURCE[libfoo]=foo.c bar.c
Packit c4476c
Packit c4476c
    OVERRIDES=bar.o
Packit c4476c
    BEGINRAW[Makefile(unix)]
Packit c4476c
    bar.o: bar.c
Packit c4476c
    	$(CC) $(CFLAGS) -DSPECIAL -c -o $@ $<
Packit c4476c
    ENDRAW[Makefile(unix)]
Packit c4476c
Packit c4476c
See the documentation further up for more information on configuration
Packit c4476c
items.
Packit c4476c
Packit c4476c
Finally, you can have some simple conditional use of the build.info
Packit c4476c
information, looking like this:
Packit c4476c
Packit c4476c
    IF[1]
Packit c4476c
     something
Packit c4476c
    ELSIF[2]
Packit c4476c
     something other
Packit c4476c
    ELSE
Packit c4476c
     something else
Packit c4476c
    ENDIF
Packit c4476c
Packit c4476c
The expression in square brackets is interpreted as a string in perl,
Packit c4476c
and will be seen as true if perl thinks it is, otherwise false.  For
Packit c4476c
example, the above would have "something" used, since 1 is true.
Packit c4476c
Packit c4476c
Together with the use of Text::Template, this can be used as
Packit c4476c
conditions based on something in the passed variables, for example:
Packit c4476c
Packit c4476c
    IF[{- $disabled{shared} -}]
Packit c4476c
      LIBS=libcrypto
Packit c4476c
      SOURCE[libcrypto]=...
Packit c4476c
    ELSE
Packit c4476c
      LIBS=libfoo
Packit c4476c
      SOURCE[libfoo]=...
Packit c4476c
    ENDIF
Packit c4476c
Packit c4476c
or:
Packit c4476c
Packit c4476c
    # VMS has a cultural standard where all libraries are prefixed.
Packit c4476c
    # For OpenSSL, the choice is 'ossl_'
Packit c4476c
    IF[{- $config{target} =~ /^vms/ -}]
Packit c4476c
     RENAME[libcrypto]=ossl_libcrypto
Packit c4476c
     RENAME[libssl]=ossl_libssl
Packit c4476c
    ENDIF
Packit c4476c
Packit c4476c
Packit c4476c
Build-file programming with the "unified" build system
Packit c4476c
======================================================
Packit c4476c
Packit c4476c
"Build files" are called "Makefile" on Unix-like operating systems,
Packit c4476c
"descrip.mms" for MMS on VMS, "makefile" for nmake on Windows, etc.
Packit c4476c
Packit c4476c
To use the "unified" build system, the target configuration needs to
Packit c4476c
set the three items 'build_scheme', 'build_file' and 'build_command'.
Packit c4476c
In the rest of this section, we will assume that 'build_scheme' is set
Packit c4476c
to "unified" (see the configurations documentation above for the
Packit c4476c
details).
Packit c4476c
Packit c4476c
For any name given by 'build_file', the "unified" system expects a
Packit c4476c
template file in Configurations/ named like the build file, with
Packit c4476c
".tmpl" appended, or in case of possible ambiguity, a combination of
Packit c4476c
the second 'build_scheme' list item and the 'build_file' name.  For
Packit c4476c
example, if 'build_file' is set to "Makefile", the template could be
Packit c4476c
Configurations/Makefile.tmpl or Configurations/unix-Makefile.tmpl.
Packit c4476c
In case both Configurations/unix-Makefile.tmpl and
Packit c4476c
Configurations/Makefile.tmpl are present, the former takes
Packit c4476c
precedence.
Packit c4476c
Packit c4476c
The build-file template is processed with the perl module
Packit c4476c
Text::Template, using "{-" and "-}" as delimiters that enclose the
Packit c4476c
perl code fragments that generate configuration-dependent content.
Packit c4476c
Those perl fragments have access to all the hash variables from
Packit c4476c
configdata.pem.
Packit c4476c
Packit c4476c
The build-file template is expected to define at least the following
Packit c4476c
perl functions in a perl code fragment enclosed with "{-" and "-}".
Packit c4476c
They are all expected to return a string with the lines they produce.
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
                                    generator => [ "generatingfile", ... ]
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
    obj2dso     - function that produces build file lines to build a
Packit c4476c
                  dynamic shared object file from object files.
Packit c4476c
Packit c4476c
                  called like this:
Packit c4476c
Packit c4476c
                        obj2dso(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
In all cases, file file paths are relative to the build tree top, and
Packit c4476c
the build file actions run with the build tree top as current working
Packit c4476c
directory.
Packit c4476c
Packit c4476c
Make sure to end the section with these functions with a string that
Packit c4476c
you thing is appropriate for the resulting build file.  If nothing
Packit c4476c
else, end it like this:
Packit c4476c
Packit c4476c
      "";       # Make sure no lingering values end up in the Makefile
Packit c4476c
    -}
Packit c4476c
Packit c4476c
Packit c4476c
Configure helper scripts
Packit c4476c
========================
Packit c4476c
Packit c4476c
Configure uses helper scripts in this directory:
Packit c4476c
Packit c4476c
Checker scripts
Packit c4476c
---------------
Packit c4476c
Packit c4476c
These scripts are per platform family, to check the integrity of the
Packit c4476c
tools used for configuration and building.  The checker script used is
Packit c4476c
either {build_platform}-{build_file}-checker.pm or
Packit c4476c
{build_platform}-checker.pm, where {build_platform} is the second
Packit c4476c
'build_scheme' list element from the configuration target data, and
Packit c4476c
{build_file} is 'build_file' from the same target data.
Packit c4476c
Packit c4476c
If the check succeeds, the script is expected to end with a non-zero
Packit c4476c
expression.  If the check fails, the script can end with a zero, or
Packit c4476c
with a `die`.