r65542 - in /branches/upstream/libextutils-cchecker-perl/current: Changes MANIFEST META.yml README lib/ExtUtils/CChecker.pm t/03accessors.t t/04module_build.t
ansgar at users.alioth.debian.org
ansgar at users.alioth.debian.org
Sun Dec 5 11:28:13 UTC 2010
Author: ansgar
Date: Sun Dec 5 11:28:01 2010
New Revision: 65542
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=65542
Log:
[svn-upgrade] new version libextutils-cchecker-perl (0.05)
Added:
branches/upstream/libextutils-cchecker-perl/current/t/03accessors.t
branches/upstream/libextutils-cchecker-perl/current/t/04module_build.t
Modified:
branches/upstream/libextutils-cchecker-perl/current/Changes
branches/upstream/libextutils-cchecker-perl/current/MANIFEST
branches/upstream/libextutils-cchecker-perl/current/META.yml
branches/upstream/libextutils-cchecker-perl/current/README
branches/upstream/libextutils-cchecker-perl/current/lib/ExtUtils/CChecker.pm
Modified: branches/upstream/libextutils-cchecker-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libextutils-cchecker-perl/current/Changes?rev=65542&op=diff
==============================================================================
--- branches/upstream/libextutils-cchecker-perl/current/Changes (original)
+++ branches/upstream/libextutils-cchecker-perl/current/Changes Sun Dec 5 11:28:01 2010
@@ -1,4 +1,12 @@
Revision history for ExtUtils-CChecker
+
+0.05 CHANGES:
+ * Added accessors for callers to push more library dirs or compiler
+ or linker flags
+
+ BUGFIXES:
+ * Ensure that ->new_module_build merges its args and internal
+ configuration correctly
0.04 CHANGES:
* Provide optional variants of ->find_include_dirs_for and
Modified: branches/upstream/libextutils-cchecker-perl/current/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libextutils-cchecker-perl/current/MANIFEST?rev=65542&op=diff
==============================================================================
--- branches/upstream/libextutils-cchecker-perl/current/MANIFEST (original)
+++ branches/upstream/libextutils-cchecker-perl/current/MANIFEST Sun Dec 5 11:28:01 2010
@@ -9,4 +9,6 @@
t/00use.t
t/01run.t
t/02assert.t
+t/03accessors.t
+t/04module_build.t
t/99pod.t
Modified: branches/upstream/libextutils-cchecker-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libextutils-cchecker-perl/current/META.yml?rev=65542&op=diff
==============================================================================
--- branches/upstream/libextutils-cchecker-perl/current/META.yml (original)
+++ branches/upstream/libextutils-cchecker-perl/current/META.yml Sun Dec 5 11:28:01 2010
@@ -17,9 +17,9 @@
provides:
ExtUtils::CChecker:
file: lib/ExtUtils/CChecker.pm
- version: 0.04
+ version: 0.05
requires:
ExtUtils::CBuilder: 0
resources:
license: http://dev.perl.org/licenses/
-version: 0.04
+version: 0.05
Modified: branches/upstream/libextutils-cchecker-perl/current/README
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libextutils-cchecker-perl/current/README?rev=65542&op=diff
==============================================================================
--- branches/upstream/libextutils-cchecker-perl/current/README (original)
+++ branches/upstream/libextutils-cchecker-perl/current/README Sun Dec 5 11:28:01 2010
@@ -54,6 +54,15 @@
$flags = $cc->extra_linker_flags
Returns the currently-configured extra linker flags in an ARRAY
reference.
+
+ $cc->push_include_dirs( @dirs )
+ Adds more include directories
+
+ $cc->push_extra_compiler_flags( @flags )
+ Adds more compiler flags
+
+ $cc->push_extra_linker_flags
+ Adds more linker flags
$success = $cc->try_compile_run( %args )
$success = $cc->try_compile_run( $source )
Modified: branches/upstream/libextutils-cchecker-perl/current/lib/ExtUtils/CChecker.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libextutils-cchecker-perl/current/lib/ExtUtils/CChecker.pm?rev=65542&op=diff
==============================================================================
--- branches/upstream/libextutils-cchecker-perl/current/lib/ExtUtils/CChecker.pm (original)
+++ branches/upstream/libextutils-cchecker-perl/current/lib/ExtUtils/CChecker.pm Sun Dec 5 11:28:01 2010
@@ -8,7 +8,7 @@
use strict;
use warnings;
-our $VERSION = '0.04';
+our $VERSION = '0.05';
use Carp;
@@ -128,6 +128,42 @@
return [ @{ $self->{extra_linker_flags} } ];
}
+=head2 $cc->push_include_dirs( @dirs )
+
+Adds more include directories
+
+=cut
+
+sub push_include_dirs
+{
+ my $self = shift;
+ push @{ $self->{include_dirs} }, @_;
+}
+
+=head2 $cc->push_extra_compiler_flags( @flags )
+
+Adds more compiler flags
+
+=cut
+
+sub push_extra_compiler_flags
+{
+ my $self = shift;
+ push @{ $self->{extra_compiler_flags} }, @_;
+}
+
+=head2 $cc->push_extra_linker_flags
+
+Adds more linker flags
+
+=cut
+
+sub push_extra_linker_flags
+{
+ my $self = shift;
+ push @{ $self->{extra_linker_flags} }, @_;
+}
+
sub cbuilder
{
my $self = shift;
@@ -169,7 +205,7 @@
my $self = shift;
my ( $symbol ) = @_;
- push @{ $self->{extra_compiler_flags} }, "-D$symbol";
+ $self->push_extra_compiler_flags( "-D$symbol" );
}
=head2 $success = $cc->try_compile_run( %args )
@@ -339,7 +375,7 @@
$self->try_compile_run( %args, include_dirs => $d ) or next;
- push @{ $self->{include_dirs} }, @$d;
+ $self->push_include_dirs( @$d );
return 1;
}
@@ -393,7 +429,7 @@
$self->try_compile_run( %args, extra_linker_flags => \@extra_linker_flags ) or next;
- push @{ $self->{extra_linker_flags} }, @extra_linker_flags;
+ $self->push_extra_linker_flags( @extra_linker_flags );
return 1;
}
@@ -452,14 +488,20 @@
sub new_module_build
{
my $self = shift;
+ my %args = @_;
+
require Module::Build;
- return Module::Build->new(
- include_dirs => $self->include_dirs,
- extra_compiler_flags => $self->extra_compiler_flags,
- extra_linker_flags => $self->extra_linker_flags,
- @_,
- );
+ foreach my $key (qw( include_dirs extra_compiler_flags extra_linker_flags )) {
+ if( exists $args{$key} ) {
+ $args{$key} = [ @{ $self->$key }, @{ $args{$key} } ];
+ }
+ else {
+ $args{$key} = $self->$key;
+ }
+ }
+
+ return Module::Build->new( %args );
}
# Keep perl happy; keep Britain tidy
Added: branches/upstream/libextutils-cchecker-perl/current/t/03accessors.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libextutils-cchecker-perl/current/t/03accessors.t?rev=65542&op=file
==============================================================================
--- branches/upstream/libextutils-cchecker-perl/current/t/03accessors.t (added)
+++ branches/upstream/libextutils-cchecker-perl/current/t/03accessors.t Sun Dec 5 11:28:01 2010
@@ -1,0 +1,23 @@
+#!/usr/bin/perl -w
+
+use strict;
+use Test::More tests => 6;
+
+use ExtUtils::CChecker;
+
+my $cc = ExtUtils::CChecker->new;
+
+is_deeply( $cc->include_dirs, [], 'include_dirs empty initially' );
+
+$cc->push_include_dirs( "/usr/include/foo" );
+is_deeply( $cc->include_dirs, [ "/usr/include/foo" ], 'include_dirs after push_include_dirs' );
+
+is_deeply( $cc->extra_compiler_flags, [], 'extra_compiler_flags empty initially' );
+
+$cc->push_extra_compiler_flags( "-DHAVE_FOO" );
+is_deeply( $cc->extra_compiler_flags, [ "-DHAVE_FOO" ], 'extra_compiler_flags after push_extra_compiler_flags' );
+
+is_deeply( $cc->extra_linker_flags, [], 'extra_linker_flags empty initially' );
+
+$cc->push_extra_linker_flags( "-lfoo" );
+is_deeply( $cc->extra_linker_flags, [ "-lfoo" ], 'extra_linker_flags after push_extra_linker_flags' );
Added: branches/upstream/libextutils-cchecker-perl/current/t/04module_build.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libextutils-cchecker-perl/current/t/04module_build.t?rev=65542&op=file
==============================================================================
--- branches/upstream/libextutils-cchecker-perl/current/t/04module_build.t (added)
+++ branches/upstream/libextutils-cchecker-perl/current/t/04module_build.t Sun Dec 5 11:28:01 2010
@@ -1,0 +1,62 @@
+#!/usr/bin/perl -w
+
+use strict;
+use Test::More tests => 4;
+use Test::Exception;
+
+use ExtUtils::CChecker;
+
+my $mbpackage;
+my %mbargs;
+my $mbret;
+
+no warnings 'once';
+local *Module::Build::new = sub {
+ ( $mbpackage, %mbargs ) = @_;
+ return $mbret;
+};
+
+my $cc = ExtUtils::CChecker->new;
+
+$cc->new_module_build( module_name => "Foo::Bar" );
+
+is( $mbpackage, "Module::Build", '$mbpackage after ->new_module_build' );
+is_deeply( \%mbargs,
+ {
+ module_name => "Foo::Bar",
+ include_dirs => [],
+ extra_compiler_flags => [],
+ extra_linker_flags => [],
+ },
+ '%mbargs after ->new_module_build' );
+
+$cc->push_include_dirs( "/usr/include/foo" );
+$cc->push_extra_compiler_flags( "-DHAVE_FOO" );
+$cc->push_extra_linker_flags( "-lfoo" );
+
+$cc->new_module_build( module_name => "Foo::Bar" );
+
+is_deeply( \%mbargs,
+ {
+ module_name => "Foo::Bar",
+ include_dirs => [ "/usr/include/foo" ],
+ extra_compiler_flags => [ "-DHAVE_FOO" ],
+ extra_linker_flags => [ "-lfoo" ],
+ },
+ '%mbargs sees correct dirs and flags' );
+
+$cc->new_module_build(
+ module_name => "Foo::Bar",
+ include_dirs => [ "/usr/include/bar" ],
+ extra_compiler_flags => [ "-DHAVE_BAR" ],
+ extra_linker_flags => [ "-lbar" ],
+);
+
+is_deeply( \%mbargs,
+ {
+ module_name => "Foo::Bar",
+ include_dirs => [ "/usr/include/foo", "/usr/include/bar" ],
+ extra_compiler_flags => [ "-DHAVE_FOO", "-DHAVE_BAR" ],
+ extra_linker_flags => [ "-lfoo", "-lbar" ],
+ },
+ 'new_module_build merges %args and internal configuration' );
More information about the Pkg-perl-cvs-commits
mailing list