This commit is contained in:
DubbleClick
2025-07-18 14:04:55 +07:00
parent 5c44703f53
commit be0dbcd9eb
6 changed files with 79 additions and 1 deletions

View File

@@ -0,0 +1,12 @@
<?php
declare(strict_types=1);
namespace SPC\builder\linux\library;
class jbig extends LinuxLibraryBase
{
use \SPC\builder\unix\library\jbig;
public const NAME = 'jbig';
}

View File

@@ -0,0 +1,12 @@
<?php
declare(strict_types=1);
namespace SPC\builder\macos\library;
class jbig extends MacOSLibraryBase
{
use \SPC\builder\unix\library\jbig;
public const NAME = 'jbig';
}

View File

@@ -0,0 +1,31 @@
<?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);
}
}

View File

@@ -38,6 +38,7 @@ trait libtiff
->optionalLib('zstd', '--enable-zstd', '--disable-zstd')
->optionalLib('webp', '--enable-webp', '--disable-webp')
->optionalLib('xz', '--enable-lzma', '--disable-lzma')
->optionalLib('jbig', '--enable-jbig', '--disable-jbig')
->make();
$this->patchPkgconfPrefix(['libtiff-4.pc']);
}