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

Comparing App-Staticperl/mkbundle (file contents):
Revision 1.34 by root, Mon Mar 12 21:45:10 2012 UTC vs.
Revision 1.37 by root, Tue Mar 19 15:24:49 2019 UTC

12our $STATIC = 0; 12our $STATIC = 0;
13our $PACKLIST = 0; 13our $PACKLIST = 0;
14our $IGNORE_ENV = 0; 14our $IGNORE_ENV = 0;
15our $ALLOW_DYNAMIC = 0; 15our $ALLOW_DYNAMIC = 0;
16our $HAVE_DYNAMIC; # maybe useful? 16our $HAVE_DYNAMIC; # maybe useful?
17our $EXTRA_CFLAGS = "";
18our $EXTRA_LDFLAGS = "";
19our $EXTRA_LIBS = "";
17 20
18our $OPTIMISE_SIZE = 0; # optimise for raw file size instead of for compression? 21our $OPTIMISE_SIZE = 0; # optimise for raw file size instead of for compression?
19 22
20our $CACHE; 23our $CACHE;
21our $CACHEVER = 1; # do not change unless you know what you are doing 24our $CACHEVER = 1; # do not change unless you know what you are doing
353 356
354use Getopt::Long; 357use Getopt::Long;
355 358
356sub parse_argv { 359sub parse_argv {
357 GetOptions 360 GetOptions
358 "perl" => \$PERL, 361 "perl" => \$PERL,
359 "app=s" => \$APP, 362 "app=s" => \$APP,
360 363
361 "verbose|v" => sub { ++$VERBOSE }, 364 "verbose|v" => sub { ++$VERBOSE },
362 "quiet|q" => sub { --$VERBOSE }, 365 "quiet|q" => sub { --$VERBOSE },
363 366
364 "strip=s" => \$STRIP, 367 "strip=s" => \$STRIP,
365 "cache=s" => \$CACHE, # internal option 368 "cache=s" => \$CACHE, # internal option
366 "eval|e=s" => sub { trace_eval $_[1] }, 369 "eval|e=s" => sub { trace_eval $_[1] },
367 "use|M=s" => sub { trace_module $_[1] }, 370 "use|M=s" => sub { trace_module $_[1] },
368 "boot=s" => sub { cmd_boot $_[1] }, 371 "boot=s" => sub { cmd_boot $_[1] },
369 "add=s" => sub { cmd_add $_[1], 0 }, 372 "add=s" => sub { cmd_add $_[1], 0 },
370 "addbin=s" => sub { cmd_add $_[1], 1 }, 373 "addbin=s" => sub { cmd_add $_[1], 1 },
371 "incglob=s" => sub { cmd_incglob $_[1] }, 374 "incglob=s" => sub { cmd_incglob $_[1] },
372 "include|i=s" => sub { cmd_include $_[1], 1 }, 375 "include|i=s" => sub { cmd_include $_[1], 1 },
373 "exclude|x=s" => sub { cmd_include $_[1], 0 }, 376 "exclude|x=s" => sub { cmd_include $_[1], 0 },
374 "usepacklists!" => \$PACKLIST, 377 "usepacklists!" => \$PACKLIST,
375 378
376 "static!" => \$STATIC, 379 "static!" => \$STATIC,
377 "staticlib=s" => sub { cmd_staticlib $_[1] }, 380 "staticlib=s" => sub { cmd_staticlib $_[1] },
378 "allow-dynamic!"=> \$ALLOW_DYNAMIC, 381 "allow-dynamic!" => \$ALLOW_DYNAMIC,
379 "ignore-env" => \$IGNORE_ENV, 382 "ignore-env" => \$IGNORE_ENV,
380 383
384 "extra-cflags=s" => \$EXTRA_CFLAGS,
385 "extra-ldflags=s" => \$EXTRA_LDFLAGS,
386 "extra-libs=s" => \$EXTRA_LIBS,
387
381 "<>" => sub { cmd_file $_[0] }, 388 "<>" => sub { cmd_file $_[0] },
382 or exit 1; 389 or exit 1;
383} 390}
384 391
385Getopt::Long::Configure ("bundling", "no_auto_abbrev", "no_ignore_case"); 392Getopt::Long::Configure ("bundling", "no_auto_abbrev", "no_ignore_case");
386 393
977 } 984 }
978 985
979 XSRETURN ($varpfx\_count); 986 XSRETURN ($varpfx\_count);
980} 987}
981 988
989#ifdef STATICPERL_BUNDLE_INCLUDE
990#include STATICPERL_BUNDLE_INCLUDE
991#endif
992
982EOF 993EOF
983 994
984############################################################################# 995#############################################################################
985# xs_init 996# xs_init
986 997
1003 char *file = __FILE__; 1014 char *file = __FILE__;
1004 dXSUB_SYS; 1015 dXSUB_SYS;
1005 1016
1006 newXSproto ("$PACKAGE\::find", find, file, "\$"); 1017 newXSproto ("$PACKAGE\::find", find, file, "\$");
1007 newXSproto ("$PACKAGE\::list", list, file, ""); 1018 newXSproto ("$PACKAGE\::list", list, file, "");
1019
1020 #ifdef STATICPERL_BUNDLE_XS_INIT
1021 STATICPERL_BUNDLE_XS_INIT;
1022 #endif
1008EOF 1023EOF
1009 1024
1010# calls 1025# calls
1011for (@static_ext) { 1026for (@static_ext) {
1012 s/\.pm$//; 1027 s/\.pm$//;
1018 1033
1019 print $fh " newXS (\"$pname\::$bootstrap\", boot_$cname, file);\n"; 1034 print $fh " newXS (\"$pname\::$bootstrap\", boot_$cname, file);\n";
1020} 1035}
1021 1036
1022print $fh <<EOF; 1037print $fh <<EOF;
1038 Safefree (PL_origfilename);
1039 PL_origfilename = savepv (PL_origargv [0]);
1040 sv_setpv (GvSV (gv_fetchpvs ("0", GV_ADD|GV_NOTQUAL, SVt_PV)), PL_origfilename);
1041
1023 #ifdef _WIN32 1042 #ifdef _WIN32
1024 /* windows perls usually trail behind unix perls 8-10 years in exporting symbols */ 1043 /* windows perls usually trail behind unix perls 8-10 years in exporting symbols */
1025 1044
1026 if (!PL_preambleav) 1045 if (!PL_preambleav)
1027 PL_preambleav = newAV (); 1046 PL_preambleav = newAV ();
1171 1190
1172{ 1191{
1173 print "generating $PREFIX.ccopts... " 1192 print "generating $PREFIX.ccopts... "
1174 if $VERBOSE >= 1; 1193 if $VERBOSE >= 1;
1175 1194
1176 $ccopts = "$Config{ccflags} $Config{optimize} $Config{cppflags} -I$Config{archlibexp}/CORE"; 1195 $ccopts = "$Config{ccflags} $Config{optimize} $Config{cppflags} -I$Config{archlibexp}/CORE $EXTRA_CFLAGS";
1177 $ccopts =~ s/([\(\)])/\\$1/g; 1196 $ccopts =~ s/([\(\)])/\\$1/g;
1178 1197
1179 open my $fh, ">$PREFIX.ccopts" 1198 open my $fh, ">$PREFIX.ccopts"
1180 or die "$PREFIX.ccopts: $!"; 1199 or die "$PREFIX.ccopts: $!";
1181 print $fh $ccopts; 1200 print $fh $ccopts;
1189{ 1208{
1190 print "generating $PREFIX.ldopts... "; 1209 print "generating $PREFIX.ldopts... ";
1191 1210
1192 $ldopts = $STATIC ? "-static " : ""; 1211 $ldopts = $STATIC ? "-static " : "";
1193 1212
1194 $ldopts .= "$Config{ccdlflags} $Config{ldflags} @libs $Config{archlibexp}/CORE/$Config{libperl} $Config{perllibs}"; 1213 $ldopts .= "$Config{ccdlflags} $Config{ldflags} $EXTRA_LDFLAGS @libs $Config{archlibexp}/CORE/$Config{libperl} $Config{perllibs} $EXTRA_LIBS";
1195 1214
1196 my %seen; 1215 my %seen;
1197 $ldopts .= " $_" for reverse grep !$seen{$_}++, reverse +($extralibs =~ /(\S+)/g); 1216 $ldopts .= " $_" for reverse grep !$seen{$_}++, reverse +($extralibs =~ /(\S+)/g);
1198 1217
1199 for (@staticlibs) { 1218 for (@staticlibs) {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines