Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the ExtUtils-ParseXS CPAN distribution.

Report information
The Basics
Id: 23523
Status: resolved
Priority: 0/
Queue: ExtUtils-ParseXS

People
Owner: Nobody in particular
Requestors: jdhedden [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in:
  • 2.07
  • 2.08
  • 2.09
  • 2.10
  • 2.11
  • 2.12
  • 2.13
  • 2.14
  • 2.15
  • 2.16
  • 2.17
Fixed in: (no value)



Subject: Make ExtUtils::CBuilder optional
ExtUtils::CBuilder is only needed for testing, and so should not be made mandatory. The attached patch makes it optional, and skips tests where it would be needed.
Subject: parsexs.patch
diff -urN ExtUtils-ParseXS-2.17/Build.PL ExtUtils-ParseXS-patched/Build.PL --- ExtUtils-ParseXS-2.17/Build.PL 2006-11-20 18:07:18.000000000 -0500 +++ ExtUtils-ParseXS-patched/Build.PL 2006-11-21 09:18:44.000000000 -0500 @@ -13,7 +13,7 @@ 'File::Spec' => 0, 'Exporter' => 0, }, - build_requires => { + recommends => { 'ExtUtils::CBuilder' => 0, }, add_to_cleanup => ["t/XSTest.c", "t/XSTest$Config{obj_ext}", "t/XSTest.$Config{dlext}"], diff -urN ExtUtils-ParseXS-2.17/Makefile.PL ExtUtils-ParseXS-patched/Makefile.PL --- ExtUtils-ParseXS-2.17/Makefile.PL 2006-11-20 18:07:18.000000000 -0500 +++ ExtUtils-ParseXS-patched/Makefile.PL 2006-11-21 09:00:12.000000000 -0500 @@ -8,7 +8,6 @@ 'Config' => '0', 'Cwd' => '0', 'Exporter' => '0', - 'ExtUtils::CBuilder' => '0', 'File::Basename' => '0', 'File::Spec' => '0' }, diff -urN ExtUtils-ParseXS-2.17/t/basic.t ExtUtils-ParseXS-patched/t/basic.t --- ExtUtils-ParseXS-2.17/t/basic.t 2006-11-20 18:07:18.000000000 -0500 +++ ExtUtils-ParseXS-patched/t/basic.t 2006-11-21 09:04:24.000000000 -0500 @@ -13,7 +13,6 @@ BEGIN { plan tests => 10 }; use DynaLoader; use ExtUtils::ParseXS qw(process_file); -use ExtUtils::CBuilder; ok(1); # If we made it this far, we're loaded. chdir 't' or die "Can't chdir to t/, $!"; @@ -36,38 +35,43 @@ # TEST doesn't like extraneous output my $quiet = $ENV{PERL_CORE} && !$ENV{HARNESS_ACTIVE}; -# Try to compile the file! Don't get too fancy, though. -my $b = ExtUtils::CBuilder->new(quiet => $quiet); -if ($b->have_compiler) { - my $module = 'XSTest'; - - my $obj_file = $b->compile( source => $source_file ); - ok $obj_file; - ok -e $obj_file, 1, "Make sure $obj_file exists"; - - my $lib_file = $b->link( objects => $obj_file, module_name => $module ); - ok $lib_file; - ok -e $lib_file, 1, "Make sure $lib_file exists"; - - eval {require XSTest}; - ok $@, ''; - ok XSTest::is_even(8); - ok !XSTest::is_even(9); - - # Win32 needs to close the DLL before it can unlink it, but unfortunately - # dl_unload_file was missing on Win32 prior to perl change #24679! - if ($^O eq 'MSWin32' and defined &DynaLoader::dl_unload_file) { - for (my $i = 0; $i < @DynaLoader::dl_modules; $i++) { - if ($DynaLoader::dl_modules[$i] eq $module) { - DynaLoader::dl_unload_file($DynaLoader::dl_librefs[$i]); - last; +eval { require ExtUtils::CBuilder; }; +if ($@) { + skip "Skipped ExtUtils::CBuilder not found", 1 for 1..7; +} else { + # Try to compile the file! Don't get too fancy, though. + my $b = ExtUtils::CBuilder->new(quiet => $quiet); + if ($b->have_compiler) { + my $module = 'XSTest'; + + my $obj_file = $b->compile( source => $source_file ); + ok $obj_file; + ok -e $obj_file, 1, "Make sure $obj_file exists"; + + my $lib_file = $b->link( objects => $obj_file, module_name => $module ); + ok $lib_file; + ok -e $lib_file, 1, "Make sure $lib_file exists"; + + eval {require XSTest}; + ok $@, ''; + ok XSTest::is_even(8); + ok !XSTest::is_even(9); + + # Win32 needs to close the DLL before it can unlink it, but unfortunately + # dl_unload_file was missing on Win32 prior to perl change #24679! + if ($^O eq 'MSWin32' and defined &DynaLoader::dl_unload_file) { + for (my $i = 0; $i < @DynaLoader::dl_modules; $i++) { + if ($DynaLoader::dl_modules[$i] eq $module) { + DynaLoader::dl_unload_file($DynaLoader::dl_librefs[$i]); + last; + } } } + 1 while unlink $obj_file; + 1 while unlink $lib_file; + } else { + skip "Skipped can't find a C compiler & linker", 1 for 1..7; } - 1 while unlink $obj_file; - 1 while unlink $lib_file; -} else { - skip "Skipped can't find a C compiler & linker", 1 for 1..7; } 1 while unlink $source_file;
build_requires is the appropriate requires category for a test dependency and can be excluded from installation by an installer. recommends is not well supported and would imply an optional run-time dependency which ExtUtils::CBuilder is not. Testing compilation is actually important, due to changes in the Perl API over different versions, different behaviors from different compilers and so on. Only compiling the generated C files can detect and diagnose these errors. Users without ExtUtils::CBuilder can simply force install if they need to ignore the failing tests. Closing this ticket as a "WONTFIX" issue.