xref: /freebsd/crypto/openssl/Configurations/00-base-templates.conf (revision 5ca8e32633c4ffbbcd6762e5888b6a4ba0708c6c)
1# -*- Mode: perl -*-
2my %targets=(
3    DEFAULTS => {
4	template	=> 1,
5
6	cflags		=> "",
7	cppflags	=> "",
8	lflags		=> "",
9	defines		=> [],
10	includes	=> [],
11	lib_cflags	=> "",
12	lib_cppflags	=> "",
13	lib_defines	=> [],
14	thread_scheme	=> "(unknown)", # Assume we don't know
15	thread_defines	=> [],
16
17	unistd		=> "<unistd.h>",
18	shared_target	=> "",
19	shared_cflag	=> "",
20	shared_defines	=> [],
21	shared_ldflag	=> "",
22	shared_rcflag	=> "",
23
24	#### Defaults for the benefit of the config targets who don't inherit
25	#### a BASE and assume Unix defaults
26	#### THESE WILL DISAPPEAR IN OpenSSL 1.2
27	build_scheme	=> [ "unified", "unix" ],
28	build_file	=> "Makefile",
29
30	AR		=> "(unused)",
31	ARFLAGS		=> "(unused)",
32	CC		=> "cc",
33	HASHBANGPERL	=> "/usr/bin/env perl",
34	RANLIB		=> sub { which("$config{cross_compile_prefix}ranlib")
35                                     ? "ranlib" : "" },
36	RC		=> "windres",
37
38	#### THESE WILL BE ENABLED IN OpenSSL 1.2
39	#HASHBANGPERL	=> "PERL", # Only Unix actually cares
40    },
41
42    BASE_common => {
43	template	=> 1,
44
45	enable		=> [],
46	disable		=> [],
47
48	defines		=>
49	    sub {
50                my @defs = ( 'OPENSSL_BUILDING_OPENSSL' );
51                push @defs, "ZLIB" unless $disabled{zlib};
52                push @defs, "ZLIB_SHARED" unless $disabled{"zlib-dynamic"};
53                return [ @defs ];
54            },
55        includes        =>
56            sub {
57                my @incs = ();
58                push @incs, $withargs{zlib_include}
59                    if !$disabled{zlib} && $withargs{zlib_include};
60                return [ @incs ];
61            },
62    },
63
64    BASE_unix => {
65        inherit_from    => [ "BASE_common" ],
66        template        => 1,
67
68        AR              => "ar",
69        ARFLAGS         => "qc",
70        CC              => "cc",
71        lflags          =>
72            sub { $withargs{zlib_lib} ? "-L".$withargs{zlib_lib} : () },
73        ex_libs         =>
74            sub { !defined($disabled{zlib})
75                  && defined($disabled{"zlib-dynamic"})
76                  ? "-lz" : () },
77        HASHBANGPERL    => "/usr/bin/env perl", # Only Unix actually cares
78        RANLIB          => sub { which("$config{cross_compile_prefix}ranlib")
79                                     ? "ranlib" : "" },
80        RC              => "windres",
81
82        build_scheme    => [ "unified", "unix" ],
83        build_file      => "Makefile",
84
85        perl_platform   => 'Unix',
86    },
87
88    BASE_Windows => {
89        inherit_from    => [ "BASE_common" ],
90        template        => 1,
91
92        lib_defines      =>
93            sub {
94                my @defs = ();
95                unless ($disabled{"zlib-dynamic"}) {
96                    my $zlib = $withargs{zlib_lib} // "ZLIB1";
97                    push @defs, 'LIBZ=' . (quotify("perl", $zlib))[0];
98                }
99                return [ @defs ];
100            },
101        ex_libs         =>
102            sub {
103                unless ($disabled{zlib}) {
104                    if (defined($disabled{"zlib-dynamic"})) {
105                        return $withargs{zlib_lib} // "ZLIB1";
106                    }
107                }
108                return ();
109            },
110
111        MT              => "mt",
112        MTFLAGS         => "-nologo",
113        mtinflag        => "-manifest ",
114        mtoutflag       => "-outputresource:",
115
116        build_file      => "makefile",
117        build_scheme    => [ "unified", "windows" ],
118
119        perl_platform   => 'Windows',
120    },
121
122    BASE_VMS => {
123        inherit_from    => [ "BASE_common" ],
124        template        => 1,
125
126        includes        =>
127            add(sub {
128                    my @incs = ();
129                    # GNV$ZLIB_INCLUDE is the standard logical name for later
130                    # zlib incarnations.
131                    push @incs, 'GNV$ZLIB_INCLUDE:'
132                        if !$disabled{zlib} && !$withargs{zlib_include};
133                    return [ @incs ];
134                }),
135
136        build_file       => "descrip.mms",
137        build_scheme     => [ "unified", "VMS" ],
138
139        perl_platform    => 'VMS',
140    },
141);
142