mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-07-16 05:15:35 +08:00
Update libaom configuration to support target architecture detection
This commit is contained in:
@@ -9,8 +9,10 @@ use StaticPHP\Attribute\Package\Library;
|
|||||||
use StaticPHP\Package\LibraryPackage;
|
use StaticPHP\Package\LibraryPackage;
|
||||||
use StaticPHP\Runtime\Executor\UnixCMakeExecutor;
|
use StaticPHP\Runtime\Executor\UnixCMakeExecutor;
|
||||||
use StaticPHP\Runtime\Executor\WindowsCMakeExecutor;
|
use StaticPHP\Runtime\Executor\WindowsCMakeExecutor;
|
||||||
|
use StaticPHP\Runtime\SystemTarget;
|
||||||
use StaticPHP\Toolchain\Interface\ToolchainInterface;
|
use StaticPHP\Toolchain\Interface\ToolchainInterface;
|
||||||
use StaticPHP\Toolchain\ZigToolchain;
|
use StaticPHP\Toolchain\ZigToolchain;
|
||||||
|
use StaticPHP\Util\System\UnixUtil;
|
||||||
|
|
||||||
#[Library('libaom')]
|
#[Library('libaom')]
|
||||||
class libaom extends LibraryPackage
|
class libaom extends LibraryPackage
|
||||||
@@ -39,9 +41,27 @@ class libaom extends LibraryPackage
|
|||||||
$new = trim($extra . ' -D_GNU_SOURCE');
|
$new = trim($extra . ' -D_GNU_SOURCE');
|
||||||
f_putenv("SPC_COMPILER_EXTRA={$new}");
|
f_putenv("SPC_COMPILER_EXTRA={$new}");
|
||||||
}
|
}
|
||||||
|
$targetCpu = SystemTarget::getTargetArch();
|
||||||
|
if (str_starts_with($targetCpu, 'aarch')) {
|
||||||
|
$targetCpu = str_replace('aarch', 'arm', $targetCpu);
|
||||||
|
}
|
||||||
|
if (
|
||||||
|
in_array($targetCpu, ['x86', 'x86_64'], true)
|
||||||
|
&& !UnixUtil::findCommand('nasm')
|
||||||
|
&& !UnixUtil::findCommand('yasm')
|
||||||
|
) {
|
||||||
|
$targetCpu = 'generic';
|
||||||
|
}
|
||||||
UnixCMakeExecutor::create($this)
|
UnixCMakeExecutor::create($this)
|
||||||
->setBuildDir("{$this->getSourceDir()}/builddir")
|
->setBuildDir("{$this->getSourceDir()}/builddir")
|
||||||
->addConfigureArgs('-DAOM_TARGET_CPU=generic')
|
->addConfigureArgs(
|
||||||
|
"-DAOM_TARGET_CPU={$targetCpu}",
|
||||||
|
'-DCONFIG_RUNTIME_CPU_DETECT=1',
|
||||||
|
'-DENABLE_EXAMPLES=OFF',
|
||||||
|
'-DENABLE_TESTS=OFF',
|
||||||
|
'-DENABLE_TOOLS=OFF',
|
||||||
|
'-DENABLE_DOCS=OFF',
|
||||||
|
)
|
||||||
->build();
|
->build();
|
||||||
f_putenv("SPC_COMPILER_EXTRA={$extra}");
|
f_putenv("SPC_COMPILER_EXTRA={$extra}");
|
||||||
$this->patchPkgconfPrefix(['aom.pc']);
|
$this->patchPkgconfPrefix(['aom.pc']);
|
||||||
|
|||||||
Reference in New Issue
Block a user