… | |
… | |
12 | our $STATIC = 0; |
12 | our $STATIC = 0; |
13 | our $PACKLIST = 0; |
13 | our $PACKLIST = 0; |
14 | our $IGNORE_ENV = 0; |
14 | our $IGNORE_ENV = 0; |
15 | our $ALLOW_DYNAMIC = 0; |
15 | our $ALLOW_DYNAMIC = 0; |
16 | our $HAVE_DYNAMIC; # maybe useful? |
16 | our $HAVE_DYNAMIC; # maybe useful? |
|
|
17 | our $EXTRA_CFLAGS = ""; |
|
|
18 | our $EXTRA_LDFLAGS = ""; |
|
|
19 | our $EXTRA_LIBS = ""; |
17 | |
20 | |
18 | our $OPTIMISE_SIZE = 0; # optimise for raw file size instead of for compression? |
21 | our $OPTIMISE_SIZE = 0; # optimise for raw file size instead of for compression? |
19 | |
22 | |
20 | our $CACHE; |
23 | our $CACHE; |
21 | our $CACHEVER = 1; # do not change unless you know what you are doing |
24 | our $CACHEVER = 1; # do not change unless you know what you are doing |
… | |
… | |
353 | |
356 | |
354 | use Getopt::Long; |
357 | use Getopt::Long; |
355 | |
358 | |
356 | sub parse_argv { |
359 | sub 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 | |
385 | Getopt::Long::Configure ("bundling", "no_auto_abbrev", "no_ignore_case"); |
392 | Getopt::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 | |
982 | EOF |
993 | EOF |
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 |
1008 | EOF |
1023 | EOF |
1009 | |
1024 | |
1010 | # calls |
1025 | # calls |
1011 | for (@static_ext) { |
1026 | for (@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 | |
1022 | print $fh <<EOF; |
1037 | print $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) { |