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_dirname = sprintf "%02d%02d", split(/\./, $config{shlib_version_number});
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
46 map { (my $x = $_) =~ s/\.a$//; $x }
47 @{$unified_info{libraries}};
49 map { $unified_info{sharednames}->{$_} || () }
50 grep(!/\.a$/, @{$unified_info{libraries}});
52 map { (my $x = $_) =~ s/\.a$//; $x }
53 @{$unified_info{install}->{libraries}};
55 map { $unified_info{sharednames}->{$_} || () }
56 grep(!/\.a$/, @{$unified_info{install}->{libraries}});
57 our @generated = ( ( map { (my $x = $_) =~ s|\.S$|\.s|; $x }
58 grep { defined $unified_info{generate}->{$_} }
59 map { @{$unified_info{sources}->{$_}} }
60 grep { /\.o$/ } keys %{$unified_info{sources}} ),
61 ( grep { /\.h$/ } keys %{$unified_info{generate}} ) );
63 # This is a horrible hack, but is needed because recursive inclusion of files
64 # in different directories does not work well with HP C.
65 my $sd = sourcedir("crypto", "async", "arch");
66 foreach (grep /\[\.crypto\.async\.arch\].*\.o$/, keys %{$unified_info{sources}}) {
67 (my $x = $_) =~ s|\.o$|.OBJ|;
68 $unified_info{before}->{$x}
69 = qq(arch_include = F\$PARSE("$sd","A.;",,,"SYNTAX_ONLY") - "A.;"
70 define arch 'arch_include');
71 $unified_info{after}->{$x}
74 my $sd1 = sourcedir("ssl","record");
75 my $sd2 = sourcedir("ssl","statem");
76 my @ssl_locl_users = grep(/^\[\.(?:ssl\.(?:record|statem)|test)\].*\.o$/,
77 keys %{$unified_info{sources}});
78 foreach (@ssl_locl_users) {
79 (my $x = $_) =~ s|\.o$|.OBJ|;
80 $unified_info{before}->{$x}
81 = qq(record_include = F\$PARSE("$sd1","A.;",,,"SYNTAX_ONLY") - "A.;"
82 define record 'record_include'
83 statem_include = F\$PARSE("$sd2","A.;",,,"SYNTAX_ONLY") - "A.;"
84 define statem 'statem_include');
85 $unified_info{after}->{$x}
89 # This makes sure things get built in the order they need
94 return "$target : build_generated\n\t\pipe \$(MMS) \$(MMSQUALIFIERS) depend && \$(MMS) \$(MMSQUALIFIERS) _$target\n_$target";
97 #print STDERR "DEBUG: before:\n", Dumper($unified_info{before});
98 #print STDERR "DEBUG: after:\n", Dumper($unified_info{after});
101 PLATFORM={- $config{target} -}
102 OPTIONS={- $config{options} -}
103 CONFIGURE_ARGS=({- join(", ",quotify_l(@{$config{perlargv}})) -})
104 SRCDIR={- $config{sourcedir} -}
105 BLDDIR={- $config{builddir} -}
107 # Allow both V and VERBOSE to indicate verbosity. This only applies
111 VERSION={- $config{version} -}
112 MAJOR={- $config{major} -}
113 MINOR={- $config{minor} -}
114 SHLIB_VERSION_NUMBER={- $config{shlib_version_number} -}
115 SHLIB_VERSION_HISTORY={- $config{shlib_version_history} -}
116 SHLIB_MAJOR={- $config{shlib_major} -}
117 SHLIB_MINOR={- $config{shlib_minor} -}
118 SHLIB_TARGET={- $target{shared_target} -}
126 LIBS={- join(", ", map { "-\n\t".$_.".OLB" } @libs) -}
127 SHLIBS={- join(", ", map { "-\n\t".$_.".EXE" } @shlibs) -}
128 ENGINES={- join(", ", map { "-\n\t".$_.".EXE" } @{$unified_info{engines}}) -}
129 PROGRAMS={- join(", ", map { "-\n\t".$_.".EXE" } @{$unified_info{programs}}) -}
130 SCRIPTS={- join(", ", map { "-\n\t".$_ } @{$unified_info{scripts}}) -}
131 {- output_off() if $disabled{makedepend}; "" -}
132 DEPS={- our @deps = map { (my $x = $_) =~ s|\.o$|\$(DEP_EXT)|; $x; }
133 grep { $unified_info{sources}->{$_}->[0] =~ /\.c$/ }
134 keys %{$unified_info{sources}};
135 join(", ", map { "-\n\t".$_ } @deps); -}
136 {- output_on() if $disabled{makedepend}; "" -}
137 GENERATED_MANDATORY={- join(", ", map { "-\n\t".$_ } @{$unified_info{depends}->{""}} ) -}
138 GENERATED={- join(", ", map { "-\n\t".$_ } @generated) -}
140 INSTALL_LIBS={- join(", ", map { "-\n\t".$_.".OLB" } @install_libs) -}
141 INSTALL_SHLIBS={- join(", ", map { "-\n\t".$_.".EXE" } @install_shlibs) -}
142 INSTALL_ENGINES={- join(", ", map { "-\n\t".$_.".EXE" } @{$unified_info{install}->{engines}}) -}
143 INSTALL_PROGRAMS={- join(", ", map { "-\n\t".$_.".EXE" } @{$unified_info{install}->{programs}}) -}
144 {- output_off() if $disabled{apps}; "" -}
145 BIN_SCRIPTS=[.tools]c_rehash.pl
146 MISC_SCRIPTS=[.apps]CA.pl, [.apps]tsget.pl
147 {- output_on() if $disabled{apps}; "" -}
149 APPS_OPENSSL={- use File::Spec::Functions;
150 catfile("apps","openssl") -}
152 # DESTDIR is for package builders so that they can configure for, say,
153 # SYS$COMMON:[OPENSSL] and yet have everything installed in STAGING:[USER].
154 # In that case, configure with --prefix=SYS$COMMON:[OPENSSL] and then run
155 # MMS with /MACROS=(DESTDIR=STAGING:[USER]). The result will end up in
156 # STAGING:[USER.OPENSSL].
157 # Normally it is left empty.
160 # Do not edit this manually. Use Configure --prefix=DIR to change this!
161 INSTALLTOP={- our $installtop =
162 catdir($config{prefix}) || "SYS\$COMMON:[OPENSSL]";
164 SYSTARTUP={- catdir($installtop, '[.SYS$STARTUP]'); -}
165 # This is the standard central area to store certificates, private keys...
166 OPENSSLDIR={- catdir($config{openssldir}) or
167 $config{prefix} ? catdir($config{prefix},"COMMON")
168 : "SYS\$COMMON:[OPENSSL-COMMON]" -}
169 # The same, but for C
170 OPENSSLDIR_C={- $osslprefix -}DATAROOT:[000000]
171 # Where installed engines reside, for C
172 ENGINESDIR_C={- $osslprefix -}ENGINES{- $sover_dirname.$target{pointer_size} -}:
174 CC= {- $config{cc} -}
175 DEFINES={- our $defines = join(",",
176 '__dummy', # To make comma processing easier
177 @{$config{defines}}) -}
178 INCLUDES={- our $includes = join(',', @{$config{includes}}) -}
179 CPPFLAGS={- our $cppflags = join('', @{$config{cppflags}}) -}
180 CPPFLAGS_Q={- (my $x = $cppflags) =~ s|"|""|g; $defines =~ s|"|""|g;
181 $x .= "/DEFINE=($defines)";
182 $x .= "/INCLUDE=($includes)" if $includes;
184 CFLAGS={- join('', @{$config{cflags}}) -}
185 LDFLAGS= {- join('', @{$config{lflags}}) -}
186 EX_LIBS= {- join('', map { ','.$_ } @{$config{ex_libs}}) -}
187 LIB_DEFINES={- join("",
189 @{$target{shared_defines}},
190 'OPENSSLDIR="""$(OPENSSLDIR_C)"""',
191 'ENGINESDIR="""$(ENGINESDIR_C)"""')) -}
192 LIB_CFLAGS={- $target{lib_cflags} // "" -}
193 DSO_CFLAGS={- $target{dso_cflags} // "" -}
194 BIN_CFLAGS={- $target{bin_cflags} // "" -}
195 NO_INST_LIB_CFLAGS={- $target{no_inst_lib_cflags} // '$(LIB_CFLAGS)' -}
196 NO_INST_DSO_CFLAGS={- $target{no_inst_dso_cflags} // '$(DSO_CFLAGS)' -}
197 NO_INST_BIN_CFLAGS={- $target{no_inst_bin_cflags} // '$(BIN_CFLAGS)' -}
199 PERL={- $config{perl} -}
201 # We let the C compiler driver to take care of .s files. This is done in
202 # order to be excused from maintaining a separate set of architecture
203 # dependent assembler flags. E.g. if you throw -mcpu=ultrasparc at SPARC
204 # gcc, then the driver will automatically translate it to -xarch=v8plus
205 # and pass it down to assembler.
207 ASFLAGS={- join('', @{$config{asflags}}) -}
209 # .FIRST and .LAST are special targets with MMS and MMK.
210 # The defines in there are for C. includes that look like
213 # #include <openssl/foo.h>
214 # #include "internal/bar.h"
216 # will use the logical names to find the files. Expecting
217 # DECompHP C to find files in subdirectories of whatever was
218 # given with /INCLUDE is a fantasy, unfortunately.
221 $(NODEBUG) openssl_inc1 = F$PARSE("[.include.openssl]","A.;",,,"syntax_only") - "A.;"
222 $(NODEBUG) openssl_inc2 = F$PARSE("{- catdir($config{sourcedir},"[.include.openssl]") -}","A.;",,,"SYNTAX_ONLY") - "A.;"
223 $(NODEBUG) internal_inc1 = F$PARSE("[.crypto.include.internal]","A.;",,,"SYNTAX_ONLY") - "A.;"
224 $(NODEBUG) internal_inc2 = F$PARSE("{- catdir($config{sourcedir},"[.include.internal]") -}","A.;",,,"SYNTAX_ONLY") - "A.;"
225 $(NODEBUG) internal_inc3 = F$PARSE("{- catdir($config{sourcedir},"[.crypto.include.internal]") -}","A.;",,,"SYNTAX_ONLY") - "A.;"
226 $(NODEBUG) DEFINE openssl 'openssl_inc1','openssl_inc2'
227 $(NODEBUG) DEFINE internal 'internal_inc1','internal_inc2','internal_inc3'
228 $(NODEBUG) staging_dir = "$(DESTDIR)"
229 $(NODEBUG) staging_instdir = ""
230 $(NODEBUG) staging_datadir = ""
231 $(NODEBUG) IF staging_dir .NES. "" THEN -
232 staging_instdir = F$PARSE("A.;",staging_dir,"[]",,"SYNTAX_ONLY")
233 $(NODEBUG) IF staging_instdir - "]A.;" .NES. staging_instdir THEN -
234 staging_instdir = staging_instdir - "]A.;" + ".OPENSSL-INSTALL]"
235 $(NODEBUG) IF staging_instdir - "A.;" .NES. staging_instdir THEN -
236 staging_instdir = staging_instdir - "A.;" + "[OPENSSL-INSTALL]"
237 $(NODEBUG) IF staging_dir .NES. "" THEN -
238 staging_datadir = F$PARSE("A.;",staging_dir,"[]",,"SYNTAX_ONLY")
239 $(NODEBUG) IF staging_datadir - "]A.;" .NES. staging_datadir THEN -
240 staging_datadir = staging_datadir - "]A.;" + ".OPENSSL-COMMON]"
241 $(NODEBUG) IF staging_datadir - "A.;" .NES. staging_datadir THEN -
242 staging_datadir = staging_datadir - "A.;" + "[OPENSSL-COMMON]"
244 $(NODEBUG) ! Installation logical names
246 $(NODEBUG) installtop = F$PARSE(staging_instdir,"$(INSTALLTOP)","[]A.;",,"SYNTAX_ONLY,NO_CONCEAL") - ".][000000" - "[000000." - "][" - "]A.;" + ".]"
247 $(NODEBUG) datatop = F$PARSE(staging_datadir,"$(OPENSSLDIR)","[]A.;",,"SYNTAX_ONLY,NO_CONCEAL") - ".][000000" - "[000000." - "][" - "]A.;" + ".]"
248 $(NODEBUG) DEFINE ossl_installroot 'installtop'
249 $(NODEBUG) DEFINE ossl_dataroot 'datatop'
251 $(NODEBUG) ! Figure out the architecture
253 $(NODEBUG) arch = f$edit( f$getsyi( "arch_name"), "upcase")
255 $(NODEBUG) ! Set up logical names for the libraries, so LINK and
256 $(NODEBUG) ! running programs can use them.
258 $(NODEBUG) {- join("\n\t\$(NODEBUG) ", map { "DEFINE ".uc($_)." 'F\$ENV(\"DEFAULT\")'".uc($_)."\$(SHLIB_EXT)" } @shlibs) || "!" -}
261 $(NODEBUG) {- join("\n\t\$(NODEBUG) ", map { "DEASSIGN ".uc($_) } @shlibs) || "!" -}
262 $(NODEBUG) DEASSIGN ossl_dataroot
263 $(NODEBUG) DEASSIGN ossl_installroot
264 $(NODEBUG) DEASSIGN internal
265 $(NODEBUG) DEASSIGN openssl
267 @ ! MMS cannot handle no actions...
269 # The main targets ###################################################
271 {- dependmagic('all'); -} : build_libs_nodep, build_engines_nodep, build_programs_nodep
272 {- dependmagic('build_libs'); -} : build_libs_nodep
273 {- dependmagic('build_engines'); -} : build_engines_nodep
274 {- dependmagic('build_programs'); -} : build_programs_nodep
276 build_generated : $(GENERATED_MANDATORY)
277 build_libs_nodep : $(LIBS), $(SHLIBS)
278 build_engines_nodep : $(ENGINES)
279 build_programs_nodep : $(PROGRAMS), $(SCRIPTS)
281 # Kept around for backward compatibility
282 build_apps build_tests : build_programs
284 # Convenience target to prebuild all generated files, not just the mandatory
286 build_all_generated : $(GENERATED_MANDATORY) $(GENERATED)
289 {- dependmagic('tests'); -} : build_programs_nodep, build_engines_nodep
290 @ ! {- output_off() if $disabled{tests}; "" -}
291 SET DEFAULT [.test]{- move("test") -}
292 CREATE/DIR [.test-runs]
293 DEFINE SRCTOP {- sourcedir() -}
294 DEFINE BLDTOP {- builddir() -}
295 DEFINE RESULT_D {- builddir(qw(test test-runs)) -}
296 DEFINE OPENSSL_ENGINES {- builddir("engines") -}
297 DEFINE OPENSSL_DEBUG_MEMORY "on"
298 IF "$(VERBOSE)" .NES. "" THEN DEFINE VERBOSE "$(VERBOSE)"
299 $(PERL) {- sourcefile("test", "run_tests.pl") -} $(TESTS)
300 DEASSIGN OPENSSL_DEBUG_MEMORY
301 DEASSIGN OPENSSL_ENGINES
304 SET DEFAULT [-]{- move("..") -}
305 @ ! {- if ($disabled{tests}) { output_on(); } else { output_off(); } "" -}
306 @ WRITE SYS$OUTPUT "Tests are not supported with your chosen Configure options"
307 @ ! {- output_on() if !$disabled{tests}; "" -}
310 @ ! {- output_off() if $disabled{tests}; "" -}
311 @ DEFINE SRCTOP {- sourcedir() -}
312 @ $(PERL) {- sourcefile("test", "run_tests.pl") -} list
314 @ ! {- if ($disabled{tests}) { output_on(); } else { output_off(); } "" -}
315 @ WRITE SYS$OUTPUT "Tests are not supported with your chosen Configure options"
316 @ ! {- output_on() if !$disabled{tests}; "" -}
318 install : install_sw install_ssldirs install_docs
319 @ WRITE SYS$OUTPUT ""
320 @ WRITE SYS$OUTPUT "######################################################################"
321 @ WRITE SYS$OUTPUT ""
322 @ IF "$(DESTDIR)" .EQS. "" THEN -
323 PIPE ( WRITE SYS$OUTPUT "Installation complete" ; -
324 WRITE SYS$OUTPUT "" ; -
325 WRITE SYS$OUTPUT "Run @$(SYSTARTUP)openssl_startup{- $osslver -} to set up logical names" ; -
326 WRITE SYS$OUTPUT "then run @$(SYSTARTUP)openssl_utils{- $osslver -} to define commands" ; -
327 WRITE SYS$OUTPUT "" )
328 @ IF "$(DESTDIR)" .NES. "" THEN -
329 PIPE ( WRITE SYS$OUTPUT "Staging installation complete" ; -
330 WRITE SYS$OUTPUT "" ; -
331 WRITE SYS$OUTPUT "Finish or package in such a way that the contents of the directory tree" ; -
332 WRITE SYS$OUTPUT staging_instdir ; -
333 WRITE SYS$OUTPUT "ends up in $(INSTALLTOP)," ; -
334 WRITE SYS$OUTPUT "and that the contents of the contents of the directory tree" ; -
335 WRITE SYS$OUTPUT staging_datadir ; -
336 WRITE SYS$OUTPUT "ends up in $(OPENSSLDIR)" ; -
337 WRITE SYS$OUTPUT "" ; -
338 WRITE SYS$OUTPUT "When in its final destination," ; -
339 WRITE SYS$OUTPUT "Run @$(SYSTARTUP)openssl_startup{- $osslver -} to set up logical names" ; -
340 WRITE SYS$OUTPUT "then run @$(SYSTARTUP)openssl_utils{- $osslver -} to define commands" ; -
341 WRITE SYS$OUTPUT "" )
344 spawn/nolog @ossl_installroot:[SYSTEST]openssl_ivp{- $osslver -}.com
346 uninstall : uninstall_docs uninstall_sw
348 # Because VMS wants the generation number (or *) to delete files, we can't
349 # use $(LIBS), $(PROGRAMS), $(GENERATED) and $(ENGINES)directly.
351 {- join("\n\t", map { "- DELETE $_.OLB;*" } @libs) || "@ !" -}
352 {- join("\n\t", map { "- DELETE $_.EXE;*,$_.MAP;*" } @shlibs) || "@ !" -}
355 {- join("\n\t", map { "- DELETE $_.EXE;*,$_.OPT;*" } @{$unified_info{programs}}) || "@ !" -}
356 {- join("\n\t", map { "- DELETE $_.EXE;*,$_.OPT;*" } @{$unified_info{engines}}) || "@ !" -}
357 {- join("\n\t", map { "- DELETE $_;*" } @{$unified_info{scripts}}) || "@ !" -}
358 {- join("\n\t", map { "- DELETE $_;*" } @generated) || "@ !" -}
359 - DELETE [...]*.MAP;*
361 - DELETE [...]*.OBJ;*,*.LIS;*
362 - DELETE []CXX$DEMANGLER_DB.;*
363 - DELETE [.VMS]openssl_startup.com;*
364 - DELETE [.VMS]openssl_shutdown.com;*
365 - DELETE []vmsconfig.pm;*
368 - DELETE configdata.pm;*
369 - DELETE descrip.mms;*
373 @ ! {- output_off() if $disabled{makedepend}; "" -}
374 @ $(PERL) -pe "if (/^# DO NOT DELETE.*/) { exit(0); }" -
375 < descrip.mms > descrip.mms-new
376 @ OPEN/APPEND DESCRIP descrip.mms-new
377 @ WRITE DESCRIP "# DO NOT DELETE THIS LINE -- make depend depends on it."
378 {- join("\n\t", map { "\@ IF F\$SEARCH(\"$_\") .NES. \"\" THEN TYPE $_ /OUTPUT=DESCRIP:" } @deps); -}
380 @ PIPE ( $(PERL) -e "use File::Compare qw/compare_text/; my $x = compare_text(""descrip.mms"",""descrip.mms-new""); exit(0x10000000 + ($x == 0));" || -
381 RENAME descrip.mms-new descrip.mms )
382 @ IF F$SEARCH("descrip.mms-new") .NES. "" THEN DELETE descrip.mms-new;*
383 -@ SPAWN/OUTPUT=NLA0: PURGE/NOLOG descrip.mms
384 @ ! {- output_on() if $disabled{makedepend}; "" -}
386 # Install helper targets #############################################
388 install_sw : all install_shared _install_dev_ns -
389 install_engines _install_runtime_ns -
390 install_startup install_ivp
392 uninstall_sw : uninstall_shared _uninstall_dev_ns -
393 uninstall_engines _uninstall_runtime_ns -
394 uninstall_startup uninstall_ivp
396 install_docs : install_html_docs
398 uninstall_docs : uninstall_html_docs
400 install_ssldirs : check_INSTALLTOP
401 - CREATE/DIR/PROT=(S:RWED,O:RWE,G:RE,W:RE) OSSL_DATAROOT:[000000]
402 IF F$SEARCH("OSSL_DATAROOT:[000000]CERTS.DIR;1") .EQS. "" THEN -
403 CREATE/DIR/PROT=(S:RWED,O:RWE,G:RE,W:RE) OSSL_DATAROOT:[CERTS]
404 IF F$SEARCH("OSSL_DATAROOT:[000000]PRIVATE.DIR;1") .EQS. "" THEN -
405 CREATE/DIR/PROT=(S:RWED,O:RWE,G,W) OSSL_DATAROOT:[PRIVATE]
406 IF F$SEARCH("OSSL_DATAROOT:[000000]MISC.DIR;1") .EQS. "" THEN -
407 CREATE/DIR/PROT=(S:RWED,O:RWE,G,W) OSSL_DATAROOT:[MISC]
408 COPY/PROT=W:RE $(MISC_SCRIPTS) OSSL_DATAROOT:[MISC]
409 @ ! Install configuration file
410 COPY/PROT=W:R {- sourcefile("apps", "openssl-vms.cnf") -} -
411 ossl_dataroot:[000000]openssl.cnf-dist
412 IF F$SEARCH("OSSL_DATAROOT:[000000]openssl.cnf") .EQS. "" THEN -
413 COPY/PROT=W:R {- sourcefile("apps", "openssl-vms.cnf") -} -
414 ossl_dataroot:[000000]openssl.cnf
415 @ ! Install CTLOG configuration file
416 COPY/PROT=W:R {- sourcefile("apps", "ct_log_list.cnf") -} -
417 ossl_dataroot:[000000]ct_log_list.cnf-dist
418 IF F$SEARCH("OSSL_DATAROOT:[000000]ct_log_list.cnf") .EQS. "" THEN -
419 COPY/PROT=W:R {- sourcefile("apps", "ct_log_list.cnf") -} -
420 ossl_dataroot:[000000]ct_log_list.cnf
422 install_shared : check_INSTALLTOP
423 @ {- output_off() if $disabled{shared}; "" -} !
424 @ WRITE SYS$OUTPUT "*** Installing shareable images"
425 @ ! Install shared (runtime) libraries
426 - CREATE/DIR ossl_installroot:[LIB.'arch']
428 map { "COPY/PROT=W:R $_.EXE ossl_installroot:[LIB.'arch']" }
430 @ {- output_on() if $disabled{shared}; "" -} !
432 _install_dev_ns : check_INSTALLTOP
433 @ WRITE SYS$OUTPUT "*** Installing development files"
434 @ ! Install header files
435 - CREATE/DIR ossl_installroot:[include.openssl]
436 COPY/PROT=W:R openssl:*.h ossl_installroot:[include.openssl]
437 @ ! Install static (development) libraries
438 - CREATE/DIR ossl_installroot:[LIB.'arch']
440 map { "COPY/PROT=W:R $_.OLB ossl_installroot:[LIB.'arch']" }
443 install_dev : install_shared _install_dev_ns
445 _install_runtime_ns : check_INSTALLTOP
446 @ ! Install the main program
447 - CREATE/DIR ossl_installroot:[EXE.'arch']
448 COPY/PROT=W:RE [.APPS]openssl.EXE -
449 ossl_installroot:[EXE.'arch']openssl{- $osslver -}.EXE
451 COPY/PROT=W:RE $(BIN_SCRIPTS) ossl_installroot:[EXE]
452 @ ! {- output_on() if $disabled{apps}; "" -}
454 install_runtime : install_shared _install_runtime_ns
456 install_engines : check_INSTALLTOP
457 @ {- output_off() unless scalar @{$unified_info{engines}}; "" -} !
458 @ WRITE SYS$OUTPUT "*** Installing engines"
459 - CREATE/DIR ossl_installroot:[ENGINES{- $sover_dirname.$target{pointer_size} -}.'arch']
461 map { "COPY/PROT=W:RE $_.EXE ossl_installroot:[ENGINES$sover_dirname$target{pointer_size}.'arch']" }
462 @{$unified_info{install}->{engines}}) -}
463 @ {- output_on() unless scalar @{$unified_info{engines}}; "" -} !
465 install_startup : [.VMS]openssl_startup.com [.VMS]openssl_shutdown.com -
466 [.VMS]openssl_utils.com, check_INSTALLTOP
467 - CREATE/DIR ossl_installroot:[SYS$STARTUP]
468 COPY/PROT=W:RE [.VMS]openssl_startup.com -
469 ossl_installroot:[SYS$STARTUP]openssl_startup{- $osslver -}.com
470 COPY/PROT=W:RE [.VMS]openssl_shutdown.com -
471 ossl_installroot:[SYS$STARTUP]openssl_shutdown{- $osslver -}.com
472 COPY/PROT=W:RE [.VMS]openssl_utils.com -
473 ossl_installroot:[SYS$STARTUP]openssl_utils{- $osslver -}.com
475 install_ivp : [.VMS]openssl_ivp.com check_INSTALLTOP
476 - CREATE/DIR ossl_installroot:[SYSTEST]
477 COPY/PROT=W:RE [.VMS]openssl_ivp.com -
478 ossl_installroot:[SYSTEST]openssl_ivp{- $osslver -}.com
480 [.VMS]openssl_startup.com : vmsconfig.pm {- sourcefile("VMS", "openssl_startup.com.in") -}
482 $(PERL) "-I." "-Mvmsconfig" {- sourcefile("util", "dofile.pl") -} -
483 {- sourcefile("VMS", "openssl_startup.com.in") -} -
484 > [.VMS]openssl_startup.com
486 [.VMS]openssl_utils.com : vmsconfig.pm {- sourcefile("VMS", "openssl_utils.com.in") -}
488 $(PERL) "-I." "-Mvmsconfig" {- sourcefile("util", "dofile.pl") -} -
489 {- sourcefile("VMS", "openssl_utils.com.in") -} -
490 > [.VMS]openssl_utils.com
492 [.VMS]openssl_shutdown.com : vmsconfig.pm {- sourcefile("VMS", "openssl_shutdown.com.in") -}
494 $(PERL) "-I." "-Mvmsconfig" {- sourcefile("util", "dofile.pl") -} -
495 {- sourcefile("VMS", "openssl_shutdown.com.in") -} -
496 > [.VMS]openssl_shutdown.com
498 [.VMS]openssl_ivp.com : vmsconfig.pm {- sourcefile("VMS", "openssl_ivp.com.in") -}
500 $(PERL) "-I." "-Mvmsconfig" {- sourcefile("util", "dofile.pl") -} -
501 {- sourcefile("VMS", "openssl_ivp.com.in") -} -
502 > [.VMS]openssl_ivp.com
504 vmsconfig.pm : configdata.pm
505 OPEN/WRITE/SHARE=READ CONFIG []vmsconfig.pm
506 WRITE CONFIG "package vmsconfig;"
507 WRITE CONFIG "use strict; use warnings;"
508 WRITE CONFIG "use Exporter;"
509 WRITE CONFIG "our @ISA = qw(Exporter);"
510 WRITE CONFIG "our @EXPORT = qw(%config %target %withargs %unified_info %disabled);"
511 WRITE CONFIG "our %config = ("
512 WRITE CONFIG " target => '","{- $config{target} -}","',"
513 WRITE CONFIG " version => '","{- $config{version} -}","',"
514 WRITE CONFIG " shlib_version_number => '","{- $config{shlib_version_number} -}","',"
515 WRITE CONFIG " shlib_major => '","{- $config{shlib_major} -}","',"
516 WRITE CONFIG " shlib_minor => '","{- $config{shlib_minor} -}","',"
517 WRITE CONFIG " no_shared => '","{- $disabled{shared} -}","',"
518 WRITE CONFIG " INSTALLTOP => '$(INSTALLTOP)',"
519 WRITE CONFIG " OPENSSLDIR => '$(OPENSSLDIR)',"
520 WRITE CONFIG " pointer_size => '","{- $target{pointer_size} -}","',"
522 WRITE CONFIG "our %target = ();"
523 WRITE CONFIG "our %disabled = ();"
524 WRITE CONFIG "our %withargs = ();"
525 WRITE CONFIG "our %unified_info = ();"
529 install_html_docs : check_INSTALLTOP
530 sourcedir = F$PARSE("{- $sourcedir -}A.;","[]") - "]A.;" + ".DOC]"
531 $(PERL) {- sourcefile("util", "process_docs.pl") -} -
532 --sourcedir='sourcedir' --destdir=ossl_installroot:[HTML] -
536 @ IF "$(INSTALLTOP)" .EQS. "" THEN -
537 WRITE SYS$ERROR "INSTALLTOP should not be empty"
538 @ IF "$(INSTALLTOP)" .EQS. "" THEN -
541 # Helper targets #####################################################
543 # Developer targets ##################################################
546 SH LOGICAL/PROC openssl,internal,ossl_installroot,ossl_dataroot
548 # Building targets ###################################################
550 configdata.pm : $(SRCDIR)Configure $(SRCDIR)config.com {- join(" ", @{$config{build_file_templates}}, @{$config{build_infos}}, @{$config{conf_files}}) -}
551 perl configdata.pm -r -v
552 @ WRITE SYS$OUTPUT "*************************************************"
553 @ WRITE SYS$OUTPUT "*** ***"
554 @ WRITE SYS$OUTPUT "*** Please run the same mms command again ***"
555 @ WRITE SYS$OUTPUT "*** ***"
556 @ WRITE SYS$OUTPUT "*************************************************"
557 @ PIPE ( EXIT %X10000000 )
560 perl configdata.pm -r -v
564 use File::Spec::Functions qw/abs2rel rel2abs catfile catdir/;
566 # Helper function to figure out dependencies on libraries
567 # It takes a list of library names and outputs a list of dependencies
568 sub compute_lib_depends {
569 if ($disabled{shared}) {
570 return map { $_ =~ /\.a$/ ? $`.".OLB" : $_.".OLB" } @_;
572 return map { $_ =~ /\.a$/
574 : $unified_info{sharednames}->{$_}.".EXE" } @_;
579 my $generator = join(" ", @{$args{generator}});
580 my $generator_incs = join("", map { ' "-I'.$_.'"' } @{$args{generator_incs}});
581 my $deps = join(", -\n\t\t", @{$args{generator_deps}}, @{$args{deps}});
583 if ($args{src} !~ /\.[sS]$/) {
584 if ($args{generator}->[0] =~ m|^.*\.in$|) {
585 my $dofile = abs2rel(rel2abs(catfile($config{sourcedir},
586 "util", "dofile.pl")),
587 rel2abs($config{builddir}));
589 $args{src} : $args{generator}->[0] $deps
590 \$(PERL) "-I\$(BLDDIR)" "-Mconfigdata" $dofile \\
591 "-o$target{build_file}" $generator > \$@
595 $args{src} : $args{generator}->[0] $deps
596 \$(PERL)$generator_incs $generator > \$@
600 die "No method to generate assembler source present.\n";
606 (my $obj = $args{obj}) =~ s|\.o$||;
607 my $deps = join(", -\n\t\t", @{$args{srcs}}, @{$args{deps}});
609 # Because VMS C isn't very good at combining a /INCLUDE path with
610 # #includes having a relative directory (like '#include "../foo.h"),
611 # the best choice is to move to the first source file's intended
612 # directory before compiling, and make sure to write the object file
613 # in the correct position (important when the object tree is other
614 # than the source tree).
615 my $forward = dirname($args{srcs}->[0]);
616 my $backward = abs2rel(rel2abs("."), rel2abs($forward));
617 my $objd = abs2rel(rel2abs(dirname($obj)), rel2abs($forward));
618 my $objn = basename($obj);
621 map { abs2rel(rel2abs($_), rel2abs($forward)) } @{$args{srcs}});
622 my $cflags = '$(CFLAGS)';
623 if ($args{installed}) {
624 $cflags .= { lib => '$(LIB_CFLAGS)',
625 dso => '$(DSO_CFLAGS)',
626 bin => '$(BIN_CFLAGS)' } -> {$args{intent}};
628 $cflags .= { lib => '$(NO_INST_LIB_CFLAGS)',
629 dso => '$(NO_INST_DSO_CFLAGS)',
630 bin => '$(NO_INST_BIN_CFLAGS)' } -> {$args{intent}};
632 $cflags .= '$(CPPFLAGS)';
633 $cflags .= { lib => '$(LIB_CPPFLAGS)',
634 dso => '$(DSO_CPPFLAGS)',
635 bin => '$(BIN_CPPFLAGS)' } -> {$args{intent}};
636 my $defines = '$(DEFINES)';
637 $defines .= { lib => '$(LIB_DEFINES)',
638 dso => '$(DSO_DEFINES)',
639 bin => '$(BIN_DEFINES)' } -> {$args{intent}};
640 $cflags .= '/DEFINE=('.$defines.')';
641 $cflags .= "/INCLUDE=('tmp_includes')";
643 # We create a logical name TMP_INCLUDES: to hold the list of internal
644 # includes. However, we cannot use it directly, as logical names can't
645 # hold zero entries, so we also create a symbol with the same name and
646 # use that instead, see the '/INCLUDE=' assignment above. If there are
647 # no internal include directories, it will simply be the empty string,
648 # but if there are, it will be assigned "TMP_DEFINES:,"
649 my $xtraincludes = { lib => '$(LIB_INCLUDES)',
650 dso => '$(DSO_INCLUDES)',
651 bin => '$(BIN_INCLUDES)' } -> {$args{intent}};
653 'IF tmp_add .NES. "" .AND. tmp_includes .NES. "" THEN tmp_includes = "," + tmp_includes'
654 ."\n\t".'tmp_includes = tmp_add + tmp_includes';
655 my $incs_on = 'tmp_includes := '
656 ."\n\t"."tmp_add := $xtraincludes"
658 ."\n\t".'tmp_add := $(INCLUDES)'
660 my $incs_off = 'DELETE/SYMBOL/LOCAL tmp_includes'
661 ."\n\t".'DELETE/SYMBOL/LOCAL tmp_add';
662 if (@{$args{incs}}) {
664 'DEFINE tmp_includes '
665 .join(",-\n\t\t\t", map {
666 file_name_is_absolute($_)
667 ? $_ : catdir($backward,$_)
670 ."\n\t".'IF tmp_includes .NES. "" THEN tmp_includes = "," + tmp_includes'
671 ."\n\t".'tmp_includes = "tmp_includes:" + tmp_includes';
673 "\n\t".'DEASSIGN tmp_includes';
675 my $before = $unified_info{before}->{$obj.".OBJ"} || "\@ !";
676 my $after = $unified_info{after}->{$obj.".OBJ"} || "\@ !";
677 my $depbuild = $disabled{makedepend} ? ""
678 : " /MMS=(FILE=${objd}${objn}.tmp-D,TARGET=$obj.OBJ)";
685 \$(CC) ${cflags}${depbuild} /OBJECT=${objd}${objn}.OBJ /REPOSITORY=$backward $srcs
687 SET DEFAULT $backward
691 . ($disabled{makedepend} ? "" : <<"EOF"
692 \@ PIPE ( \$(PERL) -e "use File::Compare qw/compare_text/; my \$x = compare_text(""$obj.D"",""$obj.tmp-D""); exit(0x10000000 + (\$x == 0));" || -
693 RENAME $obj.tmp-D $obj.d )
694 \@ IF F\$SEARCH("$obj.tmp-D") .NES. "" THEN DELETE $obj.tmp-D;*
700 my $lib = $args{lib};
701 my $shlib = $args{shlib};
702 my $libd = dirname($lib);
703 my $libn = basename($lib);
704 my @objs = map { (my $x = $_) =~ s|\.o$|.OBJ|; $x }
705 grep { $_ =~ m|\.o$| }
707 my @defs = grep { $_ =~ /\.opt$/ } @{$args{objs}};
708 my @deps = compute_lib_depends(@{$args{deps}});
709 die "More than one symbol vector" if scalar @defs > 1;
710 my $deps = join(", -\n\t\t", @defs, @deps);
711 my $shlib_target = $disabled{shared} ? "" : $target{shared_target};
712 my $translatesyms_pl = abs2rel(rel2abs(catfile($config{sourcedir},
713 "VMS", "translatesyms.pl")),
714 rel2abs($config{builddir}));
715 # The "[]" hack is because in .OPT files, each line inherits the
716 # previous line's file spec as default, so if no directory spec
717 # is present in the current line and the previous line has one that
718 # doesn't apply, you're in for a surprise.
720 join(",-\"\n\t", map { my $x = $_ =~ /\[/ ? $_ : "[]".$_;
721 "WRITE OPT_FILE \"$x" } @objs).
724 join("\n\t", map { my $x = $_ =~ /\[/ ? $_ : "[]".$_;
725 $x =~ s|(\.EXE)|$1/SHARE|;
726 $x =~ s|(\.OLB)|$1/LIB|;
727 "WRITE OPT_FILE \"$x\"" } @deps)
730 $shlib.EXE : $lib.OLB $deps
731 \$(PERL) $translatesyms_pl \$(BLDDIR)CXX\$DEMANGLER_DB. < $defs[0] > $defs[0]-translated
732 OPEN/WRITE/SHARE=READ OPT_FILE $lib-components.OPT
736 LINK \$(LDFLAGS)/SHARE=\$\@ $defs[0]-translated/OPT,-
737 $lib-components.OPT/OPT \$(EX_LIBS)
738 DELETE $defs[0]-translated;*,$lib-components.OPT;*
739 PURGE $shlib.EXE,$shlib.MAP
741 . ($config{target} =~ m|alpha| ? "" : <<"EOF"
742 SET IMAGE/FLAGS=(NOCALL_DEBUG) \$\@
748 my $lib = $args{lib};
749 my $libd = dirname($lib);
750 my $libn = basename($lib);
751 (my $libn_nolib = $libn) =~ s/^lib//;
752 my @objs = map { (my $x = $_) =~ s|\.o$|.OBJ|; $x } @{$args{objs}};
753 my @deps = compute_lib_depends(@{$args{deps}});
754 my $deps = join(", -\n\t\t", @objs, @deps);
755 my $shlib_target = $disabled{shared} ? "" : $target{shared_target};
756 my $engine_opt = abs2rel(rel2abs(catfile($config{sourcedir},
757 "VMS", "engine.opt")),
758 rel2abs($config{builddir}));
759 # The "[]" hack is because in .OPT files, each line inherits the
760 # previous line's file spec as default, so if no directory spec
761 # is present in the current line and the previous line has one that
762 # doesn't apply, you're in for a surprise.
764 join(",-\"\n\t", map { my $x = $_ =~ /\[/ ? $_ : "[]".$_;
765 "WRITE OPT_FILE \"$x" } @objs).
768 join("\n\t", map { my $x = $_ =~ /\[/ ? $_ : "[]".$_;
769 $x =~ s|(\.EXE)|$1/SHARE|;
770 $x =~ s|(\.OLB)|$1/LIB|;
771 "WRITE OPT_FILE \"$x\"" } @deps)
775 OPEN/WRITE/SHARE=READ OPT_FILE $lib.OPT
776 TYPE $engine_opt /OUTPUT=OPT_FILE:
780 LINK \$(LDFLAGS)/SHARE=\$\@ $lib.OPT/OPT \$(EX_LIBS)
781 - PURGE $lib.EXE,$lib.OPT,$lib.MAP
783 . ($config{target} =~ m|alpha| ? "" : <<"EOF"
784 SET IMAGE/FLAGS=(NOCALL_DEBUG) \$\@
790 (my $lib = $args{lib}) =~ s/\.a$//;
791 my @objs = map { (my $x = $_) =~ s|\.o$|.OBJ|; $x } @{$args{objs}};
792 my $objs = join(", -\n\t\t", @objs);
793 my $fill_lib = join("\n\t", (map { "LIBRARY/REPLACE $lib.OLB $_" }
797 LIBRARY/CREATE/OBJECT $lib.OLB
804 my $bin = $args{bin};
805 my $bind = dirname($bin);
806 my $binn = basename($bin);
807 my @objs = map { (my $x = $_) =~ s|\.o$|.OBJ|; $x } @{$args{objs}};
808 my $objs = join(",", @objs);
809 my @deps = compute_lib_depends(@{$args{deps}});
810 my $deps = join(", -\n\t\t", @objs, @deps);
812 my $olb_count = scalar grep(m|\.OLB$|, @deps);
813 my $analyse_objs = "@ !";
814 if ($olb_count > 0) {
816 $config{target} =~ m|alpha| ? "/GSD" : "/SECTIONS=SYMTAB";
817 $analyse_objs = "- pipe ANALYSE/OBJECT$analyse_quals $objs | SEARCH SYS\$INPUT \"\"\"main\"\"\" ; nomain = \$severity .NE. 1"
819 # The "[]" hack is because in .OPT files, each line inherits the
820 # previous line's file spec as default, so if no directory spec
821 # is present in the current line and the previous line has one that
822 # doesn't apply, you're in for a surprise.
824 join(",-\"\n\t", map { my $x = $_ =~ /\[/ ? $_ : "[]".$_;
825 "\@ WRITE OPT_FILE \"$x" } @objs).
828 join("\n\t", map { my @lines = ();
829 my $x = $_ =~ /\[/ ? $_ : "[]".$_;
830 if ($x =~ m|\.EXE$|) {
831 push @lines, "\@ WRITE OPT_FILE \"$x/SHARE\"";
832 } elsif ($x =~ m|\.OLB$|) {
833 (my $l = $x) =~ s/\W/_/g;
835 "\@ IF nomain THEN WRITE OPT_FILE \"$x/LIB\$(INCLUDE_MAIN_$l)\"",
836 "\@ IF .NOT. nomain THEN WRITE OPT_FILE \"$x/LIB\""
841 # The linking commands looks a bit complex, but it's for good reason.
842 # When you link, say, foo.obj, bar.obj and libsomething.exe/share, and
843 # bar.obj happens to have a symbol that also exists in libsomething.exe,
844 # the linker will warn about it, loudly, and will then choose to pick
845 # the first copy encountered (the one in bar.obj in this example).
846 # On Unix and on Windows, the corresponding maneuvre goes through
847 # silently with the same effect.
848 # With some test programs, made for checking the internals of OpenSSL,
849 # we do this kind of linking deliberately, picking a few specific object
850 # files from within [.crypto] or [.ssl] so we can reach symbols that are
851 # otherwise unreachable (since the shareable images only exports the
852 # symbols listed in [.util]*.num), and then with the shared libraries
853 # themselves. So we need to silence the warning about multiply defined
854 # symbols, to mimic the way linking work on Unix and Windows, and so
855 # the build isn't interrupted (MMS stops when warnings are signaled,
856 # by default), and so someone building doesn't have to worry where it
857 # isn't necessary. If there are other warnings, however, we show them
858 # and let it break the build.
862 @ OPEN/WRITE/SHARE=READ OPT_FILE $bin.OPT
866 TYPE $bin.opt ! For debugging
867 - pipe SPAWN/WAIT/NOLOG/OUT=$bin.LINKLOG -
868 LINK \$(LDFLAGS)/EXEC=\$\@ $bin.OPT/OPT \$(EX_LIBS) ; -
869 link_status = \$status ; link_severity = link_status .AND. 7
870 @ search_severity = 1
871 -@ IF link_severity .EQ. 0 THEN -
872 pipe SEARCH $bin.LINKLOG "%","-"/MATCH=AND | -
873 SPAWN/WAIT/NOLOG/OUT=NLA0: -
874 SEARCH SYS\$INPUT: "-W-MULDEF,"/MATCH=NOR ; -
875 search_severity = \$severity
876 @ ! search_severity is 3 when the last search didn't find any matching
877 @ ! string: %SEARCH-I-NOMATCHES, no strings matched
878 @ ! If that was the result, we pretend linking got through without
879 @ ! fault or warning.
880 @ IF search_severity .EQ. 3 THEN link_severity = 1
881 @ ! At this point, if link_severity shows that there was a fault
882 @ ! or warning, make sure to restore the linking status.
883 -@ IF .NOT. link_severity THEN TYPE $bin.LINKLOG
884 -@ DELETE $bin.LINKLOG;*
885 @ IF .NOT. link_severity THEN SPAWN/WAIT/NOLOG EXIT 'link_status'
886 - PURGE $bin.EXE,$bin.OPT
888 . ($config{target} =~ m|alpha| ? "" : <<"EOF"
889 SET IMAGE/FLAGS=(NOCALL_DEBUG) \$\@
895 my $script = $args{script};
896 return "" if grep { $_ eq $script } @{$args{sources}}; # No overwrite!
897 my $sources = join(" ", @{$args{sources}});
898 my $dofile = abs2rel(rel2abs(catfile($config{sourcedir},
899 "util", "dofile.pl")),
900 rel2abs($config{builddir}));
903 \$(PERL) "-I\$(BLDDIR)" "-Mconfigdata" $dofile -
904 "-o$target{build_file}" $sources > $script
905 SET FILE/PROT=(S:RWED,O:RWED,G:RE,W:RE) $script
909 "" # Important! This becomes part of the template result.