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