r53951 - in /trunk/libextutils-cchecker-perl: Changes META.yml Makefile.PL README debian/README.source debian/changelog debian/control debian/patches/ debian/rules debian/source/ debian/source/format lib/ExtUtils/CChecker.pm t/01run.t t/02assert.t
jawnsy-guest at users.alioth.debian.org
jawnsy-guest at users.alioth.debian.org
Mon Mar 8 17:44:50 UTC 2010
Author: jawnsy-guest
Date: Mon Mar 8 17:44:43 2010
New Revision: 53951
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=53951
Log:
* New upstream release
* Use new 3.0 (quilt) source format
* Remove spelling patches, applied upstream
Added:
trunk/libextutils-cchecker-perl/debian/source/
trunk/libextutils-cchecker-perl/debian/source/format
Removed:
trunk/libextutils-cchecker-perl/debian/README.source
trunk/libextutils-cchecker-perl/debian/patches/
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
trunk/libextutils-cchecker-perl/t/01run.t
trunk/libextutils-cchecker-perl/t/02assert.t
Modified: trunk/libextutils-cchecker-perl/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libextutils-cchecker-perl/Changes?rev=53951&op=diff
==============================================================================
--- trunk/libextutils-cchecker-perl/Changes (original)
+++ trunk/libextutils-cchecker-perl/Changes Mon Mar 8 17:44:43 2010
@@ -1,4 +1,10 @@
Revision history for ExtUtils-CChecker
+
+0.03 CHANGES:
+ * Support defining compiler symbols based on successful test runs,
+ so XS code can be conditional on it
+ * Line-terminate test C code to avoid (harmless) warnings from some
+ C compilers
0.02 CHANGES:
* Support automatic construction of a preconfigured Module::Build
Modified: trunk/libextutils-cchecker-perl/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libextutils-cchecker-perl/META.yml?rev=53951&op=diff
==============================================================================
--- trunk/libextutils-cchecker-perl/META.yml (original)
+++ trunk/libextutils-cchecker-perl/META.yml Mon Mar 8 17:44:43 2010
@@ -8,7 +8,7 @@
Test::More: 0
configure_requires:
Module::Build: 0.36
-generated_by: 'Module::Build version 0.3601'
+generated_by: 'Module::Build version 0.3603'
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.02
+ version: 0.03
requires:
ExtUtils::CBuilder: 0
resources:
license: http://dev.perl.org/licenses/
-version: 0.02
+version: 0.03
Modified: trunk/libextutils-cchecker-perl/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libextutils-cchecker-perl/Makefile.PL?rev=53951&op=diff
==============================================================================
--- trunk/libextutils-cchecker-perl/Makefile.PL (original)
+++ trunk/libextutils-cchecker-perl/Makefile.PL Mon Mar 8 17:44:43 2010
@@ -1,4 +1,4 @@
-# Note: this file was auto-generated by Module::Build::Compat version 0.3601
+# Note: this file was auto-generated by Module::Build::Compat version 0.3603
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=53951&op=diff
==============================================================================
--- trunk/libextutils-cchecker-perl/README (original)
+++ trunk/libextutils-cchecker-perl/README Mon Mar 8 17:44:43 2010
@@ -58,8 +58,8 @@
$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.
- Returns true if the program compiled and linked, and exited sucessfully.
- Returns false if any of these steps fail.
+ Returns true if the program compiled and linked, and exited
+ successfully. Returns false if any of these steps fail.
Takes the following named arguments. If a single argument is given, that
is taken as the source string.
@@ -76,6 +76,12 @@
* extra_linker_flags => ARRAY
Optional. If specified, pass extra flags to the linker.
+
+ * 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->assert_compile_run( %args )
Calls "try_compile_run". If it fails, die with an "OS unsupported"
@@ -186,6 +192,55 @@
"extra_linker_flags" value has been automatically passed into the new
"Module::Build" object.
+ Testing For Optional Features
+ Sometimes a function or ability may be optionally provided by the OS, or
+ you may wish your module to be useable when only partial support is
+ provided, without requiring it all to be present. In these cases it is
+ traditional to detect the presence of this optional feature in the
+ Build.PL script, and define a symbol to declare this fact if it is
+ found. The XS code can then use this symbol to select between differing
+ implementations. For example, the Build.PL:
+
+ use Module::Build;
+ use ExtUtils::CChecker;
+
+ my $cc = ExtUtils::CChecker->new;
+
+ $cc->try_compile_run(
+ define => "HAVE_MANGO",
+ source => <<'EOF' );
+ #include <mango.h>
+ #include <unistd.h>
+ int main(void) {
+ if(mango() != 0)
+ exit(1);
+ exit(0);
+ }
+ EOF
+
+ $cc->new_module_build(
+ ...
+ )->create_build_script;
+
+ If the C code compiles and runs successfully, and exits with a true
+ status, the symbol "HAVE_MANGO" will be defined on the compiler
+ commandline. This allows the XS code to detect it, for example
+
+ int
+ mango()
+ CODE:
+ #ifdef HAVE_MANGO
+ RETVAL = mango();
+ #else
+ croak("mango() not implemented");
+ #endif
+ OUTPUT:
+ RETVAL
+
+ This module will then still compile even if the operating system lacks
+ this particular function. Trying to invoke the function at runtime will
+ simply throw an exception.
+
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=53951&op=diff
==============================================================================
--- trunk/libextutils-cchecker-perl/debian/changelog (original)
+++ trunk/libextutils-cchecker-perl/debian/changelog Mon Mar 8 17:44:43 2010
@@ -1,3 +1,11 @@
+libextutils-cchecker-perl (0.03-1) UNRELEASED; urgency=low
+
+ * New upstream release
+ * Use new 3.0 (quilt) source format
+ * Remove spelling patches, applied upstream
+
+ -- Jonathan Yu <jawnsy at cpan.org> Mon, 08 Mar 2010 13:06:43 -0500
+
libextutils-cchecker-perl (0.02-1) unstable; urgency=low
* Initial Release (Closes: #567603)
Modified: trunk/libextutils-cchecker-perl/debian/control
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libextutils-cchecker-perl/debian/control?rev=53951&op=diff
==============================================================================
--- trunk/libextutils-cchecker-perl/debian/control (original)
+++ trunk/libextutils-cchecker-perl/debian/control Mon Mar 8 17:44:43 2010
@@ -1,8 +1,7 @@
Source: libextutils-cchecker-perl
Section: perl
Priority: optional
-Build-Depends: debhelper (>= 7.0.8), quilt (>= 0.46-7),
- perl (>= 5.10) | libmodule-build-perl
+Build-Depends: debhelper (>= 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>
Modified: trunk/libextutils-cchecker-perl/debian/rules
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libextutils-cchecker-perl/debian/rules?rev=53951&op=diff
==============================================================================
--- trunk/libextutils-cchecker-perl/debian/rules (original)
+++ trunk/libextutils-cchecker-perl/debian/rules Mon Mar 8 17:44:43 2010
@@ -1,4 +1,4 @@
#!/usr/bin/make -f
%:
- dh --with quilt $@
+ dh $@
Added: trunk/libextutils-cchecker-perl/debian/source/format
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libextutils-cchecker-perl/debian/source/format?rev=53951&op=file
==============================================================================
--- trunk/libextutils-cchecker-perl/debian/source/format (added)
+++ trunk/libextutils-cchecker-perl/debian/source/format Mon Mar 8 17:44:43 2010
@@ -1,0 +1,1 @@
+3.0 (quilt)
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=53951&op=diff
==============================================================================
--- trunk/libextutils-cchecker-perl/lib/ExtUtils/CChecker.pm (original)
+++ trunk/libextutils-cchecker-perl/lib/ExtUtils/CChecker.pm Mon Mar 8 17:44:43 2010
@@ -8,7 +8,7 @@
use strict;
use warnings;
-our $VERSION = '0.02';
+our $VERSION = '0.03';
use Carp;
@@ -169,8 +169,8 @@
=head2 $success = $cc->try_compile_run( $source )
Try to complile, link, and execute a C program whose source is given. Returns
-true if the program compiled and linked, and exited sucessfully. Returns false
-if any of these steps fail.
+true if the program compiled and linked, and exited successfully. Returns
+false if any of these steps fail.
Takes the following named arguments. If a single argument is given, that is
taken as the source string.
@@ -188,6 +188,12 @@
=item * extra_linker_flags => ARRAY
Optional. If specified, pass extra flags to the linker.
+
+=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
@@ -245,6 +251,8 @@
}
unlink $test_exe;
+
+ push @{ $self->{extra_compiler_flags} }, "-D$args{define}" if defined $args{define};
return 1;
}
@@ -454,6 +462,56 @@
By using the C<new_module_build> method, the detected C<extra_linker_flags>
value has been automatically passed into the new C<Module::Build> object.
+=head2 Testing For Optional Features
+
+Sometimes a function or ability may be optionally provided by the OS, or you
+may wish your module to be useable when only partial support is provided,
+without requiring it all to be present. In these cases it is traditional to
+detect the presence of this optional feature in the F<Build.PL> script, and
+define a symbol to declare this fact if it is found. The XS code can then use
+this symbol to select between differing implementations. For example, the
+F<Build.PL>:
+
+ use Module::Build;
+ use ExtUtils::CChecker;
+
+ my $cc = ExtUtils::CChecker->new;
+
+ $cc->try_compile_run(
+ define => "HAVE_MANGO",
+ source => <<'EOF' );
+ #include <mango.h>
+ #include <unistd.h>
+ int main(void) {
+ if(mango() != 0)
+ exit(1);
+ exit(0);
+ }
+ EOF
+
+ $cc->new_module_build(
+ ...
+ )->create_build_script;
+
+If the C code compiles and runs successfully, and exits with a true status,
+the symbol C<HAVE_MANGO> will be defined on the compiler commandline. This
+allows the XS code to detect it, for example
+
+ int
+ mango()
+ CODE:
+ #ifdef HAVE_MANGO
+ RETVAL = mango();
+ #else
+ croak("mango() not implemented");
+ #endif
+ OUTPUT:
+ RETVAL
+
+This module will then still compile even if the operating system lacks this
+particular function. Trying to invoke the function at runtime will simply
+throw an exception.
+
=head1 AUTHOR
Paul Evans <leonerd at leonerd.org.uk>
Modified: trunk/libextutils-cchecker-perl/t/01run.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libextutils-cchecker-perl/t/01run.t?rev=53951&op=diff
==============================================================================
--- trunk/libextutils-cchecker-perl/t/01run.t (original)
+++ trunk/libextutils-cchecker-perl/t/01run.t Mon Mar 8 17:44:43 2010
@@ -1,7 +1,7 @@
#!/usr/bin/perl -w
use strict;
-use Test::More tests => 5;
+use Test::More tests => 6;
use ExtUtils::CChecker;
@@ -10,7 +10,14 @@
ok( defined $cc, 'defined $cc' );
isa_ok( $cc, "ExtUtils::CChecker", '$cc' );
-ok( $cc->try_compile_run( "int main(void) { return 0; }" ), 'Trivial C program compiles and runs' );
-ok( !$cc->try_compile_run( "int foo bar splot" ), 'Broken C program does not compile and run' );
+ok( $cc->try_compile_run( "int main(void) { return 0; }\n" ), 'Trivial C program compiles and runs' );
+ok( !$cc->try_compile_run( "int foo bar splot\n" ), 'Broken C program does not compile and run' );
-ok( $cc->try_compile_run( source => "int main(void) { return 0; }" ), 'source named argument' );
+ok( $cc->try_compile_run( source => "int main(void) { return 0; }\n" ), 'source named argument' );
+
+$cc->try_compile_run(
+ source => "int main(void) { return 0; }\n",
+ define => "HAVE_C",
+);
+
+is_deeply( $cc->extra_compiler_flags, [ "-DHAVE_C" ], 'HAVE_C defined' );
Modified: trunk/libextutils-cchecker-perl/t/02assert.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libextutils-cchecker-perl/t/02assert.t?rev=53951&op=diff
==============================================================================
--- trunk/libextutils-cchecker-perl/t/02assert.t (original)
+++ trunk/libextutils-cchecker-perl/t/02assert.t Mon Mar 8 17:44:43 2010
@@ -9,12 +9,12 @@
my $cc = ExtUtils::CChecker->new;
lives_ok(
- sub { $cc->assert_compile_run( source => "int main(void) { return 0; }", diag => "OK source" ); },
+ sub { $cc->assert_compile_run( source => "int main(void) { return 0; }\n", diag => "OK source" ); },
'Trivial C program'
);
throws_ok(
- sub { $cc->assert_compile_run( source => "int foo bar splot", diag => "broken source" ); },
+ sub { $cc->assert_compile_run( source => "int foo bar splot\n", diag => "broken source" ); },
qr/^OS unsupported - broken source$/,
'Broken C program does not compile and run'
);
More information about the Pkg-perl-cvs-commits
mailing list