mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-03-18 21:04:52 +08:00
32 lines
1.0 KiB
PHP
32 lines
1.0 KiB
PHP
|
|
<?php
|
||
|
|
|
||
|
|
declare(strict_types=1);
|
||
|
|
|
||
|
|
namespace SPC\builder\unix\library;
|
||
|
|
|
||
|
|
use SPC\exception\FileSystemException;
|
||
|
|
use SPC\exception\RuntimeException;
|
||
|
|
use SPC\store\FileSystem;
|
||
|
|
|
||
|
|
trait jbig
|
||
|
|
{
|
||
|
|
/**
|
||
|
|
* @throws FileSystemException
|
||
|
|
* @throws RuntimeException
|
||
|
|
*/
|
||
|
|
protected function build(): void
|
||
|
|
{
|
||
|
|
// Patch Makefile to add -fPIC flag for position-independent code
|
||
|
|
FileSystem::replaceFileStr($this->source_dir . '/Makefile', 'CFLAGS = -O2 -W -Wno-unused-result', 'CFLAGS = -O2 -W -Wno-unused-result -fPIC');
|
||
|
|
|
||
|
|
// Build the library
|
||
|
|
shell()->cd($this->source_dir)->initializeEnv($this)
|
||
|
|
->exec("make -j{$this->builder->concurrency} {$this->builder->getEnvString()} lib")
|
||
|
|
->exec('cp libjbig/libjbig.a ' . BUILD_LIB_PATH)
|
||
|
|
->exec('cp libjbig/libjbig85.a ' . BUILD_LIB_PATH)
|
||
|
|
->exec('cp libjbig/jbig.h ' . BUILD_INCLUDE_PATH)
|
||
|
|
->exec('cp libjbig/jbig85.h ' . BUILD_INCLUDE_PATH)
|
||
|
|
->exec('cp libjbig/jbig_ar.h ' . BUILD_INCLUDE_PATH);
|
||
|
|
}
|
||
|
|
}
|