mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-03-17 20:34:51 +08:00
add imagick for linux
This commit is contained in:
parent
db3728bc00
commit
125556b73b
@ -27,7 +27,7 @@
|
||||
| gettext | | | |
|
||||
| gmp | yes | yes | |
|
||||
| iconv | yes | yes | |
|
||||
| imagick | | yes | |
|
||||
| imagick | yes | yes | |
|
||||
| inotify | yes | yes | |
|
||||
| mbstring | yes | yes | |
|
||||
| mbregex | yes | yes | |
|
||||
|
||||
15
src/SPC/builder/linux/library/imagemagick.php
Normal file
15
src/SPC/builder/linux/library/imagemagick.php
Normal file
@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace SPC\builder\linux\library;
|
||||
|
||||
/**
|
||||
* a template library class for unix
|
||||
*/
|
||||
class imagemagick extends LinuxLibraryBase
|
||||
{
|
||||
use \SPC\builder\unix\library\imagemagick;
|
||||
|
||||
public const NAME = 'imagemagick';
|
||||
}
|
||||
@ -4,57 +4,12 @@ declare(strict_types=1);
|
||||
|
||||
namespace SPC\builder\macos\library;
|
||||
|
||||
use SPC\store\FileSystem;
|
||||
|
||||
/**
|
||||
* gmp is a template library class for unix
|
||||
*/
|
||||
class imagemagick extends MacOSLibraryBase
|
||||
{
|
||||
use \SPC\builder\unix\library\imagemagick;
|
||||
|
||||
public const NAME = 'imagemagick';
|
||||
|
||||
protected function build(): void
|
||||
{
|
||||
$extra = '--without-jxl --without-xml --without-zstd --without-x ';
|
||||
// jpeg support
|
||||
$extra .= $this->builder->getLib('libjpeg') ? '--with-jpeg ' : '';
|
||||
// png support
|
||||
$extra .= $this->builder->getLib('libpng') ? '--with-png ' : '';
|
||||
// webp support
|
||||
$extra .= $this->builder->getLib('libwebp') ? '--with-webp ' : '';
|
||||
// zstd support
|
||||
// $extra .= $this->builder->getLib('zstd') ? '--with-zstd ' : '--without-zstd ';
|
||||
// freetype support
|
||||
$extra .= $this->builder->getLib('freetype') ? '--with-freetype ' : '--without-freetype ';
|
||||
|
||||
shell()->cd($this->source_dir)
|
||||
->exec(
|
||||
"{$this->builder->configure_env} ./configure " .
|
||||
'--enable-static --disable-shared ' .
|
||||
$extra .
|
||||
'--prefix='
|
||||
)
|
||||
->exec('make clean')
|
||||
->exec("make -j{$this->builder->concurrency}")
|
||||
->exec('make install DESTDIR=' . BUILD_ROOT_PATH);
|
||||
$filelist = [
|
||||
'ImageMagick.pc',
|
||||
'ImageMagick-7.Q16HDRI.pc',
|
||||
'Magick++.pc',
|
||||
'Magick++-7.Q16HDRI.pc',
|
||||
'MagickCore.pc',
|
||||
'MagickCore-7.Q16HDRI.pc',
|
||||
'MagickWand.pc',
|
||||
'MagickWand-7.Q16HDRI.pc',
|
||||
];
|
||||
$this->patchPkgconfPrefix($filelist);
|
||||
foreach ($filelist as $file) {
|
||||
FileSystem::replaceFile(
|
||||
BUILD_LIB_PATH . '/pkgconfig/' . $file,
|
||||
REPLACE_FILE_PREG,
|
||||
'#includearchdir=/include/ImageMagick-7#m',
|
||||
'includearchdir=${prefix}/include/ImageMagick-7'
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
57
src/SPC/builder/unix/library/imagemagick.php
Normal file
57
src/SPC/builder/unix/library/imagemagick.php
Normal file
@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace SPC\builder\unix\library;
|
||||
|
||||
use SPC\store\FileSystem;
|
||||
|
||||
trait imagemagick
|
||||
{
|
||||
protected function build(): void
|
||||
{
|
||||
$extra = '--without-jxl --without-xml --without-zstd --without-x --disable-openmp ';
|
||||
// libzip support
|
||||
$extra .= $this->builder->getLib('libzip') ? '--with-zip ' : '--without-zip ';
|
||||
// jpeg support
|
||||
$extra .= $this->builder->getLib('libjpeg') ? '--with-jpeg ' : '';
|
||||
// png support
|
||||
$extra .= $this->builder->getLib('libpng') ? '--with-png ' : '';
|
||||
// webp support
|
||||
$extra .= $this->builder->getLib('libwebp') ? '--with-webp ' : '';
|
||||
// zstd support
|
||||
// $extra .= $this->builder->getLib('zstd') ? '--with-zstd ' : '--without-zstd ';
|
||||
// freetype support
|
||||
$extra .= $this->builder->getLib('freetype') ? '--with-freetype ' : '--without-freetype ';
|
||||
|
||||
shell()->cd($this->source_dir)
|
||||
->exec(
|
||||
"{$this->builder->configure_env} ./configure " .
|
||||
'--enable-static --disable-shared ' .
|
||||
$extra .
|
||||
'--prefix='
|
||||
)
|
||||
->exec('make clean')
|
||||
->exec("make -j{$this->builder->concurrency}")
|
||||
->exec('make install DESTDIR=' . BUILD_ROOT_PATH);
|
||||
$filelist = [
|
||||
'ImageMagick.pc',
|
||||
'ImageMagick-7.Q16HDRI.pc',
|
||||
'Magick++.pc',
|
||||
'Magick++-7.Q16HDRI.pc',
|
||||
'MagickCore.pc',
|
||||
'MagickCore-7.Q16HDRI.pc',
|
||||
'MagickWand.pc',
|
||||
'MagickWand-7.Q16HDRI.pc',
|
||||
];
|
||||
$this->patchPkgconfPrefix($filelist);
|
||||
foreach ($filelist as $file) {
|
||||
FileSystem::replaceFile(
|
||||
BUILD_LIB_PATH . '/pkgconfig/' . $file,
|
||||
REPLACE_FILE_PREG,
|
||||
'#includearchdir=/include/ImageMagick-7#m',
|
||||
'includearchdir=${prefix}/include/ImageMagick-7'
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user