Blame Configurations/README

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