summaryrefslogtreecommitdiff
path: root/win32/buildext.pl
diff options
context:
space:
mode:
authorNick Ing-Simmons <nik@tiuk.ti.com>2001-03-29 14:59:11 +0000
committerNick Ing-Simmons <nik@tiuk.ti.com>2001-03-29 14:59:11 +0000
commit17af6fb0658e86e2f4a472e3392fc688e0c25b43 (patch)
tree0a34d767d8c64fa919a914828d49acd783e810e6 /win32/buildext.pl
parentc7997937a3d3c62c11d46b84cf8e39979d05cd2e (diff)
downloadperl-17af6fb0658e86e2f4a472e3392fc688e0c25b43.tar.gz
Work in progress - determine win32 extensions to build via script.
p4raw-id: //depot/perlio@9442
Diffstat (limited to 'win32/buildext.pl')
-rw-r--r--win32/buildext.pl63
1 files changed, 63 insertions, 0 deletions
diff --git a/win32/buildext.pl b/win32/buildext.pl
new file mode 100644
index 0000000000..6e64b91f5e
--- /dev/null
+++ b/win32/buildext.pl
@@ -0,0 +1,63 @@
+use File::Find;
+use File::Basename;
+use Cwd;
+my $here = getcwd();
+my $perl = $^X;
+$here =~ s,/,\\,g;
+if ($perl =~ m#^\.\.#)
+ {
+ $perl = "$here\\$perl";
+ }
+my $make = shift;
+my $dep = shift;
+my $dmod = -M $dep;
+my $dir = shift;
+chdir($dir) || die "Cannot cd to $dir\n";
+(my $ext = getcwd()) =~ s,/,\\,g;
+my $no = join('|',qw(DynaLoader GDBM_File ODBM_File NDBM_File DB_File Syslog Sysv));
+$no = qr/^(?:$no)$/i;
+my %ext;
+find(\&find_xs,'.');
+
+foreach my $dir (sort keys %ext)
+ {
+ if (chdir("$ext\\$dir"))
+ {
+ my $mmod = -M 'Makefile';
+ if (!(-f 'Makefile') || $mmod > $dmod)
+ {
+ print "\nMakefile.PL in $dir ($mmod > $dmod)\n";
+ my $code = system($perl,"-I$here\\..\lib",'Makefile.PL','INSTALLDIRS=perl');
+ warn "$code from $dir's Makefile.PL" if $code;
+ $mmod = -M 'Makefile';
+ if ($mmod > $dmod)
+ {
+ warn "Makefile $mmod > $dmod ($dep)\n";
+ }
+ }
+ print "\nMaking $dir\n";
+ system($make);
+ chdir($here) || die "Cannot cd to $here:$!";
+ }
+ else
+ {
+ warn "Cannot cd to $ext\\$dir:$!";
+ }
+ }
+
+sub find_xs
+{
+ if (/^(.*)\.pm$/i)
+ {
+ my $name = $1;
+ return if $name =~ $no;
+ my $dir = $File::Find::dir;
+ $dir =~ s,./,,;
+ return if exists $ext{$dir};
+ return unless -f "$ext/$dir/Makefile.PL";
+ if ($dir =~ /$name$/i)
+ {
+ $ext{$dir} = $name;
+ }
+ }
+} \ No newline at end of file