mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-07-02 14:25:41 +08:00
fix libheif (#1153)
This commit is contained in:
@@ -11,15 +11,28 @@ trait libheif
|
||||
{
|
||||
public function patchBeforeBuild(): bool
|
||||
{
|
||||
$patched = false;
|
||||
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;
|
||||
$patched = true;
|
||||
}
|
||||
return false;
|
||||
// libheif 1.22+ ships a C-incompatible header: `struct heif_bad_pixel`
|
||||
$heif_properties = $this->source_dir . '/libheif/api/libheif/heif_properties.h';
|
||||
if (file_exists($heif_properties)
|
||||
&& str_contains(file_get_contents($heif_properties), 'struct heif_bad_pixel { uint32_t row; uint32_t column; };')
|
||||
) {
|
||||
FileSystem::replaceFileStr(
|
||||
$heif_properties,
|
||||
'struct heif_bad_pixel { uint32_t row; uint32_t column; };',
|
||||
'typedef struct heif_bad_pixel { uint32_t row; uint32_t column; } heif_bad_pixel;'
|
||||
);
|
||||
$patched = true;
|
||||
}
|
||||
return $patched;
|
||||
}
|
||||
|
||||
protected function build(): void
|
||||
|
||||
Reference in New Issue
Block a user