Fix imagick patch newer than 30800 (#641)

This commit is contained in:
Jerry Ma 2025-03-14 10:57:33 +08:00 committed by GitHub
parent 2681a88488
commit 39a66daf04
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 17 additions and 4 deletions

View File

@ -411,8 +411,21 @@ class SourcePatcher
*/
public static function patchImagickWith84(): bool
{
SourcePatcher::patchFile('imagick_php84.patch', SOURCE_PATH . '/php-src/ext/imagick');
return true;
// match imagick version id
$file = SOURCE_PATH . '/php-src/ext/imagick/php_imagick.h';
if (!file_exists($file)) {
return false;
}
$content = file_get_contents($file);
if (preg_match('/#define PHP_IMAGICK_EXTNUM\s+(\d+)/', $content, $match) === 0) {
return false;
}
$extnum = intval($match[1]);
if ($extnum < 30800) {
SourcePatcher::patchFile('imagick_php84_before_30800.patch', SOURCE_PATH . '/php-src/ext/imagick');
return true;
}
return false;
}
public static function patchLibaomForAlpine(): bool

View File

@ -40,8 +40,8 @@ $prefer_pre_built = false;
// If you want to test your added extensions and libs, add below (comma separated, example `bcmath,openssl`).
$extensions = match (PHP_OS_FAMILY) {
'Linux', 'Darwin' => 'openssl,gmssl',
'Windows' => 'gettext',
'Linux', 'Darwin' => 'imagick',
'Windows' => 'bcmath',
};
// If you want to test lib-suggests feature with extension, add them below (comma separated, example `libwebp,libavif`).