Files
static-php-cli/src/SPC/builder/linux/library/liburing.php

54 lines
1.4 KiB
PHP
Raw Normal View History

2025-08-25 22:57:04 +07:00
<?php
declare(strict_types=1);
namespace SPC\builder\linux\library;
2025-08-26 18:16:44 +07:00
use SPC\builder\linux\SystemUtil;
use SPC\store\FileSystem;
2025-12-03 15:02:14 +01:00
use SPC\toolchain\GccNativeToolchain;
use SPC\toolchain\ToolchainManager;
2025-08-25 22:57:04 +07:00
use SPC\util\executor\UnixAutoconfExecutor;
use SPC\util\SPCTarget;
2025-08-25 22:57:04 +07:00
class liburing extends LinuxLibraryBase
{
public const NAME = 'liburing';
2025-08-26 18:16:44 +07:00
public function patchBeforeBuild(): bool
{
2025-12-03 15:02:14 +01:00
if (SystemUtil::isMuslDist()) {
FileSystem::replaceFileStr($this->source_dir . '/configure', 'realpath -s', 'realpath');
return true;
2025-08-26 18:16:44 +07:00
}
2025-12-03 15:02:14 +01:00
return false;
2025-08-26 18:16:44 +07:00
}
2025-08-25 22:57:04 +07:00
protected function build(): void
{
2025-12-03 15:02:14 +01:00
$use_libc = ToolchainManager::getToolchainClass() !== GccNativeToolchain::class || version_compare(SPCTarget::getLibcVersion(), '2.30', '>=');
$make = UnixAutoconfExecutor::create($this);
2025-12-03 15:02:14 +01:00
if ($use_libc) {
$make->appendEnv([
'CFLAGS' => '-D_GNU_SOURCE',
]);
}
$make
2025-08-25 22:57:04 +07:00
->removeConfigureArgs(
'--disable-shared',
'--enable-static',
'--with-pic',
'--enable-pic',
)
->addConfigureArgs(
$use_libc ? '--use-libc' : '',
2025-08-25 22:57:04 +07:00
)
->configure()
2025-12-03 15:02:14 +01:00
->make('library ENABLE_SHARED=0', 'install ENABLE_SHARED=0', with_clean: false);
2025-08-25 22:57:04 +07:00
2025-08-27 08:31:48 +07:00
$this->patchPkgconfPrefix();
2025-08-25 22:57:04 +07:00
}
}