2 # minimod.PL writes the contents of miniperlmain.c into the module
3 # ExtUtils::Miniperl for later perusal (when the perl source is
6 # It also writes the subroutine writemain(), which takes as its
7 # arguments module names that shall be statically linked into perl.
9 # Authors: Andreas Koenig <k@franz.ww.TU-Berlin.DE>, Tim Bunce
10 # <Tim.Bunce@ig.co.uk>
12 # Version 1.0, Feb 2nd 1995 by Andreas Koenig
17 # This File keeps the contents of miniperlmain.c.
19 # It was generated automatically by minimod.PL from the contents
20 # of miniperlmain.c. Don't edit this file!
22 # ANY CHANGES MADE HERE WILL BE LOST!
26 package ExtUtils::Miniperl;
29 @EXPORT = qw(&writemain);
34 open MINI, "miniperlmain.c";
36 last if /Do not delete this line--writemain depends on it/;
46 print unless /dXSUB_SYS/;
57 my($dl) = canon('/','DynaLoader');
61 my($pname) = canon('/', $_);
63 ($mname = $pname) =~ s!/!::!g;
64 ($cname = $pname) =~ s!/!__!g;
65 print "EXTERN_C void boot_${cname} (pTHX_ CV* cv);\n";
68 my ($tail1,$tail2) = ( $tail =~ /\A(.*\n)(\s*\}.*)\Z/s );
71 print "\tconst char file[] = __FILE__;\n";
72 print "\tdXSUB_SYS;\n" if $] > 5.002;
75 my($pname) = canon('/', $_);
76 my($mname, $cname, $ccode);
77 ($mname = $pname) =~ s!/!::!g;
78 ($cname = $pname) =~ s!/!__!g;
81 # Must NOT install 'DynaLoader::boot_DynaLoader' as 'bootstrap'!
82 # boot_DynaLoader is called directly in DynaLoader.pm
83 $ccode = "\t/* DynaLoader is a special case */\n
84 \tnewXS(\"${mname}::boot_${cname}\", boot_${cname}, file);\n";
85 print $ccode unless $SEEN{$ccode}++;
87 $ccode = "\tnewXS(\"${mname}::bootstrap\", boot_${cname}, file);\n";
88 print $ccode unless $SEEN{$ccode}++;
98 # might be X::Y or lib/auto/X/Y/Y.a
100 s:^(lib|ext)/(auto/)?::;
103 grep(s:/:$as:, @ext) if ($as ne '/');
112 ExtUtils::Miniperl, writemain - write the C code for perlmain.c
116 C<use ExtUtils::Miniperl;>
118 C<writemain(@directories);>
122 This whole module is written when perl itself is built from a script
123 called minimod.PL. In case you want to patch it, please patch
124 minimod.PL in the perl distribution instead.
126 writemain() takes an argument list of directories containing archive
127 libraries that relate to perl modules and should be linked into a new
128 perl binary. It writes to STDOUT a corresponding perlmain.c file that
129 is a plain C file containing all the bootstrap code to make the
130 modules associated with the libraries available from within perl.
132 The typical usage is from within a Makefile generated by
133 ExtUtils::MakeMaker. So under normal circumstances you won't have to
134 deal with this module directly.
138 L<ExtUtils::MakeMaker>