mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-07-08 17:35:36 +08:00
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.
This commit is contained in:
@@ -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()) . ' ' .
|
||||
|
||||
Reference in New Issue
Block a user