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