mirror of
https://github.com/yann64/haikuports.git
synced 2026-05-05 06:28:55 +02:00
130 lines
3.8 KiB
Plaintext
130 lines
3.8 KiB
Plaintext
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
|
|
|