meson: windows: Normalize slashes in prefix
authorAndres Freund <[email protected]>
Tue, 27 Sep 2022 18:55:00 +0000 (11:55 -0700)
committerAndres Freund <[email protected]>
Thu, 29 Sep 2022 01:48:19 +0000 (18:48 -0700)
This fixes a build issue on windows, when the prefix is set to a path with
forward slashes. Windows python defaults to a path with a backslash, but mingw
ucrt python defaults to a forward slash. This in turn lead to a wrong PATH set
during tests, causing tests to fail.

Reported-by: Melih Mutlu <[email protected]>
Discussion: http://postgr.es/m/20220928022724[email protected]

meson.build

index 38b2c3aae2e6bd9d6f68df7652bcf027fc526f5b..02c086c04e775205b712b5aa8e7629e0ef0cc01a 100644 (file)
@@ -2733,15 +2733,15 @@ endif
 
 prefix = get_option('prefix')
 
-test_prefix = prefix
+test_prefix = fs.as_posix(prefix)
 
 if fs.is_absolute(get_option('prefix'))
   if host_system == 'windows'
-    if prefix.split(':\\').length() == 1
+    if prefix.split(':/').length() == 1
       # just a drive
       test_prefix = ''
     else
-      test_prefix = prefix.split(':\\')[1]
+      test_prefix = prefix.split(':/')[1]
     endif
   else
     assert(prefix.startswith('/'))