Skip to content

Commit a98f72c

Browse files
authored
Merge pull request #824 from crazywhalecc/tiff
add Lerc, JBIG and JXL libraries for use in imagick
2 parents c364970 + 9c9ffb6 commit a98f72c

File tree

18 files changed

+291
-48
lines changed

18 files changed

+291
-48
lines changed

.php-cs-fixer.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
return (new PhpCsFixer\Config())
66
->setRiskyAllowed(true)
7+
->setUnsupportedPhpVersionAllowed(true)
78
->setRules([
89
'@PSR12' => true,
910
'@Symfony' => true,

bin/spc-gnu-docker

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ RUN sed -i 's/^#.*baseurl=http/baseurl=http/g' /etc/yum.repos.d/*.repo && \
8686
sed -i 's/^mirrorlist=http/#mirrorlist=http/g' /etc/yum.repos.d/*.repo
8787
8888
RUN yum update -y && \
89-
yum install -y devtoolset-10-gcc-*
89+
yum install -y devtoolset-10-gcc-* devtoolset-10-libatomic-devel
9090
RUN echo "source scl_source enable devtoolset-10" >> /etc/bashrc
9191
RUN source /etc/bashrc
9292
RUN yum install -y which

config/lib.json

Lines changed: 52 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -228,8 +228,9 @@
228228
],
229229
"lib-depends": [
230230
"zlib",
231-
"libpng",
232231
"libjpeg",
232+
"libjxl",
233+
"libpng",
233234
"libwebp",
234235
"freetype",
235236
"libtiff",
@@ -252,6 +253,18 @@
252253
"openssl"
253254
]
254255
},
256+
"jbig": {
257+
"source": "jbig",
258+
"static-libs-unix": [
259+
"libjbig.a",
260+
"libjbig85.a"
261+
],
262+
"headers": [
263+
"jbig.h",
264+
"jbig85.h",
265+
"jbig_ar.h"
266+
]
267+
},
255268
"ldap": {
256269
"source": "ldap",
257270
"static-libs-unix": [
@@ -265,6 +278,13 @@
265278
"libsodium"
266279
]
267280
},
281+
"lerc": {
282+
"source": "lerc",
283+
"static-libs-unix": [
284+
"libLerc.a"
285+
],
286+
"cpp-library": true
287+
},
268288
"libacl": {
269289
"source": "libacl",
270290
"static-libs-unix": [
@@ -400,6 +420,21 @@
400420
"zlib"
401421
]
402422
},
423+
"libjxl": {
424+
"source": "libjxl",
425+
"static-libs-unix": [
426+
"libjxl.a",
427+
"libjxl_cms.a",
428+
"libjxl_threads.a",
429+
"libhwy.a"
430+
],
431+
"lib-depends": [
432+
"brotli",
433+
"libjpeg",
434+
"libpng",
435+
"libwebp"
436+
]
437+
},
403438
"liblz4": {
404439
"source": "liblz4",
405440
"static-libs-unix": [
@@ -485,9 +520,6 @@
485520
],
486521
"lib-depends": [
487522
"openssl"
488-
],
489-
"lib-suggests": [
490-
"zlib"
491523
]
492524
},
493525
"libtiff": {
@@ -498,6 +530,13 @@
498530
"lib-depends": [
499531
"zlib",
500532
"libjpeg"
533+
],
534+
"lib-suggests-unix": [
535+
"lerc",
536+
"libwebp",
537+
"jbig",
538+
"xz",
539+
"zstd"
501540
]
502541
},
503542
"libuuid": {
@@ -813,6 +852,15 @@
813852
"libiconv"
814853
]
815854
},
855+
"watcher": {
856+
"source": "watcher",
857+
"static-libs-unix": [
858+
"libwatcher-c.a"
859+
],
860+
"headers": [
861+
"wtr/watcher-c.h"
862+
]
863+
},
816864
"xz": {
817865
"source": "xz",
818866
"static-libs-unix": [
@@ -866,14 +914,5 @@
866914
"zstd.h",
867915
"zstd_errors.h"
868916
]
869-
},
870-
"watcher": {
871-
"source": "watcher",
872-
"static-libs-unix": [
873-
"libwatcher-c.a"
874-
],
875-
"headers": [
876-
"wtr/watcher-c.h"
877-
]
878917
}
879918
}

config/source.json

Lines changed: 48 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -388,6 +388,19 @@
388388
"path": "LICENSE"
389389
}
390390
},
391+
"jbig": {
392+
"type": "url",
393+
"url": "https://dl.static-php.dev/static-php-cli/deps/jbig/jbigkit-2.1.tar.gz",
394+
"provide-pre-built": true,
395+
"alt": {
396+
"type": "url",
397+
"url": "https://www.cl.cam.ac.uk/~mgk25/jbigkit/download/jbigkit-2.1.tar.gz"
398+
},
399+
"license": {
400+
"type": "file",
401+
"path": "COPYING"
402+
}
403+
},
391404
"ldap": {
392405
"type": "filelist",
393406
"url": "https://www.openldap.org/software/download/OpenLDAP/openldap-release/",
@@ -397,6 +410,16 @@
397410
"path": "LICENSE"
398411
}
399412
},
413+
"lerc": {
414+
"type": "ghtar",
415+
"repo": "Esri/lerc",
416+
"prefer-stable": true,
417+
"provide-pre-built": true,
418+
"license": {
419+
"type": "file",
420+
"path": "LICENSE"
421+
}
422+
},
400423
"libacl": {
401424
"alt": {
402425
"type": "url",
@@ -534,6 +557,21 @@
534557
"path": "LICENSE.md"
535558
}
536559
},
560+
"libjxl": {
561+
"type": "git",
562+
"url": "https://github.com/libjxl/libjxl",
563+
"rev": "main",
564+
"submodules": [
565+
"third_party/highway",
566+
"third_party/libjpeg-turbo",
567+
"third_party/sjpeg",
568+
"third_party/skcms"
569+
],
570+
"license": {
571+
"type": "file",
572+
"path": "LICENSE"
573+
}
574+
},
537575
"liblz4": {
538576
"type": "ghrel",
539577
"repo": "lz4/lz4",
@@ -597,6 +635,7 @@
597635
"repo": "libssh2/libssh2",
598636
"match": "libssh2.+\\.tar\\.gz",
599637
"prefer-stable": true,
638+
"provide-pre-built": true,
600639
"license": {
601640
"type": "file",
602641
"path": "COPYING"
@@ -606,7 +645,6 @@
606645
"type": "filelist",
607646
"url": "https://download.osgeo.org/libtiff/",
608647
"regex": "/href=\"(?<file>tiff-(?<version>[^\"]+)\\.tar\\.xz)\"/",
609-
"provide-pre-built": true,
610648
"license": {
611649
"type": "file",
612650
"path": "LICENSE.md"
@@ -999,6 +1037,15 @@
9991037
"path": "COPYING"
10001038
}
10011039
},
1040+
"watcher": {
1041+
"type": "ghtar",
1042+
"repo": "e-dant/watcher",
1043+
"prefer-stable": true,
1044+
"license": {
1045+
"type": "file",
1046+
"path": "license"
1047+
}
1048+
},
10021049
"xdebug": {
10031050
"type": "url",
10041051
"url": "https://pecl.php.net/get/xdebug",
@@ -1079,14 +1126,5 @@
10791126
"type": "file",
10801127
"path": "LICENSE"
10811128
}
1082-
},
1083-
"watcher": {
1084-
"type": "ghtar",
1085-
"repo": "e-dant/watcher",
1086-
"prefer-stable": true,
1087-
"license": {
1088-
"type": "file",
1089-
"path": "license"
1090-
}
10911129
}
10921130
}

src/SPC/builder/Extension.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
use SPC\store\Config;
1111
use SPC\store\FileSystem;
1212
use SPC\util\SPCConfigUtil;
13-
use SPC\util\SPCTarget;
1413

1514
class Extension
1615
{
@@ -516,8 +515,7 @@ protected function getStaticAndSharedLibs(): array
516515
$sharedLibString = '';
517516
$staticLibString = '';
518517
$staticLibs = $this->getLibFilesString();
519-
$staticLibs = str_replace(BUILD_LIB_PATH . '/lib', '-l', $staticLibs);
520-
$staticLibs = str_replace('.a', '', $staticLibs);
518+
$staticLibs = str_replace([BUILD_LIB_PATH . '/lib', '.a'], ['-l', ''], $staticLibs);
521519
$staticLibs = explode('-l', $staticLibs . ' ' . $config['libs']);
522520
foreach ($staticLibs as $lib) {
523521
$lib = trim($lib);
@@ -533,8 +531,8 @@ protected function getStaticAndSharedLibs(): array
533531
$sharedLibString .= '-l' . $lib . ' ';
534532
}
535533
}
536-
// move static libstdc++ to shared if we are on non-full-static build target
537-
if (!SPCTarget::isStatic() && in_array(SPCTarget::getLibc(), SPCTarget::LIBC_LIST)) {
534+
// move -lstdc++ to static libraries because centos 7 the shared libstdc++ is incomplete
535+
if (str_contains((string) getenv('PATH'), 'rh/devtoolset-10')) {
538536
$staticLibString .= ' -lstdc++';
539537
$sharedLibString = str_replace('-lstdc++', '', $sharedLibString);
540538
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace SPC\builder\linux\library;
6+
7+
class jbig extends LinuxLibraryBase
8+
{
9+
use \SPC\builder\unix\library\jbig;
10+
11+
public const NAME = 'jbig';
12+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace SPC\builder\linux\library;
6+
7+
class lerc extends LinuxLibraryBase
8+
{
9+
use \SPC\builder\unix\library\lerc;
10+
11+
public const NAME = 'lerc';
12+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace SPC\builder\linux\library;
6+
7+
class libjxl extends LinuxLibraryBase
8+
{
9+
use \SPC\builder\unix\library\libjxl;
10+
11+
public const NAME = 'libjxl';
12+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace SPC\builder\macos\library;
6+
7+
class jbig extends MacOSLibraryBase
8+
{
9+
use \SPC\builder\unix\library\jbig;
10+
11+
public const NAME = 'jbig';
12+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace SPC\builder\macos\library;
6+
7+
class lerc extends MacOSLibraryBase
8+
{
9+
use \SPC\builder\unix\library\lerc;
10+
11+
public const NAME = 'lerc';
12+
}

0 commit comments

Comments
 (0)