39 lines
1.3 KiB
PHP
Raw Normal View History

<?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
{
// 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)
->exec(
'./configure ' .
'--enable-static --disable-shared --with-pic ' .
"{$extra_libs} " .
'--disable-cxx ' .
'--prefix='
)
->exec('make clean')
->exec("make -j{$this->builder->concurrency}")
->exec('make install DESTDIR=' . BUILD_ROOT_PATH);
$this->patchPkgconfPrefix(['libtiff-4.pc']);
}
}