This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
perl5337delta: note that stadtx was removed
[perl5.git] / plan9 / mkfile
1 APE=/sys/src/ape
2 < $APE/config
3 <plan9/buildinfo
4 archname = plan9_$objtype
5 privroot = /sys/lib/perl
6 privlib  = $privroot/$p9pvers
7 archroot = /$objtype/lib/perl
8 archlib  = $archroot/$p9pvers
9 sitelib  = $privlib/site_perl
10 sitearch = $archlib/site_perl
11 corelib  = $archlib/CORE
12 arpalib  = $corelib/arpa
13
14 pwd=`{pwd}
15 cpanlib=`{cd cpan; ls -ld * | grep '^d' | awk '{ print $10 }' | grep -v '^\.'}
16 icpanlib=`{echo $pwd^/cpan/^$cpanlib^/lib}
17 distlib=`{cd dist; ls -ld * | grep '^d' | awk '{ print $10 }' | grep -v '^\.'}
18 idistlib=`{echo $pwd^/dist/^$distlib $pwd^/dist/^$distlib^/lib }
19 extlib=`{cd ext; ls -ld * | grep '^d' | awk '{ print $10 }' | grep -v '^\.'}
20 iextlib=`{echo $pwd^/ext/^$extlib $pwd^/ext/^$extlib/lib }
21
22 buildlibs=`{echo -I$pwd^/^(lib archlib privlib) -I^$icpanlib -I^$idistlib -I^$iextlib }
23 miniperl=`{echo $pwd/miniperl $buildlibs }
24 perl=`{echo $pwd/perl $buildlibs }
25 xscmd=`{echo $pwd/dist/ExtUtils-ParseXS/lib/ExtUtils/xsubpp -noprototypes -typemap $pwd/dist/ExtUtils-ParseXS/t/typemap}
26 miniperlxs=`{echo $miniperl $xscmd}
27 perlxs=`{echo $perl $xscmd}
28
29 BASECFLAGS=-B -D_SUSV2_SOURCE -D_POSIX_SOURCE -D_BSD_EXTENSION
30 PERLCFLAGS =-DPERL_CORE $BASECFLAGS
31 CFLAGS=-DPERL_IS_MINIPERL $PERLCFLAGS
32
33 CCCMD = $CC  -c $CFLAGS
34 PERLCCCMD= $CC -c $PERLCFLAGS
35 XSCCCMD= $CC -c $BASECFLAGS
36
37 perllib = archlib/CORE/libperl.a
38
39 perlshr = archlib/CORE/libperlshr.a
40
41 installman1dir = /sys/man/1
42 installman3dir = /sys/man/2
43
44 podnames = perl perlbook perldata perldebtut perldiag perldsc perlform perlfunc perlipc perllexwarn perllol perlmod perlmodlib perlmodinstall perlnewmod perlop perlootut perlopentut perlpacktut perlpod perlport perlrequick perlretut perlref perlreftut perlrequick perlrun perlsec perlstyle perlsub perlsyn perltie perltrap perlutil perlunifaq perluniintro perlvar
45 faqpodnames = perlfaq perlfaq1 perlfaq2 perlfaq3 perlfaq4 perlfaq5 perlfaq6 perlfaq7 perlfaq8 perlfaq9
46 advpodnames = perlapi perlapio perlcall perlclib perlcompile perldebguts perldbmfilter perldebug perldelta perldiag perlebcdic perlembed perlfilter perlfork perlguts perlhack perlintern perliol perllocale perlnumber perlobj perlpodspec perlre perlthrtut perltodo perlunicode perlunicook perlxs perlxs perlxstut
47 archpodnames = perlaix perlamiga perlbeos perlbs2000 perlce perlcygwin perldgux perldos perlfreebsd perlhpux perlhurd perlirix perlmacos perlmpeix perlnetware perlos2 perlos390 perlos400 perlplan9 perlqnx perlsolaris perltru64 perlvms perlvos perlwin32
48 histpodnames = perl5004delta perl5005delta perl561delta perl56delta perl570delta perl571delta perl572delta perl573delta perl58delta perlhist
49
50 libpods = ${podnames:%=pod/%.pod}
51
52 perlpods = $libpods
53
54 extensions = File::Glob IO Opcode DynaLoader Fcntl POSIX Cwd re B Devel::Peek attributes Hash::Util Hash::Util::FieldHash mro Storable Time::HiRes Unicode::Normalize List::Util
55 ext_xs = Glob.xs IO.xs Opcode.xs  dl_none.xs Fcntl.xs POSIX.xs Cwd.xs re.xs B.xs Peek.xs attributes.xs Util.xs FieldHash.xs mro.xs Storable.xs HiRes.xs Normalize.xs ListUtil.xs
56 ext_c = ${ext_xs:%.xs=%.c}
57 ext_obj = ${ext_xs:%.xs=%.$O} bsd_glob.$O poll.$O re_comp.$O re_exec.$O
58
59 # Socket requires a full version of Perl (one with IO to build).
60 more_extensions = Socket Data::Dumper
61 more_ext_xs = Socket.xs Dumper.xs
62 more_ext_c = ${more_ext_xs:%.xs=%.c}
63 more_ext_obj = ${more_ext_xs:%.xs=%.$O}
64
65 obj = av.$O caretx.$O deb.$O doio.$O doop.$O dquote.$O dump.$O globals.$O gv.$O hv.$O keywords.$O locale.$O malloc.$O mathoms.$O mg.$O mro_core.$O numeric.$O op.$O pad.$O perlapi.$O perlio.$O perly.$O pp.$O pp_ctl.$O pp_hot.$O pp_pack.$O pp_sort.$O pp_sys.$O reentr.$O regcomp.$O regexec.$O run.$O scope.$O sv.$O taint.$O time64.$O toke.$O universal.$O utf8.$O util.$O
66
67 OBJS = perl.$O plan9.$O $obj
68
69 # TODO: what's this used for?
70 testlist = `{cd t; echo base/*.t comp/*.t cmd/*.t run/*.t io/*.t re/*.t opbasic/*.t op/*.t uni/*.t perf/*.t}
71
72 install:V:      perl preplibrary 
73                 cp perl /$objtype/bin/perl-$p9pvers
74                 cp plan9/aperl /rc/bin/Perl-$p9pvers
75                 
76                 if (test ! -d $privroot) mkdir $privroot
77                 if (test ! -d $privlib) mkdir $privlib
78                 if (test ! -d $privlib/auto) mkdir $privlib/auto
79                 if (test ! -d $sitelib) mkdir $sitelib
80                 if (test ! -d $archroot) mkdir $archroot
81                 if (test ! -d $archlib) mkdir $archlib
82                 if (test ! -d $sitearch) mkdir $sitearch
83                 if (test ! -d $corelib) mkdir $corelib
84                 if (test ! -d $arpalib) mkdir $arpalib
85                 cp *.h plan9/*.h  $corelib
86                 cp plan9/arpa/*.h  $arpalib
87                 
88                 # Populate library directories
89                 {cd privlib ; tar c . } | {cd $privlib ; tar x }
90                 {cd lib ; tar c . } | {cd $privlib ; tar x }
91                 {cd archlib ; tar c . } | {cd $archlib ; tar x }
92                 # mk man # don't make man pages now--resolve multiversion
93                 
94 perl:   perlnosocket more_extensions
95                 $LD $PERLCFLAGS -o perl perlmain.$O perl.$O $perllib $perlshr $more_ext_obj
96
97 perlnosocket:           config.h miniperlmain.$O miniperl archlib/Config.pm perlmain.$O $perlshr
98                 $LD $PERLCFLAGS -o perl perlmain.$O perl.$O $perllib $perlshr
99                 
100 miniperl:       config.h $perllib miniperlmain.$O 
101                 $LD  $CFLAGS -o miniperl miniperlmain.$O  $perllib 
102
103 preplibrary:V:  miniperl archlib/Config.pm
104                         mkdir -p privlib/auto
105                         for (file in lib/*.pm lib/*/*.pm archlib/Config.pm) $miniperl -e 'use AutoSplit; autosplit(@ARGV)' $file privlib/auto
106         
107 $perllib(%):N:  %
108 $perllib: ${OBJS:%=$perllib(%)}
109                 mkdir -p archlib/CORE
110                 ar rv $perllib $OBJS
111                 $RANLIB $perllib
112                         
113 miniperlmain.$O:        config.h uudmap.h
114                                 $CCCMD miniperlmain.c
115
116 perlmain.$O:    config.h perlmain.c
117                         $PERLCCCMD perl.c
118                         $PERLCCCMD perlmain.c
119
120 malloc.$O: malloc.c
121                         # Does the PTRDIFF_MAX need to be set per architecture?
122                         $CCCMD -DPTRDIFF_MAX^'='^9223372036854775807L malloc.c
123
124 perlmain.c:     miniperl extensions archlib/Config.pm
125                         $miniperl -MExtUtils::Miniperl -e 'writemain(\q{perlmain.c}, @ARGV)' $extensions
126
127 config.h:               plan9/fndvers
128                         plan9/fndvers 
129                         mkdir -p archlib/CORE
130                         cp config.h archlib/CORE
131
132 $perlshr(%):N:  %
133 $perlshr:  ${ext_obj:%=$perlshr(%)}
134                 ar rv $perlshr $ext_obj
135                 $RANLIB $perlshr
136
137 uudmap.h:       generate_uudmap.c
138                         $CCCMD generate_uudmap.c
139                         # This is currently a show-stopper for cross-compilation: find the true $objtype by looking at kernel?
140                         $LD $CFLAGS -o generate_uudmap generate_uudmap.$O
141                         chmod +x generate_uudmap
142                         ./generate_uudmap uudmap.h bitcount.h mg_data.h
143
144 extensions:V: miniperl archlib/Config.pm $ext_c dist/XSLoader/XSLoader.pm
145
146 more_extensions:V: perlnosocket $more_ext_c $more_ext_obj
147                         ext_obj=`{echo $ext_obj $more_ext_obj}
148
149 Socket.$O: Socket.c
150                         $XSCCCMD -I plan9 Socket.c
151
152 attributes.$O: attributes.c
153                         $XSCCCMD -I plan9 attributes.c
154
155 mro.$O: mro.c
156                         $XSCCCMD -I plan9 mro.c
157
158 B.$O: B.c
159                         $XSCCCMD -I plan9 B.c
160
161 Peek.$O: Peek.c
162                         $XSCCCMD -I plan9 Peek.c
163
164 Util.$O: Util.c
165                         $XSCCCMD -I plan9 Util.c
166
167 FieldHash.$O: FieldHash.c
168                         $XSCCCMD -I plan9 FieldHash.c
169
170 re.$O: re.c
171                         $XSCCCMD -DPERL_EXT_RE_BUILD -DPERL_EXT_RE_DEBUG -DPERL_EXT -I plan9 re.c
172
173 re_comp.$O: re_comp.c
174                         $XSCCCMD -DPERL_EXT_RE_BUILD -DPERL_EXT_RE_DEBUG -DPERL_EXT -I plan9 re_comp.c
175
176 re_exec.$O: re_exec.c
177                         $XSCCCMD -DPERL_EXT_RE_BUILD -DPERL_EXT_RE_DEBUG -DPERL_EXT -I plan9 re_exec.c
178
179 Cwd.$O: Cwd.c IO.c
180                         cp dist/IO/ppport.h dist/PathTools
181                         $XSCCCMD -DDOUBLE_SLASHES_SPECIAL^'='^0 -I plan9 Cwd.c
182
183 IO.$O: extensions
184                         $XSCCCMD -I plan9 IO.c
185
186 poll.$O: extensions
187                         $XSCCCMD -I plan9 poll.c
188
189 POSIX.$O: extensions
190                         $XSCCCMD -I plan9 POSIX.c
191
192 Glob.$O: extensions
193                         $XSCCCMD -I plan9 Glob.c
194
195 bsd_glob.$O: extensions
196                         $XSCCCMD -I plan9 -I. bsd_glob.c
197
198 Normalize.$O:   extensions
199                         $XSCCCMD -I plan9 -I. Normalize.c
200
201 Dumper.$O:      Dumper.c
202                         $XSCCCMD -I plan9 -I. Dumper.c
203
204 HiRes.$O:       extensions
205                         $XSCCCMD -I plan9 -I. HiRes.c
206
207 Storable.$O:    extensions
208                         $XSCCCMD -I plan9 -I. Storable.c
209
210 ListUtil.$O:    extensions
211                         $XSCCCMD -I plan9 -I. ListUtil.c
212
213 Opcode.$O: extensions
214                         $XSCCCMD -I plan9 Opcode.c
215
216 Fcntl.$O: extensions
217                         $XSCCCMD -I plan9 Fcntl.c
218
219 dl_none.$O: extensions
220                         $XSCCCMD -I plan9 dl_none.c
221
222 Glob.c:         archlib/Config.pm       ext/File-Glob/Glob.xs
223                         cd ext/File-Glob
224                         $miniperl Makefile.PL # to write constants      
225                         cd $pwd
226                         $miniperlxs ext/File-Glob/Glob.xs > $target
227                         cp ext/File-Glob/bsd_glob.^(c h) $pwd
228                         mkdir -p archlib/File
229                         cp ext/File-Glob/Glob.pm archlib/File/Glob.pm
230
231 ppport.h:   archlib/Config.pm
232                         if (test ! -f /bin/sh) bind -a /386/bin/ape /bin
233                         # specify the list, otherwise suicide
234                         $miniperl mkppport --list mkppport.lst
235
236 Cwd.c:          archlib/Config.pm dist/PathTools/Cwd.xs
237                         $miniperlxs dist/PathTools/Cwd.xs > $target
238                         cp dist/PathTools/Cwd.pm archlib
239                         { cd dist/PathTools/lib; tar c . } | { mkdir -p archlib; cd archlib; tar x }
240
241 IO.c:           archlib/Config.pm dist/IO/IO.xs ppport.h
242                         $miniperlxs dist/IO/IO.xs > $target
243                         cp dist/IO/poll.^(c h) $pwd
244                         cp dist/IO/IO.pm archlib
245                         { cd dist/IO/lib; tar c . } | { mkdir -p archlib; cd archlib; tar x }
246
247 dist/XSLoader/XSLoader.pm:  archlib/Config.pm
248                         cd dist/XSLoader
249                         $miniperl XSLoader_pm.PL
250                         cp XSLoader.pm $pwd/archlib
251
252 ext/Errno/Errno.pm: perlnosocket        
253                         cd ext/Errno
254                         $perl Makefile.PL
255                         $perl Errno_pm.PL arch.txt
256                         cp Errno.pm $pwd/archlib
257                 
258 Socket.c:               perlnosocket cpan/Socket/Socket.xs ext/Errno/Errno.pm
259                         cd cpan/Socket
260                         $perl Makefile.PL # to write const-xs.inc
261                         cd $pwd
262                         $perlxs cpan/Socket/Socket.xs > $target
263                         cp cpan/Socket/Socket.pm archlib
264
265 uni.data:       archlib/Config.pm lib/unicore/mktables
266                         $miniperl lib/unicore/mktables -C lib/unicore -makelist -p
267
268 Normalize.c:            archlib/Config.pm dist/Unicode-Normalize/Normalize.xs uni.data
269                         $miniperl dist/Unicode-Normalize/mkheader
270                         $miniperlxs dist/Unicode-Normalize/Normalize.xs > $target
271                         mkdir -p archlib/Unicode
272                         cp dist/Unicode-Normalize/Normalize.pm archlib/Unicode
273
274 Dumper.c:               perlnosocket dist/Data-Dumper/Dumper.xs
275                         $perlxs dist/Data-Dumper/Dumper.xs > $target
276                         mkdir -p archlib/Data
277                         cp dist/Data-Dumper/Dumper.pm archlib/Data
278
279 HiRes.c:                archlib/Config.pm dist/Time-HiRes/HiRes.xs
280                         cd dist/Time-HiRes
281                         $miniperl Makefile.PL # to write const-xs.inc
282                         cd $pwd
283                         $miniperlxs dist/Time-HiRes/HiRes.xs > $target
284                         mkdir -p archlib/Time
285                         cp dist/Time-HiRes/HiRes.pm archlib/Time
286
287 ListUtil.c:             archlib/Config.pm cpan/Scalar-List-Utils/ListUtil.xs
288                         cp cpan/Scalar-List-Utils/multicall.h $pwd
289                         $miniperlxs cpan/Scalar-List-Utils/ListUtil.xs > $target
290                         { cd cpan/Scalar-List-Utils/lib; tar c . } | { mkdir -p archlib; cd archlib; tar x }
291
292 Storable.c:             archlib/Config.pm dist/Storable/Storable.xs
293                         $miniperlxs dist/Storable/Storable.xs > $target
294                         cp dist/Storable/Storable.pm archlib
295
296 Opcode.c:               archlib/Config.pm ext/Opcode/Opcode.xs
297                         $miniperlxs ext/Opcode/Opcode.xs > $target
298                         cp ext/Opcode/^(Opcode ops)^.pm archlib
299
300 Fcntl.c:                archlib/Config.pm ext/Fcntl/Fcntl.xs
301                         cd ext/Fcntl
302                         $miniperl Makefile.PL # to write const-xs.inc
303                         cd $pwd
304                         $miniperlxs ext/Fcntl/Fcntl.xs > $target
305                         cp ext/Fcntl/Fcntl.pm archlib
306
307 POSIX.c:                archlib/Config.pm ext/POSIX/POSIX.xs
308                         cd ext/POSIX
309                         $miniperl Makefile.PL # to write const-xs.inc
310                         cd $pwd
311                         $miniperlxs ext/POSIX/POSIX.xs > $target
312                         cp ext/POSIX/lib/POSIX.pm archlib
313
314 B.c:            archlib/Config.pm ext/B/B.xs
315                         cd ext/B
316                         $miniperl Makefile.PL PERL_CORE^'='^1 # to write const-xs.inc
317                         cd $pwd
318                         $miniperlxs ext/B/B.xs > $target
319                         cp ext/B/^(B O)^.pm archlib
320
321 Peek.c:         archlib/Config.pm ext/Devel-Peek/Peek.xs
322                         $miniperlxs ext/Devel-Peek/Peek.xs > $target
323                         cp ext/Devel-Peek/Peek.pm archlib
324
325 attributes.c:   archlib/Config.pm ext/attributes/attributes.xs
326                         $miniperlxs ext/attributes/attributes.xs > $target
327                         cp ext/attributes/attributes.pm archlib
328
329 mro.c:  archlib/Config.pm ext/mro/mro.xs
330                         $miniperlxs ext/mro/mro.xs > $target
331                         cp ext/mro/mro.pm archlib
332
333 Util.c: archlib/Config.pm ext/Hash-Util/Util.xs
334                         $miniperlxs ext/Hash-Util/Util.xs > $target
335                         { cd ext/Hash-Util/lib; tar c . } | { cd archlib; tar x }
336
337 FieldHash.c:    archlib/Config.pm ext/Hash-Util-FieldHash/FieldHash.xs
338                         $miniperlxs ext/Hash-Util-FieldHash/FieldHash.xs > $target
339                         { cd ext/Hash-Util-FieldHash/lib; tar c . } | { cd archlib; tar x }
340         
341 re.c:   archlib/Config.pm ext/re/re.xs
342                         $miniperlxs ext/re/re.xs > $target
343                         cp ext/re/re_^(comp top)^.h $pwd
344                         cp ext/re/re.pm archlib
345
346 re_comp.c:      miniperl re.c regcomp.c
347                         cp regcomp.c $target
348
349 re_exec.c:      miniperl re.c regexec.c
350                         cp regexec.c $target
351
352 dl_none.c:      archlib/Config.pm ext/DynaLoader/dl_none.xs
353                         cd ext/DynaLoader;
354                         $miniperl DynaLoader_pm.PL
355                         cd $pwd
356                         $miniperlxs ext/DynaLoader/dl_none.xs > $target
357                         cp ext/DynaLoader/DynaLoader.pm archlib
358
359 preptest:Q: perl
360                         # Bind the crap out of everything, as different tests expect different INCs
361                         cp perl t/perl
362                         cd t
363                         mntpt=/$objtype/lib/perl
364                         if (test ! -d $mntpt ) {
365                                 mkdir $mntpt
366                                 rmdir=1
367                         }
368                         ramfs -m $mntpt
369                         mkdir -p $mntpt/5.32.0/site_perl
370                         echo -n Binding directories
371                         for (l in $pwd/lib $pwd/archlib $icpanlib $idistlib $iextlib ) {
372                                 if (test -d $l ) {
373                                         if (! ~ `{grep $l <{ns} >[1]/dev/null; echo $status} '') bind -a $l $mntpt/5.32.0/site_perl
374                                         echo -n .
375                                 }
376                         }
377                         bind $mntpt/5.32.0/site_perl $pwd/lib
378                         echo done
379                         echo Binding sh
380                         if (! ~ `{grep /$objtype/bin/ape <{ns} >[1]/dev/null; echo $status} '') bind -a /$objtype/bin/ape /bin
381
382 minitest:V: preptest
383                         cd t
384                         perl TEST $testlist
385                         unmount $pwd/lib
386                         unmount $mntpt
387                         if (~ $rmdir 1) rm $mntpt
388                         rm t/perl
389
390 test:V: preptest
391                         cd t
392                         perl TEST `{ ls */*.t | comm -23 - ../plan9/exclude }
393                         unmount $pwd/lib
394                         unmount $mntpt
395                         if (~ $rmdir 1) rm $mntpt
396                         rm t/perl
397
398 plan9.$O:       config.h plan9/plan9.c
399                         cp plan9/plan9.c plan9.c
400                         $CCCMD plan9.c
401
402 %.$O:   config.h %.c
403                 $CCCMD $stem.c
404
405 archlib/Config.pm:              config.sh
406                                 $miniperl make_patchnum.pl
407                                 $miniperl configpm
408                                 cp lib/Config.pm archlib/Config.pm
409                                 cp lib/Config_heavy.pl archlib/Config_heavy.pl
410                                 cp lib/Config_git.pl archlib/Config_git.pl
411
412
413 config.sh:      miniperl
414                 miniperl plan9/genconfig.pl $extensions $more_extensions
415
416 installall:V:   
417                         for (386 68000 68020 arm arm amd64 mips power power64 sparc sparc64 spim) mk install
418
419 man:V:          $perlpods pod/pod2man.PL perl
420                         perl pod/pod2man.PL
421                         for (i in $podnames) pod/pod2man pod/$i.pod > $installman3dir/$i
422                         for (i in $faqpodnames) pod/pod2man pod/$i.pod > $installman3dir/$i
423                         for (i in $advpodnames) pod/pod2man pod/$i.pod > $installman3dir/$i
424                         for (i in $archpodnames) pod/pod2man pod/$i.pod > $installman3dir/$i
425                         for (i in $histpodnames) pod/pod2man pod/$i.pod > $installman3dir/$i
426                         
427 nuke clean:V:   
428                 rm -f *.$O config.sh $perllib config.h $perlshr perlmain.c perl miniperl git_version.h $ext_c $more_ext_c generate_uudmap uudmap.h bitcount.h mg_data.h plan9.c plan9ish.h math.h bsd_glob.^(c h) poll.^(c h) re_*.^(c h) uni.data multicall.h
429                 rm -rf privlib archlib
430
431 deleteman:V:
432                         rm -f $installman1dir/perl* $installman3dir/perl*