contrib/buildsystems: handle quoted spaces in filenames

The engine.pl script expects file names not to contain spaces. However,
paths with spaces are quite prevalent on Windows. Use shellwords() rather
than split() to parse them correctly.

Helped-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Philip Oakley <philipoakley@iee.org>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
This commit is contained in:
Philip Oakley 2015-07-19 16:08:21 +01:00 коммит произвёл Johannes Schindelin
Родитель 38e18625fc
Коммит fb32eac393
1 изменённых файлов: 4 добавлений и 3 удалений

Просмотреть файл

@ -12,6 +12,7 @@ use File::Basename;
use File::Spec; use File::Spec;
use Cwd; use Cwd;
use Generators; use Generators;
use Text::ParseWords;
my (%build_structure, %compile_options, @makedry); my (%build_structure, %compile_options, @makedry);
my $out_dir = getcwd(); my $out_dir = getcwd();
@ -231,7 +232,7 @@ sub removeDuplicates
sub handleCompileLine sub handleCompileLine
{ {
my ($line, $lineno) = @_; my ($line, $lineno) = @_;
my @parts = split(' ', $line); my @parts = shellwords($line);
my $sourcefile; my $sourcefile;
shift(@parts); # ignore cmd shift(@parts); # ignore cmd
while (my $part = shift @parts) { while (my $part = shift @parts) {
@ -265,7 +266,7 @@ sub handleLibLine
my (@objfiles, @lflags, $libout, $part); my (@objfiles, @lflags, $libout, $part);
# kill cmd and rm 'prefix' # kill cmd and rm 'prefix'
$line =~ s/^rm -f .* && .* rcs //; $line =~ s/^rm -f .* && .* rcs //;
my @parts = split(' ', $line); my @parts = shellwords($line);
while ($part = shift @parts) { while ($part = shift @parts) {
if ($part =~ /^-/) { if ($part =~ /^-/) {
push(@lflags, $part); push(@lflags, $part);
@ -306,7 +307,7 @@ sub handleLinkLine
{ {
my ($line, $lineno) = @_; my ($line, $lineno) = @_;
my (@objfiles, @lflags, @libs, $appout, $part); my (@objfiles, @lflags, @libs, $appout, $part);
my @parts = split(' ', $line); my @parts = shellwords($line);
shift(@parts); # ignore cmd shift(@parts); # ignore cmd
while ($part = shift @parts) { while ($part = shift @parts) {
if ($part =~ /^-IGNORE/) { if ($part =~ /^-IGNORE/) {