Subject: | XS file deleted by perl Build realclean! |
Another attempt at making a EU::MM + M::B compatible structure.
As in cpan #20532, create a Foo module using:
h2xs -n Foo --skip-autoloader
and drop the attached Build.PL in place.
This builds OK, as expected (even without an include_dirs setting, since
the XS/C files are in the same directory as the files that they
include), but when I run
perl Build realclean
it deletes Foo.xs!
Clearly it shouldn't have deleted a file that it didn't generate.
Subject: | Build.PL |
use Module::Build;
my $build = Module::Build->new(
module_name => 'Foo',
xs_files => { 'Foo.xs' => './Foo.xs' },
add_to_cleanup => ['const-c.inc', 'const-xs.inc'],
);
$build->create_build_script();
if (eval {require ExtUtils::Constant; 1}) {
my @names = (qw());
ExtUtils::Constant::WriteConstants(
NAME => 'Foo',
NAMES => \@names,
DEFAULT_TYPE => 'IV',
C_FILE => 'const-c.inc',
XS_FILE => 'const-xs.inc'
);
}
else {
use File::Copy;
use File::Spec;
foreach my $file ('const-c.inc', 'const-xs.inc') {
my $fallback = File::Spec->catfile('fallback', $file);
copy ($fallback, $file) or die "Can't copy $fallback to $file: $!";
}
}