Skip to content

Commit be0dbcd

Browse files
committed
add jbig
1 parent 5c44703 commit be0dbcd

File tree

6 files changed

+79
-1
lines changed

6 files changed

+79
-1
lines changed

config/lib.json

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,18 @@
272272
],
273273
"cpp-library": true
274274
},
275+
"jbig": {
276+
"source": "jbig",
277+
"static-libs-unix": [
278+
"libjbig.a",
279+
"libjbig85.a"
280+
],
281+
"headers": [
282+
"jbig.h",
283+
"jbig85.h",
284+
"jbig_ar.h"
285+
]
286+
},
275287
"libacl": {
276288
"source": "libacl",
277289
"static-libs-unix": [
@@ -507,7 +519,8 @@
507519
"libjpeg"
508520
],
509521
"lib-suggests-unix": [
510-
"lerc"
522+
"lerc",
523+
"jbig"
511524
]
512525
},
513526
"libuuid": {

config/source.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -476,6 +476,15 @@
476476
"path": "LICENSE"
477477
}
478478
},
479+
"jbig": {
480+
"type": "url",
481+
"url": "https://www.cl.cam.ac.uk/~mgk25/jbigkit/download/jbigkit-2.1.tar.gz",
482+
"provide-pre-built": true,
483+
"license": {
484+
"type": "file",
485+
"path": "COPYING"
486+
}
487+
},
479488
"libevent": {
480489
"type": "ghrel",
481490
"repo": "libevent/libevent",
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\macos\library;
6+
7+
class jbig extends MacOSLibraryBase
8+
{
9+
use \SPC\builder\unix\library\jbig;
10+
11+
public const NAME = 'jbig';
12+
}

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

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace SPC\builder\unix\library;
6+
7+
use SPC\exception\FileSystemException;
8+
use SPC\exception\RuntimeException;
9+
use SPC\store\FileSystem;
10+
11+
trait jbig
12+
{
13+
/**
14+
* @throws FileSystemException
15+
* @throws RuntimeException
16+
*/
17+
protected function build(): void
18+
{
19+
// Patch Makefile to add -fPIC flag for position-independent code
20+
FileSystem::replaceFileStr($this->source_dir . '/Makefile', 'CFLAGS = -O2 -W -Wno-unused-result', 'CFLAGS = -O2 -W -Wno-unused-result -fPIC');
21+
22+
// Build the library
23+
shell()->cd($this->source_dir)->initializeEnv($this)
24+
->exec("make -j{$this->builder->concurrency} {$this->builder->getEnvString()} lib")
25+
->exec('cp libjbig/libjbig.a ' . BUILD_LIB_PATH)
26+
->exec('cp libjbig/libjbig85.a ' . BUILD_LIB_PATH)
27+
->exec('cp libjbig/jbig.h ' . BUILD_INCLUDE_PATH)
28+
->exec('cp libjbig/jbig85.h ' . BUILD_INCLUDE_PATH)
29+
->exec('cp libjbig/jbig_ar.h ' . BUILD_INCLUDE_PATH);
30+
}
31+
}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ protected function build(): void
3838
->optionalLib('zstd', '--enable-zstd', '--disable-zstd')
3939
->optionalLib('webp', '--enable-webp', '--disable-webp')
4040
->optionalLib('xz', '--enable-lzma', '--disable-lzma')
41+
->optionalLib('jbig', '--enable-jbig', '--disable-jbig')
4142
->make();
4243
$this->patchPkgconfPrefix(['libtiff-4.pc']);
4344
}

0 commit comments

Comments
 (0)