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