Add recipe for nuspell

This commit is contained in:
François Revol
2020-02-04 13:58:58 +01:00
parent 11f919c776
commit a73c504137
2 changed files with 217 additions and 0 deletions

View File

@@ -0,0 +1,88 @@
SUMMARY="Free and open source C++ spell checking library"
DESCRIPTION="Nuspell is a free and open source spell checker library \
and command-line program designed for languages with rich morphology \
and complex word compounding. \
Nuspell is a pure C++ re-implementation of Hunspell.
Main features of Nuspell spell checker:
- Full unicode support backed by ICU
- Backward compatibility with Hunspell dictionary file format
- Twofold affix stripping (for agglutinative languages, like Azeri, Basque, Estonian, Finnish, Hungarian, Turkish, etc.)
- Support complex compounds (for example, Hungarian, German and Dutch)
- Support language specific features (for example, special casing of Azeri and Turkish dotted i, or German sharp s)
- Handle conditional affixes, circumfixes, fogemorphemes, forbidden words, pseudoroots and homonyms.
- Free software. Licensed under GNU LGPL v3."
HOMEPAGE="https://nuspell.github.io/"
COPYRIGHT="2016-2019 Dimitrij Mijoski, Sander van Geloven
2007-2016 Hunspell developers et al.
2002-2008 László Németh (Hunspell)
2001-2002 Kevin Hendricks (MySpell)"
LICENSE="GNU LGPL v3"
REVISION="1"
SOURCE_URI="https://github.com/nuspell/nuspell/archive/v$portVersion.tar.gz"
CHECKSUM_SHA256="9ce86d5463723cc7dceba9d1dd046e1022ed5e3004ac6d12f2daaf5b090a6066"
PATCHES="nuspell-$portVersion.patchset"
ARCHITECTURES="!x86_gcc2 ?x86 ?x86_64"
SECONDARY_ARCHITECTURES="?x86"
PROVIDES="
$portName = $portVersion
cmd:nuspell$secondaryArchSuffix = $portVersion
"
REQUIRES="
haiku$secondaryArchSuffix
lib:libboost_locale$secondaryArchSuffix
lib:libicudata$secondaryArchSuffix
lib:libicuuc$secondaryArchSuffix
"
PROVIDES_devel="
nuspell${secondaryArchSuffix}_devel = $portVersion
devel:libnuspell$secondaryArchSuffix
"
REQUIRES_devel="
nuspell$secondaryArchSuffix == $portVersion base
"
BUILD_REQUIRES="
haiku${secondaryArchSuffix}_devel
devel:libboost_locale$secondaryArchSuffix
devel:libicudata$secondaryArchSuffix
devel:libicuuc$secondaryArchSuffix
"
BUILD_PREREQUIRES="
cmd:cmake
cmd:gcc$secondaryArchSuffix
cmd:ld$secondaryArchSuffix
cmd:make
#cmd:git # for tests
#cmd:ronn # for the docs (ruby stuff)
"
BUILD()
{
mkdir -p build
cd build
cmake $cmakeDirArgs ..
make $jobArgs
}
INSTALL()
{
cd build
make install
prepareInstalledDevelLibs libnuspell
fixPkgconfig
packageEntries devel \
$developDir \
$libDir/cmake
}
#TEST()
#{
# make test
#}

View File

