summaryrefslogtreecommitdiff
path: root/vms/stage_gawk_install.com
blob: 22daf7f54bf3aedb09fad778298b5764119c18aa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
$! File: stage_gawk_install.com
$!
$! Stages the build products to new_gnu:[...] for testing and for building
$! a kit.
$!
$! If p1 starts with "R" then remove instead of install.
$!
$! The file PCSI_GAWK_FILE_LIST.TXT is read in to get the files other
$! than the release notes file and the source backup file.
$!
$! The PCSI system can really only handle ODS-2 format filenames and
$! assumes that there is only one source directory.  It also assumes that
$! all destination files with the same name come from the same source file.
$!
$!
$! 29-Sep-2013  J. Malmberg
$!
$!===========================================================================
$!
$ arch_type = f$getsyi("ARCH_NAME")
$ arch_code = f$extract(0, 1, arch_type)
$!
$ mode = "install"
$ code = f$extract(0, 1, p1)
$ if code .eqs. "R" .or. code .eqs. "r" then mode = "remove"
$!
$!  First create the directories
$!--------------------------------
$ if mode .eqs. "install"
$ then
$   create/dir new_gnu:[bin]/prot=o:rwed
$   create/dir new_gnu:[vms_bin]/prot=o:rwed
$   create/dir new_gnu:[vms_help]/prot=o:rwed
$   create/dir new_gnu:[lib]/prot=o:rwed
$   create/dir new_gnu:[usr.bin]/prot=o:rwed
$   create/dir new_gnu:[usr.include]/prot=o:rwed
$   create/dir new_gnu:[usr.lib.gawk]/prot=o:rwed
$   create/dir new_gnu:[usr.share.awk]/prot=o:rwed
$   create/dir new_gnu:[usr.share.doc.gawk]/prot=o:rwed
$   create/dir new_gnu:[usr.share.info]/prot=o:rwed
$   create/dir new_gnu:[usr.src.gawk.extension.vms]/prot=o:rwed
$   create/dir new_gnu:[usr.share.doc.man.man1]/prot=o:rwed
$ endif
$!
$ if mode .eqs. "install"
$ then
$    copy [.vms]gnv_gawk_startup.com -
         new_gnu:[vms_bin]gnv$gawk_startup.com
