mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-03-17 20:34:51 +08:00
Use SPC_EXTRA_LIBS instead of SPC_WINDOWS_EXEC_LIBS
This commit is contained in:
parent
7e7eb844a7
commit
e6a050de82
@ -64,7 +64,7 @@ UPX_EXEC="${PKG_ROOT_PATH}\bin\upx.exe"
|
||||
; phpmicro patches, for more info, see: https://github.com/easysoft/phpmicro/tree/master/patches
|
||||
SPC_MICRO_PATCHES=static_extensions_win32,cli_checks,disable_huge_page,vcruntime140,win32,zend_stream,cli_static
|
||||
; Windows static linking system libs
|
||||
SPC_WINDOWS_EXEC_LIBS="ws2_32.lib shell32.lib"
|
||||
SPC_EXTRA_LIBS=""
|
||||
|
||||
[linux]
|
||||
; Linux can use different build toolchain, but the toolchain can not be changed in this file:
|
||||
|
||||
@ -59,10 +59,10 @@ class curl extends Extension
|
||||
|
||||
public function patchBeforeMake(): bool
|
||||
{
|
||||
$extra_libs = getenv('SPC_WINDOWS_EXEC_LIBS');
|
||||
$extra_libs = getenv('SPC_EXTRA_LIBS');
|
||||
if (!str_contains($extra_libs, 'secur32.lib')) {
|
||||
$extra_libs .= ' secur32.lib';
|
||||
putenv('SPC_WINDOWS_EXEC_LIBS=' . $extra_libs);
|
||||
putenv('SPC_EXTRA_LIBS=' . trim($extra_libs));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
@ -61,11 +61,6 @@ class WindowsBuilder extends BuilderBase
|
||||
*/
|
||||
public function buildPHP(int $build_target = BUILD_TARGET_NONE): void
|
||||
{
|
||||
// ---------- Update extra-libs ----------
|
||||
$extra_libs = getenv('SPC_EXTRA_LIBS') ?: '';
|
||||
$extra_libs .= (empty($extra_libs) ? '' : ' ') . implode(' ', $this->getAllStaticLibFiles());
|
||||
f_putenv('SPC_EXTRA_LIBS=' . $extra_libs);
|
||||
|
||||
$enableCli = ($build_target & BUILD_TARGET_CLI) === BUILD_TARGET_CLI;
|
||||
$enableFpm = ($build_target & BUILD_TARGET_FPM) === BUILD_TARGET_FPM;
|
||||
$enableMicro = ($build_target & BUILD_TARGET_MICRO) === BUILD_TARGET_MICRO;
|
||||
@ -162,10 +157,10 @@ class WindowsBuilder extends BuilderBase
|
||||
{
|
||||
SourcePatcher::patchWindowsCLITarget();
|
||||
|
||||
$extra_libs = getenv('SPC_WINDOWS_EXEC_LIBS') ?: '';
|
||||
$extra_libs = getenv('SPC_EXTRA_LIBS') ?: '';
|
||||
|
||||
// add nmake wrapper
|
||||
FileSystem::writeFile(SOURCE_PATH . '\php-src\nmake_cli_wrapper.bat', "nmake /nologo LIBS_CLI=\"{$extra_libs}\" EXTRA_LD_FLAGS_PROGRAM= %*");
|
||||
FileSystem::writeFile(SOURCE_PATH . '\php-src\nmake_cli_wrapper.bat', "nmake /nologo LIBS_CLI=\"ws2_32.lib shell32.lib {$extra_libs}\" EXTRA_LD_FLAGS_PROGRAM= %*");
|
||||
|
||||
cmd()->cd(SOURCE_PATH . '\php-src')->exec("{$this->sdk_prefix} nmake_cli_wrapper.bat --task-args php.exe");
|
||||
|
||||
@ -199,11 +194,11 @@ class WindowsBuilder extends BuilderBase
|
||||
}
|
||||
FileSystem::writeFile(SOURCE_PATH . '\php-src\Makefile', $makefile);
|
||||
|
||||
$extra_libs = getenv('SPC_WINDOWS_EXEC_LIBS') ?: '';
|
||||
$extra_libs = getenv('SPC_EXTRA_LIBS') ?: '';
|
||||
|
||||
// add nmake wrapper
|
||||
$fake_cli = $this->getOption('with-micro-fake-cli', false) ? ' /DPHP_MICRO_FAKE_CLI" ' : '';
|
||||
$wrapper = "nmake /nologo LIBS_MICRO=\"{$extra_libs}\" CFLAGS_MICRO=\"/DZEND_ENABLE_STATIC_TSRMLS_CACHE=1{$fake_cli}\" %*";
|
||||
$wrapper = "nmake /nologo LIBS_MICRO=\"ws2_32.lib shell32.lib {$extra_libs}\" CFLAGS_MICRO=\"/DZEND_ENABLE_STATIC_TSRMLS_CACHE=1{$fake_cli}\" %*";
|
||||
FileSystem::writeFile(SOURCE_PATH . '\php-src\nmake_micro_wrapper.bat', $wrapper);
|
||||
|
||||
// phar patch for micro
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user