summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Ing-Simmons <nik@tiuk.ti.com>2001-04-07 11:39:45 +0000
committerNick Ing-Simmons <nik@tiuk.ti.com>2001-04-07 11:39:45 +0000
commit8e2329934bcca9c59680f6d478c3c2bc3ef7c649 (patch)
treed3828afeb910666ce7ae57b739670767c1bc0326
parent267cbce72d0da7af102852e6d7e0bb5c1ce41da6 (diff)
downloadperl-8e2329934bcca9c59680f6d478c3c2bc3ef7c649.tar.gz
Split out extension finding code from buildext.pl into FindExt.pm
Use it to get Config.pm's idea of available extensions in line with what is built. p4raw-id: //depot/perlio@9604
-rw-r--r--MANIFEST1
-rw-r--r--win32/FindExt.pm62
-rw-r--r--win32/buildext.pl27
-rw-r--r--win32/config_sh.PL7
-rw-r--r--win32/makefile.mk4
5 files changed, 76 insertions, 25 deletions
diff --git a/MANIFEST b/MANIFEST
index e358010a65..b6dab2e8a0 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -1880,6 +1880,7 @@ win32/config_sh.PL Perl code to update Win32 config.sh from Makefile
win32/des_fcrypt.patch Win32 port
win32/distclean.bat Remove _ALL_ files not listed here in MANIFEST
win32/dl_win32.xs Win32 port
+win32/FindExt.pm Scan for extensions
win32/genmk95.pl Perl code to generate command.com-usable makefile.95
win32/include/arpa/inet.h Win32 port
win32/include/dirent.h Win32 port
diff --git a/win32/FindExt.pm b/win32/FindExt.pm
new file mode 100644
index 0000000000..ea5165f1c4
--- /dev/null
+++ b/win32/FindExt.pm
@@ -0,0 +1,62 @@
+package FindExt;
+use strict;
+use File::Find;
+use File::Basename;
+use Cwd;
+
+my $no = join('|',qw(DynaLoader GDBM_File ODBM_File NDBM_File DB_File Syslog Sysv));
+$no = qr/^(?:$no)$/i;
+
+my %ext;
+my $ext;
+sub scan_ext
+{
+ my $here = getcwd();
+ my $dir = shift;
+ chdir($dir) || die "Cannot cd to $dir\n";
+ ($ext = getcwd()) =~ s,/,\\,g;
+ find(\&find_ext,'.');
+ chdir($here) || die "Cannot cd to $here\n";
+ my @ext = extensions();
+}
+
+sub dynamic_extensions
+{
+ return grep $ext{$_} eq 'dynamic',keys %ext;
+}
+
+sub noxs_extensions
+{
+ return grep $ext{$_} eq 'noxs',keys %ext;
+}
+
+sub extensions
+{
+ return keys %ext;
+}
+
+sub find_ext
+{
+ if (/^(.*)\.pm$/i || /^(.*)_pm.PL$/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)
+ {
+ if (-f "$ext/$dir/$name.xs")
+ {
+ $ext{$dir} = 'dynamic';
+ }
+ else
+ {
+ $ext{$dir} = 'nonxs';
+ }
+ }
+ }
+}
+
+1;
diff --git a/win32/buildext.pl b/win32/buildext.pl
index 6e40bb9bf7..5800750e52 100644
--- a/win32/buildext.pl
+++ b/win32/buildext.pl
@@ -1,6 +1,6 @@
-use File::Find;
use File::Basename;
use Cwd;
+use FindExt;
my $here = getcwd();
my $perl = $^X;
$here =~ s,/,\\,g;
@@ -15,12 +15,11 @@ 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,'.');
+FindExt::scan_ext($ext);
-foreach my $dir (sort keys %ext)
+my @ext = FindExt::extensions();
+
+foreach my $dir (sort @ext)
{
if (chdir("$ext\\$dir"))
{
@@ -46,19 +45,3 @@ foreach my $dir (sort keys %ext)
}
}
-sub find_xs
-{
- if (/^(.*)\.pm$/i || /^(.*)_pm.PL$/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;
- }
- }
-}
diff --git a/win32/config_sh.PL b/win32/config_sh.PL
index 0e1d351c1a..9757e52cac 100644
--- a/win32/config_sh.PL
+++ b/win32/config_sh.PL
@@ -1,3 +1,4 @@
+use FindExt;
# take a semicolon separated path list and turn it into a quoted
# list of paths that Text::Parsewords will grok
sub mungepath {
@@ -33,13 +34,19 @@ sub loadopts {
}
}
+FindExt::scan_ext("../ext");
+
my %opt;
+
my $optref = loadopts();
while (@{$optref} && $optref->[0] =~ /^([\w_]+)=(.*)$/) {
$opt{$1}=$2;
shift(@{$optref});
}
+$opt{'dynamic_ext'} = join(' ',FindExt::dynamic_extensions());
+$opt{'nonxs_ext'} = join(' ',FindExt::noxs_extensions());
+
my $pl_h = '../patchlevel.h';
if (-e $pl_h) {
diff --git a/win32/makefile.mk b/win32/makefile.mk
index 5333ce650c..25ec97de56 100644
--- a/win32/makefile.mk
+++ b/win32/makefile.mk
@@ -800,8 +800,6 @@ CFG_VARS = \
_o=$(o) obj_ext=$(o) ~ \
_a=$(a) lib_ext=$(a) ~ \
static_ext=$(STATIC_EXT) ~ \
- dynamic_ext=$(DYNAMIC_EXT) ~ \
- nonxs_ext=$(NONXS_EXT) ~ \
use5005threads=$(USE_5005THREADS) ~ \
useithreads=$(USE_ITHREADS) ~ \
usethreads=$(USE_5005THREADS) ~ \
@@ -902,7 +900,7 @@ config.w32 : $(CFGSH_TMPL)
-del /f config.h
copy $(CFGH_TMPL) config.h
-..\config.sh : config.w32 $(MINIPERL) config_sh.PL
+..\config.sh : config.w32 $(MINIPERL) config_sh.PL FindExt.pm
$(MINIPERL) -I..\lib config_sh.PL --cfgsh-option-file \
$(mktmp $(CFG_VARS)) config.w32 > ..\config.sh