3 buildext.pl - build extensions
7 buildext.pl make [-make_opts] dep directory [target] !ext1 !ext2
11 buildext.pl nmake -nologo perldll.def ..\ext
13 buildext.pl nmake -nologo perldll.def ..\ext clean
15 buildext.pl dmake perldll.def ..\ext
17 buildext.pl dmake perldll.def ..\ext clean
19 Will skip building extensions which are marked with an '!' char.
20 Mostly because they still not ported to specified platform.
28 # @ARGV with '!' at first position are exclusions
29 my %excl = map {$_=>1} map {/^!(.*)$/} @ARGV;
30 @ARGV = grep {!/^!/} @ARGV;
35 if ($perl =~ m#^\.\.#)
37 $perl = "$here\\$perl";
39 (my $topdir = $perl) =~ s/\\[^\\]+$//;
40 # miniperl needs to find perlglob and pl2bat
41 $ENV{PATH} = "$topdir;$topdir\\win32\\bin;$ENV{PATH}";
42 #print "PATH=$ENV{PATH}\n";
43 my $pl2bat = "$topdir\\win32\\bin\\pl2bat";
44 unless (-f "$pl2bat.bat") {
45 my @args = ($perl, ("$pl2bat.pl") x 2);
47 system(@args) unless defined $::Cross::platform;
50 $make .= " ".shift while $ARGV[0]=~/^-/;
54 chdir($dir) || die "Cannot cd to $dir\n";
56 (my $ext = getcwd()) =~ s,/,\\,g;
58 FindExt::scan_ext($ext);
60 my @ext = FindExt::extensions();
62 foreach my $dir (sort @ext)
64 if (exists $excl{$dir}) {
65 warn "Skipping extension $ext\\$dir, not ported to current platform";
68 if (chdir("$ext\\$dir"))
70 my $mmod = -M 'Makefile';
71 if (!(-f 'Makefile') || $mmod > $dmod)
73 print "\nRunning Makefile.PL in $dir\n";
74 my @perl = ($perl, "-I$here\\..\\lib", 'Makefile.PL',
75 'INSTALLDIRS=perl', 'PERL_CORE=1');
76 if (defined $::Cross::platform) {
77 @perl = (@perl[0,1],"-MCross=$::Cross::platform",@perl[2..$#perl]);
79 print join(' ', @perl), "\n";
80 $code = system(@perl);
81 warn "$code from $dir's Makefile.PL" if $code;
82 $mmod = -M 'Makefile';
85 warn "Makefile $mmod > $dmod ($dep)\n";
90 print "Making $targ in $dir\n$make $targ\n";
91 $code = system("$make $targ");
92 die "Unsuccessful make($dir): code=$code" if $code!=0;
96 print "Making $dir\n$make\n";
97 $code = system($make);
98 die "Unsuccessful make($dir): code=$code" if $code!=0;
100 chdir($here) || die "Cannot cd to $here:$!";
104 warn "Cannot cd to $ext\\$dir:$!";