diff options
Diffstat (limited to 'openssl-1.1.0h/Configurations')
| -rw-r--r-- | openssl-1.1.0h/Configurations/00-base-templates.conf | 293 | ||||
| -rw-r--r-- | openssl-1.1.0h/Configurations/10-main.conf | 1884 | ||||
| -rw-r--r-- | openssl-1.1.0h/Configurations/50-djgpp.conf | 15 | ||||
| -rw-r--r-- | openssl-1.1.0h/Configurations/50-haiku.conf | 29 | ||||
| -rw-r--r-- | openssl-1.1.0h/Configurations/50-masm.conf | 17 | ||||
| -rw-r--r-- | openssl-1.1.0h/Configurations/90-team.conf | 112 | ||||
| -rw-r--r-- | openssl-1.1.0h/Configurations/INTERNALS.Configure | 136 | ||||
| -rw-r--r-- | openssl-1.1.0h/Configurations/README | 721 | ||||
| -rw-r--r-- | openssl-1.1.0h/Configurations/README.design | 641 | ||||
| -rw-r--r-- | openssl-1.1.0h/Configurations/common.tmpl | 229 | ||||
| -rw-r--r-- | openssl-1.1.0h/Configurations/descrip.mms.tmpl | 780 | ||||
| -rw-r--r-- | openssl-1.1.0h/Configurations/unix-Makefile.tmpl | 1044 | ||||
| -rw-r--r-- | openssl-1.1.0h/Configurations/unix-checker.pm | 22 | ||||
| -rw-r--r-- | openssl-1.1.0h/Configurations/windows-checker.pm | 22 | ||||
| -rw-r--r-- | openssl-1.1.0h/Configurations/windows-makefile.tmpl | 621 | 
15 files changed, 6566 insertions, 0 deletions
diff --git a/openssl-1.1.0h/Configurations/00-base-templates.conf b/openssl-1.1.0h/Configurations/00-base-templates.conf new file mode 100644 index 0000000..3455b3a --- /dev/null +++ b/openssl-1.1.0h/Configurations/00-base-templates.conf @@ -0,0 +1,293 @@ +# -*- Mode: perl -*- +%targets=( +    DEFAULTS => { +	template	=> 1, + +	cflags		=> "", +	defines		=> [], +	thread_scheme	=> "(unknown)", # Assume we don't know +	thread_defines	=> [], + +	apps_aux_src	=> "", +	cpuid_asm_src	=> "mem_clr.c", +	uplink_aux_src	=> "", +	bn_asm_src	=> "bn_asm.c", +	ec_asm_src	=> "", +	des_asm_src	=> "des_enc.c fcrypt_b.c", +	aes_asm_src	=> "aes_core.c aes_cbc.c", +	bf_asm_src	=> "bf_enc.c", +	md5_asm_src	=> "", +	cast_asm_src	=> "c_enc.c", +	rc4_asm_src	=> "rc4_enc.c rc4_skey.c", +	rmd160_asm_src	=> "", +	rc5_asm_src	=> "rc5_enc.c", +	wp_asm_src	=> "wp_block.c", +	cmll_asm_src	=> "camellia.c cmll_misc.c cmll_cbc.c", +	modes_asm_src	=> "", +	padlock_asm_src	=> "", +	chacha_asm_src	=> "chacha_enc.c", +	poly1305_asm_src	=> "", + +	unistd		=> "<unistd.h>", +	shared_target	=> "", +	shared_cflag	=> "", +	shared_defines	=> [], +	shared_ldflag	=> "", +	shared_rcflag	=> "", +	shared_extension	=> "", + +        build_scheme    => [ "unified", "unix" ], +        build_file      => "Makefile", +    }, + +    BASE_common => { +	template	=> 1, +	defines		=> +	    sub { +                my @defs = (); +                push @defs, "ZLIB" unless $disabled{zlib}; +                push @defs, "ZLIB_SHARED" unless $disabled{"zlib-dynamic"}; +                return [ @defs ]; +            }, +    }, + +    BASE_unix => { +        inherit_from    => [ "BASE_common" ], +        template        => 1, + +        ex_libs         => +            sub { +                unless ($disabled{zlib}) { +                    if (defined($disabled{"zlib-dynamic"})) { +                        if (defined($withargs{zlib_lib})) { +                            return "-L".$withargs{zlib_lib}." -lz"; +                        } else { +                            return "-lz"; +                        } +                    } +                } +                return (); }, + +        build_scheme    => [ "unified", "unix" ], +        build_file      => "Makefile", +    }, + +    BASE_Windows => { +        inherit_from    => [ "BASE_common" ], +        template        => 1, + +        ex_libs         => +            sub { +                unless ($disabled{zlib}) { +                    if (defined($disabled{"zlib-dynamic"})) { +                        return $withargs{zlib_lib} // "ZLIB1"; +                    } +                } +                return (); +            }, + +        ld              => "link", +        lflags          => "/nologo", +        loutflag        => "/out:", +        ar              => "lib", +        arflags         => "/nologo", +        aroutflag       => "/out:", +        rc               => "rc", +        rcoutflag        => "/fo", +        mt              => "mt", +        mtflags         => "-nologo", +        mtinflag        => "-manifest ", +        mtoutflag       => "-outputresource:", + +        build_file      => "makefile", +        build_scheme    => [ "unified", "windows" ], +    }, + +    BASE_VMS => { +        inherit_from    => [ "BASE_common" ], +        template        => 1, + +        build_file       => "descrip.mms", +        build_scheme     => [ "unified", "VMS" ], +    }, + +    uplink_common => { +	template	=> 1, +	apps_aux_src	=> add("../ms/applink.c"), +	uplink_aux_src	=> add("../ms/uplink.c"), +	defines		=> add("OPENSSL_USE_APPLINK"), +    }, +    x86_uplink => { +	inherit_from	=> [ "uplink_common" ], +	template	=> 1, +	uplink_aux_src	=> add("uplink-x86.s"), +    }, +    x86_64_uplink => { +	inherit_from	=> [ "uplink_common" ], +	template	=> 1, +	uplink_aux_src	=> add("uplink-x86_64.s"), +    }, +    ia64_uplink => { +	inherit_from	=> [ "uplink_common" ], +	template	=> 1, +	uplink_aux_src	=> add("uplink-ia64.s"), +    }, + +    x86_asm => { +	template	=> 1, +	cpuid_asm_src	=> "x86cpuid.s", +	bn_asm_src	=> "bn-586.s co-586.s x86-mont.s x86-gf2m.s", +	ec_asm_src	=> "ecp_nistz256.c ecp_nistz256-x86.s", +	des_asm_src	=> "des-586.s crypt586.s", +	aes_asm_src	=> "aes-586.s vpaes-x86.s aesni-x86.s", +	bf_asm_src	=> "bf-586.s", +	md5_asm_src	=> "md5-586.s", +	cast_asm_src	=> "cast-586.s", +	sha1_asm_src	=> "sha1-586.s sha256-586.s sha512-586.s", +	rc4_asm_src	=> "rc4-586.s", +	rmd160_asm_src	=> "rmd-586.s", +	rc5_asm_src	=> "rc5-586.s", +	wp_asm_src	=> "wp_block.c wp-mmx.s", +	cmll_asm_src	=> "cmll-x86.s", +	modes_asm_src	=> "ghash-x86.s", +	padlock_asm_src	=> "e_padlock-x86.s", +	chacha_asm_src	=> "chacha-x86.s", +	poly1305_asm_src=> "poly1305-x86.s", +    }, +    x86_elf_asm => { +	template	=> 1, +	inherit_from	=> [ "x86_asm" ], +	perlasm_scheme	=> "elf" +    }, +    x86_64_asm => { +	template	=> 1, +	cpuid_asm_src   => "x86_64cpuid.s", +	bn_asm_src      => "asm/x86_64-gcc.c x86_64-mont.s x86_64-mont5.s x86_64-gf2m.s rsaz_exp.c rsaz-x86_64.s rsaz-avx2.s", +	ec_asm_src      => "ecp_nistz256.c ecp_nistz256-x86_64.s", +	aes_asm_src     => "aes-x86_64.s vpaes-x86_64.s bsaes-x86_64.s aesni-x86_64.s aesni-sha1-x86_64.s aesni-sha256-x86_64.s aesni-mb-x86_64.s", +	md5_asm_src     => "md5-x86_64.s", +	sha1_asm_src    => "sha1-x86_64.s sha256-x86_64.s sha512-x86_64.s sha1-mb-x86_64.s sha256-mb-x86_64.s", +	rc4_asm_src     => "rc4-x86_64.s rc4-md5-x86_64.s", +	wp_asm_src      => "wp-x86_64.s", +	cmll_asm_src    => "cmll-x86_64.s cmll_misc.c", +	modes_asm_src   => "ghash-x86_64.s aesni-gcm-x86_64.s", +	padlock_asm_src => "e_padlock-x86_64.s", +	chacha_asm_src	=> "chacha-x86_64.s", +	poly1305_asm_src=> "poly1305-x86_64.s", +    }, +    ia64_asm => { +	template	=> 1, +	cpuid_asm_src   => "ia64cpuid.s", +	bn_asm_src      => "bn-ia64.s ia64-mont.s", +	aes_asm_src     => "aes_core.c aes_cbc.c aes-ia64.s", +	md5_asm_src     => "md5-ia64.s", +	sha1_asm_src    => "sha1-ia64.s sha256-ia64.s sha512-ia64.s", +	rc4_asm_src     => "rc4-ia64.s rc4_skey.c", +	modes_asm_src   => "ghash-ia64.s", +	perlasm_scheme	=> "void" +    }, +    sparcv9_asm => { +	template	=> 1, +	cpuid_asm_src   => "sparcv9cap.c sparccpuid.S", +	bn_asm_src      => "asm/sparcv8plus.S sparcv9-mont.S sparcv9a-mont.S vis3-mont.S sparct4-mont.S sparcv9-gf2m.S", +	ec_asm_src      => "ecp_nistz256.c ecp_nistz256-sparcv9.S", +	des_asm_src     => "des_enc-sparc.S fcrypt_b.c dest4-sparcv9.S", +	aes_asm_src     => "aes_core.c aes_cbc.c aes-sparcv9.S aest4-sparcv9.S aesfx-sparcv9.S", +	md5_asm_src     => "md5-sparcv9.S", +	sha1_asm_src    => "sha1-sparcv9.S sha256-sparcv9.S sha512-sparcv9.S", +	cmll_asm_src    => "camellia.c cmll_misc.c cmll_cbc.c cmllt4-sparcv9.S", +	modes_asm_src   => "ghash-sparcv9.S", +	poly1305_asm_src=> "poly1305-sparcv9.S", +	perlasm_scheme	=> "void" +    }, +    sparcv8_asm => { +	template	=> 1, +	cpuid_asm_src   => "", +	bn_asm_src      => "asm/sparcv8.S", +	des_asm_src     => "des_enc-sparc.S fcrypt_b.c", +	perlasm_scheme	=> "void" +    }, +    alpha_asm => { +	template	=> 1, +	cpuid_asm_src   => "alphacpuid.s", +	bn_asm_src      => "bn_asm.c alpha-mont.S", +	sha1_asm_src    => "sha1-alpha.S", +	modes_asm_src   => "ghash-alpha.S", +	perlasm_scheme	=> "void" +    }, +    mips32_asm => { +	template	=> 1, +	bn_asm_src      => "bn-mips.s mips-mont.s", +	aes_asm_src     => "aes_cbc.c aes-mips.S", +	sha1_asm_src    => "sha1-mips.S sha256-mips.S", +    }, +    mips64_asm => { +	inherit_from	=> [ "mips32_asm" ], +	template	=> 1, +	sha1_asm_src    => add("sha512-mips.S"), +	poly1305_asm_src=> "poly1305-mips.S", +    }, +    s390x_asm => { +	template	=> 1, +	cpuid_asm_src   => "s390xcap.c s390xcpuid.S", +	bn_asm_src      => "asm/s390x.S s390x-mont.S s390x-gf2m.s", +	aes_asm_src     => "aes-s390x.S aes-ctr.fake aes-xts.fake", +	sha1_asm_src    => "sha1-s390x.S sha256-s390x.S sha512-s390x.S", +	rc4_asm_src     => "rc4-s390x.s", +	modes_asm_src   => "ghash-s390x.S", +	chacha_asm_src  => "chacha-s390x.S", +	poly1305_asm_src=> "poly1305-s390x.S", +    }, +    armv4_asm => { +	template	=> 1, +	cpuid_asm_src   => "armcap.c armv4cpuid.S", +	bn_asm_src      => "bn_asm.c armv4-mont.S armv4-gf2m.S", +	ec_asm_src      => "ecp_nistz256.c ecp_nistz256-armv4.S", +	aes_asm_src     => "aes_cbc.c aes-armv4.S bsaes-armv7.S aesv8-armx.S", +	sha1_asm_src    => "sha1-armv4-large.S sha256-armv4.S sha512-armv4.S", +	modes_asm_src   => "ghash-armv4.S ghashv8-armx.S", +	chacha_asm_src  => "chacha-armv4.S", +	poly1305_asm_src=> "poly1305-armv4.S",  +	perlasm_scheme	=> "void" +    }, +    aarch64_asm => { +	template	=> 1, +	cpuid_asm_src   => "armcap.c arm64cpuid.S", +	ec_asm_src      => "ecp_nistz256.c ecp_nistz256-armv8.S", +	bn_asm_src      => "bn_asm.c armv8-mont.S", +	aes_asm_src     => "aes_core.c aes_cbc.c aesv8-armx.S vpaes-armv8.S", +	sha1_asm_src    => "sha1-armv8.S sha256-armv8.S sha512-armv8.S", +	modes_asm_src   => "ghashv8-armx.S", +	chacha_asm_src  => "chacha-armv8.S", +	poly1305_asm_src=> "poly1305-armv8.S", +    }, +    parisc11_asm => { +	template	=> 1, +	cpuid_asm_src   => "pariscid.s", +	bn_asm_src      => "bn_asm.c parisc-mont.s", +	aes_asm_src     => "aes_core.c aes_cbc.c aes-parisc.s", +	sha1_asm_src    => "sha1-parisc.s sha256-parisc.s sha512-parisc.s", +	rc4_asm_src     => "rc4-parisc.s", +	modes_asm_src   => "ghash-parisc.s", +	perlasm_scheme	=> "32" +    }, +    parisc20_64_asm => { +	template	=> 1, +	inherit_from	=> [ "parisc11_asm" ], +	perlasm_scheme	=> "64", +    }, +    ppc64_asm => { +	template	=> 1, +	cpuid_asm_src   => "ppccpuid.s ppccap.c", +	bn_asm_src      => "bn-ppc.s ppc-mont.s ppc64-mont.s", +	aes_asm_src     => "aes_core.c aes_cbc.c aes-ppc.s vpaes-ppc.s aesp8-ppc.s", +	sha1_asm_src    => "sha1-ppc.s sha256-ppc.s sha512-ppc.s sha256p8-ppc.s sha512p8-ppc.s", +	modes_asm_src   => "ghashp8-ppc.s", +	chacha_asm_src	=> "chacha-ppc.s", +	poly1305_asm_src=> "poly1305-ppc.s poly1305-ppcfp.s", +    }, +    ppc32_asm => { +	inherit_from	=> [ "ppc64_asm" ], +	template	=> 1 +    }, +); diff --git a/openssl-1.1.0h/Configurations/10-main.conf b/openssl-1.1.0h/Configurations/10-main.conf new file mode 100644 index 0000000..b49f04b --- /dev/null +++ b/openssl-1.1.0h/Configurations/10-main.conf @@ -0,0 +1,1884 @@ +## -*- mode: perl; -*- +## Standard openssl configuration targets. + +# Helper functions for the Windows configs +my $vc_win64a_info = {}; +sub vc_win64a_info { +    unless (%$vc_win64a_info) { +        if (`nasm -v 2>NUL` =~ /NASM version ([0-9]+\.[0-9]+)/ && $1 >= 2.0) { +            $vc_win64a_info = { as        => "nasm", +                                asflags   => "-f win64 -DNEAR -Ox -g", +                                asoutflag => "-o" }; +        } elsif ($disabled{asm}) { +            $vc_win64a_info = { as        => "ml64", +                                asflags   => "/c /Cp /Cx /Zi", +                                asoutflag => "/Fo" }; +        } else { +            $die->("NASM not found - please read INSTALL and NOTES.WIN for further details\n"); +            $vc_win64a_info = { as        => "{unknown}", +                                asflags   => "", +                                asoutflag => "" }; +        } +    } +    return $vc_win64a_info; +} + +my $vc_win32_info = {}; +sub vc_win32_info { +    unless (%$vc_win32_info) { +        my $ver=`nasm -v 2>NUL`; +        my $vew=`nasmw -v 2>NUL`; +        if ($ver ne "" || $vew ne "") { +            $vc_win32_info = { as        => $ver ge $vew ? "nasm" : "nasmw", +                               asflags   => "-f win32", +                               asoutflag => "-o", +                               perlasm_scheme => "win32n" }; +        } elsif ($disabled{asm}) { +            $vc_win32_info = { as        => "ml", +                               asflags   => "/nologo /Cp /coff /c /Cx /Zi", +                               asoutflag => "/Fo", +                               perlasm_scheme => "win32" }; +        } else { +            $die->("NASM not found - please read INSTALL and NOTES.WIN for further details\n"); +            $vc_win32_info = { as        => "{unknown}", +                               asflags   => "", +                               asoutflag => "", +                               perlasm_scheme => "win32" }; +        } +    } +    return $vc_win32_info; +} + +my $vc_wince_info = {}; +sub vc_wince_info { +    unless (%$vc_wince_info) { +        # sanity check +        $die->('%OSVERSION% is not defined') if (!defined($ENV{'OSVERSION'})); +        $die->('%PLATFORM% is not defined')  if (!defined($ENV{'PLATFORM'})); +        $die->('%TARGETCPU% is not defined') if (!defined($ENV{'TARGETCPU'})); + +        # +        # Idea behind this is to mimic flags set by eVC++ IDE... +        # +        my $wcevers = $ENV{'OSVERSION'};                    # WCENNN +	my $wcevernum; +	my $wceverdotnum; +	if ($wcevers =~ /^WCE([1-9])([0-9]{2})$/) { +	    $wcevernum = "$1$2"; +	    $wceverdotnum = "$1.$2"; +	} else { +	    $die->('%OSVERSION% value is insane'); +	    $wcevernum = "{unknown}"; +	    $wceverdotnum = "{unknown}"; +	} +        my $wcecdefs = "-D_WIN32_WCE=$wcevernum -DUNDER_CE=$wcevernum"; # -D_WIN32_WCE=NNN +        my $wcelflag = "/subsystem:windowsce,$wceverdotnum";        # ...,N.NN + +        my $wceplatf =  $ENV{'PLATFORM'}; + +        $wceplatf =~ tr/a-z0-9 /A-Z0-9_/; +        $wcecdefs .= " -DWCE_PLATFORM_$wceplatf"; + +        my $wcetgt = $ENV{'TARGETCPU'};                     # just shorter name... +      SWITCH: for($wcetgt) { +          /^X86/        && do { $wcecdefs.=" -Dx86 -D_X86_ -D_i386_ -Di_386_"; +                                $wcelflag.=" /machine:X86";     last; }; +          /^ARMV4[IT]/  && do { $wcecdefs.=" -DARM -D_ARM_ -D$wcetgt"; +                                $wcecdefs.=" -DTHUMB -D_THUMB_" if($wcetgt=~/T$/); +                                $wcecdefs.=" -QRarch4T -QRinterwork-return"; +                                $wcelflag.=" /machine:THUMB";   last; }; +          /^ARM/        && do { $wcecdefs.=" -DARM -D_ARM_ -D$wcetgt"; +                                $wcelflag.=" /machine:ARM";     last; }; +          /^MIPSIV/     && do { $wcecdefs.=" -DMIPS -D_MIPS_ -DR4000 -D$wcetgt"; +                                $wcecdefs.=" -D_MIPS64 -QMmips4 -QMn32"; +                                $wcelflag.=" /machine:MIPSFPU"; last; }; +          /^MIPS16/     && do { $wcecdefs.=" -DMIPS -D_MIPS_ -DR4000 -D$wcetgt"; +                                $wcecdefs.=" -DMIPSII -QMmips16"; +                                $wcelflag.=" /machine:MIPS16";  last; }; +          /^MIPSII/     && do { $wcecdefs.=" -DMIPS -D_MIPS_ -DR4000 -D$wcetgt"; +                                $wcecdefs.=" -QMmips2"; +                                $wcelflag.=" /machine:MIPS";    last; }; +          /^R4[0-9]{3}/ && do { $wcecdefs.=" -DMIPS -D_MIPS_ -DR4000"; +                                $wcelflag.=" /machine:MIPS";    last; }; +          /^SH[0-9]/    && do { $wcecdefs.=" -D$wcetgt -D_${wcetgt}_ -DSHx"; +                                $wcecdefs.=" -Qsh4" if ($wcetgt =~ /^SH4/); +                                $wcelflag.=" /machine:$wcetgt"; last; }; +          { $wcecdefs.=" -D$wcetgt -D_${wcetgt}_"; +            $wcelflag.=" /machine:$wcetgt";                     last; }; +      } + +        $vc_wince_info = { cflags => $wcecdefs, +                           lflags => $wcelflag }; +    } +    return $vc_wince_info; +} + +# Helper functions for the VMS configs +my $vms_info = {}; +sub vms_info { +    unless (%$vms_info) { +        my $pointer_size = shift; +        my $pointer_size_str = $pointer_size == 0 ? "" : "$pointer_size"; + +        $vms_info->{disable_warns} = [ ]; +        $vms_info->{pointer_size} = $pointer_size_str; +        if ($pointer_size == 64) { +            `PIPE CC /NOCROSS_REFERENCE /NOLIST /NOOBJECT /WARNINGS = DISABLE = ( MAYLOSEDATA3, EMPTYFILE ) NL: 2> NL:`; +            if ($? == 0) { +                push @{$vms_info->{disable_warns}}, "MAYLOSEDATA3"; +            } +        } + +        unless ($disabled{zlib}) { +            my $default_zlib = 'GNV$LIBZSHR' . $pointer_size_str; +            if (defined($disabled{"zlib-dynamic"})) { +                $vms_info->{zlib} = $withargs{zlib_lib} || "$default_zlib/SHARE"; +            } else { +                $vms_info->{def_zlib} = $withargs{zlib_lib} || $default_zlib; +                # In case the --with-zlib-lib value contains something like +                # /SHARE or /LIB or so at the end, remove it. +                $vms_info->{def_zlib} =~ s|/.*$||g; +            } +        } +    } +    return $vms_info; +} + +%targets = ( + +#### Basic configs that should work on any 32-bit box +    "gcc" => { +        cc               => "gcc", +        cflags           => picker(debug   => "-O0 -g", +                                   release => "-O3"), +        thread_scheme    => "(unknown)", +        bn_ops           => "BN_LLONG", +    }, +    "cc" => { +        cc               => "cc", +        cflags           => "-O", +        thread_scheme    => "(unknown)", +    }, + +#### VOS Configurations +    "vos-gcc" => { +        inherit_from     => [ "BASE_unix" ], +        cc               => "gcc", +        cflags           => picker(default => "-Wall -DOPENSSL_SYS_VOS -D_POSIX_C_SOURCE=200112L -D_BSD -D_VOS_EXTENDED_NAMES -DB_ENDIAN", +                                   debug   => "-O0 -g", +                                   release => "-O3"), +        thread_scheme    => "(unknown)", +        sys_id           => "VOS", +        lflags           => "-Wl,-map", +        bn_ops           => "BN_LLONG", +        shared_extension => ".so", +    }, + +#### Solaris configurations +    "solaris-common" => { +        inherit_from     => [ "BASE_unix" ], +        template         => 1, +        cflags           => "-DFILIO_H", +        ex_libs          => add("-lsocket -lnsl -ldl"), +        dso_scheme       => "dlfcn", +        thread_scheme    => "pthreads", +        shared_target    => "solaris-shared", +        shared_extension => ".so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", +    }, +#### Solaris x86 with GNU C setups +    "solaris-x86-gcc" => { +        # NB. GNU C has to be configured to use GNU assembler, and not +        # /usr/ccs/bin/as. Failure to comply will result in compile +        # failures [at least] in 32-bit build. +        # [Above statement is in direct contradition with one below. +        #  Latter is kept, because it's formally inappropriate to +        #  modify compile flags in letter release.] +        # -DOPENSSL_NO_INLINE_ASM switches off inline assembler. We have +        # to do it here because whenever GNU C instantiates an assembler +        # template it surrounds it with #APP #NO_APP comment pair which +        # (at least Solaris 7_x86) /usr/ccs/bin/as fails to assemble +        # with "Illegal mnemonic" error message. +        inherit_from     => [ "solaris-common", asm("x86_elf_asm") ], +        cc               => "gcc", +        cflags           => add_before(picker(default => "-Wall -DL_ENDIAN -DOPENSSL_NO_INLINE_ASM", +                                              debug   => "-O0 -g", +                                              release => "-O3 -fomit-frame-pointer"), +                                       threads("-pthread")), +        ex_libs          => add(threads("-pthread")), +        bn_ops           => "BN_LLONG", +        shared_cflag     => "-fPIC", +        shared_ldflag    => "-shared -static-libgcc", +    }, +    "solaris64-x86_64-gcc" => { +        # -shared -static-libgcc might appear controversial, but modules +        # taken from static libgcc do not have relocations and linking +        # them into our shared objects doesn't have any negative side +        # effects. On the contrary, doing so makes it possible to use +        # gcc shared build with Sun C. Given that gcc generates faster +        # code [thanks to inline assembler], I would actually recommend +        # to consider using gcc shared build even with vendor compiler:-) +        #					<appro@fy.chalmers.se> +        inherit_from     => [ "solaris-common", asm("x86_64_asm") ], +        cc               => "gcc", +        cflags           => add_before(picker(default => "-m64 -Wall -DL_ENDIAN", +                                              debug   => "-O0 -g", +                                              release => "-O3"), +                                       threads("-pthread")), +        ex_libs          => add(threads("-pthread")), +        bn_ops           => "SIXTY_FOUR_BIT_LONG", +        perlasm_scheme   => "elf", +        shared_cflag     => "-fPIC", +        shared_ldflag    => "-m64 -shared -static-libgcc", +        multilib         => "/64", +    }, + +#### Solaris x86 with Sun C setups +    # There used to be solaris-x86-cc target, but it was removed, +    # primarily because vendor assembler can't assemble our modules +    # with -KPIC flag. As result it, assembly support, was not even +    # available as option. But its lack means lack of side-channel +    # resistant code, which is incompatible with security by todays +    # standards. Fortunately gcc is readily available prepackaged +    # option, which we can firmly point at... +    # +    # On related note, solaris64-x86_64-cc target won't compile code +    # paths utilizing AVX and post-Haswell instruction extensions. +    # Consider switching to solaris64-x86_64-gcc even here... +    # +    "solaris64-x86_64-cc" => { +        inherit_from     => [ "solaris-common", asm("x86_64_asm") ], +        cc               => "cc", +        cflags           => add_before(picker(default => "-xarch=generic64 -xstrconst -Xa -DL_ENDIAN", +                                              debug   => "-g", +                                              release => "-xO5 -xdepend -xbuiltin"), +                                       threads("-D_REENTRANT")), +        thread_scheme    => "pthreads", +        lflags           => add("-xarch=generic64",threads("-mt")), +        ex_libs          => add(threads("-lpthread")), +        bn_ops           => "SIXTY_FOUR_BIT_LONG", +        perlasm_scheme   => "elf", +        shared_cflag     => "-KPIC", +        shared_ldflag    => "-xarch=generic64 -G -dy -z text", +        multilib         => "/64", +    }, + +#### SPARC Solaris with GNU C setups +    "solaris-sparcv7-gcc" => { +        inherit_from     => [ "solaris-common" ], +        cc               => "gcc", +        cflags           => add_before(picker(default => "-Wall -DB_ENDIAN -DBN_DIV2W", +                                              debug   => "-O0 -g", +                                              release => "-O3"), +                                       threads("-pthread")), +        ex_libs          => add(threads("-pthread")), +        bn_ops           => "BN_LLONG RC4_CHAR", +        shared_cflag     => "-fPIC", +        shared_ldflag    => "-shared", +    }, +    "solaris-sparcv8-gcc" => { +        inherit_from     => [ "solaris-sparcv7-gcc", asm("sparcv8_asm") ], +        cflags           => add_before("-mcpu=v8"), +    }, +    "solaris-sparcv9-gcc" => { +        # -m32 should be safe to add as long as driver recognizes +        # -mcpu=ultrasparc +        inherit_from     => [ "solaris-sparcv7-gcc", asm("sparcv9_asm") ], +        cflags           => add_before("-m32 -mcpu=ultrasparc"), +    }, +    "solaris64-sparcv9-gcc" => { +        inherit_from     => [ "solaris-sparcv9-gcc" ], +        cflags           => sub { my $f=join(" ",@_); $f =~ s/\-m32/-m64/; $f; }, +        bn_ops           => "BN_LLONG RC4_CHAR", +        shared_ldflag    => "-m64 -shared", +        multilib         => "/64", +    }, + +#### SPARC Solaris with Sun C setups +# SC4.0 doesn't pass 'make test', upgrade to SC5.0 or SC4.2. +# SC4.2 is ok, better than gcc even on bn as long as you tell it -xarch=v8 +# SC5.0 note: Compiler common patch 107357-01 or later is required! +    "solaris-sparcv7-cc" => { +        inherit_from     => [ "solaris-common" ], +        cc               => "cc", +        cflags           => add_before(picker(default => "-xstrconst -Xa -DB_ENDIAN -DBN_DIV2W", +                                              debug   => "-g", +                                              release => "-xO5 -xdepend"), +                                       threads("-D_REENTRANT")), +        lflags           => add(threads("-mt")), +        ex_libs          => add(threads("-lpthread")), +        bn_ops           => "BN_LLONG RC4_CHAR", +        shared_cflag     => "-KPIC", +        shared_ldflag    => "-G -dy -z text", +    }, +#### +    "solaris-sparcv8-cc" => { +        inherit_from     => [ "solaris-sparcv7-cc", asm("sparcv8_asm") ], +        cflags           => add_before("-xarch=v8"), +    }, +    "solaris-sparcv9-cc" => { +        inherit_from     => [ "solaris-sparcv7-cc", asm("sparcv9_asm") ], +        cflags           => add_before("-xarch=v8plus"), +    }, +    "solaris64-sparcv9-cc" => { +        inherit_from     => [ "solaris-sparcv7-cc", asm("sparcv9_asm") ], +        cflags           => add_before("-xarch=v9"), +        lflags           => add_before("-xarch=v9"), +        bn_ops           => "BN_LLONG RC4_CHAR", +        shared_ldflag    => "-xarch=v9 -G -dy -z text", +        multilib         => "/64", +    }, + +#### IRIX 6.x configs +# Only N32 and N64 ABIs are supported. +    "irix-mips3-gcc" => { +        inherit_from     => [ "BASE_unix", asm("mips64_asm") ], +        cc               => "gcc", +        cflags           => combine(picker(default => "-mabi=n32 -DB_ENDIAN -DBN_DIV3W", +                                           debug   => "-g -O0", +                                           release => "-O3"), +                                    threads("-D_SGI_MP_SOURCE")), +        ex_libs          => add(threads("-lpthread")), +        bn_ops           => "RC4_CHAR SIXTY_FOUR_BIT", +        thread_scheme    => "pthreads", +        perlasm_scheme   => "n32", +        dso_scheme       => "dlfcn", +        shared_target    => "irix-shared", +        shared_ldflag    => "-mabi=n32", +        shared_extension => ".so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", +        multilib         => "32", +    }, +    "irix-mips3-cc" => { +        inherit_from     => [ "BASE_unix", asm("mips64_asm") ], +        cc               => "cc", +        cflags           => combine(picker(default => "-n32 -mips3 -use_readonly_const -G0 -rdata_shared -DB_ENDIAN -DBN_DIV3W", +                                           debug   => "-g -O0", +                                           release => "-O2"), +                                    threads("-D_SGI_MP_SOURCE")), +        ex_libs          => add(threads("-lpthread")), +        bn_ops           => "RC4_CHAR SIXTY_FOUR_BIT", +        thread_scheme    => "pthreads", +        perlasm_scheme   => "n32", +        dso_scheme       => "dlfcn", +        shared_target    => "irix-shared", +        shared_ldflag    => "-n32", +        shared_extension => ".so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", +        multilib         => "32", +    }, +    # N64 ABI builds. +    "irix64-mips4-gcc" => { +        inherit_from     => [ "BASE_unix", asm("mips64_asm") ], +        cc               => "gcc", +        cflags           => combine(picker(default => "-mabi=64 -mips4 -DB_ENDIAN -DBN_DIV3W", +                                           debug   => "-g -O0", +                                           release => "-O3"), +                                    threads("-D_SGI_MP_SOURCE")), +        ex_libs          => add(threads("-lpthread")), +        bn_ops           => "RC4_CHAR SIXTY_FOUR_BIT_LONG", +        thread_scheme    => "pthreads", +        perlasm_scheme   => "64", +        dso_scheme       => "dlfcn", +        shared_target    => "irix-shared", +        shared_ldflag    => "-mabi=64", +        shared_extension => ".so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", +        multilib         => "64", +    }, +    "irix64-mips4-cc" => { +        inherit_from     => [ "BASE_unix", asm("mips64_asm") ], +        cc               => "cc", +        cflags           => combine(picker(default => "-64 -mips4 -use_readonly_const -G0 -rdata_shared -DB_ENDIAN -DBN_DIV3W", +                                           debug   => "-g -O0", +                                           release => "-O2"), +                                    threads("-D_SGI_MP_SOURCE")), +        ex_libs          => add(threads("-lpthread")), +        bn_ops           => "RC4_CHAR SIXTY_FOUR_BIT_LONG", +        thread_scheme    => "pthreads", +        perlasm_scheme   => "64", +        dso_scheme       => "dlfcn", +        shared_target    => "irix-shared", +        shared_ldflag    => "-64", +        shared_extension => ".so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", +        multilib         => "64", +    }, + +#### Unified HP-UX ANSI C configs. +# Special notes: +# - Originally we were optimizing at +O4 level. It should be noted +#   that the only difference between +O3 and +O4 is global inter- +#   procedural analysis. As it has to be performed during the link +#   stage the compiler leaves behind certain pseudo-code in lib*.a +#   which might be release or even patch level specific. Generating +#   the machine code for and analyzing the *whole* program appears +#   to be *extremely* memory demanding while the performance gain is +#   actually questionable. The situation is intensified by the default +#   HP-UX data set size limit (infamous 'maxdsiz' tunable) of 64MB +#   which is way too low for +O4. In other words, doesn't +O3 make +#   more sense? +# - Keep in mind that the HP compiler by default generates code +#   suitable for execution on the host you're currently compiling at. +#   If the toolkit is meant to be used on various PA-RISC processors +#   consider './Configure hpux-parisc-[g]cc +DAportable'. +# - -DMD32_XARRAY triggers workaround for compiler bug we ran into in +#   32-bit message digests. (For the moment of this writing) HP C +#   doesn't seem to "digest" too many local variables (they make "him" +#   chew forever:-). For more details look-up MD32_XARRAY comment in +#   crypto/sha/sha_lcl.h. +# - originally there were 32-bit hpux-parisc2-* targets. They were +#   scrapped, because a) they were not interchangeable with other 32-bit +#   targets; b) performance-critical 32-bit assembly modules implement +#   even PA-RISC 2.0-specific code paths, which are chosen at run-time, +#   thus adequate performance is provided even with PA-RISC 1.1 build. +#					<appro@fy.chalmers.se> +    "hpux-parisc-gcc" => { +        inherit_from     => [ "BASE_unix" ], +        cc               => "gcc", +        cflags           => combine(picker(default => "-DB_ENDIAN -DBN_DIV2W", +                                           debug   => "-O0 -g", +                                           release => "-O3"), +                                    threads("-pthread")), +        ex_libs          => add("-Wl,+s -ldld", threads("-pthread")), +        bn_ops           => "BN_LLONG", +        thread_scheme    => "pthreads", +        dso_scheme       => "dl", +        shared_target    => "hpux-shared", +        shared_cflag     => "-fPIC", +        shared_ldflag    => "-shared", +        shared_extension => ".sl.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", +    }, +    "hpux-parisc1_1-gcc" => { +        inherit_from     => [ "hpux-parisc-gcc", asm("parisc11_asm") ], +        multilib         => "/pa1.1", +    }, +    "hpux64-parisc2-gcc" => { +        inherit_from     => [ "BASE_unix", asm("parisc20_64_asm") ], +        cc               => "gcc", +        cflags           => combine(picker(default => "-DB_ENDIAN", +                                           debug   => "-O0 -g", +                                           release => "-O3"), +                                    threads("-D_REENTRANT")), +        ex_libs          => add("-ldl"), +        bn_ops           => "SIXTY_FOUR_BIT_LONG RC4_CHAR", +        thread_scheme    => "pthreads", +        dso_scheme       => "dlfcn", +        shared_target    => "hpux-shared", +        shared_cflag     => "-fpic", +        shared_ldflag    => "-shared", +        shared_extension => ".sl.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", +        multilib         => "/pa20_64", +    }, + +    # More attempts at unified 10.X and 11.X targets for HP C compiler. +    # +    # Chris Ruemmler <ruemmler@cup.hp.com> +    # Kevin Steves <ks@hp.se> +    "hpux-parisc-cc" => { +        inherit_from     => [ "BASE_unix" ], +        cc               => "cc", +        cflags           => combine(picker(default => "+Optrs_strongly_typed -Ae +ESlit -DB_ENDIAN -DBN_DIV2W -DMD32_XARRAY", +                                           debug   => "+O0 +d -g", +                                           release => "+O3"), +                                    threads("-D_REENTRANT")), +        ex_libs          => add("-Wl,+s -ldld",threads("-lpthread")), +        bn_ops           => "RC4_CHAR", +        thread_scheme    => "pthreads", +        dso_scheme       => "dl", +        shared_target    => "hpux-shared", +        shared_cflag     => "+Z", +        shared_ldflag    => "-b", +        shared_extension => ".sl.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", +    }, +    "hpux-parisc1_1-cc" => { +        inherit_from     => [ "hpux-parisc-cc", asm("parisc11_asm") ], +        cflags           => add_before("+DA1.1"), +        multilib         => "/pa1.1", +    }, +    "hpux64-parisc2-cc" => { +        inherit_from     => [ "BASE_unix", asm("parisc20_64_asm") ], +        cc               => "cc", +        cflags           => combine(picker(default => "+DD64 +Optrs_strongly_typed -Ae +ESlit -DB_ENDIAN -DMD32_XARRAY", +                                           debug   => "+O0 +d -g", +                                           release => "+O3"), +                                    threads("-D_REENTRANT")), +        ex_libs          => add("-ldl",threads("-lpthread")), +        bn_ops           => "SIXTY_FOUR_BIT_LONG RC4_CHAR", +        thread_scheme    => "pthreads", +        dso_scheme       => "dlfcn", +        shared_target    => "hpux-shared", +        shared_cflag     => "+Z", +        shared_ldflag    => "+DD64 -b", +        shared_extension => ".sl.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", +        multilib         => "/pa20_64", +    }, + +    # HP/UX IA-64 targets +    "hpux-ia64-cc" => { +        inherit_from     => [ "BASE_unix", asm("ia64_asm") ], +        cc               => "cc", +        cflags           => combine(picker(default => "-Ae +DD32 +Olit=all -z -DB_ENDIAN", +                                           debug   => "+O0 +d -g", +                                           release => "+O2"), +                                    threads("-D_REENTRANT")), +        ex_libs          => add("-ldl",threads("-lpthread")), +        bn_ops           => "SIXTY_FOUR_BIT", +        thread_scheme    => "pthreads", +        dso_scheme       => "dlfcn", +        shared_target    => "hpux-shared", +        shared_cflag     => "+Z", +        shared_ldflag    => "+DD32 -b", +        shared_extension => ".so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", +        multilib         => "/hpux32", +    }, +    # Frank Geurts <frank.geurts@nl.abnamro.com> has patiently assisted +    # with debugging of the following config. +    "hpux64-ia64-cc" => { +        inherit_from     => [ "BASE_unix", asm("ia64_asm") ], +        cc               => "cc", +        cflags           => combine(picker(default => "-Ae +DD64 +Olit=all -z -DB_ENDIAN", +                                           debug   => "+O0 +d -g", +                                           release => "+O3"), +                                    threads("-D_REENTRANT")), +        ex_libs          => add("-ldl", threads("-lpthread")), +        bn_ops           => "SIXTY_FOUR_BIT_LONG", +        thread_scheme    => "pthreads", +        dso_scheme       => "dlfcn", +        shared_target    => "hpux-shared", +        shared_cflag     => "+Z", +        shared_ldflag    => "+DD64 -b", +        shared_extension => ".so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", +        multilib         => "/hpux64", +    }, +    # GCC builds... +    "hpux-ia64-gcc" => { +        inherit_from     => [ "BASE_unix", asm("ia64_asm") ], +        cc               => "gcc", +        cflags           => combine(picker(default => "-DB_ENDIAN", +                                           debug   => "-O0 -g", +                                           release => "-O3"), +                                    threads("-pthread")), +        ex_libs          => add("-ldl", threads("-pthread")), +        bn_ops           => "SIXTY_FOUR_BIT", +        thread_scheme    => "pthreads", +        dso_scheme       => "dlfcn", +        shared_target    => "hpux-shared", +        shared_cflag     => "-fpic", +        shared_ldflag    => "-shared", +        shared_extension => ".so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", +        multilib         => "/hpux32", +    }, +    "hpux64-ia64-gcc" => { +        inherit_from     => [ "BASE_unix", asm("ia64_asm") ], +        cc               => "gcc", +        cflags           => combine(picker(default => "-mlp64 -DB_ENDIAN", +                                           debug   => "-O0 -g", +                                           release => "-O3"), +                                    threads("-pthread")), +        ex_libs          => add("-ldl", threads("-pthread")), +        bn_ops           => "SIXTY_FOUR_BIT_LONG", +        thread_scheme    => "pthreads", +        dso_scheme       => "dlfcn", +        shared_target    => "hpux-shared", +        shared_cflag     => "-fpic", +        shared_ldflag    => "-mlp64 -shared", +        shared_extension => ".so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", +        multilib         => "/hpux64", +    }, + +#### HP MPE/iX http://jazz.external.hp.com/src/openssl/ +    "MPE/iX-gcc" => { +        inherit_from     => [ "BASE_unix" ], +        cc               => "gcc", +        cflags           => "-DBN_DIV2W -O3 -D_POSIX_SOURCE -D_SOCKET_SOURCE -I/SYSLOG/PUB", +        sys_id           => "MPE", +        ex_libs          => add("-L/SYSLOG/PUB -lsyslog -lsocket -lcurses"), +        thread_scheme    => "(unknown)", +        bn_ops           => "BN_LLONG", +    }, + +#### DEC Alpha Tru64 targets. Tru64 is marketing name for OSF/1 version 4 +#### and forward. In reality 'uname -s' still returns "OSF1". Originally +#### there were even osf1-* configs targeting prior versions provided, +#### but not anymore... +    "tru64-alpha-gcc" => { +        inherit_from     => [ "BASE_unix", asm("alpha_asm") ], +        cc               => "gcc", +        cflags           => combine("-std=c9x -D_XOPEN_SOURCE=500 -D_OSF_SOURCE -O3", +                                    threads("-pthread")), +        ex_libs          => add("-lrt", threads("-pthread")), # for mlock(2) +        bn_ops           => "SIXTY_FOUR_BIT_LONG", +        thread_scheme    => "pthreads", +        dso_scheme       => "dlfcn", +        shared_target    => "alpha-osf1-shared", +        shared_extension => ".so", +    }, +    "tru64-alpha-cc" => { +        inherit_from     => [ "BASE_unix", asm("alpha_asm") ], +        cc               => "cc", +        cflags           => combine("-std1 -D_XOPEN_SOURCE=500 -D_OSF_SOURCE -tune host -fast -readonly_strings", +                                    threads("-pthread")), +        ex_libs          => add("-lrt", threads("-pthread")), # for mlock(2) +        bn_ops           => "SIXTY_FOUR_BIT_LONG", +        thread_scheme    => "pthreads", +        dso_scheme       => "dlfcn", +        shared_target    => "alpha-osf1-shared", +        shared_ldflag    => "-msym", +        shared_extension => ".so", +    }, + +#### +#### Variety of LINUX:-) +#### +# *-generic* is endian-neutral target, but ./config is free to +# throw in -D[BL]_ENDIAN, whichever appropriate... +    "linux-generic32" => { +        inherit_from     => [ "BASE_unix" ], +        cc               => "gcc", +        cflags           => combine(picker(default => "-Wall", +                                           debug   => "-O0 -g", +                                           release => "-O3"), +                                    threads("-pthread")), +        ex_libs          => add("-ldl", threads("-pthread")), +        bn_ops           => "BN_LLONG RC4_CHAR", +        thread_scheme    => "pthreads", +        dso_scheme       => "dlfcn", +        shared_target    => "linux-shared", +        shared_cflag     => "-fPIC -DOPENSSL_USE_NODELETE", +        shared_ldflag    => "-Wl,-znodelete", +        shared_extension => ".so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", +    }, +    "linux-generic64" => { +        inherit_from     => [ "linux-generic32" ], +        bn_ops           => "SIXTY_FOUR_BIT_LONG RC4_CHAR", +    }, + +    "linux-ppc" => { +        inherit_from     => [ "linux-generic32", asm("ppc32_asm") ], +        perlasm_scheme   => "linux32", +    }, +    "linux-ppc64" => { +        inherit_from     => [ "linux-generic64", asm("ppc64_asm") ], +        cflags           => add("-m64 -DB_ENDIAN"), +        perlasm_scheme   => "linux64", +        shared_ldflag    => add("-m64"), +        multilib         => "64", +    }, +    "linux-ppc64le" => { +        inherit_from     => [ "linux-generic64", asm("ppc64_asm") ], +        cflags           => add("-m64 -DL_ENDIAN"), +        perlasm_scheme   => "linux64le", +        shared_ldflag    => add("-m64"), +    }, + +    "linux-armv4" => { +        ################################################################ +        # Note that -march is not among compiler options in linux-armv4 +        # target description. Not specifying one is intentional to give +        # you choice to: +        # +        # a) rely on your compiler default by not specifying one; +        # b) specify your target platform explicitly for optimal +        # performance, e.g. -march=armv6 or -march=armv7-a; +        # c) build "universal" binary that targets *range* of platforms +        # by specifying minimum and maximum supported architecture; +        # +        # As for c) option. It actually makes no sense to specify +        # maximum to be less than ARMv7, because it's the least +        # requirement for run-time switch between platform-specific +        # code paths. And without run-time switch performance would be +        # equivalent to one for minimum. Secondly, there are some +        # natural limitations that you'd have to accept and respect. +        # Most notably you can *not* build "universal" binary for +        # big-endian platform. This is because ARMv7 processor always +        # picks instructions in little-endian order. Another similar +        # limitation is that -mthumb can't "cross" -march=armv6t2 +        # boundary, because that's where it became Thumb-2. Well, this +        # limitation is a bit artificial, because it's not really +        # impossible, but it's deemed too tricky to support. And of +        # course you have to be sure that your binutils are actually +        # up to the task of handling maximum target platform. With all +        # this in mind here is an example of how to configure +        # "universal" build: +        # +        # ./Configure linux-armv4 -march=armv6 -D__ARM_MAX_ARCH__=8 +        # +        inherit_from     => [ "linux-generic32", asm("armv4_asm") ], +        perlasm_scheme   => "linux32", +    }, +    "linux-aarch64" => { +        inherit_from     => [ "linux-generic64", asm("aarch64_asm") ], +        perlasm_scheme   => "linux64", +    }, +    "linux-arm64ilp32" => {  # https://wiki.linaro.org/Platform/arm64-ilp32 +        inherit_from     => [ "linux-generic32", asm("aarch64_asm") ], +        cflags           => add("-mabi=ilp32"), +        bn_ops           => "SIXTY_FOUR_BIT RC4_CHAR", +        perlasm_scheme   => "linux64", +        shared_ldflag    => add("-mabi=ilp32"), +    }, + +    "linux-mips32" => { +        # Configure script adds minimally required -march for assembly +        # support, if no -march was specified at command line. +        inherit_from     => [ "linux-generic32", asm("mips32_asm") ], +        cflags           => add("-mabi=32 -DBN_DIV3W"), +        perlasm_scheme   => "o32", +        shared_ldflag    => add("-mabi=32"), +    }, +    # mips32 and mips64 below refer to contemporary MIPS Architecture +    # specifications, MIPS32 and MIPS64, rather than to kernel bitness. +    "linux-mips64" => { +        inherit_from     => [ "linux-generic32", asm("mips64_asm") ], +        cflags           => add("-mabi=n32 -DBN_DIV3W"), +        bn_ops           => "SIXTY_FOUR_BIT RC4_CHAR", +        perlasm_scheme   => "n32", +        shared_ldflag    => add("-mabi=n32"), +        multilib         => "32", +    }, +    "linux64-mips64" => { +        inherit_from     => [ "linux-generic64", asm("mips64_asm") ], +        cflags           => add("-mabi=64 -DBN_DIV3W"), +        perlasm_scheme   => "64", +        shared_ldflag    => add("-mabi=64"), +        multilib         => "64", +    }, + +    #### IA-32 targets... +    #### These two targets are a bit aged and are to be used on older Linux +    #### machines where gcc doesn't understand -m32 and -m64 +    "linux-elf" => { +        inherit_from     => [ "linux-generic32", asm("x86_elf_asm") ], +        cflags           => add(picker(default => "-DL_ENDIAN", +                                       release => "-fomit-frame-pointer")), +        bn_ops           => "BN_LLONG", +    }, +    "linux-aout" => { +        inherit_from     => [ "BASE_unix", asm("x86_asm") ], +        cc               => "gcc", +        cflags           => add(picker(default => "-DL_ENDIAN -Wall", +                                       debug   => "-O0 -g", +                                       release => "-O3 -fomit-frame-pointer")), +        bn_ops           => "BN_LLONG", +        thread_scheme    => "(unknown)", +        perlasm_scheme   => "a.out", +    }, + +    #### X86 / X86_64 targets +    "linux-x86" => { +        inherit_from     => [ "linux-generic32", asm("x86_asm") ], +        cflags           => add(picker(default => "-m32 -DL_ENDIAN", +                                       release => "-fomit-frame-pointer")), +        bn_ops           => "BN_LLONG", +        perlasm_scheme   => "elf", +        shared_ldflag    => add("-m32"), +    }, +    "linux-x86-clang" => { +        inherit_from     => [ "linux-x86" ], +        cc               => "clang", +        cxx              => "clang++", +        cflags           => add("-Wextra -Qunused-arguments"), +    }, +    "linux-x86_64" => { +        inherit_from     => [ "linux-generic64", asm("x86_64_asm") ], +        cflags           => add("-m64 -DL_ENDIAN"), +        bn_ops           => "SIXTY_FOUR_BIT_LONG", +        perlasm_scheme   => "elf", +        shared_ldflag    => add("-m64"), +        multilib         => "64", +    }, +    "linux-x86_64-clang" => { +        inherit_from     => [ "linux-x86_64" ], +        cc               => "clang", +        cflags           => add("-Wextra -Qunused-arguments"), +    }, +    "linux-x32" => { +        inherit_from     => [ "linux-generic32", asm("x86_64_asm") ], +        cflags           => add("-mx32 -DL_ENDIAN"), +        bn_ops           => "SIXTY_FOUR_BIT", +        perlasm_scheme   => "elf32", +        shared_ldflag    => add("-mx32"), +        multilib         => "x32", +    }, + +    "linux-ia64" => { +        inherit_from     => [ "linux-generic64", asm("ia64_asm") ], +        bn_ops           => "SIXTY_FOUR_BIT_LONG", +    }, + +    "linux64-s390x" => { +        inherit_from     => [ "linux-generic64", asm("s390x_asm") ], +        cflags           => add("-m64 -DB_ENDIAN"), +        perlasm_scheme   => "64", +        shared_ldflag    => add("-m64"), +        multilib         => "64", +    }, +    "linux32-s390x" => { +        #### So called "highgprs" target for z/Architecture CPUs +        # "Highgprs" is kernel feature first implemented in Linux +        # 2.6.32, see /proc/cpuinfo. The idea is to preserve most +        # significant bits of general purpose registers not only +        # upon 32-bit process context switch, but even on +        # asynchronous signal delivery to such process. This makes +        # it possible to deploy 64-bit instructions even in legacy +        # application context and achieve better [or should we say +        # adequate] performance. The build is binary compatible with +        # linux-generic32, and the idea is to be able to install the +        # resulting libcrypto.so alongside generic one, e.g. as +        # /lib/highgprs/libcrypto.so.x.y, for ldconfig and run-time +        # linker to autodiscover. Unfortunately it doesn't work just +        # yet, because of couple of bugs in glibc +        # sysdeps/s390/dl-procinfo.c affecting ldconfig and ld.so.1... +        # +        inherit_from     => [ "linux-generic32", asm("s390x_asm") ], +        cflags           => add("-m31 -Wa,-mzarch -DB_ENDIAN"), +        bn_asm_src       => sub { my $r=join(" ",@_); $r=~s|asm/s390x\.S|bn_asm.c|; $r; }, +        perlasm_scheme   => "31", +        shared_ldflag    => add("-m31"), +        multilib         => "/highgprs", +    }, + +    #### SPARC Linux setups +    # Ray Miller <ray.miller@computing-services.oxford.ac.uk> has +    # patiently assisted with debugging of following two configs. +    "linux-sparcv8" => { +        inherit_from     => [ "linux-generic32", asm("sparcv8_asm") ], +        cflags           => add("-mcpu=v8 -DB_ENDIAN -DBN_DIV2W"), +    }, +    "linux-sparcv9" => { +        # it's a real mess with -mcpu=ultrasparc option under Linux, +        # but -Wa,-Av8plus should do the trick no matter what. +        inherit_from     => [ "linux-generic32", asm("sparcv9_asm") ], +        cflags           => add("-m32 -mcpu=ultrasparc -Wa,-Av8plus -DB_ENDIAN -DBN_DIV2W"), +        shared_ldflag    => add("-m32"), +    }, +    "linux64-sparcv9" => { +        # GCC 3.1 is a requirement +        inherit_from     => [ "linux-generic64", asm("sparcv9_asm") ], +        cflags           => add("-m64 -mcpu=ultrasparc -DB_ENDIAN"), +        bn_ops           => "BN_LLONG RC4_CHAR", +        shared_ldflag    => add("-m64"), +        multilib         => "64", +    }, + +    "linux-alpha-gcc" => { +        inherit_from     => [ "linux-generic64", asm("alpha_asm") ], +        cflags           => add("-DL_ENDIAN"), +        bn_ops           => "SIXTY_FOUR_BIT_LONG", +    }, +    "linux-c64xplus" => { +        inherit_from     => [ "BASE_unix" ], +        # TI_CGT_C6000_7.3.x is a requirement +        cc               => "cl6x", +        cflags           => combine("--linux -ea=.s -eo=.o -mv6400+ -o2 -ox -ms -pden -DOPENSSL_SMALL_FOOTPRINT", +                                    threads("-D_REENTRANT")), +        bn_ops           => "BN_LLONG", +        cpuid_asm_src    => "c64xpluscpuid.s", +        bn_asm_src       => "asm/bn-c64xplus.asm c64xplus-gf2m.s", +        aes_asm_src      => "aes-c64xplus.s aes_cbc.c aes-ctr.fake", +        sha1_asm_src     => "sha1-c64xplus.s sha256-c64xplus.s sha512-c64xplus.s", +        rc4_asm_src      => "rc4-c64xplus.s", +        modes_asm_src    => "ghash-c64xplus.s", +        chacha_asm_src   => "chacha-c64xplus.s", +        poly1305_asm_src => "poly1305-c64xplus.s", +        thread_scheme    => "pthreads", +        perlasm_scheme   => "void", +        dso_scheme       => "dlfcn", +        shared_target    => "linux-shared", +        shared_cflag     => "--pic", +        shared_ldflag    => add("-z --sysv --shared"), +        shared_extension => ".so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", +        ranlib           => "true", +    }, + +#### Android: linux-* but without pointers to headers and libs. +    # +    # It takes pair of prior-set environment variables to make it work: +    # +    # CROSS_SYSROOT=/some/where/android-ndk-<ver>/platforms/android-<apiver>/arch-<arch> +    # CROSS_COMPILE=<prefix> +    # +    # As well as PATH adjusted to cover ${CROSS_COMPILE}gcc and company. +    # For example to compile for ICS and ARM with NDK 10d, you'd: +    # +    # ANDROID_NDK=/some/where/android-ndk-10d +    # CROSS_SYSROOT=$ANDROID_NDK/platforms/android-14/arch-arm +    # CROSS_COMPILE=arm-linux-androideabi- +    # PATH=$ANDROID_NDK/toolchains/arm-linux-androideabi-4.8/prebuild/linux-x86_64/bin +    # +    "android" => { +        inherit_from     => [ "linux-generic32" ], +        # Special note about unconditional -fPIC and -pie. The underlying +        # reason is that Lollipop refuses to run non-PIE. But what about +        # older systems and NDKs? -fPIC was never problem, so the only +        # concern is -pie. Older toolchains, e.g. r4, appear to handle it +        # and binaries turn mostly functional. "Mostly" means that oldest +        # Androids, such as Froyo, fail to handle executable, but newer +        # systems are perfectly capable of executing binaries targeting +        # Froyo. Keep in mind that in the nutshell Android builds are +        # about JNI, i.e. shared libraries, not applications. +        cflags           => add(picker(default => "-mandroid -fPIC --sysroot=\$(CROSS_SYSROOT) -Wa,--noexecstack")), +        bin_cflags       => "-pie", +    }, +    "android-x86" => { +        inherit_from     => [ "android", asm("x86_asm") ], +        cflags           => add(picker(release => "-fomit-frame-pointer")), +        bn_ops           => "BN_LLONG", +        perlasm_scheme   => "android", +    }, +    ################################################################ +    # Contemporary Android applications can provide multiple JNI +    # providers in .apk, targeting multiple architectures. Among +    # them there is "place" for two ARM flavours: generic eabi and +    # armv7-a/hard-float. However, it should be noted that OpenSSL's +    # ability to engage NEON is not constrained by ABI choice, nor +    # is your ability to call OpenSSL from your application code +    # compiled with floating-point ABI other than default 'soft'. +    # [Latter thanks to __attribute__((pcs("aapcs"))) declaration.] +    # This means that choice of ARM libraries you provide in .apk +    # is driven by application needs. For example if application +    # itself benefits from NEON or is floating-point intensive, then +    # it might be appropriate to provide both libraries. Otherwise +    # just generic eabi would do. But in latter case it would be +    # appropriate to +    # +    #   ./Configure android-armeabi -D__ARM_MAX_ARCH__=8 +    # +    # in order to build "universal" binary and allow OpenSSL take +    # advantage of NEON when it's available. +    # +    "android-armeabi" => { +        inherit_from     => [ "android", asm("armv4_asm") ], +    }, +    "android-mips" => { +        inherit_from     => [ "android", asm("mips32_asm") ], +        perlasm_scheme   => "o32", +    }, + +    "android64" => { +        inherit_from     => [ "linux-generic64" ], +        cflags           => add(picker(default => "-mandroid -fPIC --sysroot=\$(CROSS_SYSROOT) -Wa,--noexecstack")), +        bin_cflags       => "-pie", +    }, +    "android64-aarch64" => { +        inherit_from     => [ "android64", asm("aarch64_asm") ], +        perlasm_scheme   => "linux64", +    }, + +#### *BSD +    "BSD-generic32" => { +        # As for thread cflag. Idea is to maintain "collective" set of +        # flags, which would cover all BSD flavors. -pthread applies +        # to them all, but is treated differently. OpenBSD expands is +        # as -D_POSIX_THREAD -lc_r, which is sufficient. FreeBSD 4.x +        # expands it as -lc_r, which has to be accompanied by explicit +        # -D_THREAD_SAFE and sometimes -D_REENTRANT. FreeBSD 5.x +        # expands it as -lc_r, which seems to be sufficient? +        inherit_from     => [ "BASE_unix" ], +        cc               => "cc", +        cflags           => combine(picker(default => "-Wall", +                                           debug   => "-O0 -g", +                                           release => "-O3"), +                                    threads("-pthread -D_THREAD_SAFE -D_REENTRANT")), +        bn_ops           => "BN_LLONG", +        thread_scheme    => "pthreads", +        dso_scheme       => "dlfcn", +        shared_target    => "bsd-gcc-shared", +        shared_cflag     => "-fPIC", +        shared_extension => ".so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", +    }, +    "BSD-generic64" => { +        inherit_from     => [ "BSD-generic32" ], +        bn_ops           => "SIXTY_FOUR_BIT_LONG", +    }, + +    "BSD-x86" => { +        inherit_from     => [ "BSD-generic32", asm("x86_asm") ], +        cflags           => add(picker(default => "-DL_ENDIAN", +                                       release => "-fomit-frame-pointer")), +        bn_ops           => "BN_LLONG", +        shared_target    => "bsd-shared", +        perlasm_scheme   => "a.out", +    }, +    "BSD-x86-elf" => { +        inherit_from     => [ "BSD-x86" ], +        perlasm_scheme   => "elf", +    }, + +    "BSD-sparcv8" => { +        inherit_from     => [ "BSD-generic32", asm("sparcv8_asm") ], +        cflags           => add("-mcpu=v8 -DB_ENDIAN"), +    }, +    "BSD-sparc64" => { +        # -DMD32_REG_T=int doesn't actually belong in sparc64 target, it +        # simply *happens* to work around a compiler bug in gcc 3.3.3, +        # triggered by RIPEMD160 code. +        inherit_from     => [ "BSD-generic64", asm("sparcv9_asm") ], +        cflags           => add("-DB_ENDIAN -DMD32_REG_T=int"), +        bn_ops           => "BN_LLONG", +    }, + +    "BSD-ia64" => { +        inherit_from     => [ "BSD-generic64", asm("ia64_asm") ], +        cflags           => add_before("-DL_ENDIAN"), +        bn_ops           => "SIXTY_FOUR_BIT_LONG", +    }, + +    "BSD-x86_64" => { +        inherit_from     => [ "BSD-generic64", asm("x86_64_asm") ], +        cflags           => add_before("-DL_ENDIAN"), +        bn_ops           => "SIXTY_FOUR_BIT_LONG", +        perlasm_scheme   => "elf", +    }, + +    "bsdi-elf-gcc" => { +        inherit_from     => [ "BASE_unix", asm("x86_elf_asm") ], +        cc               => "gcc", +        cflags           => "-DPERL5 -DL_ENDIAN -fomit-frame-pointer -O3 -Wall", +        ex_libs          => add("-ldl"), +        bn_ops           => "BN_LLONG", +        thread_scheme    => "(unknown)", +        dso_scheme       => "dlfcn", +        shared_target    => "bsd-gcc-shared", +        shared_cflag     => "-fPIC", +        shared_extension => ".so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", +    }, + +    "nextstep" => { +        inherit_from     => [ "BASE_unix" ], +        cc               => "cc", +        cflags           => "-O -Wall", +        unistd           => "<libc.h>", +        bn_ops           => "BN_LLONG", +        thread_scheme    => "(unknown)", +    }, +    "nextstep3.3" => { +        inherit_from     => [ "BASE_unix" ], +        cc               => "cc", +        cflags           => "-O3 -Wall", +        unistd           => "<libc.h>", +        bn_ops           => "BN_LLONG", +        thread_scheme    => "(unknown)", +    }, + +# QNX +    "qnx4" => { +        inherit_from     => [ "BASE_unix" ], +        cc               => "cc", +        cflags           => "-DL_ENDIAN -DTERMIO", +        thread_scheme    => "(unknown)", +    }, +    "QNX6" => { +        inherit_from     => [ "BASE_unix" ], +        cc               => "gcc", +        ex_libs          => add("-lsocket"), +        dso_scheme       => "dlfcn", +        shared_target    => "bsd-gcc-shared", +        shared_cflag     => "-fPIC", +        shared_extension => ".so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", +    }, +    "QNX6-i386" => { +        inherit_from     => [ "BASE_unix", asm("x86_elf_asm") ], +        cc               => "gcc", +        cflags           => "-DL_ENDIAN -O2 -Wall", +        ex_libs          => add("-lsocket"), +        dso_scheme       => "dlfcn", +        shared_target    => "bsd-gcc-shared", +        shared_cflag     => "-fPIC", +        shared_extension => ".so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", +    }, + +#### SCO/Caldera targets. +# +# Originally we had like unixware-*, unixware-*-pentium, unixware-*-p6, etc. +# Now we only have blended unixware-* as it's the only one used by ./config. +# If you want to optimize for particular microarchitecture, bypass ./config +# and './Configure unixware-7 -Kpentium_pro' or whatever appropriate. +# Note that not all targets include assembler support. Mostly because of +# lack of motivation to support out-of-date platforms with out-of-date +# compiler drivers and assemblers. Tim Rice <tim@multitalents.net> has +# patiently assisted to debug most of it. +# +# UnixWare 2.0x fails destest with -O. +    "unixware-2.0" => { +        inherit_from     => [ "BASE_unix" ], +        cc               => "cc", +        cflags           => combine("-DFILIO_H -DNO_STRINGS_H", +                                    threads("-Kthread")), +        ex_libs          => add("-lsocket -lnsl -lresolv -lx"), +        thread_scheme    => "uithreads", +    }, +    "unixware-2.1" => { +        inherit_from     => [ "BASE_unix" ], +        cc               => "cc", +        cflags           => combine("-O -DFILIO_H", +                                    threads("-Kthread")), +        ex_libs          => add("-lsocket -lnsl -lresolv -lx"), +        thread_scheme    => "uithreads", +    }, +    "unixware-7" => { +        inherit_from     => [ "BASE_unix", asm("x86_elf_asm") ], +        cc               => "cc", +        cflags           => combine("-O -DFILIO_H -Kalloca", +                                    threads("-Kthread")), +        ex_libs          => add("-lsocket -lnsl"), +        thread_scheme    => "uithreads", +        bn_ops           => "BN_LLONG", +        perlasm_scheme   => "elf-1", +        dso_scheme       => "dlfcn", +        shared_target    => "svr5-shared", +        shared_cflag     => "-Kpic", +        shared_extension => ".so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", +    }, +    "unixware-7-gcc" => { +        inherit_from     => [ "BASE_unix", asm("x86_elf_asm") ], +        cc               => "gcc", +        cflags           => combine("-DL_ENDIAN -DFILIO_H -O3 -fomit-frame-pointer -Wall", +                                    threads("-D_REENTRANT")), +        ex_libs          => add("-lsocket -lnsl"), +        bn_ops           => "BN_LLONG", +        thread_scheme    => "pthreads", +        perlasm_scheme   => "elf-1", +        dso_scheme       => "dlfcn", +        shared_target    => "gnu-shared", +        shared_cflag     => "-fPIC", +        shared_extension => ".so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", +    }, +# SCO 5 - Ben Laurie <ben@algroup.co.uk> says the -O breaks the SCO cc. +    "sco5-cc" => { +        inherit_from     => [ "BASE_unix", asm("x86_elf_asm") ], +        cc               => "cc", +        cflags           => "-belf", +        ex_libs          => add("-lsocket -lnsl"), +        thread_scheme    => "(unknown)", +        perlasm_scheme   => "elf-1", +        dso_scheme       => "dlfcn", +        shared_target    => "svr3-shared", +        shared_cflag     => "-Kpic", +        shared_extension => ".so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", +    }, +    "sco5-gcc" => { +        inherit_from     => [ "BASE_unix", asm("x86_elf_asm") ], +        cc               => "gcc", +        cflags           => "-O3 -fomit-frame-pointer", +        ex_libs          => add("-lsocket -lnsl"), +        bn_ops           => "BN_LLONG", +        thread_scheme    => "(unknown)", +        perlasm_scheme   => "elf-1", +        dso_scheme       => "dlfcn", +        shared_target    => "svr3-shared", +        shared_cflag     => "-fPIC", +        shared_extension => ".so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", +    }, + +#### IBM's AIX. +    # Below targets assume AIX >=5. Caveat lector. If you are accustomed +    # to control compilation "bitness" by setting $OBJECT_MODE environment +    # variable, then you should know that in OpenSSL case it's considered +    # only in ./config. Once configured, build procedure remains "deaf" to +    # current value of $OBJECT_MODE. +    "aix-gcc" => { +        inherit_from     => [ "BASE_unix", asm("ppc32_asm") ], +        cc               => "gcc", +        cflags           => combine(picker(default => "-DB_ENDIAN", +                                           debug   => "-O0 -g", +                                           release => "-O"), +                                    threads("-pthread")), +        ex_libs          => add(threads("-pthread")), +        sys_id           => "AIX", +        bn_ops           => "BN_LLONG RC4_CHAR", +        thread_scheme    => "pthreads", +        perlasm_scheme   => "aix32", +        dso_scheme       => "dlfcn", +        shared_target    => "aix-shared", +        shared_ldflag    => "-shared -static-libgcc -Wl,-G", +        shared_extension => ".so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", +        arflags          => "-X32", +    }, +    "aix64-gcc" => { +        inherit_from     => [ "BASE_unix", asm("ppc64_asm") ], +        cc               => "gcc", +        cflags           => combine(picker(default => "-maix64 -DB_ENDIAN", +                                           debug   => "-O0 -g", +                                           release => "-O"), +                                    threads("-pthread")), +        ex_libs          => add(threads("-pthread")), +        sys_id           => "AIX", +        bn_ops           => "SIXTY_FOUR_BIT_LONG RC4_CHAR", +        thread_scheme    => "pthreads", +        perlasm_scheme   => "aix64", +        dso_scheme       => "dlfcn", +        shared_target    => "aix-shared", +        shared_ldflag    => "-maix64 -shared -static-libgcc -Wl,-G", +        shared_extension => ".so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", +        arflags          => "-X64", +    }, +    "aix-cc" => { +        inherit_from     => [ "BASE_unix", asm("ppc32_asm") ], +        cc               => "cc", +        cflags           => combine(picker(default => "-q32 -DB_ENDIAN -qmaxmem=16384 -qro -qroconst", +                                           debug   => "-O0 -g", +                                           release => "-O"), +                                    threads("-qthreaded -D_THREAD_SAFE")), +        sys_id           => "AIX", +        bn_ops           => "BN_LLONG RC4_CHAR", +        thread_scheme    => "pthreads", +        ex_libs          => threads("-lpthreads"), +        perlasm_scheme   => "aix32", +        dso_scheme       => "dlfcn", +        shared_target    => "aix-shared", +        shared_ldflag    => "-q32 -G", +        shared_extension => ".so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", +        arflags          => "-X 32", +    }, +    "aix64-cc" => { +        inherit_from     => [ "BASE_unix", asm("ppc64_asm") ], +        cc               => "cc", +        cflags           => combine(picker(default => "-q64 -DB_ENDIAN -qmaxmem=16384 -qro -qroconst", +                                           debug   => "-O0 -g", +                                           release => "-O"), +                                    threads("-qthreaded -D_THREAD_SAFE")), +        sys_id           => "AIX", +        bn_ops           => "SIXTY_FOUR_BIT_LONG RC4_CHAR", +        thread_scheme    => "pthreads", +        ex_libs          => threads("-lpthreads"), +        perlasm_scheme   => "aix64", +        dso_scheme       => "dlfcn", +        shared_target    => "aix-shared", +        shared_ldflag    => "-q64 -G", +        shared_extension => ".so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", +        arflags          => "-X 64", +    }, + +# SIEMENS BS2000/OSD: an EBCDIC-based mainframe +    "BS2000-OSD" => { +        inherit_from     => [ "BASE_unix" ], +        cc               => "c89", +        cflags           => "-O -XLLML -XLLMK -XL -DB_ENDIAN -DCHARSET_EBCDIC", +        ex_libs          => add("-lsocket -lnsl"), +        bn_ops           => "THIRTY_TWO_BIT RC4_CHAR", +        thread_scheme    => "(unknown)", +    }, + +#### Visual C targets +# +# Win64 targets, WIN64I denotes IA-64 and WIN64A - AMD64 +# +# Note about -wd4090, disable warning C4090. This warning returns false +# positives in some situations. Disabling it altogether masks both +# legitimate and false cases, but as we compile on multiple platforms, +# we rely on other compilers to catch legitimate cases. +# +# Also note that we force threads no matter what.  Configuring "no-threads" +# is ignored. +    "VC-common" => { +        inherit_from     => [ "BASE_Windows" ], +        template         => 1, +        cc               => "cl", +        cflags           => "-W3 -wd4090 -Gs0 -GF -Gy -nologo -DOPENSSL_SYS_WIN32 -DWIN32_LEAN_AND_MEAN -DL_ENDIAN -D_CRT_SECURE_NO_DEPRECATE", +        defines          => add(sub { my @defs = (); +                                      unless ($disabled{"zlib-dynamic"}) { +                                          my $zlib = +                                              $withargs{zlib_lib} // "ZLIB1"; +                                          push @defs, +                                              quotify("perl", +                                                      'LIBZ="' . $zlib . '"'); +                                      } +                                      return [ @defs ]; +                                    }), +        coutflag         => "/Fo", +        lib_cflags       => add("/Zi /Fdossl_static"), +        dso_cflags       => "/Zi /Fddso", +        bin_cflags       => "/Zi /Fdapp", +        lflags           => add("/debug"), +        shared_ldflag    => "/dll", +        shared_target    => "win-shared", # meaningless except it gives Configure a hint +        thread_scheme    => "winthreads", +        dso_scheme       => "win32", +        apps_aux_src     => add("win32_init.c"), +    }, +    "VC-noCE-common" => { +        inherit_from     => [ "VC-common" ], +        template         => 1, +        cflags           => add(picker(default => "-DUNICODE -D_UNICODE", +                                       debug   => +                                       sub { +                                           ($disabled{shared} ? "" : "/MDd") +                                               ." /Od -DDEBUG -D_DEBUG"; +                                       }, +                                       release => +                                       sub { +                                           ($disabled{shared} ? "" : "/MD") +                                               ." /O2"; +                                       })), +        lib_cflags       => add(sub { $disabled{shared} ? "/MT /Zl" : () }), +        # Following might/should appears controversial, i.e. defining +        # /MDd without evaluating $disabled{shared}. It works in +        # non-shared build because static library is compiled with /Zl +        # and bares no reference to specific RTL. And it works in +        # shared build because multiple /MDd options are not prohibited. +        # But why /MDd in static build? Well, basically this is just a +        # reference point, which allows to catch eventual errors that +        # would prevent those who want to wrap OpenSSL into own .DLL. +        # Why not /MD in release build then? Well, some are likely to +        # prefer [non-debug] openssl.exe to be free from Micorosoft RTL +        # redistributable. +        bin_cflags       => add(picker(debug   => "/MDd", +                                       release => sub { $disabled{shared} ? "/MT" : () }, +                                      )), +        bin_lflags       => add("/subsystem:console /opt:ref"), +        ex_libs          => add(sub { +            my @ex_libs = (); +            push @ex_libs, 'ws2_32.lib' unless $disabled{sock}; +            push @ex_libs, 'gdi32.lib advapi32.lib crypt32.lib user32.lib'; +            return join(" ", @ex_libs); +        }), +    }, +    "VC-WIN64-common" => { +        inherit_from     => [ "VC-noCE-common" ], +        template         => 1, +        ex_libs          => add(sub { +            my @ex_libs = (); +            push @ex_libs, 'bufferoverflowu.lib' if (`cl 2>&1` =~ /14\.00\.4[0-9]{4}\./); +            return join(" ", @_, @ex_libs); +        }), +        bn_ops           => "SIXTY_FOUR_BIT EXPORT_VAR_AS_FN", +        build_scheme     => add("VC-W64", { separator => undef }), +    }, +    "VC-WIN64I" => { +        inherit_from     => [ "VC-WIN64-common", asm("ia64_asm"), +                              sub { $disabled{shared} ? () : "ia64_uplink" } ], +        as               => "ias", +        asflags          => "-d debug", +        asoutflag        => "-o", +        sys_id           => "WIN64I", +        bn_asm_src       => sub { return undef unless @_; +                                  my $r=join(" ",@_); $r=~s|bn-ia64.s|bn_asm.c|; $r; }, +        perlasm_scheme   => "ias", +        multilib         => "-ia64", +    }, +    "VC-WIN64A" => { +        inherit_from     => [ "VC-WIN64-common", asm("x86_64_asm"), +                              sub { $disabled{shared} ? () : "x86_64_uplink" } ], +        as               => sub { vc_win64a_info()->{as} }, +        asflags          => sub { vc_win64a_info()->{asflags} }, +        asoutflag        => sub { vc_win64a_info()->{asoutflag} }, +        sys_id           => "WIN64A", +        bn_asm_src       => sub { return undef unless @_; +                                  my $r=join(" ",@_); $r=~s|asm/x86_64-gcc|bn_asm|; $r; }, +        perlasm_scheme   => "auto", +        multilib         => "-x64", +    }, +    "VC-WIN32" => { +        # x86 Win32 target defaults to ANSI API, if you want UNICODE, +        # configure with 'perl Configure VC-WIN32 -DUNICODE -D_UNICODE' +        inherit_from     => [ "VC-noCE-common", asm("x86_asm"), +                              sub { $disabled{shared} ? () : "uplink_common" } ], +        as               => sub { vc_win32_info()->{as} }, +        asflags          => sub { vc_win32_info()->{asflags} }, +        asoutflag        => sub { vc_win32_info()->{asoutflag} }, +        ex_libs          => add(sub { +            my @ex_libs = (); +            # WIN32 UNICODE build gets linked with unicows.lib for +            # backward compatibility with Win9x. +            push @ex_libs, 'unicows.lib' +                if (grep { $_ eq "UNICODE" } @user_defines); +            return join(" ", @ex_libs, @_); +        }), +        sys_id           => "WIN32", +        bn_ops           => "BN_LLONG EXPORT_VAR_AS_FN", +        perlasm_scheme   => sub { vc_win32_info()->{perlasm_scheme} }, +        build_scheme     => add("VC-W32", { separator => undef }), +    }, +    "VC-CE" => { +        inherit_from     => [ "VC-common" ], +        as               => "ml", +        asflags          => "/nologo /Cp /coff /c /Cx /Zi", +        asoutflag        => "/Fo", +        cc               => "cl", +        cflags           => +            picker(default => +                   combine('/W3 /WX /GF /Gy /nologo -DUNICODE -D_UNICODE -DOPENSSL_SYS_WINCE -DWIN32_LEAN_AND_MEAN -DL_ENDIAN -DDSO_WIN32 -DNO_CHMOD -DOPENSSL_SMALL_FOOTPRINT', +                           sub { vc_wince_info()->{cflags}; }, +                           sub { defined($ENV{'WCECOMPAT'}) +                                     ? '-I$(WCECOMPAT)/include' : (); }, +                           sub { defined($ENV{'PORTSDK_LIBPATH'}) +                                     ? '-I$(PORTSDK_LIBPATH)/../../include' : (); }, +                           sub { `cl 2>&1` =~ /Version ([0-9]+)\./ && $1>=14 +                                     ? ($disabled{shared} ? " /MT" : " /MD") +                                     : " /MC"; }), +                   debug   => "/Od -DDEBUG -D_DEBUG", +                   release => "/O1i"), +        lflags           => combine("/nologo /opt:ref", +                                    sub { vc_wince_info()->{lflags}; }, +                                    sub { defined($ENV{PORTSDK_LIBPATH}) +                                              ? "/entry:mainCRTstartup" : (); }), +        sys_id           => "WINCE", +        bn_ops           => "BN_LLONG EXPORT_VAR_AS_FN", +        ex_libs          => add(sub { +            my @ex_libs = (); +            push @ex_libs, 'ws2.lib' unless $disabled{sock}; +            push @ex_libs, 'crypt32.lib'; +            if (defined($ENV{WCECOMPAT})) { +                my $x = '$(WCECOMPAT)/lib'; +                if (-f "$x/$ENV{TARGETCPU}/wcecompatex.lib") { +                    $x .= '/$(TARGETCPU)/wcecompatex.lib'; +                } else { +                    $x .= '/wcecompatex.lib'; +                } +                push @ex_libs, $x; +            } +            push @ex_libs, '$(PORTSDK_LIBPATH)/portlib.lib' +                if (defined($ENV{'PORTSDK_LIBPATH'})); +            push @ex_libs, ' /nodefaultlib coredll.lib corelibc.lib' +                if ($ENV{'TARGETCPU'} eq "X86"); +            return @ex_libs; +        }), +        build_scheme     => add("VC-WCE", { separator => undef }), +    }, + +#### MinGW +    "mingw" => { +        inherit_from     => [ "BASE_unix", asm("x86_asm"), +                              sub { $disabled{shared} ? () : "x86_uplink" } ], +        cc               => "gcc", +        cflags           => combine(picker(default => "-DL_ENDIAN -DWIN32_LEAN_AND_MEAN -DUNICODE -D_UNICODE -m32 -Wall", +                                           debug   => "-g -O0", +                                           release => "-O3 -fomit-frame-pointer"), +                                    threads("-D_MT")), +        sys_id           => "MINGW32", +        ex_libs          => add("-lws2_32 -lgdi32 -lcrypt32"), +        bn_ops           => "BN_LLONG EXPORT_VAR_AS_FN", +        thread_scheme    => "winthreads", +        perlasm_scheme   => "coff", +        dso_scheme       => "win32", +        shared_target    => "mingw-shared", +        shared_cflag     => add("-D_WINDLL"), +        shared_ldflag    => "-static-libgcc", +        shared_rcflag    => "--target=pe-i386", +        shared_extension => ".dll", +        multilib         => "", +        apps_aux_src     => add("win32_init.c"), +    }, +    "mingw64" => { +        # As for OPENSSL_USE_APPLINK. Applink makes it possible to use +        # .dll compiled with one compiler with application compiled with +        # another compiler. It's possible to engage Applink support in +        # mingw64 build, but it's not done, because till mingw64 +        # supports structured exception handling, one can't seriously +        # consider its binaries for using with non-mingw64 run-time +        # environment. And as mingw64 is always consistent with itself, +        # Applink is never engaged and can as well be omitted. +        inherit_from     => [ "BASE_unix", asm("x86_64_asm") ], +        cc               => "gcc", +        cflags           => combine(picker(default => "-DL_ENDIAN -DWIN32_LEAN_AND_MEAN -DUNICODE -D_UNICODE -m64 -Wall", +                                           debug   => "-g -O0", +                                           release => "-O3"), +                                    threads("-D_MT")), +        sys_id           => "MINGW64", +        ex_libs          => add("-lws2_32 -lgdi32 -lcrypt32"), +        bn_ops           => "SIXTY_FOUR_BIT EXPORT_VAR_AS_FN", +        thread_scheme    => "winthreads", +        perlasm_scheme   => "mingw64", +        dso_scheme       => "win32", +        shared_target    => "mingw-shared", +        shared_cflag     => add("-D_WINDLL"), +        shared_ldflag    => "-static-libgcc", +        shared_rcflag    => "--target=pe-x86-64", +        shared_extension => ".dll", +        multilib         => "64", +        apps_aux_src     => add("win32_init.c"), +    }, + +#### UEFI +    "UEFI" => { +        inherit_from     => [ "BASE_unix" ], +        cc               => "cc", +        cflags           => "-DL_ENDIAN -O", +        sys_id           => "UEFI", +    }, + +#### UWIN +    "UWIN" => { +        inherit_from     => [ "BASE_unix" ], +        cc               => "cc", +        cflags           => "-DTERMIOS -DL_ENDIAN -O -Wall", +        sys_id           => "UWIN", +        bn_ops           => "BN_LLONG", +        dso_scheme       => "win32", +    }, + +#### Cygwin +    "Cygwin-x86" => { +        inherit_from     => [ "BASE_unix", asm("x86_asm") ], +        cc               => "gcc", +        cflags           => picker(default => "-DTERMIOS -DL_ENDIAN -Wall", +                                   debug   => "-g -O0", +                                   release => "-O3 -fomit-frame-pointer"), +        sys_id           => "CYGWIN", +        bn_ops           => "BN_LLONG", +        thread_scheme    => "pthread", +        perlasm_scheme   => "coff", +        dso_scheme       => "dlfcn", +        shared_target    => "cygwin-shared", +        shared_cflag     => "-D_WINDLL", +        shared_ldflag    => "-shared", +        shared_extension => ".dll", +    }, +    "Cygwin-x86_64" => { +        inherit_from     => [ "BASE_unix", asm("x86_64_asm") ], +        cc               => "gcc", +        cflags           => picker(default => "-DTERMIOS -DL_ENDIAN -Wall", +                                   debug   => "-g -O0", +                                   release => "-O3"), +        sys_id           => "CYGWIN", +        bn_ops           => "SIXTY_FOUR_BIT_LONG", +        thread_scheme    => "pthread", +        perlasm_scheme   => "mingw64", +        dso_scheme       => "dlfcn", +        shared_target    => "cygwin-shared", +        shared_cflag     => "-D_WINDLL", +        shared_ldflag    => "-shared", +        shared_extension => ".dll", +    }, +    # Backward compatibility for those using this target +    "Cygwin" => { +	inherit_from     => [ "Cygwin-x86" ] +    }, +    # In case someone constructs the Cygwin target name themself +    "Cygwin-i386" => { +	inherit_from     => [ "Cygwin-x86" ] +    }, +    "Cygwin-i486" => { +	inherit_from     => [ "Cygwin-x86" ] +    }, +    "Cygwin-i586" => { +	inherit_from     => [ "Cygwin-x86" ] +    }, +    "Cygwin-i686" => { +	inherit_from     => [ "Cygwin-x86" ] +    }, + +##### MacOS X (a.k.a. Darwin) setup +    "darwin-common" => { +        inherit_from     => [ "BASE_unix" ], +        template         => 1, +        cc               => "cc", +        cflags           => combine(picker(default => "", +                                           debug   => "-g -O0", +                                           release => "-O3"), +                                   threads("-D_REENTRANT")), +        sys_id           => "MACOSX", +        plib_lflags      => "-Wl,-search_paths_first", +        bn_ops           => "BN_LLONG RC4_CHAR", +        thread_scheme    => "pthreads", +        perlasm_scheme   => "osx32", +        dso_scheme       => "dlfcn", +        ranlib           => "ranlib -c", +        shared_target    => "darwin-shared", +        shared_cflag     => "-fPIC", +        shared_ldflag    => "-dynamiclib", +        shared_extension => ".\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib", +    }, +    # Option "freeze" such as -std=gnu9x can't negatively interfere +    # with future defaults for below two targets, because MacOS X +    # for PPC has no future, it was discontinued by vendor in 2009. +    "darwin-ppc-cc" => { +        inherit_from     => [ "darwin-common", asm("ppc32_asm") ], +        cflags           => add("-arch ppc -std=gnu9x -DB_ENDIAN -Wa,-force_cpusubtype_ALL"), +        perlasm_scheme   => "osx32", +        shared_cflag     => add("-fno-common"), +        shared_ldflag    => "-arch ppc -dynamiclib", +    }, +    "darwin64-ppc-cc" => { +        inherit_from     => [ "darwin-common", asm("ppc64_asm") ], +        cflags           => add("-arch ppc64 -std=gnu9x -DB_ENDIAN"), +        bn_ops           => "SIXTY_FOUR_BIT_LONG RC4_CHAR", +        perlasm_scheme   => "osx64", +        shared_ldflag    => "-arch ppc64 -dynamiclib", +    }, +    "darwin-i386-cc" => { +        inherit_from     => [ "darwin-common", asm("x86_asm") ], +        cflags           => add(picker(default => "-arch i386 -DL_ENDIAN", +                                       release => "-fomit-frame-pointer")), +        bn_ops           => "BN_LLONG RC4_INT", +        perlasm_scheme   => "macosx", +        shared_ldflag    => "-arch i386 -dynamiclib", +    }, +    "darwin64-x86_64-cc" => { +        inherit_from     => [ "darwin-common", asm("x86_64_asm") ], +        cflags           => add("-arch x86_64 -DL_ENDIAN -Wall"), +        bn_ops           => "SIXTY_FOUR_BIT_LONG", +        perlasm_scheme   => "macosx", +        shared_ldflag    => "-arch x86_64 -dynamiclib", +    }, + +#### iPhoneOS/iOS +# +# It takes three prior-set environment variables to make it work: +# +# CROSS_COMPILE=/where/toolchain/is/usr/bin/ [note ending slash] +# CROSS_TOP=/where/SDKs/are +# CROSS_SDK=iPhoneOSx.y.sdk +# +# Exact paths vary with Xcode releases, but for couple of last ones +# they would look like this: +# +# CROSS_COMPILE=`xcode-select --print-path`/Toolchains/XcodeDefault.xctoolchain/usr/bin/ +# CROSS_TOP=`xcode-select --print-path`/Platforms/iPhoneOS.platform/Developer +# CROSS_SDK=iPhoneOS.sdk +# +    "iphoneos-cross" => { +        inherit_from     => [ "darwin-common" ], +        cflags           => add("-isysroot \$(CROSS_TOP)/SDKs/\$(CROSS_SDK) -fno-common"), +        sys_id           => "iOS", +    }, +    "ios-cross" => { +        inherit_from     => [ "darwin-common", asm("armv4_asm") ], +        # It should be possible to go below iOS 6 and even add -arch armv6, +        # thus targeting iPhone pre-3GS, but it's assumed to be irrelevant +        # at this point. +        cflags           => add("-arch armv7 -mios-version-min=6.0.0 -isysroot \$(CROSS_TOP)/SDKs/\$(CROSS_SDK) -fno-common"), +        sys_id           => "iOS", +        perlasm_scheme   => "ios32", +    }, +    "ios64-cross" => { +        inherit_from     => [ "darwin-common", asm("aarch64_asm") ], +        cflags           => add("-arch arm64 -mios-version-min=7.0.0 -isysroot \$(CROSS_TOP)/SDKs/\$(CROSS_SDK) -fno-common"), +        sys_id           => "iOS", +        bn_ops           => "SIXTY_FOUR_BIT_LONG RC4_CHAR", +        perlasm_scheme   => "ios64", +    }, + +##### GNU Hurd +    "hurd-x86" => { +        inherit_from     => [ "BASE_unix" ], +        inherit_from     => [ asm("x86_elf_asm") ], +        cc               => "gcc", +        cflags           => combine("-DL_ENDIAN -O3 -fomit-frame-pointer -Wall", +                                    threads("-pthread")), +        ex_libs          => add("-ldl", threads("-pthread")), +        bn_ops           => "BN_LLONG", +        thread_scheme    => "pthreads", +        dso_scheme       => "dlfcn", +        shared_target    => "linux-shared", +        shared_cflag     => "-fPIC", +        shared_extension => ".so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", +    }, + +##### VxWorks for various targets +    "vxworks-ppc60x" => { +        inherit_from     => [ "BASE_unix" ], +        cc               => "ccppc", +        cflags           => "-D_REENTRANT -mrtp -mhard-float -mstrict-align -fno-implicit-fp -DPPC32_fp60x -O2 -fstrength-reduce -fno-builtin -fno-strict-aliasing -Wall -DCPU=PPC32 -DTOOL_FAMILY=gnu -DTOOL=gnu -I\$(WIND_BASE)/target/usr/h -I\$(WIND_BASE)/target/usr/h/wrn/coreip", +        sys_id           => "VXWORKS", +        ex_libs          => add("-Wl,--defsym,__wrs_rtp_base=0xe0000000 -L \$(WIND_BASE)/target/usr/lib/ppc/PPC32/common"), +    }, +    "vxworks-ppcgen" => { +        inherit_from     => [ "BASE_unix" ], +        cc               => "ccppc", +        cflags           => "-D_REENTRANT -mrtp -msoft-float -mstrict-align -O1 -fno-builtin -fno-strict-aliasing -Wall -DCPU=PPC32 -DTOOL_FAMILY=gnu -DTOOL=gnu -I\$(WIND_BASE)/target/usr/h -I\$(WIND_BASE)/target/usr/h/wrn/coreip", +        sys_id           => "VXWORKS", +        ex_libs          => add("-Wl,--defsym,__wrs_rtp_base=0xe0000000 -L \$(WIND_BASE)/target/usr/lib/ppc/PPC32/sfcommon"), +    }, +    "vxworks-ppc405" => { +        inherit_from     => [ "BASE_unix" ], +        cc               => "ccppc", +        cflags           => "-g -msoft-float -mlongcall -DCPU=PPC405 -I\$(WIND_BASE)/target/h", +        sys_id           => "VXWORKS", +        lflags           => "-r", +    }, +    "vxworks-ppc750" => { +        inherit_from     => [ "BASE_unix" ], +        cc               => "ccppc", +        cflags           => "-ansi -nostdinc -DPPC750 -D_REENTRANT -fvolatile -fno-builtin -fno-for-scope -fsigned-char -Wall -msoft-float -mlongcall -DCPU=PPC604 -I\$(WIND_BASE)/target/h \$(DEBUG_FLAG)", +        sys_id           => "VXWORKS", +        lflags           => "-r", +    }, +    "vxworks-ppc750-debug" => { +        inherit_from     => [ "BASE_unix" ], +        cc               => "ccppc", +        cflags           => "-ansi -nostdinc -DPPC750 -D_REENTRANT -fvolatile -fno-builtin -fno-for-scope -fsigned-char -Wall -msoft-float -mlongcall -DCPU=PPC604 -I\$(WIND_BASE)/target/h -DPEDANTIC -DDEBUG -g", +        sys_id           => "VXWORKS", +        lflags           => "-r", +    }, +    "vxworks-ppc860" => { +        inherit_from     => [ "BASE_unix" ], +        cc               => "ccppc", +        cflags           => "-nostdinc -msoft-float -DCPU=PPC860 -DNO_STRINGS_H -I\$(WIND_BASE)/target/h", +        sys_id           => "VXWORKS", +        lflags           => "-r", +    }, +    "vxworks-simlinux" => { +        inherit_from     => [ "BASE_unix" ], +        cc               => "ccpentium", +        cflags           => "-B\$(WIND_BASE)/host/\$(WIND_HOST_TYPE)/lib/gcc-lib/ -D_VSB_CONFIG_FILE=\"\$(WIND_BASE)/target/lib/h/config/vsbConfig.h\" -DL_ENDIAN -DCPU=SIMLINUX -DTOOL_FAMILY=gnu -DTOOL=gnu -fno-builtin -fno-defer-pop -DNO_STRINGS_H -I\$(WIND_BASE)/target/h -I\$(WIND_BASE)/target/h/wrn/coreip -DOPENSSL_NO_HW_PADLOCK", +        sys_id           => "VXWORKS", +        lflags           => "-r", +        ranlib           => "ranlibpentium", +    }, +    "vxworks-mips" => { +        inherit_from     => [ "BASE_unix", asm("mips32_asm") ], +        cc               => "ccmips", +        cflags           => combine("-mrtp -mips2 -O -G 0 -B\$(WIND_BASE)/host/\$(WIND_HOST_TYPE)/lib/gcc-lib/ -D_VSB_CONFIG_FILE=\"\$(WIND_BASE)/target/lib/h/config/vsbConfig.h\" -DCPU=MIPS32 -msoft-float -mno-branch-likely -DTOOL_FAMILY=gnu -DTOOL=gnu -fno-builtin -fno-defer-pop -DNO_STRINGS_H -I\$(WIND_BASE)/target/usr/h -I\$(WIND_BASE)/target/h/wrn/coreip", +                                    threads("-D_REENTRANT")), +        sys_id           => "VXWORKS", +        ex_libs          => add("-Wl,--defsym,__wrs_rtp_base=0xe0000000 -L \$(WIND_BASE)/target/usr/lib/mips/MIPSI32/sfcommon"), +        thread_scheme    => "pthreads", +        perlasm_scheme   => "o32", +        ranlib           => "ranlibmips", +    }, + +#### uClinux +    "uClinux-dist" => { +        inherit_from     => [ "BASE_unix" ], +        cc               => "$ENV{'CC'}", +        cflags           => combine(threads("-D_REENTRANT")), +        ex_libs          => add("\$(LDLIBS)"), +        bn_ops           => "BN_LLONG", +        thread_scheme    => "pthreads", +        dso_scheme       => "$ENV{'LIBSSL_dlfcn'}", +        shared_target    => "linux-shared", +        shared_cflag     => "-fPIC", +        shared_ldflag    => "-shared", +        shared_extension => ".so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", +        ranlib           => "$ENV{'RANLIB'}", +    }, +    "uClinux-dist64" => { +        inherit_from     => [ "BASE_unix" ], +        cc               => "$ENV{'CC'}", +        cflags           => combine(threads("-D_REENTRANT")), +        ex_libs          => add("\$(LDLIBS)"), +        bn_ops           => "SIXTY_FOUR_BIT_LONG", +        thread_scheme    => "pthreads", +        dso_scheme       => "$ENV{'LIBSSL_dlfcn'}", +        shared_target    => "linux-shared", +        shared_cflag     => "-fPIC", +        shared_ldflag    => "-shared", +        shared_extension => ".so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", +        ranlib           => "$ENV{'RANLIB'}", +    }, + +    ##### VMS +    "vms-generic" => { +        inherit_from     => [ "BASE_VMS" ], +        template         => 1, +        cc               => "CC/DECC", +        cflags           => picker(default => "/STANDARD=(ISOC94,RELAXED)/NOLIST/PREFIX=ALL", +                                   debug   => "/NOOPTIMIZE/DEBUG", +                                   release => "/OPTIMIZE/NODEBUG"), +        defines          => add("OPENSSL_USE_NODELETE"), +        lflags           => picker(default => "/MAP", +                                   debug   => "/DEBUG/TRACEBACK", +                                   release => "/NODEBUG/NOTRACEBACK"), +        lib_cflags       => add("/NAMES=(AS_IS,SHORTENED)/EXTERN_MODEL=STRICT_REFDEF"), +        dso_cflags       => add("/NAMES=(AS_IS,SHORTENED)"), +        shared_target    => "vms-shared", +        dso_scheme       => "vms", +        thread_scheme    => "pthreads", + +        apps_aux_src     => "vms_decc_init.c vms_term_sock.c", +    }, + +    "vms-alpha" => { +        inherit_from     => [ "vms-generic" ], +        cflags           => add(sub { my @warnings = +                                          @{vms_info(0)->{disable_warns}}; +                                      @warnings +                                          ? "/WARNINGS=DISABLE=(".join(",",@warnings).")" : (); }), +        defines          => +                    add(sub { +                            return vms_info(0)->{def_zlib} +                                ? "LIBZ=\"\"\"".vms_info(0)->{def_zlib}."\"\"\"" : (); +                            }), +        ex_libs          => add(sub { return vms_info(0)->{zlib} || (); }), +        pointer_size     => sub { return vms_info(0)->{pointer_size} }, +        #as               => "???", +        #debug_aflags     => "/NOOPTIMIZE/DEBUG", +        #release_aflags   => "/OPTIMIZE/NODEBUG", +        bn_opts          => "SIXTY_FOUR_BIT RC4_INT", +    }, +    "vms-alpha-p32" => { +        inherit_from     => [ "vms-generic" ], +        cflags           => +            add("/POINTER_SIZE=32", +                sub { my @warnings = +                          @{vms_info(32)->{disable_warns}}; +                      @warnings +                          ? "/WARNINGS=DISABLE=(".join(",",@warnings).")" : (); +                } ), +        defines          => +                    add(sub { +                            return vms_info(32)->{def_zlib} +                                ? "LIBZ=\"\"\"".vms_info(32)->{def_zlib}."\"\"\"" : (); +                            }), +        ex_libs          => add(sub { return vms_info(32)->{zlib} || (); }), +        pointer_size     => sub { return vms_info(32)->{pointer_size} }, +    }, +    "vms-alpha-p64" => { +        inherit_from     => [ "vms-generic" ], +        cflags           => +            add("/POINTER_SIZE=64=ARGV", +                sub { my @warnings = +                          @{vms_info(64)->{disable_warns}}; +                      @warnings +                          ? "/WARNINGS=DISABLE=(".join(",",@warnings).")" : (); +                } ), +        defines          => +                    add(sub { +                            return vms_info(64)->{def_zlib} +                                ? "LIBZ=\"\"\"".vms_info(64)->{def_zlib}."\"\"\"" : (); +                            }), +        ex_libs          => add(sub { return vms_info(64)->{zlib} || (); }), +        pointer_size     => sub { return vms_info(64)->{pointer_size} }, +    }, +    "vms-ia64" => { +        inherit_from     => [ "vms-generic" ], +        cflags           => add(sub { my @warnings = +                                          @{vms_info(0)->{disable_warns}}; +                                      @warnings +                                          ? "/WARNINGS=DISABLE=(".join(",",@warnings).")" : (); }), +        defines          => +                    add(sub { +                            return vms_info(0)->{def_zlib} +                                ? "LIBZ=\"\"\"".vms_info(0)->{def_zlib}."\"\"\"" : (); +                            }), +        ex_libs          => add(sub { return vms_info(0)->{zlib} || (); }), +        pointer_size     => sub { return vms_info(0)->{pointer_size} }, +        #as               => "I4S", +        #debug_aflags     => "/NOOPTIMIZE/DEBUG", +        #release_aflags   => "/OPTIMIZE/NODEBUG", +        bn_opts          => "SIXTY_FOUR_BIT RC4_INT", +    }, +    "vms-ia64-p32" => { +        inherit_from     => [ "vms-generic" ], +        cflags           => +            add("/POINTER_SIZE=32", +                sub { my @warnings = +                          @{vms_info(32)->{disable_warns}}; +                      @warnings +                          ? "/WARNINGS=DISABLE=(".join(",",@warnings).")" : (); +                } ), +        defines          => +                    add(sub { +                            return vms_info(32)->{def_zlib} +                                ? "LIBZ=\"\"\"".vms_info(32)->{def_zlib}."\"\"\"" : (); +                            }), +        ex_libs          => add(sub { return vms_info(32)->{zlib} || (); }), +        pointer_size     => sub { return vms_info(32)->{pointer_size} }, +    }, +    "vms-ia64-p64" => { +        inherit_from     => [ "vms-generic" ], +        cflags           => +            add("/POINTER_SIZE=64=ARGV", +                sub { my @warnings = +                          @{vms_info(64)->{disable_warns}}; +                      @warnings +                          ? "/WARNINGS=DISABLE=(".join(",",@warnings).")" : (); +                } ), +        defines          => +                    add(sub { +                            return vms_info(64)->{def_zlib} +                                ? "LIBZ=\"\"\"".vms_info(64)->{def_zlib}."\"\"\"" : (); +                            }), +        ex_libs          => add(sub { return vms_info(64)->{zlib} || (); }), +        pointer_size     => sub { return vms_info(64)->{pointer_size} }, +    }, + +); diff --git a/openssl-1.1.0h/Configurations/50-djgpp.conf b/openssl-1.1.0h/Configurations/50-djgpp.conf new file mode 100644 index 0000000..f532bd1 --- /dev/null +++ b/openssl-1.1.0h/Configurations/50-djgpp.conf @@ -0,0 +1,15 @@ +# We can't make any commitment to support the DJGPP platform, +# and rely entirely on the OpenSSL community to help is fine +# tune and test. + +%targets = ( +    "DJGPP" => { +        inherit_from     => [ asm("x86_asm") ], +        cc               => "gcc", +        cflags           => "-I/dev/env/WATT_ROOT/inc -DTERMIOS -DL_ENDIAN -fomit-frame-pointer -O2 -Wall", +        sys_id           => "MSDOS", +        ex_libs          => add("-L/dev/env/WATT_ROOT/lib -lwatt"), +        bn_ops           => "BN_LLONG", +        perlasm_scheme   => "a.out", +    }, +); diff --git a/openssl-1.1.0h/Configurations/50-haiku.conf b/openssl-1.1.0h/Configurations/50-haiku.conf new file mode 100644 index 0000000..f114666 --- /dev/null +++ b/openssl-1.1.0h/Configurations/50-haiku.conf @@ -0,0 +1,29 @@ +%targets = ( +    "haiku-common" => { +        template         => 1, +        cc               => "cc", +        cflags           => add_before(picker(default => "-DL_ENDIAN -Wall -include \$(SRCDIR)/os-dep/haiku.h", +                                              debug   => "-g -O0", +                                              release => "-O2"), +                                       threads("-D_REENTRANT")), +        sys_id           => "HAIKU", +        ex_libs          => "-lnetwork", +        perlasm_scheme   => "elf", +        thread_scheme    => "pthreads", +        dso_scheme       => "dlfcn", +        shared_target    => "gnu-shared", +        shared_cflag     => "-fPIC", +        shared_ldflag    => "-shared", +        shared_extension => ".so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", +    }, +    "haiku-x86" => { +        inherit_from     => [ "haiku-common", asm("x86_elf_asm") ], +        cflags           => add(picker(release => "-fomit-frame-pointer")), +        bn_ops           => "BN_LLONG", +    }, +    "haiku-x86_64" => { +        inherit_from     => [ "haiku-common" ], +        cflags           => add("-m64"), +        bn_ops           => "SIXTY_FOUR_BIT_LONG", +    }, +); diff --git a/openssl-1.1.0h/Configurations/50-masm.conf b/openssl-1.1.0h/Configurations/50-masm.conf new file mode 100644 index 0000000..60a5507 --- /dev/null +++ b/openssl-1.1.0h/Configurations/50-masm.conf @@ -0,0 +1,17 @@ +# We can't make commitment to supporting Microsoft assembler, +# because it would mean supporting all masm versions. This in +# in turn is because masm is not really an interchangeable option, +# while users tend to have reasons to stick with specific Visual +# Studio versions. It's usually lesser hassle to make it work +# with latest assembler, but tweaking for older versions had +# proven to be daunting task. This is experimental target, for +# production builds stick with [up-to-date version of] nasm. + +%targets = ( +    "VC-WIN64A-masm" => { +        inherit_from    => [ "VC-WIN64A" ], +        as              => "ml64", +        asflags         => "/c /Cp /Cx /Zi", +        asoutflag       => "/Fo", +    }, +); diff --git a/openssl-1.1.0h/Configurations/90-team.conf b/openssl-1.1.0h/Configurations/90-team.conf new file mode 100644 index 0000000..0a83c22 --- /dev/null +++ b/openssl-1.1.0h/Configurations/90-team.conf @@ -0,0 +1,112 @@ +## -*- mode: perl; -*- +## Build configuration targets for openssl-team members + +%targets = ( +    "purify" => { +        cc               => "purify gcc", +        cflags           => "-g -Wall", +        thread_scheme    => "(unknown)", +        ex_libs          => add(" ","-lsocket -lnsl"), +    }, +    "debug" => { +        cc               => "gcc", +        cflags           => "-DBN_DEBUG -DREF_DEBUG -DCONF_DEBUG -DBN_CTX_DEBUG -DOPENSSL_NO_ASM -ggdb -g2 -Wformat -Wshadow -Wmissing-prototypes -Wmissing-declarations -Werror", +        thread_scheme    => "(unknown)", +    }, +    "debug-erbridge" => { +        inherit_from     => [ "x86_64_asm" ], +        cc               => "gcc", +        cflags           => combine("$gcc_devteam_warn -DBN_DEBUG -DCONF_DEBUG -m64 -DL_ENDIAN -DTERMIO -g", +                                    threads("-D_REENTRANT")), +        ex_libs          => add(" ","-ldl"), +        bn_ops           => "SIXTY_FOUR_BIT_LONG", +        thread_scheme    => "pthreads", +        perlasm_scheme   => "elf", +        dso_scheme       => "dlfcn", +        shared_target    => "linux-shared", +        shared_cflag     => "-fPIC", +        shared_ldflag    => "-m64", +        shared_extension => ".so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", +        multilib         => "64", +    }, +    "debug-linux-pentium" => { +        inherit_from     => [ "x86_elf_asm" ], +        cc               => "gcc", +        cflags           => combine("-DBN_DEBUG -DREF_DEBUG -DCONF_DEBUG -DBN_CTX_DEBUG -DL_ENDIAN -g -mcpu=pentium -Wall", +                                    threads("-D_REENTRANT")), +        ex_libs          => add(" ","-ldl"), +        bn_ops           => "BN_LLONG", +        thread_scheme    => "pthreads", +        dso_scheme       => "dlfcn", +    }, +    "debug-linux-ppro" => { +        inherit_from     => [ "x86_elf_asm" ], +        cc               => "gcc", +        cflags           => combine("-DBN_DEBUG -DREF_DEBUG -DCONF_DEBUG -DBN_CTX_DEBUG -DL_ENDIAN -g -mcpu=pentiumpro -Wall", +                                    threads("-D_REENTRANT")), +        ex_libs          => add(" ","-ldl"), +        bn_ops           => "BN_LLONG", +        thread_scheme    => "pthreads", +        dso_scheme       => "dlfcn", +    }, +    "debug-linux-ia32-aes" => { +        cc               => "gcc", +        cflags           => combine("-DL_ENDIAN -O3 -fomit-frame-pointer -Wall", +                                    threads("-D_REENTRANT")), +        ex_libs          => add(" ","-ldl"), +        bn_ops           => "BN_LLONG", +        cpuid_asm_src    => "x86cpuid.s", +        bn_asm_src       => "bn-586.s co-586.s x86-mont.s", +        des_asm_src      => "des-586.s crypt586.s", +        aes_asm_src      => "aes_x86core.s aes_cbc.s aesni-x86.s", +        bf_asm_src       => "bf-586.s", +        md5_asm_src      => "md5-586.s", +        sha1_asm_src     => "sha1-586.s sha256-586.s sha512-586.s", +        cast_asm_src     => "cast-586.s", +        rc4_asm_src      => "rc4-586.s", +        rmd160_asm_src   => "rmd-586.s", +        rc5_asm_src      => "rc5-586.s", +        wp_asm_src       => "wp_block.s wp-mmx.s", +        modes_asm_src    => "ghash-x86.s", +        padlock_asm_src  => "e_padlock-x86.s", +        thread_scheme    => "pthreads", +        perlasm_scheme   => "elf", +        dso_scheme       => "dlfcn", +        shared_target    => "linux-shared", +        shared_cflag     => "-fPIC", +        shared_extension => ".so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", +    }, +    "dist" => { +        cc               => "cc", +        cflags           => "-O", +        thread_scheme    => "(unknown)", +    }, +    "debug-test-64-clang" => { +        inherit_from     => [ "x86_64_asm" ], +        cc               => "clang", +        cflags           => combine("$gcc_devteam_warn -Wno-error=overlength-strings -Wno-error=extended-offsetof -Wno-error=language-extension-token -Wno-error=unused-const-variable -Wstrict-overflow -Qunused-arguments -DBN_DEBUG -DCONF_DEBUG -DDEBUG_SAFESTACK -DDEBUG_UNUSED -g3 -O3 -pipe", +                                    threads("${BSDthreads}")), +        bn_ops           => "SIXTY_FOUR_BIT_LONG", +        thread_scheme    => "pthreads", +        perlasm_scheme   => "elf", +        dso_scheme       => "dlfcn", +        shared_target    => "bsd-gcc-shared", +        shared_cflag     => "-fPIC", +        shared_extension => ".so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", +    }, +    "darwin64-debug-test-64-clang" => { +        inherit_from     => [ "x86_64_asm" ], +        cc               => "clang", +        cflags           => combine("-arch x86_64 -DL_ENDIAN $gcc_devteam_warn -Wno-error=overlength-strings -Wno-error=extended-offsetof -Wno-error=language-extension-token -Wno-error=unused-const-variable -Wstrict-overflow -Qunused-arguments -DBN_DEBUG -DCONF_DEBUG -DDEBUG_SAFESTACK -DDEBUG_UNUSED -g3 -O3 -pipe", +                                    threads("${BSDthreads}")), +        sys_id           => "MACOSX", +        bn_ops           => "SIXTY_FOUR_BIT_LONG", +        thread_scheme    => "pthreads", +        perlasm_scheme   => "macosx", +        dso_scheme       => "dlfcn", +        shared_target    => "darwin-shared", +        shared_cflag     => "-fPIC -fno-common", +        shared_ldflag    => "-arch x86_64 -dynamiclib", +        shared_extension => ".\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib", +    }, +); diff --git a/openssl-1.1.0h/Configurations/INTERNALS.Configure b/openssl-1.1.0h/Configurations/INTERNALS.Configure new file mode 100644 index 0000000..b28305d --- /dev/null +++ b/openssl-1.1.0h/Configurations/INTERNALS.Configure @@ -0,0 +1,136 @@ +Configure Internals +=================== + +[ note: this file uses markdown for formatting ] + +Intro +----- + +This is a collection of notes that are hopefully of interest to those +who decide to dive into Configure and what it does.  This is a living +document and anyone is encouraged to add to it and submit changes. +There's no claim for this document to be complete at any time, but it +will hopefully reach such a point in time. + + +---------------------------------------------------------------------- + +Parsing build.info files, processing conditions +----------------------------------------------- + +Processing conditions in build.info files is done with the help of a +condition stack that tell if a build.info should be processed or if it +should just be skipped over.  The possible states of the stack top are +expressed in the following comment from Configure: + +    # The top item of this stack has the following values +    # -2 positive already run and we found ELSE (following ELSIF should fail) +    # -1 positive already run (skip until ENDIF) +    # 0 negatives so far (if we're at a condition, check it) +    # 1 last was positive (don't skip lines until next ELSE, ELSIF or ENDIF) +    # 2 positive ELSE (following ELSIF should fail) + +Ground rule is that non-condition lines are skipped over if the +stack top is > 0.  Condition lines (IF, ELSIF, ELSE and ENDIF +statements) need to be processed either way to keep track of the skip +stack states, so they are a little more intricate. + +Instead of trying to describe in words, here are some example of what +the skip stack should look like after each line is processed: + +Example 1: + +| IF[1]                     |  1        |                               | +|   ... whatever ...        |           | this line is processed        | +|   IF[1]                   |  1  1     |                               | +|     ... whatever ...      |           | this line is processed        | +|   ELSIF[1]                |  1 -1     |                               | +|     ... whatever ...      |           | this line is skipped over     | +|   ELSE                    |  1 -2     |                               | +|     ... whatever ...      |           | this line is skipped over     | +|   ENDIF                   |  1        |                               | +|   ... whatever ...        |           | this line is processed        | +| ELSIF[1]                  | -1        |                               | +|   ... whatever ...        |           | this line is skipped over     | +|   IF[1]                   | -1 -1     |                               | +|     ... whatever ...      |           | this line is skipped over     | +|   ELSIF[1]                | -1 -1     |                               | +|     ... whatever ...      |           | this line is skipped over     | +|   ELSE                    | -1 -2     |                               | +|     ... whatever ...      |           | this line is skipped over     | +|   ENDIF                   | -1        |                               | +|   ... whatever ...        |           | this line is skipped over     | +| ENDIF                     |           |                               | + +Example 2: + +| IF[0]                     |  0        |                               | +|   ... whatever ...        |           | this line is skipped over     | +|   IF[1]                   |  0 -1     |                               | +|     ... whatever ...      |           | this line is skipped over     | +|   ELSIF[1]                |  0 -1     |                               | +|     ... whatever ...      |           | this line is skipped over     | +|   ELSE                    |  0 -2     |                               | +|     ... whatever ...      |           | this line is skipped over     | +|   ENDIF                   |  0        |                               | +|   ... whatever ...        |           | this line is skipped over     | +| ELSIF[1]                  |  1        |                               | +|   ... whatever ...        |           | this line is processed        | +|   IF[1]                   |  1  1     |                               | +|     ... whatever ...      |           | this line is processed        | +|   ELSIF[1]                |  1 -1     |                               | +|     ... whatever ...      |           | this line is skipped over     | +|   ELSE                    |  1 -2     |                               | +|     ... whatever ...      |           | this line is skipped over     | +|   ENDIF                   |  1        |                               | +|   ... whatever ...        |           | this line is processed        | +| ENDIF                     |           |                               | + +Example 3: + +| IF[0]                     |  0        |                               | +|   ... whatever ...        |           | this line is skipped over     | +|   IF[0]                   |  0 -1     |                               | +|     ... whatever ...      |           | this line is skipped over     | +|   ELSIF[1]                |  0 -1     |                               | +|     ... whatever ...      |           | this line is skipped over     | +|   ELSE                    |  0 -2     |                               | +|     ... whatever ...      |           | this line is skipped over     | +|   ENDIF                   |  0        |                               | +|   ... whatever ...        |           | this line is skipped over     | +| ELSIF[1]                  |  1        |                               | +|   ... whatever ...        |           | this line is processed        | +|   IF[0]                   |  1  0     |                               | +|     ... whatever ...      |           | this line is skipped over     | +|   ELSIF[1]                |  1  1     |                               | +|     ... whatever ...      |           | this line is processed        | +|   ELSE                    |  1 -2     |                               | +|     ... whatever ...      |           | this line is skipped over     | +|   ENDIF                   |  1        |                               | +|   ... whatever ...        |           | this line is processed        | +| ENDIF                     |           |                               | + +Example 4: + +| IF[0]                     |  0        |                               | +|   ... whatever ...        |           | this line is skipped over     | +|   IF[0]                   |  0 -1     |                               | +|     ... whatever ...      |           | this line is skipped over     | +|   ELSIF[0]                |  0 -1     |                               | +|     ... whatever ...      |           | this line is skipped over     | +|   ELSE                    |  0 -2     |                               | +|     ... whatever ...      |           | this line is skipped over     | +|   ENDIF                   |  0        |                               | +|   ... whatever ...        |           | this line is skipped over     | +| ELSIF[1]                  |  1        |                               | +|   ... whatever ...        |           | this line is processed        | +|   IF[0]                   |  1  0     |                               | +|     ... whatever ...      |           | this line is skipped over     | +|   ELSIF[0]                |  1  0     |                               | +|     ... whatever ...      |           | this line is skipped over     | +|   ELSE                    |  1  2     |                               | +|     ... whatever ...      |           | this line is processed        | +|   ENDIF                   |  1        |                               | +|   ... whatever ...        |           | this line is processed        | +| ENDIF                     |           |                               | + diff --git a/openssl-1.1.0h/Configurations/README b/openssl-1.1.0h/Configurations/README new file mode 100644 index 0000000..6e13645 --- /dev/null +++ b/openssl-1.1.0h/Configurations/README @@ -0,0 +1,721 @@ +Intro +===== + +This directory contains a few sets of files that are used for +configuration in diverse ways: + +    *.conf      Target platform configurations, please read +                'Configurations of OpenSSL target platforms' for more +                information. +    *.tmpl      Build file templates, please read 'Build-file +                programming with the "unified" build system' as well +                as 'Build info files' for more information. +    *.pm        Helper scripts / modules for the main `Configure` +                script.  See 'Configure helper scripts for more +                information. + + +Configurations of OpenSSL target platforms +========================================== + +Configuration targets are a collection of facts that we know about +different platforms and their capabilities.  We organise them in a +hash table, where each entry represent a specific target. + +Note that configuration target names must be unique across all config +files.  The Configure script does check that a config file doesn't +have config targets that shadow config targets from other files. + +In each table entry, the following keys are significant: + +        inherit_from    => Other targets to inherit values from. +                           Explained further below. [1] +        template        => Set to 1 if this isn't really a platform +                           target.  Instead, this target is a template +                           upon which other targets can be built. +                           Explained further below.  [1] + +        sys_id          => System identity for systems where that +                           is difficult to determine automatically. + +        cc              => The compiler command, usually one of "cc", +                           "gcc" or "clang".  This command is normally +                           also used to link object files and +                           libraries into the final program. +        cflags          => Flags that are used at all times when +                           compiling. +        defines         => As an alternative, macro definitions may be +                           present here instead of in `cflags'.  If +                           given here, they MUST be as an array of the +                           string such as "MACRO=value", or just +                           "MACRO" for definitions without value. +        shared_cflag    => Extra compilation flags used when +                           compiling for shared libraries, typically +                           something like "-fPIC". + +        (linking is a complex thing, see [3] below) +        ld              => Linker command, usually not defined +                           (meaning the compiler command is used +                           instead). +                           (NOTE: this is here for future use, it's +                           not implemented yet) +        lflags          => Flags that are used when linking apps. +        shared_ldflag   => Flags that are used when linking shared +                           or dynamic libraries. +        plib_lflags     => Extra linking flags to appear just before +                           the libraries on the command line. +        ex_libs         => Extra libraries that are needed when +                           linking. + +        ar              => The library archive command, the default is +                           "ar". +                           (NOTE: this is here for future use, it's +                           not implemented yet) +        arflags         => Flags to be used with the library archive +                           command. + +        ranlib          => The library archive indexing command, the +                           default is 'ranlib' it it exists. + +        unistd          => An alternative header to the typical +                           '<unistd.h>'.  This is very rarely needed. + +        shared_extension => File name extension used for shared +                            libraries.  +        obj_extension   => File name extension used for object files. +                           On unix, this defaults to ".o" (NOTE: this +                           is here for future use, it's not +                           implemented yet) +        exe_extension   => File name extension used for executable +                           files.  On unix, this defaults to "" (NOTE: +                           this is here for future use, it's not +                           implemented yet) +        shlib_variant   => A "variant" identifier inserted between the base +                           shared library name and the extension.  On "unixy" +                           platforms (BSD, Linux, Solaris, MacOS/X, ...) this +                           supports installation of custom OpenSSL libraries +                           that don't conflict with other builds of OpenSSL +                           installed on the system.  The variant identifier +                           becomes part of the SONAME of the library and also +                           any symbol versions (symbol versions are not used or +                           needed with MacOS/X).  For example, on a system +                           where a default build would normally create the SSL +                           shared library as 'libssl.so -> libssl.so.1.1' with +                           the value of the symlink as the SONAME, a target +                           definition that sets 'shlib_variant => "-abc"' will +                           create 'libssl.so -> libssl-abc.so.1.1', again with +                           an SONAME equal to the value of the symlink.  The +                           symbol versions associated with the variant library +                           would then be 'OPENSSL_ABC_<version>' rather than +                           the default 'OPENSSL_<version>'. The string inserted +                           into symbol versions is obtained by mapping all +                           letters in the "variant" identifier to upper case +                           and all non-alphanumeric characters to '_'. + +        thread_scheme   => The type of threads is used on the +                           configured platform.  Currently known +                           values are "(unknown)", "pthreads", +                           "uithreads" (a.k.a solaris threads) and +                           "winthreads".  Except for "(unknown)", the +                           actual value is currently ignored but may +                           be used in the future.  See further notes +                           below [2]. +        dso_scheme      => The type of dynamic shared objects to build +                           for.  This mostly comes into play with +                           engines, but can be used for other purposes +                           as well.  Valid values are "DLFCN" +                           (dlopen() et al), "DLFCN_NO_H" (for systems +                           that use dlopen() et al but do not have +                           fcntl.h), "DL" (shl_load() et al), "WIN32" +                           and "VMS". +        perlasm_scheme  => The perlasm method used to created the +                           assembler files used when compiling with +                           assembler implementations. +        shared_target   => The shared library building method used. +                           This is a target found in Makefile.shared. +        build_scheme    => The scheme used to build up a Makefile. +                           In its simplest form, the value is a string +                           with the name of the build scheme. +                           The value may also take the form of a list +                           of strings, if the build_scheme is to have +                           some options.  In this case, the first +                           string in the list is the name of the build +                           scheme. +                           Currently recognised build scheme is "unified". +                           For the "unified" build scheme, this item +                           *must* be an array with the first being the +                           word "unified" and the second being a word +                           to identify the platform family. + +        multilib        => On systems that support having multiple +                           implementations of a library (typically a +                           32-bit and a 64-bit variant), this is used +                           to have the different variants in different +                           directories. + +        bn_ops          => Building options (was just bignum options in +                           the earlier history of this option, hence the +                           name). This is a string of words that describe +                           algorithms' implementation parameters that +                           are optimal for the designated target platform, +                           such as the type of integers used to build up +                           the bignum, different ways to implement certain +                           ciphers and so on. To fully comprehend the +                           meaning, the best is to read the affected +                           source. +                           The valid words are: + +                           THIRTY_TWO_BIT       bignum limbs are 32 bits, +                                                this is default if no +                                                option is specified, it +                                                works on any supported +                                                system [unless "wider" +                                                limb size is implied in +                                                assembly code]; +                           BN_LLONG             bignum limbs are 32 bits, +                                                but 64-bit 'unsigned long +                                                long' is used internally +                                                in calculations; +                           SIXTY_FOUR_BIT_LONG  bignum limbs are 64 bits +                                                and sizeof(long) is 8; +                           SIXTY_FOUR_BIT       bignums limbs are 64 bits, +                                                but execution environment +                                                is ILP32; +                           RC4_CHAR             RC4 key schedule is made +                                                up of 'unsigned char's; +                           RC4_INT              RC4 key schedule is made +                                                up of 'unsigned int's; +                           EXPORT_VAR_AS_FN     for shared libraries, +                                                export vars as +                                                accessor functions. + +        apps_extra_src  => Extra source to build apps/openssl, as +                           needed by the target. +        cpuid_asm_src   => assembler implementation of cpuid code as +                           well as OPENSSL_cleanse(). +                           Default to mem_clr.c +        bn_asm_src      => Assembler implementation of core bignum +                           functions. +                           Defaults to bn_asm.c +        ec_asm_src      => Assembler implementation of core EC +                           functions. +        des_asm_src     => Assembler implementation of core DES +                           encryption functions. +                           Defaults to 'des_enc.c fcrypt_b.c' +        aes_asm_src     => Assembler implementation of core AES +                           functions. +                           Defaults to 'aes_core.c aes_cbc.c' +        bf_asm_src      => Assembler implementation of core BlowFish +                           functions. +                           Defaults to 'bf_enc.c' +        md5_asm_src     => Assembler implementation of core MD5 +                           functions. +        sha1_asm_src    => Assembler implementation of core SHA1, +                           functions, and also possibly SHA256 and +                           SHA512 ones. +        cast_asm_src    => Assembler implementation of core CAST +                           functions. +                           Defaults to 'c_enc.c' +        rc4_asm_src     => Assembler implementation of core RC4 +                           functions. +                           Defaults to 'rc4_enc.c rc4_skey.c' +        rmd160_asm_src  => Assembler implementation of core RMD160 +                           functions. +        rc5_asm_src     => Assembler implementation of core RC5 +                           functions. +                           Defaults to 'rc5_enc.c' +        wp_asm_src      => Assembler implementation of core WHIRLPOOL +                           functions. +        cmll_asm_src    => Assembler implementation of core CAMELLIA +                           functions. +                           Defaults to 'camellia.c cmll_misc.c cmll_cbc.c' +        modes_asm_src   => Assembler implementation of cipher modes, +                           currently the functions gcm_gmult_4bit and +                           gcm_ghash_4bit. +        padlock_asm_src => Assembler implementation of core parts of +                           the padlock engine.  This is mandatory on +                           any platform where the padlock engine might +                           actually be built. + + +[1] as part of the target configuration, one can have a key called +    'inherit_from' that indicate what other configurations to inherit +    data from.  These are resolved recursively. + +    Inheritance works as a set of default values that can be overridden +    by corresponding key values in the inheriting configuration. + +    Note 1: any configuration table can be used as a template. +    Note 2: pure templates have the attribute 'template => 1' and +            cannot be used as build targets. + +    If several configurations are given in the 'inherit_from' array, +    the values of same attribute are concatenated with space +    separation.  With this, it's possible to have several smaller +    templates for different configuration aspects that can be combined +    into a complete configuration. + +    instead of a scalar value or an array, a value can be a code block +    of the form 'sub { /* your code here */ }'.  This code block will +    be called with the list of inherited values for that key as +    arguments.  In fact, the concatenation of strings is really done +    by using 'sub { join(" ",@_) }' on the list of inherited values. + +    An example: + +        "foo" => { +                template => 1, +                haha => "ha ha", +                hoho => "ho", +                ignored => "This should not appear in the end result", +        }, +        "bar" => { +                template => 1, +                haha => "ah", +                hoho => "haho", +                hehe => "hehe" +        }, +        "laughter" => { +                inherit_from => [ "foo", "bar" ], +                hehe => sub { join(" ",(@_,"!!!")) }, +                ignored => "", +        } + +        The entry for "laughter" will become as follows after processing: + +        "laughter" => { +                haha => "ha ha ah", +                hoho => "ho haho", +                hehe => "hehe !!!", +                ignored => "" +        } + +[2] OpenSSL is built with threading capabilities unless the user +    specifies 'no-threads'.  The value of the key 'thread_scheme' may +    be "(unknown)", in which case the user MUST give some compilation +    flags to Configure. + +[3] OpenSSL has three types of things to link from object files or +    static libraries: + +    - shared libraries; that would be libcrypto and libssl. +    - shared objects (sometimes called dynamic libraries);  that would +      be the engines. +    - applications; those are apps/openssl and all the test apps. + +    Very roughly speaking, linking is done like this (words in braces +    represent the configuration settings documented at the beginning +    of this file): + +    shared libraries: +        {ld} $(CFLAGS) {shared_ldflag} -shared -o libfoo.so \ +            -Wl,--whole-archive libfoo.a -Wl,--no-whole-archive \ +            {plib_lflags} -lcrypto {ex_libs} + +    shared objects: +        {ld} $(CFLAGS) {shared_ldflag} -shared -o libeng.so \ +            blah1.o blah2.o {plib_lflags} -lcrypto {ex_libs} + +    applications: +        {ld} $(CFLAGS) {lflags} -o app \ +            app1.o utils.o {plib_lflags} -lssl -lcrypto {ex_libs} + + +Historically, the target configurations came in form of a string with +values separated by colons.  This use is deprecated.  The string form +looked like this: + +   "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}" + + +Build info files +================ + +The build.info files that are spread over the source tree contain the +minimum information needed to build and distribute OpenSSL.  It uses a +simple and yet fairly powerful language to determine what needs to be +built, from what sources, and other relationships between files. + +For every build.info file, all file references are relative to the +directory of the build.info file for source files, and the +corresponding build directory for built files if the build tree +differs from the source tree. + +When processed, every line is processed with the perl module +Text::Template, using the delimiters "{-" and "-}".  The hashes +%config and %target are passed to the perl fragments, along with +$sourcedir and $builddir, which are the locations of the source +directory for the current build.info file and the corresponding build +directory, all relative to the top of the build tree. + +To begin with, things to be built are declared by setting specific +variables: + +    PROGRAMS=foo bar +    LIBS=libsomething +    ENGINES=libeng +    SCRIPTS=myhack +    EXTRA=file1 file2 + +Note that the files mentioned for PROGRAMS, LIBS and ENGINES *must* be +without extensions.  The build file templates will figure them out. + +For each thing to be built, it is then possible to say what sources +they are built from: + +    PROGRAMS=foo bar +    SOURCE[foo]=foo.c common.c +    SOURCE[bar]=bar.c extra.c common.c + +It's also possible to tell some other dependencies: + +    DEPEND[foo]=libsomething +    DEPEND[libbar]=libsomethingelse + +(it could be argued that 'libsomething' and 'libsomethingelse' are +source as well.  However, the files given through SOURCE are expected +to be located in the source tree while files given through DEPEND are +expected to be located in the build tree) + +For some libraries, we maintain files with public symbols and their +slot in a transfer vector (important on some platforms).  It can be +declared like this: + +    ORDINALS[libcrypto]=crypto + +The value is not the name of the file in question, but rather the +argument to util/mkdef.pl that indicates which file to use. + +One some platforms, shared libraries come with a name that's different +from their static counterpart.  That's declared as follows: + +    SHARED_NAME[libfoo]=cygfoo-{- $config{shlibver} -} + +The example is from Cygwin, which has a required naming convention. + +Sometimes, it makes sense to rename an output file, for example a +library: + +    RENAME[libfoo]=libbar + +That lines has "libfoo" get renamed to "libbar".  While it makes no +sense at all to just have a rename like that (why not just use +"libbar" everywhere?), it does make sense when it can be used +conditionally.  See a little further below for an example. + +In some cases, it's desirable to include some source files in the +shared form of a library only: + +    SHARED_SOURCE[libfoo]=dllmain.c + +For any file to be built, it's also possible to tell what extra +include paths the build of their source files should use: + +    INCLUDE[foo]=include + +In some cases, one might want to generate some source files from +others, that's done as follows: + +    GENERATE[foo.s]=asm/something.pl $(CFLAGS) +    GENERATE[bar.s]=asm/bar.S + +The value of each GENERATE line is a command line or part of it. +Configure places no rules on the command line, except the the first +item muct be the generator file.  It is, however, entirely up to the +build file template to define exactly how those command lines should +be handled, how the output is captured and so on. + +Sometimes, the generator file itself depends on other files, for +example if it is a perl script that depends on other perl modules. +This can be expressed using DEPEND like this: + +    DEPEND[asm/something.pl]=../perlasm/Foo.pm + +There may also be cases where the exact file isn't easily specified, +but an inclusion directory still needs to be specified.  INCLUDE can +be used in that case: + +    INCLUDE[asm/something.pl]=../perlasm + +NOTE: GENERATE lines are limited to one command only per GENERATE. + +As a last resort, it's possible to have raw build file lines, between +BEGINRAW and ENDRAW lines as follows: + +    BEGINRAW[Makefile(unix)] +    haha.h: {- $builddir -}/Makefile +        echo "/* haha */" > haha.h +    ENDRAW[Makefile(unix)] + +The word within square brackets is the build_file configuration item +or the build_file configuration item followed by the second word in the +build_scheme configuration item for the configured target within +parenthesis as shown above.  For example, with the following relevant +configuration items: + +   build_file   => "build.ninja" +   build_scheme => [ "unified", "unix" ] + +... these lines will be considered: + +   BEGINRAW[build.ninja] +   build haha.h: echo "/* haha */" > haha.h +   ENDRAW[build.ninja] + +   BEGINRAW[build.ninja(unix)] +   build hoho.h: echo "/* hoho */" > hoho.h +   ENDRAW[build.ninja(unix)] + +Should it be needed because the recipes within a RAW section might +clash with those generated by Configure, it's possible to tell it +not to generate them with the use of OVERRIDES, for example: + +    SOURCE[libfoo]=foo.c bar.c +     +    OVERRIDES=bar.o +    BEGINRAW[Makefile(unix)] +    bar.o: bar.c +    	$(CC) $(CFLAGS) -DSPECIAL -c -o $@ $< +    ENDRAW[Makefile(unix)] + +See the documentation further up for more information on configuration +items. + +Finally, you can have some simple conditional use of the build.info +information, looking like this: + +    IF[1] +     something +    ELSIF[2] +     something other +    ELSE +     something else +    ENDIF + +The expression in square brackets is interpreted as a string in perl, +and will be seen as true if perl thinks it is, otherwise false.  For +example, the above would have "something" used, since 1 is true. + +Together with the use of Text::Template, this can be used as +conditions based on something in the passed variables, for example: + +    IF[{- $disabled{shared} -}] +      LIBS=libcrypto +      SOURCE[libcrypto]=... +    ELSE +      LIBS=libfoo +      SOURCE[libfoo]=... +    ENDIF + +or: + +    # VMS has a cultural standard where all libraries are prefixed. +    # For OpenSSL, the choice is 'ossl_' +    IF[{- $config{target} =~ /^vms/ -}] +     RENAME[libcrypto]=ossl_libcrypto +     RENAME[libssl]=ossl_libssl +    ENDIF + + +Build-file programming with the "unified" build system +====================================================== + +"Build files" are called "Makefile" on Unix-like operating systems, +"descrip.mms" for MMS on VMS, "makefile" for nmake on Windows, etc. + +To use the "unified" build system, the target configuration needs to +set the three items 'build_scheme', 'build_file' and 'build_command'. +In the rest of this section, we will assume that 'build_scheme' is set +to "unified" (see the configurations documentation above for the +details). + +For any name given by 'build_file', the "unified" system expects a +template file in Configurations/ named like the build file, with +".tmpl" appended, or in case of possible ambiguity, a combination of +the second 'build_scheme' list item and the 'build_file' name.  For +example, if 'build_file' is set to "Makefile", the template could be +Configurations/Makefile.tmpl or Configurations/unix-Makefile.tmpl. +In case both Configurations/unix-Makefile.tmpl and +Configurations/Makefile.tmpl are present, the former takes +precedence. + +The build-file template is processed with the perl module +Text::Template, using "{-" and "-}" as delimiters that enclose the +perl code fragments that generate configuration-dependent content. +Those perl fragments have access to all the hash variables from +configdata.pem. + +The build-file template is expected to define at least the following +perl functions in a perl code fragment enclosed with "{-" and "-}". +They are all expected to return a string with the lines they produce. + +    generatesrc - function that produces build file lines to generate +                  a source file from some input. + +                  It's called like this: + +                        generatesrc(src => "PATH/TO/tobegenerated", +                                    generator => [ "generatingfile", ... ] +                                    generator_incs => [ "INCL/PATH", ... ] +                                    generator_deps => [ "dep1", ... ] +                                    generator => [ "generatingfile", ... ] +                                    incs => [ "INCL/PATH", ... ], +                                    deps => [ "dep1", ... ], +                                    intent => one of "libs", "dso", "bin" ); + +                  'src' has the name of the file to be generated. +                  'generator' is the command or part of command to +                  generate the file, of which the first item is +                  expected to be the file to generate from. +                  generatesrc() is expected to analyse and figure out +                  exactly how to apply that file and how to capture +                  the result.  'generator_incs' and 'generator_deps' +                  are include directories and files that the generator +                  file itself depends on.  'incs' and 'deps' are +                  include directories and files that are used if $(CC) +                  is used as an intermediary step when generating the +                  end product (the file indicated by 'src').  'intent' +                  indicates what the generated file is going to be +                  used for. + +    src2obj     - function that produces build file lines to build an +                  object file from source files and associated data. + +                  It's called like this: + +                        src2obj(obj => "PATH/TO/objectfile", +                                srcs => [ "PATH/TO/sourcefile", ... ], +                                deps => [ "dep1", ... ], +                                incs => [ "INCL/PATH", ... ] +                                intent => one of "lib", "dso", "bin" ); + +                  'obj' has the intended object file *without* +                  extension, src2obj() is expected to add that. +                  'srcs' has the list of source files to build the +                  object file, with the first item being the source +                  file that directly corresponds to the object file. +                  'deps' is a list of explicit dependencies.  'incs' +                  is a list of include file directories.  Finally, +                  'intent' indicates what this object file is going +                  to be used for. + +    obj2lib     - function that produces build file lines to build a +                  static library file ("libfoo.a" in Unix terms) from +                  object files. + +                  called like this: + +                        obj2lib(lib => "PATH/TO/libfile", +                                objs => [ "PATH/TO/objectfile", ... ]); + +                  'lib' has the intended library file name *without* +                  extension, obj2lib is expected to add that.  'objs' +                  has the list of object files (also *without* +                  extension) to build this library. + +    libobj2shlib - function that produces build file lines to build a +                  shareable object library file ("libfoo.so" in Unix +                  terms) from the corresponding static library file +                  or object files. + +                  called like this: + +                        libobj2shlib(shlib => "PATH/TO/shlibfile", +                                     lib => "PATH/TO/libfile", +                                     objs => [ "PATH/TO/objectfile", ... ], +                                     deps => [ "PATH/TO/otherlibfile", ... ], +                                     ordinals => [ "word", "/PATH/TO/ordfile" ]); + +                  'lib' has the intended library file name *without* +                  extension, libobj2shlib is expected to add that. +                  'shlib' has the corresponding shared library name +                  *without* extension.  'deps' has the list of other +                  libraries (also *without* extension) this library +                  needs to be linked with.  'objs' has the list of +                  object files (also *without* extension) to build +                  this library.  'ordinals' MAY be present, and when +                  it is, its value is an array where the word is +                  "crypto" or "ssl" and the file is one of the ordinal +                  files util/libeay.num or util/ssleay.num in the +                  source directory. + +                  This function has a choice; it can use the +                  corresponding static library as input to make the +                  shared library, or the list of object files. + +    obj2dso     - function that produces build file lines to build a +                  dynamic shared object file from object files. + +                  called like this: + +                        obj2dso(lib => "PATH/TO/libfile", +                                objs => [ "PATH/TO/objectfile", ... ], +                                deps => [ "PATH/TO/otherlibfile", +                                ... ]); + +                  This is almost the same as libobj2shlib, but the +                  intent is to build a shareable library that can be +                  loaded in runtime (a "plugin"...).  The differences +                  are subtle, one of the most visible ones is that the +                  resulting shareable library is produced from object +                  files only. + +    obj2bin     - function that produces build file lines to build an +                  executable file from object files. + +                  called like this: + +                        obj2bin(bin => "PATH/TO/binfile", +                                objs => [ "PATH/TO/objectfile", ... ], +                                deps => [ "PATH/TO/libfile", ... ]); + +                  'bin' has the intended executable file name +                  *without* extension, obj2bin is expected to add +                  that.  'objs' has the list of object files (also +                  *without* extension) to build this library.  'deps' +                  has the list of library files (also *without* +                  extension) that the programs needs to be linked +                  with. + +    in2script   - function that produces build file lines to build a +                  script file from some input. + +                  called like this: + +                        in2script(script => "PATH/TO/scriptfile", +                                  sources => [ "PATH/TO/infile", ... ]); + +                  'script' has the intended script file name. +                  'sources' has the list of source files to build the +                  resulting script from. + +In all cases, file file paths are relative to the build tree top, and +the build file actions run with the build tree top as current working +directory. + +Make sure to end the section with these functions with a string that +you thing is appropriate for the resulting build file.  If nothing +else, end it like this: + +      "";       # Make sure no lingering values end up in the Makefile +    -} + + +Configure helper scripts +======================== + +Configure uses helper scripts in this directory: + +Checker scripts +--------------- + +These scripts are per platform family, to check the integrity of the +tools used for configuration and building.  The checker script used is +either {build_platform}-{build_file}-checker.pm or +{build_platform}-checker.pm, where {build_platform} is the second +'build_scheme' list element from the configuration target data, and +{build_file} is 'build_file' from the same target data. + +If the check succeeds, the script is expected to end with a non-zero +expression.  If the check fails, the script can end with a zero, or +with a `die`. diff --git a/openssl-1.1.0h/Configurations/README.design b/openssl-1.1.0h/Configurations/README.design new file mode 100644 index 0000000..bea9790 --- /dev/null +++ b/openssl-1.1.0h/Configurations/README.design @@ -0,0 +1,641 @@ +Design document for the unified scheme data +=========================================== + +How are things connected? +------------------------- + +The unified scheme takes all its data from the build.info files seen +throughout the source tree.  These files hold the minimum information +needed to build end product files from diverse sources.  See the +section on build.info files below. + +From the information in build.info files, Configure builds up an +information database as a hash table called %unified_info, which is +stored in configdata.pm, found at the top of the build tree (which may +or may not be the same as the source tree). + +Configurations/common.tmpl uses the data from %unified_info to +generate the rules for building end product files as well as +intermediary files with the help of a few functions found in the +build-file templates.  See the section on build-file templates further +down for more information. + +build.info files +---------------- + +As mentioned earlier, build.info files are meant to hold the minimum +information needed to build output files, and therefore only (with a +few possible exceptions [1]) have information about end products (such +as scripts, library files and programs) and source files (such as C +files, C header files, assembler files, etc).  Intermediate files such +as object files are rarely directly referred to in build.info files (and +when they are, it's always with the file name extension .o), they are +inferred by Configure.  By the same rule of minimalism, end product +file name extensions (such as .so, .a, .exe, etc) are never mentioned +in build.info.  Their file name extensions will be inferred by the +build-file templates, adapted for the platform they are meant for (see +sections on %unified_info and build-file templates further down). + +The variables PROGRAMS, LIBS, ENGINES and SCRIPTS are used to declare +end products.  There are variants for them with '_NO_INST' as suffix +(PROGRAM_NO_INST etc) to specify end products that shouldn't get +installed. + +The variables SOURCE, DEPEND, INCLUDE and ORDINALS are indexed by a +produced file, and their values are the source used to produce that +particular produced file, extra dependencies, include directories +needed, and ordinal files (explained further below. + +All their values in all the build.info throughout the source tree are +collected together and form a set of programs, libraries, engines and +scripts to be produced, source files, dependencies, etc etc etc. + +Let's have a pretend example, a very limited contraption of OpenSSL, +composed of the program 'apps/openssl', the libraries 'libssl' and +'libcrypto', an engine 'engines/ossltest' and their sources and +dependencies. + +    # build.info +    LIBS=libcrypto libssl +    ORDINALS[libcrypto]=crypto +    ORDINALS[libssl]=ssl +    INCLUDE[libcrypto]=include +    INCLUDE[libssl]=include +    DEPEND[libssl]=libcrypto + +This is the top directory build.info file, and it tells us that two +libraries are to be built, there are some ordinals to be used to +declare what symbols in those libraries are seen as public, the +include directory 'include/' shall be used throughout when building +anything that will end up in each library, and that the library +'libssl' depend on the library 'libcrypto' to function properly. + +    # apps/build.info +    PROGRAMS=openssl +    SOURCE[openssl]=openssl.c +    INCLUDE[openssl]=.. ../include +    DEPEND[openssl]=../libssl + +This is the build.info file in 'apps/', one may notice that all file +paths mentioned are relative to the directory the build.info file is +located in.  This one tells us that there's a program to be built +called 'apps/openssl' (the file name extension will depend on the +platform and is therefore not mentioned in the build.info file).  It's +built from one source file, 'apps/openssl.c', and building it requires +the use of '.' and 'include' include directories (both are declared +from the point of view of the 'apps/' directory), and that the program +depends on the library 'libssl' to function properly. + +    # crypto/build.info +    LIBS=../libcrypto +    SOURCE[../libcrypto]=aes.c evp.c cversion.c +    DEPEND[cversion.o]=buildinf.h +     +    GENERATE[buildinf.h]=../util/mkbuildinf.pl "$(CC) $(CFLAGS)" "$(PLATFORM)" +    DEPEND[buildinf.h]=../Makefile +    DEPEND[../util/mkbuildinf.pl]=../util/Foo.pm + +This is the build.info file in 'crypto', and it tells us a little more +about what's needed to produce 'libcrypto'.  LIBS is used again to +declare that 'libcrypto' is to be produced.  This declaration is +really unnecessary as it's already mentioned in the top build.info +file, but can make the info file easier to understand.  This is to +show that duplicate information isn't an issue. + +This build.info file informs us that 'libcrypto' is built from a few +source files, 'crypto/aes.c', 'crypto/evp.c' and 'crypto/cversion.c'. +It also shows us that building the object file inferred from +'crypto/cversion.c' depends on 'crypto/buildinf.h'.  Finally, it  +also shows the possibility to declare how some files are generated +using some script, in this case a perl script, and how such scripts +can be declared to depend on other files, in this case a perl module. + +Two things are worth an extra note: + +'DEPEND[cversion.o]' mentions an object file.  DEPEND indexes is the +only location where it's valid to mention them + +Lines in 'BEGINRAW'..'ENDRAW' sections must always mention files as +seen from the top directory, no exception. + +    # ssl/build.info +    LIBS=../libssl +    SOURCE[../libssl]=tls.c + +This is the build.info file in 'ssl/', and it tells us that the +library 'libssl' is built from the source file 'ssl/tls.c'. + +    # engines/build.info +    ENGINES=dasync +    SOURCE[dasync]=e_dasync.c +    DEPEND[dasync]=../libcrypto +    INCLUDE[dasync]=../include + +    ENGINES_NO_INST=ossltest +    SOURCE[ossltest]=e_ossltest.c +    DEPEND[ossltest]=../libcrypto +    INCLUDE[ossltest]=../include + +This is the build.info file in 'engines/', telling us that two engines +called 'engines/dasync' and 'engines/ossltest' shall be built, that +dasync's source is 'engines/e_dasync.c' and ossltest's source is +'engines/e_ossltest.c' and that the include directory 'include/' may +be used when building anything that will be part of these engines. +Also, both engines depend on the library 'libcrypto' to function +properly.  Finally, only dasync is being installed, as ossltest is +only for internal testing. + +When Configure digests these build.info files, the accumulated +information comes down to this: + +    LIBS=libcrypto libssl +    ORDINALS[libcrypto]=crypto +    SOURCE[libcrypto]=crypto/aes.c crypto/evp.c crypto/cversion.c +    DEPEND[crypto/cversion.o]=crypto/buildinf.h +    INCLUDE[libcrypto]=include +    ORDINALS[libssl]=ssl +    SOURCE[libssl]=ssl/tls.c +    INCLUDE[libssl]=include +    DEPEND[libssl]=libcrypto +     +    PROGRAMS=apps/openssl +    SOURCE[apps/openssl]=apps/openssl.c +    INCLUDE[apps/openssl]=. include +    DEPEND[apps/openssl]=libssl + +    ENGINES=engines/dasync +    SOURCE[engines/dasync]=engines/e_dasync.c +    DEPEND[engines/dasync]=libcrypto +    INCLUDE[engines/dasync]=include + +    ENGINES_NO_INST=engines/ossltest +    SOURCE[engines/ossltest]=engines/e_ossltest.c +    DEPEND[engines/ossltest]=libcrypto +    INCLUDE[engines/ossltest]=include +     +    GENERATE[crypto/buildinf.h]=util/mkbuildinf.pl "$(CC) $(CFLAGS)" "$(PLATFORM)" +    DEPEND[crypto/buildinf.h]=Makefile +    DEPEND[util/mkbuildinf.pl]=util/Foo.pm + + +A few notes worth mentioning: + +LIBS may be used to declare routine libraries only. + +PROGRAMS may be used to declare programs only. + +ENGINES may be used to declare engines only. + +The indexes for SOURCE and ORDINALS must only be end product files, +such as libraries, programs or engines.  The values of SOURCE +variables must only be source files (possibly generated) + +INCLUDE and DEPEND shows a relationship between different files +(usually produced files) or between files and directories, such as a +program depending on a library, or between an object file and some +extra source file. + +When Configure processes the build.info files, it will take it as +truth without question, and will therefore perform very few checks. +If the build tree is separate from the source tree, it will assume +that all built files and up in the build directory and that all source +files are to be found in the source tree, if they can be found there. +Configure will assume that source files that can't be found in the +source tree (such as 'crypto/bildinf.h' in the example above) are +generated and will be found in the build tree. + + +The %unified_info database +-------------------------- + +The information in all the build.info get digested by Configure and +collected into the %unified_info database, divided into the following +indexes: + +  depends   => a hash table containing 'file' => [ 'dependency' ... ] +               pairs.  These are directly inferred from the DEPEND +               variables in build.info files. + +  engines   => a list of engines.  These are directly inferred from +               the ENGINES variable in build.info files. + +  generate  => a hash table containing 'file' => [ 'generator' ... ] +               pairs.  These are directly inferred from the GENERATE +               variables in build.info files. + +  includes  => a hash table containing 'file' => [ 'include' ... ] +               pairs.  These are directly inferred from the INCLUDE +               variables in build.info files. + +  install   => a hash table containing 'type' => [ 'file' ... ] pairs. +               The types are 'programs', 'libraries', 'engines' and +               'scripts', and the array of files list the files of +               that type that should be installed. + +  libraries => a list of libraries.  These are directly inferred from +               the LIBS variable in build.info files. + +  ordinals  => a hash table containing 'file' => [ 'word', 'ordfile' ] +               pairs.  'file' and 'word' are directly inferred from +               the ORDINALS variables in build.info files, while the +               file 'ofile' comes from internal knowledge in +               Configure. + +  programs  => a list of programs.  These are directly inferred from +               the PROGRAMS variable in build.info files. + +  rawlines  => a list of build-file lines.  These are a direct copy of +               the BEGINRAW..ENDRAW lines in build.info files.  Note: +               only the BEGINRAW..ENDRAW section for the current +               platform are copied, the rest are ignored. + +  scripts   => a list of scripts.  There are directly inferred from +               the SCRIPTS variable in build.info files. + +  sources   => a hash table containing 'file' => [ 'sourcefile' ... ] +               pairs.  These are indirectly inferred from the SOURCE +               variables in build.info files.  Object files are +               mentioned in this hash table, with source files from +               SOURCE variables, and AS source files for programs and +               libraries. + +  shared_sources => +               a hash table just like 'sources', but only as source +               files (object files) for building shared libraries. + +As an example, here is how the build.info files example from the +section above would be digested into a %unified_info table: + +    our %unified_info = ( +        "depends" => +            { +                "apps/openssl" => +                    [ +                        "libssl", +                    ], +                "crypto/buildinf.h" => +                    [ +                        "Makefile", +                    ], +                "crypto/cversion.o" => +                    [ +                        "crypto/buildinf.h", +                    ], +                "engines/ossltest" => +                    [ +                        "libcrypto", +                    ], +                "libssl" => +                    [ +                        "libcrypto", +                    ], +                "util/mkbuildinf.pl" => +                    [ +                        "util/Foo.pm", +                    ], +            }, +        "engines" => +            [ +                "engines/dasync", +                "engines/ossltest", +            ], +        "generate" => +            { +                "crypto/buildinf.h" => +                    [ +                        "util/mkbuildinf.pl", +                        "\"\$(CC)", +                        "\$(CFLAGS)\"", +                        "\"$(PLATFORM)\"", +                    ], +            }, +        "includes" => +            { +                "apps/openssl" => +                    [ +                        ".", +                        "include", +                    ], +                "engines/ossltest" => +                    [ +                        "include" +                    ], +                "libcrypto" => +                    [ +                        "include", +                    ], +                "libssl" => +                    [ +                        "include", +                    ], +                "util/mkbuildinf.pl" => +                    [ +                        "util", +                    ], +            } +        "install" => +            { +                "engines" => +                    [ +                        "engines/dasync", +                    ], +                "libraries" => +                    [ +                        "libcrypto", +                        "libssl", +                    ], +                "programs" => +                    [ +                        "apps/openssl", +                    ], +           }, +        "libraries" => +            [ +                "libcrypto", +                "libssl", +            ], +        "ordinals" => +            { +                "libcrypto" => +                    [ +                        "crypto", +                        "util/libcrypto.num", +                    ], +                "libssl" => +                    [ +                        "ssl", +                        "util/libssl.num", +                    ], +            }, +        "programs" => +            [ +                "apps/openssl", +            ], +        "rawlines" => +            [ +            ], +        "sources" => +            { +                "apps/openssl" => +                    [ +                        "apps/openssl.o", +                    ], +                "apps/openssl.o" => +                    [ +                        "apps/openssl.c", +                    ], +                "crypto/aes.o" => +                    [ +                        "crypto/aes.c", +                    ], +                "crypto/cversion.o" => +                    [ +                        "crypto/cversion.c", +                    ], +                "crypto/evp.o" => +                    [ +                        "crypto/evp.c", +                    ], +                "engines/e_ossltest.o" => +                    [ +                        "engines/e_ossltest.c", +                    ], +                "engines/ossltest" => +                    [ +                        "engines/e_ossltest.o", +                    ], +                "libcrypto" => +                    [ +                        "crypto/aes.c", +                        "crypto/cversion.c", +                        "crypto/evp.c", +                    ], +                "libssl" => +                    [ +                        "ssl/tls.c", +                    ], +                "ssl/tls.o" => +                    [ +                        "ssl/tls.c", +                    ], +            }, +    ); + +As can be seen, everything in %unified_info is fairly simple suggest +of information.  Still, it tells us that to build all programs, we +must build 'apps/openssl', and to build the latter, we will need to +build all its sources ('apps/openssl.o' in this case) and all the +other things it depends on (such as 'libssl').  All those dependencies +need to be built as well, using the same logic, so to build 'libssl', +we need to build 'ssl/tls.o' as well as 'libcrypto', and to build the +latter... + + +Build-file templates +-------------------- + +Build-file templates are essentially build-files (such as Makefile on +Unix) with perl code fragments mixed in.  Those perl code fragment +will generate all the configuration dependent data, including all the +rules needed to build end product files and intermediary files alike. +At a minimum, there must be a perl code fragment that defines a set of +functions that are used to generates specific build-file rules, to +build static libraries from object files, to build shared libraries +from static libraries, to programs from object files and libraries, +etc. + +    generatesrc - function that produces build file lines to generate +                  a source file from some input. + +                  It's called like this: + +                        generatesrc(src => "PATH/TO/tobegenerated", +                                    generator => [ "generatingfile", ... ] +                                    generator_incs => [ "INCL/PATH", ... ] +                                    generator_deps => [ "dep1", ... ] +                                    incs => [ "INCL/PATH", ... ], +                                    deps => [ "dep1", ... ], +                                    intent => one of "libs", "dso", "bin" ); + +                  'src' has the name of the file to be generated. +                  'generator' is the command or part of command to +                  generate the file, of which the first item is +                  expected to be the file to generate from. +                  generatesrc() is expected to analyse and figure out +                  exactly how to apply that file and how to capture +                  the result.  'generator_incs' and 'generator_deps' +                  are include directories and files that the generator +                  file itself depends on.  'incs' and 'deps' are +                  include directories and files that are used if $(CC) +                  is used as an intermediary step when generating the +                  end product (the file indicated by 'src').  'intent' +                  indicates what the generated file is going to be +                  used for. + +    src2obj     - function that produces build file lines to build an +                  object file from source files and associated data. + +                  It's called like this: + +                        src2obj(obj => "PATH/TO/objectfile", +                                srcs => [ "PATH/TO/sourcefile", ... ], +                                deps => [ "dep1", ... ], +                                incs => [ "INCL/PATH", ... ] +                                intent => one of "lib", "dso", "bin" ); + +                  'obj' has the intended object file *without* +                  extension, src2obj() is expected to add that. +                  'srcs' has the list of source files to build the +                  object file, with the first item being the source +                  file that directly corresponds to the object file. +                  'deps' is a list of explicit dependencies.  'incs' +                  is a list of include file directories.  Finally, +                  'intent' indicates what this object file is going +                  to be used for. + +    obj2lib     - function that produces build file lines to build a +                  static library file ("libfoo.a" in Unix terms) from +                  object files. + +                  called like this: + +                        obj2lib(lib => "PATH/TO/libfile", +                                objs => [ "PATH/TO/objectfile", ... ]); + +                  'lib' has the intended library file name *without* +                  extension, obj2lib is expected to add that.  'objs' +                  has the list of object files (also *without* +                  extension) to build this library. + +    libobj2shlib - function that produces build file lines to build a +                  shareable object library file ("libfoo.so" in Unix +                  terms) from the corresponding static library file +                  or object files. + +                  called like this: + +                        libobj2shlib(shlib => "PATH/TO/shlibfile", +                                     lib => "PATH/TO/libfile", +                                     objs => [ "PATH/TO/objectfile", ... ], +                                     deps => [ "PATH/TO/otherlibfile", ... ], +                                     ordinals => [ "word", "/PATH/TO/ordfile" ]); + +                  'lib' has the intended library file name *without* +                  extension, libobj2shlib is expected to add that. +                  'shlib' has the corresponding shared library name +                  *without* extension.  'deps' has the list of other +                  libraries (also *without* extension) this library +                  needs to be linked with.  'objs' has the list of +                  object files (also *without* extension) to build +                  this library.  'ordinals' MAY be present, and when +                  it is, its value is an array where the word is +                  "crypto" or "ssl" and the file is one of the ordinal +                  files util/libcrypto.num or util/libssl.num in the +                  source directory. + +                  This function has a choice; it can use the +                  corresponding static library as input to make the +                  shared library, or the list of object files. + +    obj2dynlib  - function that produces build file lines to build a +                  dynamically loadable library file ("libfoo.so" on +                  Unix) from object files. + +                  called like this: + +                        obj2dynlib(lib => "PATH/TO/libfile", +                                   objs => [ "PATH/TO/objectfile", ... ], +                                   deps => [ "PATH/TO/otherlibfile", +                                   ... ]); + +                  This is almost the same as libobj2shlib, but the +                  intent is to build a shareable library that can be +                  loaded in runtime (a "plugin"...).  The differences +                  are subtle, one of the most visible ones is that the +                  resulting shareable library is produced from object +                  files only. + +    obj2bin     - function that produces build file lines to build an +                  executable file from object files. + +                  called like this: + +                        obj2bin(bin => "PATH/TO/binfile", +                                objs => [ "PATH/TO/objectfile", ... ], +                                deps => [ "PATH/TO/libfile", ... ]); + +                  'bin' has the intended executable file name +                  *without* extension, obj2bin is expected to add +                  that.  'objs' has the list of object files (also +                  *without* extension) to build this library.  'deps' +                  has the list of library files (also *without* +                  extension) that the programs needs to be linked +                  with. + +    in2script   - function that produces build file lines to build a +                  script file from some input. + +                  called like this: + +                        in2script(script => "PATH/TO/scriptfile", +                                  sources => [ "PATH/TO/infile", ... ]); + +                  'script' has the intended script file name. +                  'sources' has the list of source files to build the +                  resulting script from. + +Along with the build-file templates is the driving engine +Configurations/common.tmpl, which looks through all the information in +%unified_info and generates all the rulesets to build libraries, +programs and all intermediate files, using the rule generating +functions defined in the build-file template. + +As an example with the smaller build.info set we've seen as an +example, producing the rules to build 'libcrypto' would result in the +following calls: + +    # Note: libobj2shlib will only be called if shared libraries are +    # to be produced. +    # Note 2: libobj2shlib gets both the name of the static library +    # and the names of all the object files that go into it.  It's up +    # to the implementation to decide which to use as input. +    # Note 3: common.tmpl peals off the ".o" extension from all object +    # files, as the platform at hand may have a different one. +    libobj2shlib(shlib => "libcrypto", +                 lib => "libcrypto", +                 objs => [ "crypto/aes", "crypto/evp", "crypto/cversion" ], +                 deps => [  ] +                 ordinals => [ "crypto", "util/libcrypto.num" ]); + +    obj2lib(lib => "libcrypto" +            objs => [ "crypto/aes", "crypto/evp", "crypto/cversion" ]); + +    src2obj(obj => "crypto/aes" +            srcs => [ "crypto/aes.c" ], +            deps => [ ], +            incs => [ "include" ], +            intent => "lib"); + +    src2obj(obj => "crypto/evp" +            srcs => [ "crypto/evp.c" ], +            deps => [ ], +            incs => [ "include" ], +            intent => "lib"); + +    src2obj(obj => "crypto/cversion" +            srcs => [ "crypto/cversion.c" ], +            deps => [ "crypto/buildinf.h" ], +            incs => [ "include" ], +            intent => "lib"); + +    generatesrc(src => "crypto/buildinf.h", +                generator => [ "util/mkbuildinf.pl", "\"$(CC)", +                               "$(CFLAGS)\"", "\"$(PLATFORM)\"" ], +                generator_incs => [ "util" ], +                generator_deps => [ "util/Foo.pm" ], +                incs => [ ], +                deps => [ ], +                intent => "lib"); + +The returned strings from all those calls are then concatenated +together and written to the resulting build-file. diff --git a/openssl-1.1.0h/Configurations/common.tmpl b/openssl-1.1.0h/Configurations/common.tmpl new file mode 100644 index 0000000..13ffe94 --- /dev/null +++ b/openssl-1.1.0h/Configurations/common.tmpl @@ -0,0 +1,229 @@ +{- # -*- Mode: perl -*- + + use File::Basename; + + # A cache of objects for which a recipe has already been generated + my %cache; + + # resolvedepends and reducedepends work in tandem to make sure + # there are no duplicate dependencies and that they are in the + # right order.  This is especially used to sort the list of + # libraries that a build depends on. + sub resolvedepends { +     my $thing = shift; +     my @listsofar = @_;    # to check if we're looping +     my @list = @{$unified_info{depends}->{$thing}}; +     my @newlist = (); +     if (scalar @list) { +         foreach my $item (@list) { +             # It's time to break off when the dependency list starts looping +             next if grep { $_ eq $item } @listsofar; +             push @newlist, $item, resolvedepends($item, @listsofar, $item); +         } +     } +     @newlist; + } + sub reducedepends { +     my @list = @_; +     my @newlist = (); +     while (@list) { +         my $item = shift @list; +         push @newlist, $item +             unless grep { $item eq $_ } @list; +     } +     @newlist; + } + + # dogenerate is responsible for producing all the recipes that build + # generated source files.  It recurses in case a dependency is also a + # generated source file. + sub dogenerate { +     my $src = shift; +     return "" if $cache{$src}; +     my $obj = shift; +     my $bin = shift; +     my %opts = @_; +     if ($unified_info{generate}->{$src}) { +         die "$src is generated by Configure, should not appear in build file\n" +             if ref $unified_info{generate}->{$src} eq ""; +         my $script = $unified_info{generate}->{$src}->[0]; +         $OUT .= generatesrc(src => $src, +                             generator => $unified_info{generate}->{$src}, +                             generator_incs => $unified_info{includes}->{$script}, +                             generator_deps => $unified_info{depends}->{$script}, +                             deps => $unified_info{depends}->{$src}, +                             incs => $unified_info{includes}->{$obj}, +                             %opts); +         foreach (@{$unified_info{depends}->{$src}}) { +             dogenerate($_, $obj, $bin, %opts); +         } +     } +     $cache{$src} = 1; + } + + # doobj is responsible for producing all the recipes that build + # object files as well as dependency files. + sub doobj { +     my $obj = shift; +     return "" if $cache{$obj}; +     (my $obj_no_o = $obj) =~ s|\.o$||; +     my $bin = shift; +     my %opts = @_; +     if (@{$unified_info{sources}->{$obj}}) { +         $OUT .= src2obj(obj => $obj_no_o, +                         srcs => $unified_info{sources}->{$obj}, +                         deps => $unified_info{depends}->{$obj}, +                         incs => $unified_info{includes}->{$obj}, +                         %opts); +         foreach ((@{$unified_info{sources}->{$obj}}, +                   @{$unified_info{depends}->{$obj}})) { +             dogenerate($_, $obj, $bin, %opts); +         } +     } +     $cache{$obj} = 1; + } + + # dolib is responsible for building libraries.  It will call + # libobj2shlib is shared libraries are produced, and obj2lib in all + # cases.  It also makes sure all object files for the library are + # built. + sub dolib { +     my $lib = shift; +     return "" if $cache{$lib}; +     unless ($disabled{shared}) { +         my %ordinals = +             $unified_info{ordinals}->{$lib} +             ? (ordinals => $unified_info{ordinals}->{$lib}) : (); +         $OUT .= libobj2shlib(shlib => $unified_info{sharednames}->{$lib}, +                              lib => $lib, +                              objs => [ map { (my $x = $_) =~ s|\.o$||; $x } +                                        (@{$unified_info{sources}->{$lib}}, +                                         @{$unified_info{shared_sources}->{$lib}}) ], +                              deps => [ reducedepends(resolvedepends($lib)) ], +                              %ordinals); +         foreach (@{$unified_info{shared_sources}->{$lib}}) { +             doobj($_, $lib, intent => "lib"); +         } +     } +     $OUT .= obj2lib(lib => $lib, +                     objs => [ map { (my $x = $_) =~ s|\.o$||; $x } +                               @{$unified_info{sources}->{$lib}} ]); +     foreach (@{$unified_info{sources}->{$lib}}) { +         doobj($_, $lib, intent => "lib"); +     } +     $cache{$lib} = 1; + } + + # doengine is responsible for building engines.  It will call + # obj2dso, and also makes sure all object files for the library + # are built. + sub doengine { +     my $lib = shift; +     return "" if $cache{$lib}; +     $OUT .= obj2dso(lib => $lib, +                     objs => [ map { (my $x = $_) =~ s|\.o$||; $x } +                               (@{$unified_info{sources}->{$lib}}, +                                @{$unified_info{shared_sources}->{$lib}}) ], +                     deps => [ resolvedepends($lib) ]); +     foreach ((@{$unified_info{sources}->{$lib}}, +               @{$unified_info{shared_sources}->{$lib}})) { +         doobj($_, $lib, intent => "dso"); +     } +     $cache{$lib} = 1; + } + + # dobin is responsible for building programs.  It will call obj2bin, + # and also makes sure all object files for the library are built. + sub dobin { +     my $bin = shift; +     return "" if $cache{$bin}; +     my $deps = [ reducedepends(resolvedepends($bin)) ]; +     $OUT .= obj2bin(bin => $bin, +                     objs => [ map { (my $x = $_) =~ s|\.o$||; $x } +                               @{$unified_info{sources}->{$bin}} ], +                     deps => $deps); +     foreach (@{$unified_info{sources}->{$bin}}) { +         doobj($_, $bin, intent => "bin"); +     } +     $cache{$bin} = 1; + } + + # dobin is responsible for building scripts from templates.  It will + # call in2script. + sub doscript { +     my $script = shift; +     return "" if $cache{$script}; +     $OUT .= in2script(script => $script, +                       sources => $unified_info{sources}->{$script}); +     $cache{$script} = 1; + } + + sub dodir { +     my $dir = shift; +     return "" if !exists(&generatedir) or $cache{$dir}; +     $OUT .= generatedir(dir => $dir, +                         deps => $unified_info{dirinfo}->{$dir}->{deps}, +                         %{$unified_info{dirinfo}->{$_}->{products}}); +     $cache{$dir} = 1; + } + + # Start with populating the cache with all the overrides + %cache = map { $_ => 1 } @{$unified_info{overrides}}; + + # For convenience collect information regarding directories where + # files are generated, those generated files and the end product + # they end up in where applicable.  Then, add build rules for those + # directories + if (exists &generatedir) { +     my %loopinfo = ( "dso" => [ @{$unified_info{engines}} ], +                      "lib" => [ @{$unified_info{libraries}} ], +                      "bin" => [ @{$unified_info{programs}} ], +                      "script" => [ @{$unified_info{scripts}} ] ); +     foreach my $type (keys %loopinfo) { +         foreach my $product (@{$loopinfo{$type}}) { +             my %dirs = (); +             my $pd = dirname($product); + +             # We already have a "test" target, and the current directory +             # is just silly to make a target for +             $dirs{$pd} = 1 unless $pd eq "test" || $pd eq "."; + +             foreach (@{$unified_info{sources}->{$product}}) { +                 my $d = dirname($_); + +                 # We don't want to create targets for source directories +                 # when building out of source +                 next if ($config{sourcedir} ne $config{builddir} +                          && $d =~ m|^\Q$config{sourcedir}\E|); +                 # We already have a "test" target, and the current directory +                 # is just silly to make a target for +                 next if $d eq "test" || $d eq "."; + +                 $dirs{$d} = 1; +                 push @{$unified_info{dirinfo}->{$d}->{deps}}, $_ +                     if $d ne $pd; +             } +             foreach (keys %dirs) { +                 push @{$unified_info{dirinfo}->{$_}->{products}->{$type}}, +                 $product; +             } +         } +     } + } + + # Build mandatory generated headers + foreach (@{$unified_info{depends}->{""}}) { dogenerate($_); } + + # Build all known libraries, engines, programs and scripts. + # Everything else will be handled as a consequence. + foreach (@{$unified_info{libraries}}) { dolib($_);    } + foreach (@{$unified_info{engines}})   { doengine($_); } + foreach (@{$unified_info{programs}})  { dobin($_);    } + foreach (@{$unified_info{scripts}})   { doscript($_); } + + foreach (sort keys %{$unified_info{dirinfo}})  { dodir($_); } + + # Finally, should there be any applicable BEGINRAW/ENDRAW sections, + # they are added here. + $OUT .= $_."\n" foreach @{$unified_info{rawlines}}; +-} diff --git a/openssl-1.1.0h/Configurations/descrip.mms.tmpl b/openssl-1.1.0h/Configurations/descrip.mms.tmpl new file mode 100644 index 0000000..7e3356f --- /dev/null +++ b/openssl-1.1.0h/Configurations/descrip.mms.tmpl @@ -0,0 +1,780 @@ +## descrip.mms to build OpenSSL on OpenVMS +## +## {- join("\n## ", @autowarntext) -} +{- +  use File::Spec::Functions qw/:DEFAULT abs2rel rel2abs/; + +  # Our prefix, claimed when speaking with the VSI folks Tuesday +  # January 26th 2016 +  our $osslprefix = 'OSSL$'; +  (our $osslprefix_q = $osslprefix) =~ s/\$/\\\$/; + +  our $sover = sprintf "%02d%02d", $config{shlib_major}, $config{shlib_minor}; +  our $osslver = sprintf "%02d%02d", split(/\./, $config{version}); + +  our $sourcedir = $config{sourcedir}; +  our $builddir = $config{builddir}; +  sub sourcefile { +      catfile($sourcedir, @_); +  } +  sub buildfile { +      catfile($builddir, @_); +  } +  sub sourcedir { +      catdir($sourcedir, @_); +  } +  sub builddir { +      catdir($builddir, @_); +  } +  sub tree { +      (my $x = shift) =~ s|\]$|...]|; +      $x +  } +  sub move { +      my $f = catdir(@_); +      my $b = abs2rel(rel2abs("."),rel2abs($f)); +      $sourcedir = catdir($b,$sourcedir) +          if !file_name_is_absolute($sourcedir); +      $builddir = catdir($b,$builddir) +          if !file_name_is_absolute($builddir); +      ""; +  } + +  # Because we need to make two computations of these data, +  # we store them in arrays for reuse +  our @shlibs = map { $unified_info{sharednames}->{$_} || () } @{$unified_info{libraries}}; +  our @install_shlibs = map { $unified_info{sharednames}->{$_} || () } @{$unified_info{install}->{libraries}}; +  our @generated = ( ( map { (my $x = $_) =~ s|\.S$|\.s|; $x } +                       grep { defined $unified_info{generate}->{$_} } +                       map { @{$unified_info{sources}->{$_}} } +                       grep { /\.o$/ } keys %{$unified_info{sources}} ), +                     ( grep { /\.h$/ } keys %{$unified_info{generate}} ) ); + +  # This is a horrible hack, but is needed because recursive inclusion of files +  # in different directories does not work well with HP C. +  my $sd = sourcedir("crypto", "async", "arch"); +  foreach (grep /\[\.crypto\.async\.arch\].*\.o$/, keys %{$unified_info{sources}}) { +      (my $x = $_) =~ s|\.o$|.OBJ|; +      $unified_info{before}->{$x} +          = qq(arch_include = F\$PARSE("$sd","A.;",,,"SYNTAX_ONLY") - "A.;" +        define arch 'arch_include'); +      $unified_info{after}->{$x} +          = qq(deassign arch); +  } +  my $sd1 = sourcedir("ssl","record"); +  my $sd2 = sourcedir("ssl","statem"); +  $unified_info{before}->{"[.test]heartbeat_test.OBJ"} +      = $unified_info{before}->{"[.test]ssltest_old.OBJ"} +      = qq(record_include = F\$PARSE("$sd1","A.;",,,"SYNTAX_ONLY") - "A.;" +        define record 'record_include' +        statem_include = F\$PARSE("$sd2","A.;",,,"SYNTAX_ONLY") - "A.;" +        define statem 'statem_include'); +  $unified_info{after}->{"[.test]heartbeat_test.OBJ"} +      = $unified_info{after}->{"[.test]ssltest.OBJ"} +      = qq(deassign statem +        deassign record); +  foreach (grep /^\[\.ssl\.(?:record|statem)\].*\.o$/, keys %{$unified_info{sources}}) { +      (my $x = $_) =~ s|\.o$|.OBJ|; +      $unified_info{before}->{$x} +          = qq(record_include = F\$PARSE("$sd1","A.;",,,"SYNTAX_ONLY") - "A.;" +        define record 'record_include' +        statem_include = F\$PARSE("$sd2","A.;",,,"SYNTAX_ONLY") - "A.;" +        define statem 'statem_include'); +      $unified_info{after}->{$x} +          = qq(deassign statem +        deassign record); +  } +  # This makes sure things get built in the order they need +  # to. You're welcome. +  sub dependmagic { +      my $target = shift; + +      return "$target : build_generated\n\t\pipe \$(MMS) \$(MMSQUALIFIERS) depend && \$(MMS) \$(MMSQUALIFIERS) _$target\n_$target"; +  } +  #use Data::Dumper; +  #print STDERR "DEBUG: before:\n", Dumper($unified_info{before}); +  #print STDERR "DEBUG: after:\n", Dumper($unified_info{after}); +  ""; +-} +PLATFORM={- $config{target} -} +OPTIONS={- $config{options} -} +CONFIGURE_ARGS=({- join(", ",quotify_l(@{$config{perlargv}})) -}) +SRCDIR={- $config{sourcedir} -} +BLDDIR={- $config{builddir} -} + +# Allow both V and VERBOSE to indicate verbosity.  This only applies +# to testing. +VERBOSE=$(V) + +VERSION={- $config{version} -} +MAJOR={- $config{major} -} +MINOR={- $config{minor} -} +SHLIB_VERSION_NUMBER={- $config{shlib_version_number} -} +SHLIB_VERSION_HISTORY={- $config{shlib_version_history} -} +SHLIB_MAJOR={- $config{shlib_major} -} +SHLIB_MINOR={- $config{shlib_minor} -} +SHLIB_TARGET={- $target{shared_target} -} + +EXE_EXT=.EXE +LIB_EXT=.OLB +SHLIB_EXT=.EXE +OBJ_EXT=.OBJ +DEP_EXT=.D + +LIBS={- join(", ", map { "-\n\t".$_.".OLB" } @{$unified_info{libraries}}) -} +SHLIBS={- join(", ", map { "-\n\t".$_.".EXE" } @shlibs) -} +ENGINES={- join(", ", map { "-\n\t".$_.".EXE" } @{$unified_info{engines}}) -} +PROGRAMS={- join(", ", map { "-\n\t".$_.".EXE" } @{$unified_info{programs}}) -} +SCRIPTS={- join(", ", map { "-\n\t".$_ } @{$unified_info{scripts}}) -} +{- output_off() if $disabled{makedepend}; "" -} +DEPS={- our @deps = map { (my $x = $_) =~ s|\.o$|\$(DEP_EXT)|; $x; } +                    grep { $unified_info{sources}->{$_}->[0] =~ /\.c$/ } +                    keys %{$unified_info{sources}}; +        join(", ", map { "-\n\t".$_ } @deps); -} +{- output_on() if $disabled{makedepend}; "" -} +GENERATED_MANDATORY={- join(", ", map { "-\n\t".$_ } @{$unified_info{depends}->{""}} ) -} +GENERATED={- join(", ", map { "-\n\t".$_ } @generated) -} + +INSTALL_LIBS={- join(", ", map { "-\n\t".$_.".OLB" } @{$unified_info{install}->{libraries}}) -} +INSTALL_SHLIBS={- join(", ", map { "-\n\t".$_.".EXE" } @install_shlibs) -} +INSTALL_ENGINES={- join(", ", map { "-\n\t".$_.".EXE" } @{$unified_info{install}->{engines}}) -} +INSTALL_PROGRAMS={- join(", ", map { "-\n\t".$_.".EXE" } @{$unified_info{install}->{programs}}) -} +{- output_off() if $disabled{apps}; "" -} +BIN_SCRIPTS=[.tools]c_rehash.pl +MISC_SCRIPTS=[.apps]CA.pl, [.apps]tsget.pl +{- output_on() if $disabled{apps}; "" -} + +APPS_OPENSSL={- use File::Spec::Functions; +                catfile("apps","openssl") -} + +# DESTDIR is for package builders so that they can configure for, say, +# SYS$COMMON:[OPENSSL] and yet have everything installed in STAGING:[USER]. +# In that case, configure with --prefix=SYS$COMMON:[OPENSSL] and then run +# MMS with /MACROS=(DESTDIR=STAGING:[USER]).  The result will end up in +# STAGING:[USER.OPENSSL]. +# Normally it is left empty. +DESTDIR= + +# Do not edit this manually. Use Configure --prefix=DIR to change this! +INSTALLTOP={- our $installtop = +                  catdir($config{prefix}) || "SYS\$COMMON:[OPENSSL]"; +              $installtop -} +SYSTARTUP={- catdir($installtop, '[.SYS$STARTUP]'); -} +# This is the standard central area to store certificates, private keys... +OPENSSLDIR={- catdir($config{openssldir}) or +              $config{prefix} ? catdir($config{prefix},"COMMON") +                              : "SYS\$COMMON:[OPENSSL-COMMON]" -} +# The same, but for C +OPENSSLDIR_C={- $osslprefix -}DATAROOT:[000000] +# Where installed engines reside, for C +ENGINESDIR_C={- $osslprefix -}ENGINES{- $sover.$target{pointer_size} -}: + +CC= {- $target{cc} -} +CFLAGS= /DEFINE=({- join(",", @{$target{defines}}, @{$config{defines}},"OPENSSLDIR=\"\"\"\$(OPENSSLDIR_C)\"\"\"","ENGINESDIR=\"\"\"\$(ENGINESDIR_C)\"\"\"") -}) {- $target{cflags} -} {- $config{cflags} -} +CFLAGS_Q=$(CFLAGS) +DEPFLAG= /DEFINE=({- join(",", @{$config{depdefines}}) -}) +LDFLAGS= {- $target{lflags} -} +EX_LIBS= {- $target{ex_libs} ? ",".$target{ex_libs} : "" -}{- $config{ex_libs} ? ",".$config{ex_libs} : "" -} +LIB_CFLAGS={- $target{lib_cflags} || "" -} +DSO_CFLAGS={- $target{dso_cflags} || "" -} +BIN_CFLAGS={- $target{bin_cflags} || "" -} + +PERL={- $config{perl} -} + +# We let the C compiler driver to take care of .s files. This is done in +# order to be excused from maintaining a separate set of architecture +# dependent assembler flags. E.g. if you throw -mcpu=ultrasparc at SPARC +# gcc, then the driver will automatically translate it to -xarch=v8plus +# and pass it down to assembler. +AS={- $target{as} -} +ASFLAG={- $target{asflags} -} + +# .FIRST and .LAST are special targets with MMS and MMK. +# The defines in there are for C.  includes that look like +# this: +# +#    #include <openssl/foo.h> +#    #include "internal/bar.h" +# +# will use the logical names to find the files.  Expecting +# DECompHP C to find files in subdirectories of whatever was +# given with /INCLUDE is a fantasy, unfortunately. +NODEBUG=@ +.FIRST : +        $(NODEBUG) openssl_inc1 = F$PARSE("[.include.openssl]","A.;",,,"syntax_only") - "A.;" +        $(NODEBUG) openssl_inc2 = F$PARSE("{- catdir($config{sourcedir},"[.include.openssl]") -}","A.;",,,"SYNTAX_ONLY") - "A.;" +        $(NODEBUG) internal_inc1 = F$PARSE("[.crypto.include.internal]","A.;",,,"SYNTAX_ONLY") - "A.;" +        $(NODEBUG) internal_inc2 = F$PARSE("{- catdir($config{sourcedir},"[.include.internal]") -}","A.;",,,"SYNTAX_ONLY") - "A.;" +        $(NODEBUG) internal_inc3 = F$PARSE("{- catdir($config{sourcedir},"[.crypto.include.internal]") -}","A.;",,,"SYNTAX_ONLY") - "A.;" +        $(NODEBUG) DEFINE openssl 'openssl_inc1','openssl_inc2' +        $(NODEBUG) DEFINE internal 'internal_inc1','internal_inc2','internal_inc3' +        $(NODEBUG) staging_dir = "$(DESTDIR)" +        $(NODEBUG) staging_instdir = "" +        $(NODEBUG) staging_datadir = "" +        $(NODEBUG) IF staging_dir .NES. "" THEN - +                staging_instdir = F$PARSE("A.;",staging_dir,"[]",,"SYNTAX_ONLY") +        $(NODEBUG) IF staging_instdir - "]A.;" .NES. staging_instdir THEN - +                staging_instdir = staging_instdir - "]A.;" + ".OPENSSL-INSTALL]" +        $(NODEBUG) IF staging_instdir - "A.;" .NES. staging_instdir THEN - +                staging_instdir = staging_instdir - "A.;" + "[OPENSSL-INSTALL]" +        $(NODEBUG) IF staging_dir .NES. "" THEN - +                staging_datadir = F$PARSE("A.;",staging_dir,"[]",,"SYNTAX_ONLY") +        $(NODEBUG) IF staging_datadir - "]A.;" .NES. staging_datadir THEN - +                staging_datadir = staging_datadir - "]A.;" + ".OPENSSL-COMMON]" +        $(NODEBUG) IF staging_datadir - "A.;" .NES. staging_datadir THEN - +                staging_datadir = staging_datadir - "A.;" + "[OPENSSL-COMMON]" +        $(NODEBUG) ! +        $(NODEBUG) ! Installation logical names +        $(NODEBUG) ! +        $(NODEBUG) installtop = F$PARSE(staging_instdir,"$(INSTALLTOP)","[]A.;",,"SYNTAX_ONLY,NO_CONCEAL") - ".][000000" - "[000000." - "][" - "]A.;" + ".]" +        $(NODEBUG) datatop = F$PARSE(staging_datadir,"$(OPENSSLDIR)","[]A.;",,"SYNTAX_ONLY,NO_CONCEAL") - ".][000000" - "[000000." - "][" - "]A.;" + ".]" +        $(NODEBUG) DEFINE ossl_installroot 'installtop' +        $(NODEBUG) DEFINE ossl_dataroot 'datatop' +        $(NODEBUG) ! +        $(NODEBUG) ! Figure out the architecture +        $(NODEBUG) ! +        $(NODEBUG) arch = f$edit( f$getsyi( "arch_name"), "upcase") +        $(NODEBUG) ! +        $(NODEBUG) ! Set up logical names for the libraries, so LINK and +        $(NODEBUG) ! running programs can use them. +        $(NODEBUG) ! +        $(NODEBUG) {- join("\n\t\$(NODEBUG) ", map { "DEFINE ".uc($_)." 'F\$ENV(\"DEFAULT\")'".uc($_)."\$(SHLIB_EXT)" } map { $unified_info{sharednames}->{$_} || () } @{$unified_info{libraries}}) || "!" -} + +.LAST : +        $(NODEBUG) {- join("\n\t\$(NODEBUG) ", map { "DEASSIGN ".uc($_) } map { $unified_info{sharednames}->{$_} || () } @{$unified_info{libraries}}) || "!" -} +        $(NODEBUG) DEASSIGN ossl_dataroot +        $(NODEBUG) DEASSIGN ossl_installroot +        $(NODEBUG) DEASSIGN internal +        $(NODEBUG) DEASSIGN openssl +.DEFAULT : +        @ ! MMS cannot handle no actions... + +# The main targets ################################################### + +{- dependmagic('all'); -} : build_libs_nodep, build_engines_nodep, build_programs_nodep +{- dependmagic('build_libs'); -} : build_libs_nodep +{- dependmagic('build_engines'); -} : build_engines_nodep +{- dependmagic('build_programs'); -} : build_programs_nodep + +build_generated : $(GENERATED_MANDATORY) +build_libs_nodep : $(LIBS), $(SHLIBS) +build_engines_nodep : $(ENGINES) +build_programs_nodep : $(PROGRAMS), $(SCRIPTS) + +# Kept around for backward compatibility +build_apps build_tests : build_programs + +# Convenience target to prebuild all generated files, not just the mandatory +# ones +build_all_generated : $(GENERATED_MANDATORY) $(GENERATED) + +test : tests +{- dependmagic('tests'); -} : build_programs_nodep, build_engines_nodep +        @ ! {- output_off() if $disabled{tests}; "" -} +        SET DEFAULT [.test]{- move("test") -} +        CREATE/DIR [.test-runs] +        DEFINE SRCTOP {- sourcedir() -} +        DEFINE BLDTOP {- builddir() -} +        DEFINE RESULT_D {- builddir(qw(test test-runs)) -} +        DEFINE OPENSSL_ENGINES {- builddir("engines") -} +        DEFINE OPENSSL_DEBUG_MEMORY "on" +        IF "$(VERBOSE)" .NES. "" THEN DEFINE VERBOSE "$(VERBOSE)" +        $(PERL) {- sourcefile("test", "run_tests.pl") -} $(TESTS) +        DEASSIGN OPENSSL_DEBUG_MEMORY +        DEASSIGN OPENSSL_ENGINES +        DEASSIGN BLDTOP +        DEASSIGN SRCTOP +        SET DEFAULT [-]{- move("..") -} +        @ ! {- if ($disabled{tests}) { output_on(); } else { output_off(); } "" -} +        @ WRITE SYS$OUTPUT "Tests are not supported with your chosen Configure options" +        @ ! {- output_on() if !$disabled{tests}; "" -} + +list-tests : +        @ ! {- output_off() if $disabled{tests}; "" -} +        @ DEFINE SRCTOP {- sourcedir() -} +        @ $(PERL) {- sourcefile("test", "run_tests.pl") -} list +        @ DEASSIGN SRCTOP +        @ ! {- if ($disabled{tests}) { output_on(); } else { output_off(); } "" -} +        @ WRITE SYS$OUTPUT "Tests are not supported with your chosen Configure options" +        @ ! {- output_on() if !$disabled{tests}; "" -} + +install : install_sw install_ssldirs install_docs +        @ WRITE SYS$OUTPUT "" +        @ WRITE SYS$OUTPUT "######################################################################" +        @ WRITE SYS$OUTPUT "" +        @ IF "$(DESTDIR)" .EQS. "" THEN - +             PIPE ( WRITE SYS$OUTPUT "Installation complete" ; - +                    WRITE SYS$OUTPUT "" ; - +                    WRITE SYS$OUTPUT "Run @$(SYSTARTUP)openssl_startup{- $osslver -} to set up logical names" ; - +                    WRITE SYS$OUTPUT "then run @$(SYSTARTUP)openssl_utils{- $osslver -} to define commands" ; - +                    WRITE SYS$OUTPUT "" ) +        @ IF "$(DESTDIR)" .NES. "" THEN - +             PIPE ( WRITE SYS$OUTPUT "Staging installation complete" ; - +                    WRITE SYS$OUTPUT "" ; - +                    WRITE SYS$OUTPUT "Finish or package in such a way that the contents of the directory tree" ; - +                    WRITE SYS$OUTPUT staging_instdir ; - +                    WRITE SYS$OUTPUT "ends up in $(INSTALLTOP)," ; - +                    WRITE SYS$OUTPUT "and that the contents of the contents of the directory tree" ; - +                    WRITE SYS$OUTPUT staging_datadir ; - +                    WRITE SYS$OUTPUT "ends up in $(OPENSSLDIR)" ; - +                    WRITE SYS$OUTPUT "" ; - +                    WRITE SYS$OUTPUT "When in its final destination," ; - +                    WRITE SYS$OUTPUT "Run @$(SYSTARTUP)openssl_startup{- $osslver -} to set up logical names" ; - +                    WRITE SYS$OUTPUT "then run @$(SYSTARTUP)openssl_utils{- $osslver -} to define commands" ; - +                    WRITE SYS$OUTPUT "" ) + +check_install : +        spawn/nolog @ossl_installroot:[SYSTEST]openssl_ivp{- $osslver -}.com + +uninstall : uninstall_docs uninstall_sw + +# Because VMS wants the generation number (or *) to delete files, we can't +# use $(LIBS), $(PROGRAMS), $(GENERATED) and $(ENGINES)directly. +libclean : +        {- join("\n\t", map { "- DELETE $_.OLB;*" } @{$unified_info{libraries}}) || "@ !" -} +        {- join("\n\t", map { "- DELETE $_.EXE;*,$_.MAP;*,$_.OPT;*" } @shlibs) || "@ !" -} + +clean : libclean +        {- join("\n\t", map { "- DELETE $_.EXE;*,$_.OPT;*" } @{$unified_info{programs}}) || "@ !" -} +        {- join("\n\t", map { "- DELETE $_.EXE;*,$_.OPT;*" } @{$unified_info{engines}}) || "@ !" -} +        {- join("\n\t", map { "- DELETE $_;*" } @{$unified_info{scripts}}) || "@ !" -} +        {- join("\n\t", map { "- DELETE $_;*" } @generated) || "@ !" -} +        - DELETE [...]*.MAP;* +        - DELETE [...]*.D;* +        - DELETE [...]*.OBJ;*,*.LIS;* +        - DELETE []CXX$DEMANGLER_DB.;* +        - DELETE [.VMS]openssl_startup.com;* +        - DELETE [.VMS]openssl_shutdown.com;* +        - DELETE []vmsconfig.pm;* + +distclean : clean +        - DELETE configdata.pm;* +        - DELETE descrip.mms;* + +depend : descrip.mms +descrip.mms : FORCE +	@ ! {- output_off() if $disabled{makedepend}; "" -} +        @ $(PERL) -pe "if (/^# DO NOT DELETE.*/) { exit(0); }" - +                < descrip.mms > descrip.mms-new +        @ OPEN/APPEND DESCRIP descrip.mms-new +        @ WRITE DESCRIP "# DO NOT DELETE THIS LINE -- make depend depends on it." +        {- join("\n\t", map { "\@ IF F\$SEARCH(\"$_\") .NES. \"\" THEN TYPE $_ /OUTPUT=DESCRIP:" } @deps); -} +        @ CLOSE DESCRIP +        @ PIPE ( $(PERL) -e "use File::Compare qw/compare_text/; my $x = compare_text(""descrip.mms"",""descrip.mms-new""); exit(0x10000000 + ($x == 0));" || - +                 RENAME descrip.mms-new descrip.mms ) +        @ IF F$SEARCH("descrip.mms-new") .NES. "" THEN DELETE descrip.mms-new;* +        -@ SPAWN/OUTPUT=NLA0: PURGE/NOLOG descrip.mms +	@ ! {- output_on() if $disabled{makedepend}; "" -} + +# Install helper targets ############################################# + +install_sw : all install_shared _install_dev_ns - +             install_engines _install_runtime_ns - +             install_startup install_ivp + +uninstall_sw : uninstall_shared _uninstall_dev_ns - +               uninstall_engines _uninstall_runtime_ns - +               uninstall_startup uninstall_ivp + +install_docs : install_html_docs + +uninstall_docs : uninstall_html_docs + +install_ssldirs : check_INSTALLTOP +        - CREATE/DIR/PROT=(S:RWED,O:RWE,G:RE,W:RE) OSSL_DATAROOT:[000000] +        IF F$SEARCH("OSSL_DATAROOT:[000000]CERTS.DIR;1") .EQS. "" THEN - +                CREATE/DIR/PROT=(S:RWED,O:RWE,G:RE,W:RE) OSSL_DATAROOT:[CERTS] +        IF F$SEARCH("OSSL_DATAROOT:[000000]PRIVATE.DIR;1") .EQS. "" THEN - +                CREATE/DIR/PROT=(S:RWED,O:RWE,G,W) OSSL_DATAROOT:[PRIVATE] +        IF F$SEARCH("OSSL_DATAROOT:[000000]MISC.DIR;1") .EQS. "" THEN - +                CREATE/DIR/PROT=(S:RWED,O:RWE,G,W) OSSL_DATAROOT:[MISC] +        COPY/PROT=W:RE $(MISC_SCRIPTS) OSSL_DATAROOT:[MISC] +        @ ! Install configuration file +        COPY/PROT=W:R {- sourcefile("apps", "openssl-vms.cnf") -} - +                ossl_dataroot:[000000]openssl.cnf-dist +        IF F$SEARCH("OSSL_DATAROOT:[000000]openssl.cnf") .EQS. "" THEN - +                COPY/PROT=W:R {- sourcefile("apps", "openssl-vms.cnf") -} - +                        ossl_dataroot:[000000]openssl.cnf + +install_shared : check_INSTALLTOP +        @ {- output_off() if $disabled{shared}; "" -} ! +        @ WRITE SYS$OUTPUT "*** Installing shareable images" +        @ ! Install shared (runtime) libraries +        - CREATE/DIR ossl_installroot:[LIB.'arch'] +        {- join("\n        ", +                map { "COPY/PROT=W:R $_.EXE ossl_installroot:[LIB.'arch']" } +                @install_shlibs) -} +        @ {- output_on() if $disabled{shared}; "" -} ! + +_install_dev_ns : check_INSTALLTOP +        @ WRITE SYS$OUTPUT "*** Installing development files" +        @ ! Install header files +        - CREATE/DIR ossl_installroot:[include.openssl] +        COPY/PROT=W:R openssl:*.h ossl_installroot:[include.openssl] +        @ ! Install static (development) libraries +        - CREATE/DIR ossl_installroot:[LIB.'arch'] +        {- join("\n        ", +                map { "COPY/PROT=W:R $_.OLB ossl_installroot:[LIB.'arch']" } +                @{$unified_info{install}->{libraries}}) -} + +install_dev : install_shared _install_dev_ns + +_install_runtime_ns : check_INSTALLTOP +        @ ! Install the main program +        - CREATE/DIR ossl_installroot:[EXE.'arch'] +        COPY/PROT=W:RE [.APPS]openssl.EXE - +                ossl_installroot:[EXE.'arch']openssl{- $osslver -}.EXE +        @ ! Install scripts +        COPY/PROT=W:RE $(BIN_SCRIPTS) ossl_installroot:[EXE] +        @ ! {- output_on() if $disabled{apps}; "" -} + +install_runtime : install_shared _install_runtime_ns + +install_engines : check_INSTALLTOP +        @ {- output_off() unless scalar @{$unified_info{engines}}; "" -} ! +        @ WRITE SYS$OUTPUT "*** Installing engines" +        - CREATE/DIR ossl_installroot:[ENGINES{- $sover.$target{pointer_size} -}.'arch'] +        {- join("\n        ", +                map { "COPY/PROT=W:RE $_.EXE ossl_installroot:[ENGINES$sover$target{pointer_size}.'arch']" } +                @{$unified_info{install}->{engines}}) -} +        @ {- output_on() unless scalar @{$unified_info{engines}}; "" -} ! + +install_startup : [.VMS]openssl_startup.com [.VMS]openssl_shutdown.com - +                 [.VMS]openssl_utils.com, check_INSTALLTOP +        - CREATE/DIR ossl_installroot:[SYS$STARTUP] +        COPY/PROT=W:RE [.VMS]openssl_startup.com - +                ossl_installroot:[SYS$STARTUP]openssl_startup{- $osslver -}.com +        COPY/PROT=W:RE [.VMS]openssl_shutdown.com - +                ossl_installroot:[SYS$STARTUP]openssl_shutdown{- $osslver -}.com +        COPY/PROT=W:RE [.VMS]openssl_utils.com - +                ossl_installroot:[SYS$STARTUP]openssl_utils{- $osslver -}.com + +install_ivp : [.VMS]openssl_ivp.com check_INSTALLTOP +        - CREATE/DIR ossl_installroot:[SYSTEST] +        COPY/PROT=W:RE [.VMS]openssl_ivp.com - +                ossl_installroot:[SYSTEST]openssl_ivp{- $osslver -}.com + +[.VMS]openssl_startup.com : vmsconfig.pm {- sourcefile("VMS", "openssl_startup.com.in") -} +        - CREATE/DIR [.VMS] +        $(PERL) "-I." "-Mvmsconfig" {- sourcefile("util", "dofile.pl") -} - +                {- sourcefile("VMS", "openssl_startup.com.in") -} - +                > [.VMS]openssl_startup.com + +[.VMS]openssl_utils.com : vmsconfig.pm {- sourcefile("VMS", "openssl_utils.com.in") -} +        - CREATE/DIR [.VMS] +        $(PERL) "-I." "-Mvmsconfig" {- sourcefile("util", "dofile.pl") -} - +                {- sourcefile("VMS", "openssl_utils.com.in") -} - +                > [.VMS]openssl_utils.com + +[.VMS]openssl_shutdown.com : vmsconfig.pm {- sourcefile("VMS", "openssl_shutdown.com.in") -} +        - CREATE/DIR [.VMS] +        $(PERL) "-I." "-Mvmsconfig" {- sourcefile("util", "dofile.pl") -} - +                {- sourcefile("VMS", "openssl_shutdown.com.in") -} - +                > [.VMS]openssl_shutdown.com + +[.VMS]openssl_ivp.com : vmsconfig.pm {- sourcefile("VMS", "openssl_ivp.com.in") -} +        - CREATE/DIR [.VMS] +        $(PERL) "-I." "-Mvmsconfig" {- sourcefile("util", "dofile.pl") -} - +                {- sourcefile("VMS", "openssl_ivp.com.in") -} - +                > [.VMS]openssl_ivp.com + +vmsconfig.pm : configdata.pm +        OPEN/WRITE/SHARE=READ CONFIG []vmsconfig.pm +        WRITE CONFIG "package vmsconfig;" +        WRITE CONFIG "use strict; use warnings;" +        WRITE CONFIG "use Exporter;" +        WRITE CONFIG "our @ISA = qw(Exporter);" +        WRITE CONFIG "our @EXPORT = qw(%config %target %withargs %unified_info %disabled);" +        WRITE CONFIG "our %config = (" +        WRITE CONFIG "  target => '","{- $config{target} -}","'," +        WRITE CONFIG "  version => '","{- $config{version} -}","'," +        WRITE CONFIG "  shlib_major => '","{- $config{shlib_major} -}","'," +        WRITE CONFIG "  shlib_minor => '","{- $config{shlib_minor} -}","'," +        WRITE CONFIG "  no_shared => '","{- $disabled{shared} -}","'," +        WRITE CONFIG "  INSTALLTOP => '$(INSTALLTOP)'," +        WRITE CONFIG "  OPENSSLDIR => '$(OPENSSLDIR)'," +        WRITE CONFIG "  pointer_size => '","{- $target{pointer_size} -}","'," +        WRITE CONFIG ");" +        WRITE CONFIG "our %target = ();" +        WRITE CONFIG "our %disabled = ();" +        WRITE CONFIG "our %withargs = ();" +        WRITE CONFIG "our %unified_info = ();" +        WRITE CONFIG "1;" +        CLOSE CONFIG + +install_html_docs : check_INSTALLTOP +        sourcedir = F$PARSE("{- $sourcedir -}A.;","[]") - "]A.;" + ".DOC]" +        $(PERL) {- sourcefile("util", "process_docs.pl") -} - +                --sourcedir='sourcedir' --destdir=ossl_installroot:[HTML] - +                --type=html + +check_INSTALLTOP : +        @ IF "$(INSTALLTOP)" .EQS. "" THEN - +                WRITE SYS$ERROR "INSTALLTOP should not be empty" +        @ IF "$(INSTALLTOP)" .EQS. "" THEN - +                EXIT %x10000002 + +# Helper targets ##################################################### + +# Developer targets ################################################## + +debug_logicals : +        SH LOGICAL/PROC openssl,internal,ossl_installroot,ossl_dataroot + +# Building targets ################################################### + +configdata.pm : $(SRCDIR)Configure $(SRCDIR)config.com {- join(" ", @{$config{build_file_templates}}, @{$config{build_infos}}, @{$config{conf_files}}) -} +        @ WRITE SYS$OUTPUT "Reconfiguring..." +        perl $(SRCDIR)Configure reconf +        @ WRITE SYS$OUTPUT "*************************************************" +        @ WRITE SYS$OUTPUT "***                                           ***" +        @ WRITE SYS$OUTPUT "***   Please run the same mms command again   ***" +        @ WRITE SYS$OUTPUT "***                                           ***" +        @ WRITE SYS$OUTPUT "*************************************************" +        @ PIPE ( EXIT %X10000000 ) + +{- +  use File::Basename; +  use File::Spec::Functions qw/abs2rel rel2abs catfile catdir/; + +  sub generatesrc { +      my %args = @_; +      my $generator = join(" ", @{$args{generator}}); +      my $generator_incs = join("", map { ' "-I'.$_.'"' } @{$args{generator_incs}}); +      my $deps = join(", -\n\t\t", @{$args{generator_deps}}, @{$args{deps}}); + +      if ($args{src} !~ /\.[sS]$/) { +          if ($args{generator}->[0] =~ m|^.*\.in$|) { +	      my $dofile = abs2rel(rel2abs(catfile($config{sourcedir}, +                                                   "util", "dofile.pl")), +                                   rel2abs($config{builddir})); +              return <<"EOF"; +$args{src} : $args{generator}->[0] $deps +	\$(PERL) "-I\$(BLDDIR)" "-Mconfigdata" $dofile \\ +	    "-o$target{build_file}" $generator > \$@ +EOF +	  } else { +              return <<"EOF"; +$args{src} : $args{generator}->[0] $deps +	\$(PERL)$generator_incs $generator > \$@ +EOF +	  } +      } else { +          die "No method to generate assembler source present.\n"; +      } +  } + +  sub src2obj { +      my %args = @_; +      my $obj = $args{obj}; +      my $deps = join(", -\n\t\t", @{$args{srcs}}, @{$args{deps}}); + +      # Because VMS C isn't very good at combining a /INCLUDE path with +      # #includes having a relative directory (like '#include "../foo.h"), +      # the best choice is to move to the first source file's intended +      # directory before compiling, and make sure to write the object file +      # in the correct position (important when the object tree is other +      # than the source tree). +      my $forward = dirname($args{srcs}->[0]); +      my $backward = abs2rel(rel2abs("."), rel2abs($forward)); +      my $objd = abs2rel(rel2abs(dirname($obj)), rel2abs($forward)); +      my $objn = basename($obj); +      my $srcs = +          join(", ", +               map { abs2rel(rel2abs($_), rel2abs($forward)) } @{$args{srcs}}); +      my $ecflags = { lib => '$(LIB_CFLAGS)', +                      dso => '$(DSO_CFLAGS)', +                      bin => '$(BIN_CFLAGS)' } -> {$args{intent}}; +      my $incs_on = "\@ !"; +      my $incs_off = "\@ !"; +      my $incs = ""; +      my @incs = (); +      push @incs, @{$args{incs}} if @{$args{incs}}; +      unless ($disabled{zlib}) { +          # GNV$ZLIB_INCLUDE is the standard logical name for later zlib +          # incarnations. +          push @incs, ($withargs{zlib_include} || 'GNV$ZLIB_INCLUDE:'); +      } +      if (@incs) { +          $incs_on = +              "DEFINE tmp_includes " +              .join(",-\n\t\t\t", map { +                                      file_name_is_absolute($_) +                                      ? $_ : catdir($backward,$_) +                                  } @incs); +          $incs_off = "DEASSIGN tmp_includes"; +          $incs = " /INCLUDE=(tmp_includes:)"; +      } +      my $before = $unified_info{before}->{$obj.".OBJ"} || "\@ !"; +      my $after = $unified_info{after}->{$obj.".OBJ"} || "\@ !"; +      my $depbuild = $disabled{makedepend} ? "" +          : " /MMS=(FILE=${objd}${objn}.tmp-D,TARGET=$obj.OBJ)"; + +      return <<"EOF"; +$obj.OBJ : $deps +        ${before} +        SET DEFAULT $forward +        $incs_on +        \$(CC) \$(CFLAGS)${ecflags}${incs}${depbuild} /OBJECT=${objd}${objn}.OBJ /REPOSITORY=$backward $srcs +        $incs_off +        SET DEFAULT $backward +        ${after} +        \@ PIPE ( \$(PERL) -e "use File::Compare qw/compare_text/; my \$x = compare_text(""$obj.D"",""$obj.tmp-D""); exit(0x10000000 + (\$x == 0));" || - +                 RENAME $obj.tmp-D $obj.d ) +        \@ IF F\$SEARCH("$obj.tmp-D") .NES. "" THEN DELETE $obj.tmp-D;* +        - PURGE $obj.OBJ +EOF +  } +  sub libobj2shlib { +      my %args = @_; +      my $lib = $args{lib}; +      my $shlib = $args{shlib}; +      my $libd = dirname($lib); +      my $libn = basename($lib); +      (my $mkdef_key = $libn) =~ s/^${osslprefix_q}lib([^0-9]*)\d*/$1/i; +      my @deps = map { +          $disabled{shared} ? $_.".OLB" +              : $unified_info{sharednames}->{$_}.".EXE"; } @{$args{deps}}; +      my $deps = join(", -\n\t\t", @deps); +      my $shlib_target = $disabled{shared} ? "" : $target{shared_target}; +      my $ordinalsfile = defined($args{ordinals}) ? $args{ordinals}->[1] : ""; +      my $engine_opt = abs2rel(rel2abs(catfile($config{sourcedir}, +                                               "VMS", "engine.opt")), +                               rel2abs($config{builddir})); +      my $mkdef_pl = abs2rel(rel2abs(catfile($config{sourcedir}, +                                             "util", "mkdef.pl")), +                             rel2abs($config{builddir})); +      my $translatesyms_pl = abs2rel(rel2abs(catfile($config{sourcedir}, +                                                     "VMS", "translatesyms.pl")), +                                     rel2abs($config{builddir})); +      # The "[]" hack is because in .OPT files, each line inherits the +      # previous line's file spec as default, so if no directory spec +      # is present in the current line and the previous line has one that +      # doesn't apply, you're in for a surprise. +      my $write_opt = +          join("\n\t", map { my $x = $_ =~ /\[/ ? $_ : "[]".$_; +                             $x =~ s|(\.EXE)|$1/SHARE|; +                             $x =~ s|(\.OLB)|$1/LIB|; +                             "WRITE OPT_FILE \"$x\"" } @deps) +          || "\@ !"; +      return <<"EOF"; +$shlib.EXE : $lib.OLB $deps $ordinalsfile +        \$(PERL) $mkdef_pl "$mkdef_key" "VMS" > $shlib.SYMVEC-tmp +        \$(PERL) $translatesyms_pl \$(BLDDIR)CXX\$DEMANGLER_DB. < $shlib.SYMVEC-tmp > $shlib.SYMVEC +        DELETE $shlib.SYMVEC-tmp;* +        OPEN/WRITE/SHARE=READ OPT_FILE $shlib.OPT +        WRITE OPT_FILE "IDENTIFICATION=""V$config{version}""" +        TYPE $shlib.SYMVEC /OUTPUT=OPT_FILE: +        WRITE OPT_FILE "$lib.OLB/LIBRARY" +        $write_opt +        CLOSE OPT_FILE +        LINK /MAP=$shlib.MAP /FULL/SHARE=$shlib.EXE $shlib.OPT/OPT \$(EX_LIBS) +        DELETE $shlib.SYMVEC;* +        PURGE $shlib.EXE,$shlib.OPT,$shlib.MAP +EOF +  } +  sub obj2dso { +      my %args = @_; +      my $lib = $args{lib}; +      my $libd = dirname($lib); +      my $libn = basename($lib); +      (my $libn_nolib = $libn) =~ s/^lib//; +      my @objs = map { "$_.OBJ" } @{$args{objs}}; +      my @deps = map { +          $disabled{shared} ? $_.".OLB" +              : $unified_info{sharednames}->{$_}.".EXE"; } @{$args{deps}}; +      my $deps = join(", -\n\t\t", @objs, @deps); +      my $shlib_target = $disabled{shared} ? "" : $target{shared_target}; +      my $engine_opt = abs2rel(rel2abs(catfile($config{sourcedir}, +                                               "VMS", "engine.opt")), +                               rel2abs($config{builddir})); +      # The "[]" hack is because in .OPT files, each line inherits the +      # previous line's file spec as default, so if no directory spec +      # is present in the current line and the previous line has one that +      # doesn't apply, you're in for a surprise. +      my $write_opt1 = +          join(",-\"\n\t", map { my $x = $_ =~ /\[/ ? $_ : "[]".$_; +                                 "WRITE OPT_FILE \"$x" } @objs). +          "\""; +      my $write_opt2 = +          join("\n\t", map { my $x = $_ =~ /\[/ ? $_ : "[]".$_; +                             $x =~ s|(\.EXE)|$1/SHARE|; +                             $x =~ s|(\.OLB)|$1/LIB|; +                             "WRITE OPT_FILE \"$x\"" } @deps) +          || "\@ !"; +      return <<"EOF"; +$lib.EXE : $deps +        OPEN/WRITE/SHARE=READ OPT_FILE $lib.OPT +        TYPE $engine_opt /OUTPUT=OPT_FILE: +        $write_opt1 +        $write_opt2 +        CLOSE OPT_FILE +        LINK /MAP=$lib.MAP /FULL/SHARE=$lib.EXE $lib.OPT/OPT \$(EX_LIBS) +        - PURGE $lib.EXE,$lib.OPT,$lib.MAP +EOF +  } +  sub obj2lib { +      my %args = @_; +      my $lib = $args{lib}; +      my $objs = join(", -\n\t\t", map { $_.".OBJ" } (@{$args{objs}})); +      my $fill_lib = join("\n\t", (map { "LIBRARY/REPLACE $lib.OLB $_.OBJ" } +                                    @{$args{objs}})); +      return <<"EOF"; +$lib.OLB : $objs +        LIBRARY/CREATE/OBJECT $lib.OLB +        $fill_lib +        - PURGE $lib.OLB +EOF +  } +  sub obj2bin { +      my %args = @_; +      my $bin = $args{bin}; +      my $bind = dirname($bin); +      my $binn = basename($bin); +      my @objs = map { "$_.OBJ" } @{$args{objs}}; +      my @deps = map { +          $disabled{shared} ? $_.".OLB" +              : $unified_info{sharednames}->{$_}.".EXE"; } @{$args{deps}}; +      my $deps = join(", -\n\t\t", @objs, @deps); +      # The "[]" hack is because in .OPT files, each line inherits the +      # previous line's file spec as default, so if no directory spec +      # is present in the current line and the previous line has one that +      # doesn't apply, you're in for a surprise. +      my $write_opt1 = +          join(",-\"\n\t", map { my $x = $_ =~ /\[/ ? $_ : "[]".$_; +                                 "WRITE OPT_FILE \"$x" } @objs). +          "\""; +      my $write_opt2 = +          join("\n\t", map { my $x = $_ =~ /\[/ ? $_ : "[]".$_; +                             $x =~ s|(\.EXE)|$1/SHARE|; +                             $x =~ s|(\.OLB)|$1/LIB|; +                             "WRITE OPT_FILE \"$x\"" } @deps) +          || "\@ !"; +      return <<"EOF"; +$bin.EXE : $deps +        OPEN/WRITE/SHARE=READ OPT_FILE $bin.OPT +        $write_opt1 +        $write_opt2 +        CLOSE OPT_FILE +        LINK/EXEC=$bin.EXE \$(LDFLAGS) $bin.OPT/OPT \$(EX_LIBS) +        - PURGE $bin.EXE,$bin.OPT +EOF +  } +  sub in2script { +      my %args = @_; +      my $script = $args{script}; +      return "" if grep { $_ eq $script } @{$args{sources}}; # No overwrite! +      my $sources = join(" ", @{$args{sources}}); +      my $dofile = abs2rel(rel2abs(catfile($config{sourcedir}, +                                           "util", "dofile.pl")), +                           rel2abs($config{builddir})); +      return <<"EOF"; +$script : $sources +        \$(PERL) "-I\$(BLDDIR)" "-Mconfigdata" $dofile - +	    "-o$target{build_file}" $sources > $script +        SET FILE/PROT=(S:RWED,O:RWED,G:RE,W:RE) $script +        PURGE $script +EOF +  } +  ""    # Important!  This becomes part of the template result. +-} diff --git a/openssl-1.1.0h/Configurations/unix-Makefile.tmpl b/openssl-1.1.0h/Configurations/unix-Makefile.tmpl new file mode 100644 index 0000000..40cf2c3 --- /dev/null +++ b/openssl-1.1.0h/Configurations/unix-Makefile.tmpl @@ -0,0 +1,1044 @@ +## +## Makefile for OpenSSL +## +## {- join("\n## ", @autowarntext) -} +{- +     our $objext = $target{obj_extension} || ".o"; +     our $depext = $target{dep_extension} || ".d"; +     our $exeext = $target{exe_extension} || ""; +     our $libext = $target{lib_extension} || ".a"; +     our $shlibext = $target{shared_extension} || ".so"; +     our $shlibvariant = $target{shlib_variant} || ""; +     our $shlibextsimple = $target{shared_extension_simple} || ".so"; +     our $shlibextimport = $target{shared_import_extension} || ""; +     our $dsoext = $target{dso_extension} || ".so"; + +     sub windowsdll { $config{target} =~ /^(?:Cygwin|mingw)/ } + +     our $sover = $config{target} =~ /^mingw/ +         ? $config{shlib_major}."_".$config{shlib_minor} +         : $config{shlib_major}.".".$config{shlib_minor}; + +     # shlib and shlib_simple both take a static library name and figure +     # out what the shlib name should be. +     # +     # When OpenSSL is configured "no-shared", these functions will just +     # return empty lists, making them suitable to join(). +     # +     # With Windows DLL producers, shlib($libname) will return the shared +     # library name (which usually is different from the static library +     # name) with the default shared extension appended to it, while +     # shlib_simple($libname) will return the static library name with +     # the shared extension followed by ".a" appended to it.  The former +     # result is used as the runtime shared library while the latter is +     # used as the DLL import library. +     # +     # On all Unix systems, shlib($libname) will return the library name +     # with the default shared extension, while shlib_simple($libname) +     # will return the name from shlib($libname) with any SO version number +     # removed.  On some systems, they may therefore return the exact same +     # string. +     sub shlib { +         return () if $disabled{shared}; +         my $lib = shift; +         return $unified_info{sharednames}->{$lib}. $shlibvariant. $shlibext; +     } +     sub shlib_simple { +         return () if $disabled{shared}; + +         my $lib = shift; +         if (windowsdll()) { +             return $lib . $shlibextimport; +         } +         return $lib .  $shlibextsimple; +     } + +     # dso is a complement to shlib / shlib_simple that returns the +     # given libname with the simple shared extension (possible SO version +     # removed).  This differs from shlib_simple() by being unconditional. +     sub dso { +         my $engine = shift; + +         return $engine . $dsoext; +     } +     # This makes sure things get built in the order they need +     # to. You're welcome. +     sub dependmagic { +         my $target = shift; + +         return "$target: build_generated\n\t\$(MAKE) depend && \$(MAKE) _$target\n_$target"; +     } +     ''; +-} +PLATFORM={- $config{target} -} +OPTIONS={- $config{options} -} +CONFIGURE_ARGS=({- join(", ",quotify_l(@{$config{perlargv}})) -}) +SRCDIR={- $config{sourcedir} -} +BLDDIR={- $config{builddir} -} + +VERSION={- $config{version} -} +MAJOR={- $config{major} -} +MINOR={- $config{minor} -} +SHLIB_VERSION_NUMBER={- $config{shlib_version_number} -} +SHLIB_VERSION_HISTORY={- $config{shlib_version_history} -} +SHLIB_MAJOR={- $config{shlib_major} -} +SHLIB_MINOR={- $config{shlib_minor} -} +SHLIB_TARGET={- $target{shared_target} -} + +LIBS={- join(" ", map { $_.$libext } @{$unified_info{libraries}}) -} +SHLIBS={- join(" ", map { shlib($_) } @{$unified_info{libraries}}) -} +SHLIB_INFO={- join(" ", map { "\"".shlib($_).";".shlib_simple($_)."\"" } @{$unified_info{libraries}}) -} +ENGINES={- join(" ", map { dso($_) } @{$unified_info{engines}}) -} +PROGRAMS={- join(" ", map { $_.$exeext } @{$unified_info{programs}}) -} +SCRIPTS={- join(" ", @{$unified_info{scripts}}) -} +{- output_off() if $disabled{makedepend}; "" -} +DEPS={- join(" ", map { (my $x = $_) =~ s|\.o$|$depext|; $x; } +                  grep { $unified_info{sources}->{$_}->[0] =~ /\.c$/ } +                  keys %{$unified_info{sources}}); -} +{- output_on() if $disabled{makedepend}; "" -} +GENERATED_MANDATORY={- join(" ", @{$unified_info{depends}->{""}} ) -} +GENERATED={- join(" ", +                  ( grep { defined $unified_info{generate}->{$_} } +                    map { @{$unified_info{sources}->{$_}} } +                    grep { /\.o$/ } keys %{$unified_info{sources}} ), +                  ( grep { /\.h$/ } keys %{$unified_info{generate}} )) -} + +INSTALL_LIBS={- join(" ", map { $_.$libext } @{$unified_info{install}->{libraries}}) -} +INSTALL_SHLIBS={- join(" ", map { shlib($_) } @{$unified_info{install}->{libraries}}) -} +INSTALL_SHLIB_INFO={- join(" ", map { "\"".shlib($_).";".shlib_simple($_)."\"" } @{$unified_info{install}->{libraries}}) -} +INSTALL_ENGINES={- join(" ", map { dso($_) } @{$unified_info{install}->{engines}}) -} +INSTALL_PROGRAMS={- join(" ", map { $_.$exeext } @{$unified_info{install}->{programs}}) -} +{- output_off() if $disabled{apps}; "" -} +BIN_SCRIPTS=$(BLDDIR)/tools/c_rehash +MISC_SCRIPTS=$(BLDDIR)/apps/CA.pl $(BLDDIR)/apps/tsget +{- output_on() if $disabled{apps}; "" -} + +APPS_OPENSSL={- use File::Spec::Functions; +                catfile("apps","openssl") -} + +# DESTDIR is for package builders so that they can configure for, say, +# /usr/ and yet have everything installed to /tmp/somedir/usr/. +# Normally it is left empty. +DESTDIR= + +# Do not edit these manually. Use Configure with --prefix or --openssldir +# to change this!  Short explanation in the top comment in Configure +INSTALLTOP={- # $prefix is used in the OPENSSLDIR perl snippet +	      # +	      our $prefix = $config{prefix} || "/usr/local"; +              $prefix -} +OPENSSLDIR={- # +	      # The logic here is that if no --openssldir was given, +	      # OPENSSLDIR will get the value from $prefix plus "/ssl". +	      # If --openssldir was given and the value is an absolute +	      # path, OPENSSLDIR will get its value without change. +	      # If the value from --openssldir is a relative path, +	      # OPENSSLDIR will get $prefix with the --openssldir +	      # value appended as a subdirectory. +	      # +              use File::Spec::Functions; +              our $openssldir = +                  $config{openssldir} ? +                      (file_name_is_absolute($config{openssldir}) ? +                           $config{openssldir} +                           : catdir($prefix, $config{openssldir})) +                      : catdir($prefix, "ssl"); +              $openssldir -} +LIBDIR={- # +          # if $prefix/lib$target{multilib} is not an existing +          # directory, then assume that it's not searched by linker +          # automatically, in which case adding $target{multilib} suffix +          # causes more grief than we're ready to tolerate, so don't... +          our $multilib = +              -d "$prefix/lib$target{multilib}" ? $target{multilib} : ""; +          our $libdir = $config{libdir} || "lib$multilib"; +          $libdir -} +ENGINESDIR={- use File::Spec::Functions; +              catdir($prefix,$libdir,"engines-$sover") -} + +# Convenience variable for those who want to set the rpath in shared +# libraries and applications +LIBRPATH=$(INSTALLTOP)/$(LIBDIR) + +MANDIR=$(INSTALLTOP)/share/man +DOCDIR=$(INSTALLTOP)/share/doc/$(BASENAME) +HTMLDIR=$(DOCDIR)/html + +# MANSUFFIX is for the benefit of anyone who may want to have a suffix +# appended after the manpage file section number.  "ssl" is popular, +# resulting in files such as config.5ssl rather than config.5. +MANSUFFIX= +HTMLSUFFIX=html + + + +CROSS_COMPILE= {- $config{cross_compile_prefix} -} +CC= $(CROSS_COMPILE){- $target{cc} -} +CFLAGS={- our $cflags2 = join(" ",(map { "-D".$_} @{$target{defines}}, @{$config{defines}}),"-DOPENSSLDIR=\"\\\"\$(OPENSSLDIR)\\\"\"","-DENGINESDIR=\"\\\"\$(ENGINESDIR)\\\"\"") -} {- $target{cflags} -} {- $config{cflags} -} +CFLAGS_Q={- $cflags2 =~ s|([\\"])|\\$1|g; $cflags2 -} {- $config{cflags} -} +LDFLAGS= {- $target{lflags} -} +PLIB_LDFLAGS= {- $target{plib_lflags} -} +EX_LIBS= {- $target{ex_libs} -} {- $config{ex_libs} -} +LIB_CFLAGS={- $target{shared_cflag} || "" -} +LIB_LDFLAGS={- $target{shared_ldflag}." ".$config{shared_ldflag} -} +DSO_CFLAGS={- $target{shared_cflag} || "" -} +DSO_LDFLAGS=$(LIB_LDFLAGS) +BIN_CFLAGS={- $target{bin_cflags} -} + +PERL={- $config{perl} -} + +ARFLAGS= {- $target{arflags} -} +AR=$(CROSS_COMPILE){- $target{ar} || "ar" -} $(ARFLAGS) r +RANLIB= {- $target{ranlib} -} +NM= $(CROSS_COMPILE){- $target{nm} || "nm" -} +RCFLAGS={- $target{shared_rcflag} -} +RC= $(CROSS_COMPILE){- $target{rc} || "windres" -} +RM= rm -f +RMDIR= rmdir +TAR= {- $target{tar} || "tar" -} +TARFLAGS= {- $target{tarflags} -} +MAKEDEPEND={- $config{makedepprog} -} + +BASENAME=       openssl +NAME=           $(BASENAME)-$(VERSION) +TARFILE=        ../$(NAME).tar + +# We let the C compiler driver to take care of .s files. This is done in +# order to be excused from maintaining a separate set of architecture +# dependent assembler flags. E.g. if you throw -mcpu=ultrasparc at SPARC +# gcc, then the driver will automatically translate it to -xarch=v8plus +# and pass it down to assembler.  In any case, we do not define AS or +# ASFLAGS for this reason. +PERLASM_SCHEME= {- $target{perlasm_scheme} -} + +# For x86 assembler: Set PROCESSOR to 386 if you want to support +# the 80386. +PROCESSOR= {- $config{processor} -} + +# We want error [and other] messages in English. Trouble is that make(1) +# doesn't pass macros down as environment variables unless there already +# was corresponding variable originally set. In other words we can only +# reassign environment variables, but not set new ones, not in portable +# manner that is. That's why we reassign several, just to be sure... +LC_ALL=C +LC_MESSAGES=C +LANG=C + +# The main targets ################################################### + +{- dependmagic('all'); -}: build_libs_nodep build_engines_nodep build_programs_nodep link-utils +{- dependmagic('build_libs'); -}: build_libs_nodep +{- dependmagic('build_engines'); -}: build_engines_nodep +{- dependmagic('build_programs'); -}: build_programs_nodep + +build_generated: $(GENERATED_MANDATORY) +build_libs_nodep: libcrypto.pc libssl.pc openssl.pc +build_engines_nodep: $(ENGINES) +build_programs_nodep: $(PROGRAMS) $(SCRIPTS) + +# Kept around for backward compatibility +build_apps build_tests: build_programs + +# Convenience target to prebuild all generated files, not just the mandatory +# ones +build_all_generated: $(GENERATED_MANDATORY) $(GENERATED) + +test: tests +{- dependmagic('tests'); -}: build_programs_nodep build_engines_nodep link-utils +	@ : {- output_off() if $disabled{tests}; "" -} +	( cd test; \ +	  mkdir -p test-runs; \ +	  SRCTOP=../$(SRCDIR) \ +	  BLDTOP=../$(BLDDIR) \ +	  RESULT_D=test-runs \ +	  PERL="$(PERL)" \ +	  EXE_EXT={- $exeext -} \ +	  OPENSSL_ENGINES=`cd ../$(BLDDIR)/engines; pwd` \ +	  OPENSSL_DEBUG_MEMORY=on \ +	    $(PERL) ../$(SRCDIR)/test/run_tests.pl $(TESTS) ) +	@ : {- if ($disabled{tests}) { output_on(); } else { output_off(); } "" -} +	@echo "Tests are not supported with your chosen Configure options" +	@ : {- output_on() if !$disabled{tests}; "" -} + +list-tests: +	@ : {- output_off() if $disabled{tests}; "" -} +	@SRCTOP="$(SRCDIR)" \ +	 $(PERL) $(SRCDIR)/test/run_tests.pl list +	@ : {- if ($disabled{tests}) { output_on(); } else { output_off(); } "" -} +	@echo "Tests are not supported with your chosen Configure options" +	@ : {- output_on() if !$disabled{tests}; "" -} + +install: install_sw install_ssldirs install_docs + +uninstall: uninstall_docs uninstall_sw + +libclean: +	@set -e; for s in $(SHLIB_INFO); do \ +		s1=`echo "$$s" | cut -f1 -d";"`; \ +		s2=`echo "$$s" | cut -f2 -d";"`; \ +		echo $(RM) $$s1; \ +		$(RM) $$s1; \ +		if [ "$$s1" != "$$s2" ]; then \ +			echo $(RM) $$s2; \ +			$(RM) $$s2; \ +		fi; \ +	done +	$(RM) $(LIBS) +	$(RM) *.map + +clean: libclean +	$(RM) $(PROGRAMS) $(TESTPROGS) $(ENGINES) $(SCRIPTS) +	$(RM) $(GENERATED) +	-$(RM) `find . -name '*{- $depext -}' -a \! -path "./.git/*"` +	-$(RM) `find . -name '*{- $objext -}' -a \! -path "./.git/*"` +	$(RM) core +	$(RM) tags TAGS doc-nits +	$(RM) -r test/test-runs +	$(RM) openssl.pc libcrypto.pc libssl.pc +	-$(RM) `find . -type l -a \! -path "./.git/*"` +	$(RM) $(TARFILE) + +distclean: clean +	$(RM) configdata.pm +	$(RM) Makefile + +# We check if any depfile is newer than Makefile and decide to +# concatenate only if that is true. +depend: +	@: {- output_off() if $disabled{makedepend}; "" -} +	@if egrep "^# DO NOT DELETE THIS LINE" Makefile >/dev/null && [ -z "`find $(DEPS) -newer Makefile 2>/dev/null; exit 0`" ]; then :; else \ +	  ( $(PERL) -pe 'exit 0 if /^# DO NOT DELETE THIS LINE.*/' < Makefile; \ +	    echo '# DO NOT DELETE THIS LINE -- make depend depends on it.'; \ +	    echo; \ +	    for f in $(DEPS); do \ +	      if [ -f $$f ]; then cat $$f; fi; \ +	    done ) > Makefile.new; \ +	  if cmp Makefile.new Makefile >/dev/null 2>&1; then \ +	    rm -f Makefile.new; \ +	  else \ +	    mv -f Makefile.new Makefile; \ +	  fi; \ +	fi +	@: {- output_on() if $disabled{makedepend}; "" -} + +# Install helper targets ############################################# + +install_sw: all install_dev install_engines install_runtime + +uninstall_sw: uninstall_runtime uninstall_engines uninstall_dev + +install_docs: install_man_docs install_html_docs + +uninstall_docs: uninstall_man_docs uninstall_html_docs +	$(RM) -r -v $(DESTDIR)$(DOCDIR) + +install_ssldirs: +	@$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(OPENSSLDIR)/certs +	@$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(OPENSSLDIR)/private +	@$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(OPENSSLDIR)/misc +	@set -e; for x in dummy $(MISC_SCRIPTS); do \ +		if [ "$$x" = "dummy" ]; then continue; fi; \ +		fn=`basename $$x`; \ +		echo "install $$x -> $(DESTDIR)$(OPENSSLDIR)/misc/$$fn"; \ +		cp $$x $(DESTDIR)$(OPENSSLDIR)/misc/$$fn.new; \ +		chmod 755 $(DESTDIR)$(OPENSSLDIR)/misc/$$fn.new; \ +		mv -f $(DESTDIR)$(OPENSSLDIR)/misc/$$fn.new \ +		      $(DESTDIR)$(OPENSSLDIR)/misc/$$fn; \ +	done +	@echo "install $(SRCDIR)/apps/openssl.cnf -> $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.dist" +	@cp $(SRCDIR)/apps/openssl.cnf $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.new +	@chmod 644 $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.new +	@mv -f  $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.new $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.dist +	@if ! [ -f "$(DESTDIR)$(OPENSSLDIR)/openssl.cnf" ]; then \ +		echo "install $(SRCDIR)/apps/openssl.cnf -> $(DESTDIR)$(OPENSSLDIR)/openssl.cnf"; \ +		cp $(SRCDIR)/apps/openssl.cnf $(DESTDIR)$(OPENSSLDIR)/openssl.cnf; \ +		chmod 644 $(DESTDIR)$(OPENSSLDIR)/openssl.cnf; \ +	fi + +install_dev: +	@[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1) +	@echo "*** Installing development files" +	@$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(INSTALLTOP)/include/openssl +	@ : {- output_off() unless grep { $_ eq "OPENSSL_USE_APPLINK" } @{$target{defines}}; "" -} +	@echo "install $(SRCDIR)/ms/applink.c -> $(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c" +	@cp $(SRCDIR)/ms/applink.c $(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c +	@chmod 644 $(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c +	@ : {- output_on() unless grep { $_ eq "OPENSSL_USE_APPLINK" } @{$target{defines}}; "" -} +	@set -e; for i in $(SRCDIR)/include/openssl/*.h \ +			  $(BLDDIR)/include/openssl/*.h; do \ +		fn=`basename $$i`; \ +		echo "install $$i -> $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn"; \ +		cp $$i $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn; \ +		chmod 644 $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn; \ +	done +	@$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(INSTALLTOP)/$(LIBDIR) +	@set -e; for l in $(INSTALL_LIBS); do \ +		fn=`basename $$l`; \ +		echo "install $$l -> $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn"; \ +		cp $$l $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn.new; \ +		$(RANLIB) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn.new; \ +		chmod 644 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn.new; \ +		mv -f $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn.new \ +		      $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn; \ +	done +	@ : {- output_off() if $disabled{shared}; "" -} +	@set -e; for s in $(INSTALL_SHLIB_INFO); do \ +		s1=`echo "$$s" | cut -f1 -d";"`; \ +		s2=`echo "$$s" | cut -f2 -d";"`; \ +		fn1=`basename $$s1`; \ +		fn2=`basename $$s2`; \ +		: {- output_off() if windowsdll(); "" -}; \ +		echo "install $$s1 -> $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn1"; \ +		cp $$s1 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn1.new; \ +		chmod 755 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn1.new; \ +		mv -f $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn1.new \ +		      $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn1; \ +		if [ "$$fn1" != "$$fn2" ]; then \ +			echo "link $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2 -> $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn1"; \ +			ln -sf $$fn1 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2; \ +		fi; \ +		: {- output_on() if windowsdll(); "" -}{- output_off() unless windowsdll(); "" -}; \ +		echo "install $$s2 -> $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2"; \ +		cp $$s2 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2.new; \ +		chmod 755 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2.new; \ +		mv -f $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2.new \ +		      $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2; \ +		: {- output_on() unless windowsdll(); "" -}; \ +	done +	@ : {- output_on() if $disabled{shared}; "" -} +	@$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig +	@echo "install libcrypto.pc -> $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libcrypto.pc" +	@cp libcrypto.pc $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig +	@chmod 644 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libcrypto.pc +	@echo "install libssl.pc -> $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libssl.pc" +	@cp libssl.pc $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig +	@chmod 644 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libssl.pc +	@echo "install openssl.pc -> $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/openssl.pc" +	@cp openssl.pc $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig +	@chmod 644 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/openssl.pc + +uninstall_dev: +	@echo "*** Uninstalling development files" +	@ : {- output_off() unless grep { $_ eq "OPENSSL_USE_APPLINK" } @{$target{defines}}; "" -} +	@echo "$(RM) $(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c" +	@$(RM) $(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c +	@ : {- output_on() unless grep { $_ eq "OPENSSL_USE_APPLINK" } @{$target{defines}}; "" -} +	@set -e; for i in $(SRCDIR)/include/openssl/*.h \ +			  $(BLDDIR)/include/openssl/*.h; do \ +		fn=`basename $$i`; \ +		echo "$(RM) $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn"; \ +		$(RM) $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn; \ +	done +	-$(RMDIR) $(DESTDIR)$(INSTALLTOP)/include/openssl +	-$(RMDIR) $(DESTDIR)$(INSTALLTOP)/include +	@set -e; for l in $(INSTALL_LIBS); do \ +		fn=`basename $$l`; \ +		echo "$(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn"; \ +		$(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn; \ +	done +	@ : {- output_off() if $disabled{shared}; "" -} +	@set -e; for s in $(INSTALL_SHLIB_INFO); do \ +		s1=`echo "$$s" | cut -f1 -d";"`; \ +		s2=`echo "$$s" | cut -f2 -d";"`; \ +		fn1=`basename $$s1`; \ +		fn2=`basename $$s2`; \ +		: {- output_off() if windowsdll(); "" -}; \ +		echo "$(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn1"; \ +		$(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn1; \ +		if [ "$$fn1" != "$$fn2" ]; then \ +			echo "$(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2"; \ +			$(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2; \ +		fi; \ +		: {- output_on() if windowsdll(); "" -}{- output_off() unless windowsdll(); "" -}; \ +		echo "$(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2"; \ +		$(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2; \ +		: {- output_on() unless windowsdll(); "" -}; \ +	done +	@ : {- output_on() if $disabled{shared}; "" -} +	$(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libcrypto.pc +	$(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libssl.pc +	$(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/openssl.pc +	-$(RMDIR) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig +	-$(RMDIR) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR) + +install_engines: +	@[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1) +	@$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(ENGINESDIR)/ +	@echo "*** Installing engines" +	@set -e; for e in dummy $(INSTALL_ENGINES); do \ +		if [ "$$e" = "dummy" ]; then continue; fi; \ +		fn=`basename $$e`; \ +		echo "install $$e -> $(DESTDIR)$(ENGINESDIR)/$$fn"; \ +		cp $$e $(DESTDIR)$(ENGINESDIR)/$$fn.new; \ +		chmod 755 $(DESTDIR)$(ENGINESDIR)/$$fn.new; \ +		mv -f $(DESTDIR)$(ENGINESDIR)/$$fn.new \ +		      $(DESTDIR)$(ENGINESDIR)/$$fn; \ +	done + +uninstall_engines: +	@echo "*** Uninstalling engines" +	@set -e; for e in dummy $(INSTALL_ENGINES); do \ +		if [ "$$e" = "dummy" ]; then continue; fi; \ +		fn=`basename $$e`; \ +		if [ "$$fn" = '{- dso("ossltest") -}' ]; then \ +			continue; \ +		fi; \ +		echo "$(RM) $(DESTDIR)$(ENGINESDIR)/$$fn"; \ +		$(RM) $(DESTDIR)$(ENGINESDIR)/$$fn; \ +	done +	-$(RMDIR) $(DESTDIR)$(ENGINESDIR) + +install_runtime: +	@[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1) +	@$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(INSTALLTOP)/bin +	@ : {- output_off() if windowsdll(); "" -} +	@$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(INSTALLTOP)/$(LIBDIR) +	@ : {- output_on() if windowsdll(); "" -} +	@echo "*** Installing runtime files" +	@set -e; for s in dummy $(INSTALL_SHLIBS); do \ +		if [ "$$s" = "dummy" ]; then continue; fi; \ +		fn=`basename $$s`; \ +		: {- output_off() unless windowsdll(); "" -}; \ +		echo "install $$s -> $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \ +		cp $$s $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \ +		chmod 644 $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \ +		mv -f $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new \ +		      $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \ +		: {- output_on() unless windowsdll(); "" -}{- output_off() if windowsdll(); "" -}; \ +		echo "install $$s -> $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn"; \ +		cp $$s $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn.new; \ +		chmod 755 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn.new; \ +		mv -f $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn.new \ +		      $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn; \ +		: {- output_on() if windowsdll(); "" -}; \ +	done +	@set -e; for x in dummy $(INSTALL_PROGRAMS); do \ +		if [ "$$x" = "dummy" ]; then continue; fi; \ +		fn=`basename $$x`; \ +		echo "install $$x -> $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \ +		cp $$x $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \ +		chmod 755 $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \ +		mv -f $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new \ +		      $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \ +	done +	@set -e; for x in dummy $(BIN_SCRIPTS); do \ +		if [ "$$x" = "dummy" ]; then continue; fi; \ +		fn=`basename $$x`; \ +		echo "install $$x -> $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \ +		cp $$x $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \ +		chmod 755 $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \ +		mv -f $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new \ +		      $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \ +	done + +uninstall_runtime: +	@echo "*** Uninstalling runtime files" +	@set -e; for x in dummy $(INSTALL_PROGRAMS); \ +	do  \ +		if [ "$$x" = "dummy" ]; then continue; fi; \ +		fn=`basename $$x`; \ +		echo "$(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \ +		$(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \ +	done; +	@set -e; for x in dummy $(BIN_SCRIPTS); \ +	do  \ +		if [ "$$x" = "dummy" ]; then continue; fi; \ +		fn=`basename $$x`; \ +		echo "$(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \ +		$(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \ +	done +	@ : {- output_off() unless windowsdll(); "" -} +	@set -e; for s in dummy $(INSTALL_SHLIBS); do \ +		if [ "$$s" = "dummy" ]; then continue; fi; \ +		fn=`basename $$s`; \ +		echo "$(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \ +		$(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \ +	done +	@ : {- output_on() unless windowsdll(); "" -} +	-$(RMDIR) $(DESTDIR)$(INSTALLTOP)/bin + + +install_man_docs: +	@[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1) +	@echo "*** Installing manpages" +	$(PERL) $(SRCDIR)/util/process_docs.pl \ +		--destdir=$(DESTDIR)$(MANDIR) --type=man --suffix=$(MANSUFFIX) + +uninstall_man_docs: +	@echo "*** Uninstalling manpages" +	$(PERL) $(SRCDIR)/util/process_docs.pl \ +		--destdir=$(DESTDIR)$(MANDIR) --type=man --suffix=$(MANSUFFIX) \ +		--remove + +install_html_docs: +	@[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1) +	@echo "*** Installing HTML manpages" +	$(PERL) $(SRCDIR)/util/process_docs.pl \ +		--destdir=$(DESTDIR)$(HTMLDIR) --type=html + +uninstall_html_docs: +	@echo "*** Uninstalling manpages" +	$(PERL) $(SRCDIR)/util/process_docs.pl \ +		--destdir=$(DESTDIR)$(HTMLDIR) --type=html --remove + + +# Developer targets (note: these are only available on Unix) ######### + +update: generate errors ordinals + +generate: generate_apps generate_crypto_bn generate_crypto_objects \ +          generate_crypto_conf generate_crypto_asn1 + +doc-nits: +	(cd $(SRCDIR); $(PERL) util/find-doc-nits -n ) >doc-nits +	if [ -s doc-nits ] ; then cat doc-nits; rm doc-nits ; exit 1; fi + +# Test coverage is a good idea for the future +#coverage: $(PROGRAMS) $(TESTPROGRAMS) +#	... + +lint: +	lint -DLINT $(INCLUDES) $(SRCS) + +generate_apps: +	( cd $(SRCDIR); $(PERL) VMS/VMSify-conf.pl \ +				< apps/openssl.cnf > apps/openssl-vms.cnf ) + +generate_crypto_bn: +	( cd $(SRCDIR); $(PERL) crypto/bn/bn_prime.pl > crypto/bn/bn_prime.h ) + +generate_crypto_objects: +	( cd $(SRCDIR); $(PERL) crypto/objects/objects.pl \ +				crypto/objects/objects.txt \ +				crypto/objects/obj_mac.num \ +				include/openssl/obj_mac.h ) +	( cd $(SRCDIR); $(PERL) crypto/objects/obj_dat.pl \ +				include/openssl/obj_mac.h \ +				crypto/objects/obj_dat.h ) +	( cd $(SRCDIR); $(PERL) crypto/objects/objxref.pl \ +				crypto/objects/obj_mac.num \ +				crypto/objects/obj_xref.txt \ +				> crypto/objects/obj_xref.h ) + +generate_crypto_conf: +	( cd $(SRCDIR); $(PERL) crypto/conf/keysets.pl \ +			        > crypto/conf/conf_def.h ) + +generate_crypto_asn1: +	( cd $(SRCDIR); $(PERL) crypto/asn1/charmap.pl \ +			        > crypto/asn1/charmap.h ) + +errors: +	( cd $(SRCDIR); $(PERL) util/ck_errf.pl -strict */*.c */*/*.c ) +	( cd $(SRCDIR); $(PERL) util/mkerr.pl -recurse -write ) +	( cd $(SRCDIR)/engines; \ +	  for e in *.ec; do \ +	      $(PERL) ../util/mkerr.pl -conf $$e \ +		      -nostatic -staticloader -write *.c; \ +	  done ) + +ordinals: +	( b=`pwd`; cd $(SRCDIR); $(PERL) -I$$b util/mkdef.pl crypto update ) +	( b=`pwd`; cd $(SRCDIR); $(PERL) -I$$b util/mkdef.pl ssl update ) + +test_ordinals: +	( cd test; \ +	  SRCTOP=../$(SRCDIR) \ +	  BLDTOP=../$(BLDDIR) \ +	    $(PERL) ../$(SRCDIR)/test/run_tests.pl test_ordinals ) + +tags TAGS: FORCE +	rm -f TAGS tags +	-ctags -R . +	-etags `find . -name '*.[ch]' -o -name '*.pm'` + +# Release targets (note: only available on Unix) ##################### + +# If your tar command doesn't support --owner and --group, make sure to +# use one that does, for example GNU tar +TAR_COMMAND=$(TAR) $(TARFLAGS) --owner 0 --group 0 -cvf - +PREPARE_CMD=: +tar: +	set -e; \ +	TMPDIR=/var/tmp/openssl-copy.$$$$; \ +	DISTDIR=$(NAME); \ +	mkdir -p $$TMPDIR/$$DISTDIR; \ +	(cd $(SRCDIR); \ +	 git ls-tree -r --name-only --full-tree HEAD \ +         | grep -v '^fuzz/corpora' \ +	 | while read F; do \ +	       mkdir -p $$TMPDIR/$$DISTDIR/`dirname $$F`; \ +	       cp $$F $$TMPDIR/$$DISTDIR/$$F; \ +	   done); \ +	(cd $$TMPDIR/$$DISTDIR; \ +	 $(PREPARE_CMD); \ +	 find . -type d -print | xargs chmod 755; \ +	 find . -type f -print | xargs chmod a+r; \ +	 find . -type f -perm -0100 -print | xargs chmod a+x); \ +	(cd $$TMPDIR; $(TAR_COMMAND) $$DISTDIR) \ +	| (cd $(SRCDIR); gzip --best > $(TARFILE).gz); \ +	rm -rf $$TMPDIR +	cd $(SRCDIR); ls -l $(TARFILE).gz + +dist: +	@$(MAKE) PREPARE_CMD='$(PERL) ./Configure dist' tar + +# Helper targets ##################################################### + +link-utils: $(BLDDIR)/util/opensslwrap.sh + +$(BLDDIR)/util/opensslwrap.sh: configdata.pm +	@if [ "$(SRCDIR)" != "$(BLDDIR)" ]; then \ +	    mkdir -p "$(BLDDIR)/util"; \ +	    ln -sf "../$(SRCDIR)/util/opensslwrap.sh" "$(BLDDIR)/util"; \ +	fi + +FORCE: + +# Building targets ################################################### + +libcrypto.pc libssl.pc openssl.pc: configdata.pm $(LIBS) {- join(" ",map { shlib_simple($_) } @{$unified_info{libraries}}) -} +libcrypto.pc: +	@ ( echo 'prefix=$(INSTALLTOP)'; \ +	    echo 'exec_prefix=$${prefix}'; \ +	    echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \ +	    echo 'includedir=$${prefix}/include'; \ +	    echo 'enginesdir=$${libdir}/engines-{- $sover -}'; \ +	    echo ''; \ +	    echo 'Name: OpenSSL-libcrypto'; \ +	    echo 'Description: OpenSSL cryptography library'; \ +	    echo 'Version: '$(VERSION); \ +	    echo 'Libs: -L$${libdir} -lcrypto'; \ +	    echo 'Libs.private: $(EX_LIBS)'; \ +	    echo 'Cflags: -I$${includedir}' ) > libcrypto.pc + +libssl.pc: +	@ ( echo 'prefix=$(INSTALLTOP)'; \ +	    echo 'exec_prefix=$${prefix}'; \ +	    echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \ +	    echo 'includedir=$${prefix}/include'; \ +	    echo ''; \ +	    echo 'Name: OpenSSL-libssl'; \ +	    echo 'Description: Secure Sockets Layer and cryptography libraries'; \ +	    echo 'Version: '$(VERSION); \ +	    echo 'Requires.private: libcrypto'; \ +	    echo 'Libs: -L$${libdir} -lssl'; \ +	    echo 'Cflags: -I$${includedir}' ) > libssl.pc + +openssl.pc: +	@ ( echo 'prefix=$(INSTALLTOP)'; \ +	    echo 'exec_prefix=$${prefix}'; \ +	    echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \ +	    echo 'includedir=$${prefix}/include'; \ +	    echo ''; \ +	    echo 'Name: OpenSSL'; \ +	    echo 'Description: Secure Sockets Layer and cryptography libraries and tools'; \ +	    echo 'Version: '$(VERSION); \ +	    echo 'Requires: libssl libcrypto' ) > openssl.pc + +configdata.pm: $(SRCDIR)/Configure $(SRCDIR)/config {- join(" ", @{$config{build_file_templates}}, @{$config{build_infos}}, @{$config{conf_files}}) -} +	@echo "Detected changed: $?" +	@echo "Reconfiguring..." +	$(PERL) $(SRCDIR)/Configure reconf +	@echo "**************************************************" +	@echo "***                                            ***" +	@echo "***   Please run the same make command again   ***" +	@echo "***                                            ***" +	@echo "**************************************************" +	@false + +{- +  use File::Basename; +  use File::Spec::Functions qw/:DEFAULT abs2rel rel2abs/; + +  # Helper function to figure out dependencies on libraries +  # It takes a list of library names and outputs a list of dependencies +  sub compute_lib_depends { +      if ($disabled{shared}) { +          return map { $_.$libext } @_; +      } + +      # Depending on shared libraries: +      # On Windows POSIX layers, we depend on {libname}.dll.a +      # On Unix platforms, we depend on {shlibname}.so +      return map { shlib_simple($_) } @_; +  } + +  sub generatesrc { +      my %args = @_; +      my $generator = join(" ", @{$args{generator}}); +      my $generator_incs = join("", map { " -I".$_ } @{$args{generator_incs}}); +      my $incs = join("", map { " -I".$_ } @{$args{incs}}); +      my $deps = join(" ", @{$args{generator_deps}}, @{$args{deps}}); + +      if ($args{src} !~ /\.[sS]$/) { +          if ($args{generator}->[0] =~ m|^.*\.in$|) { +              my $dofile = abs2rel(rel2abs(catfile($config{sourcedir}, +                                                   "util", "dofile.pl")), +                                   rel2abs($config{builddir})); +              return <<"EOF"; +$args{src}: $args{generator}->[0] $deps +	\$(PERL) "-I\$(BLDDIR)" -Mconfigdata "$dofile" \\ +	    "-o$target{build_file}" $generator > \$@ +EOF +	  } else { +              return <<"EOF"; +$args{src}: $args{generator}->[0] $deps +	\$(PERL)$generator_incs $generator > \$@ +EOF +	  } +      } else { +          if ($args{generator}->[0] =~ /\.pl$/) { +              $generator = 'CC="$(CC)" $(PERL)'.$generator_incs.' '.$generator; +          } elsif ($args{generator}->[0] =~ /\.m4$/) { +              $generator = 'm4 -B 8192'.$generator_incs.' '.$generator.' >' +          } elsif ($args{generator}->[0] =~ /\.S$/) { +              $generator = undef; +          } else { +              die "Generator type for $args{src} unknown: $generator\n"; +          } + +          if (defined($generator)) { +              return <<"EOF"; +$args{src}: $args{generator}->[0] $deps +	$generator \$@ +EOF +          } +          return <<"EOF"; +$args{src}: $args{generator}->[0] $deps +	\$(CC) $incs \$(CFLAGS) -E $args{generator}->[0] | \\ +	\$(PERL) -ne '/^#(line)?\\s*[0-9]+/ or print' > \$@ +EOF +      } +  } + +  # Should one wonder about the end of the Perl snippet, it's because this +  # second regexp eats up line endings as well, if the removed path is the +  # last in the line.  We may therefore need to put back a line ending. +  sub src2obj { +      my %args = @_; +      my $obj = $args{obj}; +      my @srcs = @{$args{srcs}}; +      my $srcs = join(" ",  @srcs); +      my $deps = join(" ", @srcs, @{$args{deps}}); +      my $incs = join("", map { " -I".$_ } @{$args{incs}}); +      unless ($disabled{zlib}) { +          if ($withargs{zlib_include}) { +              $incs .= " -I".$withargs{zlib_include}; +          } +      } +      my $ecflags = { lib => '$(LIB_CFLAGS)', +                      dso => '$(DSO_CFLAGS)', +                      bin => '$(BIN_CFLAGS)' } -> {$args{intent}}; +      my $makedepprog = $config{makedepprog}; +      my $recipe; +      # extension-specific rules +      if (grep /\.s$/, @srcs) { +          $recipe .= <<"EOF"; +$obj$objext: $deps +	\$(CC) \$(CFLAGS) $ecflags -c -o \$\@ $srcs +EOF +      } elsif (grep /\.S$/, @srcs) { +          # In case one wonders why not just $(CC) -c file.S. While it +          # does work with contemporary compilers, there are some legacy +          # ones that get it wrong. Hence the elaborate scheme... We +          # don't care to maintain dependecy lists, because dependency +          # is rather weak, at most one header file that lists constants +          # which are assigned in ascending order. +          $recipe .= <<"EOF"; +$obj$objext: $deps +	( trap "rm -f \$@.*" INT 0; \\ +	  \$(CPP) $incs \$(CFLAGS) $ecflags $srcs | \\ +	  \$(PERL) -ne '/^#(line)?\\s*[0-9]+/ or print' > \$@.s && \\ +	  \$(CC) \$(CFLAGS) $ecflags -c -o \$\@ \$@.s ) +EOF +      } elsif (!$disabled{makedepend} && $makedepprog !~ /\/makedepend/) { +          $recipe .= <<"EOF"; +$obj$objext: $deps +	\$(CC) $incs \$(CFLAGS) $ecflags -MMD -MF $obj$depext.tmp -MT \$\@ -c -o \$\@ $srcs +	\@touch $obj$depext.tmp +	\@if cmp $obj$depext.tmp $obj$depext > /dev/null 2> /dev/null; then \\ +		rm -f $obj$depext.tmp; \\ +	else \\ +		mv $obj$depext.tmp $obj$depext; \\ +	fi +EOF +      } else { +          $recipe .= <<"EOF"; +$obj$objext: $deps +	\$(CC) $incs \$(CFLAGS) $ecflags -c -o \$\@ $srcs +EOF +          if (!$disabled{makedepend} && $makedepprog =~ /\/makedepend/) { +              $recipe .= <<"EOF"; +	-\$(MAKEDEPEND) -f- -o"|\$\@" -- $incs \$(CFLAGS) $ecflags -- $srcs \\ +	    >$obj$depext.tmp 2>/dev/null +	-\$(PERL) -i -pe 's/^.*\\|//; s/ \\/(\\\\.|[^ ])*//; \$\$_ = undef if (/: *\$\$/ || /^(#.*| *)\$\$/); \$\$_.="\\n" unless !defined(\$\$_) or /\\R\$\$/g;' $obj$depext.tmp +	\@if cmp $obj$depext.tmp $obj$depext > /dev/null 2> /dev/null; then \\ +		rm -f $obj$depext.tmp; \\ +	else \\ +		mv $obj$depext.tmp $obj$depext; \\ +	fi +EOF +          } +      } +      return $recipe; +  } +  # On Unix, we build shlibs from static libs, so we're ignoring the +  # object file array.  We *know* this routine is only called when we've +  # configure 'shared'. +  sub libobj2shlib { +      my %args = @_; +      my $lib = $args{lib}; +      my $shlib = $args{shlib}; +      my $libd = dirname($lib); +      my $libn = basename($lib); +      (my $libname = $libn) =~ s/^lib//; +      my $linklibs = join("", map { my $d = dirname($_); +                                    my $f = basename($_); +                                    (my $l = $f) =~ s/^lib//; +                                    " -L$d -l$l" } @{$args{deps}}); +      my $deps = join(" ",compute_lib_depends(@{$args{deps}})); +      my $shlib_target = $target{shared_target}; +      my $ordinalsfile = defined($args{ordinals}) ? $args{ordinals}->[1] : ""; +      my $target = shlib_simple($lib); +      my $target_full = shlib($lib); +      return <<"EOF" +# With a build on a Windows POSIX layer (Cygwin or Mingw), we know for a fact +# that two files get produced, {shlibname}.dll and {libname}.dll.a. +# With all other Unix platforms, we often build a shared library with the +# SO version built into the file name and a symlink without the SO version +# It's not necessary to have both as targets.  The choice falls on the +# simplest, {libname}$shlibextimport for Windows POSIX layers and +# {libname}$shlibextsimple for the Unix platforms. +$target: $lib$libext $deps $ordinalsfile +	\$(MAKE) -f \$(SRCDIR)/Makefile.shared -e \\ +		PLATFORM=\$(PLATFORM) \\ +		PERL="\$(PERL)" SRCDIR='\$(SRCDIR)' DSTDIR="$libd" \\ +		INSTALLTOP='\$(INSTALLTOP)' LIBDIR='\$(LIBDIR)' \\ +		LIBDEPS='\$(PLIB_LDFLAGS) '"$linklibs"' \$(EX_LIBS)' \\ +		LIBNAME=$libname SHLIBVERSION=\$(SHLIB_MAJOR).\$(SHLIB_MINOR) \\ +		STLIBNAME=$lib$libext \\ +		SHLIBNAME=$target SHLIBNAME_FULL=$target_full \\ +		CC='\$(CC)' CFLAGS='\$(CFLAGS) \$(LIB_CFLAGS)' \\ +		LDFLAGS='\$(LDFLAGS)' SHARED_LDFLAGS='\$(LIB_LDFLAGS)' \\ +		RC='\$(RC)' SHARED_RCFLAGS='\$(RCFLAGS)' \\ +		link_shlib.$shlib_target +EOF +	  . (windowsdll() ? <<"EOF" : ""); +	rm -f apps/$shlib$shlibext +	rm -f test/$shlib$shlibext +	rm -f fuzz/$shlib$shlibext +	cp -p $shlib$shlibext apps/ +	cp -p $shlib$shlibext test/ +	cp -p $shlib$shlibext fuzz/ +EOF +  } +  sub obj2dso { +      my %args = @_; +      my $dso = $args{lib}; +      my $dsod = dirname($dso); +      my $dson = basename($dso); +      my $shlibdeps = join("", map { my $d = dirname($_); +                                     my $f = basename($_); +                                     (my $l = $f) =~ s/^lib//; +                                     " -L$d -l$l" } @{$args{deps}}); +      my $deps = join(" ",compute_lib_depends(@{$args{deps}})); +      my $shlib_target = $target{shared_target}; +      my $objs = join(" ", map { $_.$objext } @{$args{objs}}); +      my $target = dso($dso); +      return <<"EOF"; +$target: $objs $deps +	\$(MAKE) -f \$(SRCDIR)/Makefile.shared -e \\ +		PLATFORM=\$(PLATFORM) \\ +		PERL="\$(PERL)" SRCDIR='\$(SRCDIR)' DSTDIR="$dsod" \\ +		LIBDEPS='\$(PLIB_LDFLAGS) '"$shlibdeps"' \$(EX_LIBS)' \\ +		SHLIBNAME_FULL=$target LDFLAGS='\$(LDFLAGS)' \\ +		CC='\$(CC)' CFLAGS='\$(CFLAGS) \$(DSO_CFLAGS)' \\ +		SHARED_LDFLAGS='\$(DSO_LDFLAGS)' \\ +		LIBEXTRAS="$objs" \\ +		link_dso.$shlib_target +EOF +  } +  sub obj2lib { +      my %args = @_; +      my $lib = $args{lib}; +      my $objs = join(" ", map { $_.$objext } @{$args{objs}}); +      return <<"EOF"; +$lib$libext: $objs +	\$(AR) \$\@ \$\? +	\$(RANLIB) \$\@ || echo Never mind. +EOF +  } +  sub obj2bin { +      my %args = @_; +      my $bin = $args{bin}; +      my $bind = dirname($bin); +      my $binn = basename($bin); +      my $objs = join(" ", map { $_.$objext } @{$args{objs}}); +      my $deps = join(" ",compute_lib_depends(@{$args{deps}})); +      my $linklibs = join("", map { my $d = dirname($_); +                                    my $f = basename($_); +                                    $d = "." if $d eq $f; +                                    (my $l = $f) =~ s/^lib//; +                                    " -L$d -l$l" } @{$args{deps}}); +      my $shlib_target = $disabled{shared} ? "" : $target{shared_target}; +      return <<"EOF"; +$bin$exeext: $objs $deps +	\$(RM) $bin$exeext +	\$(MAKE) -f \$(SRCDIR)/Makefile.shared -e \\ +		PERL="\$(PERL)" SRCDIR=\$(SRCDIR) \\ +		APPNAME=$bin$exeext OBJECTS="$objs" \\ +		LIBDEPS='\$(PLIB_LDFLAGS) '"$linklibs"' \$(EX_LIBS)' \\ +		CC='\$(CC)' CFLAGS='\$(CFLAGS) \$(BIN_CFLAGS)' \\ +		LDFLAGS='\$(LDFLAGS)' \\ +		link_app.$shlib_target +EOF +  } +  sub in2script { +      my %args = @_; +      my $script = $args{script}; +      my $sources = join(" ", @{$args{sources}}); +      my $dofile = abs2rel(rel2abs(catfile($config{sourcedir}, +                                           "util", "dofile.pl")), +                           rel2abs($config{builddir})); +      return <<"EOF"; +$script: $sources +	\$(PERL) "-I\$(BLDDIR)" -Mconfigdata "$dofile" \\ +	    "-o$target{build_file}" $sources > "$script" +	chmod a+x $script +EOF +  } +  sub generatedir { +      my %args = @_; +      my $dir = $args{dir}; +      my @deps = map { s|\.o$|$objext|; $_ } @{$args{deps}}; +      my @actions = (); +      my %extinfo = ( dso => $dsoext, +                      lib => $libext, +                      bin => $exeext ); + +      foreach my $type (("dso", "lib", "bin", "script")) { +          next unless defined($unified_info{dirinfo}->{$dir}->{products}->{$type}); +          # For lib object files, we could update the library.  However, it +          # was decided that it's enough to build the directory local object +          # files, so we don't need to add any actions, and the dependencies +          # are already taken care of. +          if ($type ne "lib") { +              foreach my $prod (@{$unified_info{dirinfo}->{$dir}->{products}->{$type}}) { +                  if (dirname($prod) eq $dir) { +                      push @deps, $prod.$extinfo{$type}; +                  } else { +                      push @actions, "\t@ : No support to produce $type ".join(", ", @{$unified_info{dirinfo}->{$dir}->{products}->{$type}}); +                  } +              } +          } +      } + +      my $deps = join(" ", @deps); +      my $actions = join("\n", "", @actions); +      return <<"EOF"; +$args{dir} $args{dir}/: $deps$actions +EOF +  } +  ""    # Important!  This becomes part of the template result. +-} diff --git a/openssl-1.1.0h/Configurations/unix-checker.pm b/openssl-1.1.0h/Configurations/unix-checker.pm new file mode 100644 index 0000000..b39b0eb --- /dev/null +++ b/openssl-1.1.0h/Configurations/unix-checker.pm @@ -0,0 +1,22 @@ +#! /usr/bin/perl + +use Config; + +# Check that the perl implementation file modules generate paths that +# we expect for the platform +use File::Spec::Functions qw(:DEFAULT rel2abs); + +if (rel2abs('.') !~ m|/|) { +    die <<EOF; + +****************************************************************************** +This perl implementation doesn't produce Unix like paths (with forward slash +directory separators).  Please use an implementation that matches your +building platform. + +This Perl version: $Config{version} for $Config{archname} +****************************************************************************** +EOF +} + +1; diff --git a/openssl-1.1.0h/Configurations/windows-checker.pm b/openssl-1.1.0h/Configurations/windows-checker.pm new file mode 100644 index 0000000..de46fbc --- /dev/null +++ b/openssl-1.1.0h/Configurations/windows-checker.pm @@ -0,0 +1,22 @@ +#! /usr/bin/perl + +use Config; + +# Check that the perl implementation file modules generate paths that +# we expect for the platform +use File::Spec::Functions qw(:DEFAULT rel2abs); + +if (rel2abs('.') !~ m|\\|) { +    die <<EOF; + +****************************************************************************** +This perl implementation doesn't produce Windows like paths (with backward +slash directory separators).  Please use an implementation that matches your +building platform. + +This Perl version: $Config{version} for $Config{archname} +****************************************************************************** +EOF +} + +1; diff --git a/openssl-1.1.0h/Configurations/windows-makefile.tmpl b/openssl-1.1.0h/Configurations/windows-makefile.tmpl new file mode 100644 index 0000000..e3e213f --- /dev/null +++ b/openssl-1.1.0h/Configurations/windows-makefile.tmpl @@ -0,0 +1,621 @@ +## +## Makefile for OpenSSL +## +## {- join("\n## ", @autowarntext) -} +{- + our $objext = $target{obj_extension} || ".obj"; + our $depext = $target{dep_extension} || ".d"; + our $exeext = $target{exe_extension} || ".exe"; + our $libext = $target{lib_extension} || ".lib"; + our $shlibext = $target{shared_extension} || ".dll"; + our $shlibextimport = $target{shared_import_extension} || ".lib"; + our $dsoext = $target{dso_extension} || ".dll"; + + our $sover = $config{shlib_major}."_".$config{shlib_minor}; + + my $win_installenv = +     $target{build_scheme}->[2] eq "VC-W32" ? +     "ProgramFiles(x86)" : "ProgramW6432"; + my $win_commonenv = +     $target{build_scheme}->[2] eq "VC-W32" +     ? "CommonProgramFiles(x86)" : "CommonProgramW6432"; + our $win_installroot = +     defined($ENV{$win_installenv}) +     ? $win_installenv : 'ProgramFiles'; + our $win_commonroot = +     defined($ENV{$win_commonenv}) +     ? $win_commonenv : 'CommonProgramFiles'; + + # expand variables early + $win_installroot = $ENV{$win_installroot}; + $win_commonroot = $ENV{$win_commonroot}; + + sub shlib { +     return () if $disabled{shared}; +     my $lib = shift; +     return $unified_info{sharednames}->{$lib} . $shlibext; + } + + sub shlib_import { +     return () if $disabled{shared}; +     my $lib = shift; +     return $lib . $shlibextimport; + } + + sub dso { +     my $dso = shift; + +     return $dso . $dsoext; + } + # This makes sure things get built in the order they need + # to. You're welcome. + sub dependmagic { +     my $target = shift; + +     return "$target: build_generated\n\t\$(MAKE) depend && \$(MAKE) _$target\n_$target"; + } + ''; +-} + +PLATFORM={- $config{target} -} +SRCDIR={- $config{sourcedir} -} +BLDDIR={- $config{builddir} -} + +VERSION={- $config{version} -} +MAJOR={- $config{major} -} +MINOR={- $config{minor} -} + +SHLIB_VERSION_NUMBER={- $config{shlib_version_number} -} + +LIBS={- join(" ", map { $_.$libext } @{$unified_info{libraries}}) -} +SHLIBS={- join(" ", map { shlib($_) } @{$unified_info{libraries}}) -} +SHLIBPDBS={- join(" ", map { local $shlibext = ".pdb"; shlib($_) } @{$unified_info{libraries}}) -} +ENGINES={- join(" ", map { dso($_) } @{$unified_info{engines}}) -} +ENGINEPDBS={- join(" ", map { local $dsoext = ".pdb"; dso($_) } @{$unified_info{engines}}) -} +PROGRAMS={- our @PROGRAMS = map { $_.$exeext } @{$unified_info{programs}}; join(" ", @PROGRAMS) -} +PROGRAMPDBS={- join(" ", map { $_.".pdb" } @{$unified_info{programs}}) -} +SCRIPTS={- join(" ", @{$unified_info{scripts}}) -} +{- output_off() if $disabled{makedepend}; "" -} +DEPS={- join(" ", map { (my $x = $_) =~ s|\.o$|$depext|; $x; } +                  grep { $unified_info{sources}->{$_}->[0] =~ /\.c$/ } +                  keys %{$unified_info{sources}}); -} +{- output_on() if $disabled{makedepend}; "" -} +GENERATED_MANDATORY={- join(" ", @{$unified_info{depends}->{""}} ) -} +GENERATED={- join(" ", +                  ( map { (my $x = $_) =~ s|\.[sS]$|\.asm|; $x } +                    grep { defined $unified_info{generate}->{$_} } +                    map { @{$unified_info{sources}->{$_}} } +                    grep { /\.o$/ } keys %{$unified_info{sources}} ), +                  ( grep { /\.h$/ } keys %{$unified_info{generate}} )) -} + +INSTALL_LIBS={- join(" ", map { $_.$libext } @{$unified_info{install}->{libraries}}) -} +INSTALL_SHLIBS={- join(" ", map { shlib($_) } @{$unified_info{install}->{libraries}}) -} +INSTALL_SHLIBPDBS={- join(" ", map { local $shlibext = ".pdb"; shlib($_) } @{$unified_info{install}->{libraries}}) -} +INSTALL_ENGINES={- join(" ", map { dso($_) } @{$unified_info{install}->{engines}}) -} +INSTALL_ENGINEPDBS={- join(" ", map { local $dsoext = ".pdb"; dso($_) } @{$unified_info{install}->{engines}}) -} +INSTALL_PROGRAMS={- join(" ", map { $_.$exeext } grep { !m|^test\\| } @{$unified_info{install}->{programs}}) -} +INSTALL_PROGRAMPDBS={- join(" ", map { $_.".pdb" } grep { !m|^test\\| } @{$unified_info{install}->{programs}}) -} +{- output_off() if $disabled{apps}; "" -} +BIN_SCRIPTS=$(BLDDIR)\tools\c_rehash.pl +MISC_SCRIPTS=$(BLDDIR)\apps\CA.pl $(BLDDIR)\apps\tsget.pl +{- output_on() if $disabled{apps}; "" -} + +APPS_OPENSSL={- use File::Spec::Functions; +                catfile("apps","openssl") -} + +# Do not edit these manually. Use Configure with --prefix or --openssldir +# to change this!  Short explanation in the top comment in Configure +INSTALLTOP_dev={- # $prefix is used in the OPENSSLDIR perl snippet +                  # +                  use File::Spec::Functions qw(:DEFAULT splitpath); +                  our $prefix = canonpath($config{prefix} +                                          || "$win_installroot\\OpenSSL"); +                  our ($prefix_dev, $prefix_dir, $prefix_file) = +                      splitpath($prefix, 1); +                  $prefix_dev -} +INSTALLTOP_dir={- canonpath($prefix_dir) -} +OPENSSLDIR_dev={- # +                  # The logic here is that if no --openssldir was given, +                  # OPENSSLDIR will get the value from $prefix plus "/ssl". +                  # If --openssldir was given and the value is an absolute +                  # path, OPENSSLDIR will get its value without change. +                  # If the value from --openssldir is a relative path, +                  # OPENSSLDIR will get $prefix with the --openssldir +                  # value appended as a subdirectory. +                  # +                  use File::Spec::Functions qw(:DEFAULT splitpath); +                  our $openssldir = +                      $config{openssldir} ? +                          (file_name_is_absolute($config{openssldir}) ? +                               canonpath($config{openssldir}) +                               : catdir($prefix, $config{openssldir})) +                          : canonpath("$win_commonroot\\SSL"); +                  our ($openssldir_dev, $openssldir_dir, $openssldir_file) = +                      splitpath($openssldir, 1); +                  $openssldir_dev -} +OPENSSLDIR_dir={- canonpath($openssldir_dir) -} +LIBDIR={- our $libdir = $config{libdir} || "lib"; +          $libdir -} +ENGINESDIR_dev={- use File::Spec::Functions qw(:DEFAULT splitpath); +                  our $enginesdir = catdir($prefix,$libdir,"engines-$sover"); +                  our ($enginesdir_dev, $enginesdir_dir, $enginesdir_file) = +                      splitpath($enginesdir, 1); +                  $enginesdir_dev -} +ENGINESDIR_dir={- canonpath($enginesdir_dir) -} +!IF "$(DESTDIR)" != "" +INSTALLTOP=$(DESTDIR)$(INSTALLTOP_dir) +OPENSSLDIR=$(DESTDIR)$(OPENSSLDIR_dir) +ENGINESDIR=$(DESTDIR)$(ENGINESDIR_dir) +!ELSE +INSTALLTOP=$(INSTALLTOP_dev)$(INSTALLTOP_dir) +OPENSSLDIR=$(OPENSSLDIR_dev)$(OPENSSLDIR_dir) +ENGINESDIR=$(ENGINESDIR_dev)$(ENGINESDIR_dir) +!ENDIF + +CC={- $target{cc} -} +CFLAGS={- join(" ",(map { "-D".$_} @{$target{defines}}, @{$config{defines}})) -} {- join(" ", quotify_l("-DENGINESDIR=\"$enginesdir\"", "-DOPENSSLDIR=\"$openssldir\"")) -} {- $target{cflags} -} {- $config{cflags} -} +COUTFLAG={- $target{coutflag} || "/Fo" -}$(OSSL_EMPTY) +RC={- $target{rc} || "rc" -} +RCOUTFLAG={- $target{rcoutflag} || "/fo" -}$(OSSL_EMPTY) +LD={- $target{ld} || "link" -} +LDFLAGS={- $target{lflags} -} +LDOUTFLAG={- $target{loutflag} || "/out:" -}$(OSSL_EMPTY) +EX_LIBS={- $target{ex_libs} -} +LIB_CFLAGS={- join(" ", $target{lib_cflags}, $target{shared_cflag}) || "" -} +LIB_LDFLAGS={- $target{shared_ldflag} || "" -} +DSO_CFLAGS={- join(" ", $target{dso_cflags}, $target{shared_cflag}) || "" -} +DSO_LDFLAGS={- join(" ", $target{dso_lflags}, $target{shared_ldflag}) || "" -} +BIN_CFLAGS={- $target{bin_cflags} -} +BIN_LDFLAGS={- $target{bin_lflags} -} + +PERL={- $config{perl} -} + +AR={- $target{ar} -} +ARFLAGS= {- $target{arflags} -} +AROUTFLAG={- $target{aroutflag} || "/out:" -}$(OSSL_EMPTY) + +MT={- $target{mt} -} +MTFLAGS= {- $target{mtflags} -} +MTINFLAG={- $target{mtinflag} || "-manifest " -}$(OSSL_EMPTY) +MTOUTFLAG={- $target{mtoutflag} || "-outputresource:" -}$(OSSL_EMPTY) + +AS={- $target{as} -} +ASFLAGS={- $target{asflags} -} +ASOUTFLAG={- $target{asoutflag} -}$(OSSL_EMPTY) +PERLASM_SCHEME= {- $target{perlasm_scheme} -} + +PROCESSOR= {- $config{processor} -} + +# The main targets ################################################### + +{- dependmagic('all'); -}: build_libs_nodep build_engines_nodep build_programs_nodep +{- dependmagic('build_libs'); -}: build_libs_nodep +{- dependmagic('build_engines'); -}: build_engines_nodep +{- dependmagic('build_programs'); -}: build_programs_nodep + +build_generated: $(GENERATED_MANDATORY) +build_libs_nodep: $(LIBS) {- join(" ",map { shlib_import($_) } @{$unified_info{libraries}}) -} +build_engines_nodep: $(ENGINES) +build_programs_nodep: $(PROGRAMS) $(SCRIPTS) + +# Kept around for backward compatibility +build_apps build_tests: build_programs + +# Convenience target to prebuild all generated files, not just the mandatory +# ones +build_all_generated: $(GENERATED_MANDATORY) $(GENERATED) + +test: tests +{- dependmagic('tests'); -}: build_programs_nodep build_engines_nodep +	@rem {- output_off() if $disabled{tests}; "" -} +	-mkdir $(BLDDIR)\test\test-runs +	set SRCTOP=$(SRCDIR) +	set BLDTOP=$(BLDDIR) +	set RESULT_D=$(BLDDIR)\test\test-runs +	set PERL=$(PERL) +	set OPENSSL_ENGINES=$(MAKEDIR)\engines +	set OPENSSL_DEBUG_MEMORY=on +	"$(PERL)" "$(SRCDIR)\test\run_tests.pl" $(TESTS) +	@rem {- if ($disabled{tests}) { output_on(); } else { output_off(); } "" -} +	@echo "Tests are not supported with your chosen Configure options" +	@rem {- output_on() if !$disabled{tests}; "" -} + +list-tests: +	@rem {- output_off() if $disabled{tests}; "" -} +	@set SRCTOP=$(SRCDIR) +	@"$(PERL)" "$(SRCDIR)\test\run_tests.pl" list +	@rem {- if ($disabled{tests}) { output_on(); } else { output_off(); } "" -} +	@echo "Tests are not supported with your chosen Configure options" +	@rem {- output_on() if !$disabled{tests}; "" -} + +install: install_sw install_ssldirs install_docs + +uninstall: uninstall_docs uninstall_sw + +libclean: +	"$(PERL)" -e "map { m/(.*)\.dll$$/; unlink glob """$$1.*"""; } @ARGV" $(SHLIBS) +	"$(PERL)" -e "map { m/(.*)\.dll$$/; unlink glob """apps/$$1.*"""; } @ARGV" $(SHLIBS) +	"$(PERL)" -e "map { m/(.*)\.dll$$/; unlink glob """test/$$1.*"""; } @ARGV" $(SHLIBS) +	"$(PERL)" -e "map { m/(.*)\.dll$$/; unlink glob """fuzz/$$1.*"""; } @ARGV" $(SHLIBS) +	-del /Q /F $(LIBS) +	-del /Q ossl_static.pdb + +clean: libclean +	{- join("\n\t", map { "-del /Q /F $_" } @PROGRAMS) -} +	-del /Q /F $(ENGINES) +	-del /Q /F $(SCRIPTS) +	-del /Q /F $(GENERATED) +	-del /Q /S /F *.d +	-del /Q /S /F *.obj +	-del /Q /S /F *.pdb +	-del /Q /S /F *.exp +	-del /Q /S /F engines\*.ilk +	-del /Q /S /F engines\*.lib +	-del /Q /S /F apps\*.lib +	-del /Q /S /F engines\*.manifest +	-del /Q /S /F apps\*.manifest +	-del /Q /S /F test\*.manifest + +distclean: clean +	-del /Q /F configdata.pm +	-del /Q /F makefile + +depend: + +# Install helper targets ############################################# + +install_sw: all install_dev install_engines install_runtime + +uninstall_sw: uninstall_runtime uninstall_engines uninstall_dev + +install_docs: install_html_docs + +uninstall_docs: uninstall_html_docs + +install_ssldirs: +	@"$(PERL)" "$(SRCDIR)\util\mkdir-p.pl" "$(OPENSSLDIR)\certs" +	@"$(PERL)" "$(SRCDIR)\util\mkdir-p.pl" "$(OPENSSLDIR)\private" +	@"$(PERL)" "$(SRCDIR)\util\mkdir-p.pl" "$(OPENSSLDIR)\misc" +	@"$(PERL)" "$(SRCDIR)\util\copy.pl" "$(SRCDIR)\apps\openssl.cnf" \ +                                        "$(OPENSSLDIR)\openssl.cnf.dist" +	@IF NOT EXIST "$(OPENSSLDIR)\openssl.cnf" \ +         "$(PERL)" "$(SRCDIR)\util\copy.pl" "$(SRCDIR)\apps\openssl.cnf" \ +                                        "$(OPENSSLDIR)\openssl.cnf" +	@"$(PERL)" "$(SRCDIR)\util\copy.pl" $(MISC_SCRIPTS) \ +                                        "$(OPENSSLDIR)\misc" + +install_dev: +	@if "$(INSTALLTOP)"=="" ( echo INSTALLTOP should not be empty & exit 1 ) +	@echo *** Installing development files +	@"$(PERL)" "$(SRCDIR)\util\mkdir-p.pl" "$(INSTALLTOP)\include\openssl" +	@rem {- output_off() unless grep { $_ eq "OPENSSL_USE_APPLINK" } @{$target{defines}}; "" -} +	@"$(PERL)" "$(SRCDIR)\util\copy.pl" "$(SRCDIR)\ms\applink.c" \ +				       "$(INSTALLTOP)\include\openssl" +	@rem {- output_on() unless grep { $_ eq "OPENSSL_USE_APPLINK" } @{$target{defines}}; "" -} +	@"$(PERL)" "$(SRCDIR)\util\copy.pl" "$(SRCDIR)\include\openssl\*.h" \ +				       "$(INSTALLTOP)\include\openssl" +	@"$(PERL)" "$(SRCDIR)\util\copy.pl" $(BLDDIR)\include\openssl\*.h \ +				       "$(INSTALLTOP)\include\openssl" +	@"$(PERL)" "$(SRCDIR)\util\mkdir-p.pl" "$(INSTALLTOP)\$(LIBDIR)" +	@"$(PERL)" "$(SRCDIR)\util\copy.pl" $(INSTALL_LIBS) \ +				       "$(INSTALLTOP)\$(LIBDIR)" +	@if "$(SHLIBS)"=="" \ +	 "$(PERL)" "$(SRCDIR)\util\copy.pl" ossl_static.pdb \ +                                       "$(INSTALLTOP)\$(LIBDIR)" + +uninstall_dev: + +install_engines: +	@if "$(INSTALLTOP)"=="" ( echo INSTALLTOP should not be empty & exit 1 ) +	@echo *** Installing engines +	@"$(PERL)" "$(SRCDIR)\util\mkdir-p.pl" "$(ENGINESDIR)" +	@if not "$(ENGINES)"=="" \ +	 "$(PERL)" "$(SRCDIR)\util\copy.pl" $(INSTALL_ENGINES) "$(ENGINESDIR)" +	@if not "$(ENGINES)"=="" \ +	 "$(PERL)" "$(SRCDIR)\util\copy.pl" $(INSTALL_ENGINEPDBS) "$(ENGINESDIR)" + +uninstall_engines: + +install_runtime: +	@if "$(INSTALLTOP)"=="" ( echo INSTALLTOP should not be empty & exit 1 ) +	@echo *** Installing runtime files +	@"$(PERL)" "$(SRCDIR)\util\mkdir-p.pl" "$(INSTALLTOP)\bin" +	@if not "$(SHLIBS)"=="" \ +	 "$(PERL)" "$(SRCDIR)\util\copy.pl" $(INSTALL_SHLIBS) "$(INSTALLTOP)\bin" +	@if not "$(SHLIBS)"=="" \ +	 "$(PERL)" "$(SRCDIR)\util\copy.pl" $(INSTALL_SHLIBPDBS) \ +                                        "$(INSTALLTOP)\bin" +	@"$(PERL)" "$(SRCDIR)\util\copy.pl" $(INSTALL_PROGRAMS) \ +                                        "$(INSTALLTOP)\bin" +	@"$(PERL)" "$(SRCDIR)\util\copy.pl" $(INSTALL_PROGRAMPDBS) \ +                                        "$(INSTALLTOP)\bin" +	@"$(PERL)" "$(SRCDIR)\util\copy.pl" $(BIN_SCRIPTS) \ +                                        "$(INSTALLTOP)\bin" + +uninstall_runtime: + +install_html_docs: +        "$(PERL)" "$(SRCDIR)\util\process_docs.pl" \ +                "--destdir=$(INSTALLTOP)\html" --type=html + +uninstall_html_docs: + +# Building targets ################################################### + +configdata.pm: "$(SRCDIR)\Configure" {- join(" ", map { '"'.$_.'"' } @{$config{build_file_templates}}, @{$config{build_infos}}, @{$config{conf_files}}) -} +	@echo "Detected changed: $?" +	@echo "Reconfiguring..." +	"$(PERL)" "$(SRCDIR)\Configure" reconf +	@echo "**************************************************" +	@echo "***                                            ***" +	@echo "***   Please run the same make command again   ***" +	@echo "***                                            ***" +	@echo "**************************************************" +	@exit 1 + +{- + use File::Basename; + use File::Spec::Functions qw/:DEFAULT abs2rel rel2abs/; + + # Helper function to figure out dependencies on libraries + # It takes a list of library names and outputs a list of dependencies + sub compute_lib_depends { +     if ($disabled{shared}) { +	 return map { $_.$libext } @_; +     } +     return map { shlib_import($_) } @_; + } + +  sub generatesrc { +      my %args = @_; +      (my $target = $args{src}) =~ s/\.[sS]$/.asm/; +      my ($gen0, @gens) = @{$args{generator}}; +      my $generator = '"'.$gen0.'"'.join('', map { " $_" } @gens); +      my $generator_incs = join("", map { " -I \"$_\"" } @{$args{generator_incs}}); +      my $incs = join("", map { " /I \"$_\"" } @{$args{incs}}); +      my $deps = @{$args{deps}} ? +          '"'.join('" "', @{$args{generator_deps}}, @{$args{deps}}).'"' : ''; + +      if ($target !~ /\.asm$/) { +          if ($args{generator}->[0] =~ m|^.*\.in$|) { +              my $dofile = abs2rel(rel2abs(catfile($config{sourcedir}, +                                                   "util", "dofile.pl")), +                                   rel2abs($config{builddir})); +              return <<"EOF"; +$target: "$args{generator}->[0]" $deps +	"\$(PERL)" "-I\$(BLDDIR)" -Mconfigdata "$dofile" \\ +	    "-o$target{build_file}" $generator > \$@ +EOF +	  } else { +              return <<"EOF"; +$target: "$args{generator}->[0]" $deps +	"\$(PERL)"$generator_incs $generator > \$@ +EOF +	  } +      } else { +          if ($args{generator}->[0] =~ /\.pl$/) { +              $generator = '"$(PERL)"'.$generator_incs.' '.$generator; +          } elsif ($args{generator}->[0] =~ /\.S$/) { +              $generator = undef; +          } else { +              die "Generator type for $src unknown: $generator\n"; +          } + +          if (defined($generator)) { +              # If the target is named foo.S in build.info, we want to +              # end up generating foo.s in two steps. +              if ($args{src} =~ /\.S$/) { +                   return <<"EOF"; +$target: "$args{generator}->[0]" $deps +	set ASM=\$(AS) +	$generator \$@.S +	\$(CC) $incs \$(CFLAGS) /EP /C \$@.S > \$@.i && move /Y \$@.i \$@ +        del /Q \$@.S +EOF +              } +              # Otherwise.... +              return <<"EOF"; +$target: "$args{generator}->[0]" $deps +	set ASM=\$(AS) +	$generator \$@ +EOF +          } +          return <<"EOF"; +$target: "$args{generator}->[0]" $deps +	\$(CC) $incs \$(CFLAGS) /EP /C "$args{generator}->[0]" > \$@.i && move /Y \$@.i \$@ +EOF +      } +  } + + sub src2obj { +     my %args = @_; +     my $obj = $args{obj}; +     my @srcs = map { (my $x = $_) =~ s/\.s$/.asm/; $x +                    } ( @{$args{srcs}} ); +     my $srcs = '"'.join('" "',  @srcs).'"'; +     my $deps = '"'.join('" "', @srcs, @{$args{deps}}).'"'; +     my $incs = join("", map { ' /I "'.$_.'"' } @{$args{incs}}); +     unless ($disabled{zlib}) { +         if ($withargs{zlib_include}) { +             $incs .= ' /I "'.$withargs{zlib_include}.'"'; +         } +     } +     my $ecflags = { lib => '$(LIB_CFLAGS)', +		     dso => '$(DSO_CFLAGS)', +		     bin => '$(BIN_CFLAGS)' } -> {$args{intent}}; +     my $makedepprog = $config{makedepprog}; +     if ($srcs[0] =~ /\.asm$/) { +         return <<"EOF"; +$obj$objext: $deps +	\$(AS) \$(ASFLAGS) \$(ASOUTFLAG)\$\@ $srcs +EOF +     } +     return <<"EOF"	if (!$disabled{makedepend}); +$obj$depext: $deps +	\$(CC) \$(CFLAGS) $ecflags$inc /Zs /showIncludes $srcs 2>&1 | \\ +	    "\$(PERL)" -n << > $obj$depext +chomp; +s/^Note: including file: *//; +\$\$collect{\$\$_} = 1; +END { print '$obj$objext: ',join(" ", sort keys \%collect),"\\n" } +<< +$obj$objext: $obj$depext +	\$(CC) $incs \$(CFLAGS) $ecflags -c \$(COUTFLAG)\$\@ $srcs +EOF +    return <<"EOF"	if ($disabled{makedepend}); +$obj$objext: $deps +	\$(CC) $incs \$(CFLAGS) $ecflags -c \$(COUTFLAG)\$\@ $srcs +EOF + } + + # On Unix, we build shlibs from static libs, so we're ignoring the + # object file array.  We *know* this routine is only called when we've + # configure 'shared'. + sub libobj2shlib { +     my %args = @_; +     my $lib = $args{lib}; +     my $shlib = $args{shlib}; +     (my $mkdef_key = $lib) =~ s/^lib//i; +     my $objs = join("\n", map { $_.$objext } @{$args{objs}}); +     my $linklibs = join("", +			 map { "\n$_" } compute_lib_depends(@{$args{deps}})); +     my $deps = join(" ", +		     (map { $_.$objext } @{$args{objs}}), +		     compute_lib_depends(@{$args{deps}})); +     my $ordinalsfile = defined($args{ordinals}) ? $args{ordinals}->[1] : ""; +     my $mkdef_pl = abs2rel(rel2abs(catfile($config{sourcedir}, +					    "util", "mkdef.pl")), +			    rel2abs($config{builddir})); +     my $mkrc_pl = abs2rel(rel2abs(catfile($config{sourcedir}, +					   "util", "mkrc.pl")), +			   rel2abs($config{builddir})); +     my $target = shlib_import($lib); +     return <<"EOF" +$target: $deps "$ordinalsfile" "$mkdef_pl" +	"\$(PERL)" "$mkdef_pl" "$mkdef_key" 32 > $shlib.def +	"\$(PERL)" -i.tmp -pe "s|^LIBRARY\\s+${mkdef_key}32|LIBRARY $shlib|;" $shlib.def +	DEL $shlib.def.tmp +	"\$(PERL)" "$mkrc_pl" $shlib$shlibext > $shlib.rc +	\$(RC) \$(RCOUTFLAG)$shlib.res $shlib.rc +	IF EXIST $shlib$shlibext.manifest DEL /F /Q $shlib$shlibext.manifest +	\$(LD) \$(LDFLAGS) \$(LIB_LDFLAGS) \\ +		/implib:\$@ \$(LDOUTFLAG)$shlib$shlibext /def:$shlib.def @<< || (DEL /Q \$(\@B).* $shlib.* && EXIT 1) +$objs $shlib.res$linklibs \$(EX_LIBS) +<< +	IF EXIST $shlib$shlibext.manifest \\ +	   \$(MT) \$(MTFLAGS) \$(MTINFLAG)$shlib$shlibext.manifest \$(MTOUTFLAG)$shlib$shlibext +	IF EXIST apps\\$shlib$shlibext DEL /Q /F apps\\$shlib$shlibext +	IF EXIST test\\$shlib$shlibext DEL /Q /F test\\$shlib$shlibext +	IF EXIST fuzz\\$shlib$shlibext DEL /Q /F fuzz\\$shlib$shlibext +	COPY $shlib$shlibext apps +	COPY $shlib$shlibext test +	COPY $shlib$shlibext fuzz +EOF + } + sub obj2dso { +     my %args = @_; +     my $dso = $args{lib}; +     my $dso_n = basename($dso); +     my $objs = join("\n", map { $_.$objext } @{$args{objs}}); +     my $linklibs = join("", +			 map { "\n$_" } compute_lib_depends(@{$args{deps}})); +     my $deps = join(" ", +		     (map { $_.$objext } @{$args{objs}}), +		     compute_lib_depends(@{$args{deps}})); +     return <<"EOF"; +$dso$dsoext: $deps +	IF EXIST $dso$dsoext.manifest DEL /F /Q $dso$dsoext.manifest +	\$(LD) \$(LDFLAGS) \$(DSO_LDFLAGS) \$(LDOUTFLAG)$dso$dsoext /def:<< @<< +LIBRARY         $dso_n +EXPORTS +    bind_engine		@1 +    v_check		@2 +<< +$objs$linklibs \$(EX_LIBS) +<< +	IF EXIST $dso$dsoext.manifest \\ +	   \$(MT) \$(MTFLAGS) \$(MTINFLAG)$dso$dsoext.manifest \$(MTOUTFLAG)$dso$dsoext +EOF + } + sub obj2lib { +     # Because static libs and import libs are both named the same in native +     # Windows, we can't have both.  We skip the static lib in that case, +     # as the shared libs are what we use anyway. +     return "" unless $disabled{"shared"}; + +     my %args = @_; +     my $lib = $args{lib}; +     my $objs = join("\n", map { $_.$objext } @{$args{objs}}); +     my $deps = join(" ", map { $_.$objext } @{$args{objs}}); +     return <<"EOF"; +$lib$libext: $deps +	\$(AR) \$(ARFLAGS) \$(AROUTFLAG)$lib$libext @<< +\$** +<< +EOF + } + sub obj2bin { +     my %args = @_; +     my $bin = $args{bin}; +     my $objs = join("\n", map { $_.$objext } @{$args{objs}}); +     my $linklibs = join("", +			 map { "\n$_" } compute_lib_depends(@{$args{deps}})); +     my $deps = join(" ", +		     (map { $_.$objext } @{$args{objs}}), +		     compute_lib_depends(@{$args{deps}})); +     return <<"EOF"; +$bin$exeext: $deps +	IF EXIST $bin$exeext.manifest DEL /F /Q $bin$exeext.manifest +	\$(LD) \$(LDFLAGS) \$(BIN_LDFLAGS) \$(LDOUTFLAG)$bin$exeext @<< +$objs setargv.obj$linklibs \$(EX_LIBS) +<< +	IF EXIST $bin$exeext.manifest \\ +	   \$(MT) \$(MTFLAGS) \$(MTINFLAG)$bin$exeext.manifest \$(MTOUTFLAG)$bin$exeext +EOF +  } +  sub in2script { +      my %args = @_; +      my $script = $args{script}; +      my $sources = '"'.join('" "', @{$args{sources}}).'"'; +      my $dofile = abs2rel(rel2abs(catfile($config{sourcedir}, +                                           "util", "dofile.pl")), +                           rel2abs($config{builddir})); +      return <<"EOF"; +$script: $sources +	"\$(PERL)" "-I\$(BLDDIR)" -Mconfigdata "$dofile" \\ +	    "-o$target{build_file}" $sources > "$script" +EOF +  } +  sub generatedir { +      my %args = @_; +      my $dir = $args{dir}; +      my @deps = map { s|\.o$|$objext|; $_ } @{$args{deps}}; +      my @actions = (); +      my %extinfo = ( dso => $dsoext, +                      lib => $libext, +                      bin => $exeext ); + +      foreach my $type (("dso", "lib", "bin", "script")) { +          next unless defined($unified_info{dirinfo}->{$dir}->{products}->{$type}); +          # For lib object files, we could update the library.  However, +          # LIB on Windows doesn't work that way, so we won't create any +          # actions for it, and the dependencies are already taken care of. +          if ($type ne "lib") { +              foreach my $prod (@{$unified_info{dirinfo}->{$dir}->{products}->{$type}}) { +                  if (dirname($prod) eq $dir) { +                      push @deps, $prod.$extinfo{$type}; +                  } else { +                      push @actions, "\t@rem No support to produce $type ".join(", ", @{$unified_info{dirinfo}->{$dir}->{products}->{$type}}); +                  } +              } +          } +      } + +      my $deps = join(" ", @deps); +      my $actions = join("\n", "", @actions); +      return <<"EOF"; +$args{dir} $args{dir}\\ : $deps$actions +EOF +  } +  ""    # Important!  This becomes part of the template result. +-}  | 
