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