]> WPIA git - cassiopeia.git/blob - lib/openssl/Configurations/descrip.mms.tmpl
upd: openssl to 1.1.0
[cassiopeia.git] / lib / openssl / Configurations / descrip.mms.tmpl
1 ## descrip.mms to build OpenSSL on OpenVMS
2 ##
3 ## {- join("\n## ", @autowarntext) -}
4 {-
5   use File::Spec::Functions qw/:DEFAULT abs2rel rel2abs/;
6
7   # Our prefix, claimed when speaking with the VSI folks Tuesday
8   # January 26th 2016
9   our $osslprefix = 'OSSL$';
10   (our $osslprefix_q = $osslprefix) =~ s/\$/\\\$/;
11
12   our $sover = sprintf "%02d%02d", $config{shlib_major}, $config{shlib_minor};
13   our $osslver = sprintf "%02d%02d", split(/\./, $config{version});
14
15   our $sourcedir = $config{sourcedir};
16   our $builddir = $config{builddir};
17   sub sourcefile {
18       catfile($sourcedir, @_);
19   }
20   sub buildfile {
21       catfile($builddir, @_);
22   }
23   sub sourcedir {
24       catdir($sourcedir, @_);
25   }
26   sub builddir {
27       catdir($builddir, @_);
28   }
29   sub tree {
30       (my $x = shift) =~ s|\]$|...]|;
31       $x
32   }
33   sub move {
34       my $f = catdir(@_);
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);
40       "";
41   }
42
43   # Because we need to make two computations of these data,
44   # we store them in arrays for reuse
45   our @shlibs = map { $unified_info{sharednames}->{$_} || () } @{$unified_info{libraries}};
46   our @install_shlibs = map { $unified_info{sharednames}->{$_} || () } @{$unified_info{install}->{libraries}};
47   our @generated = ( ( map { (my $x = $_) =~ s|\.S$|\.s|; $x }
48                        grep { defined $unified_info{generate}->{$_} }
49                        map { @{$unified_info{sources}->{$_}} }
50                        grep { /\.o$/ } keys %{$unified_info{sources}} ),
51                      ( grep { /\.h$/ } keys %{$unified_info{generate}} ) );
52
53   # This is a horrible hack, but is needed because recursive inclusion of files
54   # in different directories does not work well with HP C.
55   my $sd = sourcedir("crypto", "async", "arch");
56   foreach (grep /\[\.crypto\.async\.arch\].*\.o$/, keys %{$unified_info{sources}}) {
57       (my $x = $_) =~ s|\.o$|.OBJ|;
58       $unified_info{before}->{$x}
59           = qq(arch_include = F\$PARSE("$sd","A.;",,,"SYNTAX_ONLY") - "A.;"
60         define arch 'arch_include');
61       $unified_info{after}->{$x}
62           = qq(deassign arch);
63   }
64   my $sd1 = sourcedir("ssl","record");
65   my $sd2 = sourcedir("ssl","statem");
66   $unified_info{before}->{"[.test]heartbeat_test.OBJ"}
67       = $unified_info{before}->{"[.test]ssltest_old.OBJ"}
68       = qq(record_include = F\$PARSE("$sd1","A.;",,,"SYNTAX_ONLY") - "A.;"
69         define record 'record_include'
70         statem_include = F\$PARSE("$sd2","A.;",,,"SYNTAX_ONLY") - "A.;"
71         define statem 'statem_include');
72   $unified_info{after}->{"[.test]heartbeat_test.OBJ"}
73       = $unified_info{after}->{"[.test]ssltest.OBJ"}
74       = qq(deassign statem
75         deassign record);
76   foreach (grep /^\[\.ssl\.(?:record|statem)\].*\.o$/, keys %{$unified_info{sources}}) {
77       (my $x = $_) =~ s|\.o$|.OBJ|;
78       $unified_info{before}->{$x}
79           = qq(record_include = F\$PARSE("$sd1","A.;",,,"SYNTAX_ONLY") - "A.;"
80         define record 'record_include'
81         statem_include = F\$PARSE("$sd2","A.;",,,"SYNTAX_ONLY") - "A.;"
82         define statem 'statem_include');
83       $unified_info{after}->{$x}
84           = qq(deassign statem
85         deassign record);
86   }
87   #use Data::Dumper;
88   #print STDERR "DEBUG: before:\n", Dumper($unified_info{before});
89   #print STDERR "DEBUG: after:\n", Dumper($unified_info{after});
90   "";
91 -}
92 PLATFORM={- $config{target} -}
93 OPTIONS={- $config{options} -}
94 CONFIGURE_ARGS=({- join(", ",quotify_l(@{$config{perlargv}})) -})
95 SRCDIR={- $config{sourcedir} -}
96 BLDDIR={- $config{builddir} -}
97
98 # Allow both V and VERBOSE to indicate verbosity.  This only applies
99 # to testing.
100 VERBOSE=$(V)
101
102 VERSION={- $config{version} -}
103 MAJOR={- $config{major} -}
104 MINOR={- $config{minor} -}
105 SHLIB_VERSION_NUMBER={- $config{shlib_version_number} -}
106 SHLIB_VERSION_HISTORY={- $config{shlib_version_history} -}
107 SHLIB_MAJOR={- $config{shlib_major} -}
108 SHLIB_MINOR={- $config{shlib_minor} -}
109 SHLIB_TARGET={- $target{shared_target} -}
110
111 EXE_EXT=.EXE
112 LIB_EXT=.OLB
113 SHLIB_EXT=.EXE
114 OBJ_EXT=.OBJ
115 DEP_EXT=.D
116
117 LIBS={- join(", ", map { "-\n\t".$_.".OLB" } @{$unified_info{libraries}}) -}
118 SHLIBS={- join(", ", map { "-\n\t".$_.".EXE" } @shlibs) -}
119 ENGINES={- join(", ", map { "-\n\t".$_.".EXE" } @{$unified_info{engines}}) -}
120 PROGRAMS={- join(", ", map { "-\n\t".$_.".EXE" } @{$unified_info{programs}}) -}
121 SCRIPTS={- join(", ", map { "-\n\t".$_ } @{$unified_info{scripts}}) -}
122 {- output_off() if $disabled{makedepend}; "" -}
123 DEPS={- our @deps = map { (my $x = $_) =~ s|\.o$|\$(DEP_EXT)|; $x; }
124                     grep { $unified_info{sources}->{$_}->[0] =~ /\.c$/ }
125                     keys %{$unified_info{sources}};
126         join(", ", map { "-\n\t".$_ } @deps); -}
127 {- output_on() if $disabled{makedepend}; "" -}
128 GENERATED_MANDATORY={- join(", ", map { "-\n\t".$_ } @{$unified_info{depends}->{""}} ) -}
129 GENERATED={- join(", ", map { "-\n\t".$_ } @generated) -}
130
131 INSTALL_LIBS={- join(", ", map { "-\n\t".$_.".OLB" } @{$unified_info{install}->{libraries}}) -}
132 INSTALL_SHLIBS={- join(", ", map { "-\n\t".$_.".EXE" } @install_shlibs) -}
133 INSTALL_ENGINES={- join(", ", map { "-\n\t".$_.".EXE" } @{$unified_info{install}->{engines}}) -}
134 INSTALL_PROGRAMS={- join(", ", map { "-\n\t".$_.".EXE" } @{$unified_info{install}->{programs}}) -}
135 {- output_off() if $disabled{apps}; "" -}
136 BIN_SCRIPTS=[.tools]c_rehash.pl
137 MISC_SCRIPTS=[.apps]CA.pl, [.apps]tsget.pl
138 {- output_on() if $disabled{apps}; "" -}
139
140 # DESTDIR is for package builders so that they can configure for, say,
141 # SYS$COMMON:[OPENSSL] and yet have everything installed in STAGING:[USER].
142 # In that case, configure with --prefix=SYS$COMMON:[OPENSSL] and then run
143 # MMS with /MACROS=(DESTDIR=STAGING:[USER]).  The result will end up in
144 # STAGING:[USER.OPENSSL].
145 # Normally it is left empty.
146 DESTDIR=
147
148 # Do not edit this manually. Use Configure --prefix=DIR to change this!
149 INSTALLTOP={- our $installtop =
150                   catdir($config{prefix}) || "SYS\$COMMON:[OPENSSL]";
151               $installtop -}
152 SYSTARTUP={- catdir($installtop, '[.SYS$STARTUP]'); -}
153 # This is the standard central area to store certificates, private keys...
154 OPENSSLDIR={- catdir($config{openssldir}) or
155               $config{prefix} ? catdir($config{prefix},"COMMON")
156                               : "SYS\$COMMON:[OPENSSL-COMMON]" -}
157 # The same, but for C
158 OPENSSLDIR_C={- $osslprefix -}DATAROOT:[000000]
159 # Where installed engines reside, for C
160 ENGINESDIR_C={- $osslprefix -}ENGINES{- $sover.$target{pointer_size} -}:
161
162 CC= {- $target{cc} -}
163 CFLAGS= /DEFINE=({- join(",", @{$target{defines}}, @{$config{defines}},"OPENSSLDIR=\"\"\"\$(OPENSSLDIR_C)\"\"\"","ENGINESDIR=\"\"\"\$(ENGINESDIR_C)\"\"\"") -}) {- $target{cflags} -} {- $config{cflags} -}
164 CFLAGS_Q=$(CFLAGS)
165 DEPFLAG= /DEFINE=({- join(",", @{$config{depdefines}}) -})
166 LDFLAGS= {- $target{lflags} -}
167 EX_LIBS= {- $target{ex_libs} ? ",".$target{ex_libs} : "" -}{- $config{ex_libs} ? ",".$config{ex_libs} : "" -}
168 LIB_CFLAGS={- $target{lib_cflags} || "" -}
169 DSO_CFLAGS={- $target{dso_cflags} || "" -}
170 BIN_CFLAGS={- $target{bin_cflags} || "" -}
171
172 PERL={- $config{perl} -}
173
174 # We let the C compiler driver to take care of .s files. This is done in
175 # order to be excused from maintaining a separate set of architecture
176 # dependent assembler flags. E.g. if you throw -mcpu=ultrasparc at SPARC
177 # gcc, then the driver will automatically translate it to -xarch=v8plus
178 # and pass it down to assembler.
179 AS={- $target{as} -}
180 ASFLAG={- $target{asflags} -}
181
182 # .FIRST and .LAST are special targets with MMS and MMK.
183 # The defines in there are for C.  includes that look like
184 # this:
185 #
186 #    #include <openssl/foo.h>
187 #    #include "internal/bar.h"
188 #
189 # will use the logical names to find the files.  Expecting
190 # DECompHP C to find files in subdirectories of whatever was
191 # given with /INCLUDE is a fantasy, unfortunately.
192 NODEBUG=@
193 .FIRST :
194         $(NODEBUG) openssl_inc1 = F$PARSE("[.include.openssl]","A.;",,,"syntax_only") - "A.;"
195         $(NODEBUG) openssl_inc2 = F$PARSE("{- catdir($config{sourcedir},"[.include.openssl]") -}","A.;",,,"SYNTAX_ONLY") - "A.;"
196         $(NODEBUG) internal_inc1 = F$PARSE("[.crypto.include.internal]","A.;",,,"SYNTAX_ONLY") - "A.;"
197         $(NODEBUG) internal_inc2 = F$PARSE("{- catdir($config{sourcedir},"[.include.internal]") -}","A.;",,,"SYNTAX_ONLY") - "A.;"
198         $(NODEBUG) internal_inc3 = F$PARSE("{- catdir($config{sourcedir},"[.crypto.include.internal]") -}","A.;",,,"SYNTAX_ONLY") - "A.;"
199         $(NODEBUG) DEFINE openssl 'openssl_inc1','openssl_inc2'
200         $(NODEBUG) DEFINE internal 'internal_inc1','internal_inc2','internal_inc3'
201         $(NODEBUG) staging_dir = "$(DESTDIR)"
202         $(NODEBUG) staging_instdir = ""
203         $(NODEBUG) staging_datadir = ""
204         $(NODEBUG) IF staging_dir .NES. "" THEN -
205                 staging_instdir = F$PARSE("A.;",staging_dir,"[]",,"SYNTAX_ONLY")
206         $(NODEBUG) IF staging_instdir - "]A.;" .NES. staging_instdir THEN -
207                 staging_instdir = staging_instdir - "]A.;" + ".OPENSSL-INSTALL]"
208         $(NODEBUG) IF staging_instdir - "A.;" .NES. staging_instdir THEN -
209                 staging_instdir = staging_instdir - "A.;" + "[OPENSSL-INSTALL]"
210         $(NODEBUG) IF staging_dir .NES. "" THEN -
211                 staging_datadir = F$PARSE("A.;",staging_dir,"[]",,"SYNTAX_ONLY")
212         $(NODEBUG) IF staging_datadir - "]A.;" .NES. staging_datadir THEN -
213                 staging_datadir = staging_datadir - "]A.;" + ".OPENSSL-COMMON]"
214         $(NODEBUG) IF staging_datadir - "A.;" .NES. staging_datadir THEN -
215                 staging_datadir = staging_datadir - "A.;" + "[OPENSSL-COMMON]"
216         $(NODEBUG) !
217         $(NODEBUG) ! Installation logical names
218         $(NODEBUG) !
219         $(NODEBUG) installtop = F$PARSE(staging_instdir,"$(INSTALLTOP)","[]A.;",,"SYNTAX_ONLY,NO_CONCEAL") - ".][000000" - "[000000." - "][" - "]A.;" + ".]"
220         $(NODEBUG) datatop = F$PARSE(staging_datadir,"$(OPENSSLDIR)","[]A.;",,"SYNTAX_ONLY,NO_CONCEAL") - ".][000000" - "[000000." - "][" - "]A.;" + ".]"
221         $(NODEBUG) DEFINE ossl_installroot 'installtop'
222         $(NODEBUG) DEFINE ossl_dataroot 'datatop'
223         $(NODEBUG) !
224         $(NODEBUG) ! Figure out the architecture
225         $(NODEBUG) !
226         $(NODEBUG) arch = f$edit( f$getsyi( "arch_name"), "upcase")
227         $(NODEBUG) !
228         $(NODEBUG) ! Set up logical names for the libraries, so LINK and
229         $(NODEBUG) ! running programs can use them.
230         $(NODEBUG) !
231         $(NODEBUG) {- join("\n\t\$(NODEBUG) ", map { "DEFINE ".uc($_)." 'F\$ENV(\"DEFAULT\")'".uc($_)."\$(SHLIB_EXT)" } map { $unified_info{sharednames}->{$_} || () } @{$unified_info{libraries}}) || "!" -}
232
233 .LAST :
234         $(NODEBUG) {- join("\n\t\$(NODEBUG) ", map { "DEASSIGN ".uc($_) } map { $unified_info{sharednames}->{$_} || () } @{$unified_info{libraries}}) || "!" -}
235         $(NODEBUG) DEASSIGN ossl_dataroot
236         $(NODEBUG) DEASSIGN ossl_installroot
237         $(NODEBUG) DEASSIGN internal
238         $(NODEBUG) DEASSIGN openssl
239 .DEFAULT :
240         @ ! MMS cannot handle no actions...
241
242 # The main targets ###################################################
243
244 all : build_generated, -
245       build_libs_nodep, build_engines_nodep, build_programs_nodep, -
246       depend
247
248 build_libs : build_generated, build_libs_nodep, depend
249 build_libs_nodep : $(LIBS), $(SHLIBS)
250 build_engines : build_generated, build_engines_nodep, depend
251 build_engines_nodep : $(ENGINES)
252 build_programs : build_generated, build_programs_nodep, depend
253 build_programs_nodep : $(PROGRAMS), $(SCRIPTS)
254
255 build_generated : $(GENERATED_MANDATORY)
256
257 # Kept around for backward compatibility
258 build_apps build_tests : build_programs
259
260 test tests : build_generated, build_programs_nodep, build_engines_nodep, -
261              depend
262         @ ! {- output_off() if $disabled{tests}; "" -}
263         SET DEFAULT [.test]{- move("test") -}
264         DEFINE SRCTOP {- sourcedir() -}
265         DEFINE BLDTOP {- builddir() -}
266         DEFINE OPENSSL_ENGINES {- builddir("engines") -}
267         DEFINE OPENSSL_DEBUG_MEMORY "on"
268         IF "$(VERBOSE)" .NES. "" THEN DEFINE VERBOSE "$(VERBOSE)"
269         $(PERL) {- sourcefile("test", "run_tests.pl") -} $(TESTS)
270         DEASSIGN OPENSSL_DEBUG_MEMORY
271         DEASSIGN OPENSSL_ENGINES
272         DEASSIGN BLDTOP
273         DEASSIGN SRCTOP
274         SET DEFAULT [-]{- move("..") -}
275         @ ! {- if ($disabled{tests}) { output_on(); } else { output_off(); } "" -}
276         @ WRITE SYS$OUTPUT "Tests are not supported with your chosen Configure options"
277         @ ! {- output_on() if !$disabled{tests}; "" -}
278
279 list-tests :
280         @ ! {- output_off() if $disabled{tests}; "" -}
281         @ DEFINE SRCTOP {- sourcedir() -}
282         @ $(PERL) {- sourcefile("test", "run_tests.pl") -} list
283         @ DEASSIGN SRCTOP
284         @ ! {- if ($disabled{tests}) { output_on(); } else { output_off(); } "" -}
285         @ WRITE SYS$OUTPUT "Tests are not supported with your chosen Configure options"
286         @ ! {- output_on() if !$disabled{tests}; "" -}
287
288 install : install_sw install_ssldirs install_docs
289         @ WRITE SYS$OUTPUT ""
290         @ WRITE SYS$OUTPUT "######################################################################"
291         @ WRITE SYS$OUTPUT ""
292         @ IF "$(DESTDIR)" .EQS. "" THEN -
293              PIPE ( WRITE SYS$OUTPUT "Installation complete" ; -
294                     WRITE SYS$OUTPUT "" ; -
295                     WRITE SYS$OUTPUT "Run @$(SYSTARTUP)openssl_startup{- $osslver -} to set up logical names" ; -
296                     WRITE SYS$OUTPUT "then run @$(SYSTARTUP)openssl_utils{- $osslver -} to define commands" ; -
297                     WRITE SYS$OUTPUT "" )
298         @ IF "$(DESTDIR)" .NES. "" THEN -
299              PIPE ( WRITE SYS$OUTPUT "Staging installation complete" ; -
300                     WRITE SYS$OUTPUT "" ; -
301                     WRITE SYS$OUTPUT "Finish or package in such a way that the contents of the directory tree" ; -
302                     WRITE SYS$OUTPUT staging_instdir ; -
303                     WRITE SYS$OUTPUT "ends up in $(INSTALLTOP)," ; -
304                     WRITE SYS$OUTPUT "and that the contents of the contents of the directory tree" ; -
305                     WRITE SYS$OUTPUT staging_datadir ; -
306                     WRITE SYS$OUTPUT "ends up in $(OPENSSLDIR)" ; -
307                     WRITE SYS$OUTPUT "" ; -
308                     WRITE SYS$OUTPUT "When in its final destination," ; -
309                     WRITE SYS$OUTPUT "Run @$(SYSTARTUP)openssl_startup{- $osslver -} to set up logical names" ; -
310                     WRITE SYS$OUTPUT "then run @$(SYSTARTUP)openssl_utils{- $osslver -} to define commands" ; -
311                     WRITE SYS$OUTPUT "" )
312
313 check_install :
314         spawn/nolog @ossl_installroot:[SYSTEST]openssl_ivp{- $osslver -}.com
315
316 uninstall : uninstall_docs uninstall_sw
317
318 # Because VMS wants the generation number (or *) to delete files, we can't
319 # use $(LIBS), $(PROGRAMS), $(GENERATED) and $(ENGINES)directly.
320 libclean :
321         {- join("\n\t", map { "- DELETE $_.OLB;*" } @{$unified_info{libraries}}) || "@ !" -}
322         {- join("\n\t", map { "- DELETE $_.EXE;*,$_.MAP;*,$_.OPT;*" } @shlibs) || "@ !" -}
323
324 clean : libclean
325         {- join("\n\t", map { "- DELETE $_.EXE;*,$_.OPT;*" } @{$unified_info{programs}}) || "@ !" -}
326         {- join("\n\t", map { "- DELETE $_.EXE;*,$_.OPT;*" } @{$unified_info{engines}}) || "@ !" -}
327         {- join("\n\t", map { "- DELETE $_;*" } @{$unified_info{scripts}}) || "@ !" -}
328         {- join("\n\t", map { "- DELETE $_;*" } @generated) || "@ !" -}
329         - DELETE [...]*.MAP;*
330         - DELETE [...]*.D;*
331         - DELETE [...]*.OBJ;*,*.LIS;*
332         - DELETE []CXX$DEMANGLER_DB.;*
333         - DELETE [.VMS]openssl_startup.com;*
334         - DELETE [.VMS]openssl_shutdown.com;*
335         - DELETE []vmsconfig.pm;*
336
337 distclean : clean
338         - DELETE configdata.pm;*
339         - DELETE descrip.mms;*
340
341 depend : descrip.mms
342 descrip.mms : FORCE
343         @ ! {- output_off() if $disabled{makedepend}; "" -}
344         @ $(PERL) -pe "if (/^# DO NOT DELETE.*/) { exit(0); }" -
345                 < descrip.mms > descrip.mms-new
346         @ OPEN/APPEND DESCRIP descrip.mms-new
347         @ WRITE DESCRIP "# DO NOT DELETE THIS LINE -- make depend depends on it."
348         {- join("\n\t", map { "\@ IF F\$SEARCH(\"$_\") .NES. \"\" THEN TYPE $_ /OUTPUT=DESCRIP:" } @deps); -}
349         @ CLOSE DESCRIP
350         @ PIPE ( $(PERL) -e "use File::Compare qw/compare_text/; my $x = compare_text(""descrip.mms"",""descrip.mms-new""); exit(0x10000000 + ($x == 0));" || -
351                  RENAME descrip.mms-new descrip.mms )
352         @ IF F$SEARCH("descrip.mms-new") .NES. "" THEN DELETE descrip.mms-new;*
353         -@ SPAWN/OUTPUT=NLA0: PURGE/NOLOG descrip.mms
354         @ ! {- output_on() if $disabled{makedepend}; "" -}
355
356 # Install helper targets #############################################
357
358 install_sw : all install_shared _install_dev_ns -
359              install_engines _install_runtime_ns -
360              install_startup install_ivp
361
362 uninstall_sw : uninstall_shared _uninstall_dev_ns -
363                uninstall_engines _uninstall_runtime_ns -
364                uninstall_startup uninstall_ivp
365
366 install_docs : install_html_docs
367
368 uninstall_docs : uninstall_html_docs
369
370 install_ssldirs : check_INSTALLTOP
371         - CREATE/DIR/PROT=(S:RWED,O:RWE,G:RE,W:RE) OSSL_DATAROOT:[000000]
372         IF F$SEARCH("OSSL_DATAROOT:[000000]CERTS.DIR;1") .EQS. "" THEN -
373                 CREATE/DIR/PROT=(S:RWED,O:RWE,G:RE,W:RE) OSSL_DATAROOT:[CERTS]
374         IF F$SEARCH("OSSL_DATAROOT:[000000]PRIVATE.DIR;1") .EQS. "" THEN -
375                 CREATE/DIR/PROT=(S:RWED,O:RWE,G,W) OSSL_DATAROOT:[PRIVATE]
376         IF F$SEARCH("OSSL_DATAROOT:[000000]MISC.DIR;1") .EQS. "" THEN -
377                 CREATE/DIR/PROT=(S:RWED,O:RWE,G,W) OSSL_DATAROOT:[MISC]
378         COPY/PROT=W:RE $(MISC_SCRIPTS) OSSL_DATAROOT:[MISC]
379         @ ! Install configuration file
380         COPY/PROT=W:R {- sourcefile("apps", "openssl-vms.cnf") -} -
381                 ossl_dataroot:[000000]openssl.cnf-dist
382         IF F$SEARCH("OSSL_DATAROOT:[000000]openssl.cnf") .EQS. "" THEN -
383                 COPY/PROT=W:R {- sourcefile("apps", "openssl-vms.cnf") -} -
384                         ossl_dataroot:[000000]openssl.cnf
385
386 install_shared : check_INSTALLTOP
387         @ {- output_off() if $disabled{shared}; "" -} !
388         @ WRITE SYS$OUTPUT "*** Installing shareable images"
389         @ ! Install shared (runtime) libraries
390         - CREATE/DIR ossl_installroot:[LIB.'arch']
391         {- join("\n        ",
392                 map { "COPY/PROT=W:R $_.EXE ossl_installroot:[LIB.'arch']" }
393                 @install_shlibs) -}
394         @ {- output_on() if $disabled{shared}; "" -} !
395
396 _install_dev_ns : check_INSTALLTOP
397         @ WRITE SYS$OUTPUT "*** Installing development files"
398         @ ! Install header files
399         - CREATE/DIR ossl_installroot:[include.openssl]
400         COPY/PROT=W:R openssl:*.h ossl_installroot:[include.openssl]
401         @ ! Install static (development) libraries
402         - CREATE/DIR ossl_installroot:[LIB.'arch']
403         {- join("\n        ",
404                 map { "COPY/PROT=W:R $_.OLB ossl_installroot:[LIB.'arch']" }
405                 @{$unified_info{install}->{libraries}}) -}
406
407 install_dev : install_shared _install_dev_ns
408
409 _install_runtime_ns : check_INSTALLTOP
410         @ ! Install the main program
411         - CREATE/DIR ossl_installroot:[EXE.'arch']
412         COPY/PROT=W:RE [.APPS]openssl.EXE -
413                 ossl_installroot:[EXE.'arch']openssl{- $osslver -}.EXE
414         @ ! Install scripts
415         COPY/PROT=W:RE $(BIN_SCRIPTS) ossl_installroot:[EXE]
416         @ ! {- output_on() if $disabled{apps}; "" -}
417
418 install_runtime : install_shared _install_runtime_ns
419
420 install_engines : check_INSTALLTOP
421         @ {- output_off() unless scalar @{$unified_info{engines}}; "" -} !
422         @ WRITE SYS$OUTPUT "*** Installing engines"
423         - CREATE/DIR ossl_installroot:[ENGINES{- $sover.$target{pointer_size} -}.'arch']
424         {- join("\n        ",
425                 map { "COPY/PROT=W:RE $_.EXE ossl_installroot:[ENGINES$sover$target{pointer_size}.'arch']" }
426                 @{$unified_info{install}->{engines}}) -}
427         @ {- output_on() unless scalar @{$unified_info{engines}}; "" -} !
428
429 install_startup : [.VMS]openssl_startup.com [.VMS]openssl_shutdown.com -
430                  [.VMS]openssl_utils.com, check_INSTALLTOP
431         - CREATE/DIR ossl_installroot:[SYS$STARTUP]
432         COPY/PROT=W:RE [.VMS]openssl_startup.com -
433                 ossl_installroot:[SYS$STARTUP]openssl_startup{- $osslver -}.com
434         COPY/PROT=W:RE [.VMS]openssl_shutdown.com -
435                 ossl_installroot:[SYS$STARTUP]openssl_shutdown{- $osslver -}.com
436         COPY/PROT=W:RE [.VMS]openssl_utils.com -
437                 ossl_installroot:[SYS$STARTUP]openssl_utils{- $osslver -}.com
438
439 install_ivp : [.VMS]openssl_ivp.com check_INSTALLTOP
440         - CREATE/DIR ossl_installroot:[SYSTEST]
441         COPY/PROT=W:RE [.VMS]openssl_ivp.com -
442                 ossl_installroot:[SYSTEST]openssl_ivp{- $osslver -}.com
443
444 [.VMS]openssl_startup.com : vmsconfig.pm {- sourcefile("VMS", "openssl_startup.com.in") -}
445         - CREATE/DIR [.VMS]
446         $(PERL) "-I." "-Mvmsconfig" {- sourcefile("util", "dofile.pl") -} -
447                 {- sourcefile("VMS", "openssl_startup.com.in") -} -
448                 > [.VMS]openssl_startup.com
449
450 [.VMS]openssl_utils.com : vmsconfig.pm {- sourcefile("VMS", "openssl_utils.com.in") -}
451         - CREATE/DIR [.VMS]
452         $(PERL) "-I." "-Mvmsconfig" {- sourcefile("util", "dofile.pl") -} -
453                 {- sourcefile("VMS", "openssl_utils.com.in") -} -
454                 > [.VMS]openssl_utils.com
455
456 [.VMS]openssl_shutdown.com : vmsconfig.pm {- sourcefile("VMS", "openssl_shutdown.com.in") -}
457         - CREATE/DIR [.VMS]
458         $(PERL) "-I." "-Mvmsconfig" {- sourcefile("util", "dofile.pl") -} -
459                 {- sourcefile("VMS", "openssl_shutdown.com.in") -} -
460                 > [.VMS]openssl_shutdown.com
461
462 [.VMS]openssl_ivp.com : vmsconfig.pm {- sourcefile("VMS", "openssl_ivp.com.in") -}
463         - CREATE/DIR [.VMS]
464         $(PERL) "-I." "-Mvmsconfig" {- sourcefile("util", "dofile.pl") -} -
465                 {- sourcefile("VMS", "openssl_ivp.com.in") -} -
466                 > [.VMS]openssl_ivp.com
467
468 vmsconfig.pm : configdata.pm
469         OPEN/WRITE/SHARE=READ CONFIG []vmsconfig.pm
470         WRITE CONFIG "package vmsconfig;"
471         WRITE CONFIG "use strict; use warnings;"
472         WRITE CONFIG "use Exporter;"
473         WRITE CONFIG "our @ISA = qw(Exporter);"
474         WRITE CONFIG "our @EXPORT = qw(%config %target %withargs %unified_info %disabled);"
475         WRITE CONFIG "our %config = ("
476         WRITE CONFIG "  target => '","{- $config{target} -}","',"
477         WRITE CONFIG "  version => '","{- $config{version} -}","',"
478         WRITE CONFIG "  shlib_major => '","{- $config{shlib_major} -}","',"
479         WRITE CONFIG "  shlib_minor => '","{- $config{shlib_minor} -}","',"
480         WRITE CONFIG "  no_shared => '","{- $disabled{shared} -}","',"
481         WRITE CONFIG "  INSTALLTOP => '$(INSTALLTOP)',"
482         WRITE CONFIG "  OPENSSLDIR => '$(OPENSSLDIR)',"
483         WRITE CONFIG "  pointer_size => '","{- $target{pointer_size} -}","',"
484         WRITE CONFIG ");"
485         WRITE CONFIG "our %target = ();"
486         WRITE CONFIG "our %disabled = ();"
487         WRITE CONFIG "our %withargs = ();"
488         WRITE CONFIG "our %unified_info = ();"
489         WRITE CONFIG "1;"
490         CLOSE CONFIG
491
492 install_html_docs : check_INSTALLTOP
493         sourcedir = F$PARSE("{- $sourcedir -}A.;","[]") - "]A.;" + ".DOC]"
494         $(PERL) {- sourcefile("util", "process_docs.pl") -} -
495                 --sourcedir='sourcedir' --destdir=ossl_installroot:[HTML] -
496                 --type=html
497
498 check_INSTALLTOP :
499         @ IF "$(INSTALLTOP)" .EQS. "" THEN -
500                 WRITE SYS$ERROR "INSTALLTOP should not be empty"
501         @ IF "$(INSTALLTOP)" .EQS. "" THEN -
502                 EXIT %x10000002
503
504 # Helper targets #####################################################
505
506 # Developer targets ##################################################
507
508 debug_logicals :
509         SH LOGICAL/PROC openssl,internal,ossl_installroot,ossl_dataroot
510
511 # Building targets ###################################################
512
513 configdata.pm : $(SRCDIR)Configure $(SRCDIR)config.com {- join(" ", @{$config{build_file_templates}}, @{$config{build_infos}}, @{$config{conf_files}}) -}
514         @ WRITE SYS$OUTPUT "Reconfiguring..."
515         perl $(SRCDIR)Configure reconf
516         @ WRITE SYS$OUTPUT "*************************************************"
517         @ WRITE SYS$OUTPUT "***                                           ***"
518         @ WRITE SYS$OUTPUT "***   Please run the same mms command again   ***"
519         @ WRITE SYS$OUTPUT "***                                           ***"
520         @ WRITE SYS$OUTPUT "*************************************************"
521         @ PIPE ( EXIT %X10000000 )
522
523 {-
524   use File::Basename;
525   use File::Spec::Functions qw/abs2rel rel2abs catfile catdir/;
526
527   sub generatesrc {
528       my %args = @_;
529       my $generator = join(" ", @{$args{generator}});
530       my $generator_incs = join("", map { ' "-I'.$_.'"' } @{$args{generator_incs}});
531       my $deps = join(", -\n\t\t", @{$args{generator_deps}}, @{$args{deps}});
532
533       if ($args{src} !~ /\.[sS]$/) {
534           if ($args{generator}->[0] =~ m|^.*\.in$|) {
535               my $dofile = abs2rel(rel2abs(catfile($config{sourcedir},
536                                                    "util", "dofile.pl")),
537                                    rel2abs($config{builddir}));
538               return <<"EOF";
539 $args{src} : $args{generator}->[0] $deps
540         \$(PERL) "-I\$(BLDDIR)" "-Mconfigdata" $dofile \\
541             "-o$target{build_file}" $generator > \$@
542 EOF
543           } else {
544               return <<"EOF";
545 $args{src} : $args{generator}->[0] $deps
546         \$(PERL)$generator_incs $generator > \$@
547 EOF
548           }
549       } else {
550           die "No method to generate assembler source present.\n";
551       }
552   }
553
554   sub src2obj {
555       my %args = @_;
556       my $obj = $args{obj};
557       my $deps = join(", -\n\t\t", @{$args{srcs}}, @{$args{deps}});
558
559       # Because VMS C isn't very good at combining a /INCLUDE path with
560       # #includes having a relative directory (like '#include "../foo.h"),
561       # the best choice is to move to the first source file's intended
562       # directory before compiling, and make sure to write the object file
563       # in the correct position (important when the object tree is other
564       # than the source tree).
565       my $forward = dirname($args{srcs}->[0]);
566       my $backward = abs2rel(rel2abs("."), rel2abs($forward));
567       my $objd = abs2rel(rel2abs(dirname($obj)), rel2abs($forward));
568       my $objn = basename($obj);
569       my $srcs =
570           join(", ",
571                map { abs2rel(rel2abs($_), rel2abs($forward)) } @{$args{srcs}});
572       my $ecflags = { lib => '$(LIB_CFLAGS)',
573                       dso => '$(DSO_CFLAGS)',
574                       bin => '$(BIN_CFLAGS)' } -> {$args{intent}};
575       my $incs_on = "\@ !";
576       my $incs_off = "\@ !";
577       my $incs = "";
578       my @incs = ();
579       push @incs, @{$args{incs}} if @{$args{incs}};
580       unless ($disabled{zlib}) {
581           # GNV$ZLIB_INCLUDE is the standard logical name for later zlib
582           # incarnations.
583           push @incs, ($withargs{zlib_include} || 'GNV$ZLIB_INCLUDE:');
584       }
585       if (@incs) {
586           $incs_on =
587               "DEFINE tmp_includes "
588               .join(",-\n\t\t\t", map {
589                                       file_name_is_absolute($_)
590                                       ? $_ : catdir($backward,$_)
591                                   } @incs);
592           $incs_off = "DEASSIGN tmp_includes";
593           $incs = " /INCLUDE=(tmp_includes:)";
594       }
595       my $before = $unified_info{before}->{$obj.".OBJ"} || "\@ !";
596       my $after = $unified_info{after}->{$obj.".OBJ"} || "\@ !";
597       my $depbuild = $disabled{makedepend} ? ""
598           : " /MMS=(FILE=${objd}${objn}.tmp-D,TARGET=$obj.OBJ)";
599
600       return <<"EOF";
601 $obj.OBJ : $deps
602         ${before}
603         SET DEFAULT $forward
604         $incs_on
605         \$(CC) \$(CFLAGS)${ecflags}${incs}${depbuild} /OBJECT=${objd}${objn}.OBJ /REPOSITORY=$backward $srcs
606         $incs_off
607         SET DEFAULT $backward
608         ${after}
609         \@ PIPE ( \$(PERL) -e "use File::Compare qw/compare_text/; my \$x = compare_text(""$obj.D"",""$obj.tmp-D""); exit(0x10000000 + (\$x == 0));" || -
610                  RENAME $obj.tmp-D $obj.d )
611         \@ IF F\$SEARCH("$obj.tmp-D") .NES. "" THEN DELETE $obj.tmp-D;*
612         - PURGE $obj.OBJ
613 EOF
614   }
615   sub libobj2shlib {
616       my %args = @_;
617       my $lib = $args{lib};
618       my $shlib = $args{shlib};
619       my $libd = dirname($lib);
620       my $libn = basename($lib);
621       (my $mkdef_key = $libn) =~ s/^${osslprefix_q}lib([^0-9]*)\d*/$1/i;
622       my @deps = map {
623           $disabled{shared} ? $_.".OLB"
624               : $unified_info{sharednames}->{$_}.".EXE"; } @{$args{deps}};
625       my $deps = join(", -\n\t\t", @deps);
626       my $shlib_target = $disabled{shared} ? "" : $target{shared_target};
627       my $ordinalsfile = defined($args{ordinals}) ? $args{ordinals}->[1] : "";
628       my $engine_opt = abs2rel(rel2abs(catfile($config{sourcedir},
629                                                "VMS", "engine.opt")),
630                                rel2abs($config{builddir}));
631       my $mkdef_pl = abs2rel(rel2abs(catfile($config{sourcedir},
632                                              "util", "mkdef.pl")),
633                              rel2abs($config{builddir}));
634       my $translatesyms_pl = abs2rel(rel2abs(catfile($config{sourcedir},
635                                                      "VMS", "translatesyms.pl")),
636                                      rel2abs($config{builddir}));
637       # The "[]" hack is because in .OPT files, each line inherits the
638       # previous line's file spec as default, so if no directory spec
639       # is present in the current line and the previous line has one that
640       # doesn't apply, you're in for a surprise.
641       my $write_opt =
642           join("\n\t", map { my $x = $_ =~ /\[/ ? $_ : "[]".$_;
643                              $x =~ s|(\.EXE)|$1/SHARE|;
644                              $x =~ s|(\.OLB)|$1/LIB|;
645                              "WRITE OPT_FILE \"$x\"" } @deps)
646           || "\@ !";
647       return <<"EOF";
648 $shlib.EXE : $lib.OLB $deps $ordinalsfile
649         \$(PERL) $mkdef_pl "$mkdef_key" "VMS" > $shlib.SYMVEC-tmp
650         \$(PERL) $translatesyms_pl \$(BLDDIR)CXX\$DEMANGLER_DB. < $shlib.SYMVEC-tmp > $shlib.SYMVEC
651         DELETE $shlib.SYMVEC-tmp;*
652         OPEN/WRITE/SHARE=READ OPT_FILE $shlib.OPT
653         WRITE OPT_FILE "IDENTIFICATION=""V$config{version}"""
654         TYPE $shlib.SYMVEC /OUTPUT=OPT_FILE:
655         WRITE OPT_FILE "$lib.OLB/LIBRARY"
656         $write_opt
657         CLOSE OPT_FILE
658         LINK /MAP=$shlib.MAP /FULL/SHARE=$shlib.EXE $shlib.OPT/OPT \$(EX_LIBS)
659         DELETE $shlib.SYMVEC;*
660         PURGE $shlib.EXE,$shlib.OPT,$shlib.MAP
661 EOF
662   }
663   sub obj2dso {
664       my %args = @_;
665       my $lib = $args{lib};
666       my $libd = dirname($lib);
667       my $libn = basename($lib);
668       (my $libn_nolib = $libn) =~ s/^lib//;
669       my @objs = map { "$_.OBJ" } @{$args{objs}};
670       my @deps = map {
671           $disabled{shared} ? $_.".OLB"
672               : $unified_info{sharednames}->{$_}.".EXE"; } @{$args{deps}};
673       my $deps = join(", -\n\t\t", @objs, @deps);
674       my $shlib_target = $disabled{shared} ? "" : $target{shared_target};
675       my $engine_opt = abs2rel(rel2abs(catfile($config{sourcedir},
676                                                "VMS", "engine.opt")),
677                                rel2abs($config{builddir}));
678       # The "[]" hack is because in .OPT files, each line inherits the
679       # previous line's file spec as default, so if no directory spec
680       # is present in the current line and the previous line has one that
681       # doesn't apply, you're in for a surprise.
682       my $write_opt1 =
683           join(",-\"\n\t", map { my $x = $_ =~ /\[/ ? $_ : "[]".$_;
684                                  "WRITE OPT_FILE \"$x" } @objs).
685           "\"";
686       my $write_opt2 =
687           join("\n\t", map { my $x = $_ =~ /\[/ ? $_ : "[]".$_;
688                              $x =~ s|(\.EXE)|$1/SHARE|;
689                              $x =~ s|(\.OLB)|$1/LIB|;
690                              "WRITE OPT_FILE \"$x\"" } @deps)
691           || "\@ !";
692       return <<"EOF";
693 $lib.EXE : $deps
694         OPEN/WRITE/SHARE=READ OPT_FILE $lib.OPT
695         TYPE $engine_opt /OUTPUT=OPT_FILE:
696         $write_opt1
697         $write_opt2
698         CLOSE OPT_FILE
699         LINK /MAP=$lib.MAP /FULL/SHARE=$lib.EXE $lib.OPT/OPT \$(EX_LIBS)
700         - PURGE $lib.EXE,$lib.OPT,$lib.MAP
701 EOF
702   }
703   sub obj2lib {
704       my %args = @_;
705       my $lib = $args{lib};
706       my $objs = join(", -\n\t\t", map { $_.".OBJ" } (@{$args{objs}}));
707       my $fill_lib = join("\n\t", (map { "LIBRARY/REPLACE $lib.OLB $_.OBJ" }
708                                     @{$args{objs}}));
709       return <<"EOF";
710 $lib.OLB : $objs
711         LIBRARY/CREATE/OBJECT $lib.OLB
712         $fill_lib
713         - PURGE $lib.OLB
714 EOF
715   }
716   sub obj2bin {
717       my %args = @_;
718       my $bin = $args{bin};
719       my $bind = dirname($bin);
720       my $binn = basename($bin);
721       my @objs = map { "$_.OBJ" } @{$args{objs}};
722       my @deps = map {
723           $disabled{shared} ? $_.".OLB"
724               : $unified_info{sharednames}->{$_}.".EXE"; } @{$args{deps}};
725       my $deps = join(", -\n\t\t", @objs, @deps);
726       # The "[]" hack is because in .OPT files, each line inherits the
727       # previous line's file spec as default, so if no directory spec
728       # is present in the current line and the previous line has one that
729       # doesn't apply, you're in for a surprise.
730       my $write_opt1 =
731           join(",-\"\n\t", map { my $x = $_ =~ /\[/ ? $_ : "[]".$_;
732                                  "WRITE OPT_FILE \"$x" } @objs).
733           "\"";
734       my $write_opt2 =
735           join("\n\t", map { my $x = $_ =~ /\[/ ? $_ : "[]".$_;
736                              $x =~ s|(\.EXE)|$1/SHARE|;
737                              $x =~ s|(\.OLB)|$1/LIB|;
738                              "WRITE OPT_FILE \"$x\"" } @deps)
739           || "\@ !";
740       return <<"EOF";
741 $bin.EXE : $deps
742         OPEN/WRITE/SHARE=READ OPT_FILE $bin.OPT
743         $write_opt1
744         $write_opt2
745         CLOSE OPT_FILE
746         LINK/EXEC=$bin.EXE \$(LDFLAGS) $bin.OPT/OPT \$(EX_LIBS)
747         - PURGE $bin.EXE,$bin.OPT
748 EOF
749   }
750   sub in2script {
751       my %args = @_;
752       my $script = $args{script};
753       return "" if grep { $_ eq $script } @{$args{sources}}; # No overwrite!
754       my $sources = join(" ", @{$args{sources}});
755       my $dofile = abs2rel(rel2abs(catfile($config{sourcedir},
756                                            "util", "dofile.pl")),
757                            rel2abs($config{builddir}));
758       return <<"EOF";
759 $script : $sources
760         \$(PERL) "-I\$(BLDDIR)" "-Mconfigdata" $dofile -
761             "-o$target{build_file}" $sources > $script
762         SET FILE/PROT=(S:RWED,O:RWED,G:RE,W:RE) $script
763         PURGE $script
764 EOF
765   }
766   ""    # Important!  This becomes part of the template result.
767 -}