Merge branch 'main' into grpc

# Conflicts:
#	src/globals/test-extensions.php
This commit is contained in:
crazywhalecc 2025-07-22 13:57:31 +08:00
commit 20ab4afb4b
No known key found for this signature in database
GPG Key ID: 1F4BDD59391F2680
16 changed files with 278 additions and 36 deletions

View File

@ -86,7 +86,7 @@ RUN sed -i 's/^#.*baseurl=http/baseurl=http/g' /etc/yum.repos.d/*.repo && \
sed -i 's/^mirrorlist=http/#mirrorlist=http/g' /etc/yum.repos.d/*.repo sed -i 's/^mirrorlist=http/#mirrorlist=http/g' /etc/yum.repos.d/*.repo
RUN yum update -y && \ RUN yum update -y && \
yum install -y devtoolset-10-gcc-* yum install -y devtoolset-10-gcc-* devtoolset-10-libatomic-devel
RUN echo "source scl_source enable devtoolset-10" >> /etc/bashrc RUN echo "source scl_source enable devtoolset-10" >> /etc/bashrc
RUN source /etc/bashrc RUN source /etc/bashrc
RUN yum install -y which RUN yum install -y which

View File

@ -228,8 +228,9 @@
], ],
"lib-depends": [ "lib-depends": [
"zlib", "zlib",
"libpng",
"libjpeg", "libjpeg",
"libjxl",
"libpng",
"libwebp", "libwebp",
"freetype", "freetype",
"libtiff", "libtiff",
@ -252,6 +253,18 @@
"openssl" "openssl"
] ]
}, },
"jbig": {
"source": "jbig",
"static-libs-unix": [
"libjbig.a",
"libjbig85.a"
],
"headers": [
"jbig.h",
"jbig85.h",
"jbig_ar.h"
]
},
"ldap": { "ldap": {
"source": "ldap", "source": "ldap",
"static-libs-unix": [ "static-libs-unix": [
@ -265,6 +278,13 @@
"libsodium" "libsodium"
] ]
}, },
"lerc": {
"source": "lerc",
"static-libs-unix": [
"libLerc.a"
],
"cpp-library": true
},
"libacl": { "libacl": {
"source": "libacl", "source": "libacl",
"static-libs-unix": [ "static-libs-unix": [
@ -400,6 +420,21 @@
"zlib" "zlib"
] ]
}, },
"libjxl": {
"source": "libjxl",
"static-libs-unix": [
"libjxl.a",
"libjxl_cms.a",
"libjxl_threads.a",
"libhwy.a"
],
"lib-depends": [
"brotli",
"libjpeg",
"libpng",
"libwebp"
]
},
"liblz4": { "liblz4": {
"source": "liblz4", "source": "liblz4",
"static-libs-unix": [ "static-libs-unix": [
@ -485,9 +520,6 @@
], ],
"lib-depends": [ "lib-depends": [
"openssl" "openssl"
],
"lib-suggests": [
"zlib"
] ]
}, },
"libtiff": { "libtiff": {
@ -498,6 +530,13 @@
"lib-depends": [ "lib-depends": [
"zlib", "zlib",
"libjpeg" "libjpeg"
],
"lib-suggests-unix": [
"lerc",
"libwebp",
"jbig",
"xz",
"zstd"
] ]
}, },
"libuuid": { "libuuid": {
@ -813,6 +852,15 @@
"libiconv" "libiconv"
] ]
}, },
"watcher": {
"source": "watcher",
"static-libs-unix": [
"libwatcher-c.a"
],
"headers": [
"wtr/watcher-c.h"
]
},
"xz": { "xz": {
"source": "xz", "source": "xz",
"static-libs-unix": [ "static-libs-unix": [
@ -866,14 +914,5 @@
"zstd.h", "zstd.h",
"zstd_errors.h" "zstd_errors.h"
] ]
},
"watcher": {
"source": "watcher",
"static-libs-unix": [
"libwatcher-c.a"
],
"headers": [
"wtr/watcher-c.h"
]
} }
} }

View File

@ -388,6 +388,19 @@
"path": "LICENSE" "path": "LICENSE"
} }
}, },
"jbig": {
"type": "url",
"url": "https://dl.static-php.dev/static-php-cli/deps/jbig/jbigkit-2.1.tar.gz",
"provide-pre-built": true,
"alt": {
"type": "url",
"url": "https://www.cl.cam.ac.uk/~mgk25/jbigkit/download/jbigkit-2.1.tar.gz"
},
"license": {
"type": "file",
"path": "COPYING"
}
},
"ldap": { "ldap": {
"type": "filelist", "type": "filelist",
"url": "https://www.openldap.org/software/download/OpenLDAP/openldap-release/", "url": "https://www.openldap.org/software/download/OpenLDAP/openldap-release/",
@ -397,6 +410,16 @@
"path": "LICENSE" "path": "LICENSE"
} }
}, },
"lerc": {
"type": "ghtar",
"repo": "Esri/lerc",
"prefer-stable": true,
"provide-pre-built": true,
"license": {
"type": "file",
"path": "LICENSE"
}
},
"libacl": { "libacl": {
"alt": { "alt": {
"type": "url", "type": "url",
@ -534,6 +557,21 @@
"path": "LICENSE.md" "path": "LICENSE.md"
} }
}, },
"libjxl": {
"type": "git",
"url": "https://github.com/libjxl/libjxl",
"rev": "main",
"submodules": [
"third_party/highway",
"third_party/libjpeg-turbo",
"third_party/sjpeg",
"third_party/skcms"
],
"license": {
"type": "file",
"path": "LICENSE"
}
},
"liblz4": { "liblz4": {
"type": "ghrel", "type": "ghrel",
"repo": "lz4/lz4", "repo": "lz4/lz4",
@ -597,6 +635,7 @@
"repo": "libssh2/libssh2", "repo": "libssh2/libssh2",
"match": "libssh2.+\\.tar\\.gz", "match": "libssh2.+\\.tar\\.gz",
"prefer-stable": true, "prefer-stable": true,
"provide-pre-built": true,
"license": { "license": {
"type": "file", "type": "file",
"path": "COPYING" "path": "COPYING"
@ -606,7 +645,6 @@
"type": "filelist", "type": "filelist",
"url": "https://download.osgeo.org/libtiff/", "url": "https://download.osgeo.org/libtiff/",
"regex": "/href=\"(?<file>tiff-(?<version>[^\"]+)\\.tar\\.xz)\"/", "regex": "/href=\"(?<file>tiff-(?<version>[^\"]+)\\.tar\\.xz)\"/",
"provide-pre-built": true,
"license": { "license": {
"type": "file", "type": "file",
"path": "LICENSE.md" "path": "LICENSE.md"
@ -999,6 +1037,15 @@
"path": "COPYING" "path": "COPYING"
} }
}, },
"watcher": {
"type": "ghtar",
"repo": "e-dant/watcher",
"prefer-stable": true,
"license": {
"type": "file",
"path": "license"
}
},
"xdebug": { "xdebug": {
"type": "url", "type": "url",
"url": "https://pecl.php.net/get/xdebug", "url": "https://pecl.php.net/get/xdebug",
@ -1079,14 +1126,5 @@
"type": "file", "type": "file",
"path": "LICENSE" "path": "LICENSE"
} }
},
"watcher": {
"type": "ghtar",
"repo": "e-dant/watcher",
"prefer-stable": true,
"license": {
"type": "file",
"path": "license"
}
} }
} }

View File

@ -10,7 +10,6 @@ use SPC\exception\WrongUsageException;
use SPC\store\Config; use SPC\store\Config;
use SPC\store\FileSystem; use SPC\store\FileSystem;
use SPC\util\SPCConfigUtil; use SPC\util\SPCConfigUtil;
use SPC\util\SPCTarget;
class Extension class Extension
{ {
@ -516,8 +515,7 @@ class Extension
$sharedLibString = ''; $sharedLibString = '';
$staticLibString = ''; $staticLibString = '';
$staticLibs = $this->getLibFilesString(); $staticLibs = $this->getLibFilesString();
$staticLibs = str_replace(BUILD_LIB_PATH . '/lib', '-l', $staticLibs); $staticLibs = str_replace([BUILD_LIB_PATH . '/lib', '.a'], ['-l', ''], $staticLibs);
$staticLibs = str_replace('.a', '', $staticLibs);
$staticLibs = explode('-l', $staticLibs . ' ' . $config['libs']); $staticLibs = explode('-l', $staticLibs . ' ' . $config['libs']);
foreach ($staticLibs as $lib) { foreach ($staticLibs as $lib) {
$lib = trim($lib); $lib = trim($lib);
@ -533,8 +531,8 @@ class Extension
$sharedLibString .= '-l' . $lib . ' '; $sharedLibString .= '-l' . $lib . ' ';
} }
} }
// move static libstdc++ to shared if we are on non-full-static build target // move -lstdc++ to static libraries because centos 7 the shared libstdc++ is incomplete
if (!SPCTarget::isStatic() && in_array(SPCTarget::getLibc(), SPCTarget::LIBC_LIST)) { if (str_contains((string) getenv('PATH'), 'rh/devtoolset-10')) {
$staticLibString .= ' -lstdc++'; $staticLibString .= ' -lstdc++';
$sharedLibString = str_replace('-lstdc++', '', $sharedLibString); $sharedLibString = str_replace('-lstdc++', '', $sharedLibString);
} }

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\linux\library;
class lerc extends LinuxLibraryBase
{
use \SPC\builder\unix\library\lerc;
public const NAME = 'lerc';
}

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 jbig extends MacOSLibraryBase
{
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 lerc extends MacOSLibraryBase
{
use \SPC\builder\unix\library\lerc;
public const NAME = 'lerc';
}

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('zstd', ...ac_with_args('zstd'))
->optionalLib('freetype', ...ac_with_args('freetype')) ->optionalLib('freetype', ...ac_with_args('freetype'))
->optionalLib('bzip2', ...ac_with_args('bzlib')) ->optionalLib('bzip2', ...ac_with_args('bzlib'))
->optionalLib('libjxl', ...ac_with_args('jxl'))
->addConfigureArgs( ->addConfigureArgs(
'--disable-openmp', '--disable-openmp',
'--without-jxl',
'--without-x', '--without-x',
); );

View File

@ -0,0 +1,35 @@
<?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
*/
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
{
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

@ -0,0 +1,22 @@
<?php
declare(strict_types=1);
namespace SPC\builder\unix\library;
use SPC\exception\FileSystemException;
use SPC\exception\RuntimeException;
use SPC\util\executor\UnixCMakeExecutor;
trait lerc
{
/**
* @throws FileSystemException
* @throws RuntimeException
*/
protected function build(): void
{
UnixCMakeExecutor::create($this)
->build();
}
}

View File

@ -0,0 +1,28 @@
<?php
declare(strict_types=1);
namespace SPC\builder\unix\library;
use SPC\util\executor\UnixCMakeExecutor;
use SPC\util\SPCTarget;
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_SJPOEG=ON')
->addConfigureArgs('-DJPEGXL_ENABLE_JNI=OFF')
->addConfigureArgs('-DJPEGXL_ENABLE_TRANSCODE_JPEG=ON')
->addConfigureArgs('-DJPEGXL_STATIC=' . (SPCTarget::isStatic() ? 'ON' : 'OFF'))
->addConfigureArgs('-DJPEGXL_FORCE_SYSTEM_BROTLI=ON')
->addConfigureArgs('-DBUILD_TESTING=OFF')
->build();
}
}

