forked from crazywhalecc/static-php-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgraphicsmagick.php
More file actions
47 lines (38 loc) · 1.46 KB
/
graphicsmagick.php
File metadata and controls
47 lines (38 loc) · 1.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
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();
}
}