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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
|
https://github.com/agl/jbig2enc/commit/a614bdb580d65653dbfe5c9925940797a065deac
https://github.com/agl/jbig2enc/commit/d211d8c9c65fbc103594580484a3b7fa0249e160
From a614bdb580d65653dbfe5c9925940797a065deac Mon Sep 17 00:00:00 2001
From: Federico <19206300+quaqo@users.noreply.github.com>
Date: Sun, 8 Jan 2023 14:12:51 +0100
Subject: [PATCH] Fix build with Leptonica >=1.83
From leptonica 1.83 release notes:
* Use stdatomic.h to make cloning string safe. Remove all *GetRefcount() and *ChangeRefcount() accessors.
* Remove information about fields in many structs from the public interface allheaders.h, instead putting them in internal files pix_internal.h, array_internal.h and ccbord_internal.h.
--- a/src/jbig2.cc
+++ b/src/jbig2.cc
@@ -29,6 +29,9 @@
#endif
#include <leptonica/allheaders.h>
+#if (LIBLEPT_MAJOR_VERSION == 1 && LIBLEPT_MINOR_VERSION >= 83) || LIBLEPT_MAJOR_VERSION > 1
+#include "leptonica/pix_internal.h"
+#endif
#include "jbig2enc.h"
--- a/src/jbig2enc.cc
+++ b/src/jbig2enc.cc
@@ -24,6 +24,10 @@
#include <string.h>
#include <leptonica/allheaders.h>
+#if (LIBLEPT_MAJOR_VERSION == 1 && LIBLEPT_MINOR_VERSION >= 83) || LIBLEPT_MAJOR_VERSION > 1
+#include "leptonica/pix_internal.h"
+#include "leptonica/array_internal.h"
+#endif
#include <math.h>
#if defined(sun)
@@ -206,7 +210,11 @@ unite_templates(struct jbig2ctx *ctx,
numaSetValue(ctx->classer->naclass, i, new_representant);
}
}
+#if (LIBLEPT_MAJOR_VERSION == 1 && LIBLEPT_MINOR_VERSION >= 83) || LIBLEPT_MAJOR_VERSION > 1
+ ctx->classer->pixat->pix[new_representant]->refcount += ctx->classer->pixat->pix[second_template]->refcount;
+#else
pixChangeRefcount(ctx->classer->pixat->pix[new_representant],pixGetRefcount(ctx->classer->pixat->pix[second_template]));
+#endif
}
return 0;
}
--- a/src/jbig2sym.cc
+++ b/src/jbig2sym.cc
@@ -29,6 +29,10 @@
#include <stdio.h>
#include <leptonica/allheaders.h>
+#if (LIBLEPT_MAJOR_VERSION == 1 && LIBLEPT_MINOR_VERSION >= 83) || LIBLEPT_MAJOR_VERSION > 1
+#include "leptonica/pix_internal.h"
+#include "leptonica/array_internal.h"
+#endif
#include <math.h>
From d211d8c9c65fbc103594580484a3b7fa0249e160 Mon Sep 17 00:00:00 2001
From: Federico <19206300+quaqo@users.noreply.github.com>
Date: Sun, 8 Jan 2023 20:15:45 +0100
Subject: [PATCH] Fix autotools with leptonica >= 1.83
From leptonica 1.83 release notes:
* Rename the autotools generated libraries from liblept to libleptonica
--- a/configure.ac
+++ b/configure.ac
@@ -73,7 +73,7 @@ AC_CONFIG_COMMANDS([libtool-rpath-patch],
fi],
[libtool_patch_use_rpath=$enable_rpath])
-AC_CHECK_LIB([lept], [findFileFormatStream], [], [
+AC_CHECK_LIB([leptonica], [findFileFormatStream], [], [
echo "Error! Leptonica not detected."
exit -1
])
|