r59852 - in /trunk/libextutils-cchecker-perl: Changes META.yml Makefile.PL README debian/changelog debian/control debian/rules lib/ExtUtils/CChecker.pm
ansgar-guest at users.alioth.debian.org
ansgar-guest at users.alioth.debian.org
Sun Jun 27 07:45:40 UTC 2010
Author: ansgar-guest
Date: Sun Jun 27 07:45:29 2010
New Revision: 59852
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=59852
Log:
* New upstream release.
* Use Build.PL.
* Add myself to Uploaders.
Modified:
trunk/libextutils-cchecker-perl/Changes
trunk/libextutils-cchecker-perl/META.yml
trunk/libextutils-cchecker-perl/Makefile.PL
trunk/libextutils-cchecker-perl/README
trunk/libextutils-cchecker-perl/debian/changelog
trunk/libextutils-cchecker-perl/debian/control
trunk/libextutils-cchecker-perl/debian/rules
trunk/libextutils-cchecker-perl/lib/ExtUtils/CChecker.pm
Modified: trunk/libextutils-cchecker-perl/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libextutils-cchecker-perl/Changes?rev=59852&op=diff
==============================================================================
--- trunk/libextutils-cchecker-perl/Changes (original)
+++ trunk/libextutils-cchecker-perl/Changes Sun Jun 27 07:45:29 2010
@@ -1,4 +1,8 @@
Revision history for ExtUtils-CChecker
+
+0.04 CHANGES:
+ * Provide optional variants of ->find_include_dirs_for and
+ ->find_libs_for with try_... prefix
0.03 CHANGES:
* Support defining compiler symbols based on successful test runs,
Modified: trunk/libextutils-cchecker-perl/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libextutils-cchecker-perl/META.yml?rev=59852&op=diff
==============================================================================
--- trunk/libextutils-cchecker-perl/META.yml (original)
+++ trunk/libextutils-cchecker-perl/META.yml Sun Jun 27 07:45:29 2010
@@ -8,7 +8,7 @@
Test::More: 0
configure_requires:
Module::Build: 0.36
-generated_by: 'Module::Build version 0.3603'
+generated_by: 'Module::Build version 0.3607'
license: perl
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
@@ -17,9 +17,9 @@
provides:
ExtUtils::CChecker:
file: lib/ExtUtils/CChecker.pm
- version: 0.03
+ version: 0.04
requires:
ExtUtils::CBuilder: 0
resources:
license: http://dev.perl.org/licenses/
-version: 0.03
+version: 0.04
Modified: trunk/libextutils-cchecker-perl/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libextutils-cchecker-perl/Makefile.PL?rev=59852&op=diff
==============================================================================
--- trunk/libextutils-cchecker-perl/Makefile.PL (original)
+++ trunk/libextutils-cchecker-perl/Makefile.PL Sun Jun 27 07:45:29 2010
@@ -1,4 +1,4 @@
-# Note: this file was auto-generated by Module::Build::Compat version 0.3603
+# Note: this file was auto-generated by Module::Build::Compat version 0.3607
use Module::Build::Compat 0.02;
Module::Build::Compat->run_build_pl(args => \@ARGV);
Modified: trunk/libextutils-cchecker-perl/README
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libextutils-cchecker-perl/README?rev=59852&op=diff
==============================================================================
--- trunk/libextutils-cchecker-perl/README (original)
+++ trunk/libextutils-cchecker-perl/README Sun Jun 27 07:45:29 2010
@@ -57,7 +57,7 @@
$success = $cc->try_compile_run( %args )
$success = $cc->try_compile_run( $source )
- Try to complile, link, and execute a C program whose source is given.
+ Try to compile, link, and execute a C program whose source is given.
Returns true if the program compiled and linked, and exited
successfully. Returns false if any of these steps fail.
@@ -95,15 +95,15 @@
if one is generated. It may provide more useful information to
the user on why the OS is unsupported.
- $cc->find_include_dirs_for( %args )
+ $success = $cc->try_find_include_dirs_for( %args )
Try to compile, link and execute the given source, using extra include
directories.
When a usable combination is found, the directories required are stored
in the object for use in further compile operations, or returned by
- "include_dirs".
-
- If no usable combination is found, an assertion message is thrown.
+ "include_dirs". The method then returns true.
+
+ If no a usable combination is found, it returns false.
Takes the following arguments:
@@ -116,20 +116,21 @@
Gives a list of sets of dirs. Each set of dirs should be strings
in its own array reference.
- * diag => STRING
-
- If present, this string will be appended to the failure message
- if one is generated.
-
- $cc->find_libs_for( %args )
+ * define => STRING
+
+ Optional. If specified, then the named symbol will be defined on
+ the C compiler commandline if the program ran successfully (by
+ passing an option "-D*SYMBOL*").
+
+ $success = $cc->try_find_libs_for( %args )
Try to compile, link and execute the given source, when linked against a
given set of extra libraries.
When a usable combination is found, the libraries required are stored in
the object for use in further link operations, or returned by
- "extra_linker_flags".
-
- If no usable combination is found, an assertion message is thrown.
+ "extra_linker_flags". The method then returns true.
+
+ If no usable combination is found, it returns false.
Takes the following arguments:
@@ -142,10 +143,24 @@
Gives a list of sets of libraries. Each set of libraries should
be space-separated.
+ * define => STRING
+
+ Optional. If specified, then the named symbol will be defined on
+ the C compiler commandline if the program ran successfully (by
+ passing an option "-D*SYMBOL*").
+
+ $cc->find_include_dirs_for( %args )
+ $cc->find_libs_for( %args )
+ Calls "try_find_include_dirs_for" or "try_find_libs_for" respectively.
+ If it fails, die with an "OS unsupported" message.
+
+ Each method takes one extra optional argument:
+
* diag => STRING
If present, this string will be appended to the failure message
- if one is generated.
+ if one is generated. It may provide more useful information to
+ the user on why the OS is unsupported.
$mb = $cc->new_module_build( %args )
Construct and return a new Module::Build object, preconfigured with the
@@ -241,6 +256,46 @@
this particular function. Trying to invoke the function at runtime will
simply throw an exception.
+ Linux Kernel Headers
+ Operating systems built on top of the Linux kernel often share a looser
+ association with their kernel version than most other operating systems.
+ It may be the case that the running kernel is newer, containing more
+ features, than the distribution's libc headers would believe. In such
+ circumstances it can be difficult to make use of new socket options,
+ "ioctl()"s, etc.. without having the constants that define them and
+ their parameter structures, because the relevant header files are not
+ visible to the compiler. In this case, there may be little choice but to
+ pull in some of the kernel header files, which will provide the required
+ constants and structures.
+
+ The Linux kernel headers can be found using the /lib/modules directory.
+ A fragment in Build.PL like the following, may be appropriate.
+
+ chomp( my $uname_r = `uname -r` );
+
+ my @dirs = (
+ [],
+ [ "/lib/modules/$uname_r/source/include" ],
+ );
+
+ $cc->find_include_dirs_for(
+ diag => "no PF_MOONLASER",
+ dirs => \@dirs,
+ source => <<'EOF' );
+ #include <sys/socket.h>
+ #include <moon/laser.h>
+ int family = PF_MOONLASER;
+ struct laserwl lwl;
+ int main(int argc, char *argv[]) {
+ return 0;
+ }
+ EOF
+
+ This fragment will first try to compile the program as it stands, hoping
+ that the libc headers will be sufficient. If it fails, it will then try
+ including the kernel headers, which should make the constant and
+ structure visible, allowing the program to compile.
+
AUTHOR
Paul Evans <leonerd at leonerd.org.uk>
Modified: trunk/libextutils-cchecker-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libextutils-cchecker-perl/debian/changelog?rev=59852&op=diff
==============================================================================
--- trunk/libextutils-cchecker-perl/debian/changelog (original)
+++ trunk/libextutils-cchecker-perl/debian/changelog Sun Jun 27 07:45:29 2010
@@ -1,9 +1,10 @@
-libextutils-cchecker-perl (0.03-2) UNRELEASED; urgency=low
+libextutils-cchecker-perl (0.04-1) unstable; urgency=low
- * Bumped up BD on debhelper to (>= 7.0.17):
- + Makefile is built using Module::Build::Compat.
+ * New upstream release.
+ * Use Build.PL.
+ * Add myself to Uploaders.
- -- Franck Joncourt <franck at debian.org> Mon, 08 Mar 2010 22:26:41 +0100
+ -- Ansgar Burchardt <ansgar at 43-1.org> Sun, 27 Jun 2010 16:44:41 +0900
libextutils-cchecker-perl (0.03-1) unstable; urgency=low
Modified: trunk/libextutils-cchecker-perl/debian/control
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libextutils-cchecker-perl/debian/control?rev=59852&op=diff
==============================================================================
--- trunk/libextutils-cchecker-perl/debian/control (original)
+++ trunk/libextutils-cchecker-perl/debian/control Sun Jun 27 07:45:29 2010
@@ -1,10 +1,10 @@
Source: libextutils-cchecker-perl
Section: perl
Priority: optional
-Build-Depends: debhelper (>= 7.0.17), perl (>= 5.10) | libmodule-build-perl
+Build-Depends: debhelper (>= 7.3.7~), perl (>= 5.10) | libmodule-build-perl
Build-Depends-Indep: perl, libtest-exception-perl, libtest-pod-perl
Maintainer: Debian Perl Group <pkg-perl-maintainers at lists.alioth.debian.org>
-Uploaders: Jonathan Yu <jawnsy at cpan.org>
+Uploaders: Jonathan Yu <jawnsy at cpan.org>, Ansgar Burchardt <ansgar at 43-1.org>
Standards-Version: 3.8.4
Homepage: http://search.cpan.org/dist/ExtUtils-CChecker/
Vcs-Svn: svn://svn.debian.org/pkg-perl/trunk/libextutils-cchecker-perl/
Modified: trunk/libextutils-cchecker-perl/debian/rules
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libextutils-cchecker-perl/debian/rules?rev=59852&op=diff
==============================================================================
--- trunk/libextutils-cchecker-perl/debian/rules (original)
+++ trunk/libextutils-cchecker-perl/debian/rules Sun Jun 27 07:45:29 2010
@@ -1,4 +1,4 @@
#!/usr/bin/make -f
%:
- dh $@
+ dh --buildsystem=perl_build $@
Modified: trunk/libextutils-cchecker-perl/lib/ExtUtils/CChecker.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libextutils-cchecker-perl/lib/ExtUtils/CChecker.pm?rev=59852&op=diff
==============================================================================
--- trunk/libextutils-cchecker-perl/lib/ExtUtils/CChecker.pm (original)
+++ trunk/libextutils-cchecker-perl/lib/ExtUtils/CChecker.pm Sun Jun 27 07:45:29 2010
@@ -8,7 +8,7 @@
use strict;
use warnings;
-our $VERSION = '0.03';
+our $VERSION = '0.04';
use Carp;
@@ -164,11 +164,19 @@
die $message;
}
+sub define
+{
+ my $self = shift;
+ my ( $symbol ) = @_;
+
+ push @{ $self->{extra_compiler_flags} }, "-D$symbol";
+}
+
=head2 $success = $cc->try_compile_run( %args )
=head2 $success = $cc->try_compile_run( $source )
-Try to complile, link, and execute a C program whose source is given. Returns
+Try to compile, link, and execute a C program whose source is given. Returns
true if the program compiled and linked, and exited successfully. Returns
false if any of these steps fail.
@@ -252,7 +260,7 @@
unlink $test_exe;
- push @{ $self->{extra_compiler_flags} }, "-D$args{define}" if defined $args{define};
+ $self->define( $args{define} ) if defined $args{define};
return 1;
}
@@ -285,15 +293,16 @@
$self->try_compile_run( %args ) or $self->fail( $diag );
}
-=head2 $cc->find_include_dirs_for( %args )
+=head2 $success = $cc->try_find_include_dirs_for( %args )
Try to compile, link and execute the given source, using extra include
directories.
When a usable combination is found, the directories required are stored in the
object for use in further compile operations, or returned by C<include_dirs>.
-
-If no usable combination is found, an assertion message is thrown.
+The method then returns true.
+
+If no a usable combination is found, it returns false.
Takes the following arguments:
@@ -308,26 +317,22 @@
Gives a list of sets of dirs. Each set of dirs should be strings in its own
array reference.
-=item * diag => STRING
-
-If present, this string will be appended to the failure message if one is
-generated.
+=item * define => STRING
+
+Optional. If specified, then the named symbol will be defined on the C
+compiler commandline if the program ran successfully (by passing an option
+C<-DI<SYMBOL>>).
=back
=cut
-sub find_include_dirs_for
+sub try_find_include_dirs_for
{
my $self = shift;
my %args = @_;
- my $diag = delete $args{diag};
-
ref( my $dirs = $args{dirs} ) eq "ARRAY" or croak "Expected 'dirs' as ARRAY ref";
-
- my @include_dirs;
- push @include_dirs, $args{include_dirs} if exists $args{include_dirs};
foreach my $d ( @$dirs ) {
ref $d eq "ARRAY" or croak "Expected 'dirs' element as ARRAY ref";
@@ -335,22 +340,23 @@
$self->try_compile_run( %args, include_dirs => $d ) or next;
push @{ $self->{include_dirs} }, @$d;
- return;
+
+ return 1;
}
- $self->fail( $diag );
-}
-
-=head2 $cc->find_libs_for( %args )
+ return 0;
+}
+
+=head2 $success = $cc->try_find_libs_for( %args )
Try to compile, link and execute the given source, when linked against a
given set of extra libraries.
When a usable combination is found, the libraries required are stored in the
object for use in further link operations, or returned by
-C<extra_linker_flags>.
-
-If no usable combination is found, an assertion message is thrown.
+C<extra_linker_flags>. The method then returns true.
+
+If no usable combination is found, it returns false.
Takes the following arguments:
@@ -365,21 +371,20 @@
Gives a list of sets of libraries. Each set of libraries should be
space-separated.
-=item * diag => STRING
-
-If present, this string will be appended to the failure message if one is
-generated.
+=item * define => STRING
+
+Optional. If specified, then the named symbol will be defined on the C
+compiler commandline if the program ran successfully (by passing an option
+C<-DI<SYMBOL>>).
=back
=cut
-sub find_libs_for
+sub try_find_libs_for
{
my $self = shift;
my %args = @_;
-
- my $diag = delete $args{diag};
ref( my $libs = $args{libs} ) eq "ARRAY" or croak "Expected 'libs' as ARRAY ref";
@@ -389,10 +394,47 @@
$self->try_compile_run( %args, extra_linker_flags => \@extra_linker_flags ) or next;
push @{ $self->{extra_linker_flags} }, @extra_linker_flags;
- return;
+
+ return 1;
}
- $self->fail( $diag );
+ return 0;
+}
+
+=head2 $cc->find_include_dirs_for( %args )
+
+=head2 $cc->find_libs_for( %args )
+
+Calls C<try_find_include_dirs_for> or C<try_find_libs_for> respectively. If it
+fails, die with an C<OS unsupported> message.
+
+Each method takes one extra optional argument:
+
+=over 8
+
+=item * diag => STRING
+
+If present, this string will be appended to the failure message if one is
+generated. It may provide more useful information to the user on why the OS is
+unsupported.
+
+=back
+
+=cut
+
+foreach ( qw( find_libs_for find_include_dirs_for ) ) {
+ my $trymethod = "try_$_";
+
+ my $code = sub {
+ my $self = shift;
+ my %args = @_;
+
+ my $diag = delete $args{diag};
+ $self->$trymethod( %args ) or $self->fail( $diag );
+ };
+
+ no strict 'refs';
+ *$_ = $code;
}
=head2 $mb = $cc->new_module_build( %args )
@@ -512,6 +554,46 @@
particular function. Trying to invoke the function at runtime will simply
throw an exception.
+=head2 Linux Kernel Headers
+
+Operating systems built on top of the F<Linux> kernel often share a looser
+association with their kernel version than most other operating systems. It
+may be the case that the running kernel is newer, containing more features,
+than the distribution's F<libc> headers would believe. In such circumstances
+it can be difficult to make use of new socket options, C<ioctl()>s, etc..
+without having the constants that define them and their parameter structures,
+because the relevant header files are not visible to the compiler. In this
+case, there may be little choice but to pull in some of the kernel header
+files, which will provide the required constants and structures.
+
+The Linux kernel headers can be found using the F</lib/modules> directory. A
+fragment in F<Build.PL> like the following, may be appropriate.
+
+ chomp( my $uname_r = `uname -r` );
+
+ my @dirs = (
+ [],
+ [ "/lib/modules/$uname_r/source/include" ],
+ );
+
+ $cc->find_include_dirs_for(
+ diag => "no PF_MOONLASER",
+ dirs => \@dirs,
+ source => <<'EOF' );
+ #include <sys/socket.h>
+ #include <moon/laser.h>
+ int family = PF_MOONLASER;
+ struct laserwl lwl;
+ int main(int argc, char *argv[]) {
+ return 0;
+ }
+ EOF
+
+This fragment will first try to compile the program as it stands, hoping that
+the F<libc> headers will be sufficient. If it fails, it will then try
+including the kernel headers, which should make the constant and structure
+visible, allowing the program to compile.
+
=head1 AUTHOR
Paul Evans <leonerd at leonerd.org.uk>
More information about the Pkg-perl-cvs-commits
mailing list