3 # Create perlmain.c from miniperlmain.c, adding code to boot the
4 # extensions listed on the command line. In addition, create a
5 # linker options file which causes the bootstrap routines for
6 # these extension to be universal symbols in PerlShr.Exe.
8 # Last modified 29-Nov-1994 by Charles Bailey bailey@genetics.upenn.edu
11 if (-f 'miniperlmain.c') { $dir = ''; }
12 elsif (-f '../miniperlmain.c') { $dir = '../'; }
13 else { die "$0: Can't find miniperlmain.c\n"; }
15 open (IN,"${dir}miniperlmain.c")
16 || die "$0: Can't open ${dir}miniperlmain.c: $!\n";
17 open (OUT,">${dir}perlmain.c")
18 || die "$0: Can't open ${dir}perlmain.c: $!\n";
22 last if /Do not delete this line--writemain depends on it/;
29 unlink "${dir}perlmain.c";
30 die "$0: Can't find marker line in ${dir}miniperlmain.c - aborting\n";
43 $names = join(' ',@ARGV);
44 $names =~ tr/"//d; # Plan9 doesn't remove "" on command line
45 # Allow for multiple names in one quoted group
46 @exts = split(/\s+/,$names);
50 print OUT " char *file = __FILE__;\n";
51 foreach $ext (@exts) {
53 $subname =~ s/::/__/g;
54 print OUT "extern void boot_${subname} _((CV* cv));\n"
56 foreach $ext (@exts) {
58 $subname =~ s/::/__/g;
59 print "Adding $ext . . .\n";
60 if ($ext eq 'DynaLoader') {
61 # Must NOT install 'DynaLoader::boot_DynaLoader' as 'bootstrap'!
62 # boot_DynaLoader is called directly in DynaLoader.pm
63 print OUT " newXS(\"${ext}::boot_${ext}\", boot_${subname}, file);\n"
66 print OUT " newXS(\"${ext}::bootstrap\", boot_${subname}, file);\n"