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