Skip to content

Commit 6e354b4

Browse files
authored
fix: icu-static-win, ext-swoole, krb5, sqlsrv with grpc (crazywhalecc#1087)
2 parents 20f95ef + 864fa9d commit 6e354b4

File tree

9 files changed

+36
-20
lines changed

9 files changed

+36
-20
lines changed

config/source.json

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -462,10 +462,8 @@
462462
}
463463
},
464464
"krb5": {
465-
"type": "ghtagtar",
466-
"repo": "krb5/krb5",
467-
"match": "krb5.+-final",
468-
"prefer-stable": true,
465+
"type": "url",
466+
"url": "https://web.mit.edu/kerberos/dist/krb5/1.22/krb5-1.22.2.tar.gz",
469467
"license": {
470468
"type": "file",
471469
"path": "NOTICE"

src/SPC/ConsoleApplication.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
*/
3535
final class ConsoleApplication extends Application
3636
{
37-
public const string VERSION = '2.8.4';
37+
public const string VERSION = '2.8.5';
3838

3939
public function __construct()
4040
{

src/SPC/builder/extension/grpc.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,15 @@ public function patchBeforeBuildconf(): bool
2828
'zend_ce_exception,',
2929
);
3030

31+
// Fix include path conflict with pdo_sqlsrv: grpc's PHP ext dir is added to the global include path via
32+
$grpc_php_dir = "{$this->source_dir}/src/php/ext/grpc";
33+
if (file_exists("{$grpc_php_dir}/version.h")) {
34+
copy("{$grpc_php_dir}/version.h", "{$grpc_php_dir}/php_grpc_version.h");
35+
unlink("{$grpc_php_dir}/version.h");
36+
FileSystem::replaceFileStr("{$grpc_php_dir}/php_grpc.h", '#include "version.h"', '#include "php_grpc_version.h"');
37+
FileSystem::replaceFileStr("{$grpc_php_dir}/php_grpc.c", '#include "version.h"', '#include "php_grpc_version.h"');
38+
}
39+
3140
$config_m4 = <<<'M4'
3241
PHP_ARG_ENABLE(grpc, [whether to enable grpc support], [AS_HELP_STRING([--enable-grpc], [Enable grpc support])])
3342

src/SPC/builder/extension/swoole.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public function getUnixConfigureArg(bool $shared = false): string
5959
$arg .= $this->builder->getLib('brotli') ? (' --enable-brotli --with-brotli-dir=' . BUILD_ROOT_PATH) : '';
6060
$arg .= $this->builder->getLib('nghttp2') ? (' --with-nghttp2-dir=' . BUILD_ROOT_PATH) : '';
6161
$arg .= $this->builder->getLib('zstd') ? ' --enable-zstd' : '';
62-
$arg .= $this->builder->getLib('liburing') ? ' --enable-iouring --enable-uring-socket' : '';
62+
$arg .= $this->builder->getLib('liburing') && getenv('SPC_LIBC') !== 'glibc' ? ' --enable-iouring --enable-uring-socket' : '--disable-iouring';
6363
$arg .= $this->builder->getExt('sockets') ? ' --enable-sockets' : '';
6464

6565
// enable additional features that require the pdo extension, but conflict with pdo_* extensions

src/SPC/builder/unix/library/krb5.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@ protected function build(): void
1313
{
1414
$origin_source_dir = $this->source_dir;
1515
$this->source_dir .= '/src';
16-
shell()->cd($this->source_dir)->exec('autoreconf -if');
16+
shell()->cd($this->source_dir)->exec('ls -lah');
17+
if (!file_exists($this->source_dir . '/configure')) {
18+
shell()->cd($this->source_dir)->exec('autoreconf -if');
19+
}
1720
$libs = array_map(fn ($x) => $x->getName(), $this->getDependencies(true));
1821
$spc = new SPCConfigUtil($this->builder, ['no_php' => true, 'libs_only_deps' => true]);
1922
$config = $spc->config(libraries: $libs, include_suggest_lib: $this->builder->getOption('with-suggested-libs', false));

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,10 @@ protected function build(): void
1414
->addConfigureArgs(
1515
'-DENABLE_STATIC=ON',
1616
'-DENABLE_SHARED=OFF',
17-
'-DWITH_SYSTEM_ZLIB=ON'
17+
'-DWITH_SYSTEM_ZLIB=ON',
18+
'-DWITH_TOOLS=OFF',
19+
'-DWITH_TESTS=OFF',
20+
'-DWITH_SIMD=OFF',
1821
)
1922
->build();
2023
// patch pkgconfig

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,16 @@ class icu_static_win extends WindowsLibraryBase
1212

1313
protected function build(): void
1414
{
15-
copy("{$this->source_dir}\\x64-windows-static\\lib\\icudt.lib", "{$this->getLibDir()}\\icudt.lib");
16-
copy("{$this->source_dir}\\x64-windows-static\\lib\\icuin.lib", "{$this->getLibDir()}\\icuin.lib");
17-
copy("{$this->source_dir}\\x64-windows-static\\lib\\icuio.lib", "{$this->getLibDir()}\\icuio.lib");
18-
copy("{$this->source_dir}\\x64-windows-static\\lib\\icuuc.lib", "{$this->getLibDir()}\\icuuc.lib");
15+
copy("{$this->source_dir}\\lib\\icudt.lib", "{$this->getLibDir()}\\icudt.lib");
16+
copy("{$this->source_dir}\\lib\\icuin.lib", "{$this->getLibDir()}\\icuin.lib");
17+
copy("{$this->source_dir}\\lib\\icuio.lib", "{$this->getLibDir()}\\icuio.lib");
18+
copy("{$this->source_dir}\\lib\\icuuc.lib", "{$this->getLibDir()}\\icuuc.lib");
1919

2020
// create libpq folder in buildroot/includes/libpq
2121
if (!file_exists("{$this->getIncludeDir()}\\unicode")) {
2222
mkdir("{$this->getIncludeDir()}\\unicode");
2323
}
2424

25-
FileSystem::copyDir("{$this->source_dir}\\x64-windows-static\\include\\unicode", "{$this->getIncludeDir()}\\unicode");
25+
FileSystem::copyDir("{$this->source_dir}\\include\\unicode", "{$this->getIncludeDir()}\\unicode");
2626
}
2727
}

src/SPC/util/executor/UnixCMakeExecutor.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,7 @@ private function makeCmakeToolchainFile(): string
183183
$cflags = getenv('SPC_DEFAULT_C_FLAGS');
184184
$cc = getenv('CC');
185185
$cxx = getenv('CCX');
186+
$include = BUILD_INCLUDE_PATH;
186187
logger()->debug("making cmake tool chain file for {$os} {$target_arch} with CFLAGS='{$cflags}'");
187188
$root = BUILD_ROOT_PATH;
188189
$pkgConfigExecutable = PkgConfigUtil::findPkgConfig();
@@ -210,6 +211,8 @@ private function makeCmakeToolchainFile(): string
210211
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
211212
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
212213
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
214+
set(CMAKE_C_STANDARD_INCLUDE_DIRECTORIES "{$include}")
215+
set(CMAKE_CXX_STANDARD_INCLUDE_DIRECTORIES "{$include}")
213216
set(CMAKE_EXE_LINKER_FLAGS "-ldl -lpthread -lm -lutil")
214217
CMAKE;
215218
// Whoops, linux may need CMAKE_AR sometimes

src/globals/test-extensions.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
$test_php_version = [
1616
// '8.1',
1717
// '8.2',
18-
// '8.3',
18+
'8.3',
1919
// '8.4',
2020
'8.5',
2121
// 'git',
@@ -26,9 +26,9 @@
2626
'macos-15-intel', // bin/spc for x86_64
2727
'macos-15', // bin/spc for arm64
2828
// 'ubuntu-latest', // bin/spc-alpine-docker for x86_64
29-
// 'ubuntu-22.04', // bin/spc-gnu-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',
@@ -43,15 +43,15 @@
4343
$upx = false;
4444

4545
// whether to test frankenphp build, only available for macOS and linux
46-
$frankenphp = true;
46+
$frankenphp = false;
4747

4848
// prefer downloading pre-built packages to speed up the build process
4949
$prefer_pre_built = false;
5050

5151
// If you want to test your added extensions and libs, add below (comma separated, example `bcmath,openssl`).
5252
$extensions = match (PHP_OS_FAMILY) {
53-
'Linux', 'Darwin' => 'sqlsrv,pdo_sqlsrv',
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',
53+
'Linux', 'Darwin' => 'curl,swoole',
54+
'Windows' => 'intl',
5555
};
5656

5757
// If you want to test shared extensions, add them below (comma separated, example `bcmath,openssl`).
@@ -66,7 +66,7 @@
6666

6767
// If you want to test extra libs for extensions, add them below (comma separated, example `libwebp,libavif`). Unnecessary, when $with_suggested_libs is true.
6868
$with_libs = match (PHP_OS_FAMILY) {
69-
'Linux', 'Darwin' => '',
69+
'Linux', 'Darwin' => 'krb5',
7070
'Windows' => '',
7171
};
7272

0 commit comments

Comments
 (0)