2
0

build_libcurl_pc.com 5.4 KB

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