File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 88use StaticPHP \Attribute \Package \Library ;
99use StaticPHP \Package \LibraryPackage ;
1010use StaticPHP \Runtime \Executor \UnixAutoconfExecutor ;
11+ use StaticPHP \Runtime \SystemTarget ;
1112
1213#[Library('gmp ' )]
1314class 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}
You can’t perform that action at this time.
0 commit comments