]>
Commit | Line | Data |
---|---|---|
e84193e4 RL |
1 | ## descrip.mms to build OpenSSL on OpenVMS |
2 | ## | |
3 | ## {- join("\n## ", @autowarntext) -} | |
4 | {- | |
5 | use File::Spec::Functions qw/:DEFAULT abs2rel rel2abs/; | |
bbb9413b | 6 | use File::Basename; |
da51dc5f | 7 | use OpenSSL::Util; |
e84193e4 | 8 | |
c162a8c3 | 9 | (our $osslprefix_q = platform->osslprefix()) =~ s/\$/\\\$/; |
e84193e4 | 10 | |
c162a8c3 | 11 | our $sover_dirname = platform->shlib_version_as_filename(); |
bc0ac164 | 12 | our $osslver = sprintf "%02d", split(/\./, $config{version}); |
e8fb1295 | 13 | |
e84193e4 RL |
14 | our $sourcedir = $config{sourcedir}; |
15 | our $builddir = $config{builddir}; | |
0cbb6f6a RL |
16 | sub make_unix_path { |
17 | # Split the native path | |
18 | (my $vol, my $dirs, my $file) = File::Spec->splitpath($_[0]); | |
19 | my @dirs = File::Spec->splitdir($dirs); | |
20 | ||
21 | # Reassemble it as a Unix path | |
22 | $vol =~ s|:$||; | |
23 | return File::Spec::Unix->catpath( | |
24 | '', File::Spec::Unix->catdir('', $vol ? $vol : (), @dirs), $file); | |
25 | } | |
e84193e4 RL |
26 | sub sourcefile { |
27 | catfile($sourcedir, @_); | |
28 | } | |
29 | sub buildfile { | |
30 | catfile($builddir, @_); | |
31 | } | |
32 | sub sourcedir { | |
33 | catdir($sourcedir, @_); | |
34 | } | |
35 | sub builddir { | |
36 | catdir($builddir, @_); | |
37 | } | |
38 | sub tree { | |
39 | (my $x = shift) =~ s|\]$|...]|; | |
40 | $x | |
41 | } | |
e84193e4 | 42 | |
4813ad2d RL |
43 | # Because we need to make two computations of these data, |
44 | # we store them in arrays for reuse | |
33105818 | 45 | our @libs = |
c162a8c3 | 46 | map { platform->staticname($_) } |
33105818 RL |
47 | @{$unified_info{libraries}}; |
48 | our @shlibs = | |
c162a8c3 RL |
49 | map { platform->sharedname($_) // () } |
50 | @{$unified_info{libraries}}; | |
33105818 | 51 | our @install_libs = |
c162a8c3 | 52 | map { platform->staticname($_) } |
285daccd | 53 | grep { !$unified_info{attributes}->{libraries}->{$_}->{noinst} } |
ac6bba6f | 54 | @{$unified_info{libraries}}; |
33105818 | 55 | our @install_shlibs = |
c162a8c3 | 56 | map { platform->sharedname($_) // () } |
285daccd | 57 | grep { !$unified_info{attributes}->{libraries}->{$_}->{noinst} } |
ac6bba6f RL |
58 | @{$unified_info{libraries}}; |
59 | our @install_engines = | |
285daccd RL |
60 | grep { !$unified_info{attributes}->{modules}->{$_}->{noinst} |
61 | && $unified_info{attributes}->{modules}->{$_}->{engine} } | |
1842f369 | 62 | @{$unified_info{modules}}; |
41149648 RL |
63 | our @install_modules = |
64 | grep { !$unified_info{attributes}->{modules}->{$_}->{noinst} | |
f5657ce8 RL |
65 | && !$unified_info{attributes}->{modules}->{$_}->{engine} |
66 | && !$unified_info{attributes}->{modules}->{$_}->{fips} } | |
67 | @{$unified_info{modules}}; | |
68 | our @install_fipsmodules = | |
69 | grep { !$unified_info{attributes}->{modules}->{$_}->{noinst} | |
70 | && $unified_info{attributes}->{modules}->{$_}->{fips} } | |
41149648 | 71 | @{$unified_info{modules}}; |
ac6bba6f | 72 | our @install_programs = |
285daccd | 73 | grep { !$unified_info{attributes}->{programs}->{$_}->{noinst} } |
ac6bba6f | 74 | @{$unified_info{programs}}; |
994e86a9 | 75 | our @install_bin_scripts = |
285daccd RL |
76 | grep { !$unified_info{attributes}->{scripts}->{$_}->{noinst} |
77 | && !$unified_info{attributes}->{scripts}->{$_}->{misc} } | |
994e86a9 RL |
78 | @{$unified_info{scripts}}; |
79 | our @install_misc_scripts = | |
285daccd RL |
80 | grep { !$unified_info{attributes}->{scripts}->{$_}->{noinst} |
81 | && $unified_info{attributes}->{scripts}->{$_}->{misc} } | |
994e86a9 | 82 | @{$unified_info{scripts}}; |
4813ad2d | 83 | |
cfc73c23 RL |
84 | # Configured flags |
85 | ||
86 | our @cnf_asflags = ($target{asflags} || (), @{$config{asflags}}); | |
87 | our @cnf_defines = (@{$target{defines}}, @{$config{defines}}); | |
88 | our @cnf_includes = (@{$target{includes}}, @{$config{includes}}); | |
89 | our @cnf_cppflags = ($target{cppflags} || (), @{$config{cppflags}}); | |
90 | our @cnf_cflags = ($target{cflags} || (), @{$config{cflags}}); | |
91 | our @cnf_cxxflags = ($target{cxxflags} || (), @{$config{cxxflags}}); | |
92 | our @cnf_ldflags = ($target{lflags} || (), @{$config{lflags}}); | |
93 | our @cnf_ex_libs = (map{ ",$_" } @{$target{ex_libs}}, @{$config{ex_libs}}); | |
94 | ||
95 | # Variables starting with $lib_ are used to build library object files | |
96 | # and shared libraries. | |
97 | # Variables starting with $dso_ are used to build DSOs and their object files. | |
98 | # Variables starting with $bin_ are used to build programs and their object | |
99 | # files. | |
100 | ||
101 | # The following array is special and is treated separately from the rest of | |
102 | # the lib_ variables. | |
103 | our @lib_cppincludes = (@{$target{lib_includes}}, @{$target{shared_includes}}, | |
104 | @{$config{lib_includes}}, @{$config{shared_includes}}, | |
105 | @cnf_includes); | |
106 | ||
107 | our $lib_cppdefines = | |
108 | join(',', @{$target{lib_defines}}, @{$target{shared_defines}}, | |
109 | @{$config{lib_defines}}, @{$config{shared_defines}}, | |
110 | @cnf_defines, | |
111 | 'OPENSSLDIR="""$(OPENSSLDIR_C)"""', | |
112 | 'ENGINESDIR="""$(ENGINESDIR_C)"""', | |
2f9ded52 | 113 | 'MODULESDIR="""$(MODULESDIR_C)"""' |
cfc73c23 | 114 | ) |
2f9ded52 | 115 | . '$(DEFINES)' |
cfc73c23 RL |
116 | . "'extradefines'"; |
117 | our $lib_asflags = | |
118 | join(' ', $target{lib_asflags} || (), @{$config{lib_asflags}}, | |
119 | @cnf_asflags, '$(ASFLAGS)'); | |
120 | our $lib_cppflags = | |
121 | join('', $target{lib_cppflags} || (), $target{shared_cppflags} || (), | |
122 | @{$config{lib_cppflags}}, @{$config{shared_cppflag}}, | |
123 | @cnf_cppflags, '/DEFINE=('.$lib_cppdefines.')', '$(CPPFLAGS)'); | |
124 | my @lib_cflags = ( $target{lib_cflags} // () ); | |
125 | my @lib_cflags_no_inst = ( $target{no_inst_lib_cflags} // @lib_cflags ); | |
126 | my @lib_cflags_cont = ( $target{shared_cflag} || (), | |
127 | @{$config{lib_cflags}}, @{$config{shared_cflag}}, | |
128 | $cnf_cflags, '$(CFLAGS)'); | |
129 | our $lib_cflags = join('', @lib_cflags, @lib_cflags_cont ); | |
130 | our $lib_cflags_no_inst = join('', @lib_cflags_no_inst, @lib_cflags_cont ); | |
131 | our $lib_ldflags = | |
132 | join('', $target{lib_lflags} || (), $target{shared_ldflag} || (), | |
133 | @{$config{lib_lflags}}, @{$config{shared_ldflag}}, | |
134 | @cnf_ldflags, '$(LDFLAGS)'); | |
135 | our $lib_ex_libs = join('', @cnf_ex_libs, '$(EX_LIBS)'); | |
136 | ||
137 | # The following array is special and is treated separately from the rest of | |
138 | # the dso_ variables. | |
139 | our @dso_cppincludes = (@{$target{dso_includes}}, @{$target{module_includes}}, | |
140 | @{$config{dso_includes}}, @{$config{module_includes}}, | |
141 | @cnf_includes); | |
142 | ||
143 | our $dso_cppdefines = | |
144 | join(',', @{$target{dso_defines}}, @{$target{module_defines}}, | |
145 | @{$config{dso_defines}}, @{$config{module_defines}}, | |
146 | @cnf_defines, | |
cfc73c23 | 147 | ) |
2f9ded52 | 148 | . '$(DEFINES)' |
cfc73c23 RL |
149 | . "'extradefines'"; |
150 | our $dso_asflags = | |
151 | join(' ', $target{dso_asflags} || (), $target{module_asflags} || (), | |
152 | @{$config{dso_asflags}}, @{$config{module_asflags}}, | |
153 | @cnf_asflags, '$(ASFLAGS)'); | |
154 | our $dso_cppflags = | |
155 | join('', $target{dso_cppflags} || (), $target{module_cppflags} || (), | |
156 | @{$config{dso_cppflags}}, @{$config{module_cppflag}}, | |
157 | @cnf_cppflags, | |
158 | '/DEFINE=('.$dso_cppdefines.')', | |
159 | '$(CPPFLAGS)'); | |
160 | my @dso_cflags = ( $target{dso_cflags} // () ); | |
161 | my @dso_cflags_no_inst = ( $target{no_inst_dso_cflags} // @dso_cflags ); | |
162 | my @dso_cflags_cont = ( $target{module_cflag} || (), | |
163 | @{$config{dso_cflags}}, @{$config{module_cflag}}, | |
164 | $cnf_cflags, '$(CFLAGS)'); | |
165 | our $dso_cflags = join('', @dso_cflags, @dso_cflags_cont ); | |
166 | our $dso_cflags_no_inst = join('', @dso_cflags_no_inst, @dso_cflags_cont ); | |
167 | our $dso_ldflags = | |
168 | join('', $target{dso_lflags} || (), $target{module_ldflag} || (), | |
169 | @{$config{dso_lflags}}, @{$config{module_ldflag}}, | |
170 | @cnf_ldflags, '$(LDFLAGS)'); | |
171 | our $dso_ex_libs = join('', @cnf_ex_libs, '$(EX_LIBS)'); | |
172 | ||
173 | # The following array is special and is treated separately from the rest of | |
174 | # the bin_ variables. | |
175 | our @bin_cppincludes = (@{$target{bin_includes}}, | |
176 | @{$config{bin_includes}}, | |
177 | @cnf_includes); | |
178 | ||
179 | our $bin_cppdefines = | |
180 | join(',', @{$target{bin_defines}}, | |
181 | @{$config{bin_defines}}, | |
182 | @cnf_defines, | |
cfc73c23 | 183 | ) |
2f9ded52 | 184 | . '$(DEFINES)' |
cfc73c23 RL |
185 | . "'extradefines'"; |
186 | our $bin_asflags = | |
187 | join(' ', $target{bin_asflags} || (), | |
188 | @{$config{bin_asflags}}, | |
189 | @cnf_asflags, '$(ASFLAGS)'); | |
190 | our $bin_cppflags = | |
191 | join('', $target{bin_cppflags} || (), | |
192 | @{$config{bin_cppflags}}, | |
193 | @cnf_cppflags, | |
194 | '/DEFINE=('.$bin_cppdefines.')', | |
195 | '$(CPPFLAGS)'); | |
196 | my @bin_cflags = ( $target{bin_cflags} // () ); | |
197 | my @bin_cflags_no_inst = ( $target{no_inst_bin_cflags} // @bin_cflags ); | |
198 | my @bin_cflags_cont = ( @{$config{bin_cflags}}, | |
199 | $cnf_cflags, '$(CFLAGS)'); | |
200 | our $bin_cflags = join('', @bin_cflags, @bin_cflags_cont ); | |
201 | our $bin_cflags_no_inst = join('', @bin_cflags_no_inst, @bin_cflags_cont ); | |
202 | our $bin_cflags = | |
203 | join('', $target{bin_cflags} || (), | |
204 | @{$config{bin_cflags}}, | |
205 | @cnf_cflags, '$(CFLAGS)'); | |
206 | our $bin_ldflags = | |
207 | join('', $target{bin_lflags} || (), | |
208 | @{$config{bin_lflags}}, | |
209 | @cnf_ldflags, '$(LDFLAGS)'); | |
210 | our $bin_ex_libs = join('', @cnf_ex_libs, '$(EX_LIBS)'); | |
211 | ||
3c4e250e RL |
212 | # These are horrible hacks, but are needed because recursive inclusion of |
213 | # files in different directories does not work well with VMS C. We try to | |
214 | # help by specifying extra relative directories. They must always be in Unix | |
215 | # format, relative to the directory where the .c file is located. The logic | |
216 | # is that any inclusion, merged with one of these relative directories, will | |
217 | # find the requested inclusion file. | |
e84193e4 | 218 | foreach (grep /\[\.crypto\.async\.arch\].*\.o$/, keys %{$unified_info{sources}}) { |
c162a8c3 | 219 | my $obj = platform->obj($_); |
1b77f00a | 220 | push @{$unified_info{includes_extra}->{$obj}}, qw(../); |
e84193e4 | 221 | } |
1b77f00a | 222 | foreach (grep /\[\.crypto\.ec\.curve448\].*?\.o$/, keys %{$unified_info{sources}}) { |
8ba3a158 | 223 | my $obj = platform->obj($_); |
1b77f00a | 224 | push @{$unified_info{includes_extra}->{$obj}}, qw(./arch_32 ./arch64); |
8ba3a158 | 225 | } |
1b77f00a | 226 | foreach (grep /\[\.crypto\.ec\.curve448.arch_(?:32|64)\].*?\.o$/, keys %{$unified_info{sources}}) { |
c162a8c3 | 227 | my $obj = platform->obj($_); |
1b77f00a RL |
228 | push @{$unified_info{includes_extra}->{$obj}}, qw(../); |
229 | } | |
a9c474dc RL |
230 | foreach (grep /\[\.ssl\].*?\.o$/, keys %{$unified_info{sources}}) { |
231 | my $obj = platform->obj($_); | |
ae08ed08 RL |
232 | # Most of the files in [.ssl] include "ssl_local.h" which includes things |
233 | # like "record/record.h". Adding "./" as an inclusion directory helps | |
234 | # making this sort of header from these directories. | |
a9c474dc RL |
235 | push @{$unified_info{includes_extra}->{$obj}}, qw(./); |
236 | } | |
ae08ed08 RL |
237 | foreach (grep /\[\.ssl\].*?ssl_lib\.o$/, keys %{$unified_info{sources}}) { |
238 | my $obj = platform->obj($_); | |
239 | # Some files in [.ssl] include "quic/quic_local.h", which in turn | |
240 | # includes "../ssl_local.h". Adding "./quic" as an inclusion directory | |
241 | # helps making this sort of header from these directories. | |
242 | push @{$unified_info{includes_extra}->{$obj}}, qw(./quic); | |
243 | } | |
1b77f00a RL |
244 | foreach (grep /\[\.ssl\.(?:record|statem)\].*?\.o$/, keys %{$unified_info{sources}}) { |
245 | my $obj = platform->obj($_); | |
246 | # Most of the files in [.ssl.record] and [.ssl.statem] include | |
247 | # "../ssl_local.h", which includes things like "record/record.h". | |
248 | # Adding "../" as an inclusion directory helps making this sort of header | |
249 | # from these directories. | |
250 | push @{$unified_info{includes_extra}->{$obj}}, qw(../); | |
251 | ||
252 | } | |
a9c474dc RL |
253 | foreach (grep /\[\.ssl\.record\.methods\].*?\.o$/, keys %{$unified_info{sources}}) { |
254 | my $obj = platform->obj($_); | |
255 | # Most of the files in [.ssl.record.methods] include "../../ssl_local.h" | |
256 | # which includes things like "record/record.h". Adding "../../" as an | |
257 | # inclusion directory helps making this sort of header from these | |
258 | # directories. | |
259 | push @{$unified_info{includes_extra}->{$obj}}, qw(../../); | |
260 | } | |
1b77f00a RL |
261 | foreach (grep /\[\.test\].*?\.o$/, keys %{$unified_info{sources}}) { |
262 | my $obj = platform->obj($_); | |
263 | push @{$unified_info{includes_extra}->{$obj}}, qw(../ssl ./helpers); | |
3c4e250e RL |
264 | # Some of the sources in [.test] also include headers like |
265 | # "../ssl/record/methods/recmethod_local.h", which in turn might include | |
266 | # "../../ssl_local.h", so these object files need yet another hack. | |
267 | # We could make this specific to just the object files that are affected | |
268 | # directly, but that would end up with more whack-a-mole of this sort, so | |
269 | # nah, we do it broadly. | |
270 | push @{$unified_info{includes_extra}->{$obj}}, qw(../ssl/record/methods); | |
1b77f00a RL |
271 | } |
272 | foreach (grep /\[\.test\.helpers\].*?\.o$/, keys %{$unified_info{sources}}) { | |
273 | my $obj = platform->obj($_); | |
274 | push @{$unified_info{includes_extra}->{$obj}}, qw(../../ssl); | |
e84193e4 | 275 | } |
cfc73c23 | 276 | |
75726420 RL |
277 | # This makes sure things get built in the order they need |
278 | # to. You're welcome. | |
279 | sub dependmagic { | |
280 | my $target = shift; | |
281 | ||
984cf15e | 282 | return "$target : build_generated\n\t\pipe \$(MMS) \$(MMSQUALIFIERS) depend && \$(MMS) \$(MMSQUALIFIERS) _$target\n_$target"; |
75726420 | 283 | } |
e84193e4 RL |
284 | ""; |
285 | -} | |
286 | PLATFORM={- $config{target} -} | |
287 | OPTIONS={- $config{options} -} | |
288 | CONFIGURE_ARGS=({- join(", ",quotify_l(@{$config{perlargv}})) -}) | |
289 | SRCDIR={- $config{sourcedir} -} | |
b867c707 | 290 | BLDDIR={- $config{builddir} -} |
31214258 | 291 | FIPSKEY={- $config{FIPSKEY} -} |
e84193e4 | 292 | |
e8173157 RL |
293 | # Allow both V and VERBOSE to indicate verbosity. This only applies |
294 | # to testing. | |
295 | VERBOSE=$(V) | |
e3d9a6b5 | 296 | VERBOSE_FAILURE=$(VF) |
e8173157 | 297 | |
16942e08 | 298 | VERSION={- "$config{full_version}" -} |
435981cb | 299 | VERSION_NUMBER={- "$config{version}" -} |
e84193e4 RL |
300 | MAJOR={- $config{major} -} |
301 | MINOR={- $config{minor} -} | |
3a63dbef | 302 | SHLIB_VERSION_NUMBER={- $config{shlib_version} -} |
e84193e4 RL |
303 | SHLIB_TARGET={- $target{shared_target} -} |
304 | ||
33105818 | 305 | LIBS={- join(", ", map { "-\n\t".$_.".OLB" } @libs) -} |
4813ad2d | 306 | SHLIBS={- join(", ", map { "-\n\t".$_.".EXE" } @shlibs) -} |
a2405c5f RL |
307 | MODULES={- join(", ", map { "-\n\t".$_.".EXE" } |
308 | # Drop all modules that are dependencies, they will | |
309 | # be processed through their dependents | |
310 | grep { my $x = $_; | |
311 | !grep { grep { $_ eq $x } @$_ } | |
312 | values %{$unified_info{depends}} } | |
313 | @{$unified_info{modules}}) -} | |
314 | FIPSMODULE={- # We do some extra checking here, as there should be only one | |
315 | use File::Basename; | |
316 | our @fipsmodules = | |
317 | grep { !$unified_info{attributes}->{modules}->{$_}->{noinst} | |
318 | && $unified_info{attributes}->{modules}->{$_}->{fips} } | |
319 | @{$unified_info{modules}}; | |
320 | die "More that one FIPS module" if scalar @fipsmodules > 1; | |
321 | join(" ", map { platform->dso($_) } @fipsmodules) -} | |
322 | FIPSMODULENAME={- die "More that one FIPS module" if scalar @fipsmodules > 1; | |
c9b0214e | 323 | join(", ", map { basename(platform->dso($_)) } @fipsmodules) -} |
1e3d16b0 | 324 | PROGRAMS={- join(", ", map { "-\n\t".$_.".EXE" } @{$unified_info{programs}}) -} |
e84193e4 | 325 | SCRIPTS={- join(", ", map { "-\n\t".$_ } @{$unified_info{scripts}}) -} |
952a9d1a | 326 | {- output_off() if $disabled{makedepend}; "" -} |
c162a8c3 | 327 | DEPS={- our @deps = map { platform->isobj($_) ? platform->dep($_) : $_ } |
c058fcd7 RL |
328 | grep { $unified_info{sources}->{$_}->[0] =~ /\.c$/ } |
329 | keys %{$unified_info{sources}}; | |
330 | join(", ", map { "-\n\t".$_ } @deps); -} | |
952a9d1a | 331 | {- output_on() if $disabled{makedepend}; "" -} |
22119050 RL |
332 | GENERATED_MANDATORY={- join(", ", |
333 | map { "-\n\t".$_ } @{$unified_info{depends}->{""}} ) -} | |
334 | GENERATED_PODS={- # common0.tmpl provides @generated | |
335 | join(", ", | |
336 | map { my $x = $_; | |
337 | ( | |
338 | grep { | |
339 | $unified_info{attributes}->{depends} | |
340 | ->{$x}->{$_}->{pod} // 0 | |
341 | } | |
342 | keys %{$unified_info{attributes}->{depends}->{$x}} | |
343 | ) ? "-\n\t".$x : (); | |
344 | } | |
345 | @generated) -} | |
8258975c | 346 | GENERATED={- # common0.tmpl provides @generated |
c162a8c3 | 347 | join(", ", map { platform->convertext($_) } @generated) -} |
7cae3864 | 348 | |
33105818 | 349 | INSTALL_LIBS={- join(", ", map { "-\n\t".$_.".OLB" } @install_libs) -} |
0f01b7bc | 350 | INSTALL_SHLIBS={- join(", ", map { "-\n\t".$_.".EXE" } @install_shlibs) -} |
ac6bba6f | 351 | INSTALL_ENGINES={- join(", ", map { "-\n\t".$_.".EXE" } @install_engines) -} |
41149648 | 352 | INSTALL_MODULES={- join(", ", map { "-\n\t".$_.".EXE" } @install_modules) -} |
f5657ce8 RL |
353 | INSTALL_FIPSMODULE={- join(", ", map { "-\n\t".$_.".EXE" } @install_fipsmodules) -} |
354 | INSTALL_FIPSMODULECONF=[.providers]fipsmodule.cnf | |
ac6bba6f | 355 | INSTALL_PROGRAMS={- join(", ", map { "-\n\t".$_.".EXE" } @install_programs) -} |
994e86a9 RL |
356 | BIN_SCRIPTS={- join(", ", @install_bin_scripts) -} |
357 | MISC_SCRIPTS={- join(", ", @install_misc_scripts) -} | |
b0940b33 RL |
358 | HTMLDOCS1={- join(", ", map { "-\n\t".$_ } @{$unified_info{htmldocs}->{man1}}) -} |
359 | HTMLDOCS3={- join(", ", map { "-\n\t".$_ } @{$unified_info{htmldocs}->{man3}}) -} | |
360 | HTMLDOCS5={- join(", ", map { "-\n\t".$_ } @{$unified_info{htmldocs}->{man5}}) -} | |
361 | HTMLDOCS7={- join(", ", map { "-\n\t".$_ } @{$unified_info{htmldocs}->{man7}}) -} | |
e84193e4 | 362 | |
a3f1fc25 RL |
363 | APPS_OPENSSL="{- use File::Spec::Functions; |
364 | catfile("apps","openssl") -}" | |
6a74806e | 365 | |
3c65577f | 366 | # DESTDIR is for package builders so that they can configure for, say, |
e84193e4 RL |
367 | # SYS$COMMON:[OPENSSL] and yet have everything installed in STAGING:[USER]. |
368 | # In that case, configure with --prefix=SYS$COMMON:[OPENSSL] and then run | |
3c65577f RL |
369 | # MMS with /MACROS=(DESTDIR=STAGING:[USER]). The result will end up in |
370 | # STAGING:[USER.OPENSSL]. | |
e84193e4 | 371 | # Normally it is left empty. |
3c65577f | 372 | DESTDIR= |
e84193e4 RL |
373 | |
374 | # Do not edit this manually. Use Configure --prefix=DIR to change this! | |
e8fb1295 RL |
375 | INSTALLTOP={- our $installtop = |
376 | catdir($config{prefix}) || "SYS\$COMMON:[OPENSSL]"; | |
40ea24b0 RL |
377 | $installtop -} |
378 | SYSTARTUP={- catdir($installtop, '[.SYS$STARTUP]'); -} | |
e84193e4 | 379 | # This is the standard central area to store certificates, private keys... |
661a3963 | 380 | OPENSSLDIR={- catdir($config{openssldir}) or |
667c6bfe RL |
381 | $config{prefix} ? catdir($config{prefix},"COMMON") |
382 | : "SYS\$COMMON:[OPENSSL-COMMON]" -} | |
afea0067 | 383 | # The same, but for C |
c162a8c3 | 384 | OPENSSLDIR_C={- platform->osslprefix() -}DATAROOT:[000000] |
1842f369 | 385 | # Where installed ENGINE modules reside, for C |
c162a8c3 | 386 | ENGINESDIR_C={- platform->osslprefix() -}ENGINES{- $sover_dirname.$target{pointer_size} -}: |
3f4e8d66 | 387 | # Where modules reside, for C |
a3a79ab3 | 388 | MODULESDIR_C={- platform->osslprefix() -}MODULES{- $target{pointer_size} -}: |
e84193e4 | 389 | |
abe256e7 RL |
390 | ##### User defined commands and flags ################################ |
391 | ||
392 | CC={- $config{CC} -} | |
393 | CPP={- $config{CPP} -} | |
cfc73c23 | 394 | DEFINES={- our $defines = join('', map { ",$_" } @{$config{CPPDEFINES}}) -} |
0cbb6f6a | 395 | #INCLUDES={- our $includes = join(',', @{$config{CPPINCLUDES}}) -} |
cfc73c23 | 396 | CPPFLAGS={- our $cppflags = join('', @{$config{CPPFLAGS}}) -} |
abe256e7 RL |
397 | CFLAGS={- join('', @{$config{CFLAGS}}) -} |
398 | LDFLAGS={- join('', @{$config{LFLAGS}}) -} | |
399 | EX_LIBS={- join('', map { ",$_" } @{$config{LDLIBS}}) -} | |
e84193e4 | 400 | |
9e265322 | 401 | PERL={- $config{PERL} -} |
e84193e4 | 402 | |
abe256e7 RL |
403 | AS={- $config{AS} -} |
404 | ASFLAGS={- join(' ', @{$config{ASFLAGS}}) -} | |
405 | ||
406 | ##### Special command flags ########################################## | |
407 | ||
ab7134ef | 408 | ASOUTFLAG={- $target{asoutflag} -}$(OSSL_EMPTY) |
abe256e7 | 409 | |
ab7134ef | 410 | PERLASM_SCHEME={- $target{perlasm_scheme} -} |
e84193e4 | 411 | |
abe256e7 | 412 | # CPPFLAGS_Q is used for one thing only: to build up buildinf.h |
cfc73c23 RL |
413 | CPPFLAGS_Q={- (my $c = $lib_cppflags.$cppflags) =~ s|"|""|g; |
414 | (my $d = $lib_cppdefines) =~ s|"|""|g; | |
415 | my $i = join(',', @lib_cppincludes || (), '$(INCLUDES)'); | |
abe256e7 RL |
416 | my $x = $c; |
417 | $x .= "/INCLUDE=($i)" if $i; | |
418 | $x .= "/DEFINE=($d)" if $d; | |
419 | $x; -} | |
420 | ||
e84193e4 | 421 | # .FIRST and .LAST are special targets with MMS and MMK. |
e84193e4 RL |
422 | NODEBUG=@ |
423 | .FIRST : | |
6929c8fb RL |
424 | {- join( "\n \$(NODEBUG) ", @{ $target{setup_commands} // [] }, |
425 | '!' ) -} | |
22119050 | 426 | $(NODEBUG) sourcetop = F$PARSE("$(SRCDIR)","[]A.;",,,"SYNTAX_ONLY,NO_CONCEAL") - ".][000000" - "[000000." - "][" - "]A.;" + ".]" |
c3845ceb RL |
427 | $(NODEBUG) DEFINE ossl_sourceroot 'sourcetop' |
428 | $(NODEBUG) ! | |
3c65577f | 429 | $(NODEBUG) staging_dir = "$(DESTDIR)" |
6bd1ef90 RL |
430 | $(NODEBUG) staging_instdir = "" |
431 | $(NODEBUG) staging_datadir = "" | |
e84193e4 | 432 | $(NODEBUG) IF staging_dir .NES. "" THEN - |
6bd1ef90 RL |
433 | staging_instdir = F$PARSE("A.;",staging_dir,"[]",,"SYNTAX_ONLY") |
434 | $(NODEBUG) IF staging_instdir - "]A.;" .NES. staging_instdir THEN - | |
435 | staging_instdir = staging_instdir - "]A.;" + ".OPENSSL-INSTALL]" | |
436 | $(NODEBUG) IF staging_instdir - "A.;" .NES. staging_instdir THEN - | |
437 | staging_instdir = staging_instdir - "A.;" + "[OPENSSL-INSTALL]" | |
438 | $(NODEBUG) IF staging_dir .NES. "" THEN - | |
439 | staging_datadir = F$PARSE("A.;",staging_dir,"[]",,"SYNTAX_ONLY") | |
440 | $(NODEBUG) IF staging_datadir - "]A.;" .NES. staging_datadir THEN - | |
441 | staging_datadir = staging_datadir - "]A.;" + ".OPENSSL-COMMON]" | |
442 | $(NODEBUG) IF staging_datadir - "A.;" .NES. staging_datadir THEN - | |
443 | staging_datadir = staging_datadir - "A.;" + "[OPENSSL-COMMON]" | |
e84193e4 RL |
444 | $(NODEBUG) ! |
445 | $(NODEBUG) ! Installation logical names | |
446 | $(NODEBUG) ! | |
d8c1cafb RL |
447 | $(NODEBUG) ! This also creates a few DCL variables that are used for |
448 | $(NODEBUG) ! the "install_msg" target. | |
449 | $(NODEBUG) ! | |
450 | $(NODEBUG) installroot = F$PARSE(staging_instdir,"$(INSTALLTOP)","[]A.;",,"SYNTAX_ONLY,NO_CONCEAL") - ".][000000" - "[000000." - "][" - "]A.;" | |
451 | $(NODEBUG) installtop = installroot + ".]" | |
452 | $(NODEBUG) dataroot = F$PARSE(staging_datadir,"$(OPENSSLDIR)","[]A.;",,"SYNTAX_ONLY,NO_CONCEAL") - ".][000000" - "[000000." - "][" - "]A.;" | |
453 | $(NODEBUG) datatop = dataroot + ".]" | |
6bd1ef90 RL |
454 | $(NODEBUG) DEFINE ossl_installroot 'installtop' |
455 | $(NODEBUG) DEFINE ossl_dataroot 'datatop' | |
e84193e4 | 456 | $(NODEBUG) ! |
0cbb6f6a RL |
457 | $(NODEBUG) ! Override disturbing system logicals. We can't deassign |
458 | $(NODEBUG) ! them, so we create it instead. This is an unfortunate | |
459 | $(NODEBUG) ! necessity. | |
460 | $(NODEBUG) ! | |
1b9fbae6 RL |
461 | $(NODEBUG) openssl_inc1 = F$PARSE("[.include.openssl]","A.;",,,"syntax_only") - "A.;" |
462 | $(NODEBUG) openssl_inc2 = F$PARSE("sourcetop:[include.openssl]","A.;",,,"SYNTAX_ONLY") - "A.;" | |
463 | $(NODEBUG) DEFINE openssl 'openssl_inc1','openssl_inc2' | |
0cbb6f6a | 464 | $(NODEBUG) ! |
e84193e4 RL |
465 | $(NODEBUG) ! Figure out the architecture |
466 | $(NODEBUG) ! | |
3ee24d4a | 467 | $(NODEBUG) arch = f$edit( f$getsyi( "arch_name"), "upcase") |
e84193e4 RL |
468 | $(NODEBUG) ! |
469 | $(NODEBUG) ! Set up logical names for the libraries, so LINK and | |
470 | $(NODEBUG) ! running programs can use them. | |
471 | $(NODEBUG) ! | |
33105818 | 472 | $(NODEBUG) {- join("\n\t\$(NODEBUG) ", map { "DEFINE ".uc($_)." 'F\$ENV(\"DEFAULT\")'".uc($_)."\$(SHLIB_EXT)" } @shlibs) || "!" -} |
e84193e4 RL |
473 | |
474 | .LAST : | |
33105818 | 475 | $(NODEBUG) {- join("\n\t\$(NODEBUG) ", map { "DEASSIGN ".uc($_) } @shlibs) || "!" -} |
1b9fbae6 | 476 | $(NODEBUG) DEASSIGN openssl |
6bd1ef90 | 477 | $(NODEBUG) DEASSIGN ossl_dataroot |
e84193e4 | 478 | $(NODEBUG) DEASSIGN ossl_installroot |
1b9fbae6 | 479 | $(NODEBUG) DEASSIGN ossl_sourceroot |
e84193e4 RL |
480 | .DEFAULT : |
481 | @ ! MMS cannot handle no actions... | |
482 | ||
483 | # The main targets ################################################### | |
484 | ||
0eed845c | 485 | {- dependmagic('build_sw'); -} : build_libs_nodep, build_modules_nodep, build_programs_nodep |
75726420 | 486 | {- dependmagic('build_libs'); -} : build_libs_nodep |
1842f369 | 487 | {- dependmagic('build_modules'); -} : build_modules_nodep |
75726420 | 488 | {- dependmagic('build_programs'); -} : build_programs_nodep |
c058fcd7 | 489 | |
22119050 RL |
490 | build_generated_pods : $(GENERATED_PODS) |
491 | build_docs : build_html_docs | |
492 | build_html_docs : $(HTMLDOCS1) $(HTMLDOCS3) $(HTMLDOCS5) $(HTMLDOCS7) | |
493 | ||
75726420 | 494 | build_generated : $(GENERATED_MANDATORY) |
8478a703 | 495 | build_libs_nodep : $(LIBS), $(SHLIBS) |
1842f369 | 496 | build_modules_nodep : $(MODULES) |
1e3d16b0 | 497 | build_programs_nodep : $(PROGRAMS), $(SCRIPTS) |
c058fcd7 | 498 | |
1e3d16b0 RL |
499 | # Kept around for backward compatibility |
500 | build_apps build_tests : build_programs | |
501 | ||
9b03b91b RL |
502 | # Convenience target to prebuild all generated files, not just the mandatory |
503 | # ones | |
b0940b33 | 504 | build_all_generated : $(GENERATED_MANDATORY) $(GENERATED) build_docs |
18d15882 AP |
505 | @ ! {- output_off() if $disabled{makedepend}; "" -} |
506 | @ WRITE SYS$OUTPUT "Warning: consider configuring with no-makedepend, because if" | |
507 | @ WRITE SYS$OUTPUT " target system doesn't have $(PERL)," | |
508 | @ WRITE SYS$OUTPUT " then make will fail..." | |
509 | @ ! {- output_on() if $disabled{makedepend}; "" -} | |
9b03b91b | 510 | |
b0940b33 RL |
511 | all : build_sw build_docs |
512 | ||
75726420 | 513 | test : tests |
0eed845c | 514 | {- dependmagic('tests'); -} : build_programs_nodep, build_modules_nodep run_tests |
22119050 | 515 | run_tests : |
d90a6beb | 516 | @ ! {- output_off() if $disabled{tests}; "" -} |
31214258 RS |
517 | DEFINE SRCTOP "$(SRCDIR)" |
518 | DEFINE BLDTOP "$(BLDDIR)" | |
519 | DEFINE FIPSKEY "$(FIPSKEY)" | |
e8173157 | 520 | IF "$(VERBOSE)" .NES. "" THEN DEFINE VERBOSE "$(VERBOSE)" |
e84193e4 RL |
521 | $(PERL) {- sourcefile("test", "run_tests.pl") -} $(TESTS) |
522 | DEASSIGN BLDTOP | |
523 | DEASSIGN SRCTOP | |
31214258 | 524 | DEASSIGN FIPSKEY |
d90a6beb MC |
525 | @ ! {- if ($disabled{tests}) { output_on(); } else { output_off(); } "" -} |
526 | @ WRITE SYS$OUTPUT "Tests are not supported with your chosen Configure options" | |
527 | @ ! {- output_on() if !$disabled{tests}; "" -} | |
e84193e4 RL |
528 | |
529 | list-tests : | |
4813ad2d | 530 | @ ! {- output_off() if $disabled{tests}; "" -} |
31214258 | 531 | @ DEFINE SRCTOP "$(SRCDIR)" |
4813ad2d RL |
532 | @ $(PERL) {- sourcefile("test", "run_tests.pl") -} list |
533 | @ DEASSIGN SRCTOP | |
534 | @ ! {- if ($disabled{tests}) { output_on(); } else { output_off(); } "" -} | |
535 | @ WRITE SYS$OUTPUT "Tests are not supported with your chosen Configure options" | |
536 | @ ! {- output_on() if !$disabled{tests}; "" -} | |
e84193e4 | 537 | |
25ab5424 | 538 | install : install_sw install_ssldirs install_docs {- $disabled{fips} ? "" : "install_fips" -} install_msg |
b0940b33 | 539 | |
d8c1cafb | 540 | install_msg : |
a8a421b1 RL |
541 | @ WRITE SYS$OUTPUT "" |
542 | @ WRITE SYS$OUTPUT "######################################################################" | |
543 | @ WRITE SYS$OUTPUT "" | |
687237e9 | 544 | @ IF "$(DESTDIR)" .EQS. "" THEN - |
72ddea9b | 545 | @{- sourcefile("VMS", "msg_install.com") -} "$(SYSTARTUP)" "{- $osslver -}" |
6bd1ef90 | 546 | @ IF "$(DESTDIR)" .NES. "" THEN - |
72ddea9b | 547 | @{- sourcefile("VMS", "msg_staging.com") -} - |
d8c1cafb RL |
548 | "''installroot']" "''dataroot']" "$(INSTALLTOP)" "$(OPENSSLDIR)" - |
549 | "$(SYSTARTUP)" "{- $osslver -}" | |
e84193e4 | 550 | |
3426de22 | 551 | check_install : |
e8fb1295 | 552 | spawn/nolog @ossl_installroot:[SYSTEST]openssl_ivp{- $osslver -}.com |
3426de22 | 553 | |
25ab5424 | 554 | uninstall : uninstall_docs uninstall_sw {- $disabled{fips} ? "" : "uninstall_fips" -} |
e84193e4 | 555 | |
4813ad2d | 556 | # Because VMS wants the generation number (or *) to delete files, we can't |
1842f369 | 557 | # use $(LIBS), $(PROGRAMS), $(GENERATED) and $(MODULES) directly. |
4813ad2d | 558 | libclean : |
33105818 | 559 | {- join("\n\t", map { "- DELETE $_.OLB;*" } @libs) || "@ !" -} |
81183680 | 560 | {- join("\n\t", map { "- DELETE $_.EXE;*,$_.MAP;*" } @shlibs) || "@ !" -} |
4813ad2d | 561 | |
e84193e4 | 562 | clean : libclean |
b0940b33 RL |
563 | {- join("\n\t", map { "- DELETE $_;*" } @{$unified_info{htmldocs}->{man1}}) || "@ !" -} |
564 | {- join("\n\t", map { "- DELETE $_;*" } @{$unified_info{htmldocs}->{man3}}) || "@ !" -} | |
565 | {- join("\n\t", map { "- DELETE $_;*" } @{$unified_info{htmldocs}->{man5}}) || "@ !" -} | |
566 | {- join("\n\t", map { "- DELETE $_;*" } @{$unified_info{htmldocs}->{man7}}) || "@ !" -} | |
1ae4c07e | 567 | {- join("\n\t", map { "- DELETE $_.EXE;*,$_.OPT;*" } @{$unified_info{programs}}) || "@ !" -} |
1842f369 | 568 | {- join("\n\t", map { "- DELETE $_.EXE;*,$_.OPT;*" } @{$unified_info{modules}}) || "@ !" -} |
4813ad2d | 569 | {- join("\n\t", map { "- DELETE $_;*" } @{$unified_info{scripts}}) || "@ !" -} |
90b3a620 | 570 | {- join("\n\t", map { "- DELETE $_;*" } @{$unified_info{depends}->{""}}) || "@ !" -} |
4813ad2d RL |
571 | {- join("\n\t", map { "- DELETE $_;*" } @generated) || "@ !" -} |
572 | - DELETE [...]*.MAP;* | |
573 | - DELETE [...]*.D;* | |
574 | - DELETE [...]*.OBJ;*,*.LIS;* | |
575 | - DELETE []CXX$DEMANGLER_DB.;* | |
576 | - DELETE [.VMS]openssl_startup.com;* | |
577 | - DELETE [.VMS]openssl_shutdown.com;* | |
578 | - DELETE []vmsconfig.pm;* | |
e84193e4 | 579 | |
7cae3864 | 580 | distclean : clean |
ef8040bc | 581 | - DELETE [.include.openssl]configuration.h;* |
7cae3864 RL |
582 | - DELETE configdata.pm;* |
583 | - DELETE descrip.mms;* | |
584 | ||
c058fcd7 | 585 | depend : descrip.mms |
952a9d1a | 586 | @ ! {- output_off() if $disabled{makedepend}; "" -} |
2e535eb5 | 587 | @ $(PERL) {- sourcefile("util", "add-depends.pl") -} "{- $config{makedep_scheme} -}" |
952a9d1a | 588 | @ ! {- output_on() if $disabled{makedepend}; "" -} |
e84193e4 RL |
589 | |
590 | # Install helper targets ############################################# | |
591 | ||
41149648 RL |
592 | install_sw : install_dev install_engines install_modules - |
593 | install_runtime install_startup install_ivp | |
4813ad2d | 594 | |
41149648 RL |
595 | uninstall_sw : uninstall_dev uninstall_modules uninstall_engines - |
596 | uninstall_runtime uninstall_startup uninstall_ivp | |
e84193e4 | 597 | |
4813ad2d | 598 | install_docs : install_html_docs |
e84193e4 | 599 | |
4813ad2d | 600 | uninstall_docs : uninstall_html_docs |
e84193e4 | 601 | |
f5657ce8 | 602 | {- output_off() if $disabled{fips}; "" -} |
25ab5424 | 603 | install_fips : build_sw $(INSTALL_FIPSMODULECONF) |
f5657ce8 | 604 | @ WRITE SYS$OUTPUT "*** Installing FIPS module" |
a3a79ab3 | 605 | - CREATE/DIR ossl_installroot:[MODULES{- $target{pointer_size} -}.'arch'] |
85efdaab | 606 | - CREATE/DIR/PROT=(S:RWED,O:RWE,G:RE,W:RE) OSSL_DATAROOT:[000000] |
f5657ce8 | 607 | COPY/PROT=W:RE $(INSTALL_FIPSMODULES) - |
a3a79ab3 | 608 | ossl_installroot:[MODULES{- $target{pointer_size} -}.'arch']$(FIPSMODULENAME) |
8cab385e | 609 | @ WRITE SYS$OUTPUT "*** Installing FIPS module configuration" |
25ab5424 | 610 | COPY/PROT=W:RE $(INSTALL_FIPSMODULECONF) OSSL_DATAROOT:[000000] |
8cab385e | 611 | |
25ab5424 | 612 | uninstall_fips : |
8cab385e | 613 | @ WRITE SYS$OUTPUT "*** Uninstalling FIPS module configuration" |
f5657ce8 RL |
614 | DELETE OSSL_DATAROOT:[000000]fipsmodule.cnf;* |
615 | @ WRITE SYS$OUTPUT "*** Uninstalling FIPS module" | |
a3a79ab3 | 616 | DELETE ossl_installroot:[MODULES{- $target{pointer_size} -}.'arch']$(FIPSMODULENAME);* |
f5657ce8 | 617 | {- output_on() if $disabled{fips}; "" -} |
8cab385e | 618 | |
4813ad2d RL |
619 | install_ssldirs : check_INSTALLTOP |
620 | - CREATE/DIR/PROT=(S:RWED,O:RWE,G:RE,W:RE) OSSL_DATAROOT:[000000] | |
621 | IF F$SEARCH("OSSL_DATAROOT:[000000]CERTS.DIR;1") .EQS. "" THEN - | |
622 | CREATE/DIR/PROT=(S:RWED,O:RWE,G:RE,W:RE) OSSL_DATAROOT:[CERTS] | |
623 | IF F$SEARCH("OSSL_DATAROOT:[000000]PRIVATE.DIR;1") .EQS. "" THEN - | |
624 | CREATE/DIR/PROT=(S:RWED,O:RWE,G,W) OSSL_DATAROOT:[PRIVATE] | |
625 | IF F$SEARCH("OSSL_DATAROOT:[000000]MISC.DIR;1") .EQS. "" THEN - | |
626 | CREATE/DIR/PROT=(S:RWED,O:RWE,G,W) OSSL_DATAROOT:[MISC] | |
627 | COPY/PROT=W:RE $(MISC_SCRIPTS) OSSL_DATAROOT:[MISC] | |
628 | @ ! Install configuration file | |
cb926df2 RL |
629 | COPY/PROT=W:R {- sourcefile("apps", "openssl-vms.cnf") -} - |
630 | ossl_dataroot:[000000]openssl.cnf-dist | |
631 | IF F$SEARCH("OSSL_DATAROOT:[000000]openssl.cnf") .EQS. "" THEN - | |
632 | COPY/PROT=W:R {- sourcefile("apps", "openssl-vms.cnf") -} - | |
633 | ossl_dataroot:[000000]openssl.cnf | |
c7af65c7 RS |
634 | @ ! Install CTLOG configuration file |
635 | COPY/PROT=W:R {- sourcefile("apps", "ct_log_list.cnf") -} - | |
636 | ossl_dataroot:[000000]ct_log_list.cnf-dist | |
637 | IF F$SEARCH("OSSL_DATAROOT:[000000]ct_log_list.cnf") .EQS. "" THEN - | |
638 | COPY/PROT=W:R {- sourcefile("apps", "ct_log_list.cnf") -} - | |
639 | ossl_dataroot:[000000]ct_log_list.cnf | |
e84193e4 | 640 | |
c1123d9f | 641 | install_dev : check_INSTALLTOP install_runtime_libs |
e84193e4 RL |
642 | @ WRITE SYS$OUTPUT "*** Installing development files" |
643 | @ ! Install header files | |
b3514b47 | 644 | - CREATE/DIR ossl_installroot:[include.openssl] |
1b9fbae6 RL |
645 | COPY/PROT=W:R ossl_sourceroot:[include.openssl]*.h - |
646 | ossl_installroot:[include.openssl] | |
647 | COPY/PROT=W:R [.include.openssl]*.h ossl_installroot:[include.openssl] | |
36b53720 | 648 | @ ! Install static (development) libraries |
b3514b47 | 649 | - CREATE/DIR ossl_installroot:[LIB.'arch'] |
e84193e4 | 650 | {- join("\n ", |
a8a421b1 | 651 | map { "COPY/PROT=W:R $_.OLB ossl_installroot:[LIB.'arch']" } |
33105818 | 652 | @install_libs) -} |
e84193e4 | 653 | |
1842f369 RL |
654 | install_engines : check_INSTALLTOP install_runtime_libs build_modules |
655 | @ {- output_off() unless scalar @install_engines; "" -} ! | |
41149648 | 656 | @ WRITE SYS$OUTPUT "*** Installing engines" |
d4453024 | 657 | - CREATE/DIR ossl_installroot:[ENGINES{- $sover_dirname.$target{pointer_size} -}.'arch'] |
f27f64e1 | 658 | {- join("\n ", |
d4453024 | 659 | map { "COPY/PROT=W:RE $_.EXE ossl_installroot:[ENGINES$sover_dirname$target{pointer_size}.'arch']" } |
ac6bba6f | 660 | @install_engines) -} |
1842f369 | 661 | @ {- output_on() unless scalar @install_engines; "" -} ! |
e84193e4 | 662 | |
41149648 RL |
663 | install_modules : check_INSTALLTOP install_runtime_libs build_modules |
664 | @ {- output_off() unless scalar @install_modules; "" -} ! | |
665 | @ WRITE SYS$OUTPUT "*** Installing modules" | |
a3a79ab3 | 666 | - CREATE/DIR ossl_installroot:[MODULES{- $target{pointer_size} -}.'arch'] |
41149648 | 667 | {- join("\n ", |
a3a79ab3 | 668 | map { "COPY/PROT=W:RE $_.EXE ossl_installroot:[MODULES$target{pointer_size}.'arch']" } |
41149648 RL |
669 | @install_modules) -} |
670 | @ {- output_on() unless scalar @install_modules; "" -} ! | |
671 | ||
e9994901 | 672 | install_runtime : install_programs |
c1123d9f | 673 | |
e8d01a60 | 674 | install_runtime_libs : check_INSTALLTOP build_libs |
c1123d9f RL |
675 | @ {- output_off() if $disabled{shared}; "" -} ! |
676 | @ WRITE SYS$OUTPUT "*** Installing shareable images" | |
677 | @ ! Install shared (runtime) libraries | |
678 | - CREATE/DIR ossl_installroot:[LIB.'arch'] | |
679 | {- join("\n ", | |
680 | map { "COPY/PROT=W:R $_.EXE ossl_installroot:[LIB.'arch']" } | |
681 | @install_shlibs) -} | |
682 | @ {- output_on() if $disabled{shared}; "" -} ! | |
683 | ||
e8d01a60 | 684 | install_programs : check_INSTALLTOP install_runtime_libs build_programs |
c1123d9f RL |
685 | @ {- output_off() if $disabled{apps}; "" -} ! |
686 | @ ! Install the main program | |
687 | - CREATE/DIR ossl_installroot:[EXE.'arch'] | |
688 | COPY/PROT=W:RE [.APPS]openssl.EXE - | |
689 | ossl_installroot:[EXE.'arch']openssl{- $osslver -}.EXE | |
690 | @ ! Install scripts | |
691 | COPY/PROT=W:RE $(BIN_SCRIPTS) ossl_installroot:[EXE] | |
692 | @ ! {- output_on() if $disabled{apps}; "" -} | |
693 | ||
4813ad2d | 694 | install_startup : [.VMS]openssl_startup.com [.VMS]openssl_shutdown.com - |
dbb3aba1 | 695 | [.VMS]openssl_utils.com, check_INSTALLTOP |
b3514b47 | 696 | - CREATE/DIR ossl_installroot:[SYS$STARTUP] |
e8fb1295 RL |
697 | COPY/PROT=W:RE [.VMS]openssl_startup.com - |
698 | ossl_installroot:[SYS$STARTUP]openssl_startup{- $osslver -}.com | |
699 | COPY/PROT=W:RE [.VMS]openssl_shutdown.com - | |
700 | ossl_installroot:[SYS$STARTUP]openssl_shutdown{- $osslver -}.com | |
701 | COPY/PROT=W:RE [.VMS]openssl_utils.com - | |
702 | ossl_installroot:[SYS$STARTUP]openssl_utils{- $osslver -}.com | |
e84193e4 | 703 | |
3426de22 RL |
704 | install_ivp : [.VMS]openssl_ivp.com check_INSTALLTOP |
705 | - CREATE/DIR ossl_installroot:[SYSTEST] | |
e8fb1295 RL |
706 | COPY/PROT=W:RE [.VMS]openssl_ivp.com - |
707 | ossl_installroot:[SYSTEST]openssl_ivp{- $osslver -}.com | |
3426de22 | 708 | |
e073fd15 | 709 | [.VMS]openssl_startup.com : vmsconfig.pm {- sourcefile("VMS", "openssl_startup.com.in") -} |
b3514b47 | 710 | - CREATE/DIR [.VMS] |
e84193e4 RL |
711 | $(PERL) "-I." "-Mvmsconfig" {- sourcefile("util", "dofile.pl") -} - |
712 | {- sourcefile("VMS", "openssl_startup.com.in") -} - | |
713 | > [.VMS]openssl_startup.com | |
714 | ||
dbb3aba1 RL |
715 | [.VMS]openssl_utils.com : vmsconfig.pm {- sourcefile("VMS", "openssl_utils.com.in") -} |
716 | - CREATE/DIR [.VMS] | |
717 | $(PERL) "-I." "-Mvmsconfig" {- sourcefile("util", "dofile.pl") -} - | |
718 | {- sourcefile("VMS", "openssl_utils.com.in") -} - | |
719 | > [.VMS]openssl_utils.com | |
720 | ||
e073fd15 | 721 | [.VMS]openssl_shutdown.com : vmsconfig.pm {- sourcefile("VMS", "openssl_shutdown.com.in") -} |
b3514b47 | 722 | - CREATE/DIR [.VMS] |
e84193e4 RL |
723 | $(PERL) "-I." "-Mvmsconfig" {- sourcefile("util", "dofile.pl") -} - |
724 | {- sourcefile("VMS", "openssl_shutdown.com.in") -} - | |
725 | > [.VMS]openssl_shutdown.com | |
726 | ||
3426de22 RL |
727 | [.VMS]openssl_ivp.com : vmsconfig.pm {- sourcefile("VMS", "openssl_ivp.com.in") -} |
728 | - CREATE/DIR [.VMS] | |
729 | $(PERL) "-I." "-Mvmsconfig" {- sourcefile("util", "dofile.pl") -} - | |
730 | {- sourcefile("VMS", "openssl_ivp.com.in") -} - | |
731 | > [.VMS]openssl_ivp.com | |
732 | ||
27f42b46 | 733 | vmsconfig.pm : configdata.pm |
e84193e4 RL |
734 | OPEN/WRITE/SHARE=READ CONFIG []vmsconfig.pm |
735 | WRITE CONFIG "package vmsconfig;" | |
736 | WRITE CONFIG "use strict; use warnings;" | |
737 | WRITE CONFIG "use Exporter;" | |
738 | WRITE CONFIG "our @ISA = qw(Exporter);" | |
0f2d3e4e | 739 | WRITE CONFIG "our @EXPORT = qw(%config %target %withargs %unified_info %disabled);" |
e84193e4 | 740 | WRITE CONFIG "our %config = (" |
34d5490a RL |
741 | WRITE CONFIG " target => '","{- $config{target} -}","'," |
742 | WRITE CONFIG " version => '","{- $config{version} -}","'," | |
539ea812 | 743 | WRITE CONFIG " shlib_version => '","{- $config{shlib_version} -}","'," |
34d5490a RL |
744 | WRITE CONFIG " shlib_major => '","{- $config{shlib_major} -}","'," |
745 | WRITE CONFIG " shlib_minor => '","{- $config{shlib_minor} -}","'," | |
84af1bae | 746 | WRITE CONFIG " no_shared => '","{- $disabled{shared} -}","'," |
e84193e4 RL |
747 | WRITE CONFIG " INSTALLTOP => '$(INSTALLTOP)'," |
748 | WRITE CONFIG " OPENSSLDIR => '$(OPENSSLDIR)'," | |
34d5490a | 749 | WRITE CONFIG " pointer_size => '","{- $target{pointer_size} -}","'," |
e84193e4 RL |
750 | WRITE CONFIG ");" |
751 | WRITE CONFIG "our %target = ();" | |
0f2d3e4e | 752 | WRITE CONFIG "our %disabled = ();" |
e84193e4 RL |
753 | WRITE CONFIG "our %withargs = ();" |
754 | WRITE CONFIG "our %unified_info = ();" | |
755 | WRITE CONFIG "1;" | |
756 | CLOSE CONFIG | |
757 | ||
b0940b33 RL |
758 | install_html_docs : check_INSTALLTOP build_html_docs |
759 | @ WRITE SYS$OUTPUT "*** Installing HTML docs" | |
760 | - CREATE/DIR ossl_installroot:[HTML.MAN1] | |
761 | - CREATE/DIR ossl_installroot:[HTML.MAN3] | |
762 | - CREATE/DIR ossl_installroot:[HTML.MAN5] | |
763 | - CREATE/DIR ossl_installroot:[HTML.MAN7] | |
764 | {- join("\n ", | |
765 | ( map { "COPY/PROT=W:RE $_ ossl_installroot:[HTML.MAN1]" } | |
766 | @{$unified_info{htmldocs}->{man1}} ), | |
767 | ( map { "COPY/PROT=W:RE $_ ossl_installroot:[HTML.MAN3]" } | |
768 | @{$unified_info{htmldocs}->{man3}} ), | |
769 | ( map { "COPY/PROT=W:RE $_ ossl_installroot:[HTML.MAN5]" } | |
770 | @{$unified_info{htmldocs}->{man5}} ), | |
771 | ( map { "COPY/PROT=W:RE $_ ossl_installroot:[HTML.MAN7]" } | |
772 | @{$unified_info{htmldocs}->{man7}} )) -} | |
e990ec52 | 773 | |
e84193e4 RL |
774 | check_INSTALLTOP : |
775 | @ IF "$(INSTALLTOP)" .EQS. "" THEN - | |
776 | WRITE SYS$ERROR "INSTALLTOP should not be empty" | |
777 | @ IF "$(INSTALLTOP)" .EQS. "" THEN - | |
778 | EXIT %x10000002 | |
779 | ||
e84193e4 RL |
780 | # Developer targets ################################################## |
781 | ||
782 | debug_logicals : | |
7285ac09 | 783 | SH LOGICAL/PROC openssl,internal,ossl_installroot,ossl_dataroot |
e84193e4 RL |
784 | |
785 | # Building targets ################################################### | |
786 | ||
468d1517 RL |
787 | descrip.mms : configdata.pm {- join(" ", @{$config{build_file_templates}}) -} |
788 | perl configdata.pm | |
789 | @ WRITE SYS$OUTPUT "*************************************************" | |
790 | @ WRITE SYS$OUTPUT "*** ***" | |
791 | @ WRITE SYS$OUTPUT "*** Please run the same mms command again ***" | |
792 | @ WRITE SYS$OUTPUT "*** ***" | |
793 | @ WRITE SYS$OUTPUT "*************************************************" | |
794 | @ PIPE ( EXIT %X10000000 ) | |
795 | ||
796 | configdata.pm : $(SRCDIR)Configure $(SRCDIR)config.com {- join(" ", @{$config{build_infos}}, @{$config{conf_files}}) -} | |
a1b6933e | 797 | perl configdata.pm -r |
e84193e4 RL |
798 | @ WRITE SYS$OUTPUT "*************************************************" |
799 | @ WRITE SYS$OUTPUT "*** ***" | |
800 | @ WRITE SYS$OUTPUT "*** Please run the same mms command again ***" | |
801 | @ WRITE SYS$OUTPUT "*** ***" | |
802 | @ WRITE SYS$OUTPUT "*************************************************" | |
27f42b46 | 803 | @ PIPE ( EXIT %X10000000 ) |
e84193e4 | 804 | |
34544072 | 805 | reconfigure reconf : |
a1b6933e | 806 | perl configdata.pm -r |
bf01fbbf | 807 | |
e84193e4 RL |
808 | {- |
809 | use File::Basename; | |
810 | use File::Spec::Functions qw/abs2rel rel2abs catfile catdir/; | |
0cbb6f6a | 811 | use File::Spec::Unix; |
66ddf178 | 812 | |
6dd07a93 RL |
813 | # Helper function to convert dependencies in platform agnostic form to |
814 | # dependencies in platform form. | |
815 | sub compute_platform_depends { | |
816 | map { my $x = $_; | |
817 | ||
818 | grep { $x eq $_ } @{$unified_info{programs}} and platform->bin($x) | |
819 | or grep { $x eq $_ } @{$unified_info{modules}} and platform->dso($x) | |
820 | or grep { $x eq $_ } @{$unified_info{libraries}} and platform->lib($x) | |
821 | or platform->convertext($x); } @_; | |
822 | } | |
823 | ||
186a31e5 RL |
824 | # Helper function to figure out dependencies on libraries |
825 | # It takes a list of library names and outputs a list of dependencies | |
826 | sub compute_lib_depends { | |
c162a8c3 RL |
827 | # Depending on shared libraries: |
828 | # On Windows POSIX layers, we depend on {libname}.dll.a | |
829 | # On Unix platforms, we depend on {shlibname}.so | |
77550dbf RL |
830 | return map { |
831 | { lib => platform->sharedlib($_) // platform->staticlib($_), | |
285daccd | 832 | attrs => $unified_info{attributes}->{libraries}->{$_} } |
77550dbf | 833 | } @_; |
186a31e5 RL |
834 | } |
835 | ||
ab7134ef | 836 | # Helper function to deal with inclusion directory specs. |
0cbb6f6a RL |
837 | # We're dealing with two issues: |
838 | # 1. A lot of include directory specs take up a lot of command line real | |
839 | # estate, and the DCL command line is very limited (2KiB). | |
840 | # 2. For optimal usage, include directory paths must be in Unix form, | |
841 | # that's the only way the C compiler can merge multiple include paths | |
842 | # in a sane way (we can stop worrying about 1.h including foo/2.h | |
843 | # including ../3.h). | |
844 | # | |
845 | # To resolve 1, we need to create a file with include directory pragmas, | |
846 | # and let the compiler use it with /FIRST_INCLUDE=. | |
847 | # To resolve 2, we convert all include directory specs we get to Unix, | |
848 | # with available File::Spec functions. | |
ab7134ef | 849 | # |
0cbb6f6a RL |
850 | # We use CRC-24 from https://tools.ietf.org/html/rfc4880#section-6, |
851 | # reimplemented in Perl to get a workable and constant file name for each | |
852 | # combination of include directory specs. It is assumed that the order of | |
853 | # these directories don't matter. | |
854 | # | |
855 | # This function takes as input a list of include directories | |
856 | # This function returns a list two things: | |
857 | # 1. The file name to use with /FIRST_INCLUDE= | |
858 | # 2. Text to insert into descrip.mms (may be the empty string) | |
859 | sub crc24 { | |
860 | my $input = shift; | |
861 | ||
862 | my $init_value = 0x00B704CE; | |
863 | my $poly_value = 0x01864CFB; | |
864 | ||
865 | my $crc = $init_value; | |
866 | ||
867 | foreach my $x (unpack ('C*', $input)) { | |
868 | $crc ^= $x << 16; | |
869 | ||
870 | for (my $i; $i < 8; $i++) { | |
871 | $crc <<= 1; | |
872 | if ($crc & 0x01000000) { | |
873 | $crc ^= $poly_value; | |
874 | } | |
ab7134ef | 875 | } |
ab7134ef | 876 | } |
0cbb6f6a RL |
877 | $crc &= 0xFFFFFF; |
878 | ||
879 | return $crc; | |
880 | } | |
881 | my %includefile_cache; | |
882 | sub make_includefile { | |
883 | my %dirs = map { | |
884 | my $udir = make_unix_path(rel2abs($_)); | |
885 | ||
886 | $udir => 1; | |
887 | } @_; | |
888 | my @dirs = sort keys %dirs; | |
889 | my $filename = sprintf 'incdirs_%x.h', crc24(join(',', @dirs)); | |
890 | ||
891 | if ($includefile_cache{$filename}) { | |
892 | return ($filename, ""); | |
893 | } | |
894 | ||
895 | my $scripture = <<"EOF"; | |
896 | $filename : | |
897 | open/write inc_output $filename | |
898 | EOF | |
899 | foreach (@dirs) { | |
900 | $scripture .= <<"EOF"; | |
901 | write inc_output "#pragma include_directory ""$_""" | |
902 | EOF | |
903 | } | |
904 | $scripture .= <<"EOF"; | |
905 | close inc_output | |
906 | EOF | |
907 | $includefile_cache{$filename} = $scripture; | |
908 | ||
909 | return ($filename, $scripture); | |
ab7134ef RL |
910 | } |
911 | ||
98b7b741 RL |
912 | # On VMS, (some) header file directories include the files |
913 | # __DECC_INCLUDE_EPILOGUE.H and __DECC_INCLUDE_PROLOGUE.H. | |
914 | # When header files are generated, and the build directory | |
915 | # isn't the same as the source directory, these files must | |
916 | # be copied alongside the generated header file, or their | |
917 | # effect will be lost. | |
918 | # We use the same include file cache as make_includefile | |
919 | # to check if the scripture to copy these files has already | |
920 | # been generated. | |
921 | sub make_decc_include_files { | |
922 | my $outd = shift; | |
923 | my $ind = shift; | |
924 | ||
925 | # If the build directory and the source directory are the | |
926 | # same, there's no need to copy the prologue and epilogue | |
927 | # files. | |
928 | return ('') if $outd eq $ind; | |
929 | ||
930 | my $outprologue = catfile($outd, '__DECC_INCLUDE_PROLOGUE.H'); | |
931 | my $outepilogue = catfile($outd, '__DECC_INCLUDE_EPILOGUE.H'); | |
932 | my $inprologue = catfile($ind, '__DECC_INCLUDE_PROLOGUE.H'); | |
933 | my $inepilogue = catfile($ind, '__DECC_INCLUDE_EPILOGUE.H'); | |
934 | my @filenames = (); | |
935 | my $scripture = ''; | |
936 | ||
937 | if ($includefile_cache{$outprologue}) { | |
938 | push @filenames, $outprologue; | |
939 | } elsif (-f $inprologue) { | |
940 | my $local_scripture .= <<"EOF"; | |
941 | $outprologue : $inprologue | |
942 | COPY $inprologue $outprologue | |
943 | EOF | |
944 | $includefile_cache{$outprologue} = $local_scripture; | |
945 | ||
946 | push @filenames, $outprologue; | |
947 | $scripture .= $local_scripture; | |
948 | } | |
949 | if ($includefile_cache{$outepilogue}) { | |
950 | push @filenames, $outepilogue; | |
951 | } elsif (-f $inepilogue) { | |
952 | my $local_scripture .= <<"EOF"; | |
953 | $outepilogue : $inepilogue | |
954 | COPY $inepilogue $outepilogue | |
955 | EOF | |
956 | $includefile_cache{$outepilogue} = $local_scripture; | |
957 | ||
958 | push @filenames, $outepilogue; | |
959 | $scripture .= $local_scripture; | |
960 | } | |
961 | ||
962 | return (@filenames, $scripture); | |
963 | } | |
964 | ||
3f399e37 RL |
965 | sub generatetarget { |
966 | my %args = @_; | |
6dd07a93 | 967 | my $deps = join(" ", compute_platform_depends(@{$args{deps}})); |
3f399e37 RL |
968 | return <<"EOF"; |
969 | $args{target} : $deps | |
970 | EOF | |
971 | } | |
972 | ||
66ddf178 RL |
973 | sub generatesrc { |
974 | my %args = @_; | |
79f47ef5 RL |
975 | my $gen0 = $args{generator}->[0]; |
976 | my $gen_args = join('', map { " $_" } | |
977 | @{$args{generator}}[1..$#{$args{generator}}]); | |
978 | my $gen_incs = join("", map { ' "-I'.$_.'"' } @{$args{generator_incs}}); | |
6dd07a93 RL |
979 | my $deps = join(", -\n\t\t", |
980 | compute_platform_depends(@{$args{generator_deps}}, | |
981 | @{$args{deps}})); | |
66ddf178 | 982 | |
b0940b33 | 983 | if ($args{src} =~ /\.html$/) { |
79f47ef5 RL |
984 | # |
985 | # HTML generator | |
986 | # | |
987 | my $title = basename($args{src}, ".html"); | |
988 | my $pod = $gen0; | |
989 | my $mkpod2html = sourcefile('util', 'mkpod2html.pl'); | |
33a62d44 | 990 | my $srcdoc = sourcedir('doc'); |
79f47ef5 | 991 | return <<"EOF"; |
22119050 | 992 | $args{src} : $pod |
33a62d44 | 993 | \$(PERL) $mkpod2html -i $pod -o \$\@ -t "$title" -r "$srcdoc" |
b0940b33 | 994 | EOF |
22119050 RL |
995 | } elsif ($args{src} =~ /\.(\d)$/) { |
996 | # | |
997 | # Man-page generator, on VMS we simply ignore man-pages | |
998 | # | |
999 | return ""; | |
b0940b33 | 1000 | } elsif (platform->isdef($args{src})) { |
79f47ef5 RL |
1001 | # |
1002 | # Linker script-ish generator | |
1003 | # | |
c162a8c3 | 1004 | my $target = platform->def($args{src}); |
ef2dfc99 | 1005 | my $mkdef = sourcefile('util', 'mkdef.pl'); |
435981cb | 1006 | my $ord_ver = $args{intent} eq 'lib' ? ' --version $(VERSION_NUMBER)' : ''; |
66a24ab8 RL |
1007 | my $ord_name = |
1008 | $args{generator}->[1] || basename($args{product}, '.EXE'); | |
36d3acb9 RL |
1009 | my $case_insensitive = |
1010 | $target{$args{intent}.'_cflags'} =~ m|/NAMES=[^/]*AS_IS|i | |
1011 | ? '' : ' --case-insensitive'; | |
ef2dfc99 | 1012 | return <<"EOF"; |
79f47ef5 | 1013 | $target : $gen0 $deps $mkdef |
e5f831a0 | 1014 | \$(PERL) $mkdef$ord_ver --type $args{intent} --ordinals $gen0 --name $ord_name "--OS" "VMS"$case_insensitive > $target |
7cae3864 | 1015 | EOF |
b8d3cf09 RL |
1016 | } elsif (platform->isasm($args{src}) |
1017 | || platform->iscppasm($args{src})) { | |
79f47ef5 RL |
1018 | # |
1019 | # Assembler generator | |
1020 | # | |
cfc73c23 RL |
1021 | my $cppflags = |
1022 | { shlib => "$lib_cflags $lib_cppflags", | |
1023 | lib => "$lib_cflags $lib_cppflags", | |
1024 | dso => "$dso_cflags $dso_cppflags", | |
1025 | bin => "$bin_cflags $bin_cppflags" } -> {$args{intent}}; | |
0a37ff4d | 1026 | my $defs = join("", map { ",".$_ } @{$args{defs}}); |
b8d3cf09 RL |
1027 | my $target = platform->isasm($args{src}) |
1028 | ? platform->asm($args{src}) | |
1029 | : $args{src}; | |
593d5c2f | 1030 | |
79f47ef5 RL |
1031 | my $generator; |
1032 | if ($gen0 =~ /\.pl$/) { | |
1033 | $generator = '$(PERL)'.$gen_incs.' '.$gen0.$gen_args | |
593d5c2f | 1034 | .' '.$cppflags; |
79f47ef5 | 1035 | } elsif ($gen0 =~ /\.S$/) { |
593d5c2f RL |
1036 | $generator = undef; |
1037 | } else { | |
79f47ef5 | 1038 | die "Generator type for $src unknown: $gen0.$gen_args\n"; |
593d5c2f RL |
1039 | } |
1040 | ||
ab7134ef | 1041 | if (defined($generator)) { |
ab7134ef | 1042 | return <<"EOF"; |
79f47ef5 | 1043 | $target : $gen0 $deps |
593d5c2f | 1044 | \@ extradefines = "$defs" |
ab7134ef | 1045 | $generator \$\@ |
593d5c2f | 1046 | \@ DELETE/SYMBOL/LOCAL extradefines |
ab7134ef RL |
1047 | EOF |
1048 | } | |
1049 | return <<"EOF"; | |
79f47ef5 | 1050 | $target : $gen0 $deps |
0a37ff4d | 1051 | \@ extradefines = "$defs" |
79f47ef5 | 1052 | PIPE \$(CPP) $cppflags $gen0 | - |
ab7134ef | 1053 | \$(PERL) "-ne" "/^#(\\s*line)?\\s*[0-9]+\\s+""/ or print" > \$\@ |
0a37ff4d | 1054 | \@ DELETE/SYMBOL/LOCAL extradefines |
79f47ef5 RL |
1055 | EOF |
1056 | } elsif ($gen0 =~ m|^.*\.in$|) { | |
1057 | # | |
1058 | # "dofile" generator (file.in -> file) | |
1059 | # | |
1060 | my $dofile = abs2rel(rel2abs(catfile($config{sourcedir}, | |
1061 | "util", "dofile.pl")), | |
1062 | rel2abs($config{builddir})); | |
6dd07a93 RL |
1063 | my @perlmodules = ( 'configdata.pm', |
1064 | grep { $_ =~ m|\.pm$| } @{$args{deps}} ); | |
1065 | my %perlmoduleincs = map { '"-I'.dirname($_).'"' => 1 } @perlmodules; | |
98b7b741 RL |
1066 | my @decc_include_data |
1067 | = make_decc_include_files(dirname($args{src}), dirname($gen0)); | |
1068 | my $decc_include_scripture = pop @decc_include_data; | |
1069 | $deps = join(' ', $deps, @decc_include_data, | |
1070 | compute_platform_depends(@perlmodules)); | |
6dd07a93 RL |
1071 | @perlmodules = map { '"-M'.basename($_, '.pm').'"' } @perlmodules; |
1072 | my $perlmodules = join(' ', '', sort keys %perlmoduleincs, @perlmodules); | |
98b7b741 | 1073 | |
79f47ef5 | 1074 | return <<"EOF"; |
22119050 | 1075 | $args{src} : $gen0 $deps |
6dd07a93 | 1076 | \$(PERL)$perlmodules $dofile "-o$target{build_file}" $gen0$gen_args > \$\@ |
98b7b741 | 1077 | $decc_include_scripture |
79f47ef5 RL |
1078 | EOF |
1079 | } elsif (grep { $_ eq $gen0 } @{$unified_info{programs}}) { | |
1080 | # | |
1081 | # Generic generator using OpenSSL programs | |
1082 | # | |
1083 | ||
6dd07a93 | 1084 | # Redo $gen0, to ensure that we have the proper extension |
79f47ef5 RL |
1085 | $gen0 = platform->bin($gen0); |
1086 | return <<"EOF"; | |
22119050 | 1087 | $args{src} : $gen0 $deps |
b4810b70 | 1088 | PIPE MCR $gen0$gen_args > \$@ |
79f47ef5 RL |
1089 | EOF |
1090 | } else { | |
1091 | # | |
1092 | # Generic generator using Perl | |
1093 | # | |
1094 | return <<"EOF"; | |
22119050 | 1095 | $args{src} : $gen0 $deps |
79f47ef5 | 1096 | \$(PERL)$gen_incs $gen0$gen_args > \$\@ |
ab7134ef | 1097 | EOF |
66ddf178 RL |
1098 | } |
1099 | } | |
1100 | ||
e84193e4 | 1101 | sub src2obj { |
d88736df | 1102 | my $asmext = platform->asmext(); |
e84193e4 | 1103 | my %args = @_; |
d88736df RL |
1104 | my @srcs = |
1105 | map { my $x = $_; | |
1106 | (platform->isasm($x) && grep { $x eq $_ } @generated) | |
1107 | ? platform->asm($x) : $x } | |
1108 | ( @{$args{srcs}} ); | |
c162a8c3 | 1109 | my $obj = platform->obj($args{obj}); |
d88736df | 1110 | my $dep = platform->dep($args{obj}); |
ab7134ef | 1111 | my $deps = join(", -\n\t\t", @srcs, @{$args{deps}}); |
e84193e4 RL |
1112 | |
1113 | # Because VMS C isn't very good at combining a /INCLUDE path with | |
1114 | # #includes having a relative directory (like '#include "../foo.h"), | |
1115 | # the best choice is to move to the first source file's intended | |
1116 | # directory before compiling, and make sure to write the object file | |
1117 | # in the correct position (important when the object tree is other | |
1118 | # than the source tree). | |
1119 | my $forward = dirname($args{srcs}->[0]); | |
1120 | my $backward = abs2rel(rel2abs("."), rel2abs($forward)); | |
1121 | my $objd = abs2rel(rel2abs(dirname($obj)), rel2abs($forward)); | |
d88736df RL |
1122 | my $objn = basename($obj); |
1123 | my $depd = abs2rel(rel2abs(dirname($dep)), rel2abs($forward)); | |
1124 | my $depn = basename($dep); | |
e84193e4 | 1125 | my $srcs = |
ab7134ef | 1126 | join(", ", map { abs2rel(rel2abs($_), rel2abs($forward)) } @srcs); |
1b77f00a RL |
1127 | my $incextra = join(',', map { "\"$_\"" } |
1128 | @{$unified_info{includes_extra}->{$obj}}); | |
1129 | $incextra = "/INCLUDE=($incextra)" if $incextra; | |
c162a8c3 | 1130 | |
ab7134ef | 1131 | my $cflags; |
5cae2d34 | 1132 | if ($args{attrs}->{noinst}) { |
cfc73c23 RL |
1133 | $cflags .= { shlib => $lib_cflags_no_inst, |
1134 | lib => $lib_cflags_no_inst, | |
1135 | dso => $dso_cflags_no_inst, | |
1136 | bin => $bin_cflags_no_inst } -> {$args{intent}}; | |
5cae2d34 | 1137 | } else { |
cfc73c23 RL |
1138 | $cflags .= { shlib => $lib_cflags, |
1139 | lib => $lib_cflags, | |
1140 | dso => $dso_cflags, | |
1141 | bin => $bin_cflags } -> {$args{intent}}; | |
1750142f | 1142 | } |
cfc73c23 RL |
1143 | $cflags .= { shlib => $lib_cppflags, |
1144 | lib => $lib_cppflags, | |
1145 | dso => $dso_cppflags, | |
1146 | bin => $bin_cppflags } -> {$args{intent}}; | |
1b77f00a | 1147 | $cflags .= $incextra; |
0a37ff4d | 1148 | my $defs = join("", map { ",".$_ } @{$args{defs}}); |
cfc73c23 RL |
1149 | my $asflags = { shlib => $lib_asflags, |
1150 | lib => $lib_asflags, | |
1151 | dso => $dso_asflags, | |
1152 | bin => $bin_asflags } -> {$args{intent}}; | |
ab7134ef | 1153 | |
d88736df | 1154 | if ($srcs[0] =~ /\Q${asmext}\E$/) { |
e4366648 | 1155 | return <<"EOF"; |
d88736df | 1156 | $obj : $deps |
e4366648 | 1157 | SET DEFAULT $forward |
d88736df | 1158 | \$(AS) $asflags \$(ASOUTFLAG)${objd}${objn} $srcs |
e4366648 | 1159 | SET DEFAULT $backward |
d88736df | 1160 | - PURGE $obj |
e4366648 RL |
1161 | EOF |
1162 | } elsif ($srcs[0] =~ /.S$/) { | |
1163 | return <<"EOF"; | |
d88736df | 1164 | $obj : $deps |
e4366648 RL |
1165 | SET DEFAULT $forward |
1166 | \@ $incs_on | |
1167 | \@ extradefines = "$defs" | |
1168 | PIPE \$(CPP) ${cflags} $srcs | - | |
1169 | \$(PERL) -ne "/^#(\\s*line)?\\s*[0-9]+\\s+""/ or print" - | |
d88736df | 1170 | > ${objd}${objn}-asm |
e4366648 RL |
1171 | \@ DELETE/SYMBOL/LOCAL extradefines |
1172 | \@ $incs_off | |
1173 | SET DEFAULT $backward | |
d88736df RL |
1174 | \$(AS) $asflags \$(ASOUTFLAG)$obj $obj-asm |
1175 | - PURGE $obj | |
e4366648 RL |
1176 | EOF |
1177 | } | |
1178 | ||
0cbb6f6a RL |
1179 | my ($incdir_filename, $incdir_scripture) = |
1180 | make_includefile(@{ { shlib => [ @lib_cppincludes ], | |
1181 | lib => [ @lib_cppincludes ], | |
1182 | dso => [ @dso_cppincludes ], | |
1183 | bin => [ @bin_cppincludes ] } -> {$args{intent}} }, | |
1184 | @{$args{incs}}); | |
1185 | $deps .= ", -\n\t\t$incdir_filename"; | |
1186 | $cflags = | |
1187 | $target{cflag_incfirst} | |
1188 | . '"'.make_unix_path(rel2abs($incdir_filename)).'"' | |
1189 | . $cflags; | |
1190 | ||
952a9d1a | 1191 | my $depbuild = $disabled{makedepend} ? "" |
d88736df | 1192 | : " /MMS=(FILE=${depd}${depn},TARGET=$obj)"; |
e84193e4 | 1193 | |
c39785d4 | 1194 | return <<"EOF"; |
c162a8c3 | 1195 | $obj : $deps |
70ef9057 | 1196 | SET DEFAULT $forward |
722c9762 | 1197 | \@ $incs_on |
0a37ff4d | 1198 | \@ extradefines = "$defs" |
d88736df | 1199 | \$(CC) ${cflags}${depbuild} /OBJECT=${objd}${objn} /REPOSITORY=$backward $srcs |
0a37ff4d | 1200 | \@ DELETE/SYMBOL/LOCAL extradefines |
722c9762 | 1201 | \@ $incs_off |
e84193e4 | 1202 | SET DEFAULT $backward |
c162a8c3 | 1203 | - PURGE $obj |
0cbb6f6a | 1204 | $incdir_scripture |
ea7df7ea | 1205 | EOF |
e84193e4 | 1206 | } |
f6196227 | 1207 | sub obj2shlib { |
e84193e4 | 1208 | my %args = @_; |
c162a8c3 RL |
1209 | my $shlibname = platform->sharedname($args{lib}); |
1210 | my $shlib = platform->sharedlib($args{lib}); | |
1211 | my @objs = map { platform->convertext($_) } | |
1212 | grep { platform->isobj($_) } | |
b78eb0b6 | 1213 | @{$args{objs}}; |
c162a8c3 RL |
1214 | my @defs = map { platform->convertext($_) } |
1215 | grep { platform->isdef($_) } | |
ef2dfc99 | 1216 | @{$args{objs}}; |
186a31e5 | 1217 | my @deps = compute_lib_depends(@{$args{deps}}); |
81183680 | 1218 | die "More than one symbol vector" if scalar @defs > 1; |
77550dbf | 1219 | my $deps = join(", -\n\t\t", @objs, @defs, map { $_->{lib} } @deps); |
84af1bae | 1220 | my $shlib_target = $disabled{shared} ? "" : $target{shared_target}; |
e84193e4 RL |
1221 | my $translatesyms_pl = abs2rel(rel2abs(catfile($config{sourcedir}, |
1222 | "VMS", "translatesyms.pl")), | |
1223 | rel2abs($config{builddir})); | |
1224 | # The "[]" hack is because in .OPT files, each line inherits the | |
1225 | # previous line's file spec as default, so if no directory spec | |
1226 | # is present in the current line and the previous line has one that | |
1227 | # doesn't apply, you're in for a surprise. | |
b78eb0b6 RL |
1228 | my $write_opt1 = |
1229 | join(",-\"\n\t", map { my $x = $_ =~ /\[/ ? $_ : "[]".$_; | |
1230 | "WRITE OPT_FILE \"$x" } @objs). | |
1231 | "\""; | |
1232 | my $write_opt2 = | |
77550dbf RL |
1233 | join("\n\t", map { my $x = $_->{lib} =~ /\[/ |
1234 | ? $_->{lib} : "[]".$_->{lib}; | |
e84193e4 | 1235 | $x =~ s|(\.EXE)|$1/SHARE|; |
ef3c88cf | 1236 | $x =~ s|(\.OLB)|$1/LIB|; |
e84193e4 RL |
1237 | "WRITE OPT_FILE \"$x\"" } @deps) |
1238 | || "\@ !"; | |
a2880aec | 1239 | return <<"EOF" |
c162a8c3 | 1240 | $shlib : $deps |
81183680 | 1241 | \$(PERL) $translatesyms_pl \$(BLDDIR)CXX\$DEMANGLER_DB. < $defs[0] > $defs[0]-translated |
c162a8c3 | 1242 | OPEN/WRITE/SHARE=READ OPT_FILE $shlibname-components.OPT |
b78eb0b6 RL |
1243 | $write_opt1 |
1244 | $write_opt2 | |
1245 | CLOSE OPT_FILE | |
cfc73c23 | 1246 | LINK ${lib_ldflags}/SHARE=\$\@ $defs[0]-translated/OPT,- |
c162a8c3 RL |
1247 | $shlibname-components.OPT/OPT \$(LIB_EX_LIBS) |
1248 | DELETE $defs[0]-translated;*,$shlibname-components.OPT;* | |
1249 | PURGE $shlibname.EXE,$shlibname.MAP | |
e84193e4 | 1250 | EOF |
a2880aec RL |
1251 | . ($config{target} =~ m|alpha| ? "" : <<"EOF" |
1252 | SET IMAGE/FLAGS=(NOCALL_DEBUG) \$\@ | |
1253 | EOF | |
1254 | ); | |
e84193e4 | 1255 | } |
5386287c | 1256 | sub obj2dso { |
e84193e4 | 1257 | my %args = @_; |
285daccd RL |
1258 | my $dsoname = platform->dsoname($args{module}); |
1259 | my $dso = platform->dso($args{module}); | |
c162a8c3 RL |
1260 | my @objs = map { platform->convertext($_) } |
1261 | grep { platform->isobj($_) } | |
66a24ab8 | 1262 | @{$args{objs}}; |
c162a8c3 RL |
1263 | my @defs = map { platform->convertext($_) } |
1264 | grep { platform->isdef($_) } | |
66a24ab8 | 1265 | @{$args{objs}}; |
186a31e5 | 1266 | my @deps = compute_lib_depends(@{$args{deps}}); |
77550dbf | 1267 | my $deps = join(", -\n\t\t", @objs, @defs, map { $_->{lib} } @deps); |
66a24ab8 | 1268 | die "More than one symbol vector" if scalar @defs > 1; |
84af1bae | 1269 | my $shlib_target = $disabled{shared} ? "" : $target{shared_target}; |
e84193e4 RL |
1270 | # The "[]" hack is because in .OPT files, each line inherits the |
1271 | # previous line's file spec as default, so if no directory spec | |
1272 | # is present in the current line and the previous line has one that | |
1273 | # doesn't apply, you're in for a surprise. | |
c62a9cd7 RL |
1274 | # Furthermore, we collect all object files and static libraries in |
1275 | # an explicit cluster, to make it clear to the linker that these files | |
1276 | # shall be processed before shareable images. | |
1277 | # The shareable images are used with /SELECTIVE, to avoid warnings of | |
1278 | # multiply defined symbols when the module object files override some | |
1279 | # symbols that are present in the shareable image. | |
47852e6a | 1280 | my $write_opt1 = |
c62a9cd7 RL |
1281 | join(",-\"\n\t", |
1282 | "\@ WRITE OPT_FILE \"CLUSTER=_,,", | |
1283 | (map { my $x = $_ =~ /\[/ ? $_ : "[]".$_; | |
1284 | "\@ WRITE OPT_FILE \"$x" } @objs), | |
1285 | (map { my $x = ($_->{lib} =~ /\[/) ? $_->{lib} : "[]".$_->{lib}; | |
1286 | "\@ WRITE OPT_FILE \"$x/LIB" } | |
1287 | grep { $_->{lib} =~ m|\.OLB$| } | |
1288 | @deps)) | |
1289 | ."\""; | |
47852e6a | 1290 | my $write_opt2 = |
c62a9cd7 RL |
1291 | join("\n\t", |
1292 | (map { my $x = ($_->{lib} =~ /\[/) ? $_->{lib} : "[]".$_->{lib}; | |
1293 | "\@ WRITE OPT_FILE \"$x/SHARE/SELECTIVE\"" } | |
1294 | grep { $_->{lib} =~ m|\.EXE$| } | |
1295 | @deps)) | |
e84193e4 | 1296 | || "\@ !"; |
a2880aec | 1297 | return <<"EOF" |
c162a8c3 RL |
1298 | $dso : $deps |
1299 | OPEN/WRITE/SHARE=READ OPT_FILE $dsoname-components.OPT | |
47852e6a RL |
1300 | $write_opt1 |
1301 | $write_opt2 | |
e84193e4 | 1302 | CLOSE OPT_FILE |
cfc73c23 | 1303 | LINK ${dso_ldflags}/SHARE=\$\@ $defs[0]/OPT,- |
c162a8c3 RL |
1304 | $dsoname-components.OPT/OPT \$(DSO_EX_LIBS) |
1305 | - PURGE $dsoname.EXE,$dsoname.OPT,$dsoname.MAP | |
e84193e4 | 1306 | EOF |
a2880aec RL |
1307 | . ($config{target} =~ m|alpha| ? "" : <<"EOF" |
1308 | SET IMAGE/FLAGS=(NOCALL_DEBUG) \$\@ | |
1309 | EOF | |
1310 | ); | |
e84193e4 RL |
1311 | } |
1312 | sub obj2lib { | |
1313 | my %args = @_; | |
c162a8c3 RL |
1314 | my $lib = platform->staticlib($args{lib}); |
1315 | my @objs = map { platform->convertext($_) } | |
1316 | grep { platform->isobj($_) } | |
1317 | @{$args{objs}}; | |
81183680 | 1318 | my $objs = join(", -\n\t\t", @objs); |
c162a8c3 | 1319 | my $fill_lib = join("\n\t", (map { "LIBRARY/REPLACE $lib $_" } @objs)); |
e84193e4 | 1320 | return <<"EOF"; |
c162a8c3 RL |
1321 | $lib : $objs |
1322 | LIBRARY/CREATE/OBJECT $lib | |
e84193e4 | 1323 | $fill_lib |
c162a8c3 | 1324 | - PURGE $lib |
e84193e4 RL |
1325 | EOF |
1326 | } | |
1327 | sub obj2bin { | |
1328 | my %args = @_; | |
c162a8c3 RL |
1329 | my $bin = platform->bin($args{bin}); |
1330 | my $binname = platform->binname($args{bin}); | |
1331 | my @objs = map { platform->convertext($_) } | |
1332 | grep { platform->isobj($_) } | |
1333 | @{$args{objs}}; | |
b3e5db40 | 1334 | my $objs = join(",", @objs); |
186a31e5 | 1335 | my @deps = compute_lib_depends(@{$args{deps}}); |
77550dbf | 1336 | my $deps = join(", -\n\t\t", @objs, map { $_->{lib} } @deps); |
b3e5db40 | 1337 | |
77550dbf | 1338 | my $olb_count = scalar grep(m|\.OLB$|, map { $_->{lib} } @deps); |
b3e5db40 RL |
1339 | my $analyse_objs = "@ !"; |
1340 | if ($olb_count > 0) { | |
1341 | my $analyse_quals = | |
1342 | $config{target} =~ m|alpha| ? "/GSD" : "/SECTIONS=SYMTAB"; | |
1343 | $analyse_objs = "- pipe ANALYSE/OBJECT$analyse_quals $objs | SEARCH SYS\$INPUT \"\"\"main\"\"\" ; nomain = \$severity .NE. 1" | |
1344 | } | |
e84193e4 RL |
1345 | # The "[]" hack is because in .OPT files, each line inherits the |
1346 | # previous line's file spec as default, so if no directory spec | |
1347 | # is present in the current line and the previous line has one that | |
1348 | # doesn't apply, you're in for a surprise. | |
47852e6a | 1349 | my $write_opt1 = |
c62a9cd7 RL |
1350 | "\@ WRITE OPT_FILE \"CASE_SENSITIVE=YES\"\n\t" |
1351 | .join(",-\"\n\t", | |
1352 | "\@ WRITE OPT_FILE \"CLUSTER=_,,", | |
1353 | (map { my $x = $_ =~ /\[/ ? $_ : "[]".$_; | |
1354 | "\@ WRITE OPT_FILE \"$x" } @objs), | |
1355 | (map { my $x = ($_->{lib} =~ /\[/) ? $_->{lib} : "[]".$_->{lib}; | |
1ec0acf2 RL |
1356 | # Special hack to include the MAIN object module |
1357 | # explicitly, if it's known that there is one. | |
1358 | # |incmain| is defined in the rule generation further | |
1359 | # down, with the necessary /INCLUDE=main option unless | |
1360 | # the program has been determined to have a main function | |
1361 | # already. | |
1362 | $_->{attrs}->{has_main} | |
1363 | ? "\@ WRITE OPT_FILE \"$x/LIB''incmain'" | |
1364 | : "\@ WRITE OPT_FILE \"$x/LIB" } | |
c62a9cd7 RL |
1365 | grep { $_->{lib} =~ m|\.OLB$| } |
1366 | @deps)) | |
1367 | ."\""; | |
47852e6a | 1368 | my $write_opt2 = |
c62a9cd7 RL |
1369 | join("\n\t", |
1370 | (map { my $x = $_->{lib} =~ /\[/ ? $_->{lib} : "[]".$_->{lib}; | |
1371 | "\@ WRITE OPT_FILE \"$x/SHARE/SELECTIVE\"" } | |
1372 | grep { $_->{lib} =~ m|\.EXE$| } | |
1373 | @deps)) | |
e84193e4 | 1374 | || "\@ !"; |
bbdec3f2 RL |
1375 | # The linking commands looks a bit complex, but it's for good reason. |
1376 | # When you link, say, foo.obj, bar.obj and libsomething.exe/share, and | |
1377 | # bar.obj happens to have a symbol that also exists in libsomething.exe, | |
1378 | # the linker will warn about it, loudly, and will then choose to pick | |
1379 | # the first copy encountered (the one in bar.obj in this example). | |
f691578b | 1380 | # On Unix and on Windows, the corresponding maneuver goes through |
bbdec3f2 RL |
1381 | # silently with the same effect. |
1382 | # With some test programs, made for checking the internals of OpenSSL, | |
1383 | # we do this kind of linking deliberately, picking a few specific object | |
1384 | # files from within [.crypto] or [.ssl] so we can reach symbols that are | |
1385 | # otherwise unreachable (since the shareable images only exports the | |
1386 | # symbols listed in [.util]*.num), and then with the shared libraries | |
1387 | # themselves. So we need to silence the warning about multiply defined | |
1388 | # symbols, to mimic the way linking work on Unix and Windows, and so | |
1389 | # the build isn't interrupted (MMS stops when warnings are signaled, | |
1390 | # by default), and so someone building doesn't have to worry where it | |
1391 | # isn't necessary. If there are other warnings, however, we show them | |
1392 | # and let it break the build. | |
a2880aec | 1393 | return <<"EOF" |
c162a8c3 | 1394 | $bin : $deps |
b3e5db40 | 1395 | $analyse_objs |
1ec0acf2 RL |
1396 | @ incmain = "/INCLUDE=main" |
1397 | @ IF .NOT. nomain THEN incmain = "" | |
c162a8c3 | 1398 | @ OPEN/WRITE/SHARE=READ OPT_FILE $binname.OPT |
47852e6a RL |
1399 | $write_opt1 |
1400 | $write_opt2 | |
b3e5db40 | 1401 | @ CLOSE OPT_FILE |
c162a8c3 RL |
1402 | TYPE $binname.OPT ! For debugging |
1403 | - pipe SPAWN/WAIT/NOLOG/OUT=$binname.LINKLOG - | |
cfc73c23 | 1404 | LINK ${bin_ldflags}/EXEC=\$\@ $binname.OPT/OPT \$(BIN_EX_LIBS) ; - |
bbdec3f2 RL |
1405 | link_status = \$status ; link_severity = link_status .AND. 7 |
1406 | @ search_severity = 1 | |
1407 | -@ IF link_severity .EQ. 0 THEN - | |
c162a8c3 | 1408 | pipe SEARCH $binname.LINKLOG "%","-"/MATCH=AND | - |
bbdec3f2 RL |
1409 | SPAWN/WAIT/NOLOG/OUT=NLA0: - |
1410 | SEARCH SYS\$INPUT: "-W-MULDEF,"/MATCH=NOR ; - | |
1411 | search_severity = \$severity | |
1412 | @ ! search_severity is 3 when the last search didn't find any matching | |
1413 | @ ! string: %SEARCH-I-NOMATCHES, no strings matched | |
fb0abdce RL |
1414 | @ ! If that was the result, we pretend linking got through without |
1415 | @ ! fault or warning. | |
1416 | @ IF search_severity .EQ. 3 THEN link_severity = 1 | |
1417 | @ ! At this point, if link_severity shows that there was a fault | |
1418 | @ ! or warning, make sure to restore the linking status. | |
c162a8c3 RL |
1419 | -@ IF .NOT. link_severity THEN TYPE $binname.LINKLOG |
1420 | -@ DELETE $binname.LINKLOG;* | |
fb0abdce | 1421 | @ IF .NOT. link_severity THEN SPAWN/WAIT/NOLOG EXIT 'link_status' |
c162a8c3 | 1422 | - PURGE $bin,$binname.OPT |
e84193e4 | 1423 | EOF |
b3e5db40 | 1424 | . ($config{target} =~ m|alpha| ? "" : <<"EOF" |
a2880aec RL |
1425 | SET IMAGE/FLAGS=(NOCALL_DEBUG) \$\@ |
1426 | EOF | |
1427 | ); | |
e84193e4 RL |
1428 | } |
1429 | sub in2script { | |
1430 | my %args = @_; | |
1431 | my $script = $args{script}; | |
1432 | return "" if grep { $_ eq $script } @{$args{sources}}; # No overwrite! | |
1433 | my $sources = join(" ", @{$args{sources}}); | |
1434 | my $dofile = abs2rel(rel2abs(catfile($config{sourcedir}, | |
1435 | "util", "dofile.pl")), | |
1436 | rel2abs($config{builddir})); | |
1437 | return <<"EOF"; | |
079f8d36 | 1438 | $script : $sources configdata.pm |
b867c707 | 1439 | \$(PERL) "-I\$(BLDDIR)" "-Mconfigdata" $dofile - |
ba327ade | 1440 | "-o$target{build_file}" $sources > $script |
e84193e4 RL |
1441 | SET FILE/PROT=(S:RWED,O:RWED,G:RE,W:RE) $script |
1442 | PURGE $script | |
1443 | EOF | |
1444 | } | |
1445 | "" # Important! This becomes part of the template result. | |
1446 | -} |