Skip to content

Commit 52862a3

Browse files
committed
fix libtiff libs being defined after configure
1 parent ff092b4 commit 52862a3

File tree

4 files changed

+35
-12
lines changed

4 files changed

+35
-12
lines changed

config/lib.json

Lines changed: 6 additions & 5 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",
@@ -240,8 +241,7 @@
240241
"zstd",
241242
"xz",
242243
"libzip",
243-
"libxml2",
244-
"libjxl"
244+
"libxml2"
245245
]
246246
},
247247
"imap": {
@@ -424,11 +424,12 @@
424424
"source": "libjxl",
425425
"static-libs-unix": [
426426
"libjxl.a",
427-
"libjxl_dec.a"
427+
"libjxl_dec.a",
428+
"libjxl_threads.a",
429+
"libhwy.a"
428430
],
429431
"lib-depends": [
430432
"brotli",
431-
"libgif",
432433
"libjpeg",
433434
"libpng",
434435
"libwebp"

config/source.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -390,8 +390,12 @@
390390
},
391391
"jbig": {
392392
"type": "url",
393-
"url": "https://www.cl.cam.ac.uk/~mgk25/jbigkit/download/jbigkit-2.1.tar.gz",
393+
"url": "https://dl.static-php.dev/static-php-cli/deps/jbig/jbigkit-2.1.tar.gz",
394394
"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+
},
395399
"license": {
396400
"type": "file",
397401
"path": "COPYING"

src/SPC/builder/unix/library/libjxl.php

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,28 @@
44

55
namespace SPC\builder\unix\library;
66

7+
use SPC\store\FileSystem;
78
use SPC\util\executor\UnixCMakeExecutor;
9+
use SPC\util\SPCTarget;
810

911
trait libjxl
1012
{
13+
public function patchBeforeBuild(): bool
14+
{
15+
$depsContent = file_get_contents($this->source_dir . '/deps.sh');
16+
if (str_contains($depsContent, '# return 0')) {
17+
return false;
18+
}
19+
FileSystem::replaceFileStr(
20+
$this->source_dir . '/deps.sh',
21+
'return 0',
22+
'# return 0',
23+
);
24+
shell()->cd($this->source_dir)
25+
->exec('./deps.sh');
26+
return true;
27+
}
28+
1129
protected function build(): void
1230
{
1331
UnixCMakeExecutor::create($this)
@@ -17,7 +35,7 @@ protected function build(): void
1735
->addConfigureArgs('-DJPEGXL_ENABLE_BENCHMARK=OFF')
1836
->addConfigureArgs('-DJPEGXL_ENABLE_PLUGINS=OFF')
1937
->addConfigureArgs('-DJPEGXL_ENABLE_SJPEG=OFF')
20-
->addConfigureArgs('-DJPEGXL_STATIC=ON')
38+
->addConfigureArgs('-DJPEGXL_STATIC=' . SPCTarget::isStatic() ? 'ON' : 'OFF')
2139
->addConfigureArgs('-DBUILD_TESTING=OFF')
2240
->build();
2341
}

src/SPC/builder/unix/library/libtiff.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@ protected function build(): void
2222
FileSystem::replaceFileStr($this->source_dir . '/configure', '-lwebp', '-lwebp -lsharpyuv');
2323
FileSystem::replaceFileStr($this->source_dir . '/configure', '-l"$lerc_lib_name"', '-l"$lerc_lib_name" ' . $libcpp);
2424
UnixAutoconfExecutor::create($this)
25+
->optionalLib('lerc', '--enable-lerc', '--disable-lerc')
26+
->optionalLib('zstd', '--enable-zstd', '--disable-zstd')
27+
->optionalLib('libwebp', '--enable-webp', '--disable-webp')
28+
->optionalLib('xz', '--enable-lzma', '--disable-lzma')
29+
->optionalLib('jbig', '--enable-jbig', '--disable-jbig')
2530
->configure(
2631
// zlib deps
2732
'--enable-zlib',
@@ -39,11 +44,6 @@ protected function build(): void
3944
'--disable-cxx',
4045
'--without-x',
4146
)
42-
->optionalLib('lerc', '--enable-lerc', '--disable-lerc')
43-
->optionalLib('zstd', '--enable-zstd', '--disable-zstd')
44-
->optionalLib('webp', '--enable-webp', '--disable-webp')
45-
->optionalLib('xz', '--enable-lzma', '--disable-lzma')
46-
->optionalLib('jbig', '--enable-jbig', '--disable-jbig')
4747
->make();
4848
$this->patchPkgconfPrefix(['libtiff-4.pc']);
4949
}

0 commit comments

Comments
 (0)