Compare commits

...

3 Commits

Author SHA1 Message Date
DubbleClick
2ef64e4597 add libjxl #755 2025-07-20 00:11:29 +07:00
DubbleClick
6c18862fd1 fixes 2025-07-19 23:54:38 +07:00
Marc
6c109c52f6 Update src/SPC/builder/unix/library/jbig.php
Co-authored-by: Jerry Ma <jesse2061@outlook.com>
2025-07-19 17:56:54 +07:00
8 changed files with 83 additions and 10 deletions

View File

@@ -4,6 +4,7 @@ declare(strict_types=1);
return (new PhpCsFixer\Config())
->setRiskyAllowed(true)
->setUnsupportedPhpVersionAllowed(true)
->setRules([
'@PSR12' => true,
'@Symfony' => true,

View File

@@ -240,7 +240,8 @@
"zstd",
"xz",
"libzip",
"libxml2"
"libxml2",
"libjxl"
]
},
"imap": {
@@ -419,6 +420,20 @@
"zlib"
]
},
"libjxl": {
"source": "libjxl",
"static-libs-unix": [
"libjxl.a",
"libjxl_dec.a"
],
"lib-depends": [
"brotli",
"libgif",
"libjpeg",
"libpng",
"libwebp"
]
},
"liblz4": {
"source": "liblz4",
"static-libs-unix": [
@@ -497,6 +512,7 @@
"static-libs-windows": [
"libssh2.lib"
],
"provide-pre-built": true,
"headers": [
"libssh2.h",
"libssh2_publickey.h",
@@ -504,9 +520,6 @@
],
"lib-depends": [
"openssl"
],
"lib-suggests": [
"zlib"
]
},
"libtiff": {

View File

@@ -553,6 +553,14 @@
"path": "LICENSE.md"
}
},
"libjxl": {
"type": "ghtar",
"repo": "libjxl/libjxl",
"license": {
"type": "file",
"path": "LICENSE"
}
},
"liblz4": {
"type": "ghrel",
"repo": "lz4/lz4",
@@ -625,7 +633,6 @@
"type": "filelist",
"url": "https://download.osgeo.org/libtiff/",
"regex": "/href=\"(?<file>tiff-(?<version>[^\"]+)\\.tar\\.xz)\"/",
"provide-pre-built": true,
"license": {
"type": "file",
"path": "LICENSE.md"

View File

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

View File

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

View File

@@ -32,9 +32,9 @@ trait imagemagick
->optionalLib('zstd', ...ac_with_args('zstd'))
->optionalLib('freetype', ...ac_with_args('freetype'))
->optionalLib('bzip2', ...ac_with_args('bzlib'))
->optionalLib('libjxl', ...ac_with_args('jxl'))
->addConfigureArgs(
'--disable-openmp',
'--without-jxl',
'--without-x',
);

View File

@@ -12,14 +12,18 @@ trait jbig
{
/**
* @throws FileSystemException
*/
public function patchBeforeBuild(): bool
{
FileSystem::replaceFileStr($this->source_dir . '/Makefile', 'CFLAGS = -O2 -W -Wno-unused-result', 'CFLAGS = -O2 -W -Wno-unused-result -fPIC');
return true;
}
/**
* @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)

View File

@@ -0,0 +1,24 @@
<?php
declare(strict_types=1);
namespace SPC\builder\unix\library;
use SPC\util\executor\UnixCMakeExecutor;
trait libjxl
{
protected function build(): void
{
UnixCMakeExecutor::create($this)
->addConfigureArgs('-DJPEGXL_ENABLE_TOOLS=OFF')
->addConfigureArgs('-DJPEGXL_ENABLE_EXAMPLES=OFF')
->addConfigureArgs('-DJPEGXL_ENABLE_MANPAGES=OFF')
->addConfigureArgs('-DJPEGXL_ENABLE_BENCHMARK=OFF')
->addConfigureArgs('-DJPEGXL_ENABLE_PLUGINS=OFF')
->addConfigureArgs('-DJPEGXL_ENABLE_SJPEG=OFF')
->addConfigureArgs('-DJPEGXL_STATIC=ON')
->addConfigureArgs('-DBUILD_TESTING=OFF')
->build();
}
}