summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristopher Hillenbrand2022-10-02 15:24:32 -0400
committerChristopher Hillenbrand2022-10-02 15:24:32 -0400
commita045f7ec1e571d82f8d93971a4589972e245cd45 (patch)
tree84863e3ff5dc81f97459931d685a3cd77ff83663
parent9c0b87ad7a6bdf0250cc7a4874df3e46a4c74da5 (diff)
downloadaur-a045f7ec1e571d82f8d93971a4589972e245cd45.tar.gz
add hanging commit and dpi patch (see CHANGELOG)
-rw-r--r--.SRCINFO7
-rw-r--r--CHANGELOG7
-rw-r--r--PKGBUILD13
-rw-r--r--commit-ea6a40a.patch28
-rw-r--r--dpi.patch58
5 files changed, 109 insertions, 4 deletions
diff --git a/.SRCINFO b/.SRCINFO
index 1ffe3f1b2e14..667ee4cee64e 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,8 +1,9 @@
pkgbase = jbig2enc
pkgdesc = A JBIG2 image encoder
pkgver = 0.29
- pkgrel = 3
+ pkgrel = 4
url = https://github.com/agl/jbig2enc
+ changelog = CHANGELOG
arch = i686
arch = x86_64
license = Apache
@@ -20,8 +21,12 @@ pkgbase = jbig2enc
source = https://github.com/agl/jbig2enc/archive/refs/tags/0.29.tar.gz
source = jbig2enc-pdfpy.patch
source = jbig2enc.1
+ source = commit-ea6a40a.patch
+ source = dpi.patch
sha256sums = bfcf0d0448ee36046af6c776c7271cd5a644855723f0a832d1c0db4de3c21280
sha256sums = a5d98fc43b2f3dc73dd1f352a439a6ae73fd085f469420aa29e47d9a4e2f40f6
sha256sums = c940124f102695872fae02b243e0dd99c05ecfb3ecef0a476b3e903a0db69a54
+ sha256sums = 99d086e922653cc6fa0b1cccff90f9fd1d279ecd96104e73ea281c253781718a
+ sha256sums = 5cccc44d3019367351516cc3952692fbe23bc05b7c5726553f98d5b262f78686
pkgname = jbig2enc
diff --git a/CHANGELOG b/CHANGELOG
new file mode 100644
index 000000000000..9b728bf42803
--- /dev/null
+++ b/CHANGELOG
@@ -0,0 +1,7 @@
+v0.29-4:
+
+jbig2enc 0.29-4 contains a patch to set the dpi of images without dpi information. See here:
+https://github.com/agl/jbig2enc/pull/52/commits/cd6c1df2e3475237206385bf8a373bbe06932d86
+It won't do anything unless you use it, but it hasn't been tested.
+Edit the PKGBUILD to remove this patch ("dpi.patch") if you prefer.
+
diff --git a/PKGBUILD b/PKGBUILD
index f86b2f516d98..e682dd0d99c7 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -4,7 +4,7 @@
pkgname=jbig2enc
pkgver=0.29
-pkgrel=3
+pkgrel=4
pkgdesc="A JBIG2 image encoder"
arch=('i686' 'x86_64')
url="https://github.com/agl/jbig2enc"
@@ -14,18 +14,25 @@ optdepends=('python: for pdf.py')
provides=('jbig2enc')
conflicts=('jbig2enc-git')
makedepends=('automake' 'libtool' 'gzip')
+changelog=CHANGELOG
source=("https://github.com/agl/jbig2enc/archive/refs/tags/$pkgver.tar.gz"
"jbig2enc-pdfpy.patch"
- "jbig2enc.1")
+ "jbig2enc.1"
+ "commit-ea6a40a.patch"
+ "dpi.patch")
sha256sums=('bfcf0d0448ee36046af6c776c7271cd5a644855723f0a832d1c0db4de3c21280'
'a5d98fc43b2f3dc73dd1f352a439a6ae73fd085f469420aa29e47d9a4e2f40f6'
- 'c940124f102695872fae02b243e0dd99c05ecfb3ecef0a476b3e903a0db69a54')
+ 'c940124f102695872fae02b243e0dd99c05ecfb3ecef0a476b3e903a0db69a54'
+ '99d086e922653cc6fa0b1cccff90f9fd1d279ecd96104e73ea281c253781718a'
+ '5cccc44d3019367351516cc3952692fbe23bc05b7c5726553f98d5b262f78686')
prepare() {
cd "${srcdir}/${pkgname}-${pkgver}"
#sed -i 's@^#!/usr/bin/python$@#!/usr/bin/env python2@' pdf.py
+ patch --forward --strip=1 --input="${srcdir}/commit-ea6a40a.patch"
patch --forward --strip=1 --input="${srcdir}/jbig2enc-pdfpy.patch"
+ patch --forward --strip=1 --input="${srcdir}/dpi.patch"
cat "${srcdir}/jbig2enc.1" | gzip > "${srcdir}/jbig2enc.1.gz"
}
diff --git a/commit-ea6a40a.patch b/commit-ea6a40a.patch
new file mode 100644
index 000000000000..69260fa7ecda
--- /dev/null
+++ b/commit-ea6a40a.patch
@@ -0,0 +1,28 @@
+diff --git a/src/jbig2.cc b/src/jbig2.cc
+index 515c1ef..0bddb90 100644
+--- a/src/jbig2.cc
++++ b/src/jbig2.cc
+@@ -418,8 +418,11 @@ main(int argc, char **argv) {
+ if (pixl->d > 8) {
+ gray = pixConvertRGBToGrayFast(pixl);
+ if (!gray) return 1;
+- } else {
++ } else if (pixl->d == 4 || pixl->d == 8) {
+ gray = pixClone(pixl);
++ } else {
++ fprintf(stderr, "Unsupported input image depth: %d\n", pixl->d);
++ return 1;
+ }
+ if (up2) {
+ pixt = pixScaleGray2xLIThresh(gray, bw_threshold);
+@@ -432,6 +435,10 @@ main(int argc, char **argv) {
+ } else {
+ pixt = pixClone(pixl);
+ }
++ if (!pixt) {
++ fprintf(stderr, "Failed to convert input image to binary\n");
++ return 1;
++ }
+ if (verbose)
+ pixInfo(pixt, "thresholded image:");
+
diff --git a/dpi.patch b/dpi.patch
new file mode 100644
index 000000000000..6de7056329d7
--- /dev/null
+++ b/dpi.patch
@@ -0,0 +1,58 @@
+diff --git a/src/jbig2.cc b/src/jbig2.cc
+index 0bddb90..9447350 100644
+--- a/src/jbig2.cc
++++ b/src/jbig2.cc
+@@ -55,6 +55,7 @@ usage(const char *argv0) {
+ fprintf(stderr, " -S: remove images from mixed input and save separately\n");
+ fprintf(stderr, " -j --jpeg-output: write images from mixed input as JPEG\n");
+ fprintf(stderr, " -a --auto-thresh: use automatic thresholding in symbol encoder\n");
++ fprintf(stderr, " -D --dpi: force dpi\n");
+ fprintf(stderr, " --no-hash: disables use of hash function for automatic thresholding\n");
+ fprintf(stderr, " -V --version: version info\n");
+ fprintf(stderr, " -v: be verbose\n");
+@@ -218,6 +219,7 @@ main(int argc, char **argv) {
+ bool segment = false;
+ bool auto_thresh = false;
+ bool hash = true;
++ int dpi = 0;
+ int i;
+
+ #ifdef WIN32
+@@ -353,6 +355,24 @@ main(int argc, char **argv) {
+ continue;
+ }
+
++ if (strcmp(argv[i], "-D") == 0 ||
++ strcmp(argv[i], "--dpi") == 0) {
++ char *endptr;
++ long t_dpi = strtol(argv[i+1], &endptr, 10);
++ if (*endptr) {
++ fprintf(stderr, "Cannot parse int value: %s\n", argv[i+1]);
++ usage(argv[0]);
++ return 1;
++ }
++ if (t_dpi <= 0 || t_dpi > 9600) {
++ fprintf(stderr, "Invalid dpi: (1..9600)\n");
++ return 12;
++ }
++ dpi = (int)t_dpi;
++ i++;
++ continue;
++ }
++
+ break;
+ }
+
+@@ -402,6 +422,11 @@ main(int argc, char **argv) {
+ source = pixReadTiff(argv[i], subimage++);
+ }
+
++ if (dpi != 0 && source->xres == 0 && source->yres == 0) {
++ source->xres = dpi;
++ source->yres = dpi;
++ }
++
+ if (!source) return 3;
+ if (verbose)
+ pixInfo(source, "source image:");
+