Merge remote-tracking branch 'origin/main' into fix/icurel

This commit is contained in:
DubbleClick
2025-06-05 16:48:47 +07:00
5 changed files with 45 additions and 19 deletions

View File

@@ -18,7 +18,15 @@ trait curl
{ {
$extra = ''; $extra = '';
// lib:openssl // lib:openssl
$extra .= $this->builder->getLib('openssl') ? '-DCURL_USE_OPENSSL=ON ' : '-DCURL_USE_OPENSSL=OFF -DCURL_ENABLE_SSL=OFF '; if ($this->builder->getLib('openssl')) {
$extra .=
'-DCURL_USE_OPENSSL=ON ' .
'-DCURL_CA_BUNDLE=OFF ' .
'-DCURL_CA_PATH=OFF ' .
'-DCURL_CA_FALLBACK=ON ';
} else {
$extra .= '-DCURL_USE_OPENSSL=OFF -DCURL_ENABLE_SSL=OFF ';
}
// lib:brotli // lib:brotli
$extra .= $this->builder->getLib('brotli') ? '-DCURL_BROTLI=ON ' : '-DCURL_BROTLI=OFF '; $extra .= $this->builder->getLib('brotli') ? '-DCURL_BROTLI=ON ' : '-DCURL_BROTLI=OFF ';
// lib:libssh2 // lib:libssh2

View File

@@ -18,9 +18,13 @@ trait freetype
*/ */
protected function build(): void protected function build(): void
{ {
$extra_libs = $this->builder->getLib('libpng') ? '-DFT_DISABLE_PNG=OFF ' : '-DFT_DISABLE_PNG=ON '; $extra = '';
$extra_libs .= $this->builder->getLib('bzip2') ? '-DFT_DISABLE_BZIP2=OFF ' : '-DFT_DISABLE_BZIP2=ON '; if (version_compare(get_cmake_version(), '4.0.0', '>=')) {
$extra_libs .= $this->builder->getLib('brotli') ? '-DFT_DISABLE_BROTLI=OFF ' : '-DFT_DISABLE_BROTLI=ON '; $extra .= '-DCMAKE_POLICY_VERSION_MINIMUM=3.12 ';
}
$extra .= $this->builder->getLib('libpng') ? '-DFT_DISABLE_PNG=OFF ' : '-DFT_DISABLE_PNG=ON ';
$extra .= $this->builder->getLib('bzip2') ? '-DFT_DISABLE_BZIP2=OFF ' : '-DFT_DISABLE_BZIP2=ON ';
$extra .= $this->builder->getLib('brotli') ? '-DFT_DISABLE_BROTLI=OFF ' : '-DFT_DISABLE_BROTLI=ON ';
FileSystem::resetDir($this->source_dir . '/build'); FileSystem::resetDir($this->source_dir . '/build');
shell()->cd($this->source_dir . '/build') shell()->cd($this->source_dir . '/build')
->setEnv([ ->setEnv([
@@ -31,8 +35,7 @@ trait freetype
->execWithEnv( ->execWithEnv(
"cmake {$this->builder->makeCmakeArgs()} -DFT_DISABLE_HARFBUZZ=ON " . "cmake {$this->builder->makeCmakeArgs()} -DFT_DISABLE_HARFBUZZ=ON " .
'-DBUILD_SHARED_LIBS=OFF ' . '-DBUILD_SHARED_LIBS=OFF ' .
'-DPOSITION_INDEPENDENT_CODE=ON ' . "{$extra}.."
"{$extra_libs}.."
) )
->execWithEnv('make clean') ->execWithEnv('make clean')
->execWithEnv("make -j{$this->builder->concurrency}") ->execWithEnv("make -j{$this->builder->concurrency}")

View File

@@ -87,17 +87,14 @@ class LinuxToolCheckList
#[AsCheckItem('if cmake version >= 3.18', limit_os: 'Linux')] #[AsCheckItem('if cmake version >= 3.18', limit_os: 'Linux')]
public function checkCMakeVersion(): ?CheckResult public function checkCMakeVersion(): ?CheckResult
{ {
$check_cmd = 'cmake --version'; $ver = get_cmake_version();
$pattern = '/cmake version (.*)/m'; if ($ver === null) {
$out = shell()->execWithResult($check_cmd, false)[1][0]; return CheckResult::fail('Failed to get cmake version');
if (preg_match($pattern, $out, $match)) {
$ver = $match[1];
if (version_compare($ver, '3.18.0') <= 0) {
return CheckResult::fail('cmake version is too low (' . $ver . '), please update it manually!');
}
return CheckResult::ok($match[1]);
} }
return CheckResult::fail('Failed to get cmake version'); if (version_compare($ver, '3.18.0') < 0) {
return CheckResult::fail('cmake version is too low (' . $ver . '), please update it manually!');
}
return CheckResult::ok($ver);
} }
/** @noinspection PhpUnused */ /** @noinspection PhpUnused */

View File

@@ -192,3 +192,21 @@ function f_putenv(string $env): bool
logger()->debug('Setting env: ' . $env); logger()->debug('Setting env: ' . $env);
return putenv($env); return putenv($env);
} }
/**
* Get the installed CMake version
*
* @return null|string The CMake version or null if it couldn't be determined
*/
function get_cmake_version(): ?string
{
try {
[,$output] = shell()->execWithResult('cmake --version', false);
if (preg_match('/cmake version ([\d.]+)/i', $output[0], $matches)) {
return $matches[1];
}
} catch (Exception $e) {
logger()->warning('Failed to get CMake version: ' . $e->getMessage());
}
return null;
}

View File

@@ -13,9 +13,9 @@ declare(strict_types=1);
// test php version (8.1 ~ 8.4 available, multiple for matrix) // test php version (8.1 ~ 8.4 available, multiple for matrix)
$test_php_version = [ $test_php_version = [
// '8.1', '8.1',
// '8.2', '8.2',
// '8.3', '8.3',
'8.4', '8.4',
]; ];