Add brotli compression support (RFC7924)
[openssl.git] / Configurations / 00-base-templates.conf
1 # -*- Mode: perl -*-
2 my %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, "BROTLI" unless $disabled{brotli};
52                 push @defs, "BROTLI_SHARED" unless $disabled{"brotli-dynamic"};
53                 push @defs, "ZLIB" unless $disabled{zlib};
54                 push @defs, "ZLIB_SHARED" unless $disabled{"zlib-dynamic"};
55                 return [ @defs ];
56             },
57         includes        =>
58             sub {
59                 my @incs = ();
60                 push @incs, $withargs{brotli_include}
61                     if !$disabled{brotli} && $withargs{brotli_include};
62                 push @incs, $withargs{zlib_include}
63                     if !$disabled{zlib} && $withargs{zlib_include};
64                 return [ @incs ];
65             },
66     },
67
68     BASE_unix => {
69         inherit_from    => [ "BASE_common" ],
70         template        => 1,
71
72         AR              => "ar",
73         ARFLAGS         => "qc",
74         CC              => "cc",
75         lflags          =>
76             sub {
77                 my @libs = ();
78                 push(@libs, "-L".$withargs{zlib_lib}) if $withargs{zlib_lib};
79                 push(@libs, "-L".$withargs{brotli_lib}) if $withargs{brotli_lib};
80                 return join(" ", @libs);
81             },
82         ex_libs         =>
83             sub {
84                 my @libs = ();
85                 push(@libs, "-lz") if !defined($disabled{zlib}) && defined($disabled{"zlib-dynamic"});
86                 if (!defined($disabled{brotli}) && defined($disabled{"brotli-dynamic"})) {
87                     push(@libs, "-lbrotlienc");
88                     push(@libs, "-lbrotlidec");
89                     push(@libs, "-lbrotlicommon");
90                     push(@libs, "-lm");
91                 }
92                 return join(" ", @libs);
93             },
94         HASHBANGPERL    => "/usr/bin/env perl", # Only Unix actually cares
95         RANLIB          => sub { which("$config{cross_compile_prefix}ranlib")
96                                      ? "ranlib" : "" },
97         RC              => "windres",
98
99         build_scheme    => [ "unified", "unix" ],
100         build_file      => "Makefile",
101
102         perl_platform   => 'Unix',
103     },
104
105     BASE_Windows => {
106         inherit_from    => [ "BASE_common" ],
107         template        => 1,
108
109         lib_defines      =>
110             sub {
111                 my @defs = ();
112                 unless ($disabled{"zlib-dynamic"}) {
113                     my $zlib = $withargs{zlib_lib} // "ZLIB1";
114                     push @defs, 'LIBZ=' . (quotify("perl", $zlib))[0];
115                 }
116                 return [ @defs ];
117             },
118         ex_libs         =>
119             sub {
120                 my @libs = ();
121                 unless ($disabled{zlib}) {
122                     if (defined($disabled{"zlib-dynamic"})) {
123                         push(@libs, $withargs{zlib_lib} // "ZLIB1");
124                     }
125                 }
126                 unless ($disabled{brotli}) {
127                     if (defined($disabled{"brotli-dynamic"})) {
128                         my $path = "";
129                         if (defined($withargs{brotli_lib})) {
130                             $path = $withargs{brotli_lib} . "\\";
131                         }
132                         push(@libs, $path . "brotlicommon.lib");
133                         push(@libs, $path . "brotlidec.lib");
134                         push(@libs, $path . "brotlienc.lib");
135                     }
136                 }
137                 return join(" ", @libs);
138             },
139
140         MT              => "mt",
141         MTFLAGS         => "-nologo",
142         mtinflag        => "-manifest ",
143         mtoutflag       => "-outputresource:",
144
145         build_file      => "makefile",
146         build_scheme    => [ "unified", "windows" ],
147
148         perl_platform   => 'Windows',
149     },
150
151     BASE_VMS => {
152         inherit_from    => [ "BASE_common" ],
153         template        => 1,
154
155         includes        =>
156             add(sub {
157                     my @incs = ();
158                     # GNV$ZLIB_INCLUDE is the standard logical name for later
159                     # zlib incarnations.
160                     push @incs, 'GNV$ZLIB_INCLUDE:'
161                         if !$disabled{zlib} && !$withargs{zlib_include};
162                     return [ @incs ];
163                 }),
164
165         build_file       => "descrip.mms",
166         build_scheme     => [ "unified", "VMS" ],
167
168         perl_platform    => 'VMS',
169     },
170 );