2
0

build_gnv_curl_pcsi_text.com 5.9 KB

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