Skip to content
Closed
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions config/ext.json
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,18 @@
],
"lib-depends-windows": []
},
"gmagick": {
"support": {
"Windows": "wip",
"BSD": "wip"
},
"type": "external",
"source": "ext-gmagick",
"arg-type": "custom",
"lib-depends": [
"graphicsmagick"
]
},
"gmp": {
"support": {
"Windows": "wip",
Expand Down
20 changes: 20 additions & 0 deletions config/lib.json
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,26 @@
"Security"
]
},
"graphicsmagick": {
"source": "graphicsmagick",
"pkg-configs": [
"GraphicsMagick",
"GraphicsMagickWand"
],
"lib-depends": [
"zlib",
"libpng",
"libjpeg",
"bzip2"
],
"lib-suggests": [
"libwebp",
"libtiff",
"freetype",
"zstd",
"xz"
]
},
"grpc": {
"source": "grpc",
"pkg-configs": [
Expand Down
18 changes: 18 additions & 0 deletions config/source.json
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,16 @@
"path": "LICENSE"
}
},
"ext-gmagick": {
"type": "url",
"url": "https://pecl.php.net/get/gmagick",
"path": "php-src/ext/gmagick",
"filename": "gmagick.tgz",
"license": {
"type": "file",
"path": "LICENSE"
}
},
"ext-gmssl": {
"type": "ghtar",
"repo": "gmssl/GmSSL-PHP",
Expand Down Expand Up @@ -382,6 +392,14 @@
"path": "LICENSE"
}
},
"graphicsmagick": {
"type": "url",
"url": "https://downloads.sourceforge.net/project/graphicsmagick/graphicsmagick/1.3.45/GraphicsMagick-1.3.45.tar.xz",
Comment thread
henderkes marked this conversation as resolved.
Outdated
"license": {
"type": "file",
"path": "Copyright.txt"
}
},
"grpc": {
"type": "git",
"rev": "v1.75.x",
Expand Down
18 changes: 18 additions & 0 deletions src/SPC/builder/extension/gmagick.php
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';
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems this way is invalid for PHP_CHECK_FUNC (gmagick used). Previously we use this for AC_CHECK_FUNC and it's working.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The 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.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The 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)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The 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.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The 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;
}
}
12 changes: 12 additions & 0 deletions src/SPC/builder/linux/library/graphicsmagick.php
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';
}
12 changes: 12 additions & 0 deletions src/SPC/builder/macos/library/graphicsmagick.php
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';
}
47 changes: 47 additions & 0 deletions src/SPC/builder/unix/library/graphicsmagick.php
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();
}
}
7 changes: 7 additions & 0 deletions src/globals/ext-tests/gmagick.php
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()));
Loading