@@ -0,0 +1,129 @@
From ad55c8ad61aa93ad5eb4005cd6b87e22c45d3318 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fran=C3=A7ois=20Revol?= <revol@free.fr>
Date: Tue, 4 Feb 2020 12:47:12 +0100
Subject: [PATCH 1/2] Fix build on Haiku
We don't have locale_t yet.
Some things should probably be tested by CMake instead of hardcoding ifdefs.
Some tests crash though.
---
src/nuspell/finder.cxx | 3 ++-
src/nuspell/main.cxx | 2 +-
src/nuspell/utils.hxx | 5 +++--
tests/verify.cxx | 2 +-
4 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/src/nuspell/finder.cxx b/src/nuspell/finder.cxx
index 59173ff..a374f5e 100644
--- a/src/nuspell/finder.cxx
+++ b/src/nuspell/finder.cxx
@@ -28,7 +28,8 @@
#include <utility>
#if !defined(_WIN32) && (defined(__unix__) || defined(__unix) || \
- (defined(__APPLE__) && defined(__MACH__)))
+ (defined(__APPLE__) && defined(__MACH__)) || \
+ defined(__HAIKU__))
#include <unistd.h>
#ifdef _POSIX_VERSION
#include <dirent.h>
diff --git a/src/nuspell/main.cxx b/src/nuspell/main.cxx
index f4fc5ad..ff049ee 100644
--- a/src/nuspell/main.cxx
+++ b/src/nuspell/main.cxx
@@ -33,7 +33,7 @@
#define PACKAGE_STRING "nuspell " PROJECT_VERSION
#if defined(__MINGW32__) || defined(__unix__) || defined(__unix) || \
- (defined(__APPLE__) && defined(__MACH__))
+ (defined(__APPLE__) && defined(__MACH__)) || defined(__HAIKU__)
#include <getopt.h>
#include <unistd.h>
#endif
diff --git a/src/nuspell/utils.hxx b/src/nuspell/utils.hxx
index 968053d..722c4d7 100644
--- a/src/nuspell/utils.hxx
+++ b/src/nuspell/utils.hxx
@@ -30,7 +30,8 @@
#include <clocale>
#if !defined(_WIN32) && (defined(__unix__) || defined(__unix) || \
- (defined(__APPLE__) && defined(__MACH__)))
+ (defined(__APPLE__) && defined(__MACH__)) || \
+ defined(__HAIKU__))
#include <unistd.h>
#endif
@@ -125,7 +126,7 @@ class Encoding_Converter {
};
//#if _POSIX_VERSION >= 200809L
-#ifdef _POSIX_VERSION
+#if defined(_POSIX_VERSION) && !defined(__HAIKU__)
class Setlocale_To_C_In_Scope {
locale_t old_loc = nullptr;
diff --git a/tests/verify.cxx b/tests/verify.cxx
index 453ed43..417e64a 100644
--- a/tests/verify.cxx
+++ b/tests/verify.cxx
@@ -34,7 +34,7 @@
#define PACKAGE_STRING "nuspell " PROJECT_VERSION
#if defined(__MINGW32__) || defined(__unix__) || defined(__unix) || \
- (defined(__APPLE__) && defined(__MACH__))
+ (defined(__APPLE__) && defined(__MACH__)) || defined(__HAIKU__)
#include <getopt.h>
#include <unistd.h>
#endif
--
2.24.1
From 1dc3b857df8ade706b2113adb5008e0acf825423 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fran=C3=A7ois=20Revol?= <revol@free.fr>
Date: Tue, 4 Feb 2020 13:06:07 +0100
Subject: [PATCH 2/2] Use native API on Haiku to find dictionary paths
---
src/nuspell/finder.cxx | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/src/nuspell/finder.cxx b/src/nuspell/finder.cxx
index a374f5e..b0b5e76 100644
--- a/src/nuspell/finder.cxx
+++ b/src/nuspell/finder.cxx
@@ -37,6 +37,9 @@
#include <sys/stat.h>
#include <sys/types.h>
#endif
+#if defined(__HAIKU__)
+#include <FindDirectory.h>
+#endif
#elif defined(_WIN32)
@@ -80,7 +83,17 @@ auto get_default_search_paths(OutIt out) -> OutIt
if (dicpath) {
out = split(string(dicpath), PATHSEP, out);
}
-#ifdef _POSIX_VERSION
+#if defined(__HAIKU__)
+ char **paths;
+ size_t pathsCount;
+ if (find_paths(B_FIND_PATH_DATA_DIRECTORY, "hunspell",
+ &paths, &pathsCount) == B_OK) {
+ for (int i = 0; i < pathsCount; i++) {
+ *out++ = string(paths[i]);
+ }
+ free(paths);
+ }
+#elif defined(_POSIX_VERSION)
auto home = getenv("HOME");
if (home) {
*out++ = home + string("/.local/share/hunspell");
--
2.24.1