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