commit:     be3b16b8435f258fb3a4f3751dd9833e72816349
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Thu Mar  9 07:44:34 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu Mar  9 07:57:02 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=be3b16b8

media-libs/jbig2enc: EAPI 8, fix build w/ newer leptonica

Closes: https://bugs.gentoo.org/814473
Signed-off-by: Sam James <sam <AT> gentoo.org>

 .../files/jbig2enc-0.29-leptonica-1.83.patch       | 81 ++++++++++++++++++++++
 ...big2enc-0.29.ebuild => jbig2enc-0.29-r1.ebuild} |  8 ++-
 2 files changed, 87 insertions(+), 2 deletions(-)

diff --git a/media-libs/jbig2enc/files/jbig2enc-0.29-leptonica-1.83.patch 
b/media-libs/jbig2enc/files/jbig2enc-0.29-leptonica-1.83.patch
new file mode 100644
index 000000000000..dfa43a6214af
--- /dev/null
+++ b/media-libs/jbig2enc/files/jbig2enc-0.29-leptonica-1.83.patch
@@ -0,0 +1,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 <[email protected]>
+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 <[email protected]>
+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
+                       ])
+

diff --git a/media-libs/jbig2enc/jbig2enc-0.29.ebuild 
b/media-libs/jbig2enc/jbig2enc-0.29-r1.ebuild
similarity index 89%
rename from media-libs/jbig2enc/jbig2enc-0.29.ebuild
rename to media-libs/jbig2enc/jbig2enc-0.29-r1.ebuild
index fa9f4ee5a609..44791b8f43cf 100644
--- a/media-libs/jbig2enc/jbig2enc-0.29.ebuild
+++ b/media-libs/jbig2enc/jbig2enc-0.29-r1.ebuild
@@ -1,7 +1,7 @@
-# Copyright 1999-2022 Gentoo Authors
+# Copyright 1999-2023 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
-EAPI=7
+EAPI=8
 
 inherit autotools
 
@@ -17,6 +17,10 @@ IUSE="gif jpeg png tiff webp"
 RDEPEND="media-libs/leptonica[gif?,jpeg?,png?,tiff?,webp?]"
 DEPEND="${RDEPEND}"
 
+PATCHES=(
+       "${FILESDIR}"/${P}-leptonica-1.83.patch
+)
+
 src_prepare() {
        default
 

Reply via email to