build_gnv_curl_pcsi_text.com 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199
  1. $! File: Build_GNV_curl_pcsi_text.com
  2. $!
  3. $! $Id$
  4. $!
  5. $! Build the *.pcsi$text file from the four components:
  6. $! 1. Generated =product header section
  7. $! 2. [--]readme. file from the Curl distribution, modified to fit
  8. $! a pcsi$text file format.
  9. $! 3. [--]copying file from the Curl distribution, modified to fit
  10. $! a pcsi$text file format.
  11. $! 4. Generated Producer section.
  12. $!
  13. $! Set the name of the release notes from the GNV_PCSI_FILENAME_BASE
  14. $!
  15. $! Copyright 2013 - 2022, John Malmberg
  16. $!
  17. $! Permission to use, copy, modify, and/or distribute this software for any
  18. $! purpose with or without fee is hereby granted, provided that the above
  19. $! copyright notice and this permission notice appear in all copies.
  20. $!
  21. $! THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  22. $! WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  23. $! MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
  24. $! ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  25. $! WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  26. $! ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
  27. $! OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  28. $!
  29. $! SPDX-License-Identifier: ISC
  30. $!
  31. $! 15-Jun-2009 J. Malmberg
  32. $!
  33. $!===========================================================================
  34. $!
  35. $ kit_name = f$trnlnm("GNV_PCSI_KITNAME")
  36. $ if kit_name .eqs. ""
  37. $ then
  38. $ write sys$output "@MAKE_PCSI_CURL_KIT_NAME.COM has not been run."
  39. $ goto all_exit
  40. $ endif
  41. $ producer = f$trnlnm("GNV_PCSI_PRODUCER")
  42. $ if producer .eqs. ""
  43. $ then
  44. $ write sys$output "@MAKE_PCSI_CURL_KIT_NAME.COM has not been run."
  45. $ goto all_exit
  46. $ endif
  47. $ producer_full_name = f$trnlnm("GNV_PCSI_PRODUCER_FULL_NAME")
  48. $ if producer_full_name .eqs. ""
  49. $ then
  50. $ write sys$output "@MAKE_PCSI_CURL_KIT_NAME.COM has not been run."
  51. $ goto all_exit
  52. $ endif
  53. $!
  54. $!
  55. $! Parse the kit name into components.
  56. $!---------------------------------------
  57. $ producer = f$element(0, "-", kit_name)
  58. $ base = f$element(1, "-", kit_name)
  59. $ product = f$element(2, "-", kit_name)
  60. $ mmversion = f$element(3, "-", kit_name)
  61. $ majorver = f$extract(0, 3, mmversion)
  62. $ minorver = f$extract(3, 2, mmversion)
  63. $ updatepatch = f$element(4, "-", kit_name)
  64. $ if updatepatch .eqs. "-" then updatepatch = ""
  65. $!
  66. $!
  67. $ product_line = "=product ''producer' ''base' ''product'"
  68. $ if updatepatch .eqs. ""
  69. $ then
  70. $ product_name = " ''majorver'.''minorver'"
  71. $ else
  72. $ product_name = " ''majorver'.''minorver'-''updatepatch'"
  73. $ endif
  74. $ product_line = product_line + " ''product_name' full"
  75. $!
  76. $!
  77. $! If this is VAX and the file is on NFS, the names may be mangled.
  78. $!-----------------------------------------------------------------
  79. $ readme_file = ""
  80. $ if f$search("[--]readme.") .nes. ""
  81. $ then
  82. $ readme_file = "[--]readme."
  83. $ else
  84. $ if f$search("[--]$README.") .nes. ""
  85. $ then
  86. $ readme_file = "[--]$README."
  87. $ else
  88. $ write sys$output "Can not find readme file."
  89. $ goto all_exit
  90. $ endif
  91. $ endif
  92. $ copying_file = ""
  93. $ if f$search("[--]copying.") .nes. ""
  94. $ then
  95. $ copying_file = "[--]copying."
  96. $ else
  97. $ if f$search("[--]$COPYING.") .nes. ""
  98. $ then
  99. $ copying_file = "[--]$COPYING."
  100. $ else
  101. $ write sys$output "Can not find copying file."
  102. $ goto all_exit
  103. $ endif
  104. $ endif
  105. $!
  106. $! Create the file as a VMS text file.
  107. $!----------------------------------------
  108. $ base_file = kit_name
  109. $ create 'base_file'.pcsi$text
  110. $!
  111. $!
  112. $! Start building file.
  113. $!----------------------
  114. $ open/append ptxt 'base_file'.pcsi$text
  115. $ write ptxt product_line
  116. $!
  117. $!
  118. $! First insert the Readme file.
  119. $!
  120. $ open/read rf 'readme_file'
  121. $!
  122. $ write ptxt "1 'PRODUCT"
  123. $ write ptxt "=prompt ''producter' ''product' for OpenVMS"
  124. $!
  125. $rf_loop:
  126. $ read/end=rf_loop_end rf line_in
  127. $ if line_in .nes. ""
  128. $ then
  129. $! PCSI files use the first character in for their purposes.
  130. $!--------------------------------------------------------------
  131. $ first_char = f$extract(0, 1, line_in)
  132. $ if first_char .nes. " " then line_in = " " + line_in
  133. $ endif
  134. $ write ptxt line_in
  135. $ goto rf_loop
  136. $rf_loop_end:
  137. $ close rf
  138. $!
  139. $!
  140. $! Now add in the copying file
  141. $!--------------------------------
  142. $ write ptxt ""
  143. $ write ptxt "1 'NOTICE"
  144. $ write ptxt ""
  145. $!
  146. $ open/read cf 'copying_file'
  147. $!
  148. $cf_loop:
  149. $ read/end=cf_loop_end cf line_in
  150. $ if line_in .nes. ""
  151. $ then
  152. $! PCSI files use the first character in for their purposes.
  153. $!--------------------------------------------------------------
  154. $ first_char = f$extract(0, 1, line_in)
  155. $ if first_char .nes. " " then line_in = " " + line_in
  156. $ endif
  157. $ write ptxt line_in
  158. $ goto cf_loop
  159. $cf_loop_end:
  160. $ close cf
  161. $!
  162. $! Now we need the rest of the boiler plate.
  163. $!--------------------------------------------
  164. $ write ptxt ""
  165. $ write ptxt "1 'PRODUCER"
  166. $ write ptxt "=prompt ''producer_full_name'"
  167. $ write ptxt -
  168. "This software product is provided by ''producer_full_name' with no warranty."
  169. $!
  170. $ arch_type = f$getsyi("ARCH_NAME")
  171. $ node_swvers = f$getsyi("node_swvers")
  172. $ vernum = f$extract(1, f$length(node_swvers), node_swvers)
  173. $ majver = f$element(0, ".", vernum)
  174. $ minverdash = f$element(1, ".", vernum)
  175. $ minver = f$element(0, "-", minverdash)
  176. $ dashver = f$element(1, "-", minverdash)
  177. $ if dashver .eqs. "-" then dashver = ""
  178. $ vmstag = majver + minver + dashver
  179. $ code = f$extract(0, 1, arch_type)
  180. $!
  181. $ write ptxt "1 NEED_VMS''vmstag'"
  182. $ write ptxt -
  183. "=prompt OpenVMS ''vernum' or later is not installed on your system."
  184. $ write ptxt "This product requires OpenVMS ''vernum' or later to function."
  185. $ write ptxt "1 NEED_ZLIB"
  186. $ write ptxt "=prompt ZLIB 1.2-8 or later is not installed on your system."
  187. $ write ptxt "This product requires ZLIB 1.2-8 or later to function."
  188. $ write ptxt "1 SOURCE"
  189. $ write ptxt "=prompt Source modules for ''product'"
  190. $ write ptxt "The Source modules for ''product' will be installed."
  191. $ write ptxt "1 RELEASE_NOTES"
  192. $ write ptxt "=prompt Release notes are available in the [SYSHLP] directory."
  193. $!
  194. $ close ptxt
  195. $!
  196. $!
  197. $!
  198. $all_exit:
  199. $ exit