-
-
Notifications
You must be signed in to change notification settings - Fork 262
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
- Loading branch information
1 parent
d4ec366
commit 192c8cd
Showing
14 changed files
with
303 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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'; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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'; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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'; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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'; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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'; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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']); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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']); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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']); | ||
} | ||
} |
Oops, something went wrong.