3 $! I've taken the original build_vms.com, supplied by Nico Baggus, if
4 $! memory serves me correctly, and made some modifications.
6 $! SSL support is controlled by logical names. If SSL$INCLUDE is
7 $! defined, then it is assumed that HP's SSL product has been installed.
8 $! If OPENSSL is defined, but SSL$INCLUDE is not, then OpenSSL will be
9 $! used. If neither logical name is defined, then SSL support will not
10 $! be compiled/linked in. Command-line options NOHPSSL and NOSSL can be
11 $! specified to override the automatic SSL selection.
13 $! Command-line Options:
15 $! CLEAN Delete product files for this host architecture. (No
17 $! CLEAN_ALL Delete product files for all host architectures. (No
20 $! 64 Compile with 64-bit pointers.
21 $! CCQUAL=x Add "x" to the C compiler qualifiers.
22 $! DEBUG Compile and link with debug.
23 $! IEEE Use IEEE floating point. (Alpha.)
24 $! LARGE Enable large-file support. (Non-VAX, VMS >= V7.2.)
25 $! LDAP Enable LDAP support.
26 $! LIST Create C compiler listings and linker maps.
27 $! NOHPSSL Don't use HP SSL, even if available.
28 $! NOSSL Don't use any SSL, even if available.
29 $! OSSLOLB Use OpenSSL object libraries (.OLB), even if shared
30 $! images (.EXE) are available.
34 $! CURL_CCDEFS="c_macro_1=value1 [, c_macro_2=value2 [...]]"
35 $! Compile with these additional C macros defined.
39 $! 2-DEC-2003, MSK, the "original" version.
40 $! It works for me. Your mileage may vary.
41 $! 13-JAN-2004, MSK, moved this procedure to the [.packages.vms] directory
42 $! and updated it to do hardware dependent builds.
43 $! 29-JAN-2004, MSK, moved logical defines into defines.com
44 $! 6-FEB-2004, MSK, put in various SSL support bits
45 $! 9-MAR-2004, MSK, the config-vms.h* files are now copied to the lib and
46 $! src directories as curl_config.h.
47 $! 15-MAR-2004, MSK, All of the curlmsg*.* files have also been moved to
48 $! this build directory. They will be copied to the src
49 $! directory before build. The .msg file will be compiled
50 $! to get the .obj for messages, but the .h and .sdl files
51 $! are not automatically created since they partly rely on
52 $! the freeware SDL tool.
53 $! 8-FEB-2005, MSK, merged the two config-vms.h* files into one that uses
54 $! USE_SSLEAY to define if the target has SSL support built
55 $! in. Changed the cc/define parameter accordingly.
56 $! 11-FEB-2005, MSK, If [--.LIB]AMIGAOS.C and NWLIB.C are there, rename them
57 $! 23-MAR-2005, MSK, relocated cc_qual define so that DEBUG option would work
58 $! 25-APR-2007, STL, allow compilation in 64-bit mode.
59 $! 13-DEC-2009. SMS, Changed to skip unwanted source files without
60 $! renaming the original files.
61 $! Eliminated needless, persistent logical names.
62 $! Added CURL_CCDEFS DCL symbol for user-specified C
64 $! Added CLEAN and CLEAN_ALL options.
65 $! Added CCQUAL option for user-specified C compiler
67 $! Added IEEE option for IEEE floating point (Alpha).
68 $! Added LARGE option for large-file support.
69 $! Added OSSLOLB option, and support for OpenSSL
71 $! Changed to put listing and map files into lisdir:.
72 $! Changed to avoid case confusion on ODS5 disks.
73 $! Added more default dev:[dir] save+restore.
74 $! Moved remaining "defines.com" code (back) into
75 $! here, eliminating the hard-coded OpenSSL nonsense.
76 $! Changed to use F$GETSYI( "ARCH_NAME") (or
77 $! equivalent) to name architecture-specific product
78 $! file destination directory, and to create the
79 $! directory if needed (obviating inclusion of these
80 $! directories and dummy files in the distribution
82 $! Changed the "compile" subroutine to break the CC
83 $! command across multiple lines to avoid DCL
84 $! line-too-long problems.
85 $! Changed "vo_c" messages to show the CC qualifiers
86 $! once, not with every compile command.
89 $! Save the original default dev:[dir], and arrange for its restoration
93 $ orig_def = f$environment( "DEFAULT")
94 $ on error then goto Common_Exit
95 $ on control_y then goto Common_Exit
98 $ proc = f$environment( "PROCEDURE")
100 f$parse( proc, , , "DEVICE")+ f$parse( proc, , , "DIRECTORY")
102 $! Verbose output message stuff. Define symbol to "write sys$output" or "!".
103 $! vo_c - verbose output for compile
105 $! vo_o - object check
107 $ vo_c = "write sys$output"
108 $ vo_l = "write sys$output"
111 $! Determine the main distribution directory ("[--]") in an
112 $! ODS5-tolerant (case-insensitive) way. (We do assume that the only
113 $! "]" is the one at the end.)
115 $ set default 'proc_dev_dir'
117 $ top_dev_dir = f$environment( "DEFAULT")- "]"
119 $! Define the architecture-specific product file destination directory
122 $ if (f$getsyi( "HW_MODEL") .lt. 1024)
127 $ arch_name = arch_name+ f$edit( f$getsyi( "ARCH_NAME"), "UPCASE")
128 $ if (arch_name .eqs. "") then arch_name = "UNK"
131 $ exedir = proc_dev_dir- "]"+ ".''arch_name']"
135 $! Interpret command-line options.
146 $ cc_defs = "HAVE_CONFIG_H=1"
147 $ if (f$type( CURL_CCDEFS) .nes. "")
149 $ CURL_CCDEFS = f$edit( CURL_CCDEFS, "TRIM")
150 $ cc_defs = cc_defs+ ", "+ CURL_CCDEFS
153 $ msg_qual = "/object = ''objdir'"
160 $ if (arg_val .eqs. "") then goto arg_loop_out
161 $ arg_val = f$edit( arg_val, "upcase")
163 $ if (arg_val .eqs. "CLEAN")
165 $ prods = "''exedir'*.*;*"
166 $ if (f$search( prods) .nes. "") then delete /log 'prods'
167 $ prods = proc_dev_dir+ arch_name+ ".DIR;1"
168 $ if (f$search( prods) .nes. "") then delete /log 'prods'
172 $ if (arg_val .eqs. "CLEAN_ALL")
174 $ prods = proc_dev_dir- "]"+ ".ALPHA]*.*;*"
175 $ if (f$search( prods) .nes. "") then delete /log 'prods'
176 $ prods = proc_dev_dir+ "ALPHA"+ ".DIR;1"
177 $ if (f$search( prods) .nes. "") then delete /log 'prods'
178 $ prods = proc_dev_dir- "]"+ ".IA64]*.*;*"
179 $ if (f$search( prods) .nes. "") then delete /log 'prods'
180 $ prods = proc_dev_dir+ "IA64"+ ".DIR;1"
181 $ if (f$search( prods) .nes. "") then delete /log 'prods'
182 $ prods = proc_dev_dir- "]"+ ".VAX]*.*;*"
183 $ if (f$search( prods) .nes. "") then delete /log 'prods'
184 $ prods = proc_dev_dir+ "VAX"+ ".DIR;1"
185 $ if (f$search( prods) .nes. "") then delete /log 'prods'
189 $ if (arg_val .eqs. "64")
191 $ cc_qual1 = cc_qual1+ " /POINTER = 64"
195 $ if (f$extract( 0, 6, arg_val) .eqs. "CCQUAL")
197 $ opts = f$edit( arg_val, "COLLAPSE")
198 $ eq = f$locate( "=", opts)
199 $ cc_qual2 = f$extract( (eq+ 1), 1000, opts)
203 $ if (arg_val .eqs. "DEBUG")
205 $ cc_qual1 = cc_qual1+ " /debug /nooptimize"
206 $ link_qual = link_qual+ " /debug"
210 $ if (arg_val .eqs. "IEEE")
212 $ cc_qual1 = cc_qual1+ " /FLOAT = IEEE_FLOAT"
216 $ if (arg_val .eqs. "LARGE")
218 $ if (arch_name .eqs. "VAX")
220 $ write sys$output """LARGE"" is ignored on VAX."
222 $ cc_defs = cc_defs+ ", _LARGEFILE=1"
227 $ if (arg_val .eqs. "LDAP")
233 $ if (f$extract( 0, 4, arg_val) .eqs. "LIST")
236 $ cc_qual1 = cc_qual1+ " /list = ''lisdir' /show = (all, nomessages)"
237 $ link_qual = link_qual+ " /map = ''lisdir'"
238 $ msg_qual = msg_qual+ " /list = ''lisdir'"
242 $ if (arg_val .eqs. "NOHPSSL")
248 $ if (arg_val .eqs. "NOSSL")
254 $ if (arg_val .eqs. "OSSLOLB")
260 $ write sys$output "Unrecognized command-line option: ''arg_val'"
268 $! CC /LIST, LINK /MAP, and MESSAGE /LIST are defaults in batch mode,
269 $! so be explicit when they're not desired.
273 $ cc_qual1 = cc_qual1+ " /nolist"
274 $ link_qual = link_qual+ " /nomap"
275 $ msg_qual = msg_qual+ " /nolist"
278 $! Create product directory, if needed.
280 $ if (f$search( proc_dev_dir+ arch_name+ ".DIR;1") .eqs. "")
282 $ create /directory 'exedir'
285 $! Detect available (but not prohibited) SSL software.
289 $ if (f$trnlnm( "OPENSSL") .nes. "")
291 $ cc_defs = cc_defs+ ", USE_SSLEAY=1"
292 $ if ((f$trnlnm( "SSL$INCLUDE") .nes. "") .and. (.not. nohpssl))
296 $ ssl_opt = ", ''proc_dev_dir'hpssl_"+ -
297 f$getsyi("ARCH_NAME")+ ".opt /options"
299 $! Use OpenSSL. Assume object libraries, unless shared images
300 $! are found (and not prohibited).
302 $ ssl_opt = ", ssllib:libssl.olb /library"+ -
303 ", ssllib:libcrypto.olb /library"
304 $ if (osslolb .eq. 0)
306 if ((f$search( "ssllib:ssl_libcrypto.exe") .nes. "") .and. -
307 (f$search( "ssllib:ssl_libssl.exe") .nes. ""))
309 $! OpenSSL shared images with "SSL_xxx.EXE names.
311 $ ssl_opt = ", ''proc_dev_dir'openssl_ssl_"+ -
312 f$getsyi("ARCH_NAME")+ ".opt /options"
314 $ if ((f$search( "ssllib:libcrypto.exe") .nes. "") .and. -
315 (f$search( "ssllib:libssl.exe") .nes. ""))
317 $! OpenSSL shared images with "xxx.EXE names.
319 $ ssl_opt = ", ''proc_dev_dir'openssl_"+ -
320 f$getsyi("ARCH_NAME")+ ".opt /options"
332 $ cc_defs = cc_defs+ ", CURL_DISABLE_LDAP=1"
335 $! Form CC qualifiers.
337 $ cc_defs = "/define = (''cc_defs')"
338 $ cc_qual2 = cc_qual2+ " /object = ''objdir'"+ -
339 " /include = ([-.lib], [-.src],"+ -
340 " [-.packages.vms], [-.packages.vms.''arch_name'])"
342 $ 'vo_c' "CC opts:", -
347 $! Inform the victim of our plans.
351 $ 'vo_c' "%CURL-I-BLDHPSSL, building with HP SSL support"
353 $ if (openssl .ne. 0)
355 $ if (openssl .eq. 1)
358 "%CURL-I-BLDOSSL_OLB, building with OpenSSL (object library) support"
361 "%CURL-I-BLDOSSL_EXE, building with OpenSSL (shared image) support"
364 $ 'vo_c' "%CURL-I-BLDNOSSL, building with NO SSL support"
368 $! Announce destination and SSL directories.
370 $ 'vo_c' " OBJDIR = ''objdir'"
371 $ 'vo_c' " EXEDIR = ''exedir'"
373 $ if (openssl .ne. 0)
375 $ ssllib = f$trnlnm( "ssllib")
376 $ if (ssllib .eqs. "")
378 $ ssllib = "(undefined)"
380 $ 'vo_c' " SSLLIB = ''ssllib'"
382 $ if (openssl .eq. 1)
384 $ ossl_lib1 = f$trnlnm( "ssllib")+ "LIBSSL.OLB"
385 $ ossl_lib2 = f$trnlnm( "ssllib")+ "LIBCRYPTO.OLB"
386 $ msg = "object libraries"
388 $ if (openssl .eq. 2)
390 $ ossl_lib1 = f$trnlnm( "ssllib")+ "SSL_LIBSSL.EXE"
391 $ ossl_lib2 = f$trnlnm( "ssllib")+ "SSL_LIBCRYPTO.EXE"
393 $ ossl_lib1 = f$trnlnm( "ssllib")+ "LIBSSL.EXE"
394 $ ossl_lib2 = f$trnlnm( "ssllib")+ "LIBCRYPTO.EXE"
396 $ msg = "shared images"
398 $ if ((f$search( ossl_lib1) .eqs. "") .or. -
399 (f$search( ossl_lib2) .eqs. ""))
401 $ write sys$output "Can't find OpenSSL ''msg':"
402 $ write sys$output " ''ossl_lib1'"
403 $ write sys$output " ''ossl_lib2'"
408 $! Define the "curl" (process) logical name for "#include <curl/xxx.h>".
410 $ curl = f$trnlnm( "curl", "LNM$PROCESS")
413 $ write sys$output ""
415 "Process logical name ""curl"" is already defined, but this procedure"
417 "would override that definition. Use a command like"
419 " deassign /process curl"
421 "to cancel that logical name definition, and then and re-run this procedure."
422 $ write sys$output ""
425 $ define curl 'top_dev_dir'.include.curl]
427 $! Copy the VMS-specific config file into the product directory.
429 $ call MoveIfDiff 'top_dev_dir'.lib]config-vms.h 'objdir'curl_config.h
431 $ on control_y then goto Common_Exit
433 $ set default 'proc_dev_dir'
434 $ call build "[--.lib]" "*.c" "''objdir'CURLLIB.OLB" "amigaos, nwlib, nwos"
435 $ if ($status .eq. ctrl_y) then goto Common_Exit
436 $ call build "[--.src]" "*.c" "''objdir'CURLSRC.OLB"
437 $ if ($status .eq. ctrl_y) then goto Common_Exit
438 $ call build "[]" "*.msg" "''objdir'CURLSRC.OLB"
439 $ if ($status .eq. ctrl_y) then goto Common_Exit
442 $ if (ldap .ne. 0) then ldap_opt = ", ''proc_dev_dir'ldap.opt /options"
444 $ if (openssl .ne. 0)
446 $ if (openssl .eq. 1)
448 $ 'vo_l' "%CURL-I-LINK_OSSL, linking with OpenSSL (object library)"
450 $ 'vo_l' "%CURL-I-LINK_HPSSL, linking with OpenSSL (shared image)"
455 $ 'vo_l' "%CURL-I-LINK_HPSSL, linking with HP SSL"
457 $ 'vo_l' "%CURL-I-LINK_NOSSL, linking with NO SSL support"
461 $ link 'link_qual' /executable = 'exedir'CURL.EXE -
462 'objdir'curlsrc.olb /library /include = (main, curlmsg), -
463 'objdir'curllib.olb /library -
469 $! Subroutine to build everything with a filetype passed in via P2 in
470 $! the directory passed in via P1 and put it in the object library named
471 $! via P3. Exclude items in P4.
474 $ build_def = f$environment( "default")
475 $ on control_y then goto EndLoop ! SS$_CONTROLY
476 $ sts = 1 ! SS$_NORMAL.
480 $ reset = f$search("reset")
481 $ if f$search( p3) .eqs. ""
483 $ librarian /create /object 'p3'
485 $ reject_list__ = ","+ f$edit( p4, "COLLAPSE, UPCASE")+ ","
486 $ reject_list___len = f$length( reject_list__)
487 $ reset = f$search( "reset", 1)
489 $ file = f$search( search, 1)
490 $ if file .eqs. "" then goto EndLoop
491 $! Skip a name if it's in the P4 exclusion list.
495 f$edit( f$parse( file, , , "NAME", "SYNTAX_ONLY"), "UPCASE")+ -
497 $ if (f$locate( name__, reject_list__) .lt. reject_list___len)
502 $ objfile = f$parse( "''objdir'.OBJ;", file)
503 $ obj = f$search( objfile, 2)
506 $ if (f$cvtime(f$file(file,"rdt")) .gts. f$cvtime(f$file(obj,"rdt")))
508 $ call compile 'file'
514 $ librarian /object 'p3' 'objfile'
516 $ 'vo_o' "%CURL-I-OBJUTD, ", objfile, " is up to date"
519 $ 'vo_o' "%CURL-I-OBJDNE, ", file, " does not exist"
520 $ call compile 'file'
526 $ librarian /object 'p3' 'objfile'
531 $ set default 'build_def'
533 $ endsubroutine ! Build
535 $! Based on the file TYPE, do the right compile command.
536 $! Only C and MSG supported.
539 $ on control_y then return ctrl_y ! SS$_CONTROLY
542 $ qual = p2+ p3+ p4+ p5+ p6+ p7+ p8
543 $ typ = f$edit( f$parse( file, , , "TYPE"), "UPCASE") - "."
546 $ 'vo_c' "CC (opts) ", file
552 $ cmd_msg = "MESSAGE "+ msg_qual
557 $ ENDSUBROUTINE ! Compile
559 $! Do a diff of the file specified in P1 with that in P2. If different
560 $! copy P1 to P2. This also covers if P2 doesn't exist, but not if P2
561 $! is an invalid filespec.
563 $MoveIfDiff: subroutine
565 $ define /user_mode sys$error nl:
566 $ define /user_mode sys$output nl:
567 $ differences 'p1' 'p2'
569 $ if ( status .ne. %X006C8009) ! if status is not "no diff"
574 $ on control_y then return ctrl_y ! SS$_CONTROLY
575 $ ENDSUBROUTINE ! MoveIfDiff
578 $ set default 'orig_def'
579 $ if ((curl .eqs. "") .and. (f$trnlnm( "curl", "LNM$PROCESS") .nes. ""))