]> granicus.if.org Git - postgresql/commitdiff
MSVC: Place gendef.pl temporary file in the target directory.
authorNoah Misch <noah@leadboat.com>
Thu, 8 Sep 2016 05:40:53 +0000 (01:40 -0400)
committerNoah Misch <noah@leadboat.com>
Thu, 8 Sep 2016 05:40:53 +0000 (01:40 -0400)
Until now, it used the current working directory.  This makes it safe
for simultaneous invocations of gendef.pl, with different target
directories, to run from a single current working directory, such as
$(top_srcdir).  The MSVC build system will soon rely on this.

Christian Ullrich, reviewed by Michael Paquier.

src/tools/msvc/gendef.pl

index 8ccaab35519e472117d60243ce4cb5ff87cd71cd..a6c43c2c3927d51f3b8ae573e2fc60d3e74e9096 100644 (file)
@@ -3,6 +3,7 @@ my @def;
 use warnings;
 use strict;
 use 5.8.0;
+use File::Spec::Functions qw(splitpath catpath);
 use List::Util qw(max);
 
 #
@@ -14,9 +15,11 @@ use List::Util qw(max);
 sub dumpsyms
 {
        my ($objfile, $symfile) = @_;
-       system("dumpbin /symbols /out:symbols.out $_ >NUL")
+       my ($symvol, $symdirs, $symbase) = splitpath($symfile);
+       my $tmpfile = catpath($symvol, $symdirs, "symbols.out");
+       system("dumpbin /symbols /out:$tmpfile $_ >NUL")
          && die "Could not call dumpbin";
-       rename("symbols.out", $symfile);
+       rename($tmpfile, $symfile);
 }
 
 # Given a symbol file path, loops over its contents