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='qual_includes'{- our $cppflags = join('', @{$config{cppflags}}) -}
181 CPPFLAGS_Q={- (my $x = $cppflags) =~ s|"|""|g;
182 (my $d = $defines) =~ s|"|""|g;
183 $x .= "/INCLUDE=($includes)" if $includes;
184 $x .= "/DEFINE=($d)";
186 CFLAGS={- join('', @{$config{cflags}}) -}
187 LDFLAGS= {- join('', @{$config{lflags}}) -}
188 EX_LIBS= {- join('', map { ','.$_ } @{$config{ex_libs}}) -}
190 LIB_DEFINES=$(DEFINES){- join("", (map { ",$_" }
191 @{$target{shared_defines}},
192 'OPENSSLDIR="""$(OPENSSLDIR_C)"""',
193 'ENGINESDIR="""$(ENGINESDIR_C)"""')) -}
194 LIB_CPPFLAGS=$(CPPFLAGS)/DEFINE=($(LIB_DEFINES))
195 LIB_CFLAGS=$(CFLAGS){- $target{lib_cflags} // "" -}
196 DSO_DEFINES=$(DEFINES){- join("", (map { ",$_" } @{$target{dso_defines}})) -}
197 DSO_CPPFLAGS=$(CPPFLAGS)/DEFINE=($(DSO_DEFINES))
198 DSO_CFLAGS=$(CFLAGS){- $target{dso_cflags} // "" -}
199 BIN_DEFINES=$(DEFINES){- join("", (map { ",$_" } @{$target{bin_defines}})) -}
200 BIN_CPPFLAGS=$(CPPFLAGS)/DEFINE=($(BIN_DEFINES))
201 BIN_CFLAGS=$(CFLAGS){- $target{bin_cflags} // "" -}
202 NO_INST_LIB_CFLAGS=$(CFLAGS){- $target{no_inst_lib_cflags}
203 // $target{lib_cflags}
205 NO_INST_DSO_CFLAGS=$(CFLAGS){- $target{no_inst_dso_cflags}
206 // $target{dso_cflags}
208 NO_INST_BIN_CFLAGS=$(CFLAGS){- $target{no_inst_bin_cflags}
209 // $target{bin_cflags}
212 PERL={- $config{perl} -}
214 # We let the C compiler driver to take care of .s files. This is done in
215 # order to be excused from maintaining a separate set of architecture
216 # dependent assembler flags. E.g. if you throw -mcpu=ultrasparc at SPARC
217 # gcc, then the driver will automatically translate it to -xarch=v8plus
218 # and pass it down to assembler.
220 ASFLAGS={- join('', @{$config{asflags}}) -}
222 # .FIRST and .LAST are special targets with MMS and MMK.
223 # The defines in there are for C. includes that look like
226 # #include <openssl/foo.h>
227 # #include "internal/bar.h"
229 # will use the logical names to find the files. Expecting
230 # DECompHP C to find files in subdirectories of whatever was
231 # given with /INCLUDE is a fantasy, unfortunately.
234 $(NODEBUG) openssl_inc1 = F$PARSE("[.include.openssl]","A.;",,,"syntax_only") - "A.;"
235 $(NODEBUG) openssl_inc2 = F$PARSE("{- catdir($config{sourcedir},"[.include.openssl]") -}","A.;",,,"SYNTAX_ONLY") - "A.;"
236 $(NODEBUG) internal_inc1 = F$PARSE("[.crypto.include.internal]","A.;",,,"SYNTAX_ONLY") - "A.;"
237 $(NODEBUG) internal_inc2 = F$PARSE("{- catdir($config{sourcedir},"[.include.internal]") -}","A.;",,,"SYNTAX_ONLY") - "A.;"
238 $(NODEBUG) internal_inc3 = F$PARSE("{- catdir($config{sourcedir},"[.crypto.include.internal]") -}","A.;",,,"SYNTAX_ONLY") - "A.;"
239 $(NODEBUG) DEFINE openssl 'openssl_inc1','openssl_inc2'
240 $(NODEBUG) DEFINE internal 'internal_inc1','internal_inc2','internal_inc3'
241 $(NODEBUG) staging_dir = "$(DESTDIR)"
242 $(NODEBUG) staging_instdir = ""
243 $(NODEBUG) staging_datadir = ""
244 $(NODEBUG) IF staging_dir .NES. "" THEN -
245 staging_instdir = F$PARSE("A.;",staging_dir,"[]",,"SYNTAX_ONLY")
246 $(NODEBUG) IF staging_instdir - "]A.;" .NES. staging_instdir THEN -
247 staging_instdir = staging_instdir - "]A.;" + ".OPENSSL-INSTALL]"
248 $(NODEBUG) IF staging_instdir - "A.;" .NES. staging_instdir THEN -
249 staging_instdir = staging_instdir - "A.;" + "[OPENSSL-INSTALL]"
250 $(NODEBUG) IF staging_dir .NES. "" THEN -
251 staging_datadir = F$PARSE("A.;",staging_dir,"[]",,"SYNTAX_ONLY")
252 $(NODEBUG) IF staging_datadir - "]A.;" .NES. staging_datadir THEN -
253 staging_datadir = staging_datadir - "]A.;" + ".OPENSSL-COMMON]"
254 $(NODEBUG) IF staging_datadir - "A.;" .NES. staging_datadir THEN -
255 staging_datadir = staging_datadir - "A.;" + "[OPENSSL-COMMON]"
257 $(NODEBUG) ! Installation logical names
259 $(NODEBUG) installtop = F$PARSE(staging_instdir,"$(INSTALLTOP)","[]A.;",,"SYNTAX_ONLY,NO_CONCEAL") - ".][000000" - "[000000." - "][" - "]A.;" + ".]"
260 $(NODEBUG) datatop = F$PARSE(staging_datadir,"$(OPENSSLDIR)","[]A.;",,"SYNTAX_ONLY,NO_CONCEAL") - ".][000000" - "[000000." - "][" - "]A.;" + ".]"
261 $(NODEBUG) DEFINE ossl_installroot 'installtop'
262 $(NODEBUG) DEFINE ossl_dataroot 'datatop'
264 $(NODEBUG) ! Figure out the architecture
266 $(NODEBUG) arch = f$edit( f$getsyi( "arch_name"), "upcase")
268 $(NODEBUG) ! Set up logical names for the libraries, so LINK and
269 $(NODEBUG) ! running programs can use them.
271 $(NODEBUG) {- join("\n\t\$(NODEBUG) ", map { "DEFINE ".uc($_)." 'F\$ENV(\"DEFAULT\")'".uc($_)."\$(SHLIB_EXT)" } @shlibs) || "!" -}
274 $(NODEBUG) {- join("\n\t\$(NODEBUG) ", map { "DEASSIGN ".uc($_) } @shlibs) || "!" -}
275 $(NODEBUG) DEASSIGN ossl_dataroot
276 $(NODEBUG) DEASSIGN ossl_installroot
277 $(NODEBUG) DEASSIGN internal
278 $(NODEBUG) DEASSIGN openssl
280 @ ! MMS cannot handle no actions...
282 # The main targets ###################################################
284 {- dependmagic('all'); -} : build_libs_nodep, build_engines_nodep, build_programs_nodep
285 {- dependmagic('build_libs'); -} : build_libs_nodep
286 {- dependmagic('build_engines'); -} : build_engines_nodep
287 {- dependmagic('build_programs'); -} : build_programs_nodep
289 build_generated : $(GENERATED_MANDATORY)
290 build_libs_nodep : $(LIBS), $(SHLIBS)
291 build_engines_nodep : $(ENGINES)
292 build_programs_nodep : $(PROGRAMS), $(SCRIPTS)
294 # Kept around for backward compatibility
295 build_apps build_tests : build_programs
297 # Convenience target to prebuild all generated files, not just the mandatory
299 build_all_generated : $(GENERATED_MANDATORY) $(GENERATED)
302 {- dependmagic('tests'); -} : build_programs_nodep, build_engines_nodep
303 @ ! {- output_off() if $disabled{tests}; "" -}
304 SET DEFAULT [.test]{- move("test") -}
305 CREATE/DIR [.test-runs]
306 DEFINE SRCTOP {- sourcedir() -}
307 DEFINE BLDTOP {- builddir() -}
308 DEFINE RESULT_D {- builddir(qw(test test-runs)) -}
309 DEFINE OPENSSL_ENGINES {- builddir("engines") -}
310 DEFINE OPENSSL_DEBUG_MEMORY "on"
311 IF "$(VERBOSE)" .NES. "" THEN DEFINE VERBOSE "$(VERBOSE)"
312 $(PERL) {- sourcefile("test", "run_tests.pl") -} $(TESTS)
313 DEASSIGN OPENSSL_DEBUG_MEMORY
314 DEASSIGN OPENSSL_ENGINES
317 SET DEFAULT [-]{- move("..") -}
318 @ ! {- if ($disabled{tests}) { output_on(); } else { output_off(); } "" -}
319 @ WRITE SYS$OUTPUT "Tests are not supported with your chosen Configure options"
320 @ ! {- output_on() if !$disabled{tests}; "" -}
323 @ ! {- output_off() if $disabled{tests}; "" -}
324 @ DEFINE SRCTOP {- sourcedir() -}
325 @ $(PERL) {- sourcefile("test", "run_tests.pl") -} list
327 @ ! {- if ($disabled{tests}) { output_on(); } else { output_off(); } "" -}
328 @ WRITE SYS$OUTPUT "Tests are not supported with your chosen Configure options"
329 @ ! {- output_on() if !$disabled{tests}; "" -}
331 install : install_sw install_ssldirs install_docs
332 @ WRITE SYS$OUTPUT ""
333 @ WRITE SYS$OUTPUT "######################################################################"
334 @ WRITE SYS$OUTPUT ""
335 @ IF "$(DESTDIR)" .EQS. "" THEN -
336 PIPE ( WRITE SYS$OUTPUT "Installation complete" ; -
337 WRITE SYS$OUTPUT "" ; -
338 WRITE SYS$OUTPUT "Run @$(SYSTARTUP)openssl_startup{- $osslver -} to set up logical names" ; -
339 WRITE SYS$OUTPUT "then run @$(SYSTARTUP)openssl_utils{- $osslver -} to define commands" ; -
340 WRITE SYS$OUTPUT "" )
341 @ IF "$(DESTDIR)" .NES. "" THEN -
342 PIPE ( WRITE SYS$OUTPUT "Staging installation complete" ; -
343 WRITE SYS$OUTPUT "" ; -
344 WRITE SYS$OUTPUT "Finish or package in such a way that the contents of the directory tree" ; -
345 WRITE SYS$OUTPUT staging_instdir ; -
346 WRITE SYS$OUTPUT "ends up in $(INSTALLTOP)," ; -
347 WRITE SYS$OUTPUT "and that the contents of the contents of the directory tree" ; -
348 WRITE SYS$OUTPUT staging_datadir ; -
349 WRITE SYS$OUTPUT "ends up in $(OPENSSLDIR)" ; -
350 WRITE SYS$OUTPUT "" ; -
351 WRITE SYS$OUTPUT "When in its final destination," ; -
352 WRITE SYS$OUTPUT "Run @$(SYSTARTUP)openssl_startup{- $osslver -} to set up logical names" ; -
353 WRITE SYS$OUTPUT "then run @$(SYSTARTUP)openssl_utils{- $osslver -} to define commands" ; -
354 WRITE SYS$OUTPUT "" )
357 spawn/nolog @ossl_installroot:[SYSTEST]openssl_ivp{- $osslver -}.com
359 uninstall : uninstall_docs uninstall_sw
361 # Because VMS wants the generation number (or *) to delete files, we can't
362 # use $(LIBS), $(PROGRAMS), $(GENERATED) and $(ENGINES)directly.
364 {- join("\n\t", map { "- DELETE $_.OLB;*" } @libs) || "@ !" -}
365 {- join("\n\t", map { "- DELETE $_.EXE;*,$_.MAP;*" } @shlibs) || "@ !" -}
368 {- join("\n\t", map { "- DELETE $_.EXE;*,$_.OPT;*" } @{$unified_info{programs}}) || "@ !" -}
369 {- join("\n\t", map { "- DELETE $_.EXE;*,$_.OPT;*" } @{$unified_info{engines}}) || "@ !" -}
370 {- join("\n\t", map { "- DELETE $_;*" } @{$unified_info{scripts}}) || "@ !" -}
371 {- join("\n\t", map { "- DELETE $_;*" } @generated) || "@ !" -}
372 - DELETE [...]*.MAP;*
374 - DELETE [...]*.OBJ;*,*.LIS;*
375 - DELETE []CXX$DEMANGLER_DB.;*
376 - DELETE [.VMS]openssl_startup.com;*
377 - DELETE [.VMS]openssl_shutdown.com;*
378 - DELETE []vmsconfig.pm;*
381 - DELETE configdata.pm;*
382 - DELETE descrip.mms;*
386 @ ! {- output_off() if $disabled{makedepend}; "" -}
387 @ $(PERL) -pe "if (/^# DO NOT DELETE.*/) { exit(0); }" -
388 < descrip.mms > descrip.mms-new
389 @ OPEN/APPEND DESCRIP descrip.mms-new
390 @ WRITE DESCRIP "# DO NOT DELETE THIS LINE -- make depend depends on it."
391 {- join("\n\t", map { "\@ IF F\$SEARCH(\"$_\") .NES. \"\" THEN TYPE $_ /OUTPUT=DESCRIP:" } @deps); -}
393 @ PIPE ( $(PERL) -e "use File::Compare qw/compare_text/; my $x = compare_text(""descrip.mms"",""descrip.mms-new""); exit(0x10000000 + ($x == 0));" || -
394 RENAME descrip.mms-new descrip.mms )
395 @ IF F$SEARCH("descrip.mms-new") .NES. "" THEN DELETE descrip.mms-new;*
396 -@ SPAWN/OUTPUT=NLA0: PURGE/NOLOG descrip.mms
397 @ ! {- output_on() if $disabled{makedepend}; "" -}
399 # Install helper targets #############################################
401 install_sw : all install_shared _install_dev_ns -
402 install_engines _install_runtime_ns -
403 install_startup install_ivp
405 uninstall_sw : uninstall_shared _uninstall_dev_ns -
406 uninstall_engines _uninstall_runtime_ns -
407 uninstall_startup uninstall_ivp
409 install_docs : install_html_docs
411 uninstall_docs : uninstall_html_docs
413 install_ssldirs : check_INSTALLTOP
414 - CREATE/DIR/PROT=(S:RWED,O:RWE,G:RE,W:RE) OSSL_DATAROOT:[000000]
415 IF F$SEARCH("OSSL_DATAROOT:[000000]CERTS.DIR;1") .EQS. "" THEN -
416 CREATE/DIR/PROT=(S:RWED,O:RWE,G:RE,W:RE) OSSL_DATAROOT:[CERTS]
417 IF F$SEARCH("OSSL_DATAROOT:[000000]PRIVATE.DIR;1") .EQS. "" THEN -
418 CREATE/DIR/PROT=(S:RWED,O:RWE,G,W) OSSL_DATAROOT:[PRIVATE]
419 IF F$SEARCH("OSSL_DATAROOT:[000000]MISC.DIR;1") .EQS. "" THEN -
420 CREATE/DIR/PROT=(S:RWED,O:RWE,G,W) OSSL_DATAROOT:[MISC]
421 COPY/PROT=W:RE $(MISC_SCRIPTS) OSSL_DATAROOT:[MISC]
422 @ ! Install configuration file
423 COPY/PROT=W:R {- sourcefile("apps", "openssl-vms.cnf") -} -
424 ossl_dataroot:[000000]openssl.cnf-dist
425 IF F$SEARCH("OSSL_DATAROOT:[000000]openssl.cnf") .EQS. "" THEN -
426 COPY/PROT=W:R {- sourcefile("apps", "openssl-vms.cnf") -} -
427 ossl_dataroot:[000000]openssl.cnf
428 @ ! Install CTLOG configuration file
429 COPY/PROT=W:R {- sourcefile("apps", "ct_log_list.cnf") -} -
430 ossl_dataroot:[000000]ct_log_list.cnf-dist
431 IF F$SEARCH("OSSL_DATAROOT:[000000]ct_log_list.cnf") .EQS. "" THEN -
432 COPY/PROT=W:R {- sourcefile("apps", "ct_log_list.cnf") -} -
433 ossl_dataroot:[000000]ct_log_list.cnf
435 install_shared : check_INSTALLTOP
436 @ {- output_off() if $disabled{shared}; "" -} !
437 @ WRITE SYS$OUTPUT "*** Installing shareable images"
438 @ ! Install shared (runtime) libraries
439 - CREATE/DIR ossl_installroot:[LIB.'arch']
441 map { "COPY/PROT=W:R $_.EXE ossl_installroot:[LIB.'arch']" }
443 @ {- output_on() if $disabled{shared}; "" -} !
445 _install_dev_ns : check_INSTALLTOP
446 @ WRITE SYS$OUTPUT "*** Installing development files"
447 @ ! Install header files
448 - CREATE/DIR ossl_installroot:[include.openssl]
449 COPY/PROT=W:R openssl:*.h ossl_installroot:[include.openssl]
450 @ ! Install static (development) libraries
451 - CREATE/DIR ossl_installroot:[LIB.'arch']
453 map { "COPY/PROT=W:R $_.OLB ossl_installroot:[LIB.'arch']" }
456 install_dev : install_shared _install_dev_ns
458 _install_runtime_ns : check_INSTALLTOP
459 @ ! Install the main program
460 - CREATE/DIR ossl_installroot:[EXE.'arch']
461 COPY/PROT=W:RE [.APPS]openssl.EXE -
462 ossl_installroot:[EXE.'arch']openssl{- $osslver -}.EXE
464 COPY/PROT=W:RE $(BIN_SCRIPTS) ossl_installroot:[EXE]
465 @ ! {- output_on() if $disabled{apps}; "" -}
467 install_runtime : install_shared _install_runtime_ns
469 install_engines : check_INSTALLTOP
470 @ {- output_off() unless scalar @{$unified_info{engines}}; "" -} !
471 @ WRITE SYS$OUTPUT "*** Installing engines"
472 - CREATE/DIR ossl_installroot:[ENGINES{- $sover_dirname.$target{pointer_size} -}.'arch']
474 map { "COPY/PROT=W:RE $_.EXE ossl_installroot:[ENGINES$sover_dirname$target{pointer_size}.'arch']" }
475 @{$unified_info{install}->{engines}}) -}
476 @ {- output_on() unless scalar @{$unified_info{engines}}; "" -} !
478 install_startup : [.VMS]openssl_startup.com [.VMS]openssl_shutdown.com -
479 [.VMS]openssl_utils.com, check_INSTALLTOP
480 - CREATE/DIR ossl_installroot:[SYS$STARTUP]
481 COPY/PROT=W:RE [.VMS]openssl_startup.com -
482 ossl_installroot:[SYS$STARTUP]openssl_startup{- $osslver -}.com
483 COPY/PROT=W:RE [.VMS]openssl_shutdown.com -
484 ossl_installroot:[SYS$STARTUP]openssl_shutdown{- $osslver -}.com
485 COPY/PROT=W:RE [.VMS]openssl_utils.com -
486 ossl_installroot:[SYS$STARTUP]openssl_utils{- $osslver -}.com
488 install_ivp : [.VMS]openssl_ivp.com check_INSTALLTOP
489 - CREATE/DIR ossl_installroot:[SYSTEST]
490 COPY/PROT=W:RE [.VMS]openssl_ivp.com -
491 ossl_installroot:[SYSTEST]openssl_ivp{- $osslver -}.com
493 [.VMS]openssl_startup.com : vmsconfig.pm {- sourcefile("VMS", "openssl_startup.com.in") -}
495 $(PERL) "-I." "-Mvmsconfig" {- sourcefile("util", "dofile.pl") -} -
496 {- sourcefile("VMS", "openssl_startup.com.in") -} -
497 > [.VMS]openssl_startup.com
499 [.VMS]openssl_utils.com : vmsconfig.pm {- sourcefile("VMS", "openssl_utils.com.in") -}
501 $(PERL) "-I." "-Mvmsconfig" {- sourcefile("util", "dofile.pl") -} -
502 {- sourcefile("VMS", "openssl_utils.com.in") -} -
503 > [.VMS]openssl_utils.com
505 [.VMS]openssl_shutdown.com : vmsconfig.pm {- sourcefile("VMS", "openssl_shutdown.com.in") -}
507 $(PERL) "-I." "-Mvmsconfig" {- sourcefile("util", "dofile.pl") -} -
508 {- sourcefile("VMS", "openssl_shutdown.com.in") -} -
509 > [.VMS]openssl_shutdown.com
511 [.VMS]openssl_ivp.com : vmsconfig.pm {- sourcefile("VMS", "openssl_ivp.com.in") -}
513 $(PERL) "-I." "-Mvmsconfig" {- sourcefile("util", "dofile.pl") -} -
514 {- sourcefile("VMS", "openssl_ivp.com.in") -} -
515 > [.VMS]openssl_ivp.com
517 vmsconfig.pm : configdata.pm
518 OPEN/WRITE/SHARE=READ CONFIG []vmsconfig.pm
519 WRITE CONFIG "package vmsconfig;"
520 WRITE CONFIG "use strict; use warnings;"
521 WRITE CONFIG "use Exporter;"
522 WRITE CONFIG "our @ISA = qw(Exporter);"
523 WRITE CONFIG "our @EXPORT = qw(%config %target %withargs %unified_info %disabled);"
524 WRITE CONFIG "our %config = ("
525 WRITE CONFIG " target => '","{- $config{target} -}","',"
526 WRITE CONFIG " version => '","{- $config{version} -}","',"
527 WRITE CONFIG " shlib_version_number => '","{- $config{shlib_version_number} -}","',"
528 WRITE CONFIG " shlib_major => '","{- $config{shlib_major} -}","',"
529 WRITE CONFIG " shlib_minor => '","{- $config{shlib_minor} -}","',"
530 WRITE CONFIG " no_shared => '","{- $disabled{shared} -}","',"
531 WRITE CONFIG " INSTALLTOP => '$(INSTALLTOP)',"
532 WRITE CONFIG " OPENSSLDIR => '$(OPENSSLDIR)',"
533 WRITE CONFIG " pointer_size => '","{- $target{pointer_size} -}","',"
535 WRITE CONFIG "our %target = ();"
536 WRITE CONFIG "our %disabled = ();"
537 WRITE CONFIG "our %withargs = ();"
538 WRITE CONFIG "our %unified_info = ();"
542 install_html_docs : check_INSTALLTOP
543 sourcedir = F$PARSE("{- $sourcedir -}A.;","[]") - "]A.;" + ".DOC]"
544 $(PERL) {- sourcefile("util", "process_docs.pl") -} -
545 --sourcedir='sourcedir' --destdir=ossl_installroot:[HTML] -
549 @ IF "$(INSTALLTOP)" .EQS. "" THEN -
550 WRITE SYS$ERROR "INSTALLTOP should not be empty"
551 @ IF "$(INSTALLTOP)" .EQS. "" THEN -
554 # Helper targets #####################################################
556 # Developer targets ##################################################
559 SH LOGICAL/PROC openssl,internal,ossl_installroot,ossl_dataroot
561 # Building targets ###################################################
563 configdata.pm : $(SRCDIR)Configure $(SRCDIR)config.com {- join(" ", @{$config{build_file_templates}}, @{$config{build_infos}}, @{$config{conf_files}}) -}
564 perl configdata.pm -r -v
565 @ WRITE SYS$OUTPUT "*************************************************"
566 @ WRITE SYS$OUTPUT "*** ***"
567 @ WRITE SYS$OUTPUT "*** Please run the same mms command again ***"
568 @ WRITE SYS$OUTPUT "*** ***"
569 @ WRITE SYS$OUTPUT "*************************************************"
570 @ PIPE ( EXIT %X10000000 )
573 perl configdata.pm -r -v
577 use File::Spec::Functions qw/abs2rel rel2abs catfile catdir/;
579 # Helper function to figure out dependencies on libraries
580 # It takes a list of library names and outputs a list of dependencies
581 sub compute_lib_depends {
582 if ($disabled{shared}) {
583 return map { $_ =~ /\.a$/ ? $`.".OLB" : $_.".OLB" } @_;
585 return map { $_ =~ /\.a$/
587 : $unified_info{sharednames}->{$_}.".EXE" } @_;
592 my $generator = join(" ", @{$args{generator}});
593 my $generator_incs = join("", map { ' "-I'.$_.'"' } @{$args{generator_incs}});
594 my $deps = join(", -\n\t\t", @{$args{generator_deps}}, @{$args{deps}});
596 if ($args{src} !~ /\.[sS]$/) {
597 if ($args{generator}->[0] =~ m|^.*\.in$|) {
598 my $dofile = abs2rel(rel2abs(catfile($config{sourcedir},
599 "util", "dofile.pl")),
600 rel2abs($config{builddir}));
602 $args{src} : $args{generator}->[0] $deps
603 \$(PERL) "-I\$(BLDDIR)" "-Mconfigdata" $dofile \\
604 "-o$target{build_file}" $generator > \$@
608 $args{src} : $args{generator}->[0] $deps
609 \$(PERL)$generator_incs $generator > \$@
613 die "No method to generate assembler source present.\n";
619 (my $obj = $args{obj}) =~ s|\.o$||;
620 my $deps = join(", -\n\t\t", @{$args{srcs}}, @{$args{deps}});
622 # Because VMS C isn't very good at combining a /INCLUDE path with
623 # #includes having a relative directory (like '#include "../foo.h"),
624 # the best choice is to move to the first source file's intended
625 # directory before compiling, and make sure to write the object file
626 # in the correct position (important when the object tree is other
627 # than the source tree).
628 my $forward = dirname($args{srcs}->[0]);
629 my $backward = abs2rel(rel2abs("."), rel2abs($forward));
630 my $objd = abs2rel(rel2abs(dirname($obj)), rel2abs($forward));
631 my $objn = basename($obj);
634 map { abs2rel(rel2abs($_), rel2abs($forward)) } @{$args{srcs}});
635 my $cflags = '$(CFLAGS)';
636 if ($args{installed}) {
637 $cflags = { lib => '$(LIB_CFLAGS)',
638 dso => '$(DSO_CFLAGS)',
639 bin => '$(BIN_CFLAGS)' } -> {$args{intent}};
641 $cflags = { lib => '$(NO_INST_LIB_CFLAGS)',
642 dso => '$(NO_INST_DSO_CFLAGS)',
643 bin => '$(NO_INST_BIN_CFLAGS)' } -> {$args{intent}};
645 $cflags .= { lib => '$(LIB_CPPFLAGS)',
646 dso => '$(DSO_CPPFLAGS)',
647 bin => '$(BIN_CPPFLAGS)' } -> {$args{intent}};
649 # We create a logical name TMP_INCLUDES: to hold the list of internal
650 # includes. However, we cannot use it directly, as logical names can't
651 # hold zero entries, so we also create a symbol with the same name and
652 # use that instead, see the '/INCLUDE=' assignment above. If there are
653 # no internal include directories, it will simply be the empty string,
654 # but if there are, it will be assigned "TMP_DEFINES:,"
655 my $xtraincludes = { lib => '$(LIB_INCLUDES)',
656 dso => '$(DSO_INCLUDES)',
657 bin => '$(BIN_INCLUDES)' } -> {$args{intent}};
659 'IF tmp_add .NES. "" .AND. tmp_includes .NES. "" THEN tmp_includes = "," + tmp_includes'
660 ."\n\t".'tmp_includes = tmp_add + tmp_includes';
661 my $incs_on = 'tmp_includes := '
662 ."\n\t"."tmp_add := $xtraincludes"
664 ."\n\t".'tmp_add := $(INCLUDES)'
666 my $incs_off = 'DELETE/SYMBOL/LOCAL tmp_includes'
667 ."\n\t".'DELETE/SYMBOL/LOCAL tmp_add';
668 if (@{$args{incs}}) {
670 'DEFINE tmp_includes '
671 .join(",-\n\t\t\t", map {
672 file_name_is_absolute($_)
673 ? $_ : catdir($backward,$_)
676 ."\n\t".'IF tmp_includes .NES. "" THEN tmp_includes = "," + tmp_includes'
677 ."\n\t".'tmp_includes = "tmp_includes:" + tmp_includes';
679 "\n\t".'DEASSIGN tmp_includes';
681 my $before = $unified_info{before}->{$obj.".OBJ"} || "\@ !";
682 my $after = $unified_info{after}->{$obj.".OBJ"} || "\@ !";
683 my $depbuild = $disabled{makedepend} ? ""
684 : " /MMS=(FILE=${objd}${objn}.tmp-D,TARGET=$obj.OBJ)";
691 \$(CC) ${cflags}${depbuild} /OBJECT=${objd}${objn}.OBJ /REPOSITORY=$backward $srcs
693 SET DEFAULT $backward
697 . ($disabled{makedepend} ? "" : <<"EOF"
698 \@ PIPE ( \$(PERL) -e "use File::Compare qw/compare_text/; my \$x = compare_text(""$obj.D"",""$obj.tmp-D""); exit(0x10000000 + (\$x == 0));" || -
699 RENAME $obj.tmp-D $obj.d )
700 \@ IF F\$SEARCH("$obj.tmp-D") .NES. "" THEN DELETE $obj.tmp-D;*
706 my $lib = $args{lib};
707 my $shlib = $args{shlib};
708 my $libd = dirname($lib);
709 my $libn = basename($lib);
710 my @objs = map { (my $x = $_) =~ s|\.o$|.OBJ|; $x }
711 grep { $_ =~ m|\.o$| }
713 my @defs = grep { $_ =~ /\.opt$/ } @{$args{objs}};
714 my @deps = compute_lib_depends(@{$args{deps}});
715 die "More than one symbol vector" if scalar @defs > 1;
716 my $deps = join(", -\n\t\t", @defs, @deps);
717 my $shlib_target = $disabled{shared} ? "" : $target{shared_target};
718 my $translatesyms_pl = abs2rel(rel2abs(catfile($config{sourcedir},
719 "VMS", "translatesyms.pl")),
720 rel2abs($config{builddir}));
721 # The "[]" hack is because in .OPT files, each line inherits the
722 # previous line's file spec as default, so if no directory spec
723 # is present in the current line and the previous line has one that
724 # doesn't apply, you're in for a surprise.
726 join(",-\"\n\t", map { my $x = $_ =~ /\[/ ? $_ : "[]".$_;
727 "WRITE OPT_FILE \"$x" } @objs).
730 join("\n\t", map { my $x = $_ =~ /\[/ ? $_ : "[]".$_;
731 $x =~ s|(\.EXE)|$1/SHARE|;
732 $x =~ s|(\.OLB)|$1/LIB|;
733 "WRITE OPT_FILE \"$x\"" } @deps)
736 $shlib.EXE : $lib.OLB $deps
737 \$(PERL) $translatesyms_pl \$(BLDDIR)CXX\$DEMANGLER_DB. < $defs[0] > $defs[0]-translated
738 OPEN/WRITE/SHARE=READ OPT_FILE $lib-components.OPT
742 LINK \$(LDFLAGS)/SHARE=\$\@ $defs[0]-translated/OPT,-
743 $lib-components.OPT/OPT \$(EX_LIBS)
744 DELETE $defs[0]-translated;*,$lib-components.OPT;*
745 PURGE $shlib.EXE,$shlib.MAP
747 . ($config{target} =~ m|alpha| ? "" : <<"EOF"
748 SET IMAGE/FLAGS=(NOCALL_DEBUG) \$\@
754 my $lib = $args{lib};
755 my $libd = dirname($lib);
756 my $libn = basename($lib);
757 (my $libn_nolib = $libn) =~ s/^lib//;
758 my @objs = map { (my $x = $_) =~ s|\.o$|.OBJ|; $x } @{$args{objs}};
759 my @deps = compute_lib_depends(@{$args{deps}});
760 my $deps = join(", -\n\t\t", @objs, @deps);
761 my $shlib_target = $disabled{shared} ? "" : $target{shared_target};
762 my $engine_opt = abs2rel(rel2abs(catfile($config{sourcedir},
763 "VMS", "engine.opt")),
764 rel2abs($config{builddir}));
765 # The "[]" hack is because in .OPT files, each line inherits the
766 # previous line's file spec as default, so if no directory spec
767 # is present in the current line and the previous line has one that
768 # doesn't apply, you're in for a surprise.
770 join(",-\"\n\t", map { my $x = $_ =~ /\[/ ? $_ : "[]".$_;
771 "WRITE OPT_FILE \"$x" } @objs).
774 join("\n\t", map { my $x = $_ =~ /\[/ ? $_ : "[]".$_;
775 $x =~ s|(\.EXE)|$1/SHARE|;
776 $x =~ s|(\.OLB)|$1/LIB|;
777 "WRITE OPT_FILE \"$x\"" } @deps)
781 OPEN/WRITE/SHARE=READ OPT_FILE $lib.OPT
782 TYPE $engine_opt /OUTPUT=OPT_FILE:
786 LINK \$(LDFLAGS)/SHARE=\$\@ $lib.OPT/OPT \$(EX_LIBS)
787 - PURGE $lib.EXE,$lib.OPT,$lib.MAP
789 . ($config{target} =~ m|alpha| ? "" : <<"EOF"
790 SET IMAGE/FLAGS=(NOCALL_DEBUG) \$\@
796 (my $lib = $args{lib}) =~ s/\.a$//;
797 my @objs = map { (my $x = $_) =~ s|\.o$|.OBJ|; $x } @{$args{objs}};
798 my $objs = join(", -\n\t\t", @objs);
799 my $fill_lib = join("\n\t", (map { "LIBRARY/REPLACE $lib.OLB $_" }
803 LIBRARY/CREATE/OBJECT $lib.OLB
810 my $bin = $args{bin};
811 my $bind = dirname($bin);
812 my $binn = basename($bin);
813 my @objs = map { (my $x = $_) =~ s|\.o$|.OBJ|; $x } @{$args{objs}};
814 my $objs = join(",", @objs);
815 my @deps = compute_lib_depends(@{$args{deps}});
816 my $deps = join(", -\n\t\t", @objs, @deps);
818 my $olb_count = scalar grep(m|\.OLB$|, @deps);
819 my $analyse_objs = "@ !";
820 if ($olb_count > 0) {
822 $config{target} =~ m|alpha| ? "/GSD" : "/SECTIONS=SYMTAB";
823 $analyse_objs = "- pipe ANALYSE/OBJECT$analyse_quals $objs | SEARCH SYS\$INPUT \"\"\"main\"\"\" ; nomain = \$severity .NE. 1"
825 # The "[]" hack is because in .OPT files, each line inherits the
826 # previous line's file spec as default, so if no directory spec
827 # is present in the current line and the previous line has one that
828 # doesn't apply, you're in for a surprise.
830 join(",-\"\n\t", map { my $x = $_ =~ /\[/ ? $_ : "[]".$_;
831 "\@ WRITE OPT_FILE \"$x" } @objs).
834 join("\n\t", map { my @lines = ();
835 my $x = $_ =~ /\[/ ? $_ : "[]".$_;
836 if ($x =~ m|\.EXE$|) {
837 push @lines, "\@ WRITE OPT_FILE \"$x/SHARE\"";
838 } elsif ($x =~ m|\.OLB$|) {
839 (my $l = $x) =~ s/\W/_/g;
841 "\@ IF nomain THEN WRITE OPT_FILE \"$x/LIB\$(INCLUDE_MAIN_$l)\"",
842 "\@ IF .NOT. nomain THEN WRITE OPT_FILE \"$x/LIB\""
847 # The linking commands looks a bit complex, but it's for good reason.
848 # When you link, say, foo.obj, bar.obj and libsomething.exe/share, and
849 # bar.obj happens to have a symbol that also exists in libsomething.exe,
850 # the linker will warn about it, loudly, and will then choose to pick
851 # the first copy encountered (the one in bar.obj in this example).
852 # On Unix and on Windows, the corresponding maneuvre goes through
853 # silently with the same effect.
854 # With some test programs, made for checking the internals of OpenSSL,
855 # we do this kind of linking deliberately, picking a few specific object
856 # files from within [.crypto] or [.ssl] so we can reach symbols that are
857 # otherwise unreachable (since the shareable images only exports the
858 # symbols listed in [.util]*.num), and then with the shared libraries
859 # themselves. So we need to silence the warning about multiply defined
860 # symbols, to mimic the way linking work on Unix and Windows, and so
861 # the build isn't interrupted (MMS stops when warnings are signaled,
862 # by default), and so someone building doesn't have to worry where it
863 # isn't necessary. If there are other warnings, however, we show them
864 # and let it break the build.
868 @ OPEN/WRITE/SHARE=READ OPT_FILE $bin.OPT
872 TYPE $bin.opt ! For debugging
873 - pipe SPAWN/WAIT/NOLOG/OUT=$bin.LINKLOG -
874 LINK \$(LDFLAGS)/EXEC=\$\@ $bin.OPT/OPT \$(EX_LIBS) ; -
875 link_status = \$status ; link_severity = link_status .AND. 7
876 @ search_severity = 1
877 -@ IF link_severity .EQ. 0 THEN -
878 pipe SEARCH $bin.LINKLOG "%","-"/MATCH=AND | -
879 SPAWN/WAIT/NOLOG/OUT=NLA0: -
880 SEARCH SYS\$INPUT: "-W-MULDEF,"/MATCH=NOR ; -
881 search_severity = \$severity
882 @ ! search_severity is 3 when the last search didn't find any matching
883 @ ! string: %SEARCH-I-NOMATCHES, no strings matched
884 @ ! If that was the result, we pretend linking got through without
885 @ ! fault or warning.
886 @ IF search_severity .EQ. 3 THEN link_severity = 1
887 @ ! At this point, if link_severity shows that there was a fault
888 @ ! or warning, make sure to restore the linking status.
889 -@ IF .NOT. link_severity THEN TYPE $bin.LINKLOG
890 -@ DELETE $bin.LINKLOG;*
891 @ IF .NOT. link_severity THEN SPAWN/WAIT/NOLOG EXIT 'link_status'
892 - PURGE $bin.EXE,$bin.OPT
894 . ($config{target} =~ m|alpha| ? "" : <<"EOF"
895 SET IMAGE/FLAGS=(NOCALL_DEBUG) \$\@
901 my $script = $args{script};
902 return "" if grep { $_ eq $script } @{$args{sources}}; # No overwrite!
903 my $sources = join(" ", @{$args{sources}});
904 my $dofile = abs2rel(rel2abs(catfile($config{sourcedir},
905 "util", "dofile.pl")),
906 rel2abs($config{builddir}));
909 \$(PERL) "-I\$(BLDDIR)" "-Mconfigdata" $dofile -
910 "-o$target{build_file}" $sources > $script
911 SET FILE/PROT=(S:RWED,O:RWED,G:RE,W:RE) $script
915 "" # Important! This becomes part of the template result.