1$! File: build_libcurl_pc.com 2$! 3$! $Id:$ 4$! 5$! Build the libcurl.pc file from the libcurl.pc.in file 6$! 7$! Copyright 2013 - 2020, John Malmberg 8$! 9$! Permission to use, copy, modify, and/or distribute this software for any 10$! purpose with or without fee is hereby granted, provided that the above 11$! copyright notice and this permission notice appear in all copies. 12$! 13$! THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 14$! WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 15$! MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 16$! ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 17$! WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 18$! ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT 19$! OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 20$! 21$! 22$! 15-Jun-2013 J. Malmberg 23$! 24$!=========================================================================== 25$! 26$! Skip this if the libcurl.pc already exists. 27$ if f$search("[--]libcurl.pc") .nes. "" then goto all_exit 28$! 29$! Need to know the kit type. 30$ kit_name = f$trnlnm("GNV_PCSI_KITNAME") 31$ if kit_name .eqs. "" 32$ then 33$ write sys$output "@MAKE_PCSI_CURL_KIT_NAME.COM has not been run." 34$ goto all_exit 35$ endif 36$! 37$! 38$! Parse the kit name into components. 39$!--------------------------------------- 40$ producer = f$element(0, "-", kit_name) 41$ base = f$element(1, "-", kit_name) 42$ product = f$element(2, "-", kit_name) 43$ mmversion = f$element(3, "-", kit_name) 44$ majorver = f$extract(0, 3, mmversion) 45$ minorver = f$extract(3, 2, mmversion) 46$ updatepatch = f$element(4, "-", kit_name) 47$ if updatepatch .eqs. "-" then updatepatch = "" 48$! 49$! kit type of "D" means a daily build 50$ kit_type = f$edit(f$extract(0, 1, majorver), "upcase") 51$! 52$ pc_file_in = "[--]libcurl^.pc.in" 53$! 54$ if f$search(pc_file_in) .eqs. "" 55$ then 56$ pc_file_in = "[--]libcurl.pc$5nin" 57$ if f$search(pc_file_in) .eqs. "" 58$ then 59$ pc_file_in = "[--]libcurl.pc_in" 60$ if f$search(pc_file_in) .eqs. "" 61$ then 62$ write sys$output "Can not find libcurl.pc.in." 63$ goto all_exit 64$ endif 65$ endif 66$ endif 67$! 68$ if (f$getsyi("HW_MODEL") .lt. 1024) 69$ then 70$ arch_name = "VAX" 71$ else 72$ arch_name = "" 73$ arch_name = arch_name + f$edit(f$getsyi("ARCH_NAME"), "UPCASE") 74$ if (arch_name .eqs. "") then arch_name = "UNK" 75$ endif 76$! 77$! 78$ curl_version = "0.0.0" 79$ open/read vf [--.src]tool_version.h 80$version_loop: 81$ read vf/end=version_loop_end line_in 82$ if line_in .eqs. "" then goto version_loop 83$ key = f$element(0, " ", line_in) 84$ if key .nes. "#define" then goto version_loop 85$ name = f$element(1, " ", line_in) 86$ if name .eqs. "VERSION" 87$ then 88$ curl_version = f$element(2, " ", line_in) - """" - """" 89$ else 90$ goto version_loop 91$ endif 92$version_loop_end: 93$ close vf 94$! 95$! 96$ create [--]libcurl.pc 97$ open/append pco [--]libcurl.pc 98$ open/read pci 'pc_file_in' 99$pc_file_loop: 100$ read pci/end=pc_file_loop_end line_in 101$! 102$! blank lines 103$ if line_in .eqs. "" 104$ then 105$ write pco "" 106$ goto pc_file_loop 107$ endif 108$! 109$! comment lines 110$ key = f$extract(0, 1, line_in) 111$ if key .eqs. "#" 112$ then 113$ write pco line_in 114$ goto pc_file_loop 115$ endif 116$! 117$! Special handling for libs. 118$ if f$locate("Libs:", line_in) .eq. 0 119$ then 120$ write pco "#",line_in 121$ goto pc_file_loop 122$ endif 123$! No substitution line 124$ line_in_len = f$length(line_in) 125$ if f$locate("@", line_in) .ge. line_in_len 126$ then 127$ write pco line_in 128$ goto pc_file_loop 129$ endif 130$! 131$ if f$locate("@prefix@", line_in) .lt line_in_len 132$ then 133$ if kit_type .nes. "D" 134$ then 135$ write pco "prefix=/usr" 136$ else 137$ write pco "prefix=/beta" 138$ endif 139$ goto pc_file_loop 140$ endif 141$ if f$locate("@exec_prefix@", line_in) .lt line_in_len 142$ then 143$ if kit_type .nes. "D" 144$ then 145$ write pco "exec_prefix=/usr" 146$ else 147$ write pco "exec_prefix=/beta" 148$ endif 149$ goto pc_file_loop 150$ endif 151$ if f$locate("@libdir@", line_in) .lt line_in_len 152$ then 153$ write pco "libdir=$(exec_prefix}/lib" 154$ goto pc_file_loop 155$ endif 156$ if f$locate("@includedir@", line_in) .lt line_in_len 157$ then 158$ write pco "includedir=$(prefix}/include" 159$ goto pc_file_loop 160$ endif 161$ if f$locate("@SUPPORT_PROTOCOLS@", line_in) .lt line_in_len 162$ then 163$ proto1 = "DICT FILE FTP FTPS GOPHER HTTP HTTPS IMAP IMAPS" 164$ proto2 = " LDAP LDAPS POP3 POP3S RTSP SMTP SMTPS TELNET TFTP" 165$ proto = proto1 + proto2 166$ write pco "supported_protocols=""" + proto + """" 167$ goto pc_file_loop 168$ endif 169$ if f$locate("@SUPPORT_FEATURES@", line_in) .lt line_in_len 170$ then 171$ if arch_name .eqs. "VAX" 172$ then 173$ write pco "supported_features=""SSL libz NTLM""" 174$ else 175$ write pco "supported_features=""SSL IPv6 libz NTLM""" 176$ endif 177$ goto pc_file_loop 178$ endif 179$ if f$locate("@CURLVERSION@", line_in) .lt line_in_len 180$ then 181$ write pco "Version: ''curl_version'" 182$ goto pc_file_loop 183$ endif 184$ if f$locate("@LIBCURL_LIBS@", line_in) .lt line_in_len 185$ then 186$ if arch_name .eqs. "VAX" 187$ then 188$ write pco "Libs.private: -lssl -lcrypto -lz" 189$ else 190$ write pco "Libs.private: -lssl -lcrypto -lgssapi -lz" 191$ endif 192$ goto pc_file_loop 193$ endif 194$ if f$locate("@CPPFLAG_CURL_STATICLIB@", line_in) .lt line_in_len 195$ then 196$ write pco "Cflags: -I${includedir} -DCURL_STATICLIB" 197$ goto pc_file_loop 198$ endif 199$! 200$pc_file_loop_end: 201$ close pco 202$ close pci 203$! 204$all_exit: 205$ exit 206