2023-04-29 18:59:47 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
|
|
namespace SPC\builder\unix\library;
|
|
|
|
|
|
2023-08-20 19:51:45 +08:00
|
|
|
use SPC\exception\FileSystemException;
|
|
|
|
|
use SPC\exception\RuntimeException;
|
|
|
|
|
|
2023-04-29 18:59:47 +08:00
|
|
|
trait xz
|
|
|
|
|
{
|
2023-08-20 19:51:45 +08:00
|
|
|
/**
|
|
|
|
|
* @throws RuntimeException
|
|
|
|
|
* @throws FileSystemException
|
|
|
|
|
*/
|
|
|
|
|
public function build(): void
|
2023-04-29 18:59:47 +08:00
|
|
|
{
|
|
|
|
|
shell()->cd($this->source_dir)
|
2025-06-06 09:57:20 +07:00
|
|
|
->setEnv([
|
|
|
|
|
'CFLAGS' => $this->getLibExtraCFlags(),
|
|
|
|
|
'LDFLAGS' => $this->getLibExtraLdFlags(),
|
|
|
|
|
'LIBS' => $this->getLibExtraLibs(),
|
|
|
|
|
])
|
|
|
|
|
->execWithEnv(
|
2023-10-23 00:37:28 +08:00
|
|
|
'./configure ' .
|
2023-04-29 18:59:47 +08:00
|
|
|
'--enable-static ' .
|
|
|
|
|
'--disable-shared ' .
|
2025-05-31 14:35:59 +07:00
|
|
|
'--enable-pic ' .
|
2023-04-29 18:59:47 +08:00
|
|
|
'--disable-scripts ' .
|
|
|
|
|
'--disable-doc ' .
|
|
|
|
|
'--with-libiconv ' .
|
|
|
|
|
'--prefix='
|
|
|
|
|
)
|
2025-06-06 09:57:20 +07:00
|
|
|
->execWithEnv('make clean')
|
|
|
|
|
->execWithEnv("make -j{$this->builder->concurrency}")
|
|
|
|
|
->execWithEnv('make install DESTDIR=' . BUILD_ROOT_PATH);
|
2023-04-29 18:59:47 +08:00
|
|
|
$this->patchPkgconfPrefix(['liblzma.pc']);
|
|
|
|
|
}
|
|
|
|
|
}
|