1 $! $Id: build_vms.com,v 1.1.1.1 2008-09-23 16:32:05 hoffman Exp $
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 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.
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".
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.
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
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.
51 $ on control_y then goto Common_Exit
53 $ origdir = f$environment("DEFAULT")
54 $ proc = f$environment("PROCEDURE")
55 $ thisdir = f$parse( proc,,,"DEVICE") + f$parse( proc,,,"DIRECTORY")
57 $! Verbose output message stuff. Define symbol to "write sys$output" or "!".
58 $! vo_c - verbose output for compile
60 $! vo_o - object check
62 $ vo_c = "write sys$output"
63 $ vo_l = "write sys$output"
66 $ defines = thisdir + "defines.com"
67 $ if f$trnlnm( "curl_defines_done") .eqs. ""
69 $ if f$search( defines) .eqs. ""
71 $ write sys$output "%CURL-F-DEFFNF, cannot find defines.com procedure"
81 $ cc_qual = "/define=HAVE_CONFIG_H=1"
83 $ if f$trnlnm( "CURL_BUILD_NOSSL") .eqs. ""
85 $ if f$trnlnm( "OPENSSL") .nes. ""
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. "")
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"
100 $ cc_qual = cc_qual + "/LIST/SHOW=ALL/DEBUG/NOOPT"
101 $ link_qual = "/DEBUG/MAP"
103 $ msg_qual = "/OBJ=OBJDIR:"
105 $! Put the right main config file in the two source directories for the build.
107 $ if ( openssl .eq. 1) .or. ( hpssl .eq. 1)
109 $ 'vo_c' "%CURL-I-BLDSSL, building with SSL support"
111 $ 'vo_c' "%CURL-I-BLDNOSSL, building without SSL support"
113 $ config_h = "CONFIG-VMS.H"
115 $! Only do the copy if the source and destination files are different.
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]"
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.
129 $ if f$search( "[--.lib]amigaos.c") .nes. ""
131 $ rename [--.lib]amigaos.c .c_not_used
133 $ if f$search( "[--.lib]nwlib.c") .nes. ""
135 $ rename [--.lib]nwlib.c .c_not_used
137 $ on control_y then goto Common_Exit
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)
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
152 $ if ( openssl .eq. 1) .and. ( hpssl .eq. 1)
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'
160 $ if ( openssl .eq. 0) .and. ( hpssl .eq. 0)
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),-
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
175 $ on control_y then goto EndLoop ! SS$_CONTROLY
179 $ reset = f$search("reset")
180 $ if f$search( p3) .eqs. ""
182 $ LIB/CREATE/OBJECT 'p3'
184 $ reset = f$search("reset",1)
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)
192 $ if (f$cvtime(f$file(file,"rdt")) .gts. f$cvtime(f$file(obj,"rdt")))
194 $ call compile 'file'
195 $ if .not. $status then return $status
196 $ lib/object 'p3' 'objfile'
198 $ 'vo_o' "%CURL-I-OBJUTD, ", objfile, " is up to date"
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'
210 $ endsubroutine ! Build
212 $! Based on the file TYPE, do the right compile command.
213 $! Only C and MSG supported.
216 $ on control_y then return ctrl_y ! SS$_CONTROLY
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
226 $ ENDSUBROUTINE ! Compile
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.
232 $MoveIfDiff: subroutine
234 $ set message/nof/noi/nos/not
235 $ diff/out=nla0: 'p1' 'p2'
237 $ set message/f/i/s/t
238 $ if ( status .ne. %X006C8009) ! if status is not "no diff"
243 $ on control_y then return ctrl_y ! SS$_CONTROLY
244 $ ENDSUBROUTINE ! MoveIfDiff
247 $ set default 'origdir'