1
0
mirror of https://github.com/postgres/postgres.git synced 2025-08-30 06:01:21 +03:00

Allow running src/tools/msvc/mkvcbuild.pl under not Windows

This to allow verifying the MSVC build file generation without having
to have Windows.

To do this, we avoid Windows-specific Perl modules and don't run the
"cl" compiler or "nmake".  The resulting build files won't actually be
completely correct, but it's useful enough.

Reviewed-by: Michael Paquier <michael@paquier.xyz>
Reviewed-by: Julien Rouhaud <rjuju123@gmail.com>
Discussion: https://www.postgresql.org/message-id/flat/d73b2c7b-f081-8357-8422-7564d55f1aac%402ndquadrant.com
This commit is contained in:
Peter Eisentraut
2020-02-21 20:50:56 +01:00
parent f4d59369d2
commit 73c8596488
4 changed files with 37 additions and 21 deletions

View File

@@ -6,7 +6,7 @@ package Mkvcbuild;
# src/tools/msvc/Mkvcbuild.pm
#
use Carp;
use Win32;
use if ($^O eq "MSWin32"), 'Win32';
use strict;
use warnings;
use Project;
@@ -648,9 +648,11 @@ sub mkvcbuild
# 'Can't spawn "conftest.exe"'; suppress that.
no warnings;
no strict 'subs';
# Disable error dialog boxes like we do in the postmaster.
# Here, we run code that triggers relevant errors.
use Win32API::File qw(SetErrorMode :SEM_);
use if ($^O eq "MSWin32"), 'Win32API::File', qw(SetErrorMode :SEM_);
my $oldmode = SetErrorMode(
SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX);
system(".\\$exe");