summaryrefslogtreecommitdiff
path: root/lib/App/DocKnot/Dist.pm
diff options
context:
space:
mode:
authorRuss Allbery <rra@cpan.org>2019-06-26 16:01:27 -0700
committerRuss Allbery <rra@cpan.org>2019-06-26 16:04:39 -0700
commit9a59e66844b97ae578b8e3a45117f735cec5c176 (patch)
treea1443f5eb3fbda15043e74f04ad122b66e10f234 /lib/App/DocKnot/Dist.pm
parentc9fae25cb035b1a01d8827a45b8171d96bc59e98 (diff)
Add support for testing with C++
The docknot dist command will now also build and test with C++ if the package indicates that it supports C++ via the build.cplusplus key in the package metadata.
Diffstat (limited to 'lib/App/DocKnot/Dist.pm')
-rw-r--r--lib/App/DocKnot/Dist.pm23
1 files changed, 20 insertions, 3 deletions
diff --git a/lib/App/DocKnot/Dist.pm b/lib/App/DocKnot/Dist.pm
index c852f87..975000f 100644
--- a/lib/App/DocKnot/Dist.pm
+++ b/lib/App/DocKnot/Dist.pm
@@ -31,9 +31,9 @@ our %COMMANDS = (
'Autoconf' => [
['./bootstrap'],
['./configure', 'CC=clang'],
- ['make', 'clean'],
['make', 'warnings'],
['make', 'check'],
+ ['make', 'clean'],
['./configure', 'CC=gcc'],
['make', 'warnings'],
['make', 'check'],
@@ -140,7 +140,24 @@ sub new {
# a command and its arguments
sub commands {
my ($self) = @_;
- return $COMMANDS{ $self->{config}{build}{type} };
+ my $type = $self->{config}{build}{type};
+ my @commands = map { [@$_] } $COMMANDS{$type}->@*;
+
+ # Special-case: Autoconf packages with C++ support should also attempt a
+ # build with a C++ compiler.
+ if ($type eq 'Autoconf' && $self->{config}{build}{cplusplus}) {
+ #<<<
+ my @extra = (
+ ['./configure', 'CC=g++'],
+ ['make', 'warnings'],
+ ['make', 'check'],
+ ['make', 'clean'],
+ );
+ #>>>
+ splice(@commands, 1, 0, @extra);
+ }
+
+ return @commands;
}
# Generate a distribution tarball. This assumes it is run from the root
@@ -165,7 +182,7 @@ sub make_distribution {
# Change to that directory and run the configured commands.
chdir($prefix);
- for my $command_ref ($self->commands()->@*) {
+ for my $command_ref ($self->commands()) {
systemx($command_ref->@*);
}