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