hideo55 / Module-Build-XSUtil

A Module::Build class for building XS modules
Other
6 stars 8 forks source link

Request: support pure-perl builds #8

Closed skaji closed 6 years ago

skaji commented 6 years ago

Currently Module::Build::XSUtil does not work well with distributions that offer an "XS" version or a "Pure Perl" version.

In fact, even if we create a Module::Build::XSUtil instance with allow_pureperl true and users execute Build.PL with --pureperl-only, Module::Build::XSUtil checks whether users have c compilers or not.

It would be nice if Module::Build::XSUtil support such distributions.

An easy fix may be

diff --git lib/Module/Build/XSUtil.pm lib/Module/Build/XSUtil.pm
index 51e9952..235e253 100644
--- lib/Module/Build/XSUtil.pm
+++ lib/Module/Build/XSUtil.pm
@@ -19,6 +19,7 @@ sub new {
     my %args     = @_;

     my $self = $class->SUPER::new(%args);
+    return $self if $self->pureperl_only && $self->allow_pureperl;

     if ( !defined $args{cc_warnings} ) {
         $args{cc_warnings} = 1;
hideo55 commented 6 years ago

Added in version 0.17.

skaji commented 6 years ago

@hideo55 Awesome!