graphics/gimagereader: Fix for the newer enchant.

Signed-off-by: Matteo Bernardini <ponce@slackbuilds.org>
This commit is contained in:
Fabio Bas 2024-08-04 14:25:35 +02:00 committed by Matteo Bernardini
parent 712320b61b
commit 9be6961fe3
2 changed files with 70 additions and 0 deletions

View file

@ -79,6 +79,8 @@ find -L . \
\( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
-o -perm 440 -o -perm 400 \) -exec chmod 644 {} \+
patch -p1 < $CWD/remove_enchant-provider.patch
# Path where manual will be installed
sed -i 's,"share/doc/gimagereader","doc/'$PRGNAM-$VERSION'",' CMakeLists.txt || exit 1

View file

@ -0,0 +1,68 @@
From e72d657a408dc6b77c48c086feede31e08700b4c Mon Sep 17 00:00:00 2001
From: Sandro Mani <manisandro@gmail.com>
Date: Fri, 14 Jun 2024 00:37:20 +0200
Subject: [PATCH] Work around enchant_get_prefix_dir which is not available
anymore in recent enchant
---
gtk/src/Config.cc | 7 -------
qt/src/Config.cc | 10 ++++++----
2 files changed, 6 insertions(+), 11 deletions(-)
diff --git a/gtk/src/Config.cc b/gtk/src/Config.cc
index fcec9645..73a68893 100644
--- a/gtk/src/Config.cc
+++ b/gtk/src/Config.cc
@@ -24,7 +24,6 @@
#include "Utils.hh"
#include "OutputEditorText.hh"
-#include <enchant-provider.h>
#define USE_STD_NAMESPACE
#include <tesseract/baseapi.h>
#if TESSERACT_MAJOR_VERSION < 5
@@ -214,13 +213,7 @@ void Config::openSpellingDir() {
std::string Config::spellingLocation(Location location) {
if(location == SystemLocation) {
-#ifdef G_OS_WIN32
std::string dataDir = Glib::build_filename(pkgDir, "share");
-#else
- char* prefix = enchant_get_prefix_dir();
- std::string dataDir = Glib::build_filename(prefix, "share");
- free(prefix);
-#endif
#if HAVE_ENCHANT2
if(Gio::File::create_for_path(Glib::build_filename(dataDir, "myspell"))->query_exists()) {
return Glib::build_filename(dataDir, "myspell");
diff --git a/qt/src/Config.cc b/qt/src/Config.cc
index efc788e2..fb6d2e58 100644
--- a/qt/src/Config.cc
+++ b/qt/src/Config.cc
@@ -25,10 +25,10 @@
#include <QDesktopServices>
#include <QDir>
+#include <QLibraryInfo>
#include <QMultiMap>
#include <QStandardPaths>
#include <QUrl>
-#include <enchant-provider.h>
#define USE_STD_NAMESPACE
#include <tesseract/baseapi.h>
#if TESSERACT_MAJOR_VERSION < 5
@@ -200,9 +200,11 @@ QString Config::spellingLocation(Location location) {
#ifdef Q_OS_WIN
QDir dataDir = QDir(QString("%1/../share/").arg(QApplication::applicationDirPath()));
#else
- char* prefix = enchant_get_prefix_dir();
- QDir dataDir(QDir(prefix).absoluteFilePath("share"));
- free(prefix);
+#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
+ QDir dataDir = QDir(QString("%1/share/").arg(QLibraryInfo::path(QLibraryInfo::PrefixPath)));
+#else
+ QDir dataDir = QDir(QString("%1/share/").arg(QLibraryInfo::location(QLibraryInfo::PrefixPath)));
+#endif
#endif
#if HAVE_ENCHANT2
if(QDir(dataDir.absoluteFilePath("myspell")).exists()) {