View File

@ -6,7 +6,9 @@ namespace SPC\builder\unix\library;
use SPC\exception\FileSystemException; use SPC\exception\FileSystemException;
use SPC\exception\RuntimeException; use SPC\exception\RuntimeException;
use SPC\store\FileSystem;
use SPC\util\executor\UnixAutoconfExecutor; use SPC\util\executor\UnixAutoconfExecutor;
use SPC\util\SPCTarget;
trait libtiff trait libtiff
{ {
@ -16,7 +18,15 @@ trait libtiff
*/ */
protected function build(): void protected function build(): void
{ {
$libcpp = SPCTarget::getTargetOS() === 'Linux' ? '-lstdc++' : '-lc++';
FileSystem::replaceFileStr($this->source_dir . '/configure', '-lwebp', '-lwebp -lsharpyuv');
FileSystem::replaceFileStr($this->source_dir . '/configure', '-l"$lerc_lib_name"', '-l"$lerc_lib_name" ' . $libcpp);
UnixAutoconfExecutor::create($this) UnixAutoconfExecutor::create($this)
->optionalLib('lerc', '--enable-lerc', '--disable-lerc')
->optionalLib('zstd', '--enable-zstd', '--disable-zstd')
->optionalLib('libwebp', '--enable-webp', '--disable-webp')
->optionalLib('xz', '--enable-lzma', '--disable-lzma')
->optionalLib('jbig', '--enable-jbig', '--disable-jbig')
->configure( ->configure(
// zlib deps // zlib deps
'--enable-zlib', '--enable-zlib',
@ -24,16 +34,15 @@ trait libtiff
"--with-zlib-lib-dir={$this->getLibDir()}", "--with-zlib-lib-dir={$this->getLibDir()}",
// libjpeg deps // libjpeg deps
'--enable-jpeg', '--enable-jpeg',
'--disable-old-jpeg',
'--disable-jpeg12',
"--with-jpeg-include-dir={$this->getIncludeDir()}", "--with-jpeg-include-dir={$this->getIncludeDir()}",
"--with-jpeg-lib-dir={$this->getLibDir()}", "--with-jpeg-lib-dir={$this->getLibDir()}",
// We disabled lzma, zstd, webp, libdeflate by default to reduce the size of the binary '--disable-old-jpeg',
'--disable-lzma', '--disable-jpeg12',
'--disable-zstd',
'--disable-webp',
'--disable-libdeflate', '--disable-libdeflate',
'--disable-tools',
'--disable-contrib',
'--disable-cxx', '--disable-cxx',
'--without-x',
) )
->make(); ->make();
$this->patchPkgconfPrefix(['libtiff-4.pc']); $this->patchPkgconfPrefix(['libtiff-4.pc']);

View File

@ -10,3 +10,4 @@ assert(Imagick::queryFormats('WEBP') !== []);
assert(Imagick::queryFormats('JPEG') !== []); assert(Imagick::queryFormats('JPEG') !== []);
assert(Imagick::queryFormats('PNG') !== []); assert(Imagick::queryFormats('PNG') !== []);
assert(Imagick::queryFormats('TIFF') !== []); assert(Imagick::queryFormats('TIFF') !== []);
assert(Imagick::queryFormats('JXL') !== []);