mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-03-19 05:14:52 +08:00
Add libaom, libde265, libheif support, for imagick AVIF format support (#575)
* Add libaom, libde265, libheif support, for imagick AVIF format support * Fix aom optimization * Fix aom build command * Fix libheif build command * Fix libheif build * cs fix
This commit is contained in:
parent
d4ec366c5f
commit
192c8cde87
@ -560,6 +560,19 @@
|
|||||||
"source": "rar",
|
"source": "rar",
|
||||||
"cpp-extension": true
|
"cpp-extension": true
|
||||||
},
|
},
|
||||||
|
"rdkafka": {
|
||||||
|
"support": {
|
||||||
|
"BSD": "wip",
|
||||||
|
"Windows": "wip"
|
||||||
|
},
|
||||||
|
"type": "external",
|
||||||
|
"source": "ext-rdkafka",
|
||||||
|
"arg-type": "custom",
|
||||||
|
"cpp-extension": true,
|
||||||
|
"lib-depends": [
|
||||||
|
"librdkafka"
|
||||||
|
]
|
||||||
|
},
|
||||||
"readline": {
|
"readline": {
|
||||||
"support": {
|
"support": {
|
||||||
"Windows": "wip",
|
"Windows": "wip",
|
||||||
@ -708,19 +721,6 @@
|
|||||||
"zlib"
|
"zlib"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"rdkafka": {
|
|
||||||
"support": {
|
|
||||||
"BSD": "wip",
|
|
||||||
"Windows": "wip"
|
|
||||||
},
|
|
||||||
"type": "external",
|
|
||||||
"source": "ext-rdkafka",
|
|
||||||
"arg-type": "custom",
|
|
||||||
"cpp-extension": true,
|
|
||||||
"lib-depends": [
|
|
||||||
"librdkafka"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"swoole": {
|
"swoole": {
|
||||||
"support": {
|
"support": {
|
||||||
"Windows": "no",
|
"Windows": "no",
|
||||||
|
|||||||
@ -176,7 +176,8 @@
|
|||||||
"libjpeg",
|
"libjpeg",
|
||||||
"libwebp",
|
"libwebp",
|
||||||
"freetype",
|
"freetype",
|
||||||
"libtiff"
|
"libtiff",
|
||||||
|
"libheif"
|
||||||
],
|
],
|
||||||
"lib-suggests": [
|
"lib-suggests": [
|
||||||
"zstd",
|
"zstd",
|
||||||
@ -208,6 +209,13 @@
|
|||||||
"libsodium"
|
"libsodium"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"libaom": {
|
||||||
|
"source": "libaom",
|
||||||
|
"static-libs-unix": [
|
||||||
|
"libaom.a"
|
||||||
|
],
|
||||||
|
"cpp-library": true
|
||||||
|
},
|
||||||
"libargon2": {
|
"libargon2": {
|
||||||
"source": "libargon2",
|
"source": "libargon2",
|
||||||
"static-libs-unix": [
|
"static-libs-unix": [
|
||||||
@ -235,6 +243,13 @@
|
|||||||
"ares_rules.h"
|
"ares_rules.h"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"libde265": {
|
||||||
|
"source": "libde265",
|
||||||
|
"static-libs-unix": [
|
||||||
|
"libde265.a"
|
||||||
|
],
|
||||||
|
"cpp-library": true
|
||||||
|
},
|
||||||
"libevent": {
|
"libevent": {
|
||||||
"source": "libevent",
|
"source": "libevent",
|
||||||
"static-libs-unix": [
|
"static-libs-unix": [
|
||||||
@ -276,6 +291,19 @@
|
|||||||
"fficonfig.h"
|
"fficonfig.h"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"libheif": {
|
||||||
|
"source": "libheif",
|
||||||
|
"static-libs-unix": [
|
||||||
|
"libheif.a"
|
||||||
|
],
|
||||||
|
"lib-depends": [
|
||||||
|
"libde265",
|
||||||
|
"libwebp",
|
||||||
|
"libaom",
|
||||||
|
"zlib",
|
||||||
|
"brotli"
|
||||||
|
]
|
||||||
|
},
|
||||||
"libiconv": {
|
"libiconv": {
|
||||||
"source": "libiconv",
|
"source": "libiconv",
|
||||||
"static-libs-unix": [
|
"static-libs-unix": [
|
||||||
@ -355,6 +383,18 @@
|
|||||||
"openssl"
|
"openssl"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"librdkafka": {
|
||||||
|
"source": "librdkafka",
|
||||||
|
"static-libs-unix": [
|
||||||
|
"librdkafka.a",
|
||||||
|
"librdkafka++.a",
|
||||||
|
"librdkafka-static.a"
|
||||||
|
],
|
||||||
|
"cpp-library": true,
|
||||||
|
"lib-suggests": [
|
||||||
|
"zstd"
|
||||||
|
]
|
||||||
|
},
|
||||||
"libsodium": {
|
"libsodium": {
|
||||||
"source": "libsodium",
|
"source": "libsodium",
|
||||||
"static-libs-unix": [
|
"static-libs-unix": [
|
||||||
@ -558,18 +598,6 @@
|
|||||||
"pkg-config": {
|
"pkg-config": {
|
||||||
"source": "pkg-config"
|
"source": "pkg-config"
|
||||||
},
|
},
|
||||||
"librdkafka": {
|
|
||||||
"source": "librdkafka",
|
|
||||||
"static-libs-unix": [
|
|
||||||
"librdkafka.a",
|
|
||||||
"librdkafka++.a",
|
|
||||||
"librdkafka-static.a"
|
|
||||||
],
|
|
||||||
"cpp-library": true,
|
|
||||||
"lib-suggests": [
|
|
||||||
"zstd"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"postgresql": {
|
"postgresql": {
|
||||||
"source": "postgresql",
|
"source": "postgresql",
|
||||||
"static-libs-unix": [
|
"static-libs-unix": [
|
||||||
|
|||||||
@ -303,6 +303,16 @@
|
|||||||
"path": "LICENSE"
|
"path": "LICENSE"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"libaom": {
|
||||||
|
"type": "git",
|
||||||
|
"rev": "main",
|
||||||
|
"url": "https://aomedia.googlesource.com/aom",
|
||||||
|
"provide-pre-built": true,
|
||||||
|
"license": {
|
||||||
|
"type": "file",
|
||||||
|
"path": "LICENSE"
|
||||||
|
}
|
||||||
|
},
|
||||||
"libargon2": {
|
"libargon2": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"rev": "master",
|
"rev": "master",
|
||||||
@ -338,6 +348,17 @@
|
|||||||
"path": "LICENSE.md"
|
"path": "LICENSE.md"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"libde265": {
|
||||||
|
"type": "ghrel",
|
||||||
|
"repo": "strukturag/libde265",
|
||||||
|
"match": "libde265-.+\\.tar\\.gz",
|
||||||
|
"prefer-stable": true,
|
||||||
|
"provide-pre-built": true,
|
||||||
|
"license": {
|
||||||
|
"type": "file",
|
||||||
|
"path": "COPYING"
|
||||||
|
}
|
||||||
|
},
|
||||||
"libevent": {
|
"libevent": {
|
||||||
"type": "ghrel",
|
"type": "ghrel",
|
||||||
"repo": "libevent/libevent",
|
"repo": "libevent/libevent",
|
||||||
@ -368,6 +389,17 @@
|
|||||||
"path": "LICENSE"
|
"path": "LICENSE"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"libheif": {
|
||||||
|
"type": "ghrel",
|
||||||
|
"repo": "strukturag/libheif",
|
||||||
|
"match": "libheif-.+\\.tar\\.gz",
|
||||||
|
"prefer-stable": true,
|
||||||
|
"provide-pre-built": true,
|
||||||
|
"license": {
|
||||||
|
"type": "file",
|
||||||
|
"path": "COPYING"
|
||||||
|
}
|
||||||
|
},
|
||||||
"libiconv": {
|
"libiconv": {
|
||||||
"type": "filelist",
|
"type": "filelist",
|
||||||
"url": "https://ftp.gnu.org/gnu/libiconv/",
|
"url": "https://ftp.gnu.org/gnu/libiconv/",
|
||||||
|
|||||||
12
src/SPC/builder/linux/library/libaom.php
Normal file
12
src/SPC/builder/linux/library/libaom.php
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace SPC\builder\linux\library;
|
||||||
|
|
||||||
|
class libaom extends LinuxLibraryBase
|
||||||
|
{
|
||||||
|
use \SPC\builder\unix\library\libaom;
|
||||||
|
|
||||||
|
public const NAME = 'libaom';
|
||||||
|
}
|
||||||
12
src/SPC/builder/linux/library/libde265.php
Normal file
12
src/SPC/builder/linux/library/libde265.php
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace SPC\builder\linux\library;
|
||||||
|
|
||||||
|
class libde265 extends LinuxLibraryBase
|
||||||
|
{
|
||||||
|
use \SPC\builder\unix\library\libde265;
|
||||||
|
|
||||||
|
public const NAME = 'libde265';
|
||||||
|
}
|
||||||
12
src/SPC/builder/linux/library/libheif.php
Normal file
12
src/SPC/builder/linux/library/libheif.php
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace SPC\builder\linux\library;
|
||||||
|
|
||||||
|
class libheif extends LinuxLibraryBase
|
||||||
|
{
|
||||||
|
use \SPC\builder\unix\library\libheif;
|
||||||
|
|
||||||
|
public const NAME = 'libheif';
|
||||||
|
}
|
||||||
12
src/SPC/builder/macos/library/libaom.php
Normal file
12
src/SPC/builder/macos/library/libaom.php
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace SPC\builder\macos\library;
|
||||||
|
|
||||||
|
class libaom extends MacOSLibraryBase
|
||||||
|
{
|
||||||
|
use \SPC\builder\unix\library\libaom;
|
||||||
|
|
||||||
|
public const NAME = 'libaom';
|
||||||
|
}
|
||||||
12
src/SPC/builder/macos/library/libde265.php
Normal file
12
src/SPC/builder/macos/library/libde265.php
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace SPC\builder\macos\library;
|
||||||
|
|
||||||
|
class libde265 extends MacOSLibraryBase
|
||||||
|
{
|
||||||
|
use \SPC\builder\unix\library\libde265;
|
||||||
|
|
||||||
|
public const NAME = 'libde265';
|
||||||
|
}
|
||||||
27
src/SPC/builder/macos/library/libheif.php
Normal file
27
src/SPC/builder/macos/library/libheif.php
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace SPC\builder\macos\library;
|
||||||
|
|
||||||
|
use SPC\store\FileSystem;
|
||||||
|
|
||||||
|
class libheif extends MacOSLibraryBase
|
||||||
|
{
|
||||||
|
use \SPC\builder\unix\library\libheif;
|
||||||
|
|
||||||
|
public const NAME = 'libheif';
|
||||||
|
|
||||||
|
public function patchBeforeBuild(): bool
|
||||||
|
{
|
||||||
|
if (!str_contains(file_get_contents($this->source_dir . '/CMakeLists.txt'), 'libbrotlienc')) {
|
||||||
|
FileSystem::replaceFileStr(
|
||||||
|
$this->source_dir . '/CMakeLists.txt',
|
||||||
|
'list(APPEND REQUIRES_PRIVATE "libbrotlidec")',
|
||||||
|
'list(APPEND REQUIRES_PRIVATE "libbrotlidec")' . "\n" . ' list(APPEND REQUIRES_PRIVATE "libbrotlienc")'
|
||||||
|
);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
36
src/SPC/builder/unix/library/libaom.php
Normal file
36
src/SPC/builder/unix/library/libaom.php
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace SPC\builder\unix\library;
|
||||||
|
|
||||||
|
use SPC\exception\FileSystemException;
|
||||||
|
use SPC\exception\RuntimeException;
|
||||||
|
use SPC\store\FileSystem;
|
||||||
|
|
||||||
|
trait libaom
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @throws RuntimeException
|
||||||
|
* @throws FileSystemException
|
||||||
|
*/
|
||||||
|
protected function build(): void
|
||||||
|
{
|
||||||
|
// CMake needs a clean build directory
|
||||||
|
FileSystem::resetDir($this->source_dir . '/builddir');
|
||||||
|
// Start build
|
||||||
|
shell()->cd($this->source_dir . '/builddir')
|
||||||
|
->exec(
|
||||||
|
'cmake ' .
|
||||||
|
'-DCMAKE_INSTALL_PREFIX=' . BUILD_ROOT_PATH . ' ' .
|
||||||
|
"-DCMAKE_TOOLCHAIN_FILE={$this->builder->cmake_toolchain_file} " .
|
||||||
|
'-DCMAKE_BUILD_TYPE=Release ' .
|
||||||
|
'-DBUILD_SHARED_LIBS=OFF ' .
|
||||||
|
'-DAOM_TARGET_CPU=generic ' .
|
||||||
|
'..'
|
||||||
|
)
|
||||||
|
->exec("cmake --build . -j {$this->builder->concurrency}")
|
||||||
|
->exec('make install');
|
||||||
|
$this->patchPkgconfPrefix(['aom.pc']);
|
||||||
|
}
|
||||||
|
}
|
||||||
36
src/SPC/builder/unix/library/libde265.php
Normal file
36
src/SPC/builder/unix/library/libde265.php
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace SPC\builder\unix\library;
|
||||||
|
|
||||||
|
use SPC\exception\FileSystemException;
|
||||||
|
use SPC\exception\RuntimeException;
|
||||||
|
use SPC\store\FileSystem;
|
||||||
|
|
||||||
|
trait libde265
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @throws RuntimeException
|
||||||
|
* @throws FileSystemException
|
||||||
|
*/
|
||||||
|
protected function build(): void
|
||||||
|
{
|
||||||
|
// CMake needs a clean build directory
|
||||||
|
FileSystem::resetDir($this->source_dir . '/build');
|
||||||
|
// Start build
|
||||||
|
shell()->cd($this->source_dir . '/build')
|
||||||
|
->exec(
|
||||||
|
'cmake ' .
|
||||||
|
'-DCMAKE_INSTALL_PREFIX=' . BUILD_ROOT_PATH . ' ' .
|
||||||
|
"-DCMAKE_TOOLCHAIN_FILE={$this->builder->cmake_toolchain_file} " .
|
||||||
|
'-DCMAKE_BUILD_TYPE=Release ' .
|
||||||
|
'-DBUILD_SHARED_LIBS=OFF ' .
|
||||||
|
'-DENABLE_SDL=OFF ' . // Disable SDL, currently not supported
|
||||||
|
'..'
|
||||||
|
)
|
||||||
|
->exec("cmake --build . -j {$this->builder->concurrency}")
|
||||||
|
->exec('make install');
|
||||||
|
$this->patchPkgconfPrefix(['libde265.pc']);
|
||||||
|
}
|
||||||
|
}
|
||||||
41
src/SPC/builder/unix/library/libheif.php
Normal file
41
src/SPC/builder/unix/library/libheif.php
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace SPC\builder\unix\library;
|
||||||
|
|
||||||
|
use SPC\exception\FileSystemException;
|
||||||
|
use SPC\exception\RuntimeException;
|
||||||
|
use SPC\store\FileSystem;
|
||||||
|
|
||||||
|
trait libheif
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @throws RuntimeException
|
||||||
|
* @throws FileSystemException
|
||||||
|
*/
|
||||||
|
protected function build(): void
|
||||||
|
{
|
||||||
|
// CMake needs a clean build directory
|
||||||
|
FileSystem::resetDir($this->source_dir . '/build');
|
||||||
|
// Start build
|
||||||
|
shell()->cd($this->source_dir . '/build')
|
||||||
|
->exec(
|
||||||
|
'cmake ' .
|
||||||
|
'--preset=release ' .
|
||||||
|
'-DCMAKE_INSTALL_PREFIX=' . BUILD_ROOT_PATH . ' ' .
|
||||||
|
"-DCMAKE_TOOLCHAIN_FILE={$this->builder->cmake_toolchain_file} " .
|
||||||
|
'-DCMAKE_BUILD_TYPE=Release ' .
|
||||||
|
'-DBUILD_SHARED_LIBS=OFF ' .
|
||||||
|
'-DWITH_EXAMPLES=OFF ' .
|
||||||
|
'-DWITH_GDK_PIXBUF=OFF ' .
|
||||||
|
'-DBUILD_TESTING=OFF ' .
|
||||||
|
'-DWITH_LIBSHARPYUV=ON ' . // optional: libwebp
|
||||||
|
'-DENABLE_PLUGIN_LOADING=OFF ' .
|
||||||
|
'..'
|
||||||
|
)
|
||||||
|
->exec("cmake --build . -j {$this->builder->concurrency}")
|
||||||
|
->exec('make install');
|
||||||
|
$this->patchPkgconfPrefix(['libheif.pc']);
|
||||||
|
}
|
||||||
|
}
|
||||||
12
src/globals/ext-tests/imagick.php
Normal file
12
src/globals/ext-tests/imagick.php
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
assert(class_exists('Imagick'));
|
||||||
|
assert(Imagick::queryFormats('AVIF') !== []);
|
||||||
|
assert(Imagick::queryFormats('HEIF') !== []);
|
||||||
|
assert(Imagick::queryFormats('HEIC') !== []);
|
||||||
|
assert(Imagick::queryFormats('WEBP') !== []);
|
||||||
|
assert(Imagick::queryFormats('JPEG') !== []);
|
||||||
|
assert(Imagick::queryFormats('PNG') !== []);
|
||||||
|
assert(Imagick::queryFormats('TIFF') !== []);
|
||||||
@ -21,9 +21,9 @@ $test_php_version = [
|
|||||||
|
|
||||||
// test os (macos-13, macos-14, ubuntu-latest, windows-latest are available)
|
// test os (macos-13, macos-14, ubuntu-latest, windows-latest are available)
|
||||||
$test_os = [
|
$test_os = [
|
||||||
// 'macos-14',
|
'macos-14',
|
||||||
'macos-13',
|
// 'macos-13',
|
||||||
// 'ubuntu-latest',
|
'ubuntu-latest',
|
||||||
];
|
];
|
||||||
|
|
||||||
// whether enable thread safe
|
// whether enable thread safe
|
||||||
@ -39,7 +39,7 @@ $prefer_pre_built = true;
|
|||||||
|
|
||||||
// If you want to test your added extensions and libs, add below (comma separated, example `bcmath,openssl`).
|
// If you want to test your added extensions and libs, add below (comma separated, example `bcmath,openssl`).
|
||||||
$extensions = match (PHP_OS_FAMILY) {
|
$extensions = match (PHP_OS_FAMILY) {
|
||||||
'Linux', 'Darwin' => 'rdkafka',
|
'Linux', 'Darwin' => 'imagick',
|
||||||
'Windows' => 'zlib',
|
'Windows' => 'zlib',
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -53,7 +53,7 @@ $with_libs = match (PHP_OS_FAMILY) {
|
|||||||
// You can use `common`, `bulk`, `minimal` or `none`.
|
// You can use `common`, `bulk`, `minimal` or `none`.
|
||||||
// note: combination is only available for *nix platform. Windows must use `none` combination
|
// note: combination is only available for *nix platform. Windows must use `none` combination
|
||||||
$base_combination = match (PHP_OS_FAMILY) {
|
$base_combination = match (PHP_OS_FAMILY) {
|
||||||
'Linux', 'Darwin' => 'bulk',
|
'Linux', 'Darwin' => 'minimal',
|
||||||
'Windows' => 'none',
|
'Windows' => 'none',
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user