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