8 'verbose' => 1, # verbose level, in range from 0 to 2
9 'distdir' => 'distdir',
10 'unicode' => 1, # include unicode by default
11 'minimal' => 0, # minimal possible distribution.
12 # actually this is just perl.exe and perlXX.dll
13 # but can be extended by additional exts
14 # ... (as soon as this will be implemented :)
15 'include-modules' => '', # TODO
16 'exclude-modules' => '', # TODO
17 #??? 'only-modules' => '', # TODO
18 'cross-name' => 'wince',
19 'strip-pod' => 0, # TODO strip POD from perl modules
20 'adaptation' => 0, # TODO do some adaptation, such as stripping such
21 # occurences as "if ($^O eq 'VMS'){...}" for certain modules
22 'zip' => 0, # perform zip
25 (map {/^--([\-_\w]+)=(.*)$/} @ARGV), # --opt=smth
26 (map {/^no-?(.*)$/i?($1=>0):($_=>1)} map {/^--([\-_\w]+)$/} @ARGV), # --opt --no-opt --noopt
30 # -- error checking. When something goes wrong, just exit with rc!=0
31 # -- may be '--zip' option should be made differently?
35 if ($opts{'clean-exts'}) {
36 # unfortunately, unlike perl58.dll and like, extensions for different
37 # platforms are built in same directory, therefore we must be able to clean
39 unlink '../config.sh'; # delete cache config file, which remembers our previous config
41 find({no_chdir=>1,wanted => sub{
42 unlink if /((?:\.obj|\/makefile|\/errno\.pm))$/i;
50 if ($opts{'verbose'} >=1) {
51 print STDERR "zipping...\n";
53 chdir $opts{'distdir'};
55 `zip -R perl-$opts{'cross-name'} *`;
59 my (%libexclusions, %extexclusions);
65 find({no_chdir=>1,wanted=>sub{push @lfiles, $_ if /\.p[lm]$/}},'.');
68 @lfiles = grep {!exists $libexclusions{$_}} @lfiles;
72 if ($opts{'verbose'} >=1) {
73 print STDERR "Copying perl lib files...\n";
77 mkpath "$opts{distdir}/lib/$1";
78 copy "../lib/$_", "$opts{distdir}/lib/$_";
84 find({no_chdir=>1,wanted=>sub{push @efiles, $_ if /\.pm$/}},'.');
91 #{s[/(\w+)/\1\.pm][/$1.pm]} @efiles;
92 if ($opts{'verbose'} >=1) {
93 print STDERR "Copying perl core extensions...\n";
96 /^(.*)\/([^\/]+)\/([^\/]+)$/;
97 copy "../ext/$_", "$opts{distdir}/lib/$1/$3";
100 # Config.pm, perl binaries
101 if ($opts{'verbose'} >=1) {
102 print STDERR "Copying Config.pm, perl.dll and perl.exe...\n";
104 copy "../xlib/$opts{'cross-name'}/Config.pm", "$opts{distdir}/lib/Config.pm";
105 copy "$opts{'cross-name'}/perl.exe", "$opts{distdir}/bin/perl.exe";
106 copy "$opts{'cross-name'}/perl.dll", "$opts{distdir}/bin/perl.dll";
107 # how do we know exact name of perl.dll?)
111 chdir "../xlib/$opts{'cross-name'}/auto";
112 find({no_chdir=>1,wanted=>sub{push @afiles, $_ if /\.(dll|bs)$/}},'.');
114 if ($opts{'verbose'} >=1) {
115 print STDERR "Copying binaries for perl core extensions...\n";
118 copy "../xlib/$opts{'cross-name'}/auto/$_", "$opts{distdir}/lib/auto/$_";
122 my ($fnfrom, $fnto) = @_;
123 open my $fh, "<$fnfrom" or die "can not open $fnfrom: $!";
127 if ($opts{'strip-pod'}) {
128 # actually following regexp is suspicious to not work everywhere.
129 # but we've checked on our set of modules, and it's fit for our purposes
130 $ffrom =~ s/^=\w+.*?^=cut(?:\n|\Z)//msg;
131 # $ffrom =~ s/^__END__.*\Z//msg; # TODO -- deal with Autoload
133 mkpath $1 if $fnto=~/^(.*)\/([^\/]+)$/;
134 open my $fhout, ">$fnto";
137 if ($opts{'verbose'} >=2) {
138 print STDERR "copying $fnfrom=>$fnto\n";
143 %libexclusions = map {$_=>1} split/\s/, <<"EOS";
144 abbrev.pl bigfloat.pl bigint.pl bigrat.pl cacheout.pl complete.pl ctime.pl
145 dotsh.pl exceptions.pl fastcwd.pl flush.pl ftp.pl getcwd.pl getopt.pl
146 getopts.pl hostname.pl look.pl newgetopt.pl pwd.pl termcap.pl
148 %extexclusions = map {$_=>1} split/\s/, <<"EOS";