4 $! I've taken the original build_vms.com, supplied by Nico Baggus, if
5 $! memory serves me correctly, and made some modifications.
7 $! SSL support is controlled by logical names. If SSL$INCLUDE is
8 $! defined, then it is assumed that HP's SSL product has been installed.
9 $! If OPENSSL is defined, but SSL$INCLUDE is not, then OpenSSL will be
10 $! used. If neither logical name is defined, then SSL support will not
11 $! be compiled/linked in. Command-line options NOHPSSL and NOSSL can be
12 $! specified to override the automatic SSL selection.
14 $! Command-line Options:
16 $! CLEAN Delete product files for this host architecture. (No
18 $! CLEAN_ALL Delete product files for all host architectures. (No
21 $! 64 Compile with 64-bit pointers.
22 $! CCQUAL=x Add "x" to the C compiler qualifiers.
23 $! DEBUG Compile and link with debug.
24 $! IEEE Use IEEE floating point. (Alpha.)
25 $! LARGE Enable large-file support. (Non-VAX, VMS >= V7.2.)
26 $! LDAP Enable LDAP support.
27 $! LIST Create C compiler listings and linker maps.
28 $! NOHPSSL Don't use HP SSL, even if available.
29 $! NOSSL Don't use any SSL, even if available.
30 $! OSSLOLB Use OpenSSL object libraries (.OLB), even if shared
31 $! images (.EXE) are available.
35 $! CURL_CCDEFS="c_macro_1=value1 [, c_macro_2=value2 [...]]"
36 $! Compile with these additional C macros defined.
40 $! 2-DEC-2003, MSK, the "original" version.
41 $! It works for me. Your mileage may vary.
42 $! 13-JAN-2004, MSK, moved this procedure to the [.packages.vms] directory
43 $! and updated it to do hardware dependent builds.
44 $! 29-JAN-2004, MSK, moved logical defines into defines.com
45 $! 6-FEB-2004, MSK, put in various SSL support bits
46 $! 9-MAR-2004, MSK, the config-vms.h* files are now copied to the lib and
47 $! src directories as curl_config.h.
48 $! 15-MAR-2004, MSK, All of the curlmsg*.* files have also been moved to
49 $! this build directory. They will be copied to the src
50 $! directory before build. The .msg file will be compiled
51 $! to get the .obj for messages, but the .h and .sdl files
52 $! are not automatically created since they partly rely on
53 $! the freeware SDL tool.
54 $! 8-FEB-2005, MSK, merged the two config-vms.h* files into one that uses
55 $! USE_SSLEAY to define if the target has SSL support built
56 $! in. Changed the cc/define parameter accordingly.
57 $! 11-FEB-2005, MSK, If [--.LIB]AMIGAOS.C and NWLIB.C are there, rename them
58 $! 23-MAR-2005, MSK, relocated cc_qual define so that DEBUG option would work
59 $! 25-APR-2007, STL, allow compilation in 64-bit mode.
60 $! 13-DEC-2009. SMS, Changed to skip unwanted source files without
61 $! renaming the original files.
62 $! Eliminated needless, persistent logical names.
63 $! Added CURL_CCDEFS DCL symbol for user-specified C
65 $! Added CLEAN and CLEAN_ALL options.
66 $! Added CCQUAL option for user-specified C compiler
68 $! Added IEEE option for IEEE floating point (Alpha).
69 $! Added LARGE option for large-file support.
70 $! Added OSSLOLB option, and support for OpenSSL
72 $! Changed to put listing and map files into lisdir:.
73 $! Changed to avoid case confusion on ODS5 disks.
74 $! Added more default dev:[dir] save+restore.
75 $! Moved remaining "defines.com" code (back) into
76 $! here, eliminating the hard-coded OpenSSL nonsense.
77 $! Changed to use F$GETSYI( "ARCH_NAME") (or
78 $! equivalent) to name architecture-specific product
79 $! file destination directory, and to create the
80 $! directory if needed (obviating inclusion of these
81 $! directories and dummy files in the distribution
83 $! Changed the "compile" subroutine to break the CC
84 $! command across multiple lines to avoid DCL
85 $! line-too-long problems.
86 $! Changed "vo_c" messages to show the CC qualifiers
87 $! once, not with every compile command.
90 $! Save the original default dev:[dir], and arrange for its restoration
94 $ orig_def = f$environment( "DEFAULT")
95 $ on error then goto Common_Exit
96 $ on control_y then goto Common_Exit
99 $ proc = f$environment( "PROCEDURE")
101 f$parse( proc, , , "DEVICE")+ f$parse( proc, , , "DIRECTORY")
103 $! Verbose output message stuff. Define symbol to "write sys$output" or "!".
104 $! vo_c - verbose output for compile
106 $! vo_o - object check
108 $ vo_c = "write sys$output"
109 $ vo_l = "write sys$output"
112 $! Determine the main distribution directory ("[--]") in an
113 $! ODS5-tolerant (case-insensitive) way. (We do assume that the only
114 $! "]" is the one at the end.)
116 $ set default 'proc_dev_dir'
118 $ top_dev_dir = f$environment( "DEFAULT")- "]"
120 $! Define the architecture-specific product file destination directory
123 $ if (f$getsyi( "HW_MODEL") .lt. 1024)
128 $ arch_name = arch_name+ f$edit( f$getsyi( "ARCH_NAME"), "UPCASE")
129 $ if (arch_name .eqs. "") then arch_name = "UNK"
132 $ exedir = proc_dev_dir- "]"+ ".''arch_name']"
136 $! Interpret command-line options.
147 $ cc_defs = "HAVE_CONFIG_H=1"
148 $ if (f$type( CURL_CCDEFS) .nes. "")
150 $ CURL_CCDEFS = f$edit( CURL_CCDEFS, "TRIM")
151 $ cc_defs = cc_defs+ ", "+ CURL_CCDEFS
154 $ msg_qual = "/object = ''objdir'"
161 $ if (arg_val .eqs. "") then goto arg_loop_out
162 $ arg_val = f$edit( arg_val, "upcase")
164 $ if (arg_val .eqs. "CLEAN")
166 $ prods = "''exedir'*.*;*"
167 $ if (f$search( prods) .nes. "") then delete /log 'prods'
168 $ prods = proc_dev_dir+ arch_name+ ".DIR;1"
169 $ if (f$search( prods) .nes. "") then delete /log 'prods'
173 $ if (arg_val .eqs. "CLEAN_ALL")
175 $ prods = proc_dev_dir- "]"+ ".ALPHA]*.*;*"
176 $ if (f$search( prods) .nes. "") then delete /log 'prods'
177 $ prods = proc_dev_dir+ "ALPHA"+ ".DIR;1"
178 $ if (f$search( prods) .nes. "") then delete /log 'prods'
179 $ prods = proc_dev_dir- "]"+ ".IA64]*.*;*"
180 $ if (f$search( prods) .nes. "") then delete /log 'prods'
181 $ prods = proc_dev_dir+ "IA64"+ ".DIR;1"
182 $ if (f$search( prods) .nes. "") then delete /log 'prods'
183 $ prods = proc_dev_dir- "]"+ ".VAX]*.*;*"
184 $ if (f$search( prods) .nes. "") then delete /log 'prods'
185 $ prods = proc_dev_dir+ "VAX"+ ".DIR;1"
186 $ if (f$search( prods) .nes. "") then delete /log 'prods'
190 $ if (arg_val .eqs. "64")
192 $ cc_qual1 = cc_qual1+ " /POINTER = 64"
196 $ if (f$extract( 0, 6, arg_val) .eqs. "CCQUAL")
198 $ opts = f$edit( arg_val, "COLLAPSE")
199 $ eq = f$locate( "=", opts)
200 $ cc_qual2 = f$extract( (eq+ 1), 1000, opts)
204 $ if (arg_val .eqs. "DEBUG")
206 $ cc_qual1 = cc_qual1+ " /debug /nooptimize"
207 $ link_qual = link_qual+ " /debug"
211 $ if (arg_val .eqs. "IEEE")
213 $ cc_qual1 = cc_qual1+ " /FLOAT = IEEE_FLOAT"
217 $ if (arg_val .eqs. "LARGE")
219 $ if (arch_name .eqs. "VAX")
221 $ write sys$output """LARGE"" is ignored on VAX."
223 $ cc_defs = cc_defs+ ", _LARGEFILE=1"
228 $ if (arg_val .eqs. "LDAP")
234 $ if (f$extract( 0, 4, arg_val) .eqs. "LIST")
237 $ cc_qual1 = cc_qual1+ " /list = ''lisdir' /show = (all, nomessages)"
238 $ link_qual = link_qual+ " /map = ''lisdir'"
239 $ msg_qual = msg_qual+ " /list = ''lisdir'"
243 $ if (arg_val .eqs. "NOHPSSL")
249 $ if (arg_val .eqs. "NOSSL")
255 $ if (arg_val .eqs. "OSSLOLB")
261 $ write sys$output "Unrecognized command-line option: ''arg_val'"
269 $! CC /LIST, LINK /MAP, and MESSAGE /LIST are defaults in batch mode,
270 $! so be explicit when they're not desired.
274 $ cc_qual1 = cc_qual1+ " /nolist"
275 $ link_qual = link_qual+ " /nomap"
276 $ msg_qual = msg_qual+ " /nolist"
279 $! Create product directory, if needed.
281 $ if (f$search( proc_dev_dir+ arch_name+ ".DIR;1") .eqs. "")
283 $ create /directory 'exedir'
286 $! Detect available (but not prohibited) SSL software.
290 $ if (f$trnlnm( "OPENSSL") .nes. "")
292 $ cc_defs = cc_defs+ ", USE_SSLEAY=1"
293 $ if ((f$trnlnm( "SSL$INCLUDE") .nes. "") .and. (.not. nohpssl))
297 $ ssl_opt = ", ''proc_dev_dir'hpssl_"+ -
298 f$getsyi("ARCH_NAME")+ ".opt /options"
300 $! Use OpenSSL. Assume object libraries, unless shared images
301 $! are found (and not prohibited).
303 $ ssl_opt = ", ssllib:libssl.olb /library"+ -
304 ", ssllib:libcrypto.olb /library"
305 $ if (osslolb .eq. 0)
307 if ((f$search( "ssllib:ssl_libcrypto.exe") .nes. "") .and. -
308 (f$search( "ssllib:ssl_libssl.exe") .nes. ""))
310 $! OpenSSL shared images with "SSL_xxx.EXE names.
312 $ ssl_opt = ", ''proc_dev_dir'openssl_ssl_"+ -
313 f$getsyi("ARCH_NAME")+ ".opt /options"
315 $ if ((f$search( "ssllib:libcrypto.exe") .nes. "") .and. -
316 (f$search( "ssllib:libssl.exe") .nes. ""))
318 $! OpenSSL shared images with "xxx.EXE names.
320 $ ssl_opt = ", ''proc_dev_dir'openssl_"+ -
321 f$getsyi("ARCH_NAME")+ ".opt /options"
333 $ cc_defs = cc_defs+ ", CURL_DISABLE_LDAP=1"
336 $! Form CC qualifiers.
338 $ cc_defs = "/define = (''cc_defs')"
339 $ cc_qual2 = cc_qual2+ " /object = ''objdir'"+ -
340 " /include = ([-.lib], [-.src],"+ -
341 " [-.packages.vms], [-.packages.vms.''arch_name'])"
343 $ 'vo_c' "CC opts:", -
348 $! Inform the victim of our plans.
352 $ 'vo_c' "%CURL-I-BLDHPSSL, building with HP SSL support"
354 $ if (openssl .ne. 0)
356 $ if (openssl .eq. 1)
359 "%CURL-I-BLDOSSL_OLB, building with OpenSSL (object library) support"
362 "%CURL-I-BLDOSSL_EXE, building with OpenSSL (shared image) support"
365 $ 'vo_c' "%CURL-I-BLDNOSSL, building with NO SSL support"
369 $! Announce destination and SSL directories.
371 $ 'vo_c' " OBJDIR = ''objdir'"
372 $ 'vo_c' " EXEDIR = ''exedir'"
374 $ if (openssl .ne. 0)
376 $ ssllib = f$trnlnm( "ssllib")
377 $ if (ssllib .eqs. "")
379 $ ssllib = "(undefined)"
381 $ 'vo_c' " SSLLIB = ''ssllib'"
383 $ if (openssl .eq. 1)
385 $ ossl_lib1 = f$trnlnm( "ssllib")+ "LIBSSL.OLB"
386 $ ossl_lib2 = f$trnlnm( "ssllib")+ "LIBCRYPTO.OLB"
387 $ msg = "object libraries"
389 $ if (openssl .eq. 2)
391 $ ossl_lib1 = f$trnlnm( "ssllib")+ "SSL_LIBSSL.EXE"
392 $ ossl_lib2 = f$trnlnm( "ssllib")+ "SSL_LIBCRYPTO.EXE"
394 $ ossl_lib1 = f$trnlnm( "ssllib")+ "LIBSSL.EXE"
395 $ ossl_lib2 = f$trnlnm( "ssllib")+ "LIBCRYPTO.EXE"
397 $ msg = "shared images"
399 $ if ((f$search( ossl_lib1) .eqs. "") .or. -
400 (f$search( ossl_lib2) .eqs. ""))
402 $ write sys$output "Can't find OpenSSL ''msg':"
403 $ write sys$output " ''ossl_lib1'"
404 $ write sys$output " ''ossl_lib2'"
409 $! Define the "curl" (process) logical name for "#include <curl/xxx.h>".
411 $ curl = f$trnlnm( "curl", "LNM$PROCESS")
414 $ write sys$output ""
416 "Process logical name ""curl"" is already defined, but this procedure"
418 "would override that definition. Use a command like"
420 " deassign /process curl"
422 "to cancel that logical name definition, and then and re-run this procedure."
423 $ write sys$output ""
426 $ define curl 'top_dev_dir'.include.curl]
428 $! Copy the VMS-specific config file into the product directory.
430 $ call MoveIfDiff 'proc_dev_dir'config-vms.h 'objdir'curl_config.h
432 $ on control_y then goto Common_Exit
434 $ set default 'proc_dev_dir'
435 $ call build "[--.lib]" "*.c" "''objdir'CURLLIB.OLB" "amigaos, nwlib, nwos"
436 $ if ($status .eq. ctrl_y) then goto Common_Exit
437 $ call build "[--.src]" "*.c" "''objdir'CURLSRC.OLB"
438 $ if ($status .eq. ctrl_y) then goto Common_Exit
439 $ call build "[]" "*.msg" "''objdir'CURLSRC.OLB"
440 $ if ($status .eq. ctrl_y) then goto Common_Exit
443 $ if (ldap .ne. 0) then ldap_opt = ", ''proc_dev_dir'ldap.opt /options"
445 $ if (openssl .ne. 0)
447 $ if (openssl .eq. 1)
449 $ 'vo_l' "%CURL-I-LINK_OSSL, linking with OpenSSL (object library)"
451 $ 'vo_l' "%CURL-I-LINK_HPSSL, linking with OpenSSL (shared image)"
456 $ 'vo_l' "%CURL-I-LINK_HPSSL, linking with HP SSL"
458 $ 'vo_l' "%CURL-I-LINK_NOSSL, linking with NO SSL support"
462 $ link 'link_qual' /executable = 'exedir'CURL.EXE -
463 'objdir'curlsrc.olb /library /include = (main, curlmsg), -
464 'objdir'curllib.olb /library -
470 $! Subroutine to build everything with a filetype passed in via P2 in
471 $! the directory passed in via P1 and put it in the object library named
472 $! via P3. Exclude items in P4.
475 $ build_def = f$environment( "default")
476 $ on control_y then goto EndLoop ! SS$_CONTROLY
477 $ sts = 1 ! SS$_NORMAL.
481 $ reset = f$search("reset")
482 $ if f$search( p3) .eqs. ""
484 $ librarian /create /object 'p3'
486 $ reject_list__ = ","+ f$edit( p4, "COLLAPSE, UPCASE")+ ","
487 $ reject_list___len = f$length( reject_list__)
488 $ reset = f$search( "reset", 1)
490 $ file = f$search( search, 1)
491 $ if file .eqs. "" then goto EndLoop
492 $! Skip a name if it's in the P4 exclusion list.
496 f$edit( f$parse( file, , , "NAME", "SYNTAX_ONLY"), "UPCASE")+ -
498 $ if (f$locate( name__, reject_list__) .lt. reject_list___len)
503 $ objfile = f$parse( "''objdir'.OBJ;", file)
504 $ obj = f$search( objfile, 2)
507 $ if (f$cvtime(f$file(file,"rdt")) .gts. f$cvtime(f$file(obj,"rdt")))
509 $ call compile 'file'
515 $ librarian /object 'p3' 'objfile'
517 $ 'vo_o' "%CURL-I-OBJUTD, ", objfile, " is up to date"
520 $ 'vo_o' "%CURL-I-OBJDNE, ", file, " does not exist"
521 $ call compile 'file'
527 $ librarian /object 'p3' 'objfile'
532 $ set default 'build_def'
534 $ endsubroutine ! Build
536 $! Based on the file TYPE, do the right compile command.
537 $! Only C and MSG supported.
540 $ on control_y then return ctrl_y ! SS$_CONTROLY
543 $ qual = p2+ p3+ p4+ p5+ p6+ p7+ p8
544 $ typ = f$edit( f$parse( file, , , "TYPE"), "UPCASE") - "."
547 $ 'vo_c' "CC (opts) ", file
553 $ cmd_msg = "MESSAGE "+ msg_qual
558 $ ENDSUBROUTINE ! Compile
560 $! Do a diff of the file specified in P1 with that in P2. If different
561 $! copy P1 to P2. This also covers if P2 doesn't exist, but not if P2
562 $! is an invalid filespec.
564 $MoveIfDiff: subroutine
566 $ define /user_mode sys$error nl:
567 $ define /user_mode sys$output nl:
568 $ differences 'p1' 'p2'
570 $ if ( status .ne. %X006C8009) ! if status is not "no diff"
575 $ on control_y then return ctrl_y ! SS$_CONTROLY
576 $ ENDSUBROUTINE ! MoveIfDiff
579 $ set default 'orig_def'
580 $ if ((curl .eqs. "") .and. (f$trnlnm( "curl", "LNM$PROCESS") .nes. ""))