Add ext-gd

This commit is contained in:
crazywhalecc
2026-03-09 15:55:01 +08:00
parent 38715bba21
commit 61d50cd28b
2 changed files with 39 additions and 0 deletions

View File

@@ -0,0 +1,26 @@
<?php
declare(strict_types=1);
namespace Package\Extension;
use StaticPHP\Attribute\Package\CustomPhpConfigureArg;
use StaticPHP\Attribute\Package\Extension;
use StaticPHP\Package\PackageInstaller;
use StaticPHP\Package\PhpExtensionPackage;
#[Extension('gd')]
class gd extends PhpExtensionPackage
{
#[CustomPhpConfigureArg('Darwin')]
#[CustomPhpConfigureArg('Linux')]
public function getUnixConfigureArg(bool $shared, PackageInstaller $installer): string
{
$arg = '--enable-gd' . ($shared ? '=shared' : '');
$arg .= $installer->getLibraryPackage('freetype') ? ' --with-freetype' : '';
$arg .= $installer->getLibraryPackage('libjpeg') ? ' --with-jpeg' : '';
$arg .= $installer->getLibraryPackage('libwebp') ? ' --with-webp' : '';
$arg .= $installer->getLibraryPackage('libavif') ? ' --with-avif' : '';
return $arg;
}
}