2023-04-29 18:59:47 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
|
|
namespace SPC\builder\unix\library;
|
|
|
|
|
|
2025-01-28 19:37:50 +08:00
|
|
|
use SPC\store\FileSystem;
|
|
|
|
|
|
2023-04-29 18:59:47 +08:00
|
|
|
trait bzip2
|
|
|
|
|
{
|
2025-01-28 19:37:50 +08:00
|
|
|
public function patchBeforeBuild(): bool
|
|
|
|
|
{
|
|
|
|
|
FileSystem::replaceFileStr($this->source_dir . '/Makefile', 'CFLAGS=-Wall', 'CFLAGS=-fPIC -Wall');
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2023-04-29 18:59:47 +08:00
|
|
|
protected function build(): void
|
|
|
|
|
{
|
2025-06-09 11:12:34 +08:00
|
|
|
shell()->cd($this->source_dir)->initializeEnv($this)
|
2025-06-09 10:24:06 +08:00
|
|
|
->exec("make PREFIX='" . BUILD_ROOT_PATH . "' clean")
|
|
|
|
|
->exec("make -j{$this->builder->concurrency} {$this->builder->getEnvString()} PREFIX='" . BUILD_ROOT_PATH . "' libbz2.a")
|
2023-04-29 18:59:47 +08:00
|
|
|
->exec('cp libbz2.a ' . BUILD_LIB_PATH)
|
|
|
|
|
->exec('cp bzlib.h ' . BUILD_INCLUDE_PATH);
|
|
|
|
|
}
|
|
|
|
|
}
|