Fix MSVC installations with multiple "configure" files detected
authorMichael Paquier <[email protected]>
Thu, 21 May 2020 05:41:36 +0000 (14:41 +0900)
committerMichael Paquier <[email protected]>
Thu, 21 May 2020 05:41:36 +0000 (14:41 +0900)
When installing binaries and libraries using the MSVC installation
routines, the operation gets done after moving to the root folder, whose
location is detected by checking if "configure" exists two times in a
row.  So, calling the installation script from src/tools/msvc/ with an
extra "configure" file four levels up the root path of the code tree
causes the execution to go further up, leading to a failure in finding
the builds.  This commit fixes the issue by moving to the root folder of
the code tree only once, when necessary.

Author: Arnold Müller
Reviewed-by: Daniel Gustafsson
Discussion: https://postgr.es/m/16343-f638f67e7e52b86c@postgresql.org
Backpatch-through: 9.5

src/tools/msvc/Install.pm

index a839429e2f7c2895f369b052597999a978e27012..c3d49981fcc2c6060ed6f4363179c0c96075f220 100644 (file)
@@ -62,8 +62,16 @@ sub Install
        do "./config.pl" if (-f "config.pl");
    }
 
-   chdir("../../..")    if (-f "../../../configure");
-   chdir("../../../..") if (-f "../../../../configure");
+   # Move to the root path depending on the current location.
+   if (-f "../../../configure")
+   {
+       chdir("../../..");
+   }
+   elsif (-f "../../../../configure")
+   {
+       chdir("../../../..");
+   }
+
    my $conf = "";
    if (-d "debug")
    {