1$! File: PCSI_PRODUCT_GNV_CURL.COM
2$!
3$! This command file packages up the product CURL into a sequential
4$! format kit
5$!
6$! Copyright (C) John Malmberg
7$!
8$! Permission to use, copy, modify, and/or distribute this software for any
9$! purpose with or without fee is hereby granted, provided that the above
10$! copyright notice and this permission notice appear in all copies.
11$!
12$! THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
13$! WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
14$! MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
15$! ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
16$! WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
17$! ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
18$! OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
19$!
20$! SPDX-License-Identifier: ISC
21$!
22$!=========================================================================
23$!
24$! Save default
25$ default_dir = f$environment("DEFAULT")
26$!
27$! Put things back on error.
28$ on warning then goto all_exit
29$!
30$!
31$ can_build = 1
32$ producer = f$trnlnm("GNV_PCSI_PRODUCER")
33$ if producer .eqs. ""
34$ then
35$   write sys$output "GNV_PCSI_PRODUCER logical name has not been set."
36$   can_build = 0
37$ endif
38$ producer_full_name = f$trnlnm("GNV_PCSI_PRODUCER_FULL_NAME")
39$ if producer_full_name .eqs. ""
40$ then
41$   write sys$output -
42        "GNV_PCSI_PRODUCER_FULL_NAME logical name has not been set."
43$   can_build = 0
44$ endif
45$ stage_root_name = f$trnlnm("STAGE_ROOT")
46$ if stage_root_name .eqs. ""
47$ then
48$   write sys$output "STAGE_ROOT logical name has not been set."
49$   can_build = 0
50$ endif
51$!
52$ if (can_build .eq. 0)
53$ then
54$    write sys$output "Not able to build a kit."
55$    goto all_exit
56$ endif
57$!
58$! Make sure that the kit name is up to date for this build
59$!----------------------------------------------------------
60$ @MAKE_PCSI_CURL_KIT_NAME.COM
61$!
62$!
63$! Make sure that the image is built
64$!----------------------------------
65$ arch_name = f$edit(f$getsyi("arch_name"),"UPCASE")
66$ if f$search("[--.src]curl.exe") .eqs. ""
67$ then
68$   build_it = 1
69$   libfile = "[.packages.vms.''arch_name']curllib.olb"
70$   if f$search(libfile) .nes. ""
71$   then
72$       build_it = 0
73$   else
74$       ! GNV based build
75$       libfile = "[.lib.^.libs]libcurl.a"
76$       if f$search(libfile) .nes. ""
77$       then
78$           build_it = 0;
79$       endif
80$   endif
81$   if build_it .eq. 1
82$   then
83$       @build_vms list
84$   endif
85$   @gnv_link_curl.com
86$ endif
87$!
88$! Make sure that the release note file name is up to date
89$!---------------------------------------------------------
90$ @BUILD_GNV_CURL_RELEASE_NOTES.COM
91$!
92$!
93$! Make sure that the source has been backed up.
94$!----------------------------------------------
95$ arch_type = f$getsyi("ARCH_NAME")
96$ arch_code = f$extract(0, 1, arch_type)
97$ @backup_gnv_curl_src.com
98$!
99$! Regenerate the PCSI description file.
100$!--------------------------------------
101$ @BUILD_GNV_CURL_PCSI_DESC.COM
102$!
103$! Regenerate the PCSI Text file.
104$!---------------------------------
105$ @BUILD_GNV_CURL_PCSI_TEXT.COM
106$!
107$!
108$! Parse the kit name into components.
109$!---------------------------------------
110$ kit_name = f$trnlnm("GNV_PCSI_KITNAME")
111$ if kit_name .eqs. ""
112$ then
113$   write sys$output "@MAKE_PCSI_CURL_KIT_NAME.COM has not been run."
114$   goto all_exit
115$ endif
116$ producer = f$element(0, "-", kit_name)
117$ base = f$element(1, "-", kit_name)
118$ product_name = f$element(2, "-", kit_name)
119$ mmversion = f$element(3, "-", kit_name)
120$ majorver = f$extract(0, 3, mmversion)
121$ minorver = f$extract(3, 2, mmversion)
122$ updatepatch = f$element(4, "-", kit_name)
123$ if updatepatch .eqs. "" then updatepatch = ""
124$!
125$ version_fao = "!AS.!AS"
126$ mmversion = f$fao(version_fao, "''majorver'", "''minorver'")
127$ if updatepatch .nes. ""
128$ then
129$   version = "''mmversion'" + "-" + updatepatch
130$ else
131$   version = "''mmversion'"
132$ endif
133$!
134$ @stage_curl_install remove
135$ @stage_curl_install
136$!
137$! Move to the base directories
138$ set def [--]
139$ current_default = f$environment("DEFAULT")
140$ my_dir = f$parse(current_default,,,"DIRECTORY") - "[" - "<" - ">" - "]"
141$!
142$!
143$!
144$ source = "''default_dir'"
145$ src1 = "new_gnu:[usr.bin],"
146$ src2 = "new_gnu:[usr.include.curl],"
147$ src3 = "new_gnu:[usr.lib],"
148$ src4 = "new_gnu:[usr.lib.pkgconfig],"
149$ src5 = "new_gnu:[usr.share.man.man1],"
150$ src6 = "new_gnu:[usr.share.man.man3],"
151$ src7 = "new_gnu:[vms_src],"
152$ src8 = "new_gnu:[common_src],"
153$ src9 = "prj_root:[''my_dir'],prj_root:[''my_dir'.src]"
154$ gnu_src = src1 + src2 + src3 + src4 + src5 + src6 + src7 + src8 + src9
155$!
156$!
157$ base = ""
158$ if arch_name .eqs. "ALPHA" then base = "AXPVMS"
159$ if arch_name .eqs. "IA64" then base = "I64VMS"
160$ if arch_name .eqs. "VAX" then base = "VAXVMS"
161$!
162$ if base .eqs. "" then exit 44
163$!
164$ pcsi_option = "/option=noconfirm"
165$ if arch_code .eqs. "V"
166$ then
167$   pcsi_option = ""
168$ endif
169$!
170$!
171$product package 'product_name' -
172 /base='base' -
173 /producer='producer' -
174 /source='source' -
175 /destination=STAGE_ROOT:[KIT] -
176 /material=('gnu_src','source') -
177 /format=sequential 'pcsi_option'
178$!
179$!
180$! VAX can not do a compressed kit.
181$! ZIP -9 "-V" does a better job, so no reason to normally build a compressed
182$! kit.
183$!----------------------------------
184$if p1 .eqs. "COMPRESSED"
185$then
186$   if arch_code .nes. "V"
187$   then
188$       product copy /options=(novalidate, noconfirm) /format=compressed -
189        'product_name' -
190        /source=stage_root:[kit]/dest=stage_root:[kit] -
191        /version='version'/base='base'
192$   endif
193$endif
194$!
195$all_exit:
196$ set def 'default_dir'
197$ exit
198