summaryrefslogtreecommitdiff
path: root/make_ext.pl
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2014-02-27 12:21:54 +0100
committerNicholas Clark <nick@ccl4.org>2014-03-02 07:08:54 +0100
commit2ce0aa69a204fa44a8c3946e66edc43902f6b657 (patch)
treee6ca1e4e9478b26c270c3ddd2ff72963ab050bf4 /make_ext.pl
parent1804eb619f3626a88b7de2b1a7fd4263c6d5cfc2 (diff)
downloadperl-2ce0aa69a204fa44a8c3946e66edc43902f6b657.tar.gz
make_ext.pl can also handle extensions with a module tree at the top level.
This gets us Digest and Memoize.
Diffstat (limited to 'make_ext.pl')
-rw-r--r--make_ext.pl22
1 files changed, 16 insertions, 6 deletions
diff --git a/make_ext.pl b/make_ext.pl
index cdf81e9b66..0c5d739fc8 100644
--- a/make_ext.pl
+++ b/make_ext.pl
@@ -550,9 +550,9 @@ sub _unlink {
sub just_pm_to_blib {
my ($target, $ext_dir, $mname) = @_;
- my $has_lib;
- my $has_top;
+ my ($has_lib, $has_top, $has_topdir);
my ($last) = $mname =~ /([^:]+)$/;
+ my ($first) = $mname =~ /^([^:]+)/;
foreach my $leaf (<*>) {
if (-d $leaf) {
@@ -561,6 +561,10 @@ sub just_pm_to_blib {
++$has_lib;
next;
}
+ if ($leaf eq $first) {
+ ++$has_topdir;
+ next;
+ }
}
return $leaf
unless -f _;
@@ -586,6 +590,8 @@ sub just_pm_to_blib {
}
return 'no lib/'
unless $has_lib || $has_top;
+ die "Inconsistent module $mname has both lib/ and $first/"
+ if $has_lib && $has_topdir;
print "\nRunning pm_to_blib for $ext_dir directly\n";
@@ -594,7 +600,7 @@ sub just_pm_to_blib {
my $to = $mname =~ s!::!/!gr;
$pm{"$last.pm"} = "../../lib/$to.pm";
}
- if ($has_lib) {
+ if ($has_lib || $has_topdir) {
# strictly ExtUtils::MakeMaker uses the pm_to_blib target to install
# .pm, pod and .pl files. We're just going to do it for .pm and .pod
# files, to avoid problems on case munging file systems. Specifically,
@@ -614,7 +620,7 @@ sub just_pm_to_blib {
unless /\A[^.]+\.(?:pm|pod)\z/i;
push @found, $_;
}
- }, 'lib');
+ }, $has_lib ? 'lib' : $first);
1;
}) {
# Problem files aren't really errors:
@@ -623,8 +629,12 @@ sub just_pm_to_blib {
# But anything else is:
die $@;
}
- foreach (@found) {
- $pm{$_} = "../../$_";
+ if ($has_lib) {
+ $pm{$_} = "../../$_"
+ foreach @found;
+ } else {
+ $pm{$_} = "../../lib/$_"
+ foreach @found;
}
}
# This is running under miniperl, so no autodie