]>
Commit | Line | Data |
---|---|---|
e84193e4 RL |
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 | # This is a horrible hack, but is needed because recursive inclusion of files | |
41 | # in different directories does not work well with HP C. | |
42 | my $sd = sourcedir("crypto", "async", "arch"); | |
43 | foreach (grep /\[\.crypto\.async\.arch\].*\.o$/, keys %{$unified_info{sources}}) { | |
44 | (my $x = $_) =~ s|\.o$|.OBJ|; | |
45 | $unified_info{before}->{$x} | |
46 | = qq(arch = F\$PARSE("$sd","A.;",,,"SYNTAX_ONLY") - "A.;" | |
47 | define arch 'arch'); | |
48 | $unified_info{after}->{$x} | |
49 | = qq(deassign arch); | |
50 | } | |
51 | my $sd1 = sourcedir("ssl","record"); | |
52 | my $sd2 = sourcedir("ssl","statem"); | |
0cea8832 | 53 | $unified_info{before}->{"[.test]heartbeat_test.OBJ"} |
e84193e4 RL |
54 | = $unified_info{before}->{"[.test]ssltest.OBJ"} |
55 | = qq(record = F\$PARSE("$sd1","A.;",,,"SYNTAX_ONLY") - "A.;" | |
56 | define record 'record' | |
57 | statem = F\$PARSE("$sd2","A.;",,,"SYNTAX_ONLY") - "A.;" | |
58 | define statem 'statem'); | |
0cea8832 | 59 | $unified_info{after}->{"[.test]heartbeat_test.OBJ"} |
e84193e4 RL |
60 | = $unified_info{after}->{"[.test]ssltest.OBJ"} |
61 | = qq(deassign statem | |
62 | deassign record); | |
63 | foreach (grep /^\[\.ssl\.(?:record|statem)\].*\.o$/, keys %{$unified_info{sources}}) { | |
64 | (my $x = $_) =~ s|\.o$|.OBJ|; | |
65 | $unified_info{before}->{$x} | |
66 | = qq(record = F\$PARSE("$sd1","A.;",,,"SYNTAX_ONLY") - "A.;" | |
67 | define record 'record' | |
68 | statem = F\$PARSE("$sd2","A.;",,,"SYNTAX_ONLY") - "A.;" | |
69 | define statem 'statem'); | |
70 | $unified_info{after}->{$x} | |
71 | = qq(deassign statem | |
72 | deassign record); | |
73 | } | |
74 | #use Data::Dumper; | |
75 | #print STDERR "DEBUG: before:\n", Dumper($unified_info{before}); | |
76 | #print STDERR "DEBUG: after:\n", Dumper($unified_info{after}); | |
77 | ""; | |
78 | -} | |
79 | PLATFORM={- $config{target} -} | |
80 | OPTIONS={- $config{options} -} | |
81 | CONFIGURE_ARGS=({- join(", ",quotify_l(@{$config{perlargv}})) -}) | |
82 | SRCDIR={- $config{sourcedir} -} | |
83 | BUILDDIR={- $config{builddir} -} | |
84 | ||
85 | VERSION={- $config{version} -} | |
86 | MAJOR={- $config{major} -} | |
87 | MINOR={- $config{minor} -} | |
88 | SHLIB_VERSION_NUMBER={- $config{shlib_version_number} -} | |
89 | SHLIB_VERSION_HISTORY={- $config{shlib_version_history} -} | |
90 | SHLIB_MAJOR={- $config{shlib_major} -} | |
91 | SHLIB_MINOR={- $config{shlib_minor} -} | |
92 | SHLIB_TARGET={- $target{shared_target} -} | |
93 | ||
94 | EXE_EXT=.EXE | |
95 | LIB_EXT=.OLB | |
96 | SHLIB_EXT=.EXE | |
97 | OBJ_EXT=.OBJ | |
98 | DEP_EXT=.MMS | |
99 | ||
100 | LIBS={- join(", ", map { "-\n\t".$_.".OLB" } @{$unified_info{libraries}}) -} | |
101 | SHLIBS={- join(" ", map { $_."\$(SHLIB_EXT)" } map { $unified_info{sharednames}->{$_} || () } @{$unified_info{libraries}}) -} | |
102 | ENGINES={- join(", ", map { "-\n\t".$_.".EXE" } @{$unified_info{engines}}) -} | |
103 | PROGRAMS={- join(", ", map { "-\n\t".$_.".EXE" } grep { !m|^\[\.test\]| } @{$unified_info{programs}}) -} | |
104 | TESTPROGS={- join(", ", map { "-\n\t".$_.".EXE" } grep { m|^\[\.test\]| } @{$unified_info{programs}}) -} | |
105 | SCRIPTS={- join(", ", map { "-\n\t".$_ } @{$unified_info{scripts}}) -} | |
c058fcd7 RL |
106 | DEPS={- our @deps = map { (my $x = $_) =~ s|\.o$|\$(DEP_EXT)|; $x; } |
107 | grep { $unified_info{sources}->{$_}->[0] =~ /\.c$/ } | |
108 | keys %{$unified_info{sources}}; | |
109 | join(", ", map { "-\n\t".$_ } @deps); -} | |
e84193e4 | 110 | |
3c65577f | 111 | # DESTDIR is for package builders so that they can configure for, say, |
e84193e4 RL |
112 | # SYS$COMMON:[OPENSSL] and yet have everything installed in STAGING:[USER]. |
113 | # In that case, configure with --prefix=SYS$COMMON:[OPENSSL] and then run | |
3c65577f RL |
114 | # MMS with /MACROS=(DESTDIR=STAGING:[USER]). The result will end up in |
115 | # STAGING:[USER.OPENSSL]. | |
e84193e4 | 116 | # Normally it is left empty. |
3c65577f | 117 | DESTDIR= |
e84193e4 RL |
118 | |
119 | # Do not edit this manually. Use Configure --prefix=DIR to change this! | |
120 | INSTALLTOP={- catdir($config{prefix}) || "SYS\$COMMON:[OPENSSL-\$(MAJOR).\$(MINOR)]" -} | |
121 | # This is the standard central area to store certificates, private keys... | |
122 | OPENSSLDIR={- catdir($config{openssldir}) || | |
123 | $config{prefix} ? catdir($config{prefix},"SSL") | |
124 | : "SYS\$COMMON:[SSL]" -} | |
125 | # Where installed engines reside | |
126 | ENGINESDIR={- $osslprefix -}ENGINES: | |
127 | ||
128 | CC= {- $target{cc} -} | |
129 | CFLAGS= /DEFINE=({- join(",", @{$config{defines}},"OPENSSLDIR=\"\"\"\$(OPENSSLDIR)\"\"\"","ENGINESDIR=\"\"\"\$(ENGINESDIR)\"\"\"") -}) {- $config{cflags} -} | |
130 | DEPFLAG= /DEFINE=({- join(",", @{$config{depdefines}}) -}) | |
131 | LDFLAGS= {- $config{lflags} -} | |
132 | EX_LIBS= {- $config{ex_libs} ? ",".$config{ex_libs} : "" -} | |
133 | ||
134 | PERL={- $config{perl} -} | |
135 | ||
136 | # We let the C compiler driver to take care of .s files. This is done in | |
137 | # order to be excused from maintaining a separate set of architecture | |
138 | # dependent assembler flags. E.g. if you throw -mcpu=ultrasparc at SPARC | |
139 | # gcc, then the driver will automatically translate it to -xarch=v8plus | |
140 | # and pass it down to assembler. | |
141 | AS={- $target{as} -} | |
142 | ASFLAG={- $target{asflags} -} | |
143 | ||
144 | # .FIRST and .LAST are special targets with MMS and MMK. | |
145 | # The defines in there are for C. includes that look like | |
146 | # this: | |
147 | # | |
148 | # #include <openssl/foo.h> | |
149 | # #include "internal/bar.h" | |
150 | # | |
151 | # will use the logical names to find the files. Expecting | |
152 | # DECompHP C to find files in subdirectories of whatever was | |
153 | # given with /INCLUDE is a fantasy, unfortunately. | |
154 | NODEBUG=@ | |
155 | .FIRST : | |
156 | $(NODEBUG) openssl_inc1 = F$PARSE("[.include.openssl]","A.;",,,"syntax_only") - "A.;" | |
15766632 | 157 | $(NODEBUG) openssl_inc2 = F$PARSE("{- catdir($config{sourcedir},"[.include.openssl]") -}","A.;",,,"SYNTAX_ONLY") - "A.;" |
e84193e4 RL |
158 | $(NODEBUG) internal_inc1 = F$PARSE("[.crypto.include.internal]","A.;",,,"SYNTAX_ONLY") - "A.;" |
159 | $(NODEBUG) internal_inc2 = F$PARSE("{- catdir($config{sourcedir},"[.include.internal]") -}","A.;",,,"SYNTAX_ONLY") - "A.;" | |
160 | $(NODEBUG) internal_inc3 = F$PARSE("{- catdir($config{sourcedir},"[.crypto.include.internal]") -}","A.;",,,"SYNTAX_ONLY") - "A.;" | |
161 | $(NODEBUG) DEFINE openssl 'openssl_inc1','openssl_inc2' | |
162 | $(NODEBUG) DEFINE internal 'internal_inc1','internal_inc2','internal_inc3' | |
3c65577f | 163 | $(NODEBUG) staging_dir = "$(DESTDIR)" |
e84193e4 RL |
164 | $(NODEBUG) IF staging_dir .NES. "" THEN - |
165 | staging_dir = F$PARSE("A.;",staging_dir,"[]",,"SYNTAX_ONLY") - "A.;" | |
166 | $(NODEBUG) ! | |
167 | $(NODEBUG) ! Installation logical names | |
168 | $(NODEBUG) ! | |
169 | $(NODEBUG) installtop_dev = F$PARSE(staging_dir,"$(INSTALLTOP)",,"DEVICE","SYNTAX_ONLY") | |
170 | $(NODEBUG) ! Because there are no routines to merge directories, we have to | |
171 | $(NODEBUG) ! do it ourselves | |
172 | $(NODEBUG) IF staging_dir .NES. "" THEN - | |
173 | staging_dir = F$PARSE(staging_dir,"[000000]",,"DIRECTORY","SYNTAX_ONLY") | |
174 | $(NODEBUG) installtop_dir = F$PARSE("$(INSTALLTOP)","[000000]",,"DIRECTORY","SYNTAX_ONLY") | |
175 | $(NODEBUG) IF staging_dir .NES. "" .AND. staging_dir .NES. "[000000]" THEN - | |
176 | installtop_dir = staging_dir - "]" + "." + (installtop_dir - "[") | |
177 | $(NODEBUG) installtop_dir = installtop_dir - "]" + ".]" | |
178 | $(NODEBUG) DEFINE ossl_installroot 'installtop_dev''installtop_dir' | |
179 | $(NODEBUG) ! | |
180 | $(NODEBUG) datatop = F$PARSE("$(OPENSSLDIR)","[000000]A.;",,,"SYNTAX_ONLY") - | |
181 | - "]A.;" + ".]" | |
3c65577f | 182 | $(NODEBUG) IF "$(DESTDIR)" .EQS. "" THEN - |
e84193e4 RL |
183 | DEFINE ossl_dataroot 'datatop' |
184 | $(NODEBUG) ! | |
185 | $(NODEBUG) ! Figure out the architecture | |
186 | $(NODEBUG) ! | |
187 | $(NODEBUG) arch == f$edit( f$getsyi( "arch_name"), "upcase") | |
188 | $(NODEBUG) ! | |
189 | $(NODEBUG) ! Set up logical names for the libraries, so LINK and | |
190 | $(NODEBUG) ! running programs can use them. | |
191 | $(NODEBUG) ! | |
192 | $(NODEBUG) {- join("\n\t\$(NODEBUG) ", map { "DEFINE ".uc($_)." 'F\$ENV(\"DEFAULT\")'".uc($_)."\$(SHLIB_EXT)" } map { $unified_info{sharednames}->{$_} || () } @{$unified_info{libraries}}) || "!" -} | |
193 | ||
194 | .LAST : | |
195 | $(NODEBUG) {- join("\n\t\$(NODEBUG) ", map { "DEASSIGN ".uc($_) } map { $unified_info{sharednames}->{$_} || () } @{$unified_info{libraries}}) || "!" -} | |
3c65577f | 196 | $(NODEBUG) IF "$(DESTDIR)" .EQS. "" THEN DEASSIGN ossl_dataroot |
e84193e4 RL |
197 | $(NODEBUG) DEASSIGN ossl_installroot |
198 | $(NODEBUG) DEASSIGN internal | |
199 | $(NODEBUG) DEASSIGN openssl | |
200 | .DEFAULT : | |
201 | @ ! MMS cannot handle no actions... | |
202 | ||
203 | # The main targets ################################################### | |
204 | ||
27f42b46 | 205 | all : configdata.pm, - |
c058fcd7 RL |
206 | build_libs_nodep, build_engines_nodep, build_apps_nodep, - |
207 | depend | |
208 | ||
27f42b46 | 209 | build_libs : configdata.pm, build_libs_nodep, depend |
c058fcd7 | 210 | build_libs_nodep : $(LIBS) |
27f42b46 | 211 | build_engines : configdata.pm, build_engines_nodep, depend |
c058fcd7 | 212 | build_engines_nodep : $(ENGINES) |
27f42b46 | 213 | build_apps : configdata.pm, build_apps_nodep, depend |
c058fcd7 | 214 | build_apps_nodep : $(PROGRAMS), $(SCRIPTS) |
27f42b46 | 215 | build_tests : configdata.pm, build_tests_nodep, depend |
c058fcd7 RL |
216 | build_tests_nodep : $(TESTPROGS) |
217 | ||
27f42b46 | 218 | test tests : configdata.pm, - |
c058fcd7 RL |
219 | build_apps_nodep, build_engines_nodep, build_tests_nodep, - |
220 | depend, rehash | |
e84193e4 RL |
221 | SET DEFAULT [.test]{- move("test") -} |
222 | DEFINE SRCTOP {- sourcedir() -} | |
223 | DEFINE BLDTOP {- builddir() -} | |
224 | $(PERL) {- sourcefile("test", "run_tests.pl") -} $(TESTS) | |
225 | DEASSIGN BLDTOP | |
226 | DEASSIGN SRCTOP | |
227 | SET DEFAULT [-]{- move("..") -} | |
228 | ||
229 | list-tests : | |
230 | @ TOP=$(SRCDIR) PERL=$(PERL) $(PERL) {- catfile($config{sourcedir},"test", "run_tests.pl") -} list | |
231 | ||
232 | # Because VMS wants the generation number (or *) to delete files, we can't | |
233 | # use $(LIBS), $(PROGRAMS) and $(TESTPROGS) directly. | |
234 | libclean : | |
235 | - DELETE []OSSL$LIB*.OLB;*,OSSL$LIB*.LIS;* | |
236 | - DELETE [.crypto...]*.OBJ;*,*.LIS;* | |
237 | - DELETE [.ssl...]*.OBJ;*,*.LIS;* | |
238 | - DELETE [.engines...]*.OBJ;*,*.LIS;* | |
239 | - DELETE []CXX$DEMANGLER_DB.;* | |
240 | ||
241 | install : install_sw install_docs | |
a8a421b1 RL |
242 | @ WRITE SYS$OUTPUT "" |
243 | @ WRITE SYS$OUTPUT "######################################################################" | |
244 | @ WRITE SYS$OUTPUT "" | |
245 | @ WRITE SYS$OUTPUT "Installation complete" | |
246 | @ WRITE SYS$OUTPUT "" | |
247 | @ IF "$(DESTDIR)" .NES. "" THEN EXIT 1 | |
248 | @ WRITE SYS$OUTPUT "Run @$(INSTALLTOP)openssl_startup to set up logical names" | |
249 | @ WRITE SYS$OUTPUT "then run @$(INSTALLTOP)openssl_setup to define commands" | |
250 | @ WRITE SYS$OUTPUT "" | |
e84193e4 RL |
251 | |
252 | uninstall : uninstall_docs uninstall_sw | |
253 | ||
254 | clean : libclean | |
255 | - DELETE []OSSL$LIB*.EXE;*,OSSL$LIB*.MAP;*,OSSL$LIB*.OPT;* | |
256 | - DELETE [.engines...]LIB*.EXE;*,LIB*.MAP;*,LIB*.OPT;* | |
257 | - DELETE [.apps]*.EXE;*,*.MAP;*,*.OPT;* | |
258 | - DELETE [.apps]*.OBJ;*,*.LIS;* | |
259 | - DELETE [.test]*.EXE;*,*.MAP;*,*.OPT;* | |
260 | - DELETE [.test]*.OBJ;*,*.LIS;* | |
261 | - DELETE [.test]*.LOG;* | |
262 | - DELETE []*.MAP;* | |
263 | ||
c058fcd7 RL |
264 | depend : descrip.mms |
265 | descrip.mms : FORCE | |
266 | @ $(PERL) -pe "if (/^# DO NOT DELETE.*/) { exit(0); }" - | |
267 | < descrip.mms > descrip.mms-new | |
268 | @ OPEN/APPEND DESCRIP descrip.mms-new | |
269 | @ WRITE DESCRIP "# DO NOT DELETE THIS LINE -- make depend depends on it." | |
5be5e56c | 270 | {- join("\n\t", map { "\@ IF F\$SEARCH(\"$_\") .NES. \"\" THEN TYPE $_ /OUTPUT=DESCRIP:" } @deps); -} |
c058fcd7 | 271 | @ CLOSE DESCRIP |
5be5e56c RL |
272 | @ PIPE ( $(PERL) -e "use File::Compare qw/compare_text/; my $x = compare_text(""descrip.mms"",""descrip.mms-new""); exit(0x10000000 + ($x == 0));" || - |
273 | RENAME descrip.mms-new descrip.mms ) | |
c058fcd7 RL |
274 | @ IF F$SEARCH("descrip.mms-new") .NES. "" THEN DELETE descrip.mms-new;* |
275 | -@ SPAWN/OUTPUT=NLA0: PURGE/NOLOG descrip.mms | |
e84193e4 RL |
276 | |
277 | # Install helper targets ############################################# | |
278 | ||
279 | install_sw : all install_dev install_engines install_runtime install_config | |
e84193e4 RL |
280 | |
281 | uninstall_sw : uninstall_dev uninstall_engines uninstall_runtime uninstall_config | |
282 | ||
283 | install_docs : install_man_docs install_html_docs | |
284 | ||
285 | uninstall_docs : uninstall_man_docs uninstall_html_docs | |
286 | ||
287 | install_dev : check_INSTALLTOP | |
288 | @ WRITE SYS$OUTPUT "*** Installing development files" | |
289 | @ ! Install header files | |
290 | CREATE/DIR ossl_installroot:[include.openssl] | |
291 | COPY/PROT=W:R openssl:*.h ossl_installroot:[include.openssl] | |
292 | @ ! Install libraries | |
a8a421b1 | 293 | CREATE/DIR ossl_installroot:[LIB.'arch'] |
e84193e4 | 294 | {- join("\n ", |
a8a421b1 | 295 | map { "COPY/PROT=W:R $_.OLB ossl_installroot:[LIB.'arch']" } |
e84193e4 | 296 | @{$unified_info{libraries}}) -} |
84af1bae | 297 | @ {- output_off() if $disabled{shared}; "" -} ! |
e84193e4 | 298 | {- join("\n ", |
a8a421b1 | 299 | map { "COPY/PROT=W:RE $_.EXE ossl_installroot:[LIB.'arch']" } |
ecd44a3c | 300 | map { $unified_info{sharednames}->{$_} || () } |
e84193e4 | 301 | @{$unified_info{libraries}}) -} |
84af1bae | 302 | @ {- output_on() if $disabled{shared}; "" -} ! |
e84193e4 RL |
303 | |
304 | install_runtime : check_INSTALLTOP | |
305 | @ WRITE SYS$OUTPUT "*** Installing runtime files" | |
306 | @ ! Install the main program | |
a8a421b1 RL |
307 | CREATE/DIR ossl_installroot:[EXE.'arch'] |
308 | COPY/PROT=W:RE [.APPS]openssl.EXE ossl_installroot:[EXE.'arch'] | |
e84193e4 RL |
309 | @ ! Install scripts |
310 | CREATE/DIR ossl_installroot:[EXE] | |
311 | COPY/PROT=W:RE [.APPS]CA.pl ossl_installroot:[EXE] | |
312 | COPY/PROT=W:RE [.TOOLS]c_rehash. ossl_installroot:[EXE]c_rehash.pl | |
313 | @ ! Install configuration file | |
314 | COPY/PROT=W:RE {- sourcefile("apps", "openssl-vms.cnf") -} - | |
315 | ossl_installroot:[000000]openssl.cnf | |
316 | ||
317 | install_engines : check_INSTALLTOP | |
f27f64e1 | 318 | @ {- output_off() unless scalar @{$unified_info{engines}}; "" -} ! |
e84193e4 | 319 | @ WRITE SYS$OUTPUT "*** Installing engines" |
a8a421b1 | 320 | CREATE/DIR ossl_installroot:[ENGINES.'arch'] |
f27f64e1 RL |
321 | {- join("\n ", |
322 | map { "COPY/PROT=W:RE $_.EXE ossl_installroot:[ENGINES.'arch']" } | |
323 | grep(!m|ossltest$|i, @{$unified_info{engines}})) -} | |
324 | @ {- output_on() unless scalar @{$unified_info{engines}}; "" -} ! | |
e84193e4 RL |
325 | |
326 | install_config : [.VMS]openssl_startup.com [.VMS]openssl_shutdown.com - | |
327 | check_INSTALLTOP | |
3c65577f | 328 | IF "$(DESTDIR)" .EQS. "" THEN - |
e84193e4 RL |
329 | IF F$SEARCH("OSSL_DATAROOT:[000000]CERTS.DIR;1") .EQS. "" THEN - |
330 | CREATE/DIR/PROT=(S:RWED,O:RWE,G:RE,W:RE) OSSL_DATAROOT:[CERTS] | |
3c65577f | 331 | IF "$(DESTDIR)" .EQS. "" THEN - |
e84193e4 RL |
332 | IF F$SEARCH("OSSL_DATAROOT:[000000]PRIVATE.DIR;1") .EQS. "" THEN - |
333 | CREATE/DIR/PROT=(S:RWED,O:RWE,G:,W:) OSSL_DATAROOT:[PRIVATE] | |
334 | CREATE/DIR ossl_installroot:[SYS$STARTUP] | |
335 | COPY/PROT=W:RE - | |
336 | [.VMS]openssl_startup.com,openssl_shutdown.com - | |
337 | ossl_installroot:[SYS$STARTUP] | |
338 | COPY/PROT=W:RE - | |
339 | {- sourcefile("VMS", "openssl_utils.com") -} - | |
340 | ossl_installroot:[SYS$STARTUP] | |
341 | ||
342 | [.VMS]openssl_startup.com : vmsconfig.pm | |
343 | CREATE/DIR [.VMS] | |
344 | $(PERL) "-I." "-Mvmsconfig" {- sourcefile("util", "dofile.pl") -} - | |
345 | {- sourcefile("VMS", "openssl_startup.com.in") -} - | |
346 | > [.VMS]openssl_startup.com | |
347 | ||
348 | [.VMS]openssl_shutdown.com : vmsconfig.pm | |
349 | CREATE/DIR [.VMS] | |
350 | $(PERL) "-I." "-Mvmsconfig" {- sourcefile("util", "dofile.pl") -} - | |
351 | {- sourcefile("VMS", "openssl_shutdown.com.in") -} - | |
352 | > [.VMS]openssl_shutdown.com | |
353 | ||
27f42b46 | 354 | vmsconfig.pm : configdata.pm |
e84193e4 RL |
355 | OPEN/WRITE/SHARE=READ CONFIG []vmsconfig.pm |
356 | WRITE CONFIG "package vmsconfig;" | |
357 | WRITE CONFIG "use strict; use warnings;" | |
358 | WRITE CONFIG "use Exporter;" | |
359 | WRITE CONFIG "our @ISA = qw(Exporter);" | |
0f2d3e4e | 360 | WRITE CONFIG "our @EXPORT = qw(%config %target %withargs %unified_info %disabled);" |
e84193e4 RL |
361 | WRITE CONFIG "our %config = (" |
362 | WRITE CONFIG " target => '{- $config{target} -}'," | |
363 | WRITE CONFIG " version => '$(MAJOR).$(MINOR)'," | |
84af1bae | 364 | WRITE CONFIG " no_shared => '","{- $disabled{shared} -}","'," |
e84193e4 RL |
365 | WRITE CONFIG " INSTALLTOP => '$(INSTALLTOP)'," |
366 | WRITE CONFIG " OPENSSLDIR => '$(OPENSSLDIR)'," | |
367 | WRITE CONFIG " pointersize => '","{- $target{pointersize} -}","'," | |
368 | WRITE CONFIG " shared_libs => [" | |
369 | {- join("\n ", map { "WRITE CONFIG \" '$_'," } map { $unified_info{sharednames}->{$_} || () } @{$unified_info{libraries}}) || "\@ !" -} | |
370 | WRITE CONFIG " ]," | |
371 | WRITE CONFIG ");" | |
372 | WRITE CONFIG "our %target = ();" | |
0f2d3e4e | 373 | WRITE CONFIG "our %disabled = ();" |
e84193e4 RL |
374 | WRITE CONFIG "our %withargs = ();" |
375 | WRITE CONFIG "our %unified_info = ();" | |
376 | WRITE CONFIG "1;" | |
377 | CLOSE CONFIG | |
378 | ||
379 | check_INSTALLTOP : | |
380 | @ IF "$(INSTALLTOP)" .EQS. "" THEN - | |
381 | WRITE SYS$ERROR "INSTALLTOP should not be empty" | |
382 | @ IF "$(INSTALLTOP)" .EQS. "" THEN - | |
383 | EXIT %x10000002 | |
384 | ||
385 | # Helper targets ##################################################### | |
386 | ||
c058fcd7 | 387 | rehash : copy-certs, build_apps_nodep |
e84193e4 RL |
388 | !MCR [.apps]openssl.exe rehash {- builddir("certs", "demo") -} |
389 | $(PERL) [.tools]c_rehash. [.certs.demo] | |
390 | ||
391 | copy-certs : | |
392 | @ IF F$SEARCH("{- buildfile("certs.dir") -}") .EQS. "" THEN - | |
393 | CREATE/DIR {- builddir("certs") -} | |
394 | -@ IF "{- sourcedir("certs") -}" .NES. "{- builddir("certs") -}" THEN - | |
395 | COPY {- tree(sourcedir("certs")) -}*.* {- tree(builddir("certs")) -} | |
396 | ||
397 | # Developer targets ################################################## | |
398 | ||
399 | debug_logicals : | |
400 | SH LOGICAL/PROC openssl,internal,ossl_installroot | |
3c65577f | 401 | IF "$(DESTDIR)" .EQS. "" THEN - |
e84193e4 RL |
402 | SH LOGICAL/PROC ossl_dataroot |
403 | ||
404 | # Building targets ################################################### | |
405 | ||
27f42b46 | 406 | configdata.pm : {- sourcefile("Configurations", "descrip.mms.tmpl") -} $(SRCDIR)Configure ! $(SRCDIR)config.com |
c058fcd7 | 407 | @ WRITE SYS$OUTPUT "Detected changed: $?" |
e84193e4 RL |
408 | @ WRITE SYS$OUTPUT "Reconfiguring..." |
409 | perl $(SRCDIR)Configure reconf | |
410 | @ WRITE SYS$OUTPUT "*************************************************" | |
411 | @ WRITE SYS$OUTPUT "*** ***" | |
412 | @ WRITE SYS$OUTPUT "*** Please run the same mms command again ***" | |
413 | @ WRITE SYS$OUTPUT "*** ***" | |
414 | @ WRITE SYS$OUTPUT "*************************************************" | |
27f42b46 | 415 | @ PIPE ( EXIT %X10000000 ) |
e84193e4 RL |
416 | |
417 | {- | |
418 | use File::Basename; | |
419 | use File::Spec::Functions qw/abs2rel rel2abs catfile catdir/; | |
e84193e4 RL |
420 | sub src2obj { |
421 | my %args = @_; | |
422 | my $obj = $args{obj}; | |
423 | my $deps = join(", -\n\t\t", @{$args{srcs}}, @{$args{deps}}); | |
424 | ||
425 | # Because VMS C isn't very good at combining a /INCLUDE path with | |
426 | # #includes having a relative directory (like '#include "../foo.h"), | |
427 | # the best choice is to move to the first source file's intended | |
428 | # directory before compiling, and make sure to write the object file | |
429 | # in the correct position (important when the object tree is other | |
430 | # than the source tree). | |
431 | my $forward = dirname($args{srcs}->[0]); | |
432 | my $backward = abs2rel(rel2abs("."), rel2abs($forward)); | |
433 | my $objd = abs2rel(rel2abs(dirname($obj)), rel2abs($forward)); | |
434 | my $objn = basename($obj); | |
435 | my $srcs = | |
436 | join(", ", | |
437 | map { abs2rel(rel2abs($_), rel2abs($forward)) } @{$args{srcs}}); | |
438 | my $incs = | |
439 | "/INCLUDE=(".join(",", | |
440 | map { | |
441 | file_name_is_absolute($_) | |
442 | ? $_ : catdir($backward,$_) | |
443 | } @{$args{incs}}).")"; | |
444 | my $before = $unified_info{before}->{$obj.".OBJ"} || "\@ !"; | |
445 | my $after = $unified_info{after}->{$obj.".OBJ"} || "\@ !"; | |
446 | ||
447 | return <<"EOF"; | |
88297284 | 448 | $obj.MMS : $deps |
70ef9057 RL |
449 | ${before} |
450 | SET DEFAULT $forward | |
88297284 | 451 | \$(CC) \$(CFLAGS)${incs} /MMS=(FILE=${objd}${objn}.MMS,TARGET=$obj.OBJ) /NOOBJECT $srcs |
70ef9057 RL |
452 | SET DEFAULT $backward |
453 | ${after} | |
454 | - PURGE $obj.MMS | |
88297284 | 455 | $obj.OBJ : $obj.MMS |
e84193e4 RL |
456 | ${before} |
457 | SET DEFAULT $forward | |
458 | \$(CC) \$(CFLAGS)${incs} /OBJECT=${objd}${objn}.OBJ /REPOSITORY=$backward $srcs | |
459 | SET DEFAULT $backward | |
460 | ${after} | |
461 | - PURGE $obj.OBJ | |
462 | EOF | |
463 | } | |
464 | sub libobj2shlib { | |
465 | my %args = @_; | |
466 | my $lib = $args{lib}; | |
467 | my $shlib = $args{shlib}; | |
468 | my $libd = dirname($lib); | |
469 | my $libn = basename($lib); | |
470 | (my $mkdef_key = $libn) =~ s/^${osslprefix_q}lib//i; | |
471 | my @deps = map { | |
84af1bae | 472 | $disabled{shared} ? $_.".OLB" |
e84193e4 RL |
473 | : $unified_info{sharednames}->{$_}.".EXE"; } @{$args{deps}}; |
474 | my $deps = join(", -\n\t\t", @deps); | |
84af1bae | 475 | my $shlib_target = $disabled{shared} ? "" : $target{shared_target}; |
e84193e4 RL |
476 | my $ordinalsfile = defined($args{ordinals}) ? $args{ordinals}->[1] : ""; |
477 | my $engine_opt = abs2rel(rel2abs(catfile($config{sourcedir}, | |
478 | "VMS", "engine.opt")), | |
479 | rel2abs($config{builddir})); | |
480 | my $mkdef_pl = abs2rel(rel2abs(catfile($config{sourcedir}, | |
481 | "util", "mkdef.pl")), | |
482 | rel2abs($config{builddir})); | |
483 | my $translatesyms_pl = abs2rel(rel2abs(catfile($config{sourcedir}, | |
484 | "VMS", "translatesyms.pl")), | |
485 | rel2abs($config{builddir})); | |
486 | # The "[]" hack is because in .OPT files, each line inherits the | |
487 | # previous line's file spec as default, so if no directory spec | |
488 | # is present in the current line and the previous line has one that | |
489 | # doesn't apply, you're in for a surprise. | |
490 | my $write_opt = | |
491 | join("\n\t", map { my $x = $_ =~ /\[/ ? $_ : "[]".$_; | |
492 | $x =~ s|(\.EXE)|$1/SHARE|; | |
ef3c88cf | 493 | $x =~ s|(\.OLB)|$1/LIB|; |
e84193e4 RL |
494 | "WRITE OPT_FILE \"$x\"" } @deps) |
495 | || "\@ !"; | |
496 | return <<"EOF"; | |
497 | $shlib.EXE : $lib.OLB $deps $ordinalsfile | |
498 | IF "$mkdef_key" .EQS. "ssl" .OR. "$mkdef_key" .EQS. "crypto" THEN - | |
499 | \$(PERL) $mkdef_pl "$mkdef_key" "VMS" > $shlib.SYMVEC-tmp | |
500 | IF "$mkdef_key" .EQS. "ssl" .OR. "$mkdef_key" .EQS. "crypto" THEN - | |
501 | \$(PERL) $translatesyms_pl \$(BUILDDIR)CXX\$DEMANGLER_DB. < $shlib.SYMVEC-tmp > $shlib.SYMVEC | |
502 | OPEN/WRITE/SHARE=READ OPT_FILE $shlib.OPT | |
503 | WRITE OPT_FILE "IDENTIFICATION=""V$config{version}""" | |
504 | IF "$mkdef_key" .NES. "ssl" .AND. "$mkdef_key" .NES. "crypto" THEN - | |
505 | TYPE $engine_opt /OUTPUT=OPT_FILE: | |
506 | IF "$mkdef_key" .EQS. "ssl" .OR. "$mkdef_key" .EQS. "crypto" THEN - | |
507 | TYPE $shlib.SYMVEC /OUTPUT=OPT_FILE: | |
508 | WRITE OPT_FILE "$lib.OLB/LIBRARY" | |
509 | $write_opt ! Comment to protect from empty line | |
510 | CLOSE OPT_FILE | |
511 | LINK /MAP=$shlib.MAP /FULL/SHARE=$shlib.EXE $shlib.OPT/OPT \$(EX_LIBS) | |
512 | - DELETE $shlib.SYMVEC;* | |
513 | - PURGE $shlib.EXE,$shlib.OPT,$shlib.MAP | |
514 | EOF | |
515 | } | |
5386287c | 516 | sub obj2dso { |
e84193e4 RL |
517 | my %args = @_; |
518 | my $lib = $args{lib}; | |
519 | my $libd = dirname($lib); | |
520 | my $libn = basename($lib); | |
521 | (my $libn_nolib = $libn) =~ s/^lib//; | |
522 | my @objs = map { "$_.OBJ" } @{$args{objs}}; | |
523 | my @deps = map { | |
84af1bae | 524 | $disabled{shared} ? $_.".OLB" |
e84193e4 RL |
525 | : $unified_info{sharednames}->{$_}.".EXE"; } @{$args{deps}}; |
526 | my $deps = join(", -\n\t\t", @objs, @deps); | |
84af1bae | 527 | my $shlib_target = $disabled{shared} ? "" : $target{shared_target}; |
e84193e4 RL |
528 | my $engine_opt = abs2rel(rel2abs(catfile($config{sourcedir}, |
529 | "VMS", "engine.opt")), | |
530 | rel2abs($config{builddir})); | |
531 | # The "[]" hack is because in .OPT files, each line inherits the | |
532 | # previous line's file spec as default, so if no directory spec | |
533 | # is present in the current line and the previous line has one that | |
534 | # doesn't apply, you're in for a surprise. | |
535 | my $write_opt = | |
536 | join(",-\"\n\t", map { my $x = $_ =~ /\[/ ? $_ : "[]".$_; | |
537 | "WRITE OPT_FILE \"$x" } @objs). | |
538 | "\"\n\t". | |
539 | join("\n\t", map { my $x = $_ =~ /\[/ ? $_ : "[]".$_; | |
540 | $x =~ s|(\.EXE)|$1/SHARE|; | |
ef3c88cf | 541 | $x =~ s|(\.OLB)|$1/LIB|; |
e84193e4 RL |
542 | "WRITE OPT_FILE \"$x\"" } @deps) |
543 | || "\@ !"; | |
544 | return <<"EOF"; | |
545 | $lib.EXE : $deps | |
546 | OPEN/WRITE/SHARE=READ OPT_FILE $lib.OPT | |
547 | TYPE $engine_opt /OUTPUT=OPT_FILE: | |
548 | $write_opt | |
549 | CLOSE OPT_FILE | |
550 | LINK /MAP=$lib.MAP /FULL/SHARE=$lib.EXE $lib.OPT/OPT \$(EX_LIBS) | |
551 | - PURGE $lib.EXE,$lib.OPT,$lib.MAP | |
552 | EOF | |
553 | } | |
554 | sub obj2lib { | |
555 | my %args = @_; | |
556 | my $lib = $args{lib}; | |
557 | my $objs = join(", -\n\t\t", map { $_.".OBJ" } (@{$args{objs}})); | |
558 | my $fill_lib = join("\n\t", (map { "LIBRARY/REPLACE $lib.OLB $_.OBJ" } | |
559 | @{$args{objs}})); | |
560 | return <<"EOF"; | |
561 | $lib.OLB : $objs | |
562 | LIBRARY/CREATE/OBJECT $lib | |
563 | $fill_lib | |
564 | - PURGE $lib.OLB | |
565 | EOF | |
566 | } | |
567 | sub obj2bin { | |
568 | my %args = @_; | |
569 | my $bin = $args{bin}; | |
570 | my $bind = dirname($bin); | |
571 | my $binn = basename($bin); | |
572 | my @objs = map { "$_.OBJ" } @{$args{objs}}; | |
573 | my @deps = map { | |
84af1bae | 574 | $disabled{shared} ? $_.".OLB" |
e84193e4 RL |
575 | : $unified_info{sharednames}->{$_}.".EXE"; } @{$args{deps}}; |
576 | my $deps = join(", -\n\t\t", @objs, @deps); | |
577 | # The "[]" hack is because in .OPT files, each line inherits the | |
578 | # previous line's file spec as default, so if no directory spec | |
579 | # is present in the current line and the previous line has one that | |
580 | # doesn't apply, you're in for a surprise. | |
581 | my $write_opt = | |
582 | join(",-\"\n\t", map { my $x = $_ =~ /\[/ ? $_ : "[]".$_; | |
583 | "WRITE OPT_FILE \"$x" } @objs). | |
584 | "\"\n\t". | |
585 | join("\n\t", map { my $x = $_ =~ /\[/ ? $_ : "[]".$_; | |
586 | $x =~ s|(\.EXE)|$1/SHARE|; | |
587 | $x =~ s|(\.OLB)|$1/LIB|; | |
588 | "WRITE OPT_FILE \"$x\"" } @deps) | |
589 | || "\@ !"; | |
590 | return <<"EOF"; | |
591 | $bin.EXE : $deps | |
592 | OPEN/WRITE/SHARE=READ OPT_FILE $bin.OPT | |
593 | $write_opt | |
594 | CLOSE OPT_FILE | |
595 | LINK/EXEC=$bin.EXE \$(LDFLAGS) $bin.OPT/OPT \$(EX_LIBS) | |
596 | - PURGE $bin.EXE,$bin.OPT | |
597 | EOF | |
598 | } | |
599 | sub in2script { | |
600 | my %args = @_; | |
601 | my $script = $args{script}; | |
602 | return "" if grep { $_ eq $script } @{$args{sources}}; # No overwrite! | |
603 | my $sources = join(" ", @{$args{sources}}); | |
604 | my $dofile = abs2rel(rel2abs(catfile($config{sourcedir}, | |
605 | "util", "dofile.pl")), | |
606 | rel2abs($config{builddir})); | |
607 | return <<"EOF"; | |
608 | $script : $sources | |
4b799cea | 609 | \$(PERL) "-I\$(BUILDDIR)" "-Mconfigdata" $dofile - |
ba327ade | 610 | "-o$target{build_file}" $sources > $script |
e84193e4 RL |
611 | SET FILE/PROT=(S:RWED,O:RWED,G:RE,W:RE) $script |
612 | PURGE $script | |
613 | EOF | |
614 | } | |
615 | "" # Important! This becomes part of the template result. | |
616 | -} |