Skip to content

Commit daea8e1

Browse files
committed
1 parent 727600a commit daea8e1

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

src/Package/Library/gmp.php

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
use StaticPHP\Attribute\Package\Library;
99
use StaticPHP\Package\LibraryPackage;
1010
use StaticPHP\Runtime\Executor\UnixAutoconfExecutor;
11+
use StaticPHP\Runtime\SystemTarget;
1112

1213
#[Library('gmp')]
1314
class gmp
@@ -16,10 +17,12 @@ class gmp
1617
#[BuildFor('Darwin')]
1718
public function build(LibraryPackage $lib): void
1819
{
19-
UnixAutoconfExecutor::create($lib)
20-
->appendEnv(['CFLAGS' => '-std=c17'])
21-
->configure('--enable-fat')
22-
->make();
20+
$make = UnixAutoconfExecutor::create($lib)->appendEnv(['CFLAGS' => '-std=c17']);
21+
if (SystemTarget::getTargetArch() === 'x86_64' && SystemTarget::getTargetOS() === 'Linux') {
22+
$libc = SystemTarget::getLibc() === 'glibc' ? 'gnu' : 'musl';
23+
$make->addConfigureArgs(["--host=x86_64-pc-linux-{$libc}"]);
24+
}
25+
$make->configure('--enable-fat')->make();
2326
$lib->patchPkgconfPrefix(['gmp.pc']);
2427
}
2528
}

0 commit comments

Comments
 (0)