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