1$! File: stage_curl_install.com
2$!
3$! $Id$
4$!
5$! This updates or removes the GNV$CURL.EXE and related files for the
6$! new_gnu:[*...] directory tree for running the self tests.
7$!
8$! The files installed/removed are:
9$!     [usr.bin]gnv$curl.exe
10$!     [usr.bin]curl-config.
11$!     [usr.lib]gnv$libcurl.exe
12$!     [usr.bin]curl. hard link for [usr.bin]gnv$curl.exe
13$!     [usr.include.curl]curl.h
14$!     [usr.include.curl]curlbuild.h
15$!     [usr.include.curl]curlrules.h
16$!     [usr.include.curl]curlver.h
17$!     [usr.include.curl]easy.h
18$!     [usr.include.curl]mprintf.h
19$!     [usr.include.curl]multi.h
20$!     [usr.include.curl]stdcheaders.h
21$!     [usr.include.curl]typecheck-gcc.h
22$!     [usr.lib.pkgconfig]libcurl.pc
23$!     [usr.share.man.man1]curl-config.1
24$!     [usr.share.man.man1]curl.1
25$!     [usr.share.man.man3]curl*.3
26$!     [usr.share.man.man3]libcurl*.3
27$! Future: A symbolic link to the release notes?
28$!
29$! Copyright 2012, John Malmberg
30$!
31$! Permission to use, copy, modify, and/or distribute this software for any
32$! purpose with or without fee is hereby granted, provided that the above
33$! copyright notice and this permission notice appear in all copies.
34$!
35$! THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
36$! WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
37$! MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
38$! ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
39$! WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
40$! ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
41$! OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
42$!
43$!
44$! 20-Aug-2012  J. Malmberg
45$!
46$!===========================================================================
47$!
48$ arch_type = f$getsyi("ARCH_NAME")
49$ arch_code = f$extract(0, 1, arch_type)
50$!
51$ if arch_code .nes. "V"
52$ then
53$   set proc/parse=extended
54$ endif
55$!
56$!
57$! If the first parameter begins with "r" or "R" then this is to
58$! remove the files instead of installing them.
59$ remove_filesq = f$edit(p1, "upcase,trim")
60$ remove_filesq = f$extract(0, 1, remove_filesq)
61$ remove_files = 0
62$ if remove_filesq .eqs. "R" then remove_files = 1
63$!
64$!
65$! If we are staging files, make sure that the libcurl.pc and curl-config
66$! files are present.
67$ if remove_files .eq. 0
68$ then
69$   if f$search("[--]libcurl.pc") .eqs. ""
70$   then
71$       @build_libcurl_pc.com
72$   endif
73$   if f$search("[--]curl-config") .eqs. ""
74$   then
75$       @build_curl-config_script.com
76$   endif
77$ endif
78$!
79$!
80$! Dest dirs
81$!------------------
82$ dest_dirs1 = "[usr],[usr.bin],[usr.include],[usr.include.curl]"
83$ dest_dirs2 = ",[usr.bin],[usr.lib.pkgconfig],[usr.share]"
84$ dest_dirs3 = ",[usr.share.man],[usr.share.man.man1],[usr.share.man.man3]"
85$ dest_dirs = dest_dirs1 + dest_dirs2 + dest_dirs3
86$!
87$!
88$!   Alias links needed.
89$!-------------------------
90$ source_curl = "gnv$curl.exe"
91$ dest_curl = "[bin]gnv$curl.exe"
92$ curl_links = "[bin]curl."
93$ new_gnu = "new_gnu:"
94$!
95$!
96$! Create the directories if they do not exist
97$!---------------------------------------------
98$ i = 0
99$curl_dir_loop:
100$   this_dir = f$element(i, ",", dest_dirs)
101$   i = i + 1
102$   if this_dir .eqs. "" then goto curl_dir_loop
103$   if this_dir .eqs. "," then goto curl_dir_loop_end
104$!  Just create the directories, do not delete them.
105$!  --------------------------------------------------
106$   if remove_files .eq. 0
107$   then
108$       create/dir 'new_gnu''this_dir'/prot=(o:rwed)
109$   endif
110$   goto curl_dir_loop
111$curl_dir_loop_end:
112$!
113$!
114$! Need to add in the executable file
115$!-----------------------------------
116$ if remove_files .eq. 0
117$ then
118$   copy [--.src]curl.exe 'new_gnu'[usr.bin]gnv$curl.exe/prot=w:re
119$   copy [--]curl-config. 'new_gnu'[usr.bin]curl-config./prot=w:re
120$   copy sys$disk:[]gnv$libcurl.exe 'new_gnu'[usr.lib]gnv$libcurl.exe/prot=w:re
121$ endif
122$!
123$ if remove_files .eq. 0
124$ then
125$   set file/enter='new_gnu'[bin]curl. 'new_gnu'[usr.bin]gnv$curl.exe
126$ else
127$   file = "''new_gnu'[bin]curl."
128$   if f$search(file) .nes. "" then set file/remove 'file';*
129$ endif
130$!
131$!
132$ if remove_files .eq. 0
133$ then
134$   copy [--.include.curl]curl.h 'new_gnu'[usr.include.curl]curl.h
135$   copy [--.include.curl]curlbuild.h -
136         'new_gnu'[usr.include.curl]curlbuild.h
137$   copy [--.include.curl]curlrules.h -
138         'new_gnu'[usr.include.curl]curlrules.h
139$   copy [--.include.curl]curlver.h -
140         'new_gnu'[usr.include.curl]curlver.h
141$   copy [--.include.curl]easy.h -
142         'new_gnu'[usr.include.curl]easy.h
143$   copy [--.include.curl]mprintf.h -
144         'new_gnu'[usr.include.curl]mprintf.h
145$   copy [--.include.curl]multi.h -
146         'new_gnu'[usr.include.curl]multi.h
147$   copy [--.include.curl]stdcheaders.h -
148         'new_gnu'[usr.include.curl]stdcheaders.h
149$   copy [--.include.curl]typecheck-gcc.h -
150         'new_gnu'[usr.include.curl]typecheck-gcc.h
151$   copy [--]libcurl.pc 'new_gnu'[usr.lib.pkgconfig]libcurl.pc
152$!
153$   copy [--.docs]curl-config.1 'new_gnu'[usr.share.man.man1]curl-config.1
154$   copy [--.docs]curl.1 'new_gnu'[usr.share.man.man1]curl.1
155$!
156$   copy [--.docs.libcurl]*.3 -
157         'new_gnu'[usr.share.man.man3]*.3
158$!
159$ else
160$   file = "''new_gnu'[usr.bin]curl-config."
161$   if f$search(file) .nes. "" then delete 'file';*
162$   file = "''new_gnu'[usr.bin]gnv$curl.exe"
163$   if f$search(file) .nes. "" then delete 'file';*
164$   file = "''new_gnu'[usr.lib]gnv$libcurl.exe"
165$   if f$search(file) .nes. "" then delete 'file';*
166$   file = "''new_gnu'[usr.include.curl]*.h"
167$   if f$search(file) .nes. "" then delete 'file';*
168$   file = "''new_gnu'[usr.share.man.man1]curl-config.1"
169$   if f$search(file) .nes. "" then delete 'file';*
170$   file = "''new_gnu'[usr.share.man.man1]curl.1"
171$   if f$search(file) .nes. "" then delete 'file';*
172$   file = "''new_gnu'[usr.share.man.man3]curl*.3"
173$   if f$search(file) .nes. "" then delete 'file';*
174$   file = "''new_gnu'[usr.share.man.man3]libcurl*.3"
175$   if f$search(file) .nes. "" then delete 'file';*
176$ endif
177$!
178