This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Rewrite $. entry and switch to -> syntax
[perl5.git] / vos / build.cm
1 &begin_parameters
2      cpu       option(-processor)name,allow(mc68020,i80860,pa7100,pa8000),=mc68020
3      recompile switch(-recompile),=1
4      rebind    switch(-rebind),=1
5      tgt_mod   option(-target_module)module_name,='(current_module)'
6      version   option(-version)name,allow(alpha,ga),=ga
7      compiler  option(-compiler)name,allow(cc,gcc)=cc
8 &end_parameters
9 &echo command_lines
10 &
11 & This is a VOS command macro to build Perl 5 for the Stratus VOS
12 & operating system. You need to have the VOS POSIX.1 support
13 & loaded on your system. Change the following statement, if
14 & necessary, to assign the correct pathname of the directory that
15 & contains VOS POSIX.1 support.
16 &
17 &if &version& = alpha
18 &then &set_string POSIX >vos_ftp_site>pub>vos>alpha>posix
19 &else &set_string POSIX >system>posix_object_library
20 &
21 & See if the site has VOS POSIX.1 support loaded. If not, quit now.
22 &
23 &if ^ (exists &POSIX& -directory)
24 &then &do
25       &display_line build: VOS POSIX.1 support not found. &POSIX&
26       &return 1
27       &end
28 &
29 &if &cpu& = mc68020 & &version& = ga | &cpu& = i80860 & &version& = ga
30 &then &do
31       &display_line build: "-version ga" is incompatible with "-processor mc68020 or i80860"
32       &return 1
33       &end
34 &
35 & Set up the appropriate directory suffix for each architecture.
36 &
37 &if &cpu& = mc68020
38 &then &set_string obj ''
39 &if &cpu& = i80860
40 &then &set_string obj .860
41 &if &cpu& = pa7100
42 &then &set_string obj .7100
43 &if &cpu& = pa8000
44 &then &set_string obj .8000
45 &
46 &if &cpu& = mc68020
47 &then &set_string obj2 .68k
48 &else &set_string obj2 &obj&
49 &
50 &if &compiler& = cc
51 &then &do
52 &set_string cpu -processor &cpu&
53 &set_string s .obj
54 &end
55 &else &do
56 &set_string cpu ''
57 &set_string s .o
58 &end
59 &
60 & If requested, compile the source code.
61 &
62 &if &recompile& = 0
63 &then &goto CHECK_REBIND
64 &
65 &if &version& = alpha
66 &then !set_library_paths include << < &POSIX&>incl &+
67      (master_disk)>system>include_library
68 &else !set_library_paths include << < &+
69      (master_disk)>system>stcp>include_library &+
70      (master_disk)>system>include_library
71 &
72 &if (exists *.obj -link)
73 &then !unlink *.obj -no_ask -brief
74 &
75 & Suppress several harmless compiler warning and advice messages.
76 & Use -list -show_include all -show_macros both_ways when debugging.
77 &
78 &if &compiler& = cc
79 &then &set_string cflags '-O4 -D_POSIX_C_SOURCE=199506L -DPERL_CORE -u'
80 &else &set_string cflags '-O4 -D_POSIX_C_SOURCE=199506L -DPERL_CORE -c'
81 &
82 & The following is a work-around for stcp-1437,8,9
83 &
84 &if &version& = ga
85 &then &set_string cflags &cflags& -D_BSD_SOURCE
86 &
87 &if &compiler& = cc
88 &then &set_string diag -suppress_diag 2006 2064 2065
89 &else &set_string diag ''
90 &
91 & The following is a work-around for stcp-1570 and GCC.
92 &
93 &if &compiler& = gcc
94 &then &set_string diag &diag& -w
95 &
96 !&compiler& <<av.c &diag& &cpu& &cflags& -o av&s&
97 &if (command_status) ^= 0 &then &return
98 !&compiler& <<deb.c &diag& &cpu& &cflags& -o deb&s&
99 &if (command_status) ^= 0 &then &return
100 !&compiler& <<doio.c &diag& &cpu& &cflags& -o doio&s&
101 &if (command_status) ^= 0 &then &return
102 !&compiler& <<doop.c &diag& &cpu& &cflags& -o doop&s&
103 &if (command_status) ^= 0 &then &return
104 !&compiler& <<dump.c &diag& &cpu& &cflags& -o dump&s&
105 &if (command_status) ^= 0 &then &return
106 !&compiler& <<globals.c &diag& &cpu& &cflags& -o globals&s&
107 &if (command_status) ^= 0 &then &return
108 !&compiler& <<gv.c &diag& &cpu& &cflags& -o gv&s&
109 &if (command_status) ^= 0 &then &return
110 !&compiler& <<hv.c &diag& &cpu& &cflags& -o hv&s&
111 &if (command_status) ^= 0 &then &return
112 !&compiler& <<locale.c &diag& &cpu& &cflags& -o locale&s&
113 &if (command_status) ^= 0 &then &return
114 &   !&compiler& <<malloc.c &diag& &cpu& &cflags& -o malloc&s&
115 &   &if (command_status) ^= 0 &then &return
116 !&compiler& <<mg.c &diag& &cpu& &cflags& -o mg&s&
117 &if (command_status) ^= 0 &then &return
118 !&compiler& <<numeric.c &diag& &cpu& &cflags& -o numeric&s&
119 &if (command_status) ^= 0 &then &return
120 !&compiler& <<op.c &diag& &cpu& &cflags& -o op&s&
121 &if (command_status) ^= 0 &then &return
122 &
123 & We are essentially building miniperl for now. Until we
124 & get a POSIX shell on VOS we won't add any of the extensions.
125 &
126 & !link <<op.c opmini.c -delete
127 & &if (command_status) ^= 0 &then &return
128 & !&compiler& opmini.c &diag& &cpu& &cflags& -DPERL_EXTERNAL_GLOB -o opmini&s&
129 & &if (command_status) ^= 0 &then &return
130 & !unlink opmini.c
131 & &if (command_status) ^= 0 &then &return
132 &
133 !&compiler& <<perl.c &diag& &cpu& &cflags& -o perl&s& &+
134      -DARCHLIB="/system/ported/perl/lib/5.7&obj2&" &+
135      -DARCHLIB_EXP="/system/ported/perl/lib/5.7&obj2&" &+
136      -DSITEARCH="/system/ported/perl/lib/site/5.7&obj2&" &+
137      -DSITEARCH_EXP="/system/ported/perl/lib/site/5.7&obj2&"
138 &if (command_status) ^= 0 &then &return
139 !&compiler& <<perlapi.c &diag& &cpu& &cflags& -o perlapi&s&
140 &if (command_status) ^= 0 &then &return
141 !&compiler& <<perlio.c &diag& &cpu& &cflags& -o perlio&s&
142 &if (command_status) ^= 0 &then &return
143 !&compiler& <<perly.c &diag& &cpu& &cflags& -o perly&s&
144 &if (command_status) ^= 0 &then &return
145 & compiling pp.c for the PA-RISC hits compiler bug pcg-98; avoid it.
146 & The bug is fixed in VOS 14.1.0 and all later releases.
147 &if (index (string &cpu&) pa) > 0 & (module_info os_release) < 'VOS Release 14.1.0'
148 &then !&compiler& <<pp.c &diag& &cpu& &cflags& -no_schedule -o pp&s&
149 &else !&compiler& <<pp.c &diag& &cpu& &cflags& -o pp&s&
150 &if (command_status) ^= 0 &then &return
151 !&compiler& <<pp_ctl.c &diag& &cpu& &cflags& -o pp_ctl&s&
152 &if (command_status) ^= 0 &then &return
153 !&compiler& <<pp_hot.c &diag& &cpu& &cflags& -o pp_hot&s&
154 &if (command_status) ^= 0 &then &return
155 !&compiler& <<pp_pack.c &diag& &cpu& &cflags& -o pp_pack&s&
156 &if (command_status) ^= 0 &then &return
157 !&compiler& <<pp_sys.c &diag& &cpu& &cflags& -o pp_sys&s&
158 &if (command_status) ^= 0 &then &return
159 !&compiler& <<regcomp.c &diag& &cpu& &cflags& -o regcomp&s&
160 &if (command_status) ^= 0 &then &return
161 !&compiler& <<regexec.c &diag& &cpu& &cflags& -o regexec&s&
162 &if (command_status) ^= 0 &then &return
163 !&compiler& <<run.c &diag& &cpu& &cflags& -o run&s&
164 &if (command_status) ^= 0 &then &return
165 !&compiler& <<scope.c &diag& &cpu& &cflags& -o scope&s&
166 &if (command_status) ^= 0 &then &return
167 !&compiler& <<sv.c &diag& &cpu& &cflags& -o sv&s&
168 &if (command_status) ^= 0 &then &return
169 !&compiler& <<taint.c &diag& &cpu& &cflags& -o taint&s&
170 &if (command_status) ^= 0 &then &return
171 !&compiler& <<toke.c &diag& &cpu& &cflags& -o toke&s&
172 &if (command_status) ^= 0 &then &return
173 !&compiler& <<universal.c &diag& &cpu& &cflags& -o universal&s&
174 &if (command_status) ^= 0 &then &return
175 !&compiler& <<utf8.c &diag& &cpu& &cflags& -o utf8&s&
176 &if (command_status) ^= 0 &then &return
177 !&compiler& <<util.c &diag& &cpu& &cflags& -o util&s&
178 &if (command_status) ^= 0 &then &return
179 !&compiler& <<xsutils.c &diag& &cpu& &cflags& -o xsutils&s&
180 &if (command_status) ^= 0 &then &return
181 &if &version& = alpha
182 &then &do
183 !&compiler& <vos_dummies.c &cpu& -O4 -o vos_dummies&s&
184 &if (command_status) ^= 0 &then &return
185 &end
186 &
187 &if &compiler& = gcc
188 &then &do
189  !delete_file perl.a
190  !ar rc perl.a av.o deb.o doio.o doop.o dump.o globals.o gv.o hv.o mg.o &+
191  op.o perl.o perlapi.o perlio.o perly.o pp.o pp_ctl.o pp_hot.o pp_sys.o &+
192  regcomp.o regexec.o run.o scope.o sv.o taint.o toke.o universal.o utf8.o &+
193  util.o xsutils.o
194 &end
195 &else &do
196  !&compiler& <<miniperlmain.c &diag& &cpu& &cflags& -o miniperlmain&s&
197  &if (command_status) ^= 0 &then &return
198 &end
199 &
200 & If requested, bind the executable program module.
201 &
202 &label CHECK_REBIND
203 &if &rebind& = 0
204 &then &return
205 &
206 &if (exists -directory (master_disk)>system>tcp_os>object_library&obj2&)
207 &then &set_string tcp_objlib (master_disk)>system>tcp_os>object_library&obj2&
208 &else &set_string tcp_objlib (master_disk)>system>tcp_os>object_library
209 &
210 &if (exists -directory (master_disk)>system>stcp>object_library&obj2&)
211 &then &set_string stcp_objlib (master_disk)>system>stcp>object_library&obj2&
212 &else &set_string stcp_objlib (master_disk)>system>stcp>object_library
213 &
214 &if (exists -directory (master_disk)>system>object_library&obj2&)
215 &then &set_string objlib (master_disk)>system>object_library&obj2&
216 &else &set_string objlib (master_disk)>system>object_library
217 &
218 &if (exists -directory (master_disk)>system>c_object_library&obj2&)
219 &then &set_string c_objlib (master_disk)>system>c_object_library&obj2&
220 &else &set_string c_objlib (master_disk)>system>c_object_library
221 &
222 &if (exists -directory (master_disk)>system>posix_object_library&obj2&)
223 &then &set_string posix_objlib (master_disk)>system>posix_object_library&obj2&
224 &else &set_string posix_objlib (master_disk)>system>posix_object_library
225 &
226 &if &version& = alpha
227 &then !set_library_paths object . &tcp_objlib& &+
228      &POSIX&>c>sysv_runtime>obj&obj& &+
229      &POSIX&>c>runtime>obj&obj& &+
230      &c_objlib& &objlib&
231 &else !set_library_paths object . &stcp_objlib& &+
232      &stcp_objlib&>common &+
233      &stcp_objlib&>net &+
234      &stcp_objlib&>sbsd &+
235      &stcp_objlib&>socket &+
236      &posix_objlib&>bsd &+
237      &posix_objlib& &+
238      &c_objlib& &objlib&
239 &if &compiler& = gcc
240 &then &do
241  &set_string cflags (before &$cflags& -c)
242  !&compiler& <<miniperlmain.c perl.a &diag& &cpu& &cflags& -o perl.pm
243  &if (command_status) ^= 0 &then &return
244  !delete_file perl.a
245 &end
246 &else &do
247  &if &version& = alpha
248  &then !bind -control <perl.bind vos_dummies &+
249      &tcp_objlib&>tcp_runtime &tcp_objlib&>tcp_gethost &+
250      &cpu& -target_module &tgt_mod& -map
251  &else !bind -control <perl.bind &cpu& -target_module &tgt_mod& -map
252  &if (command_status) ^= 0 &then &return
253 &end
254 !delete_file *&s& -no_ask -brief
255 !unlink *&s& -no_ask -brief