]> git.ipfire.org Git - thirdparty/openssl.git/blame - Configurations/00-base-templates.conf
Security hardening: Expose Build flags for Position Independed Execution (PIE)
[thirdparty/openssl.git] / Configurations / 00-base-templates.conf
CommitLineData
bcb1977b 1# -*- Mode: perl -*-
3b6c4b07 2my %targets=(
d2b2221a 3 DEFAULTS => {
9e0724a1 4 template => 1,
bcb1977b
RL
5
6 cflags => "",
8c3bc594
RL
7 cppflags => "",
8 lflags => "",
bcb1977b 9 defines => [],
368297d1 10 includes => [],
68b8bcf4
RL
11 lib_cflags => "",
12 lib_cppflags => "",
852c2ed2 13 lib_defines => [],
9c62a279 14 thread_scheme => "(unknown)", # Assume we don't know
bcb1977b
RL
15 thread_defines => [],
16
9e0724a1 17 unistd => "<unistd.h>",
107b5792
RL
18 shared_target => "",
19 shared_cflag => "",
3a55c92b 20 shared_defines => [],
107b5792 21 shared_ldflag => "",
64c443e3 22 shared_rcflag => "",
54bb8f74 23
36f7be2c 24 #### Defaults for the benefit of the config targets who don't inherit
46d08509 25 #### a BASE and assume Unix defaults
36f7be2c
RL
26 #### THESE WILL DISAPPEAR IN OpenSSL 1.2
27 build_scheme => [ "unified", "unix" ],
28 build_file => "Makefile",
085ed4f1 29
0e60ce63
DDO
30 AR => "(unused)",
31 ARFLAGS => "(unused)",
abe256e7
RL
32 CC => "cc",
33 HASHBANGPERL => "/usr/bin/env perl",
34 RANLIB => sub { which("$config{cross_compile_prefix}ranlib")
5f2e18bc 35 ? "ranlib" : "" },
abe256e7 36 RC => "windres",
36f7be2c
RL
37
38 #### THESE WILL BE ENABLED IN OpenSSL 1.2
abe256e7 39 #HASHBANGPERL => "PERL", # Only Unix actually cares
d2b2221a
RL
40 },
41
42 BASE_common => {
98fdbce0 43 template => 1,
906eb3d0
RL
44
45 enable => [],
46 disable => [],
47
98fdbce0 48 defines =>
62890f47 49 sub {
852c2ed2 50 my @defs = ( 'OPENSSL_BUILDING_OPENSSL' );
12e96a23
TS
51 push @defs, "BROTLI" unless $disabled{brotli};
52 push @defs, "BROTLI_SHARED" unless $disabled{"brotli-dynamic"};
62890f47
RL
53 push @defs, "ZLIB" unless $disabled{zlib};
54 push @defs, "ZLIB_SHARED" unless $disabled{"zlib-dynamic"};
caf9317d
TS
55 push @defs, "ZSTD" unless $disabled{zstd};
56 push @defs, "ZSTD_SHARED" unless $disabled{"zstd-dynamic"};
62890f47
RL
57 return [ @defs ];
58 },
368297d1
RL
59 includes =>
60 sub {
61 my @incs = ();
12e96a23
TS
62 push @incs, $withargs{brotli_include}
63 if !$disabled{brotli} && $withargs{brotli_include};
368297d1
RL
64 push @incs, $withargs{zlib_include}
65 if !$disabled{zlib} && $withargs{zlib_include};
caf9317d
TS
66 push @incs, $withargs{zstd_include}
67 if !$disabled{zstd} && $withargs{zstd_include};
368297d1
RL
68 return [ @incs ];
69 },
d2b2221a
RL
70 },
71
72 BASE_unix => {
73 inherit_from => [ "BASE_common" ],
74 template => 1,
75
abe256e7 76 AR => "ar",
385deae7 77 ARFLAGS => "qc",
abe256e7 78 CC => "cc",
1c4f9684
CL
79 bin_cflags =>
80 sub {
81 my @flags = ();
82 if (!defined($disabled{pie})) {
83 push(@flags, "-fPIE");
84 }
85 return join(" ", @flags);
86 },
87 bin_lflags =>
88 sub {
89 my @flags = ();
90 if (!defined($disabled{pie})) {
91 push(@flags, "-pie");
92 }
93 return join(" ", @flags);
94 },
47eeaf45 95 lflags =>
12e96a23
TS
96 sub {
97 my @libs = ();
98 push(@libs, "-L".$withargs{zlib_lib}) if $withargs{zlib_lib};
99 push(@libs, "-L".$withargs{brotli_lib}) if $withargs{brotli_lib};
caf9317d 100 push(@libs, "-L".$withargs{zstd_lib}) if $withargs{zstd_lib};
12e96a23
TS
101 return join(" ", @libs);
102 },
98fdbce0 103 ex_libs =>
12e96a23
TS
104 sub {
105 my @libs = ();
106 push(@libs, "-lz") if !defined($disabled{zlib}) && defined($disabled{"zlib-dynamic"});
107 if (!defined($disabled{brotli}) && defined($disabled{"brotli-dynamic"})) {
108 push(@libs, "-lbrotlienc");
109 push(@libs, "-lbrotlidec");
110 push(@libs, "-lbrotlicommon");
111 push(@libs, "-lm");
112 }
caf9317d 113 push(@libs, "-lzstd") if !defined($disabled{zstd}) && defined($disabled{"zstd-dynamic"});
12e96a23
TS
114 return join(" ", @libs);
115 },
abe256e7
RL
116 HASHBANGPERL => "/usr/bin/env perl", # Only Unix actually cares
117 RANLIB => sub { which("$config{cross_compile_prefix}ranlib")
5f2e18bc 118 ? "ranlib" : "" },
abe256e7 119 RC => "windres",
98fdbce0 120
021fff84 121 build_scheme => [ "unified", "unix" ],
d2b2221a 122 build_file => "Makefile",
9dd4ed28
RL
123
124 perl_platform => 'Unix',
d2b2221a
RL
125 },
126
127 BASE_Windows => {
128 inherit_from => [ "BASE_common" ],
129 template => 1,
130
78a50c75
AP
131 lib_defines =>
132 sub {
133 my @defs = ();
134 unless ($disabled{"zlib-dynamic"}) {
135 my $zlib = $withargs{zlib_lib} // "ZLIB1";
2cc8fe11 136 push @defs, 'LIBZ=' . (quotify("perl", $zlib))[0];
78a50c75
AP
137 }
138 return [ @defs ];
139 },
98fdbce0
RL
140 ex_libs =>
141 sub {
12e96a23 142 my @libs = ();
98fdbce0
RL
143 unless ($disabled{zlib}) {
144 if (defined($disabled{"zlib-dynamic"})) {
12e96a23
TS
145 push(@libs, $withargs{zlib_lib} // "ZLIB1");
146 }
147 }
caf9317d
TS
148 unless ($disabled{zstd}) {
149 if (defined($disabled{"zstd-dynamic"})) {
150 push(@libs, $withargs{zstd_lib} // "libzstd");
151 }
152 }
12e96a23
TS
153 unless ($disabled{brotli}) {
154 if (defined($disabled{"brotli-dynamic"})) {
155 my $path = "";
156 if (defined($withargs{brotli_lib})) {
157 $path = $withargs{brotli_lib} . "\\";
158 }
159 push(@libs, $path . "brotlicommon.lib");
160 push(@libs, $path . "brotlidec.lib");
161 push(@libs, $path . "brotlienc.lib");
98fdbce0
RL
162 }
163 }
12e96a23 164 return join(" ", @libs);
475592e2 165 },
98fdbce0 166
abe256e7
RL
167 MT => "mt",
168 MTFLAGS => "-nologo",
755542cb
RL
169 mtinflag => "-manifest ",
170 mtoutflag => "-outputresource:",
2fe73036
RL
171
172 build_file => "makefile",
173 build_scheme => [ "unified", "windows" ],
95768961
RL
174
175 perl_platform => 'Windows',
d2b2221a
RL
176 },
177
178 BASE_VMS => {
179 inherit_from => [ "BASE_common" ],
180 template => 1,
181
368297d1
RL
182 includes =>
183 add(sub {
184 my @incs = ();
185 # GNV$ZLIB_INCLUDE is the standard logical name for later
186 # zlib incarnations.
187 push @incs, 'GNV$ZLIB_INCLUDE:'
188 if !$disabled{zlib} && !$withargs{zlib_include};
189 return [ @incs ];
190 }),
191
d2b2221a
RL
192 build_file => "descrip.mms",
193 build_scheme => [ "unified", "VMS" ],
c162a8c3
RL
194
195 perl_platform => 'VMS',
9e0724a1 196 },
9e0724a1 197);