Skip to content

Commit 820d77b

Browse files
authored
[v2] Fix bunch of build bugs for Windows (#1078)
2 parents d535e4f + cd3eb3d commit 820d77b

File tree

8 files changed

+22
-11
lines changed

8 files changed

+22
-11
lines changed

config/ext.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,8 @@
6363
],
6464
"ext-depends-windows": [
6565
"zlib",
66-
"openssl"
66+
"openssl",
67+
"brotli"
6768
]
6869
},
6970
"dba": {

config/lib.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,7 @@
109109
"krb5"
110110
],
111111
"lib-suggests-windows": [
112-
"brotli",
113-
"zstd"
112+
"brotli"
114113
],
115114
"frameworks": [
116115
"CoreFoundation",
@@ -763,7 +762,6 @@
763762
"xz"
764763
],
765764
"lib-suggests-windows": [
766-
"zstd",
767765
"openssl"
768766
]
769767
},

src/SPC/builder/extension/sqlsrv.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,14 @@ public function patchBeforeWindowsConfigure(): bool
3333
}
3434
return false;
3535
}
36+
37+
public function patchBeforeMake(): bool
38+
{
39+
$makefile = SOURCE_PATH . '\php-src\Makefile';
40+
$makeContent = file_get_contents($makefile);
41+
$makeContent = preg_replace('/^(CFLAGS_(?:PDO_)?SQLSRV=.*?)\s+\/W4\b/m', '$1', $makeContent);
42+
$makeContent = preg_replace('/^(CFLAGS_(?:PDO_)?SQLSRV=.*?)\s+\/WX\b/m', '$1', $makeContent);
43+
file_put_contents($makefile, $makeContent);
44+
return true;
45+
}
3646
}

src/SPC/builder/windows/library/libjpeg.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ protected function build(): void
2828
'-DENABLE_STATIC=ON ' .
2929
'-DBUILD_TESTING=OFF ' .
3030
'-DWITH_JAVA=OFF ' .
31+
'-DWITH_SIMD=OFF ' .
3132
'-DWITH_CRT_DLL=OFF ' .
3233
"-DENABLE_ZLIB_COMPRESSION={$zlib} " .
3334
'-DCMAKE_INSTALL_PREFIX=' . BUILD_ROOT_PATH . ' '

src/SPC/builder/windows/library/ngtcp2.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ protected function build(): void
2929
'-DBUILD_SHARED_LIBS=OFF ' .
3030
'-DENABLE_STATIC_CRT=ON ' .
3131
'-DENABLE_LIB_ONLY=ON ' .
32+
'-DENABLE_OPENSSL=OFF ' .
3233
'-DCMAKE_INSTALL_PREFIX=' . BUILD_ROOT_PATH . ' '
3334
)
3435
->execWithWrapper(

src/SPC/store/FileSystem.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ public static function copyDir(string $from, string $to): void
152152
$src_path = FileSystem::convertPath($from);
153153
switch (PHP_OS_FAMILY) {
154154
case 'Windows':
155-
f_passthru('xcopy "' . $src_path . '" "' . $dst_path . '" /s/e/v/y/i');
155+
f_passthru('xcopy "' . $src_path . '" "' . $dst_path . '" /s/e/y/i');
156156
break;
157157
case 'Linux':
158158
case 'Darwin':

src/globals/ext-tests/openssl.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,6 @@
3131
}
3232
assert($valid);
3333
}
34-
if (PHP_VERSION_ID >= 80500 && defined('OPENSSL_VERSION_NUMBER') && OPENSSL_VERSION_NUMBER >= 0x30200000) {
34+
if (PHP_VERSION_ID >= 80500 && (!PHP_ZTS || PHP_OS_FAMILY !== 'Windows') && defined('OPENSSL_VERSION_NUMBER') && OPENSSL_VERSION_NUMBER >= 0x30200000) {
3535
assert(function_exists('openssl_password_hash'));
3636
}

src/globals/test-extensions.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@
2424
// test os (macos-15-intel, macos-15, ubuntu-latest, windows-latest are available)
2525
$test_os = [
2626
// 'macos-15-intel', // bin/spc for x86_64
27-
'macos-15', // bin/spc for arm64
28-
'ubuntu-latest', // bin/spc-alpine-docker for x86_64
29-
'ubuntu-22.04', // bin/spc-gnu-docker for x86_64
27+
// 'macos-15', // bin/spc for arm64
28+
// 'ubuntu-latest', // bin/spc-alpine-docker for x86_64
29+
// 'ubuntu-22.04', // bin/spc-gnu-docker for x86_64
3030
// 'ubuntu-24.04', // bin/spc for x86_64
31-
'ubuntu-22.04-arm', // bin/spc-gnu-docker for arm64
31+
// 'ubuntu-22.04-arm', // bin/spc-gnu-docker for arm64
3232
// 'ubuntu-24.04-arm', // bin/spc for arm64
3333
// 'windows-2022', // .\bin\spc.ps1
3434
'windows-2025',
@@ -51,7 +51,7 @@
5151
// If you want to test your added extensions and libs, add below (comma separated, example `bcmath,openssl`).
5252
$extensions = match (PHP_OS_FAMILY) {
5353
'Linux', 'Darwin' => 'zlib',
54-
'Windows' => 'gd,zlib,mbstring,filter',
54+
'Windows' => 'amqp,apcu,bcmath,bz2,calendar,ctype,curl,dba,dom,ds,exif,ffi,fileinfo,filter,ftp,gd,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',
5555
};
5656

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

0 commit comments

Comments
 (0)