2025-03-05 11:35:03 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
|
|
namespace SPC\builder\unix\library;
|
|
|
|
|
|
|
|
|
|
use SPC\exception\RuntimeException;
|
|
|
|
|
|
|
|
|
|
trait attr
|
|
|
|
|
{
|
|
|
|
|
/**
|
|
|
|
|
* @throws RuntimeException
|
|
|
|
|
*/
|
|
|
|
|
protected function build(): void
|
|
|
|
|
{
|
2025-03-10 11:46:53 +01:00
|
|
|
$cflags = PHP_OS_FAMILY !== 'Linux' ? "{$this->builder->arch_c_flags} -Wimplicit-function-declaration -Wno-int-conversion" : '';
|
2025-03-10 11:42:44 +01:00
|
|
|
$ldflags = PHP_OS_FAMILY !== 'Linux' ? '' : '--static';
|
2025-03-05 11:35:03 +01:00
|
|
|
shell()->cd($this->source_dir)
|
2025-03-10 11:42:44 +01:00
|
|
|
->setEnv([
|
|
|
|
|
'CFLAGS' => trim('-I' . BUILD_INCLUDE_PATH . ' ' . $this->getLibExtraCFlags() . ' ' . $cflags),
|
|
|
|
|
'LDFLAGS' => trim('-L' . BUILD_LIB_PATH . ' ' . $this->getLibExtraLdFlags() . ' ' . $ldflags),
|
|
|
|
|
'LIBS' => $this->getLibExtraLibs(),
|
|
|
|
|
])->execWithEnv('./autogen.sh')
|
2025-03-10 09:46:20 +01:00
|
|
|
->execWithEnv('./configure --prefix= --enable-static --disable-shared')
|
2025-03-05 11:35:03 +01:00
|
|
|
->execWithEnv("make -j {$this->builder->concurrency}")
|
|
|
|
|
->exec('make install DESTDIR=' . BUILD_ROOT_PATH);
|
|
|
|
|
|
|
|
|
|
$this->patchPkgconfPrefix(['libattr.pc'], PKGCONF_PATCH_PREFIX);
|
|
|
|
|
}
|
|
|
|
|
}
|