summaryrefslogtreecommitdiff
path: root/make_ext.pl
diff options
context:
space:
mode:
authorSteve Hay <SteveHay@planit.com>2009-09-29 15:41:06 +0100
committerSteve Hay <SteveHay@planit.com>2009-09-29 15:41:06 +0100
commita85e0e8cf88042961f6f69a4f64e20f985d31654 (patch)
tree87de4117de42ca0395e18b2d204711e11da7fb4d /make_ext.pl
parent710e07e27761e9989c10a90b08bcfb94284b9806 (diff)
downloadperl-a85e0e8cf88042961f6f69a4f64e20f985d31654.tar.gz
Fix distclean on Win32
nmake realclean in the Encode sub-dirs didn't work because it needed an extra ../ on the relative paths in @INC. Make the paths absolute instead. nmake realclean in DynaLoader didn't work either because it tried to make DynaLoader.c... three times. Move the loop over @ext out of the loop over @dirs to fix the repetitions, but don't add DynaLoader.c anyway when just making a 'clean' target. Also clean up the XSLoader.pm that gets left behind.
Diffstat (limited to 'make_ext.pl')
-rw-r--r--make_ext.pl68
1 files changed, 37 insertions, 31 deletions
diff --git a/make_ext.pl b/make_ext.pl
index b1980a5bcc..e272d5b111 100644
--- a/make_ext.pl
+++ b/make_ext.pl
@@ -3,9 +3,10 @@ use strict;
use warnings;
use Config;
BEGIN {
- unshift @INC, $^O eq 'MSWin32' ? '../cpan/Cwd' : 'cpan/Cwd';
+ unshift @INC, $^O eq 'MSWin32' ? ('../cpan/Cwd', '../cpan/Cwd/lib') : 'cpan/Cwd';
}
use Cwd;
+use File::Spec::Functions qw(rel2abs);
# To clarify, this isn't the entire suite of modules considered "toolchain"
# It's not even all modules needed to build ext/
@@ -179,35 +180,36 @@ if ($is_Win32) {
(my $ext = getcwd()) =~ s{/}{\\}g;
FindExt::scan_ext($ext);
FindExt::set_static_extensions(split ' ', $Config{static_ext});
+ chdir $build
+ or die "Couldn't chdir to '$build': $!"; # restore our start directory
+ }
- my @ext;
- push @ext, FindExt::static_ext() if $static;
- push @ext, FindExt::dynamic_ext() if $dynamic;
- push @ext, FindExt::nonxs_ext() if $nonxs;
- push @ext, 'DynaLoader' if $dynaloader;
+ my @ext;
+ push @ext, FindExt::static_ext() if $static;
+ push @ext, FindExt::dynamic_ext() if $dynamic;
+ push @ext, FindExt::nonxs_ext() if $nonxs;
+ push @ext, 'DynaLoader' if $dynaloader;
- foreach (sort @ext) {
- if (%incl and !exists $incl{$_}) {
- #warn "Skipping extension $ext\\$_, not in inclusion list\n";
- next;
- }
- if (exists $excl{$_}) {
- warn "Skipping extension $ext\\$_, not ported to current platform";
- next;
- }
- push @extspec, $_;
- if($_ eq 'DynaLoader') {
- # No, we don't know why nmake can't work out the dependency chain
- push @{$extra_passthrough{$_}}, 'DynaLoader.c';
- } elsif(FindExt::is_static($_)) {
- push @{$extra_passthrough{$_}}, 'LINKTYPE=static';
- }
+ foreach (sort @ext) {
+ if (%incl and !exists $incl{$_}) {
+ #warn "Skipping extension $_, not in inclusion list\n";
+ next;
+ }
+ if (exists $excl{$_}) {
+ warn "Skipping extension $_, not ported to current platform";
+ next;
+ }
+ push @extspec, $_;
+ if($_ eq 'DynaLoader' and $target !~ /clean$/) {
+ # No, we don't know why nmake can't work out the dependency chain
+ push @{$extra_passthrough{$_}}, 'DynaLoader.c';
+ } elsif(FindExt::is_static($_)) {
+ push @{$extra_passthrough{$_}}, 'LINKTYPE=static';
}
- chdir $build
- or die "Couldn't chdir to '$build': $!"; # restore our start directory
}
+
chdir '..'
- or die "Couldn't chdir to build directory: $!"; # now in the Perl build directory
+ or die "Couldn't chdir to build directory: $!"; # now in the Perl build
}
elsif ($is_VMS) {
$perl = $^X;
@@ -271,6 +273,11 @@ foreach my $spec (@extspec) {
sub build_extension {
my ($ext_dir, $perl, $mname, $pass_through) = @_;
+ unless (chdir "$ext_dir") {
+ warn "Cannot cd to $ext_dir: $!";
+ return;
+ }
+
my $up = $ext_dir;
$up =~ s![^/]+!..!g;
@@ -280,14 +287,13 @@ sub build_extension {
# $lib_dir must be last, as we're copying files into it, and in a parallel
# make there's a race condition if one process tries to open a module that
# another process has half-written.
- $ENV{PERL5LIB}
- = join $Config{path_sep}, (map {"$up/$_"} @toolchain), $lib_dir;
+ my @new_inc = ((map {"$up/$_"} @toolchain), $lib_dir);
+ if ($is_Win32) {
+ @new_inc = map {rel2abs($_)} @new_inc;
+ }
+ $ENV{PERL5LIB} = join $Config{path_sep}, @new_inc;
$ENV{PERL_CORE} = 1;
- unless (chdir "$ext_dir") {
- warn "Cannot cd to $ext_dir: $!";
- return;
- }
my $makefile;
if ($is_VMS) {
$makefile = 'descrip.mms';