1 $! File: build_libcurl_pc.com
5 $! Build the libcurl.pc file from the libcurl.pc.in file
7 $! Copyright 2013, John Malmberg
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.
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.
22 $! 15-Jun-2013 J. Malmberg
24 $!===========================================================================
26 $! Skip this if the libcurl.pc already exists.
27 $ if f$search("[--]libcurl.pc") .nes. "" then goto all_exit
29 $! Need to know the kit type.
30 $ kit_name = f$trnlnm("GNV_PCSI_KITNAME")
31 $ if kit_name .eqs. ""
33 $ write sys$output "@MAKE_PCSI_CURL_KIT_NAME.COM has not been run."
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 = ""
49 $! kit type of "D" means a daily build
50 $ kit_type = f$edit(f$extract(0, 1, majorver), "upcase")
52 $ pc_file_in = "[--]libcurl^.pc.in"
54 $ if f$search(pc_file_in) .eqs. ""
56 $ pc_file_in = "[--]libcurl.pc$5nin"
57 $ if f$search(pc_file_in) .eqs. ""
59 $ pc_file_in = "[--]libcurl.pc_in"
60 $ if f$search(pc_file_in) .eqs. ""
62 $ write sys$output "Can not find libcurl.pc.in."
68 $ if (f$getsyi("HW_MODEL") .lt. 1024)
73 $ arch_name = arch_name + f$edit(f$getsyi("ARCH_NAME"), "UPCASE")
74 $ if (arch_name .eqs. "") then arch_name = "UNK"
78 $ curl_version = "0.0.0"
79 $ open/read vf [--.src]version.h
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"
88 $ curl_version = f$element(2, " ", line_in) - """" - """"
96 $ create [--]libcurl.pc
97 $ open/append pco [--]libcurl.pc
98 $ open/read pci 'pc_file_in'
100 $ read pci/end=pc_file_loop_end line_in
103 $ if line_in .eqs. ""
110 $ key = f$extract(0, 1, line_in)
117 $! Special handling for libs.
118 $ if f$locate("Libs:", line_in) .eq. 0
120 $ write pco "#",line_in
123 $! No substitution line
124 $ line_in_len = f$length(line_in)
125 $ if f$locate("@", line_in) .ge. line_in_len
131 $ if f$locate("@prefix@", line_in) .lt line_in_len
133 $ if kit_type .nes. "D"
135 $ write pco "prefix=/usr"
137 $ write pco "prefix=/beta"
141 $ if f$locate("@exec_prefix@", line_in) .lt line_in_len
143 $ if kit_type .nes. "D"
145 $ write pco "exec_prefix=/usr"
147 $ write pco "exec_prefix=/beta"
151 $ if f$locate("@libdir@", line_in) .lt line_in_len
153 $ write pco "libdir=$(exec_prefix}/lib"
156 $ if f$locate("@includedir@", line_in) .lt line_in_len
158 $ write pco "includedir=$(prefix}/include"
161 $ if f$locate("@SUPPORT_PROTOCOLS@", line_in) .lt line_in_len
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 + """"
169 $ if f$locate("@SUPPORT_FEATURES@", line_in) .lt line_in_len
171 $ if arch_name .eqs. "VAX"
173 $ write pco "supported_features=""SSL libz NTLM"""
175 $ write pco "supported_features=""SSL IPv6 libz NTLM"""
179 $ if f$locate("@CURLVERSION@", line_in) .lt line_in_len
181 $ write pco "Version: ''curl_version'"
184 $ if f$locate("@LIBCURL_LIBS@", line_in) .lt line_in_len
186 $ if arch_name .eqs. "VAX"
188 $ write pco "Libs.private: -lssl -lcrypto -lz"
190 $ write pco "Libs.private: -lssl -lcrypto -lgssapi -lz"
194 $ if f$locate("@CPPFLAG_CURL_STATICLIB@", line_in) .lt line_in_len
196 $ write pco "Cflags: -I${includedir} -DCURL_STATICLIB"