Commit 9e52bfd8d0 for openssl.org

commit 9e52bfd8d09b9adf10cb5e5810f2a35ae0f3ee7d
Author: Bob Beck <beck@openssl.org>
Date:   Wed Sep 2 09:55:32 2026 -0600

    Convert the paths for generator scripts on windows.

    jom as used in CI apparenty handles this for us, but
    nmake (at least in older versions) does not.

    we passed CI because it appears to only exercise the jom
    path on windows.

    If we convert the slashes in the paths ourselves it works for
    both.

    Reviewed-by: Neil Horman <nhorman@openssl.org>
    Reviewed-by: Andrew Dinh <andrewd@openssl.org>
    Merge-date: Mon Sep  7 18:21:29 2026
    Merged-from: https://github.com/openssl/openssl/pull/32648

diff --git a/Configurations/windows-makefile.tmpl b/Configurations/windows-makefile.tmpl
index a7f2b6652b..747d145d7f 100644
--- a/Configurations/windows-makefile.tmpl
+++ b/Configurations/windows-makefile.tmpl
@@ -691,10 +691,26 @@ EOF
   # (in the build tree), but quotes paths of non-generated dependencies (in the
   # source tree). This is a workaround for a limitation of C++Builder's make.exe
   # in handling quoted paths: https://quality.embarcadero.com/browse/RSP-31756
+  # Configure runs the generator script itself through cleanfile(), which
+  # yields native (backslash) paths on Windows, but the remaining generator
+  # arguments are carried over verbatim from build.info.  Arguments written
+  # as $(SRCDIR)/... or $(BLDDIR)/... therefore arrive with forward slashes;
+  # convert those to backslashes and quote them so a path containing spaces
+  # survives the shell.  Anything else is a flag or a bare file name and is
+  # left alone.
+  sub generatearg {
+      my $arg = shift;
+      if ($arg =~ /\$\((?:SRCDIR|BLDDIR)\)/) {
+          $arg =~ s|/|\\|g;
+          return "\"$arg\"";
+      }
+      return $arg;
+  }
+
   sub generatesrc {
       my %args = @_;
       my $gen0 = $args{generator}->[0];
-      my $gen_args = join('', map { " $_" }
+      my $gen_args = join('', map { " ".generatearg($_) }
                               @{$args{generator}}[1..$#{$args{generator}}]);
       my $gen_incs = join("", map { " -I\"$_\"" } @{$args{generator_incs}});
       my $incs = join("", map { " -I\"$_\"" } @{$args{incs}});