$ else
$    file = "new_gnu:[vms_bin]gnv$gawk_startup.com"
$    if f$search(file) .nes. "" then delete 'file';*
$ endif
$!
$!
$!   Read through the file list to set up aliases and rename commands.
$!---------------------------------------------------------------------
$ open/read flst [.vms]pcsi_gawk_file_list.txt
$!
$inst_alias_loop:
$   ! Skip the aliases
$   read/end=inst_file_loop_end flst line_in
$   line_in = f$edit(line_in,"compress,trim,uncomment")
$   if line_in .eqs. "" then goto inst_alias_loop
$   pathname = f$element(0, " ", line_in)
$   linkflag = f$element(1, " ", line_in)
$   if linkflag .nes. "->" then goto inst_alias_done
$   goto inst_alias_loop
$!
$inst_file_loop:
$!
$   read/end=inst_file_loop_end flst line_in
$   line_in = f$edit(line_in,"compress,trim,uncomment")
$   if line_in .eqs. "" then goto inst_file_loop
$!
$inst_alias_done:
$!
$!
$!   Skip the directories as we did them above.
$!   Just process the files.
$   tdir = f$parse(line_in,,,"DIRECTORY")
$   tdir_len = f$length(tdir)
$   tname = f$parse(line_in,,,"NAME")
$   lctname = f$edit(tname, "LOWERCASE")
$   ttype = f$parse(line_in,,,"TYPE")
$   if arch_code .eqs. "V"
$   then
$       tname = lctname
$       ttype = f$edit(ttype, "LOWERCASE")
$       tdir = f$edit(tdir, "LOWERCASE")
$   endif
$   if tname .eqs. "" then goto inst_file_loop
$   if ttype .eqs. ".dir" then goto inst_file_loop
$!
$!   if p1 starts with "R" then remove instead of install.
$!
$!   If gnv$xxx.exe, then:
$!       Source is []gnv$gawk.exe
$!       Destination1 is new_gnu:[bin]gnv$gawk.exe
$!       Destination2 is new_gnu:[bin]xxx.  (alias)
$!       Destination2 is new_gnu:[bin]xxx.exe  (alias)
$!       We put all in new_gnu:[bin] instead of some in [usr.bin] because
$!       older GNV kits incorrectly put some images in [bin] and [bin]
$!       comes first in the search list.
$   if f$locate("gnv$", tname) .eq. 0
$   then
$       myfile_len = f$length(tname)
$       myfile = f$extract(4, myfile_len, tname)
$       source = "[]''myfile'''ttype'"
$       dest1 = "new_gnu:[bin]''tname'''ttype'"
$       dest2 = "new_gnu:[bin]''myfile'."
$       dest3 = "new_gnu:[bin]''myfile'.exe"
$       if mode .eqs. "install"
$       then
$           if f$search(dest1) .eqs. "" then copy 'source' 'dest1'
$           if f$search(dest2) .eqs. "" then set file/enter='dest2' 'dest1'
$           if f$search(dest3) .eqs. "" then set file/enter='dest3' 'dest1'
$       else
$           if f$search(dest2) .nes. "" then set file/remove 'dest2';*
$           if f$search(dest3) .nes. "" then set file/remove 'dest3';*
$           if f$search(dest1) .nes. "" then delete 'dest1';*
$       endif
$       goto inst_file_loop
$   endif
$!
$!   If lib.gawk] then
$!       source is sys$disk:[]
$!       dest is new_gnu:[usr.lib.gawk]
$    if f$locate("lib.gawk]", tdir) .lt. tdir_len
$    then
$!       ! Not yet available on VAX/VMS
$        if arch_code .eqs. "V" then goto inst_file_loop
$!
$        source = "[]''tname'''ttype'"
$        dest = "new_gnu:[usr.lib.gawk]''tname'''ttype'"
$        if mode .eqs. "install"
$        then
$            if f$search(dest) .eqs. "" then copy 'source' 'dest'
$        else
$            if f$search(dest) .nes. "" then delete 'dest';*
$        endif
$        goto inst_file_loop
$    endif
$!
$!   If .vms_bin] then
$!       source is sys$disk:[]
$!       dest is [vms_bin]
$   if (f$locate("vms_bin]", tdir) .lt. tdir_len)
$   then
$       if (ttype .eqs. ".cld")
$       then
$           source = "sys$disk:[]''tname'''ttype'"
$       else
$           source = "sys$disk:[.vms]''tname'''ttype'"
$       endif
$       dest = "new_gnu:[vms_bin]''tname'''ttype'"
$       if mode .eqs. "install"
$       then
$           if f$search(dest) .eqs. "" then copy 'source' 'dest'
$       else
$           if f$search(dest) .nes. "" then delete 'dest';*
$       endif
$       goto inst_file_loop
$   endif
$!
$!   If .vms_hlp] then
$!       source is sys$disk:[.vms]
$!       dest is [vms_help]
$   if (f$locate("vms_help]", tdir) .lt. tdir_len) .and. (ttype .eqs. ".hlp")
$   then
$       source = "sys$disk:[.vms]''tname'''ttype'"
$       dest = "new_gnu:[vms_help]''tname'''ttype'"
$       if mode .eqs. "install"
$       then
$           if f$search(dest) .eqs. "" then copy 'source' 'dest'
$       else
$           if f$search(dest) .nes. "" then delete 'dest';*
$       endif
$       goto inst_file_loop
$   endif
$!
$!   If doc.gawk] then
$!       source is sys$disk:[] or [.readme_d]
$!       dest is [usr.share.doc.gawk]
$   if f$locate(".doc.gawk]", tdir) .lt. tdir_len
$   then
$       if lctname .eqs. "readme" .and. ttype .nes. "."
$       then
$           source = "sys$disk:[.README_D]''tname'''ttype'"
$           if f$search(source) .eqs. ""
$           then
$!              ! This may be an NFS mangled name on VAX.
$               stype = ttype - "."
$               if stype .nes. "vms" then stype = "$" + stype
$               source = "sys$disk:[.$README_$D]$README.''stype'"
$           endif
$       else
$           source = "sys$disk:[]''tname'''ttype'"
$           if f$search(source) .eqs. ""
$           then
$               source = "sys$disk:[]$''tname'''ttype'"
$           endif
$       endif
$       dest = "new_gnu:[usr.share.doc.gawk]''tname'''ttype'"
$       if mode .eqs. "install"
$       then
$           if f$search(dest) .eqs. "" then copy 'source' 'dest'
$       else
$           if f$search(dest) .nes. "" then delete 'dest';*
$       endif
$       goto inst_file_loop
$   endif
$!
$!   If .awk] then
$!       source is sys$disk:[.awklib.eg.lib]
$!       dest is new_gnu:[usr.share.awk]
$    if f$locate(".awk]", tdir) .lt. tdir_len
$    then
$        source = "[.awklib.eg.lib]''tname'''ttype'"
$        dest = "new_gnu:[usr.share.awk]''tname'''ttype'"
$        if mode .eqs. "install"
$        then
$            if f$search(dest) .eqs. "" then copy 'source' 'dest'
$        else
$            if f$search(dest) .nes. "" then delete 'dest';*
$        endif
$        goto inst_file_loop
$    endif
$!
$!   If *.info then
$!       source is [.doc]gawk.info
$!       dest is [.usr.share.info]
$    if ttype .eqs. ".info"
$    then
$        source = "[.doc]''tname'''ttype'"
$        dest = "new_gnu:[usr.share.info]''tname'''ttype'"
$        if mode .eqs. "install"
$        then
$            if f$search(dest) .eqs. "" then copy 'source' 'dest'
$        else
$            if f$search(dest) .nes. "" then delete 'dest';*
$        endif
$        goto inst_file_loop
$    endif
$!
$!   If *.h then
$!       source is []*.h
$!       dest is [.usr.include]
$    if ttype .eqs. ".h"
$    then
$        source = "[]''tname'''ttype'"
$        dest = "new_gnu:[usr.include]''tname'''ttype'"
$        if mode .eqs. "install"
$        then
$            if f$search(dest) .eqs. "" then copy 'source' 'dest'
$        else
$            if f$search(dest) .nes. "" then delete 'dest';*
$        endif
$        goto inst_file_loop
$    endif
$!
$!   If *.opt then
$!       source is [.vms]gawk_plugin.opt
$!       dest is [.usr.src.gawk.extension.vms]
$    if ttype .eqs. ".opt"
$    then
$        source = "[.vms]''tname'''ttype'"
$        dest = "new_gnu:[usr.src.gawk.extension.vms]''tname'''ttype'"
$        if mode .eqs. "install"
$        then
$            if f$search(dest) .eqs. "" then copy 'source' 'dest'
$        else
$            if f$search(dest) .nes. "" then delete 'dest';*
$        endif
$        goto inst_file_loop
$    endif
$!
$!   If xxx.1 then
$!       source is [.doc]xxx.1
$!       dest is [usr.share.man.man1]
$    if ttype .eqs. ".1"
$    then
$        source = "[.doc]''tname'''ttype'"
$        dest = "new_gnu:[usr.share.man.man1]''tname'''ttype'"
$        if mode .eqs. "install"
$        then
$            if f$search(dest) .eqs. "" then copy 'source' 'dest'
$        else
$            if f$search(dest) .nes. "" then delete 'dest';*
$        endif
$        goto inst_file_loop
$    endif
$!
$    goto inst_file_loop
$!
$inst_file_loop_end:
$!
$close flst
$!
$all_exit:
$   exit