Skip to content
2 changes: 1 addition & 1 deletion config/lib.json
Original file line number Diff line number Diff line change
Expand Up @@ -1019,7 +1019,7 @@
"libz.a"
],
"static-libs-windows": [
"zlib_a.lib"
"zs.lib"
Copy link
Owner

@crazywhalecc crazywhalecc Feb 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If php-src and other libraries require zlib_a.lib and zlibstatic.lib, perhaps they also should be listed here instead of only zlib's produced artifact, I think.

Where possible, I believe it is necessary to reduce our patching jobs, and a more reasonable approach would be to let upstream projects make changes.

],
"headers": [
"zlib.h",
Expand Down
4 changes: 2 additions & 2 deletions src/SPC/builder/windows/library/openssl.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,13 @@ protected function build(): void
);

// patch zlib
FileSystem::replaceFileStr($this->source_dir . '\Makefile', 'ZLIB1', 'zlibstatic.lib');
FileSystem::replaceFileStr($this->source_dir . '\Makefile', 'ZLIB1', 'zs.lib');
// patch debug: https://stackoverflow.com/questions/18486243/how-do-i-build-openssl-statically-linked-against-windows-runtime
FileSystem::replaceFileStr($this->source_dir . '\Makefile', '/debug', '/incremental:no /opt:icf /dynamicbase /nxcompat /ltcg /nodefaultlib:msvcrt');
cmd()->cd($this->source_dir)->execWithWrapper(
$this->builder->makeSimpleWrapper('nmake'),
'install_dev ' .
'CNF_LDFLAGS="/NODEFAULTLIB:kernel32.lib /NODEFAULTLIB:msvcrt /NODEFAULTLIB:msvcrtd /DEFAULTLIB:libcmt /LIBPATH:' . BUILD_LIB_PATH . ' zlibstatic.lib"'
'CNF_LDFLAGS="/NODEFAULTLIB:kernel32.lib /NODEFAULTLIB:msvcrt /NODEFAULTLIB:msvcrtd /DEFAULTLIB:libcmt /LIBPATH:' . BUILD_LIB_PATH . ' zs.lib"'
);
copy($this->source_dir . '\ms\applink.c', BUILD_INCLUDE_PATH . '\openssl\applink.c');

Expand Down
7 changes: 4 additions & 3 deletions src/SPC/builder/windows/library/zlib.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,9 @@ protected function build(): void
$this->builder->makeSimpleWrapper('cmake'),
"--build build --config Release --target install -j{$this->builder->concurrency}"
);
copy(BUILD_LIB_PATH . '\zlibstatic.lib', BUILD_LIB_PATH . '\zlib_a.lib');
unlink(BUILD_ROOT_PATH . '\bin\zlib.dll');
unlink(BUILD_LIB_PATH . '\zlib.lib');
unlink(BUILD_ROOT_PATH . '\bin\z.dll');
unlink(BUILD_LIB_PATH . '\z.lib');
copy(BUILD_LIB_PATH . '\zs.lib', BUILD_LIB_PATH . '\zlib_a.lib');
copy(BUILD_LIB_PATH . '\zs.lib', BUILD_LIB_PATH . '\zlibstatic.lib');
}
}
2 changes: 1 addition & 1 deletion src/globals/extra/gd_config_80.w32
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ if (PHP_GD != "no") {
}

// zlib ext support (required)
if (!CHECK_LIB("zlib_a.lib;zlib.lib", "gd", PHP_GD)) {
if (!CHECK_LIB("zs.lib", "gd", PHP_GD)) {
ERROR("gd not enabled; zlib not enabled");
}

Expand Down
2 changes: 1 addition & 1 deletion src/globals/extra/gd_config_81.w32
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ if (PHP_GD != "no") {
}

// zlib ext support (required)
if (!CHECK_LIB("zlib_a.lib;zlib.lib", "gd", PHP_GD)) {
if (!CHECK_LIB("zs.lib", "gd", PHP_GD)) {
ERROR("gd not enabled; zlib not enabled");
}

Expand Down
16 changes: 8 additions & 8 deletions src/globals/test-extensions.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@
// 'macos-15-intel', // bin/spc for x86_64
// 'macos-15', // bin/spc for arm64
// 'ubuntu-latest', // bin/spc-alpine-docker for x86_64
'ubuntu-22.04', // bin/spc-gnu-docker for x86_64
'ubuntu-24.04', // bin/spc for x86_64
'ubuntu-22.04-arm', // bin/spc-gnu-docker for arm64
'ubuntu-24.04-arm', // bin/spc for arm64
// 'windows-2022', // .\bin\spc.ps1
// 'windows-2025',
// 'ubuntu-22.04', // bin/spc-gnu-docker for x86_64
// 'ubuntu-24.04', // bin/spc for x86_64
// 'ubuntu-22.04-arm', // bin/spc-gnu-docker for arm64
// 'ubuntu-24.04-arm', // bin/spc for arm64
'windows-2022', // .\bin\spc.ps1
'windows-2025',
];

// whether enable thread safe
Expand All @@ -50,8 +50,8 @@

// If you want to test your added extensions and libs, add below (comma separated, example `bcmath,openssl`).
$extensions = match (PHP_OS_FAMILY) {
'Linux', 'Darwin' => 'pgsql',
'Windows' => 'com_dotnet',
'Linux', 'Darwin' => 'zlib',
'Windows' => 'amqp,apcu,bcmath,bz2,calendar,ctype,curl,dba,dom,ds,exif,ffi,fileinfo,filter,ftp,iconv,igbinary,libxml,mbregex,mbstring,mysqli,mysqlnd,opcache,openssl,pdo,pdo_mysql,pdo_sqlite,pdo_sqlsrv,phar,rar,redis,session,shmop,simdjson,simplexml,soap,sockets,sqlite3,sqlsrv,ssh2,sysvshm,tokenizer,xml,xmlreader,xmlwriter,yac,yaml,zip,zlib',
};

// If you want to test shared extensions, add them below (comma separated, example `bcmath,openssl`).
Expand Down
Loading