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 CPP= {- $config{cpp} -}
176 DEFINES={- our $defines = join(",",
177 '__dummy', # To make comma processing easier
178 @{$config{defines}}) -}
179 INCLUDES={- our $includes = join(',', @{$config{includes}}) -}
180 CPPFLAGS={- our $cppflags = join('', @{$config{cppflags}}) -}
181 CPPFLAGS_Q={- (my $x = $cppflags) =~ s|"|""|g; $defines =~ s|"|""|g;
182 $x .= "/DEFINE=($defines)";
183 $x .= "/INCLUDE=($includes)" if $includes;
185 CFLAGS={- join('', @{$config{cflags}}) -}
186 LDFLAGS= {- join('', @{$config{lflags}}) -}
187 EX_LIBS= {- join('', map { ','.$_ } @{$config{ex_libs}}) -}
188 LIB_DEFINES={- join("",
190 @{$target{shared_defines}},
191 'OPENSSLDIR="""$(OPENSSLDIR_C)"""',
192 'ENGINESDIR="""$(ENGINESDIR_C)"""')) -}
193 LIB_CFLAGS={- $target{lib_cflags} // "" -}
194 DSO_CFLAGS={- $target{dso_cflags} // "" -}
195 BIN_CFLAGS={- $target{bin_cflags} // "" -}
196 NO_INST_LIB_CFLAGS={- $target{no_inst_lib_cflags} // '$(LIB_CFLAGS)' -}
197 NO_INST_DSO_CFLAGS={- $target{no_inst_dso_cflags} // '$(DSO_CFLAGS)' -}
198 NO_INST_BIN_CFLAGS={- $target{no_inst_bin_cflags} // '$(BIN_CFLAGS)' -}
200 PERL={- $config{perl} -}
202 # We let the C compiler driver to take care of .s files. This is done in
203 # order to be excused from maintaining a separate set of architecture
204 # dependent assembler flags. E.g. if you throw -mcpu=ultrasparc at SPARC
205 # gcc, then the driver will automatically translate it to -xarch=v8plus
206 # and pass it down to assembler.
208 ASFLAGS={- join('', @{$config{asflags}}) -}
210 # .FIRST and .LAST are special targets with MMS and MMK.
211 # The defines in there are for C. includes that look like
214 # #include <openssl/foo.h>
215 # #include "internal/bar.h"
217 # will use the logical names to find the files. Expecting
218 # DECompHP C to find files in subdirectories of whatever was
219 # given with /INCLUDE is a fantasy, unfortunately.
222 $(NODEBUG) openssl_inc1 = F$PARSE("[.include.openssl]","A.;",,,"syntax_only") - "A.;"
223 $(NODEBUG) openssl_inc2 = F$PARSE("{- catdir($config{sourcedir},"[.include.openssl]") -}","A.;",,,"SYNTAX_ONLY") - "A.;"
224 $(NODEBUG) internal_inc1 = F$PARSE("[.crypto.include.internal]","A.;",,,"SYNTAX_ONLY") - "A.;"
225 $(NODEBUG) internal_inc2 = F$PARSE("{- catdir($config{sourcedir},"[.include.internal]") -}","A.;",,,"SYNTAX_ONLY") - "A.;"
226 $(NODEBUG) internal_inc3 = F$PARSE("{- catdir($config{sourcedir},"[.crypto.include.internal]") -}","A.;",,,"SYNTAX_ONLY") - "A.;"
227 $(NODEBUG) DEFINE openssl 'openssl_inc1','openssl_inc2'
228 $(NODEBUG) DEFINE internal 'internal_inc1','internal_inc2','internal_inc3'
229 $(NODEBUG) staging_dir = "$(DESTDIR)"
230 $(NODEBUG) staging_instdir = ""
231 $(NODEBUG) staging_datadir = ""
232 $(NODEBUG) IF staging_dir .NES. "" THEN -
233 staging_instdir = F$PARSE("A.;",staging_dir,"[]",,"SYNTAX_ONLY")
234 $(NODEBUG) IF staging_instdir - "]A.;" .NES. staging_instdir THEN -
235 staging_instdir = staging_instdir - "]A.;" + ".OPENSSL-INSTALL]"
236 $(NODEBUG) IF staging_instdir - "A.;" .NES. staging_instdir THEN -
237 staging_instdir = staging_instdir - "A.;" + "[OPENSSL-INSTALL]"
238 $(NODEBUG) IF staging_dir .NES. "" THEN -
239 staging_datadir = F$PARSE("A.;",staging_dir,"[]",,"SYNTAX_ONLY")
240 $(NODEBUG) IF staging_datadir - "]A.;" .NES. staging_datadir THEN -
241 staging_datadir = staging_datadir - "]A.;" + ".OPENSSL-COMMON]"
242 $(NODEBUG) IF staging_datadir - "A.;" .NES. staging_datadir THEN -
243 staging_datadir = staging_datadir - "A.;" + "[OPENSSL-COMMON]"
245 $(NODEBUG) ! Installation logical names
247 $(NODEBUG) installtop = F$PARSE(staging_instdir,"$(INSTALLTOP)","[]A.;",,"SYNTAX_ONLY,NO_CONCEAL") - ".][000000" - "[000000." - "][" - "]A.;" + ".]"
248 $(NODEBUG) datatop = F$PARSE(staging_datadir,"$(OPENSSLDIR)","[]A.;",,"SYNTAX_ONLY,NO_CONCEAL") - ".][000000" - "[000000." - "][" - "]A.;" + ".]"
249 $(NODEBUG) DEFINE ossl_installroot 'installtop'
250 $(NODEBUG) DEFINE ossl_dataroot 'datatop'
252 $(NODEBUG) ! Figure out the architecture
254 $(NODEBUG) arch = f$edit( f$getsyi( "arch_name"), "upcase")
256 $(NODEBUG) ! Set up logical names for the libraries, so LINK and
257 $(NODEBUG) ! running programs can use them.
259 $(NODEBUG) {- join("\n\t\$(NODEBUG) ", map { "DEFINE ".uc($_)." 'F\$ENV(\"DEFAULT\")'".uc($_)."\$(SHLIB_EXT)" } @shlibs) || "!" -}
262 $(NODEBUG) {- join("\n\t\$(NODEBUG) ", map { "DEASSIGN ".uc($_) } @shlibs) || "!" -}
263 $(NODEBUG) DEASSIGN ossl_dataroot
264 $(NODEBUG) DEASSIGN ossl_installroot
265 $(NODEBUG) DEASSIGN internal
266 $(NODEBUG) DEASSIGN openssl
268 @ ! MMS cannot handle no actions...
270 # The main targets ###################################################
272 {- dependmagic('all'); -} : build_libs_nodep, build_engines_nodep, build_programs_nodep
273 {- dependmagic('build_libs'); -} : build_libs_nodep
274 {- dependmagic('build_engines'); -} : build_engines_nodep
275 {- dependmagic('build_programs'); -} : build_programs_nodep
277 build_generated : $(GENERATED_MANDATORY)
278 build_libs_nodep : $(LIBS), $(SHLIBS)
279 build_engines_nodep : $(ENGINES)
280 build_programs_nodep : $(PROGRAMS), $(SCRIPTS)
282 # Kept around for backward compatibility
283 build_apps build_tests : build_programs
285 # Convenience target to prebuild all generated files, not just the mandatory
287 build_all_generated : $(GENERATED_MANDATORY) $(GENERATED)
290 {- dependmagic('tests'); -} : build_programs_nodep, build_engines_nodep
291 @ ! {- output_off() if $disabled{tests}; "" -}
292 SET DEFAULT [.test]{- move("test") -}
293 CREATE/DIR [.test-runs]
294 DEFINE SRCTOP {- sourcedir() -}
295 DEFINE BLDTOP {- builddir() -}
296 DEFINE RESULT_D {- builddir(qw(test test-runs)) -}
297 DEFINE OPENSSL_ENGINES {- builddir("engines") -}
298 DEFINE OPENSSL_DEBUG_MEMORY "on"
299 IF "$(VERBOSE)" .NES. "" THEN DEFINE VERBOSE "$(VERBOSE)"
300 $(PERL) {- sourcefile("test", "run_tests.pl") -} $(TESTS)
301 DEASSIGN OPENSSL_DEBUG_MEMORY
302 DEASSIGN OPENSSL_ENGINES
305 SET DEFAULT [-]{- move("..") -}
306 @ ! {- if ($disabled{tests}) { output_on(); } else { output_off(); } "" -}
307 @ WRITE SYS$OUTPUT "Tests are not supported with your chosen Configure options"
308 @ ! {- output_on() if !$disabled{tests}; "" -}
311 @ ! {- output_off() if $disabled{tests}; "" -}
312 @ DEFINE SRCTOP {- sourcedir() -}
313 @ $(PERL) {- sourcefile("test", "run_tests.pl") -} list
315 @ ! {- if ($disabled{tests}) { output_on(); } else { output_off(); } "" -}
316 @ WRITE SYS$OUTPUT "Tests are not supported with your chosen Configure options"
317 @ ! {- output_on() if !$disabled{tests}; "" -}
319 install : install_sw install_ssldirs install_docs
320 @ WRITE SYS$OUTPUT ""
321 @ WRITE SYS$OUTPUT "######################################################################"
322 @ WRITE SYS$OUTPUT ""
323 @ IF "$(DESTDIR)" .EQS. "" THEN -
324 PIPE ( WRITE SYS$OUTPUT "Installation complete" ; -
325 WRITE SYS$OUTPUT "" ; -
326 WRITE SYS$OUTPUT "Run @$(SYSTARTUP)openssl_startup{- $osslver -} to set up logical names" ; -
327 WRITE SYS$OUTPUT "then run @$(SYSTARTUP)openssl_utils{- $osslver -} to define commands" ; -
328 WRITE SYS$OUTPUT "" )
329 @ IF "$(DESTDIR)" .NES. "" THEN -
330 PIPE ( WRITE SYS$OUTPUT "Staging installation complete" ; -
331 WRITE SYS$OUTPUT "" ; -
332 WRITE SYS$OUTPUT "Finish or package in such a way that the contents of the directory tree" ; -
333 WRITE SYS$OUTPUT staging_instdir ; -
334 WRITE SYS$OUTPUT "ends up in $(INSTALLTOP)," ; -
335 WRITE SYS$OUTPUT "and that the contents of the contents of the directory tree" ; -
336 WRITE SYS$OUTPUT staging_datadir ; -
337 WRITE SYS$OUTPUT "ends up in $(OPENSSLDIR)" ; -
338 WRITE SYS$OUTPUT "" ; -
339 WRITE SYS$OUTPUT "When in its final destination," ; -
340 WRITE SYS$OUTPUT "Run @$(SYSTARTUP)openssl_startup{- $osslver -} to set up logical names" ; -
341 WRITE SYS$OUTPUT "then run @$(SYSTARTUP)openssl_utils{- $osslver -} to define commands" ; -
342 WRITE SYS$OUTPUT "" )
345 spawn/nolog @ossl_installroot:[SYSTEST]openssl_ivp{- $osslver -}.com
347 uninstall : uninstall_docs uninstall_sw
349 # Because VMS wants the generation number (or *) to delete files, we can't
350 # use $(LIBS), $(PROGRAMS), $(GENERATED) and $(ENGINES)directly.
352 {- join("\n\t", map { "- DELETE $_.OLB;*" } @libs) || "@ !" -}
353 {- join("\n\t", map { "- DELETE $_.EXE;*,$_.MAP;*" } @shlibs) || "@ !" -}
356 {- join("\n\t", map { "- DELETE $_.EXE;*,$_.OPT;*" } @{$unified_info{programs}}) || "@ !" -}
357 {- join("\n\t", map { "- DELETE $_.EXE;*,$_.OPT;*" } @{$unified_info{engines}}) || "@ !" -}
358 {- join("\n\t", map { "- DELETE $_;*" } @{$unified_info{scripts}}) || "@ !" -}
359 {- join("\n\t", map { "- DELETE $_;*" } @generated) || "@ !" -}
360 - DELETE [...]*.MAP;*
362 - DELETE [...]*.OBJ;*,*.LIS;*
363 - DELETE []CXX$DEMANGLER_DB.;*
364 - DELETE [.VMS]openssl_startup.com;*
365 - DELETE [.VMS]openssl_shutdown.com;*
366 - DELETE []vmsconfig.pm;*
369 - DELETE configdata.pm;*
370 - DELETE descrip.mms;*
374 @ ! {- output_off() if $disabled{makedepend}; "" -}
375 @ $(PERL) -pe "if (/^# DO NOT DELETE.*/) { exit(0); }" -
376 < descrip.mms > descrip.mms-new
377 @ OPEN/APPEND DESCRIP descrip.mms-new
378 @ WRITE DESCRIP "# DO NOT DELETE THIS LINE -- make depend depends on it."
379 {- join("\n\t", map { "\@ IF F\$SEARCH(\"$_\") .NES. \"\" THEN TYPE $_ /OUTPUT=DESCRIP:" } @deps); -}
381 @ PIPE ( $(PERL) -e "use File::Compare qw/compare_text/; my $x = compare_text(""descrip.mms"",""descrip.mms-new""); exit(0x10000000 + ($x == 0));" || -
382 RENAME descrip.mms-new descrip.mms )
383 @ IF F$SEARCH("descrip.mms-new") .NES. "" THEN DELETE descrip.mms-new;*
384 -@ SPAWN/OUTPUT=NLA0: PURGE/NOLOG descrip.mms
385 @ ! {- output_on() if $disabled{makedepend}; "" -}
387 # Install helper targets #############################################
389 install_sw : all install_shared _install_dev_ns -
390 install_engines _install_runtime_ns -
391 install_startup install_ivp
393 uninstall_sw : uninstall_shared _uninstall_dev_ns -
394 uninstall_engines _uninstall_runtime_ns -
395 uninstall_startup uninstall_ivp
397 install_docs : install_html_docs
399 uninstall_docs : uninstall_html_docs
401 install_ssldirs : check_INSTALLTOP
402 - CREATE/DIR/PROT=(S:RWED,O:RWE,G:RE,W:RE) OSSL_DATAROOT:[000000]
403 IF F$SEARCH("OSSL_DATAROOT:[000000]CERTS.DIR;1") .EQS. "" THEN -
404 CREATE/DIR/PROT=(S:RWED,O:RWE,G:RE,W:RE) OSSL_DATAROOT:[CERTS]
405 IF F$SEARCH("OSSL_DATAROOT:[000000]PRIVATE.DIR;1") .EQS. "" THEN -
406 CREATE/DIR/PROT=(S:RWED,O:RWE,G,W) OSSL_DATAROOT:[PRIVATE]
407 IF F$SEARCH("OSSL_DATAROOT:[000000]MISC.DIR;1") .EQS. "" THEN -
408 CREATE/DIR/PROT=(S:RWED,O:RWE,G,W) OSSL_DATAROOT:[MISC]
409 COPY/PROT=W:RE $(MISC_SCRIPTS) OSSL_DATAROOT:[MISC]
410 @ ! Install configuration file
411 COPY/PROT=W:R {- sourcefile("apps", "openssl-vms.cnf") -} -
412 ossl_dataroot:[000000]openssl.cnf-dist
413 IF F$SEARCH("OSSL_DATAROOT:[000000]openssl.cnf") .EQS. "" THEN -
414 COPY/PROT=W:R {- sourcefile("apps", "openssl-vms.cnf") -} -
415 ossl_dataroot:[000000]openssl.cnf
416 @ ! Install CTLOG configuration file
417 COPY/PROT=W:R {- sourcefile("apps", "ct_log_list.cnf") -} -
418 ossl_dataroot:[000000]ct_log_list.cnf-dist
419 IF F$SEARCH("OSSL_DATAROOT:[000000]ct_log_list.cnf") .EQS. "" THEN -
420 COPY/PROT=W:R {- sourcefile("apps", "ct_log_list.cnf") -} -
421 ossl_dataroot:[000000]ct_log_list.cnf
423 install_shared : check_INSTALLTOP
424 @ {- output_off() if $disabled{shared}; "" -} !
425 @ WRITE SYS$OUTPUT "*** Installing shareable images"
426 @ ! Install shared (runtime) libraries
427 - CREATE/DIR ossl_installroot:[LIB.'arch']
429 map { "COPY/PROT=W:R $_.EXE ossl_installroot:[LIB.'arch']" }
431 @ {- output_on() if $disabled{shared}; "" -} !
433 _install_dev_ns : check_INSTALLTOP
434 @ WRITE SYS$OUTPUT "*** Installing development files"
435 @ ! Install header files
436 - CREATE/DIR ossl_installroot:[include.openssl]
437 COPY/PROT=W:R openssl:*.h ossl_installroot:[include.openssl]
438 @ ! Install static (development) libraries
439 - CREATE/DIR ossl_installroot:[LIB.'arch']
441 map { "COPY/PROT=W:R $_.OLB ossl_installroot:[LIB.'arch']" }
444 install_dev : install_shared _install_dev_ns
446 _install_runtime_ns : check_INSTALLTOP
447 @ ! Install the main program
448 - CREATE/DIR ossl_installroot:[EXE.'arch']
449 COPY/PROT=W:RE [.APPS]openssl.EXE -
450 ossl_installroot:[EXE.'arch']openssl{- $osslver -}.EXE
452 COPY/PROT=W:RE $(BIN_SCRIPTS) ossl_installroot:[EXE]
453 @ ! {- output_on() if $disabled{apps}; "" -}
455 install_runtime : install_shared _install_runtime_ns
457 install_engines : check_INSTALLTOP
458 @ {- output_off() unless scalar @{$unified_info{engines}}; "" -} !
459 @ WRITE SYS$OUTPUT "*** Installing engines"
460 - CREATE/DIR ossl_installroot:[ENGINES{- $sover_dirname.$target{pointer_size} -}.'arch']
462 map { "COPY/PROT=W:RE $_.EXE ossl_installroot:[ENGINES$sover_dirname$target{pointer_size}.'arch']" }
463 @{$unified_info{install}->{engines}}) -}
464 @ {- output_on() unless scalar @{$unified_info{engines}}; "" -} !
466 install_startup : [.VMS]openssl_startup.com [.VMS]openssl_shutdown.com -
467 [.VMS]openssl_utils.com, check_INSTALLTOP
468 - CREATE/DIR ossl_installroot:[SYS$STARTUP]
469 COPY/PROT=W:RE [.VMS]openssl_startup.com -
470 ossl_installroot:[SYS$STARTUP]openssl_startup{- $osslver -}.com
471 COPY/PROT=W:RE [.VMS]openssl_shutdown.com -
472 ossl_installroot:[SYS$STARTUP]openssl_shutdown{- $osslver -}.com
473 COPY/PROT=W:RE [.VMS]openssl_utils.com -
474 ossl_installroot:[SYS$STARTUP]openssl_utils{- $osslver -}.com
476 install_ivp : [.VMS]openssl_ivp.com check_INSTALLTOP
477 - CREATE/DIR ossl_installroot:[SYSTEST]
478 COPY/PROT=W:RE [.VMS]openssl_ivp.com -
479 ossl_installroot:[SYSTEST]openssl_ivp{- $osslver -}.com
481 [.VMS]openssl_startup.com : vmsconfig.pm {- sourcefile("VMS", "openssl_startup.com.in") -}
483 $(PERL) "-I." "-Mvmsconfig" {- sourcefile("util", "dofile.pl") -} -
484 {- sourcefile("VMS", "openssl_startup.com.in") -} -
485 > [.VMS]openssl_startup.com
487 [.VMS]openssl_utils.com : vmsconfig.pm {- sourcefile("VMS", "openssl_utils.com.in") -}
489 $(PERL) "-I." "-Mvmsconfig" {- sourcefile("util", "dofile.pl") -} -
490 {- sourcefile("VMS", "openssl_utils.com.in") -} -
491 > [.VMS]openssl_utils.com
493 [.VMS]openssl_shutdown.com : vmsconfig.pm {- sourcefile("VMS", "openssl_shutdown.com.in") -}
495 $(PERL) "-I." "-Mvmsconfig" {- sourcefile("util", "dofile.pl") -} -
496 {- sourcefile("VMS", "openssl_shutdown.com.in") -} -
497 > [.VMS]openssl_shutdown.com
499 [.VMS]openssl_ivp.com : vmsconfig.pm {- sourcefile("VMS", "openssl_ivp.com.in") -}
501 $(PERL) "-I." "-Mvmsconfig" {- sourcefile("util", "dofile.pl") -} -
502 {- sourcefile("VMS", "openssl_ivp.com.in") -} -
503 > [.VMS]openssl_ivp.com
505 vmsconfig.pm : configdata.pm
506 OPEN/WRITE/SHARE=READ CONFIG []vmsconfig.pm
507 WRITE CONFIG "package vmsconfig;"
508 WRITE CONFIG "use strict; use warnings;"
509 WRITE CONFIG "use Exporter;"
510 WRITE CONFIG "our @ISA = qw(Exporter);"
511 WRITE CONFIG "our @EXPORT = qw(%config %target %withargs %unified_info %disabled);"
512 WRITE CONFIG "our %config = ("
513 WRITE CONFIG " target => '","{- $config{target} -}","',"
514 WRITE CONFIG " version => '","{- $config{version} -}","',"
515 WRITE CONFIG " shlib_version_number => '","{- $config{shlib_version_number} -}","',"
516 WRITE CONFIG " shlib_major => '","{- $config{shlib_major} -}","',"
517 WRITE CONFIG " shlib_minor => '","{- $config{shlib_minor} -}","',"
518 WRITE CONFIG " no_shared => '","{- $disabled{shared} -}","',"
519 WRITE CONFIG " INSTALLTOP => '$(INSTALLTOP)',"
520 WRITE CONFIG " OPENSSLDIR => '$(OPENSSLDIR)',"
521 WRITE CONFIG " pointer_size => '","{- $target{pointer_size} -}","',"
523 WRITE CONFIG "our %target = ();"
524 WRITE CONFIG "our %disabled = ();"
525 WRITE CONFIG "our %withargs = ();"
526 WRITE CONFIG "our %unified_info = ();"
530 install_html_docs : check_INSTALLTOP
531 sourcedir = F$PARSE("{- $sourcedir -}A.;","[]") - "]A.;" + ".DOC]"
532 $(PERL) {- sourcefile("util", "process_docs.pl") -} -
533 --sourcedir='sourcedir' --destdir=ossl_installroot:[HTML] -
537 @ IF "$(INSTALLTOP)" .EQS. "" THEN -
538 WRITE SYS$ERROR "INSTALLTOP should not be empty"
539 @ IF "$(INSTALLTOP)" .EQS. "" THEN -
542 # Helper targets #####################################################
544 # Developer targets ##################################################
547 SH LOGICAL/PROC openssl,internal,ossl_installroot,ossl_dataroot
549 # Building targets ###################################################
551 configdata.pm : $(SRCDIR)Configure $(SRCDIR)config.com {- join(" ", @{$config{build_file_templates}}, @{$config{build_infos}}, @{$config{conf_files}}) -}
552 perl configdata.pm -r -v
553 @ WRITE SYS$OUTPUT "*************************************************"
554 @ WRITE SYS$OUTPUT "*** ***"
555 @ WRITE SYS$OUTPUT "*** Please run the same mms command again ***"
556 @ WRITE SYS$OUTPUT "*** ***"
557 @ WRITE SYS$OUTPUT "*************************************************"
558 @ PIPE ( EXIT %X10000000 )
561 perl configdata.pm -r -v
565 use File::Spec::Functions qw/abs2rel rel2abs catfile catdir/;
567 # Helper function to figure out dependencies on libraries
568 # It takes a list of library names and outputs a list of dependencies
569 sub compute_lib_depends {
570 if ($disabled{shared}) {
571 return map { $_ =~ /\.a$/ ? $`.".OLB" : $_.".OLB" } @_;
573 return map { $_ =~ /\.a$/
575 : $unified_info{sharednames}->{$_}.".EXE" } @_;
580 my $generator = join(" ", @{$args{generator}});
581 my $generator_incs = join("", map { ' "-I'.$_.'"' } @{$args{generator_incs}});
582 my $deps = join(", -\n\t\t", @{$args{generator_deps}}, @{$args{deps}});
584 if ($args{src} !~ /\.[sS]$/) {
585 if ($args{generator}->[0] =~ m|^.*\.in$|) {
586 my $dofile = abs2rel(rel2abs(catfile($config{sourcedir},
587 "util", "dofile.pl")),
588 rel2abs($config{builddir}));
590 $args{src} : $args{generator}->[0] $deps
591 \$(PERL) "-I\$(BLDDIR)" "-Mconfigdata" $dofile \\
592 "-o$target{build_file}" $generator > \$@
596 $args{src} : $args{generator}->[0] $deps
597 \$(PERL)$generator_incs $generator > \$@
601 die "No method to generate assembler source present.\n";
607 (my $obj = $args{obj}) =~ s|\.o$||;
608 my $deps = join(", -\n\t\t", @{$args{srcs}}, @{$args{deps}});
610 # Because VMS C isn't very good at combining a /INCLUDE path with
611 # #includes having a relative directory (like '#include "../foo.h"),
612 # the best choice is to move to the first source file's intended
613 # directory before compiling, and make sure to write the object file
614 # in the correct position (important when the object tree is other
615 # than the source tree).
616 my $forward = dirname($args{srcs}->[0]);
617 my $backward = abs2rel(rel2abs("."), rel2abs($forward));
618 my $objd = abs2rel(rel2abs(dirname($obj)), rel2abs($forward));
619 my $objn = basename($obj);
622 map { abs2rel(rel2abs($_), rel2abs($forward)) } @{$args{srcs}});
623 my $cflags = '$(CFLAGS)';
624 if ($args{installed}) {
625 $cflags .= { lib => '$(LIB_CFLAGS)',
626 dso => '$(DSO_CFLAGS)',
627 bin => '$(BIN_CFLAGS)' } -> {$args{intent}};
629 $cflags .= { lib => '$(NO_INST_LIB_CFLAGS)',
630 dso => '$(NO_INST_DSO_CFLAGS)',
631 bin => '$(NO_INST_BIN_CFLAGS)' } -> {$args{intent}};
633 $cflags .= '$(CPPFLAGS)';
634 $cflags .= { lib => '$(LIB_CPPFLAGS)',
635 dso => '$(DSO_CPPFLAGS)',
636 bin => '$(BIN_CPPFLAGS)' } -> {$args{intent}};
637 my $defines = '$(DEFINES)';
638 $defines .= { lib => '$(LIB_DEFINES)',
639 dso => '$(DSO_DEFINES)',
640 bin => '$(BIN_DEFINES)' } -> {$args{intent}};
641 $cflags .= '/DEFINE=('.$defines.')';
642 $cflags .= "/INCLUDE=('tmp_includes')";
644 # We create a logical name TMP_INCLUDES: to hold the list of internal
645 # includes. However, we cannot use it directly, as logical names can't
646 # hold zero entries, so we also create a symbol with the same name and
647 # use that instead, see the '/INCLUDE=' assignment above. If there are
648 # no internal include directories, it will simply be the empty string,
649 # but if there are, it will be assigned "TMP_DEFINES:,"
650 my $xtraincludes = { lib => '$(LIB_INCLUDES)',
651 dso => '$(DSO_INCLUDES)',
652 bin => '$(BIN_INCLUDES)' } -> {$args{intent}};
654 'IF tmp_add .NES. "" .AND. tmp_includes .NES. "" THEN tmp_includes = "," + tmp_includes'
655 ."\n\t".'tmp_includes = tmp_add + tmp_includes';
656 my $incs_on = 'tmp_includes := '
657 ."\n\t"."tmp_add := $xtraincludes"
659 ."\n\t".'tmp_add := $(INCLUDES)'
661 my $incs_off = 'DELETE/SYMBOL/LOCAL tmp_includes'
662 ."\n\t".'DELETE/SYMBOL/LOCAL tmp_add';
663 if (@{$args{incs}}) {
665 'DEFINE tmp_includes '
666 .join(",-\n\t\t\t", map {
667 file_name_is_absolute($_)
668 ? $_ : catdir($backward,$_)
671 ."\n\t".'IF tmp_includes .NES. "" THEN tmp_includes = "," + tmp_includes'
672 ."\n\t".'tmp_includes = "tmp_includes:" + tmp_includes';
674 "\n\t".'DEASSIGN tmp_includes';
676 my $before = $unified_info{before}->{$obj.".OBJ"} || "\@ !";
677 my $after = $unified_info{after}->{$obj.".OBJ"} || "\@ !";
678 my $depbuild = $disabled{makedepend} ? ""
679 : " /MMS=(FILE=${objd}${objn}.tmp-D,TARGET=$obj.OBJ)";
686 \$(CC) ${cflags}${depbuild} /OBJECT=${objd}${objn}.OBJ /REPOSITORY=$backward $srcs
688 SET DEFAULT $backward
692 . ($disabled{makedepend} ? "" : <<"EOF"
693 \@ PIPE ( \$(PERL) -e "use File::Compare qw/compare_text/; my \$x = compare_text(""$obj.D"",""$obj.tmp-D""); exit(0x10000000 + (\$x == 0));" || -
694 RENAME $obj.tmp-D $obj.d )
695 \@ IF F\$SEARCH("$obj.tmp-D") .NES. "" THEN DELETE $obj.tmp-D;*
701 my $lib = $args{lib};
702 my $shlib = $args{shlib};
703 my $libd = dirname($lib);
704 my $libn = basename($lib);
705 my @objs = map { (my $x = $_) =~ s|\.o$|.OBJ|; $x }
706 grep { $_ =~ m|\.o$| }
708 my @defs = grep { $_ =~ /\.opt$/ } @{$args{objs}};
709 my @deps = compute_lib_depends(@{$args{deps}});
710 die "More than one symbol vector" if scalar @defs > 1;
711 my $deps = join(", -\n\t\t", @defs, @deps);
712 my $shlib_target = $disabled{shared} ? "" : $target{shared_target};
713 my $translatesyms_pl = abs2rel(rel2abs(catfile($config{sourcedir},
714 "VMS", "translatesyms.pl")),
715 rel2abs($config{builddir}));
716 # The "[]" hack is because in .OPT files, each line inherits the
717 # previous line's file spec as default, so if no directory spec
718 # is present in the current line and the previous line has one that
719 # doesn't apply, you're in for a surprise.
721 join(",-\"\n\t", map { my $x = $_ =~ /\[/ ? $_ : "[]".$_;
722 "WRITE OPT_FILE \"$x" } @objs).
725 join("\n\t", map { my $x = $_ =~ /\[/ ? $_ : "[]".$_;
726 $x =~ s|(\.EXE)|$1/SHARE|;
727 $x =~ s|(\.OLB)|$1/LIB|;
728 "WRITE OPT_FILE \"$x\"" } @deps)
731 $shlib.EXE : $lib.OLB $deps
732 \$(PERL) $translatesyms_pl \$(BLDDIR)CXX\$DEMANGLER_DB. < $defs[0] > $defs[0]-translated
733 OPEN/WRITE/SHARE=READ OPT_FILE $lib-components.OPT
737 LINK \$(LDFLAGS)/SHARE=\$\@ $defs[0]-translated/OPT,-
738 $lib-components.OPT/OPT \$(EX_LIBS)
739 DELETE $defs[0]-translated;*,$lib-components.OPT;*
740 PURGE $shlib.EXE,$shlib.MAP
742 . ($config{target} =~ m|alpha| ? "" : <<"EOF"
743 SET IMAGE/FLAGS=(NOCALL_DEBUG) \$\@
749 my $lib = $args{lib};
750 my $libd = dirname($lib);
751 my $libn = basename($lib);
752 (my $libn_nolib = $libn) =~ s/^lib//;
753 my @objs = map { (my $x = $_) =~ s|\.o$|.OBJ|; $x } @{$args{objs}};
754 my @deps = compute_lib_depends(@{$args{deps}});
755 my $deps = join(", -\n\t\t", @objs, @deps);
756 my $shlib_target = $disabled{shared} ? "" : $target{shared_target};
757 my $engine_opt = abs2rel(rel2abs(catfile($config{sourcedir},
758 "VMS", "engine.opt")),
759 rel2abs($config{builddir}));
760 # The "[]" hack is because in .OPT files, each line inherits the
761 # previous line's file spec as default, so if no directory spec
762 # is present in the current line and the previous line has one that
763 # doesn't apply, you're in for a surprise.
765 join(",-\"\n\t", map { my $x = $_ =~ /\[/ ? $_ : "[]".$_;
766 "WRITE OPT_FILE \"$x" } @objs).
769 join("\n\t", map { my $x = $_ =~ /\[/ ? $_ : "[]".$_;
770 $x =~ s|(\.EXE)|$1/SHARE|;
771 $x =~ s|(\.OLB)|$1/LIB|;
772 "WRITE OPT_FILE \"$x\"" } @deps)
776 OPEN/WRITE/SHARE=READ OPT_FILE $lib.OPT
777 TYPE $engine_opt /OUTPUT=OPT_FILE:
781 LINK \$(LDFLAGS)/SHARE=\$\@ $lib.OPT/OPT \$(EX_LIBS)
782 - PURGE $lib.EXE,$lib.OPT,$lib.MAP
784 . ($config{target} =~ m|alpha| ? "" : <<"EOF"
785 SET IMAGE/FLAGS=(NOCALL_DEBUG) \$\@
791 (my $lib = $args{lib}) =~ s/\.a$//;
792 my @objs = map { (my $x = $_) =~ s|\.o$|.OBJ|; $x } @{$args{objs}};
793 my $objs = join(", -\n\t\t", @objs);
794 my $fill_lib = join("\n\t", (map { "LIBRARY/REPLACE $lib.OLB $_" }
798 LIBRARY/CREATE/OBJECT $lib.OLB
805 my $bin = $args{bin};
806 my $bind = dirname($bin);
807 my $binn = basename($bin);
808 my @objs = map { (my $x = $_) =~ s|\.o$|.OBJ|; $x } @{$args{objs}};
809 my $objs = join(",", @objs);
810 my @deps = compute_lib_depends(@{$args{deps}});
811 my $deps = join(", -\n\t\t", @objs, @deps);
813 my $olb_count = scalar grep(m|\.OLB$|, @deps);
814 my $analyse_objs = "@ !";
815 if ($olb_count > 0) {
817 $config{target} =~ m|alpha| ? "/GSD" : "/SECTIONS=SYMTAB";
818 $analyse_objs = "- pipe ANALYSE/OBJECT$analyse_quals $objs | SEARCH SYS\$INPUT \"\"\"main\"\"\" ; nomain = \$severity .NE. 1"
820 # The "[]" hack is because in .OPT files, each line inherits the
821 # previous line's file spec as default, so if no directory spec
822 # is present in the current line and the previous line has one that
823 # doesn't apply, you're in for a surprise.
825 join(",-\"\n\t", map { my $x = $_ =~ /\[/ ? $_ : "[]".$_;
826 "\@ WRITE OPT_FILE \"$x" } @objs).
829 join("\n\t", map { my @lines = ();
830 my $x = $_ =~ /\[/ ? $_ : "[]".$_;
831 if ($x =~ m|\.EXE$|) {
832 push @lines, "\@ WRITE OPT_FILE \"$x/SHARE\"";
833 } elsif ($x =~ m|\.OLB$|) {
834 (my $l = $x) =~ s/\W/_/g;
836 "\@ IF nomain THEN WRITE OPT_FILE \"$x/LIB\$(INCLUDE_MAIN_$l)\"",
837 "\@ IF .NOT. nomain THEN WRITE OPT_FILE \"$x/LIB\""
842 # The linking commands looks a bit complex, but it's for good reason.
843 # When you link, say, foo.obj, bar.obj and libsomething.exe/share, and
844 # bar.obj happens to have a symbol that also exists in libsomething.exe,
845 # the linker will warn about it, loudly, and will then choose to pick
846 # the first copy encountered (the one in bar.obj in this example).
847 # On Unix and on Windows, the corresponding maneuvre goes through
848 # silently with the same effect.
849 # With some test programs, made for checking the internals of OpenSSL,
850 # we do this kind of linking deliberately, picking a few specific object
851 # files from within [.crypto] or [.ssl] so we can reach symbols that are
852 # otherwise unreachable (since the shareable images only exports the
853 # symbols listed in [.util]*.num), and then with the shared libraries
854 # themselves. So we need to silence the warning about multiply defined
855 # symbols, to mimic the way linking work on Unix and Windows, and so
856 # the build isn't interrupted (MMS stops when warnings are signaled,
857 # by default), and so someone building doesn't have to worry where it
858 # isn't necessary. If there are other warnings, however, we show them
859 # and let it break the build.
863 @ OPEN/WRITE/SHARE=READ OPT_FILE $bin.OPT
867 TYPE $bin.opt ! For debugging
868 - pipe SPAWN/WAIT/NOLOG/OUT=$bin.LINKLOG -
869 LINK \$(LDFLAGS)/EXEC=\$\@ $bin.OPT/OPT \$(EX_LIBS) ; -
870 link_status = \$status ; link_severity = link_status .AND. 7
871 @ search_severity = 1
872 -@ IF link_severity .EQ. 0 THEN -
873 pipe SEARCH $bin.LINKLOG "%","-"/MATCH=AND | -
874 SPAWN/WAIT/NOLOG/OUT=NLA0: -
875 SEARCH SYS\$INPUT: "-W-MULDEF,"/MATCH=NOR ; -
876 search_severity = \$severity
877 @ ! search_severity is 3 when the last search didn't find any matching
878 @ ! string: %SEARCH-I-NOMATCHES, no strings matched
879 @ ! If that was the result, we pretend linking got through without
880 @ ! fault or warning.
881 @ IF search_severity .EQ. 3 THEN link_severity = 1
882 @ ! At this point, if link_severity shows that there was a fault
883 @ ! or warning, make sure to restore the linking status.
884 -@ IF .NOT. link_severity THEN TYPE $bin.LINKLOG
885 -@ DELETE $bin.LINKLOG;*
886 @ IF .NOT. link_severity THEN SPAWN/WAIT/NOLOG EXIT 'link_status'
887 - PURGE $bin.EXE,$bin.OPT
889 . ($config{target} =~ m|alpha| ? "" : <<"EOF"
890 SET IMAGE/FLAGS=(NOCALL_DEBUG) \$\@
896 my $script = $args{script};
897 return "" if grep { $_ eq $script } @{$args{sources}}; # No overwrite!
898 my $sources = join(" ", @{$args{sources}});
899 my $dofile = abs2rel(rel2abs(catfile($config{sourcedir},
900 "util", "dofile.pl")),
901 rel2abs($config{builddir}));
904 \$(PERL) "-I\$(BLDDIR)" "-Mconfigdata" $dofile -
905 "-o$target{build_file}" $sources > $script
906 SET FILE/PROT=(S:RWED,O:RWED,G:RE,W:RE) $script
910 "" # Important! This becomes part of the template result.