• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1$! File: setup_gnv_curl_build.com
2$!
3$! $Id$
4$!
5$! Set up build environment for building Curl under GNV on VMS.
6$!
7$! GNV needs some files moved into the other directories to help with
8$! the configure script and the build.
9$!
10$! Copyright 2009, John Malmberg
11$!
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.
15$!
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.
23$!
24$! 30-May-2009  J. Malmberg
25$!
26$!=======================================================================
27$!
28$! Save this so we can get back.
29$ default_dir = f$environment("default")
30$!
31$! Move to where the Configure script is.
32$ set def [--]
33$!
34$! Get the path to where the Configure script is.
35$ base_dir = f$environment("default")
36$!
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 + ","
41$!
42$! Provide lower case version to simplify parsing.
43$ args_lower = f$edit(args, "LOWERCASE,COLLAPSE")
44$!
45$ args_len = f$length(args)
46$ args_lower_len = f$length(args_lower)
47$!
48$ tests = 0
49$ if f$locate(",test", args_lower) .lt. args_lower_len
50$ then
51$   tests = 1
52$ endif
53$!
54$ examples = 0
55$ if f$locate(",exam", args_lower) .lt. args_lower_len
56$ then
57$   examples = 1
58$ endif
59$!
60$! We want detailed build logs.
61$ clist = "/list/show=(expan,includ)"
62$!
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'"
66$!
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
70$ pointer_size = "32"
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.
74$!
75$! A logical name to make it easier to find some of the hacks.
76$ define/job gnv_hacks 'base_dir'
77$!
78$! A logical name to find the [.packages.vms] directory where we started.
79$ define/job gnv_packages_vms 'default_dir'
80$!
81$! Kerberos headers:
82$ if f$trnlnm("gssapi") .eqs. ""
83$ then
84$   if f$search("sys$sysroot:[kerberos]include.dir") .nes. ""
85$   then
86$       define/job gssapi sys$sysroot:[kerberos.include]
87$   endif
88$ endif
89$!
90$! OpenSSL headers
91$ if f$trnlnm("openssl") .eqs. ""
92$ then
93$   if f$trnlnm("ssl$include") .nes. ""
94$   then
95$       define/job openssl ssl$include:
96$   endif
97$ endif
98$!
99$! C compiler include path.
100$ define/job decc$system_include prj_root:[.include.curl],-
101    [-.packages.vms],-
102    ssl$include:,gnv$gnu:[usr.include],-
103    gnv$gnu:[usr.include.libz],gnv$gnu:[include],-
104    gnv$zlib_include:,-
105    sys$sysroot:[kerberos.include]
106$!
107$! Set up a include list for the compiler to find all the header files
108$! that they need.
109$!
110$ define/job decc$user_include src_root:[.include.curl]
111$ define ssl_lib sys$library:
112$!
113$! Calculate what is needed in the option files
114$ libzshr_line = ""
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. "")
118$ then
119$   try_shr = "sys$share:" + try_shr
120$   if f$search("''try_shr'.exe") .nes. ""
121$   then
122$       libzshr_line = "''try_shr'/share"
123$   endif
124$ endif
125$!
126$! Kerberos
127$ gssrtlshr_line = ""
128$ try_shr = "sys$share:gss$rtl"
129$ if f$search("''try_shr'.exe") .nes. ""
130$ then
131$   gssrtlshr_line = "''try_shr'/share"
132$ endif
133$!
134$! HP OpenSSL
135$ libcryptoshr_line = ""
136$ try_shr = "sys$share:ssl$libcrypto_shr''pointer_size'"
137$ if f$search("''try_shr'.exe") .nes. ""
138$ then
139$   libcryptoshr_line = "''try_shr'/share"
140$ endif
141$!
142$ libsslshr_line = ""
143$ try_shr = "sys$share:ssl$libssl_shr''pointer_size'"
144$ if f$search("''try_shr'.exe") .nes. ""
145$ then
146$   libsslshr_line = "''try_shr'/share"
147$ endif
148$!
149$!
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
158$ close opt
159$ purge 'base_dir'gnv$conftest.*
160$ rename 'base_dir'gnv$conftest.* ;1
161$!
162$!
163$!
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
173$ close opt
174$ purge [.src]gnv$*.*
175$ rename [.src]gnv$*.* ;1
176$!
177$!
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
186$ close opt
187$!
188$!
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
198$ close opt
199$!
200$! Copy over the gnv$*.opt files for [.docs.examples]
201$!----------------------------------------------------
202$ if examples .ne. 0
203$ then
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"
213$!
214$   i = 0
215$example_loop:
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
221$      i = i + 1
222$      goto example_loop
223$example_loop_end:
224$!
225$! clean up the copy.
226$    purge [.docs.examples]gnv$*.opt
227$    rename [.docs.examples]gnv$*.opt ;1
228$ endif
229$!
230$!
231$ if tests .ne. 0
232$ then
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"
242$   i = 0
243$libtest_loop:
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
249$     i = i + 1
250$     goto libtest_loop
251$libtest_loop_end:
252$!
253$! clean up the copy.
254$   purge [.tests.libtest]gnv$*.opt
255$   rename [.tests.libtest]gnv$*.opt ;1
256$ endif
257$!
258$!
259$! Build the Message file.
260$!--------------------------
261$ if f$search("[.packages.vms]curlmsg.obj") .eqs. ""
262$ then
263$   message [.packages.vms]curlmsg.msg/object=[.packages.vms]
264$ endif
265$ if f$search("gnv$curlmsg.exe") .eqs. ""
266$ then
267$   link/share=gnv$curlmsg.exe [.packages.vms]curlmsg.obj
268$ endif
269$!
270$!
271$!
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. ""
276$ then
277$   cc'cflags' 'default_dir'curl_crtl_init.c/obj='init_obj'
278$   purge 'init_obj'
279$   rename 'init_obj' ;1
280$ endif
281$!
282$all_exit:
283$!
284$ set def 'default_dir'
285$!
286$! Verify can break things in bash, especially in Configure scripts.
287$ set nover
288$ exit
289