descrip.mms.tmpl 35 KB

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