1 ## descrip.mms to build OpenSSL on OpenVMS
3 ## {- join("\n## ", @autowarntext) -}
5 use File::Spec::Functions qw/:DEFAULT abs2rel rel2abs/;
7 # Our prefix, claimed when speaking with the VSI folks Tuesday
9 our $osslprefix = 'OSSL$';
10 (our $osslprefix_q = $osslprefix) =~ s/\$/\\\$/;
12 our $sover = sprintf "%02d%02d", $config{shlib_major}, $config{shlib_minor};
13 our $osslver = sprintf "%02d%02d", split(/\./, $config{version});
15 our $sourcedir = $config{sourcedir};
16 our $builddir = $config{builddir};
18 catfile($sourcedir, @_);
21 catfile($builddir, @_);
24 catdir($sourcedir, @_);
27 catdir($builddir, @_);
30 (my $x = shift) =~ s|\]$|...]|;
35 my $b = abs2rel(rel2abs("."),rel2abs($f));
36 $sourcedir = catdir($b,$sourcedir)
37 if !file_name_is_absolute($sourcedir);
38 $builddir = catdir($b,$builddir)
39 if !file_name_is_absolute($builddir);
43 # Because we need to make two computations of these data,
44 # we store them in arrays for reuse
45 our @shlibs = map { $unified_info{sharednames}->{$_} || () } @{$unified_info{libraries}};
46 our @install_shlibs = map { $unified_info{sharednames}->{$_} || () } @{$unified_info{install}->{libraries}};
47 our @generated = ( ( map { (my $x = $_) =~ s|\.S$|\.s|; $x }
48 grep { defined $unified_info{generate}->{$_} }
49 map { @{$unified_info{sources}->{$_}} }
50 grep { /\.o$/ } keys %{$unified_info{sources}} ),
51 ( grep { /\.h$/ } keys %{$unified_info{generate}} ) );
53 # This is a horrible hack, but is needed because recursive inclusion of files
54 # in different directories does not work well with HP C.
55 my $sd = sourcedir("crypto", "async", "arch");
56 foreach (grep /\[\.crypto\.async\.arch\].*\.o$/, keys %{$unified_info{sources}}) {
57 (my $x = $_) =~ s|\.o$|.OBJ|;
58 $unified_info{before}->{$x}
59 = qq(arch_include = F\$PARSE("$sd","A.;",,,"SYNTAX_ONLY") - "A.;"
60 define arch 'arch_include');
61 $unified_info{after}->{$x}
64 my $sd1 = sourcedir("ssl","record");
65 my $sd2 = sourcedir("ssl","statem");
66 my @ssl_locl_users = grep(/^\[\.(?:ssl\.(?:record|statem)|test)\].*\.o$/,
67 keys %{$unified_info{sources}});
68 foreach (@ssl_locl_users) {
69 (my $x = $_) =~ s|\.o$|.OBJ|;
70 $unified_info{before}->{$x}
71 = qq(record_include = F\$PARSE("$sd1","A.;",,,"SYNTAX_ONLY") - "A.;"
72 define record 'record_include'
73 statem_include = F\$PARSE("$sd2","A.;",,,"SYNTAX_ONLY") - "A.;"
74 define statem 'statem_include');
75 $unified_info{after}->{$x}
79 # This makes sure things get built in the order they need
84 return "$target : build_generated\n\t\pipe \$(MMS) depend && \$(MMS) _$target\n_$target";
87 #print STDERR "DEBUG: before:\n", Dumper($unified_info{before});
88 #print STDERR "DEBUG: after:\n", Dumper($unified_info{after});
91 PLATFORM={- $config{target} -}
92 OPTIONS={- $config{options} -}
93 CONFIGURE_ARGS=({- join(", ",quotify_l(@{$config{perlargv}})) -})
94 SRCDIR={- $config{sourcedir} -}
95 BLDDIR={- $config{builddir} -}
97 # Allow both V and VERBOSE to indicate verbosity. This only applies
101 VERSION={- $config{version} -}
102 MAJOR={- $config{major} -}
103 MINOR={- $config{minor} -}
104 SHLIB_VERSION_NUMBER={- $config{shlib_version_number} -}
105 SHLIB_VERSION_HISTORY={- $config{shlib_version_history} -}
106 SHLIB_MAJOR={- $config{shlib_major} -}
107 SHLIB_MINOR={- $config{shlib_minor} -}
108 SHLIB_TARGET={- $target{shared_target} -}
116 LIBS={- join(", ", map { "-\n\t".$_.".OLB" } @{$unified_info{libraries}}) -}
117 SHLIBS={- join(", ", map { "-\n\t".$_.".EXE" } @shlibs) -}
118 ENGINES={- join(", ", map { "-\n\t".$_.".EXE" } @{$unified_info{engines}}) -}
119 PROGRAMS={- join(", ", map { "-\n\t".$_.".EXE" } @{$unified_info{programs}}) -}
120 SCRIPTS={- join(", ", map { "-\n\t".$_ } @{$unified_info{scripts}}) -}
121 {- output_off() if $disabled{makedepend}; "" -}
122 DEPS={- our @deps = map { (my $x = $_) =~ s|\.o$|\$(DEP_EXT)|; $x; }
123 grep { $unified_info{sources}->{$_}->[0] =~ /\.c$/ }
124 keys %{$unified_info{sources}};
125 join(", ", map { "-\n\t".$_ } @deps); -}
126 {- output_on() if $disabled{makedepend}; "" -}
127 GENERATED_MANDATORY={- join(", ", map { "-\n\t".$_ } @{$unified_info{depends}->{""}} ) -}
128 GENERATED={- join(", ", map { "-\n\t".$_ } @generated) -}
130 INSTALL_LIBS={- join(", ", map { "-\n\t".$_.".OLB" } @{$unified_info{install}->{libraries}}) -}
131 INSTALL_SHLIBS={- join(", ", map { "-\n\t".$_.".EXE" } @install_shlibs) -}
132 INSTALL_ENGINES={- join(", ", map { "-\n\t".$_.".EXE" } @{$unified_info{install}->{engines}}) -}
133 INSTALL_PROGRAMS={- join(", ", map { "-\n\t".$_.".EXE" } @{$unified_info{install}->{programs}}) -}
134 {- output_off() if $disabled{apps}; "" -}
135 BIN_SCRIPTS=[.tools]c_rehash.pl
136 MISC_SCRIPTS=[.apps]CA.pl, [.apps]tsget.pl
137 {- output_on() if $disabled{apps}; "" -}
139 # DESTDIR is for package builders so that they can configure for, say,
140 # SYS$COMMON:[OPENSSL] and yet have everything installed in STAGING:[USER].
141 # In that case, configure with --prefix=SYS$COMMON:[OPENSSL] and then run
142 # MMS with /MACROS=(DESTDIR=STAGING:[USER]). The result will end up in
143 # STAGING:[USER.OPENSSL].
144 # Normally it is left empty.
147 # Do not edit this manually. Use Configure --prefix=DIR to change this!
148 INSTALLTOP={- our $installtop =
149 catdir($config{prefix}) || "SYS\$COMMON:[OPENSSL]";
151 SYSTARTUP={- catdir($installtop, '[.SYS$STARTUP]'); -}
152 # This is the standard central area to store certificates, private keys...
153 OPENSSLDIR={- catdir($config{openssldir}) or
154 $config{prefix} ? catdir($config{prefix},"COMMON")
155 : "SYS\$COMMON:[OPENSSL-COMMON]" -}
156 # The same, but for C
157 OPENSSLDIR_C={- $osslprefix -}DATAROOT:[000000]
158 # Where installed engines reside, for C
159 ENGINESDIR_C={- $osslprefix -}ENGINES{- $sover.$target{pointer_size} -}:
161 CC= {- $target{cc} -}
162 CFLAGS= /DEFINE=({- join(",", @{$target{defines}}, @{$config{defines}},"OPENSSLDIR=\"\"\"\$(OPENSSLDIR_C)\"\"\"","ENGINESDIR=\"\"\"\$(ENGINESDIR_C)\"\"\"") -}) {- $target{cflags} -} {- $config{cflags} -}
164 DEPFLAG= /DEFINE=({- join(",", @{$config{depdefines}}) -})
165 LDFLAGS= {- $target{lflags} -}
166 EX_LIBS= {- $target{ex_libs} ? ",".$target{ex_libs} : "" -}{- $config{ex_libs} ? ",".$config{ex_libs} : "" -}
167 LIB_CFLAGS={- $target{lib_cflags} // "" -}
168 DSO_CFLAGS={- $target{dso_cflags} // "" -}
169 BIN_CFLAGS={- $target{bin_cflags} // "" -}
170 NO_INST_LIB_CFLAGS={- $target{no_inst_lib_cflags} // '$(LIB_CFLAGS)' -}
171 NO_INST_DSO_CFLAGS={- $target{no_inst_dso_cflags} // '$(DSO_CFLAGS)' -}
172 NO_INST_BIN_CFLAGS={- $target{no_inst_bin_cflags} // '$(BIN_CFLAGS)' -}
174 PERL={- $config{perl} -}
176 # We let the C compiler driver to take care of .s files. This is done in
177 # order to be excused from maintaining a separate set of architecture
178 # dependent assembler flags. E.g. if you throw -mcpu=ultrasparc at SPARC
179 # gcc, then the driver will automatically translate it to -xarch=v8plus
180 # and pass it down to assembler.
182 ASFLAG={- $target{asflags} -}
184 # .FIRST and .LAST are special targets with MMS and MMK.
185 # The defines in there are for C. includes that look like
188 # #include <openssl/foo.h>
189 # #include "internal/bar.h"
191 # will use the logical names to find the files. Expecting
192 # DECompHP C to find files in subdirectories of whatever was
193 # given with /INCLUDE is a fantasy, unfortunately.
196 $(NODEBUG) openssl_inc1 = F$PARSE("[.include.openssl]","A.;",,,"syntax_only") - "A.;"
197 $(NODEBUG) openssl_inc2 = F$PARSE("{- catdir($config{sourcedir},"[.include.openssl]") -}","A.;",,,"SYNTAX_ONLY") - "A.;"
198 $(NODEBUG) internal_inc1 = F$PARSE("[.crypto.include.internal]","A.;",,,"SYNTAX_ONLY") - "A.;"
199 $(NODEBUG) internal_inc2 = F$PARSE("{- catdir($config{sourcedir},"[.include.internal]") -}","A.;",,,"SYNTAX_ONLY") - "A.;"
200 $(NODEBUG) internal_inc3 = F$PARSE("{- catdir($config{sourcedir},"[.crypto.include.internal]") -}","A.;",,,"SYNTAX_ONLY") - "A.;"
201 $(NODEBUG) DEFINE openssl 'openssl_inc1','openssl_inc2'
202 $(NODEBUG) DEFINE internal 'internal_inc1','internal_inc2','internal_inc3'
203 $(NODEBUG) staging_dir = "$(DESTDIR)"
204 $(NODEBUG) staging_instdir = ""
205 $(NODEBUG) staging_datadir = ""
206 $(NODEBUG) IF staging_dir .NES. "" THEN -
207 staging_instdir = F$PARSE("A.;",staging_dir,"[]",,"SYNTAX_ONLY")
208 $(NODEBUG) IF staging_instdir - "]A.;" .NES. staging_instdir THEN -
209 staging_instdir = staging_instdir - "]A.;" + ".OPENSSL-INSTALL]"
210 $(NODEBUG) IF staging_instdir - "A.;" .NES. staging_instdir THEN -
211 staging_instdir = staging_instdir - "A.;" + "[OPENSSL-INSTALL]"
212 $(NODEBUG) IF staging_dir .NES. "" THEN -
213 staging_datadir = F$PARSE("A.;",staging_dir,"[]",,"SYNTAX_ONLY")
214 $(NODEBUG) IF staging_datadir - "]A.;" .NES. staging_datadir THEN -
215 staging_datadir = staging_datadir - "]A.;" + ".OPENSSL-COMMON]"
216 $(NODEBUG) IF staging_datadir - "A.;" .NES. staging_datadir THEN -
217 staging_datadir = staging_datadir - "A.;" + "[OPENSSL-COMMON]"
219 $(NODEBUG) ! Installation logical names
221 $(NODEBUG) installtop = F$PARSE(staging_instdir,"$(INSTALLTOP)","[]A.;",,"SYNTAX_ONLY,NO_CONCEAL") - ".][000000" - "[000000." - "][" - "]A.;" + ".]"
222 $(NODEBUG) datatop = F$PARSE(staging_datadir,"$(OPENSSLDIR)","[]A.;",,"SYNTAX_ONLY,NO_CONCEAL") - ".][000000" - "[000000." - "][" - "]A.;" + ".]"
223 $(NODEBUG) DEFINE ossl_installroot 'installtop'
224 $(NODEBUG) DEFINE ossl_dataroot 'datatop'
226 $(NODEBUG) ! Figure out the architecture
228 $(NODEBUG) arch = f$edit( f$getsyi( "arch_name"), "upcase")
230 $(NODEBUG) ! Set up logical names for the libraries, so LINK and
231 $(NODEBUG) ! running programs can use them.
233 $(NODEBUG) {- join("\n\t\$(NODEBUG) ", map { "DEFINE ".uc($_)." 'F\$ENV(\"DEFAULT\")'".uc($_)."\$(SHLIB_EXT)" } map { $unified_info{sharednames}->{$_} || () } @{$unified_info{libraries}}) || "!" -}
236 $(NODEBUG) {- join("\n\t\$(NODEBUG) ", map { "DEASSIGN ".uc($_) } map { $unified_info{sharednames}->{$_} || () } @{$unified_info{libraries}}) || "!" -}
237 $(NODEBUG) DEASSIGN ossl_dataroot
238 $(NODEBUG) DEASSIGN ossl_installroot
239 $(NODEBUG) DEASSIGN internal
240 $(NODEBUG) DEASSIGN openssl
242 @ ! MMS cannot handle no actions...
244 # The main targets ###################################################
246 {- dependmagic('all'); -} : build_libs_nodep, build_engines_nodep, build_programs_nodep
247 {- dependmagic('build_libs'); -} : build_libs_nodep
248 {- dependmagic('build_engines'); -} : build_engines_nodep
249 {- dependmagic('build_programs'); -} : build_programs_nodep
251 build_generated : $(GENERATED_MANDATORY)
252 build_libs_nodep : $(LIBS), $(SHLIBS)
253 build_engines_nodep : $(ENGINES)
254 build_programs_nodep : $(PROGRAMS), $(SCRIPTS)
256 # Kept around for backward compatibility
257 build_apps build_tests : build_programs
260 {- dependmagic('tests'); -} : build_programs_nodep, build_engines_nodep
261 @ ! {- output_off() if $disabled{tests}; "" -}
262 SET DEFAULT [.test]{- move("test") -}
263 DEFINE SRCTOP {- sourcedir() -}
264 DEFINE BLDTOP {- builddir() -}
265 DEFINE OPENSSL_ENGINES {- builddir("engines") -}
266 DEFINE OPENSSL_DEBUG_MEMORY "on"
267 IF "$(VERBOSE)" .NES. "" THEN DEFINE VERBOSE "$(VERBOSE)"
268 $(PERL) {- sourcefile("test", "run_tests.pl") -} $(TESTS)
269 DEASSIGN OPENSSL_DEBUG_MEMORY
270 DEASSIGN OPENSSL_ENGINES
273 SET DEFAULT [-]{- move("..") -}
274 @ ! {- if ($disabled{tests}) { output_on(); } else { output_off(); } "" -}
275 @ WRITE SYS$OUTPUT "Tests are not supported with your chosen Configure options"
276 @ ! {- output_on() if !$disabled{tests}; "" -}
279 @ ! {- output_off() if $disabled{tests}; "" -}
280 @ DEFINE SRCTOP {- sourcedir() -}
281 @ $(PERL) {- sourcefile("test", "run_tests.pl") -} list
283 @ ! {- if ($disabled{tests}) { output_on(); } else { output_off(); } "" -}
284 @ WRITE SYS$OUTPUT "Tests are not supported with your chosen Configure options"
285 @ ! {- output_on() if !$disabled{tests}; "" -}
287 install : install_sw install_ssldirs install_docs
288 @ WRITE SYS$OUTPUT ""
289 @ WRITE SYS$OUTPUT "######################################################################"
290 @ WRITE SYS$OUTPUT ""
291 @ IF "$(DESTDIR)" .EQS. "" THEN -
292 PIPE ( WRITE SYS$OUTPUT "Installation complete" ; -
293 WRITE SYS$OUTPUT "" ; -
294 WRITE SYS$OUTPUT "Run @$(SYSTARTUP)openssl_startup{- $osslver -} to set up logical names" ; -
295 WRITE SYS$OUTPUT "then run @$(SYSTARTUP)openssl_utils{- $osslver -} to define commands" ; -
296 WRITE SYS$OUTPUT "" )
297 @ IF "$(DESTDIR)" .NES. "" THEN -
298 PIPE ( WRITE SYS$OUTPUT "Staging installation complete" ; -
299 WRITE SYS$OUTPUT "" ; -
300 WRITE SYS$OUTPUT "Finish or package in such a way that the contents of the directory tree" ; -
301 WRITE SYS$OUTPUT staging_instdir ; -
302 WRITE SYS$OUTPUT "ends up in $(INSTALLTOP)," ; -
303 WRITE SYS$OUTPUT "and that the contents of the contents of the directory tree" ; -
304 WRITE SYS$OUTPUT staging_datadir ; -
305 WRITE SYS$OUTPUT "ends up in $(OPENSSLDIR)" ; -
306 WRITE SYS$OUTPUT "" ; -
307 WRITE SYS$OUTPUT "When in its final destination," ; -
308 WRITE SYS$OUTPUT "Run @$(SYSTARTUP)openssl_startup{- $osslver -} to set up logical names" ; -
309 WRITE SYS$OUTPUT "then run @$(SYSTARTUP)openssl_utils{- $osslver -} to define commands" ; -
310 WRITE SYS$OUTPUT "" )
313 spawn/nolog @ossl_installroot:[SYSTEST]openssl_ivp{- $osslver -}.com
315 uninstall : uninstall_docs uninstall_sw
317 # Because VMS wants the generation number (or *) to delete files, we can't
318 # use $(LIBS), $(PROGRAMS), $(GENERATED) and $(ENGINES)directly.
320 {- join("\n\t", map { "- DELETE $_.OLB;*" } @{$unified_info{libraries}}) || "@ !" -}
321 {- join("\n\t", map { "- DELETE $_.EXE;*,$_.MAP;*,$_.OPT;*" } @shlibs) || "@ !" -}
324 {- join("\n\t", map { "- DELETE $_.EXE;*,$_.OPT;*" } @{$unified_info{programs}}) || "@ !" -}
325 {- join("\n\t", map { "- DELETE $_.EXE;*,$_.OPT;*" } @{$unified_info{engines}}) || "@ !" -}
326 {- join("\n\t", map { "- DELETE $_;*" } @{$unified_info{scripts}}) || "@ !" -}
327 {- join("\n\t", map { "- DELETE $_;*" } @generated) || "@ !" -}
328 - DELETE [...]*.MAP;*
330 - DELETE [...]*.OBJ;*,*.LIS;*
331 - DELETE []CXX$DEMANGLER_DB.;*
332 - DELETE [.VMS]openssl_startup.com;*
333 - DELETE [.VMS]openssl_shutdown.com;*
334 - DELETE []vmsconfig.pm;*
337 - DELETE configdata.pm;*
338 - DELETE descrip.mms;*
342 @ ! {- output_off() if $disabled{makedepend}; "" -}
343 @ $(PERL) -pe "if (/^# DO NOT DELETE.*/) { exit(0); }" -
344 < descrip.mms > descrip.mms-new
345 @ OPEN/APPEND DESCRIP descrip.mms-new
346 @ WRITE DESCRIP "# DO NOT DELETE THIS LINE -- make depend depends on it."
347 {- join("\n\t", map { "\@ IF F\$SEARCH(\"$_\") .NES. \"\" THEN TYPE $_ /OUTPUT=DESCRIP:" } @deps); -}
349 @ PIPE ( $(PERL) -e "use File::Compare qw/compare_text/; my $x = compare_text(""descrip.mms"",""descrip.mms-new""); exit(0x10000000 + ($x == 0));" || -
350 RENAME descrip.mms-new descrip.mms )
351 @ IF F$SEARCH("descrip.mms-new") .NES. "" THEN DELETE descrip.mms-new;*
352 -@ SPAWN/OUTPUT=NLA0: PURGE/NOLOG descrip.mms
353 @ ! {- output_on() if $disabled{makedepend}; "" -}
355 # Install helper targets #############################################
357 install_sw : all install_shared _install_dev_ns -
358 install_engines _install_runtime_ns -
359 install_startup install_ivp
361 uninstall_sw : uninstall_shared _uninstall_dev_ns -
362 uninstall_engines _uninstall_runtime_ns -
363 uninstall_startup uninstall_ivp
365 install_docs : install_html_docs
367 uninstall_docs : uninstall_html_docs
369 install_ssldirs : check_INSTALLTOP
370 - CREATE/DIR/PROT=(S:RWED,O:RWE,G:RE,W:RE) OSSL_DATAROOT:[000000]
371 IF F$SEARCH("OSSL_DATAROOT:[000000]CERTS.DIR;1") .EQS. "" THEN -
372 CREATE/DIR/PROT=(S:RWED,O:RWE,G:RE,W:RE) OSSL_DATAROOT:[CERTS]
373 IF F$SEARCH("OSSL_DATAROOT:[000000]PRIVATE.DIR;1") .EQS. "" THEN -
374 CREATE/DIR/PROT=(S:RWED,O:RWE,G,W) OSSL_DATAROOT:[PRIVATE]
375 IF F$SEARCH("OSSL_DATAROOT:[000000]MISC.DIR;1") .EQS. "" THEN -
376 CREATE/DIR/PROT=(S:RWED,O:RWE,G,W) OSSL_DATAROOT:[MISC]
377 COPY/PROT=W:RE $(MISC_SCRIPTS) OSSL_DATAROOT:[MISC]
378 @ ! Install configuration file
379 COPY/PROT=W:R {- sourcefile("apps", "openssl-vms.cnf") -} -
380 ossl_dataroot:[000000]openssl.cnf-dist
381 IF F$SEARCH("OSSL_DATAROOT:[000000]openssl.cnf") .EQS. "" THEN -
382 COPY/PROT=W:R {- sourcefile("apps", "openssl-vms.cnf") -} -
383 ossl_dataroot:[000000]openssl.cnf
384 @ ! Install CTLOG configuration file
385 COPY/PROT=W:R {- sourcefile("apps", "ct_log_list.cnf") -} -
386 ossl_dataroot:[000000]ct_log_list.cnf-dist
387 IF F$SEARCH("OSSL_DATAROOT:[000000]ct_log_list.cnf") .EQS. "" THEN -
388 COPY/PROT=W:R {- sourcefile("apps", "ct_log_list.cnf") -} -
389 ossl_dataroot:[000000]ct_log_list.cnf
391 install_shared : check_INSTALLTOP
392 @ {- output_off() if $disabled{shared}; "" -} !
393 @ WRITE SYS$OUTPUT "*** Installing shareable images"
394 @ ! Install shared (runtime) libraries
395 - CREATE/DIR ossl_installroot:[LIB.'arch']
397 map { "COPY/PROT=W:R $_.EXE ossl_installroot:[LIB.'arch']" }
399 @ {- output_on() if $disabled{shared}; "" -} !
401 _install_dev_ns : check_INSTALLTOP
402 @ WRITE SYS$OUTPUT "*** Installing development files"
403 @ ! Install header files
404 - CREATE/DIR ossl_installroot:[include.openssl]
405 COPY/PROT=W:R openssl:*.h ossl_installroot:[include.openssl]
406 @ ! Install static (development) libraries
407 - CREATE/DIR ossl_installroot:[LIB.'arch']
409 map { "COPY/PROT=W:R $_.OLB ossl_installroot:[LIB.'arch']" }
410 @{$unified_info{install}->{libraries}}) -}
412 install_dev : install_shared _install_dev_ns
414 _install_runtime_ns : check_INSTALLTOP
415 @ ! Install the main program
416 - CREATE/DIR ossl_installroot:[EXE.'arch']
417 COPY/PROT=W:RE [.APPS]openssl.EXE -
418 ossl_installroot:[EXE.'arch']openssl{- $osslver -}.EXE
420 COPY/PROT=W:RE $(BIN_SCRIPTS) ossl_installroot:[EXE]
421 @ ! {- output_on() if $disabled{apps}; "" -}
423 install_runtime : install_shared _install_runtime_ns
425 install_engines : check_INSTALLTOP
426 @ {- output_off() unless scalar @{$unified_info{engines}}; "" -} !
427 @ WRITE SYS$OUTPUT "*** Installing engines"
428 - CREATE/DIR ossl_installroot:[ENGINES{- $sover.$target{pointer_size} -}.'arch']
430 map { "COPY/PROT=W:RE $_.EXE ossl_installroot:[ENGINES$sover$target{pointer_size}.'arch']" }
431 @{$unified_info{install}->{engines}}) -}
432 @ {- output_on() unless scalar @{$unified_info{engines}}; "" -} !
434 install_startup : [.VMS]openssl_startup.com [.VMS]openssl_shutdown.com -
435 [.VMS]openssl_utils.com, check_INSTALLTOP
436 - CREATE/DIR ossl_installroot:[SYS$STARTUP]
437 COPY/PROT=W:RE [.VMS]openssl_startup.com -
438 ossl_installroot:[SYS$STARTUP]openssl_startup{- $osslver -}.com
439 COPY/PROT=W:RE [.VMS]openssl_shutdown.com -
440 ossl_installroot:[SYS$STARTUP]openssl_shutdown{- $osslver -}.com
441 COPY/PROT=W:RE [.VMS]openssl_utils.com -
442 ossl_installroot:[SYS$STARTUP]openssl_utils{- $osslver -}.com
444 install_ivp : [.VMS]openssl_ivp.com check_INSTALLTOP
445 - CREATE/DIR ossl_installroot:[SYSTEST]
446 COPY/PROT=W:RE [.VMS]openssl_ivp.com -
447 ossl_installroot:[SYSTEST]openssl_ivp{- $osslver -}.com
449 [.VMS]openssl_startup.com : vmsconfig.pm {- sourcefile("VMS", "openssl_startup.com.in") -}
451 $(PERL) "-I." "-Mvmsconfig" {- sourcefile("util", "dofile.pl") -} -
452 {- sourcefile("VMS", "openssl_startup.com.in") -} -
453 > [.VMS]openssl_startup.com
455 [.VMS]openssl_utils.com : vmsconfig.pm {- sourcefile("VMS", "openssl_utils.com.in") -}
457 $(PERL) "-I." "-Mvmsconfig" {- sourcefile("util", "dofile.pl") -} -
458 {- sourcefile("VMS", "openssl_utils.com.in") -} -
459 > [.VMS]openssl_utils.com
461 [.VMS]openssl_shutdown.com : vmsconfig.pm {- sourcefile("VMS", "openssl_shutdown.com.in") -}
463 $(PERL) "-I." "-Mvmsconfig" {- sourcefile("util", "dofile.pl") -} -
464 {- sourcefile("VMS", "openssl_shutdown.com.in") -} -
465 > [.VMS]openssl_shutdown.com
467 [.VMS]openssl_ivp.com : vmsconfig.pm {- sourcefile("VMS", "openssl_ivp.com.in") -}
469 $(PERL) "-I." "-Mvmsconfig" {- sourcefile("util", "dofile.pl") -} -
470 {- sourcefile("VMS", "openssl_ivp.com.in") -} -
471 > [.VMS]openssl_ivp.com
473 vmsconfig.pm : configdata.pm
474 OPEN/WRITE/SHARE=READ CONFIG []vmsconfig.pm
475 WRITE CONFIG "package vmsconfig;"
476 WRITE CONFIG "use strict; use warnings;"
477 WRITE CONFIG "use Exporter;"
478 WRITE CONFIG "our @ISA = qw(Exporter);"
479 WRITE CONFIG "our @EXPORT = qw(%config %target %withargs %unified_info %disabled);"
480 WRITE CONFIG "our %config = ("
481 WRITE CONFIG " target => '","{- $config{target} -}","',"
482 WRITE CONFIG " version => '","{- $config{version} -}","',"
483 WRITE CONFIG " shlib_major => '","{- $config{shlib_major} -}","',"
484 WRITE CONFIG " shlib_minor => '","{- $config{shlib_minor} -}","',"
485 WRITE CONFIG " no_shared => '","{- $disabled{shared} -}","',"
486 WRITE CONFIG " INSTALLTOP => '$(INSTALLTOP)',"
487 WRITE CONFIG " OPENSSLDIR => '$(OPENSSLDIR)',"
488 WRITE CONFIG " pointer_size => '","{- $target{pointer_size} -}","',"
490 WRITE CONFIG "our %target = ();"
491 WRITE CONFIG "our %disabled = ();"
492 WRITE CONFIG "our %withargs = ();"
493 WRITE CONFIG "our %unified_info = ();"
497 install_html_docs : check_INSTALLTOP
498 sourcedir = F$PARSE("{- $sourcedir -}A.;","[]") - "]A.;" + ".DOC]"
499 $(PERL) {- sourcefile("util", "process_docs.pl") -} -
500 --sourcedir='sourcedir' --destdir=ossl_installroot:[HTML] -
504 @ IF "$(INSTALLTOP)" .EQS. "" THEN -
505 WRITE SYS$ERROR "INSTALLTOP should not be empty"
506 @ IF "$(INSTALLTOP)" .EQS. "" THEN -
509 # Helper targets #####################################################
511 # Developer targets ##################################################
514 SH LOGICAL/PROC openssl,internal,ossl_installroot,ossl_dataroot
516 # Building targets ###################################################
518 configdata.pm : $(SRCDIR)Configure $(SRCDIR)config.com {- join(" ", @{$config{build_file_templates}}, @{$config{build_infos}}, @{$config{conf_files}}) -}
519 @ WRITE SYS$OUTPUT "Reconfiguring..."
520 perl $(SRCDIR)Configure reconf
521 @ WRITE SYS$OUTPUT "*************************************************"
522 @ WRITE SYS$OUTPUT "*** ***"
523 @ WRITE SYS$OUTPUT "*** Please run the same mms command again ***"
524 @ WRITE SYS$OUTPUT "*** ***"
525 @ WRITE SYS$OUTPUT "*************************************************"
526 @ PIPE ( EXIT %X10000000 )
530 use File::Spec::Functions qw/abs2rel rel2abs catfile catdir/;
532 # Helper function to figure out dependencies on libraries
533 # It takes a list of library names and outputs a list of dependencies
534 sub compute_lib_depends {
535 if ($disabled{shared}) {
536 return map { $_ =~ /\.a$/ ? $`.".OLB" : $_.".OLB" } @_;
538 return map { $_ =~ /\.a$/
540 : $unified_info{sharednames}->{$_}.".EXE" } @_;
545 my $generator = join(" ", @{$args{generator}});
546 my $generator_incs = join("", map { ' "-I'.$_.'"' } @{$args{generator_incs}});
547 my $deps = join(", -\n\t\t", @{$args{generator_deps}}, @{$args{deps}});
549 if ($args{src} !~ /\.[sS]$/) {
550 if ($args{generator}->[0] =~ m|^.*\.in$|) {
551 my $dofile = abs2rel(rel2abs(catfile($config{sourcedir},
552 "util", "dofile.pl")),
553 rel2abs($config{builddir}));
555 $args{src} : $args{generator}->[0] $deps
556 \$(PERL) "-I\$(BLDDIR)" "-Mconfigdata" $dofile \\
557 "-o$target{build_file}" $generator > \$@
561 $args{src} : $args{generator}->[0] $deps
562 \$(PERL)$generator_incs $generator > \$@
566 die "No method to generate assembler source present.\n";
572 my $obj = $args{obj};
573 my $deps = join(", -\n\t\t", @{$args{srcs}}, @{$args{deps}});
575 # Because VMS C isn't very good at combining a /INCLUDE path with
576 # #includes having a relative directory (like '#include "../foo.h"),
577 # the best choice is to move to the first source file's intended
578 # directory before compiling, and make sure to write the object file
579 # in the correct position (important when the object tree is other
580 # than the source tree).
581 my $forward = dirname($args{srcs}->[0]);
582 my $backward = abs2rel(rel2abs("."), rel2abs($forward));
583 my $objd = abs2rel(rel2abs(dirname($obj)), rel2abs($forward));
584 my $objn = basename($obj);
587 map { abs2rel(rel2abs($_), rel2abs($forward)) } @{$args{srcs}});
589 if ($args{installed}) {
590 $ecflags = { lib => '$(LIB_CFLAGS)',
591 dso => '$(DSO_CFLAGS)',
592 bin => '$(BIN_CFLAGS)' } -> {$args{intent}};
594 $ecflags = { lib => '$(NO_INST_LIB_CFLAGS)',
595 dso => '$(NO_INST_DSO_CFLAGS)',
596 bin => '$(NO_INST_BIN_CFLAGS)' } -> {$args{intent}};
598 my $incs_on = "\@ !";
599 my $incs_off = "\@ !";
602 push @incs, @{$args{incs}} if @{$args{incs}};
603 unless ($disabled{zlib}) {
604 # GNV$ZLIB_INCLUDE is the standard logical name for later zlib
606 push @incs, ($withargs{zlib_include} || 'GNV$ZLIB_INCLUDE:');
610 "DEFINE tmp_includes "
611 .join(",-\n\t\t\t", map {
612 file_name_is_absolute($_)
613 ? $_ : catdir($backward,$_)
615 $incs_off = "DEASSIGN tmp_includes";
616 $incs = " /INCLUDE=(tmp_includes:)";
618 my $before = $unified_info{before}->{$obj.".OBJ"} || "\@ !";
619 my $after = $unified_info{after}->{$obj.".OBJ"} || "\@ !";
620 my $depbuild = $disabled{makedepend} ? ""
621 : " /MMS=(FILE=${objd}${objn}.tmp-D,TARGET=$obj.OBJ)";
628 \$(CC) \$(CFLAGS)${ecflags}${incs}${depbuild} /OBJECT=${objd}${objn}.OBJ /REPOSITORY=$backward $srcs
630 SET DEFAULT $backward
632 \@ PIPE ( \$(PERL) -e "use File::Compare qw/compare_text/; my \$x = compare_text(""$obj.D"",""$obj.tmp-D""); exit(0x10000000 + (\$x == 0));" || -
633 RENAME $obj.tmp-D $obj.d )
634 \@ IF F\$SEARCH("$obj.tmp-D") .NES. "" THEN DELETE $obj.tmp-D;*
640 my $lib = $args{lib};
641 my $shlib = $args{shlib};
642 my $libd = dirname($lib);
643 my $libn = basename($lib);
644 (my $mkdef_key = $libn) =~ s/^${osslprefix_q}lib([^0-9]*)\d*/$1/i;
645 my @deps = compute_lib_depends(@{$args{deps}});
646 my $deps = join(", -\n\t\t", @deps);
647 my $shlib_target = $disabled{shared} ? "" : $target{shared_target};
648 my $ordinalsfile = defined($args{ordinals}) ? $args{ordinals}->[1] : "";
649 my $engine_opt = abs2rel(rel2abs(catfile($config{sourcedir},
650 "VMS", "engine.opt")),
651 rel2abs($config{builddir}));
652 my $mkdef_pl = abs2rel(rel2abs(catfile($config{sourcedir},
653 "util", "mkdef.pl")),
654 rel2abs($config{builddir}));
655 my $translatesyms_pl = abs2rel(rel2abs(catfile($config{sourcedir},
656 "VMS", "translatesyms.pl")),
657 rel2abs($config{builddir}));
658 # The "[]" hack is because in .OPT files, each line inherits the
659 # previous line's file spec as default, so if no directory spec
660 # is present in the current line and the previous line has one that
661 # doesn't apply, you're in for a surprise.
663 join("\n\t", map { my $x = $_ =~ /\[/ ? $_ : "[]".$_;
664 $x =~ s|(\.EXE)|$1/SHARE|;
665 $x =~ s|(\.OLB)|$1/LIB|;
666 "WRITE OPT_FILE \"$x\"" } @deps)
669 $shlib.EXE : $lib.OLB $deps $ordinalsfile
670 \$(PERL) $mkdef_pl "$mkdef_key" "VMS" > $shlib.SYMVEC-tmp
671 \$(PERL) $translatesyms_pl \$(BLDDIR)CXX\$DEMANGLER_DB. < $shlib.SYMVEC-tmp > $shlib.SYMVEC
672 DELETE $shlib.SYMVEC-tmp;*
673 OPEN/WRITE/SHARE=READ OPT_FILE $shlib.OPT
674 WRITE OPT_FILE "IDENTIFICATION=""V$config{version}"""
675 TYPE $shlib.SYMVEC /OUTPUT=OPT_FILE:
676 WRITE OPT_FILE "$lib.OLB/LIBRARY"
679 LINK \$(LDFLAGS)/SHARE=\$\@ $shlib.OPT/OPT \$(EX_LIBS)
680 DELETE $shlib.SYMVEC;*
681 PURGE $shlib.EXE,$shlib.OPT,$shlib.MAP
683 . ($config{target} =~ m|alpha| ? "" : <<"EOF"
684 SET IMAGE/FLAGS=(NOCALL_DEBUG) \$\@
690 my $lib = $args{lib};
691 my $libd = dirname($lib);
692 my $libn = basename($lib);
693 (my $libn_nolib = $libn) =~ s/^lib//;
694 my @objs = map { "$_.OBJ" } @{$args{objs}};
695 my @deps = compute_lib_depends(@{$args{deps}});
696 my $deps = join(", -\n\t\t", @objs, @deps);
697 my $shlib_target = $disabled{shared} ? "" : $target{shared_target};
698 my $engine_opt = abs2rel(rel2abs(catfile($config{sourcedir},
699 "VMS", "engine.opt")),
700 rel2abs($config{builddir}));
701 # The "[]" hack is because in .OPT files, each line inherits the
702 # previous line's file spec as default, so if no directory spec
703 # is present in the current line and the previous line has one that
704 # doesn't apply, you're in for a surprise.
706 join(",-\"\n\t", map { my $x = $_ =~ /\[/ ? $_ : "[]".$_;
707 "WRITE OPT_FILE \"$x" } @objs).
710 join("\n\t", map { my $x = $_ =~ /\[/ ? $_ : "[]".$_;
711 $x =~ s|(\.EXE)|$1/SHARE|;
712 $x =~ s|(\.OLB)|$1/LIB|;
713 "WRITE OPT_FILE \"$x\"" } @deps)
717 OPEN/WRITE/SHARE=READ OPT_FILE $lib.OPT
718 TYPE $engine_opt /OUTPUT=OPT_FILE:
722 LINK \$(LDFLAGS)/SHARE=\$\@ $lib.OPT/OPT \$(EX_LIBS)
723 - PURGE $lib.EXE,$lib.OPT,$lib.MAP
725 . ($config{target} =~ m|alpha| ? "" : <<"EOF"
726 SET IMAGE/FLAGS=(NOCALL_DEBUG) \$\@
732 my $lib = $args{lib};
733 my $objs = join(", -\n\t\t", map { $_.".OBJ" } (@{$args{objs}}));
734 my $fill_lib = join("\n\t", (map { "LIBRARY/REPLACE $lib.OLB $_.OBJ" }
738 LIBRARY/CREATE/OBJECT $lib.OLB
745 my $bin = $args{bin};
746 my $bind = dirname($bin);
747 my $binn = basename($bin);
748 my @objs = map { "$_.OBJ" } @{$args{objs}};
749 my @deps = compute_lib_depends(@{$args{deps}});
750 my $deps = join(", -\n\t\t", @objs, @deps);
751 # The "[]" hack is because in .OPT files, each line inherits the
752 # previous line's file spec as default, so if no directory spec
753 # is present in the current line and the previous line has one that
754 # doesn't apply, you're in for a surprise.
756 join(",-\"\n\t", map { my $x = $_ =~ /\[/ ? $_ : "[]".$_;
757 "WRITE OPT_FILE \"$x" } @objs).
760 join("\n\t", map { my $x = $_ =~ /\[/ ? $_ : "[]".$_;
761 $x =~ s|(\.EXE)|$1/SHARE|;
762 $x =~ s|(\.OLB)|$1/LIB|;
763 "WRITE OPT_FILE \"$x\"" } @deps)
765 # The linking commands looks a bit complex, but it's for good reason.
766 # When you link, say, foo.obj, bar.obj and libsomething.exe/share, and
767 # bar.obj happens to have a symbol that also exists in libsomething.exe,
768 # the linker will warn about it, loudly, and will then choose to pick
769 # the first copy encountered (the one in bar.obj in this example).
770 # On Unix and on Windows, the corresponding maneuvre goes through
771 # silently with the same effect.
772 # With some test programs, made for checking the internals of OpenSSL,
773 # we do this kind of linking deliberately, picking a few specific object
774 # files from within [.crypto] or [.ssl] so we can reach symbols that are
775 # otherwise unreachable (since the shareable images only exports the
776 # symbols listed in [.util]*.num), and then with the shared libraries
777 # themselves. So we need to silence the warning about multiply defined
778 # symbols, to mimic the way linking work on Unix and Windows, and so
779 # the build isn't interrupted (MMS stops when warnings are signaled,
780 # by default), and so someone building doesn't have to worry where it
781 # isn't necessary. If there are other warnings, however, we show them
782 # and let it break the build.
785 OPEN/WRITE/SHARE=READ OPT_FILE $bin.OPT
789 - pipe SPAWN/WAIT/NOLOG/OUT=$bin.LINKLOG -
790 LINK \$(LDFLAGS)/EXEC=\$\@ $bin.OPT/OPT \$(EX_LIBS) ; -
791 link_status = \$status ; link_severity = link_status .AND. 7
792 @ search_severity = 1
793 -@ IF link_severity .EQ. 0 THEN -
794 pipe SEARCH $bin.LINKLOG "%","-"/MATCH=AND | -
795 SPAWN/WAIT/NOLOG/OUT=NLA0: -
796 SEARCH SYS\$INPUT: "-W-MULDEF,"/MATCH=NOR ; -
797 search_severity = \$severity
798 @ ! search_severity is 3 when the last search didn't find any matching
799 @ ! string: %SEARCH-I-NOMATCHES, no strings matched
800 @ ! If that was the result, we pretend linking got through without
801 @ ! fault or warning.
802 @ IF search_severity .EQ. 3 THEN link_severity = 1
803 @ ! At this point, if link_severity shows that there was a fault
804 @ ! or warning, make sure to restore the linking status.
805 -@ IF .NOT. link_severity THEN TYPE $bin.LINKLOG
806 -@ DELETE $bin.LINKLOG;*
807 @ IF .NOT. link_severity THEN SPAWN/WAIT/NOLOG EXIT 'link_status'
808 - PURGE $bin.EXE,$bin.OPT
810 . ($config{target} =~ m|alpha| ? "" : <<"EOF"
811 SET IMAGE/FLAGS=(NOCALL_DEBUG) \$\@
817 my $script = $args{script};
818 return "" if grep { $_ eq $script } @{$args{sources}}; # No overwrite!
819 my $sources = join(" ", @{$args{sources}});
820 my $dofile = abs2rel(rel2abs(catfile($config{sourcedir},
821 "util", "dofile.pl")),
822 rel2abs($config{builddir}));
825 \$(PERL) "-I\$(BLDDIR)" "-Mconfigdata" $dofile -
826 "-o$target{build_file}" $sources > $script
827 SET FILE/PROT=(S:RWED,O:RWED,G:RE,W:RE) $script
831 "" # Important! This becomes part of the template result.