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

Comparing cvsroot/App-Staticperl/mkbundle (file contents):
Revision 1.29 by root, Sun Jul 10 01:37:56 2011 UTC vs.
Revision 1.35 by root, Fri Jan 17 18:06:43 2014 UTC

76 my $dir = find_incdir $_[1] 76 my $dir = find_incdir $_[1]
77 or return; 77 or return;
78 78
79 syswrite $W_TRACER, "-\n$dir\n$_[1]\n"; 79 syswrite $W_TRACER, "-\n$dir\n$_[1]\n";
80 80
81 open my $fh, "<:perlio", "$dir/$_[1]" 81 open my $fh, "<:raw:perlio", "$dir/$_[1]"
82 or warn "ERROR: $dir/$_[1]: $!\n"; 82 or warn "ERROR: $dir/$_[1]: $!\n";
83 83
84 $fh 84 $fh
85 }; 85 };
86 86
162 my ($variant, $src, $filter) = @_; 162 my ($variant, $src, $filter) = @_;
163 163
164 if (length $CACHE and 2048 <= length $src and defined $variant) { 164 if (length $CACHE and 2048 <= length $src and defined $variant) {
165 my $file = "$CACHE/" . Digest::MD5::md5_hex "$CACHEVER\x00$variant\x00$src"; 165 my $file = "$CACHE/" . Digest::MD5::md5_hex "$CACHEVER\x00$variant\x00$src";
166 166
167 if (open my $fh, "<:perlio", $file) { 167 if (open my $fh, "<:raw:perlio", $file) {
168 print "using cache for $file\n" 168 print "using cache for $file\n"
169 if $VERBOSE >= 7; 169 if $VERBOSE >= 7;
170 170
171 local $/; 171 local $/;
172 return <$fh>; 172 return <$fh>;
175 $src = $filter->($src); 175 $src = $filter->($src);
176 176
177 print "creating cache entry $file\n" 177 print "creating cache entry $file\n"
178 if $VERBOSE >= 8; 178 if $VERBOSE >= 8;
179 179
180 if (open my $fh, ">:perlio", "$file~") { 180 if (open my $fh, ">:raw:perlio", "$file~") {
181 if ((syswrite $fh, $src) == length $src) { 181 if ((syswrite $fh, $src) == length $src) {
182 close $fh; 182 close $fh;
183 rename "$file~", $file; 183 rename "$file~", $file;
184 } 184 }
185 } 185 }
563 or die "ERROR: $pm: path too long (only 128 octets supported)\n"; 563 or die "ERROR: $pm: path too long (only 128 octets supported)\n";
564 564
565 my $src = ref $path 565 my $src = ref $path
566 ? $$path 566 ? $$path
567 : do { 567 : do {
568 open my $pm, "<", $path 568 open my $pm, "<:raw:perlio", $path
569 or die "$path: $!"; 569 or die "$path: $!";
570 570
571 local $/; 571 local $/;
572 572
573 <$pm> 573 <$pm>
977 } 977 }
978 978
979 XSRETURN ($varpfx\_count); 979 XSRETURN ($varpfx\_count);
980} 980}
981 981
982#ifdef STATICPERL_BUNDLE_INCLUDE
983#include STATICPERL_BUNDLE_INCLUDE
984#endif
985
982EOF 986EOF
983 987
984############################################################################# 988#############################################################################
985# xs_init 989# xs_init
986 990
1003 char *file = __FILE__; 1007 char *file = __FILE__;
1004 dXSUB_SYS; 1008 dXSUB_SYS;
1005 1009
1006 newXSproto ("$PACKAGE\::find", find, file, "\$"); 1010 newXSproto ("$PACKAGE\::find", find, file, "\$");
1007 newXSproto ("$PACKAGE\::list", list, file, ""); 1011 newXSproto ("$PACKAGE\::list", list, file, "");
1012
1013 #ifdef STATICPERL_BUNDLE_XS_INIT
1014 STATICPERL_BUNDLE_XS_INIT;
1015 #endif
1008EOF 1016EOF
1009 1017
1010# calls 1018# calls
1011for (@static_ext) { 1019for (@static_ext) {
1012 s/\.pm$//; 1020 s/\.pm$//;
1027 PL_preambleav = newAV (); 1035 PL_preambleav = newAV ();
1028 1036
1029 av_unshift (PL_preambleav, 1); 1037 av_unshift (PL_preambleav, 1);
1030 av_store (PL_preambleav, 0, newSVpv (bootstrap, sizeof (bootstrap) - 1)); 1038 av_store (PL_preambleav, 0, newSVpv (bootstrap, sizeof (bootstrap) - 1));
1031 #else 1039 #else
1032 av_create_and_unshift_one (&PL_preambleav, newSVpv (bootstrap, sizeof (bootstrap) - 1)); 1040 Perl_av_create_and_unshift_one (&PL_preambleav, newSVpv (bootstrap, sizeof (bootstrap) - 1));
1033 #endif 1041 #endif
1034 1042
1035 if (PL_oldname) 1043 if (PL_oldname)
1036 ((XSINIT_t)PL_oldname)(aTHX); 1044 ((XSINIT_t)PL_oldname)(aTHX);
1037} 1045}
1171 1179
1172{ 1180{
1173 print "generating $PREFIX.ccopts... " 1181 print "generating $PREFIX.ccopts... "
1174 if $VERBOSE >= 1; 1182 if $VERBOSE >= 1;
1175 1183
1176 $ccopts = "$Config{ccflags} $Config{optimize} $Config{cppflags} -I\"$Config{archlibexp}/CORE\""; 1184 $ccopts = "$Config{ccflags} $Config{optimize} $Config{cppflags} -I$Config{archlibexp}/CORE";
1177 $ccopts =~ s/([\(\)])/\\$1/g; 1185 $ccopts =~ s/([\(\)])/\\$1/g;
1178 1186
1179 open my $fh, ">$PREFIX.ccopts" 1187 open my $fh, ">$PREFIX.ccopts"
1180 or die "$PREFIX.ccopts: $!"; 1188 or die "$PREFIX.ccopts: $!";
1181 print $fh $ccopts; 1189 print $fh $ccopts;
1192 $ldopts = $STATIC ? "-static " : ""; 1200 $ldopts = $STATIC ? "-static " : "";
1193 1201
1194 $ldopts .= "$Config{ccdlflags} $Config{ldflags} @libs $Config{archlibexp}/CORE/$Config{libperl} $Config{perllibs}"; 1202 $ldopts .= "$Config{ccdlflags} $Config{ldflags} @libs $Config{archlibexp}/CORE/$Config{libperl} $Config{perllibs}";
1195 1203
1196 my %seen; 1204 my %seen;
1197 $ldopts .= " $_" for grep !$seen{$_}++, ($extralibs =~ /(\S+)/g); 1205 $ldopts .= " $_" for reverse grep !$seen{$_}++, reverse +($extralibs =~ /(\S+)/g);
1198 1206
1199 for (@staticlibs) { 1207 for (@staticlibs) {
1200 $ldopts =~ s/(^|\s) (-l\Q$_\E) ($|\s)/$1-Wl,-Bstatic $2 -Wl,-Bdynamic$3/gx; 1208 $ldopts =~ s/(^|\s) (-l\Q$_\E) ($|\s)/$1-Wl,-Bstatic $2 -Wl,-Bdynamic$3/gx;
1201 } 1209 }
1202 1210
1221 print "$build\n" 1229 print "$build\n"
1222 if $VERBOSE >= 2; 1230 if $VERBOSE >= 2;
1223 1231
1224 system $build; 1232 system $build;
1225 1233
1226# unlink "$PREFIX.$_" 1234 unlink "$PREFIX.$_"
1227# for qw(ccopts ldopts c h); 1235 for qw(ccopts ldopts c h);
1228 1236
1229 print "\n" 1237 print "\n"
1230 if $VERBOSE >= 1; 1238 if $VERBOSE >= 1;
1231} 1239}
1232 1240

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines