|
9 | 9 | use StaticPHP\Package\LibraryPackage; |
10 | 10 | use StaticPHP\Runtime\Executor\UnixCMakeExecutor; |
11 | 11 | use StaticPHP\Runtime\Executor\WindowsCMakeExecutor; |
| 12 | +use StaticPHP\Runtime\SystemTarget; |
12 | 13 | use StaticPHP\Toolchain\Interface\ToolchainInterface; |
13 | 14 | use StaticPHP\Toolchain\ZigToolchain; |
| 15 | +use StaticPHP\Util\System\UnixUtil; |
14 | 16 |
|
15 | 17 | #[Library('libaom')] |
16 | 18 | class libaom extends LibraryPackage |
@@ -39,9 +41,19 @@ public function buildUnix(ToolchainInterface $toolchain): void |
39 | 41 | $new = trim($extra . ' -D_GNU_SOURCE'); |
40 | 42 | f_putenv("SPC_COMPILER_EXTRA={$new}"); |
41 | 43 | } |
| 44 | + $targetCpu = SystemTarget::getTargetArch(); |
| 45 | + if (str_starts_with($targetCpu, 'aarch')) { |
| 46 | + $targetCpu = str_replace('aarch', 'arm', $targetCpu); |
| 47 | + } |
| 48 | + if (!UnixUtil::findCommand('nasm') && !UnixUtil::findCommand('yasm')) { |
| 49 | + $targetCpu = 'generic'; |
| 50 | + } |
42 | 51 | UnixCMakeExecutor::create($this) |
43 | 52 | ->setBuildDir("{$this->getSourceDir()}/builddir") |
44 | | - ->addConfigureArgs('-DAOM_TARGET_CPU=generic') |
| 53 | + ->addConfigureArgs( |
| 54 | + "-DAOM_TARGET_CPU={$targetCpu}", |
| 55 | + '-DCONFIG_RUNTIME_CPU_DETECT=1', |
| 56 | + ) |
45 | 57 | ->build(); |
46 | 58 | f_putenv("SPC_COMPILER_EXTRA={$extra}"); |
47 | 59 | $this->patchPkgconfPrefix(['aom.pc']); |
|
0 commit comments