1 $! File: setup_gnv_curl_build.com
5 $! Set up build environment for building Curl under GNV on VMS.
7 $! GNV needs some files moved into the other directories to help with
8 $! the configure script and the build.
10 $! Copyright 2009, John Malmberg
12 $! Permission to use, copy, modify, and/or distribute this software for any
13 $! purpose with or without fee is hereby granted, provided that the above
14 $! copyright notice and this permission notice appear in all copies.
16 $! THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
17 $! WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
18 $! MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
19 $! ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
20 $! WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
21 $! ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
22 $! OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
24 $! 30-May-2009 J. Malmberg
26 $!=======================================================================
28 $! Save this so we can get back.
29 $ default_dir = f$environment("default")
31 $! Move to where the Configure script is.
34 $! Get the path to where the Configure script is.
35 $ base_dir = f$environment("default")
37 $! Allow arguments to be grouped together with comma or separated by spaces
38 $! Do no know if we will need more than 8.
39 $ args = "," + p1 + "," + p2 + "," + p3 + "," + p4 + ","
40 $ args = args + p5 + "," + p6 + "," + p7 + "," + p8 + ","
42 $! Provide lower case version to simplify parsing.
43 $ args_lower = f$edit(args, "LOWERCASE,COLLAPSE")
45 $ args_len = f$length(args)
46 $ args_lower_len = f$length(args_lower)
49 $ if f$locate(",test", args_lower) .lt. args_lower_len
55 $ if f$locate(",exam", args_lower) .lt. args_lower_len
60 $! We want detailed build logs.
61 $ clist = "/list/show=(expan,includ)"
63 $! We want full symbol names in exact case. Need a commmon
64 $! repository for all directories.
65 $ cnames = "/names=(shortened,as_is)/repository=''base_dir'"
67 $! Set the compiler options for GNV CC wrapper to inherit.
68 $ cc :== cc'clist''cnames'/nested_include_directory=none
69 $ cxx :== cxx'clist''cnames'/nested_include_directory=none
71 $! Note 64 bit pointers requires all libraries to either have
72 $! 64 bit pointers or have #pragma directives.
73 $! Currently building curl on VMS with 64 bit pointers does not work.
75 $! A logical name to make it easier to find some of the hacks.
76 $ define/job gnv_hacks 'base_dir'
78 $! A logical name to find the [.packages.vms] directory where we started.
79 $ define/job gnv_packages_vms 'default_dir'
82 $ if f$trnlnm("gssapi") .eqs. ""
84 $ if f$search("sys$sysroot:[kerberos]include.dir") .nes. ""
86 $ define/job gssapi sys$sysroot:[kerberos.include]
91 $ if f$trnlnm("openssl") .eqs. ""
93 $ if f$trnlnm("ssl$include") .nes. ""
95 $ define/job openssl ssl$include:
99 $! C compiler include path.
100 $ define/job decc$system_include prj_root:[.include.curl],-
102 ssl$include:,gnv$gnu:[usr.include],-
103 gnv$gnu:[usr.include.libz],gnv$gnu:[include],-
105 sys$sysroot:[kerberos.include]
107 $! Set up a include list for the compiler to find all the header files
110 $ define/job decc$user_include src_root:[.include.curl]
111 $ define ssl_lib sys$library:
113 $! Calculate what is needed in the option files
115 $ try_shr = "gnv$libzshr''pointer_size'"
116 $ if f$search(try_shr) .nes. "" then libzshr_line = "''try_shr'/share"
117 $ if (libzshr_line .eqs. "")
119 $ try_shr = "sys$share:" + try_shr
120 $ if f$search("''try_shr'.exe") .nes. ""
122 $ libzshr_line = "''try_shr'/share"
127 $ gssrtlshr_line = ""
128 $ try_shr = "sys$share:gss$rtl"
129 $ if f$search("''try_shr'.exe") .nes. ""
131 $ gssrtlshr_line = "''try_shr'/share"
135 $ libcryptoshr_line = ""
136 $ try_shr = "sys$share:ssl$libcrypto_shr''pointer_size'"
137 $ if f$search("''try_shr'.exe") .nes. ""
139 $ libcryptoshr_line = "''try_shr'/share"
142 $ libsslshr_line = ""
143 $ try_shr = "sys$share:ssl$libssl_shr''pointer_size'"
144 $ if f$search("''try_shr'.exe") .nes. ""
146 $ libsslshr_line = "''try_shr'/share"
150 $! Copy over the gnv$conftest* files to base directory.
151 $!-----------------------------------------------------
152 $ copy 'default_dir'gnv_conftest.c_first 'base_dir'gnv$conftest.c_first
153 $ create 'base_dir'gnv$conftest.opt
154 $ open/append opt 'base_dir'gnv$conftest.opt
155 $ if libzshr_line .nes. "" then write opt libzshr_line
156 $ if libcryptoshr_line .nes. "" then write opt libcryptoshr_line
157 $ if libsslshr_line .nes. "" then write opt libsslshr_line
159 $ purge 'base_dir'gnv$conftest.*
160 $ rename 'base_dir'gnv$conftest.* ;1
164 $! GNV helper files for building the test curl binary.
165 $!-----------------------------------------------
166 $ create [.src]gnv$curl.opt
167 $ open/append opt [.src]gnv$curl.opt
168 $ write opt "gnv_packages_vms:curlmsg.obj"
169 $ if libzshr_line .nes. "" then write opt libzshr_line
170 $ if gssrtlshr_line .nes. "" then write opt gssrtlshr_line
171 $ if libcryptoshr_line .nes. "" then write opt libcryptoshr_line
172 $ if libsslshr_line .nes. "" then write opt libsslshr_line
174 $ purge [.src]gnv$*.*
175 $ rename [.src]gnv$*.* ;1
178 $! Create the libcurl
179 $!------------------------------------------------------
180 $ create 'default_dir'gnv_libcurl_linker.opt
181 $ open/append opt 'default_dir'gnv_libcurl_linker.opt
182 $ if libzshr_line .nes. "" then write opt libzshr_line
183 $ if gssrtlshr_line .nes. "" then write opt gssrtlshr_line
184 $ if libcryptoshr_line .nes. "" then write opt libcryptoshr_line
185 $ if libsslshr_line .nes. "" then write opt libsslshr_line
189 $! Create the template linker file
190 $!---------------------------------
191 $ create 'default_dir'gnv_template_linker.opt
192 $ open/append opt 'default_dir'gnv_template_linker.opt
193 $ write opt "gnv_vms_common:vms_curl_init_unix.obj"
194 $ if libzshr_line .nes. "" then write opt libzshr_line
195 $ if gssrtlshr_line .nes. "" then write opt gssrtlshr_line
196 $ if libcryptoshr_line .nes. "" then write opt libcryptoshr_line
197 $ if libsslshr_line .nes. "" then write opt libsslshr_line
200 $! Copy over the gnv$*.opt files for [.docs.examples]
201 $!----------------------------------------------------
204 $ example_apps = "10-at-a-time,anyauthput,certinfo,cookie_interface,debug"
205 $ example_apps = example_apps + ",fileupload,fopen,ftpget,ftpgetresp"
206 $ example_apps = example_apps + ",ftpupload,getinfo,getinmemory"
207 $ example_apps = example_apps + ",http-post,httpcustomheader,httpput"
208 $ example_apps = example_apps + ",https,multi-app,multi-debugcallback"
209 $ example_apps = example_apps + ",multi-double,multi-post,multi-single"
210 $ example_apps = example_apps + ",persistant,post-callback,postit2"
211 $ example_apps = example_apps + ",sendrecv,sepheaders,simple,simplepost"
212 $ example_apps = example_apps + ",simplessl"
216 $ ap_name = f$element(i, ",", example_apps)
217 $ if ap_name .eqs. "," then goto example_loop_end
218 $ if ap_name .eqs. "" then goto example_loop_end
219 $ copy 'default_dir'gnv_template_linker.opt -
220 [.docs.examples]gnv$'ap_name'.opt
225 $! clean up the copy.
226 $ purge [.docs.examples]gnv$*.opt
227 $ rename [.docs.examples]gnv$*.opt ;1
233 $ libtest_apps = "lib500,lib501,lib502,lib503,lib504,lib505,lib506,lib507"
234 $ libtest_apps = libtest_apps + ",lib508,lib510,lib511,lib512,lib513,lib514"
235 $ libtest_apps = libtest_apps + ",lib515,lib516,lib517,lib518,lib519,lib520"
236 $ libtest_apps = libtest_apps + ",lib521,lib523,lib524,lib525,lib526,lib527"
237 $ libtest_apps = libtest_apps + ",lib529,lib530,lib532,lib533,lib536,lib537"
238 $ libtest_apps = libtest_apps + ",lib539,lib540,lib541,lib542,lib543,lib544"
239 $ libtest_apps = libtest_apps + ",lib545,lib547,lib548,lib549,lib552,lib553"
240 $ libtest_apps = libtest_apps + ",lib554,lib555,lib556,lib557,lib558,lib559"
241 $ libtest_apps = libtest_apps + ",lib560,lib562,lib564"
244 $ ap_name = f$element(i, ",", libtest_apps)
245 $ if ap_name .eqs. "," then goto libtest_loop_end
246 $ if ap_name .eqs. "" then goto libtest_loop_end
247 $ copy 'default_dir'gnv_template_linker.opt -
248 [.tests.libtest]gnv$'ap_name'.opt
253 $! clean up the copy.
254 $ purge [.tests.libtest]gnv$*.opt
255 $ rename [.tests.libtest]gnv$*.opt ;1
259 $! Build the Message file.
260 $!--------------------------
261 $ if f$search("[.packages.vms]curlmsg.obj") .eqs. ""
263 $ message [.packages.vms]curlmsg.msg/object=[.packages.vms]
265 $ if f$search("gnv$curlmsg.exe") .eqs. ""
267 $ link/share=gnv$curlmsg.exe [.packages.vms]curlmsg.obj
272 $! Need to build the common init module.
273 $!-------------------------------------------
274 $ init_obj = "[.packages.vms]curl_crtl_init.obj"
275 $ if f$search(init_obj) .eqs. ""
277 $ cc'cflags' 'default_dir'curl_crtl_init.c/obj='init_obj'
279 $ rename 'init_obj' ;1
284 $ set def 'default_dir'
286 $! Verify can break things in bash, especially in Configure scripts.