build_vms.com 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248
  1. $! $Id$
  2. $! BUILD_VMS.COM
  3. $!
  4. $! I've taken the original build_vms.com, supplied by Nico Baggus, if
  5. $! memory serves me correctly, and made some modifications.
  6. $!
  7. $! SSL support is based on logicals, or lack thereof. If SSL$INCLUDE
  8. $! is defined, then it assumed that hp's SSL product has been installed.
  9. $! If OPENSSL is defined, but SSL$INCLUDE isn't, then the OpenSSL defined
  10. $! via the defines.com procedure will be used. If neither logical is
  11. $! defined, then SSL support will not be compiled/linked in.
  12. $!
  13. $! If CURL_BUILD_NOSSL is defined to anything, then no SSL support will
  14. $! be built in. This way you can build without SSL support on systems
  15. $! that have it without the "automatic" build/link "features".
  16. $!
  17. $! If CURL_BUILD_NOHPSSL is defined to anything, it will override the
  18. $! SSL$INCLUDE check. This way you can build against OpenSSL, even if
  19. $! you have hp SSL installed.
  20. $!
  21. $! Parameter(s):
  22. $!
  23. $! P1 - LISTING will create .lis files during the C compile
  24. $! DEBUG will compile and link with debug; also will create
  25. $! compiler listings and linker map files
  26. $! 64 will compile and link with 64-bit pointers
  27. $!
  28. $! Revisions:
  29. $!
  30. $! 2-DEC-2003, MSK, the "original" version.
  31. $! It works for me. Your mileage may vary.
  32. $! 13-JAN-2004, MSK, moved this procedure to the [.packages.vms] directory
  33. $! and updated it to do hardware dependant builds.
  34. $! 29-JAN-2004, MSK, moved logical defines into defines.com
  35. $! 6-FEB-2004, MSK, put in various SSL support bits
  36. $! 9-MAR-2004, MSK, the config-vms.h* files are now copied to the lib and
  37. $! src directories as config.h.
  38. $! 15-MAR-2004, MSK, All of the curlmsg*.* files have also been moved to
  39. $! this build directory. They will be copied to the src
  40. $! directory before build. The .msg file will be compiled
  41. $! to get the .obj for messages, but the .h and .sdl files
  42. $! are not automatically created since they partly rely on
  43. $! the freeware SDL tool.
  44. $! 8-FEB-2005, MSK, merged the two config-vms.h* files into one that uses
  45. $! USE_SSLEAY to define if the target has SSL support built
  46. $! in. Changed the cc/define parameter accordingly.
  47. $! 11-FEB-2005, MSK, If [--.LIB]AMIGAOS.C and NWLIB.C are there, rename them
  48. $! 23-MAR-2005, MSK, relocated cc_qual define so that DEBUG option would work
  49. $! 25-APR-2007, STL, allow compilation in 64-bit mode.
  50. $!
  51. $ on control_y then goto Common_Exit
  52. $ ctrl_y = 1556
  53. $ origdir = f$environment("DEFAULT")
  54. $ proc = f$environment("PROCEDURE")
  55. $ thisdir = f$parse( proc,,,"DEVICE") + f$parse( proc,,,"DIRECTORY")
  56. $!
  57. $! Verbose output message stuff. Define symbol to "write sys$output" or "!".
  58. $! vo_c - verbose output for compile
  59. $! vo_l - link
  60. $! vo_o - object check
  61. $!
  62. $ vo_c = "write sys$output"
  63. $ vo_l = "write sys$output"
  64. $ vo_o = "!"
  65. $!
  66. $ defines = thisdir + "defines.com"
  67. $ if f$trnlnm( "curl_defines_done") .eqs. ""
  68. $ then
  69. $ if f$search( defines) .eqs. ""
  70. $ then
  71. $ write sys$output "%CURL-F-DEFFNF, cannot find defines.com procedure"
  72. $ exit %X18290 ! FNF
  73. $ else
  74. $ @'defines'
  75. $ endif
  76. $ endif
  77. $ set def 'thisdir'
  78. $!
  79. $ hpssl = 0
  80. $ openssl = 0
  81. $ cc_qual = "/define=HAVE_CONFIG_H=1"
  82. $ link_qual = ""
  83. $ if f$trnlnm( "CURL_BUILD_NOSSL") .eqs. ""
  84. $ then
  85. $ if f$trnlnm( "OPENSSL") .nes. ""
  86. $ then
  87. $ openssl = 1
  88. $ cc_qual = "/define=(HAVE_CONFIG_H=1,USE_SSLEAY=1)"
  89. $ if ( f$trnlnm( "SSL$INCLUDE") .nes. "") .and. -
  90. ( f$trnlnm( "CURL_BUILD_NOHPSSL") .eqs. "")
  91. $ then hpssl = 1
  92. $ endif
  93. $ endif
  94. $ endif
  95. $ cc_qual = cc_qual + "/OBJ=OBJDIR:"
  96. $ if p1 .eqs. "64" then cc_qual = cc_qual + "/POINTER=64"
  97. $ if p1 .eqs. "LISTING" then cc_qual = cc_qual + "/LIST/SHOW=ALL"
  98. $ if p1 .eqs. "DEBUG"
  99. $ then
  100. $ cc_qual = cc_qual + "/LIST/SHOW=ALL/DEBUG/NOOPT"
  101. $ link_qual = "/DEBUG/MAP"
  102. $ endif
  103. $ msg_qual = "/OBJ=OBJDIR:"
  104. $!
  105. $! Put the right main config file in the two source directories for the build.
  106. $!
  107. $ if ( openssl .eq. 1) .or. ( hpssl .eq. 1)
  108. $ then
  109. $ 'vo_c' "%CURL-I-BLDSSL, building with SSL support"
  110. $ else
  111. $ 'vo_c' "%CURL-I-BLDNOSSL, building without SSL support"
  112. $ endif
  113. $ config_h = "CONFIG-VMS.H"
  114. $!
  115. $! Only do the copy if the source and destination files are different.
  116. $!
  117. $ call MoveIfDiff 'config_h' "[--.LIB]CONFIG.H"
  118. $ call MoveIfDiff 'config_h' "[--.SRC]CONFIG.H"
  119. $! call MoveIfDiff "SETUP.H" "[--.LIB]"
  120. $! call MoveIfDiff "SETUP.H" "[--.SRC]"
  121. $ call MoveIfDiff "CURLMSG.H" "[--.SRC]"
  122. $ call MoveIfDiff "CURLMSG.MSG" "[--.SRC]"
  123. $ call MoveIfDiff "CURLMSG.SDL" "[--.SRC]"
  124. $ call MoveIfDiff "CURLMSG_VMS.H" "[--.SRC]"
  125. $!
  126. $! The [--.LIB]amigaos.c and nwlib.c files aren't needed for the VMS build.
  127. $! If they are there, rename them so the brute force build works right.
  128. $!
  129. $ if f$search( "[--.lib]amigaos.c") .nes. ""
  130. $ then
  131. $ rename [--.lib]amigaos.c .c_not_used
  132. $ endif
  133. $ if f$search( "[--.lib]nwlib.c") .nes. ""
  134. $ then
  135. $ rename [--.lib]nwlib.c .c_not_used
  136. $ endif
  137. $ on control_y then goto Common_Exit
  138. $!
  139. $ call build "[--.lib]" "*.c" "objdir:curllib.olb"
  140. $ if ($status .eq. ctrl_y) then goto Common_Exit
  141. $ call build "[--.src]" "*.c" "objdir:curlsrc.olb"
  142. $ if ($status .eq. ctrl_y) then goto Common_Exit
  143. $ call build "[--.src]" "*.msg" "objdir:curlsrc.olb"
  144. $ if ($status .eq. ctrl_y) then goto Common_Exit
  145. $ if ( openssl .eq. 1) .and. ( hpssl .eq. 0)
  146. $ then
  147. $ 'vo_l' "%CURL-I-LINK_OSSL, linking with OpenSSL"
  148. $ link 'link_qual'/exe=exedir:curl.exe -
  149. objdir:curlsrc/lib/include=(main,curlmsg),-
  150. objdir:curllib/lib, libssl/lib, libcrypto/lib
  151. $ endif
  152. $ if ( openssl .eq. 1) .and. ( hpssl .eq. 1)
  153. $ then
  154. $ 'vo_l' "%CURL-I-LINK_HPSSL, linking with hp SSL option"
  155. $ optfile = "[]hpssl_" + f$getsyi("ARCH_NAME") + ".opt/opt"
  156. $ link 'link_qual'/exe=exedir:curl.exe -
  157. objdir:curlsrc/lib/include=(main,curlmsg),-
  158. objdir:curllib/lib, 'optfile'
  159. $ endif
  160. $ if ( openssl .eq. 0) .and. ( hpssl .eq. 0)
  161. $ then
  162. $ 'vo_l' "%CURL-I-LINK_NOSSL, linking without SSL support"
  163. $ link 'link_qual'/exe=exedir:curl.exe -
  164. objdir:curlsrc/lib/include=(main,curlmsg),-
  165. objdir:curllib/lib
  166. $ endif
  167. $!
  168. $ goto Common_Exit
  169. $!
  170. $! Subroutine to build everything with a filetype passed in via P2 in
  171. $! the directory passed in via P1 and put it in the object library named
  172. $! via P3
  173. $!
  174. $build: subroutine
  175. $ on control_y then goto EndLoop ! SS$_CONTROLY
  176. $! set noon
  177. $ set default 'p1'
  178. $ search = p2
  179. $ reset = f$search("reset")
  180. $ if f$search( p3) .eqs. ""
  181. $ then
  182. $ LIB/CREATE/OBJECT 'p3'
  183. $ endif
  184. $ reset = f$search("reset",1)
  185. $Loop:
  186. $ file = f$search(search,1)
  187. $ if file .eqs. "" then goto EndLoop
  188. $ objfile = f$parse("objdir:.OBJ;",file)
  189. $ obj = f$search( objfile, 2)
  190. $ if (obj .nes. "")
  191. $ then
  192. $ if (f$cvtime(f$file(file,"rdt")) .gts. f$cvtime(f$file(obj,"rdt")))
  193. $ then
  194. $ call compile 'file'
  195. $ if .not. $status then return $status
  196. $ lib/object 'p3' 'objfile'
  197. $ else
  198. $ 'vo_o' "%CURL-I-OBJUTD, ", objfile, " is up to date"
  199. $ endif
  200. $ else
  201. $ 'vo_o' "%CURL-I-OBJDNE, ", file, " does not exist"
  202. $ call compile 'file'
  203. $ if .not. $status then return $status
  204. $ lib/object 'p3' 'objfile'
  205. $ endif
  206. $ goto Loop
  207. $EndLoop:
  208. $ !purge
  209. $ set def 'origdir'
  210. $ endsubroutine ! Build
  211. $!
  212. $! Based on the file TYPE, do the right compile command.
  213. $! Only C and MSG supported.
  214. $!
  215. $compile: subroutine
  216. $ on control_y then return ctrl_y ! SS$_CONTROLY
  217. $! set noon
  218. $ file = p1
  219. $ qual = p2+p3+p4+p5+p6+p7+p8
  220. $ typ = f$parse(file,,,"TYPE") - "."
  221. $ cmd_c = "CC "+cc_qual
  222. $ cmd_msg = "MESSAGE "+msg_qual
  223. $ x = cmd_'typ'
  224. $ 'vo_c' x," ",file
  225. $ 'x' 'file'
  226. $ ENDSUBROUTINE ! Compile
  227. $!
  228. $! Do a diff of the file specified in P1 with that in P2. If different
  229. $! copy P1 to P2. This also covers if P2 doesn't exist, but not if P2
  230. $! is an invalid filespec.
  231. $!
  232. $MoveIfDiff: subroutine
  233. $ set NoOn
  234. $ set message/nof/noi/nos/not
  235. $ diff/out=nla0: 'p1' 'p2'
  236. $ status = $status
  237. $ set message/f/i/s/t
  238. $ if ( status .ne. %X006C8009) ! if status is not "no diff"
  239. $ then
  240. $ copy 'p1' 'p2'
  241. $ purge/nolog 'p2'
  242. $ endif
  243. $ on control_y then return ctrl_y ! SS$_CONTROLY
  244. $ ENDSUBROUTINE ! MoveIfDiff
  245. $!
  246. $Common_Exit:
  247. $ set default 'origdir'
  248. $ exit