Skip to content

Commit e6a050d

Browse files
committed
Use SPC_EXTRA_LIBS instead of SPC_WINDOWS_EXEC_LIBS
1 parent 7e7eb84 commit e6a050d

File tree

3 files changed

+7
-12
lines changed

3 files changed

+7
-12
lines changed

config/env.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ UPX_EXEC="${PKG_ROOT_PATH}\bin\upx.exe"
6464
; phpmicro patches, for more info, see: https://github.com/easysoft/phpmicro/tree/master/patches
6565
SPC_MICRO_PATCHES=static_extensions_win32,cli_checks,disable_huge_page,vcruntime140,win32,zend_stream,cli_static
6666
; Windows static linking system libs
67-
SPC_WINDOWS_EXEC_LIBS="ws2_32.lib shell32.lib"
67+
SPC_EXTRA_LIBS=""
6868

6969
[linux]
7070
; Linux can use different build toolchain, but the toolchain can not be changed in this file:

src/SPC/builder/extension/curl.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,10 @@ public function patchBeforeConfigure(): bool
5959

6060
public function patchBeforeMake(): bool
6161
{
62-
$extra_libs = getenv('SPC_WINDOWS_EXEC_LIBS');
62+
$extra_libs = getenv('SPC_EXTRA_LIBS');
6363
if (!str_contains($extra_libs, 'secur32.lib')) {
6464
$extra_libs .= ' secur32.lib';
65-
putenv('SPC_WINDOWS_EXEC_LIBS=' . $extra_libs);
65+
putenv('SPC_EXTRA_LIBS=' . trim($extra_libs));
6666
return true;
6767
}
6868
return false;

src/SPC/builder/windows/WindowsBuilder.php

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,6 @@ public function __construct(array $options = [])
6161
*/
6262
public function buildPHP(int $build_target = BUILD_TARGET_NONE): void
6363
{
64-
// ---------- Update extra-libs ----------
65-
$extra_libs = getenv('SPC_EXTRA_LIBS') ?: '';
66-
$extra_libs .= (empty($extra_libs) ? '' : ' ') . implode(' ', $this->getAllStaticLibFiles());
67-
f_putenv('SPC_EXTRA_LIBS=' . $extra_libs);
68-
6964
$enableCli = ($build_target & BUILD_TARGET_CLI) === BUILD_TARGET_CLI;
7065
$enableFpm = ($build_target & BUILD_TARGET_FPM) === BUILD_TARGET_FPM;
7166
$enableMicro = ($build_target & BUILD_TARGET_MICRO) === BUILD_TARGET_MICRO;
@@ -162,10 +157,10 @@ public function buildCli(): void
162157
{
163158
SourcePatcher::patchWindowsCLITarget();
164159

165-
$extra_libs = getenv('SPC_WINDOWS_EXEC_LIBS') ?: '';
160+
$extra_libs = getenv('SPC_EXTRA_LIBS') ?: '';
166161

167162
// add nmake wrapper
168-
FileSystem::writeFile(SOURCE_PATH . '\php-src\nmake_cli_wrapper.bat', "nmake /nologo LIBS_CLI=\"{$extra_libs}\" EXTRA_LD_FLAGS_PROGRAM= %*");
163+
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= %*");
169164

170165
cmd()->cd(SOURCE_PATH . '\php-src')->exec("{$this->sdk_prefix} nmake_cli_wrapper.bat --task-args php.exe");
171166

@@ -199,11 +194,11 @@ public function buildMicro(): void
199194
}
200195
FileSystem::writeFile(SOURCE_PATH . '\php-src\Makefile', $makefile);
201196

202-
$extra_libs = getenv('SPC_WINDOWS_EXEC_LIBS') ?: '';
197+
$extra_libs = getenv('SPC_EXTRA_LIBS') ?: '';
203198

204199
// add nmake wrapper
205200
$fake_cli = $this->getOption('with-micro-fake-cli', false) ? ' /DPHP_MICRO_FAKE_CLI" ' : '';
206-
$wrapper = "nmake /nologo LIBS_MICRO=\"{$extra_libs}\" CFLAGS_MICRO=\"/DZEND_ENABLE_STATIC_TSRMLS_CACHE=1{$fake_cli}\" %*";
201+
$wrapper = "nmake /nologo LIBS_MICRO=\"ws2_32.lib shell32.lib {$extra_libs}\" CFLAGS_MICRO=\"/DZEND_ENABLE_STATIC_TSRMLS_CACHE=1{$fake_cli}\" %*";
207202
FileSystem::writeFile(SOURCE_PATH . '\php-src\nmake_micro_wrapper.bat', $wrapper);
208203

209204
// phar patch for micro

0 commit comments

Comments
 (0)