2024-03-01 19:19:47 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
|
|
namespace SPC\builder\unix\library;
|
|
|
|
|
|
|
|
|
|
use SPC\exception\FileSystemException;
|
|
|
|
|
use SPC\exception\RuntimeException;
|
|
|
|
|
|
|
|
|
|
trait libtiff
|
|
|
|
|
{
|
|
|
|
|
/**
|
|
|
|
|
* @throws FileSystemException
|
|
|
|
|
* @throws RuntimeException
|
|
|
|
|
*/
|
|
|
|
|
protected function build(): void
|
|
|
|
|
{
|
2025-01-25 17:15:53 +09:00
|
|
|
// zlib
|
|
|
|
|
$extra_libs = '--enable-zlib --with-zlib-include-dir=' . BUILD_ROOT_PATH . '/include --with-zlib-lib-dir=' . BUILD_ROOT_PATH . '/lib';
|
|
|
|
|
// libjpeg
|
|
|
|
|
$extra_libs .= ' --enable-jpeg --disable-old-jpeg --disable-jpeg12 --with-jpeg-include-dir=' . BUILD_ROOT_PATH . '/include --with-jpeg-lib-dir=' . BUILD_ROOT_PATH . '/lib';
|
|
|
|
|
// We disabled lzma, zstd, webp, libdeflate by default to reduce the size of the binary
|
|
|
|
|
$extra_libs .= ' --disable-lzma --disable-zstd --disable-webp --disable-libdeflate';
|
|
|
|
|
|
2025-06-09 11:12:34 +08:00
|
|
|
$shell = shell()->cd($this->source_dir)->initializeEnv($this)
|
2025-06-09 10:24:06 +08:00
|
|
|
->exec(
|
2024-03-01 19:19:47 +08:00
|
|
|
'./configure ' .
|
2025-05-31 14:35:59 +07:00
|
|
|
'--enable-static --disable-shared --with-pic ' .
|
2025-01-25 17:15:53 +09:00
|
|
|
"{$extra_libs} " .
|
2024-03-01 19:19:47 +08:00
|
|
|
'--disable-cxx ' .
|
|
|
|
|
'--prefix='
|
2025-06-09 14:38:45 +07:00
|
|
|
)
|
|
|
|
|
->exec('make clean')
|
2025-06-09 10:24:06 +08:00
|
|
|
->exec("make -j{$this->builder->concurrency}")
|
|
|
|
|
->exec('make install DESTDIR=' . BUILD_ROOT_PATH);
|
2024-03-01 19:19:47 +08:00
|
|
|
$this->patchPkgconfPrefix(['libtiff-4.pc']);
|
|
|
|
|
}
|
|
|
|
|
}
|