31 lines
913 B
PHP
Raw Normal View History

<?php
declare(strict_types=1);
namespace SPC\builder\unix\library;
2025-01-28 19:37:50 +08:00
use SPC\store\FileSystem;
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;
}
protected function build(): void
{
shell()->cd($this->source_dir)
2025-05-15 14:45:51 +07:00
->setEnv([
'CFLAGS' => $this->getLibExtraCFlags(),
'LDFLAGS' => $this->getLibExtraLdFlags(),
'LIBS' => $this->getLibExtraLibs(),
])
2024-04-07 15:52:24 +08:00
->execWithEnv("make PREFIX='" . BUILD_ROOT_PATH . "' clean")
->execWithEnv("make -j{$this->builder->concurrency} {$this->builder->getEnvString()} PREFIX='" . BUILD_ROOT_PATH . "' libbz2.a")
->exec('cp libbz2.a ' . BUILD_LIB_PATH)
->exec('cp bzlib.h ' . BUILD_INCLUDE_PATH);
}
}