Subject: | makefile_to_build_args() barfs on empty args |
Our automated build system configures Perl modules with code like:
$PERL Makefile.PL
"${CCFLAGS:+CCFLAGS=}${CCFLAGS}" \
"${OPTIMIZE:+OPTIMIZE=}${OPTIMIZE}" \
"${DEFINE:+DEFINE=}${DEFINE}" \
"${INC:+INC=}${INC}" \
"${LIBS:+LIBS=}${LIBS}" ${MAKEMAKER_ARGS} </dev/null
which DTRT for modules with 'traditional' Makefile.PL files.
However on modules where Makefile.PL calls Module::Build::Compat we see
things like:
% /usr/bin/perl Makefile.PL 'CCFLAGS=-D_REENTRANT -D_GNU_SOURCE -DDEBUGGING -fno-strict-aliasing -pipe -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm' 'OPTIMIZE=-O2 -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -m32 -march=i386 -mtune=pentium4 -fasynchronous-unwind-tables' '' '' ''
Malformed argument '' at /usr/lib/perl5/site_perl/5.8.6/Module/Build/Compat.pm line 135.
In this case, that's because $DEFINE, $INC, and $LIBS are all empty
for this architecture/module/build.
It would be neat to add a line to Module::Build::Compat to get it to ignore empty args, like so:
sub makefile_to_build_args {
shift;
my @out;
foreach my $arg (@_) {
+ next if ($arg eq '');
my ($key, $val) = ($arg =~ /^(\w+)=(.+)/ ? ($1, $2) :
die "Malformed argument '$arg'");