From 0e8a8066407f292aaabeb367557905e6bcf31bb0 Mon Sep 17 00:00:00 2001 From: Luther Monson Date: Wed, 27 May 2026 17:31:50 -0700 Subject: [PATCH] fix(windows): resolve doctor-installed perl and quote perl path Two related fixes for OpenSSL builds on Windows: 1. spc doctor installs Strawberry Perl under `pkgroot/strawberry-perl/`, but the validate() check only looks at the arch-specific native path (`strawberry-perl-x86_64-win`). When a user runs `spc doctor` to install perl, the subsequent build fails because the doctor's install layout isn't on the lookup list. Add it as a fallback before falling through to WindowsUtil::findCommand. 2. Wrap the resolved perl path in quote() when building the Configure command. WindowsUtil::findCommand can return a path containing spaces (e.g. `C:\Program Files\...`), which then splits the cmd.exe invocation. Quoting matches how every other interpolated path in this command is handled. --- src/Package/Library/openssl.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/Package/Library/openssl.php b/src/Package/Library/openssl.php index 69297198..08ff8b02 100644 --- a/src/Package/Library/openssl.php +++ b/src/Package/Library/openssl.php @@ -25,7 +25,12 @@ class openssl if (SystemTarget::getTargetOS() === 'Windows') { global $argv; $perl_path_native = PKG_ROOT_PATH . '\strawberry-perl-' . arch2gnu(php_uname('m')) . '-win\perl\bin\perl.exe'; - $perl = file_exists($perl_path_native) ? ($perl_path_native) : WindowsUtil::findCommand('perl.exe'); + $perl_path_doctor = PKG_ROOT_PATH . '\strawberry-perl\perl\bin\perl.exe'; + $perl = match (true) { + file_exists($perl_path_native) => $perl_path_native, + file_exists($perl_path_doctor) => $perl_path_doctor, + default => WindowsUtil::findCommand('perl.exe'), + }; if ($perl === null) { throw new EnvironmentException( 'You need to install perl first!', @@ -42,7 +47,7 @@ class openssl $perl = ApplicationContext::get('perl'); $cmd = cmd()->cd($lib->getSourceDir()) ->exec( - "{$perl} Configure zlib VC-WIN64A " . + quote($perl) . ' Configure zlib VC-WIN64A ' . 'no-shared ' . '--prefix=' . quote($lib->getBuildRootPath()) . ' ' . '--with-zlib-lib=' . quote($lib->getLibDir()) . ' ' .