diff --git a/src/Package/Library/ngtcp2.php b/src/Package/Library/ngtcp2.php index c88b643b..0a5ca8f5 100644 --- a/src/Package/Library/ngtcp2.php +++ b/src/Package/Library/ngtcp2.php @@ -24,7 +24,7 @@ class ngtcp2 '-DBUILD_SHARED_LIBS=OFF', '-DENABLE_STATIC_CRT=ON', '-DENABLE_LIB_ONLY=ON', - '-DENABLE_OPENSSL=ON', + '-DENABLE_OPENSSL=OFF', ) ->build(); } diff --git a/src/Package/Target/php/windows.php b/src/Package/Target/php/windows.php index 4d90a59f..e81de3b6 100644 --- a/src/Package/Target/php/windows.php +++ b/src/Package/Target/php/windows.php @@ -105,7 +105,7 @@ trait windows throw new PatchException('Windows Makefile patching for php.exe target', 'Cannot patch windows CLI Makefile, Makefile does not contain "$(BUILD_DIR)\php.exe:" line'); } $lines[$line_num] = '$(BUILD_DIR)\php.exe: generated_files $(DEPS_CLI) $(PHP_GLOBAL_OBJS) $(CLI_GLOBAL_OBJS) $(STATIC_EXT_OBJS) $(ASM_OBJS) $(BUILD_DIR)\php.exe.res $(BUILD_DIR)\php.exe.manifest'; - $lines[$line_num + 1] = "\t" . '"$(LINK)” /nologo $(PHP_GLOBAL_OBJS_RESP) $(CLI_GLOBAL_OBJS_RESP) $(STATIC_EXT_OBJS_RESP) $(STATIC_EXT_LIBS) $(ASM_OBJS) $(LIBS) $(LIBS_CLI) $(BUILD_DIR)\php.exe.res /out:$(BUILD_DIR)\php.exe $(LDFLAGS) $(LDFLAGS_CLI) /ltcg /nodefaultlib:msvcrt /nodefaultlib:msvcrtd /ignore:4286'; + $lines[$line_num + 1] = "\t" . '"$(LINK)" /nologo $(PHP_GLOBAL_OBJS_RESP) $(CLI_GLOBAL_OBJS_RESP) $(STATIC_EXT_OBJS_RESP) $(STATIC_EXT_LIBS) $(ASM_OBJS) $(LIBS) $(LIBS_CLI) $(BUILD_DIR)\php.exe.res /out:$(BUILD_DIR)\php.exe $(LDFLAGS) $(LDFLAGS_CLI) /ltcg /nodefaultlib:msvcrt /nodefaultlib:msvcrtd /ignore:4286'; FileSystem::writeFile("{$package->getSourceDir()}\\Makefile", implode("\r\n", $lines)); } @@ -171,7 +171,7 @@ trait windows throw new PatchException('Windows Makefile patching for php-cgi.exe target', 'Cannot patch windows CGI Makefile, Makefile does not contain "$(BUILD_DIR)\php-cgi.exe:" line'); } $lines[$line_num] = '$(BUILD_DIR)\php-cgi.exe: $(DEPS_CGI) $(CGI_GLOBAL_OBJS) $(PHP_GLOBAL_OBJS) $(STATIC_EXT_OBJS) $(ASM_OBJS) $(BUILD_DIR)\php-cgi.exe.res $(BUILD_DIR)\php-cgi.exe.manifest'; - $lines[$line_num + 1] = "\t" . '@"$(LINK)” /nologo $(PHP_GLOBAL_OBJS_RESP) $(CGI_GLOBAL_OBJS_RESP) $(STATIC_EXT_OBJS_RESP) $(STATIC_EXT_LIBS) $(ASM_OBJS) $(LIBS) $(LIBS_CGI) $(BUILD_DIR)\php-cgi.exe.res /out:$(BUILD_DIR)\php-cgi.exe $(LDFLAGS) $(LDFLAGS_CGI) /ltcg /nodefaultlib:msvcrt /nodefaultlib:msvcrtd /ignore:4286'; + $lines[$line_num + 1] = "\t" . '@"$(LINK)" /nologo $(PHP_GLOBAL_OBJS_RESP) $(CGI_GLOBAL_OBJS_RESP) $(STATIC_EXT_OBJS_RESP) $(STATIC_EXT_LIBS) $(ASM_OBJS) $(LIBS) $(LIBS_CGI) $(BUILD_DIR)\php-cgi.exe.res /out:$(BUILD_DIR)\php-cgi.exe $(LDFLAGS) $(LDFLAGS_CGI) /ltcg /nodefaultlib:msvcrt /nodefaultlib:msvcrtd /ignore:4286'; FileSystem::writeFile("{$package->getSourceDir()}\\Makefile", implode("\r\n", $lines)); // Patch cgi-static, comment ZEND_TSRMLS_CACHE_DEFINE() @@ -689,18 +689,21 @@ C_CODE; $builder->deployBinary($src_file, $dst_file); + $output_label = match ($sapi) { + 'php-cli' => 'Binary path for cli SAPI', + 'php-cgi' => 'Binary path for cgi SAPI', + 'php-micro' => 'Binary path for micro SAPI', + default => null, + }; + if ($output_label) { + $package->setOutput($output_label, $dst_file); + } + // copy .pdb debug info file if ($builder->getOption('no-strip', false) && file_exists("{$src[0]}\\{$src[2]}")) { FileSystem::createDir($debug_dir); FileSystem::copy("{$src[0]}\\{$src[2]}", "{$debug_dir}\\{$src[2]}"); } - - // with-upx-pack for cli, cgi and micro - if ($builder->getOption('with-upx-pack', false)) { - if (in_array($sapi, ['php-cli', 'php-cgi', 'php-micro'], true)) { - cmd()->exec(getenv('UPX_EXEC') . ' --best ' . escapeshellarg($dst_file)); - } - } } /** diff --git a/src/StaticPHP/Package/PackageBuilder.php b/src/StaticPHP/Package/PackageBuilder.php index e50798ad..5138582f 100644 --- a/src/StaticPHP/Package/PackageBuilder.php +++ b/src/StaticPHP/Package/PackageBuilder.php @@ -145,7 +145,7 @@ class PackageBuilder shell()->exec(getenv('UPX_EXEC') . " --best {$dst}"); } elseif ($upx_option && SystemTarget::getTargetOS() === 'Windows' && $executable) { logger()->info("Compressing {$dst} with UPX"); - shell()->exec(getenv('UPX_EXEC') . ' --best ' . escapeshellarg($dst)); + cmd()->exec(getenv('UPX_EXEC') . ' --best ' . escapeshellarg($dst)); } return $dst;