Forward-port #1087

This commit is contained in:
crazywhalecc
2026-04-11 00:45:31 +08:00
parent 25891a8648
commit ae7552f5a2
5 changed files with 21 additions and 4 deletions

View File

@@ -2,9 +2,8 @@ krb5:
type: library
artifact:
source:
type: ghtagtar
repo: krb5/krb5
match: krb5.+-final
type: url
url: 'https://web.mit.edu/kerberos/dist/krb5/1.22/krb5-1.22.2.tar.gz'
metadata:
license-files: [NOTICE]
license: BSD-3-Clause

View File

@@ -29,6 +29,15 @@ class grpc extends PhpExtensionPackage
'zend_ce_exception,',
);
// Fix include path conflict with pdo_sqlsrv: grpc's PHP ext dir is added to the global include path via
$grpc_php_dir = "{$this->getSourceDir()}/src/php/ext/grpc";
if (file_exists("{$grpc_php_dir}/version.h")) {
copy("{$grpc_php_dir}/version.h", "{$grpc_php_dir}/php_grpc_version.h");
unlink("{$grpc_php_dir}/version.h");
FileSystem::replaceFileStr("{$grpc_php_dir}/php_grpc.h", '#include "version.h"', '#include "php_grpc_version.h"');
FileSystem::replaceFileStr("{$grpc_php_dir}/php_grpc.c", '#include "version.h"', '#include "php_grpc_version.h"');
}
// custom config.m4 content for grpc extension, to prevent building libgrpc.a again
$config_m4 = <<<'M4'
PHP_ARG_ENABLE(grpc, [whether to enable grpc support], [AS_HELP_STRING([--enable-grpc], [Enable grpc support])])

View File

@@ -19,7 +19,9 @@ class krb5
#[BuildFor('Darwin')]
public function build(LibraryPackage $lib, PackageInstaller $installer): void
{
shell()->cd($lib->getSourceRoot())->exec('autoreconf -if');
if (!file_exists($lib->getSourceRoot() . '/configure')) {
shell()->cd($lib->getSourceRoot())->exec('autoreconf -if');
}
$resolved = array_keys($installer->getResolvedPackages());
$spc = new SPCConfigUtil(['no_php' => true, 'libs_only_deps' => true]);

View File

@@ -22,6 +22,10 @@ class libjpeg
->addConfigureArgs(
'-DENABLE_STATIC=ON',
'-DENABLE_SHARED=OFF',
'-DWITH_SYSTEM_ZLIB=ON',
'-DWITH_TOOLS=OFF',
'-DWITH_TESTS=OFF',
'-DWITH_SIMD=OFF',
)
->build();
// patch pkgconfig

View File

@@ -270,6 +270,7 @@ class UnixCMakeExecutor extends Executor
$cflags = getenv('SPC_DEFAULT_C_FLAGS');
$cc = getenv('CC');
$cxx = getenv('CXX');
$include = BUILD_INCLUDE_PATH;
logger()->debug("making cmake tool chain file for {$os} {$target_arch} with CFLAGS='{$cflags}'");
$root = BUILD_ROOT_PATH;
$pkgConfigExecutable = PkgConfigUtil::findPkgConfig();
@@ -298,6 +299,8 @@ set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
set(CMAKE_C_STANDARD_INCLUDE_DIRECTORIES "{$include}")
set(CMAKE_CXX_STANDARD_INCLUDE_DIRECTORIES "{$include}")
CMAKE;
// Whoops, linux may need CMAKE_AR sometimes
if (PHP_OS_FAMILY === 'Linux') {