-
-
Notifications
You must be signed in to change notification settings - Fork 381
feat: add gmagick extension and GraphicsMagick library support #1090
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 4 commits
ed659cc
b92699c
cd9f898
e837397
0b63d99
a628054
f7b69d9
d023c25
6fef646
d26a081
2006d70
e42b29f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| <?php | ||
|
|
||
| declare(strict_types=1); | ||
|
|
||
| namespace SPC\builder\extension; | ||
|
|
||
| use SPC\builder\Extension; | ||
| use SPC\util\CustomExt; | ||
|
|
||
| #[CustomExt('gmagick')] | ||
| class gmagick extends Extension | ||
| { | ||
| public function getUnixConfigureArg(bool $shared = false): string | ||
| { | ||
| $disable_omp = ' ac_cv_func_omp_pause_resource_all=no'; | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Seems this way is invalid for
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. for php we then have to use php_cv_func_omp_pause_resource_all=no or similar.
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I cannot find any other vars to fix it, unless we patch the original config.m4 (and imagick has the same issue though, but I cannot reproduce this bug)
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'll have a look for the correct syntax. The php CHECK_FUNC also doesn't perform checks when it's disabled just like other direct autoconf checks.
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The check is not cached, that's why it doesn't care. Just terrible gmagick config.m4... |
||
| return '--with-gmagick=' . ($shared ? 'shared,' : '') . BUILD_ROOT_PATH . $disable_omp; | ||
| } | ||
| } | ||
| 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 graphicsmagick extends LinuxLibraryBase | ||
| { | ||
| use \SPC\builder\unix\library\graphicsmagick; | ||
|
|
||
| public const NAME = 'graphicsmagick'; | ||
| } |
| 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 graphicsmagick extends MacOSLibraryBase | ||
| { | ||
| use \SPC\builder\unix\library\graphicsmagick; | ||
|
|
||
| public const NAME = 'graphicsmagick'; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| <?php | ||
|
|
||
| declare(strict_types=1); | ||
|
|
||
| namespace SPC\builder\unix\library; | ||
|
|
||
| use SPC\util\executor\UnixAutoconfExecutor; | ||
| use SPC\util\SPCTarget; | ||
|
|
||
| trait graphicsmagick | ||
| { | ||
| protected function build(): void | ||
| { | ||
| $ac = UnixAutoconfExecutor::create($this) | ||
| ->optionalLib('zlib', ...ac_with_args('zlib')) | ||
| ->optionalLib('libpng', ...ac_with_args('png')) | ||
| ->optionalLib('libjpeg', ...ac_with_args('jpeg')) | ||
| ->optionalLib('libwebp', ...ac_with_args('webp')) | ||
| ->optionalLib('libtiff', ...ac_with_args('tiff')) | ||
| ->optionalLib('freetype', ...ac_with_args('ttf')) | ||
| ->optionalLib('bzip2', ...ac_with_args('bzlib')) | ||
| ->addConfigureArgs( | ||
| '--disable-openmp', | ||
| '--without-x', | ||
| '--without-perl', | ||
| '--enable-shared=no', | ||
| '--enable-static=yes', | ||
| ); | ||
|
|
||
| // special: linux-static target needs `-static` | ||
| $ldflags = SPCTarget::isStatic() ? '-static -ldl' : '-ldl'; | ||
|
|
||
| // special: macOS needs -liconv | ||
| $libs = SPCTarget::getTargetOS() === 'Darwin' ? '-liconv' : ''; | ||
|
|
||
| $ac->appendEnv([ | ||
| 'LDFLAGS' => $ldflags, | ||
| 'LIBS' => $libs, | ||
| 'PKG_CONFIG' => '$PKG_CONFIG --static', | ||
| ]); | ||
|
|
||
| $ac->configure()->make(); | ||
|
|
||
| $this->patchPkgconfPrefix(['GraphicsMagick.pc', 'GraphicsMagick++.pc', 'GraphicsMagickWand.pc']); | ||
| $this->patchLaDependencyPrefix(); | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| <?php | ||
|
|
||
| declare(strict_types=1); | ||
|
|
||
| assert(class_exists('Gmagick')); | ||
| assert(in_array('JPEG', (new Gmagick())->queryformats())); | ||
| assert(in_array('PNG', (new Gmagick())->queryformats())); |
Uh oh!
There was an error while loading. Please reload this page.