X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FExtUtils%2FCBuilder%2FPlatform%2FWindows.pm;h=1ec89ee7a5e3b1ae96e2826602f8f77b13a0c9f8;hb=ea2e65188a6601dcbaa0912ec6b5cf4806638424;hp=1c0ec97ba17868915ce47c505677d35fe70e5a82;hpb=6b09c1601036c61459334bdedef5d7e29e07fcaf;p=p5sagit%2Fp5-mst-13.2.git diff --git a/lib/ExtUtils/CBuilder/Platform/Windows.pm b/lib/ExtUtils/CBuilder/Platform/Windows.pm index 1c0ec97..1ec89ee 100644 --- a/lib/ExtUtils/CBuilder/Platform/Windows.pm +++ b/lib/ExtUtils/CBuilder/Platform/Windows.pm @@ -9,7 +9,7 @@ use File::Spec; use ExtUtils::CBuilder::Base; use vars qw($VERSION @ISA); -$VERSION = '0.01'; +$VERSION = '0.12'; @ISA = qw(ExtUtils::CBuilder::Base); sub new { @@ -90,6 +90,12 @@ sub split_like_shell { return @argv; } +sub arg_defines { + my ($self, %args) = @_; + s/"/\\"/g foreach values %args; + return map qq{"-D$_=$args{$_}"}, keys %args; +} + sub compile { my ($self, %args) = @_; my $cf = $self->{config}; @@ -101,6 +107,8 @@ sub compile { $srcdir ||= File::Spec->curdir(); + my @defines = $self->arg_defines( %{ $args{defines} || {} } ); + my %spec = ( srcdir => $srcdir, builddir => $srcdir, @@ -111,9 +119,10 @@ sub compile { cflags => [ $self->split_like_shell($cf->{ccflags}), $self->split_like_shell($cf->{cccdlflags}), + $self->split_like_shell($cf->{extra_compiler_flags}), ], optimize => [ $self->split_like_shell($cf->{optimize}) ], - defines => [ '' ], + defines => \@defines, includes => [ @{$args{include_dirs} || []} ], perlinc => [ $self->perl_inc(), @@ -122,8 +131,6 @@ sub compile { use_scripts => 1, # XXX provide user option to change this??? ); - $self->add_to_cleanup($spec{output}); - $self->normalize_filespecs( \$spec{source}, \$spec{output}, @@ -158,7 +165,7 @@ sub link { # if running in perl source tree, look for libs there, not installed my $lddlflags = $cf->{lddlflags}; my $perl_src = $self->perl_src(); - $lddlflags =~ s/\Q$cf->{archlibexp}\E\\CORE/$perl_src/ if $perl_src; + $lddlflags =~ s/\Q$cf->{archlibexp}\E[\\\/]CORE/$perl_src/ if $perl_src; my %spec = ( srcdir => $to, @@ -196,7 +203,7 @@ sub link { $self->add_to_cleanup( grep defined, - @{[ @spec{qw(output implib explib def_file base_file map_file)} ]} + @{[ @spec{qw(implib explib def_file base_file map_file)} ]} ); foreach my $opt ( qw(output implib explib def_file map_file base_file) ) { @@ -262,10 +269,10 @@ sub perl_inc { =begin comment The packages below implement functions for generating properly -formated commandlines for the compiler being used. Each package +formatted commandlines for the compiler being used. Each package defines two primary functions 'format_linker_cmd()' & 'format_compiler_cmd()' that accepts a list of named arguments (a -hash) and returns a list of formated options suitable for invoking the +hash) and returns a list of formatted options suitable for invoking the compiler. By default, if the compiler supports scripting of its operation then a script file is built containing the options while those options are removed from the commandline, and a reference to the @@ -310,7 +317,6 @@ sub write_compiler_script { $spec{basename} . '.ccs' ); $self->add_to_cleanup($script); - print "Generating script '$script'\n" if !$self->{quiet}; open( SCRIPT, ">$script" )