ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/App-Staticperl/mkbundle
(Generate patch)

Comparing App-Staticperl/mkbundle (file contents):
Revision 1.17 by root, Wed Feb 9 09:52:27 2011 UTC vs.
Revision 1.19 by root, Thu Feb 10 08:58:36 2011 UTC

266} 266}
267 267
268############################################################################# 268#############################################################################
269 269
270sub cmd_boot { 270sub cmd_boot {
271 $pm{"//boot"} = $_[0]; 271 $pm{"&&boot"} = $_[0];
272} 272}
273 273
274sub cmd_add { 274sub cmd_add {
275 $_[0] =~ /^(.*)(?:\s+(\S+))$/ 275 $_[0] =~ /^(.*)(?:\s+(\S+))$/
276 or die "$_[0]: cannot parse"; 276 or die "$_[0]: cannot parse";
277 277
278 my $file = $1; 278 my $file = $1;
279 my $as = defined $2 ? $2 : "/$1"; 279 my $as = defined $2 ? $2 : "&$1";
280 280
281 $pm{$as} = $file; 281 $pm{$as} = $file;
282 $pmbin{$as} = 1 if $_[1]; 282 $pmbin{$as} = 1 if $_[1];
283} 283}
284 284
729#include <XSUB.h> 729#include <XSUB.h>
730 730
731/* public API */ 731/* public API */
732EXTERN_C PerlInterpreter *staticperl; 732EXTERN_C PerlInterpreter *staticperl;
733EXTERN_C void staticperl_xs_init (pTHX); 733EXTERN_C void staticperl_xs_init (pTHX);
734EXTERN_C void staticperl_init (void); 734EXTERN_C void staticperl_init (XSINIT_t xs_init); /* argument can be 0 */
735EXTERN_C void staticperl_cleanup (void); 735EXTERN_C void staticperl_cleanup (void);
736 736
737EOF 737EOF
738} 738}
739 739
808 $fh 808 $fh
809 }; 809 };
810} 810}
811'; 811';
812 812
813$bootstrap .= "require '//boot';" 813$bootstrap .= "require '&&boot';"
814 if exists $pm{"//boot"}; 814 if exists $pm{"&&boot"};
815 815
816$bootstrap =~ s/\s+/ /g; 816$bootstrap =~ s/\s+/ /g;
817$bootstrap =~ s/(\W) /$1/g; 817$bootstrap =~ s/(\W) /$1/g;
818$bootstrap =~ s/ (\W)/$1/g; 818$bootstrap =~ s/ (\W)/$1/g;
819 819
939 print $fh " newXS (\"$pname\::$bootstrap\", boot_$cname, file);\n"; 939 print $fh " newXS (\"$pname\::$bootstrap\", boot_$cname, file);\n";
940} 940}
941 941
942print $fh <<EOF; 942print $fh <<EOF;
943 Perl_av_create_and_unshift_one (&PL_preambleav, newSVpv (bootstrap, sizeof (bootstrap) - 1)); 943 Perl_av_create_and_unshift_one (&PL_preambleav, newSVpv (bootstrap, sizeof (bootstrap) - 1));
944
945 if (PL_oldname)
946 ((XSINIT_t)PL_oldname)(aTHX);
944} 947}
945EOF 948EOF
946 949
947############################################################################# 950#############################################################################
948# optional perl_init/perl_destroy 951# optional perl_init/perl_destroy
1011EOF 1014EOF
1012} else { 1015} else {
1013 print $fh <<EOF; 1016 print $fh <<EOF;
1014 1017
1015EXTERN_C void 1018EXTERN_C void
1016staticperl_init (void) 1019staticperl_init (XSINIT_t xs_init)
1017{ 1020{
1018 static char *args[] = { 1021 static char *args[] = {
1019 "staticperl", 1022 "staticperl",
1020 "-e", 1023 "-e",
1021 "0" 1024 "0"
1028 PERL_SYS_INIT3 (&argc, &argv, &environ); 1031 PERL_SYS_INIT3 (&argc, &argv, &environ);
1029 staticperl = perl_alloc (); 1032 staticperl = perl_alloc ();
1030 perl_construct (staticperl); 1033 perl_construct (staticperl);
1031 PL_origalen = 1; 1034 PL_origalen = 1;
1032 PL_exit_flags |= PERL_EXIT_DESTRUCT_END; 1035 PL_exit_flags |= PERL_EXIT_DESTRUCT_END;
1036 PL_oldname = (char *)xs_init;
1033 perl_parse (staticperl, staticperl_xs_init, argc, argv, environ); 1037 perl_parse (staticperl, staticperl_xs_init, argc, argv, environ);
1034 1038
1035 perl_run (staticperl); 1039 perl_run (staticperl);
1036} 1040}
1037 1041

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines