From 64b6499371fa22d52648523e65a28c041dd6579f Mon Sep 17 00:00:00 2001 From: Khaled Hosny Date: Thu, 17 Oct 2013 19:58:07 +0200 Subject: fdo#70393: move hunspell to a subdir of external Change-Id: Id3aafd95cb8c064f84898844a91f350e9aad0ed4 Reviewed-on: https://gerrit.libreoffice.org/6307 Reviewed-by: David Tardon Tested-by: David Tardon --- external/Module_external.mk | 1 + external/hunspell/ExternalProject_hunspell.mk | 27 +++++++ external/hunspell/Makefile | 7 ++ external/hunspell/Module_hunspell.mk | 25 +++++++ external/hunspell/README | 4 + external/hunspell/StaticLibrary_hunspell.mk | 37 +++++++++ external/hunspell/UnpackedTarball_hunspell.mk | 32 ++++++++ external/hunspell/hunspell-1.3.2-compound.patch | 11 +++ external/hunspell/hunspell-1.3.2-literal.patch | 11 +++ external/hunspell/hunspell-1.3.2-nullptr.patch | 20 +++++ external/hunspell/hunspell-1.3.2-overflow.patch | 91 +++++++++++++++++++++++ external/hunspell/hunspell-android.patch | 42 +++++++++++ external/hunspell/hunspell-solaris.patch | 12 +++ external/hunspell/hunspell-twoaffixcompound.patch | 80 ++++++++++++++++++++ external/hunspell/hunspell-wundef.patch.1 | 11 +++ external/hunspell/hunspell.rhbz918938.patch | 72 ++++++++++++++++++ 16 files changed, 483 insertions(+) create mode 100644 external/hunspell/ExternalProject_hunspell.mk create mode 100644 external/hunspell/Makefile create mode 100644 external/hunspell/Module_hunspell.mk create mode 100644 external/hunspell/README create mode 100644 external/hunspell/StaticLibrary_hunspell.mk create mode 100644 external/hunspell/UnpackedTarball_hunspell.mk create mode 100644 external/hunspell/hunspell-1.3.2-compound.patch create mode 100644 external/hunspell/hunspell-1.3.2-literal.patch create mode 100644 external/hunspell/hunspell-1.3.2-nullptr.patch create mode 100644 external/hunspell/hunspell-1.3.2-overflow.patch create mode 100644 external/hunspell/hunspell-android.patch create mode 100644 external/hunspell/hunspell-solaris.patch create mode 100644 external/hunspell/hunspell-twoaffixcompound.patch create mode 100644 external/hunspell/hunspell-wundef.patch.1 create mode 100644 external/hunspell/hunspell.rhbz918938.patch (limited to 'external') diff --git a/external/Module_external.mk b/external/Module_external.mk index 2b8e83603321..46bceafc5d23 100644 --- a/external/Module_external.mk +++ b/external/Module_external.mk @@ -35,6 +35,7 @@ $(eval $(call gb_Module_add_moduledirs,external,\ $(call gb_Helper_optional,GRAPHITE,graphite) \ $(call gb_Helper_optional,HARFBUZZ,harfbuzz) \ $(call gb_Helper_optional,HSQLDB,hsqldb) \ + $(call gb_Helper_optional,HUNSPELL,hunspell) \ $(call gb_Helper_optional,LIBATOMIC_OPS,libatomic_ops) \ $(call gb_Helper_optional,LIBPNG,libpng) \ )) diff --git a/external/hunspell/ExternalProject_hunspell.mk b/external/hunspell/ExternalProject_hunspell.mk new file mode 100644 index 000000000000..6bbb6183cf01 --- /dev/null +++ b/external/hunspell/ExternalProject_hunspell.mk @@ -0,0 +1,27 @@ +# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +$(eval $(call gb_ExternalProject_ExternalProject,hunspell)) + +$(eval $(call gb_ExternalProject_register_targets,hunspell,\ + build \ +)) + +$(call gb_ExternalProject_get_state_target,hunspell,build): + $(call gb_ExternalProject_run,build,\ + LIBS="$(gb_STDLIBS) $(LIBS)" \ + ./configure --disable-shared --disable-nls --with-pic \ + $(if $(filter YES,$(CROSS_COMPILING)),--build=$(BUILD_PLATFORM) --host=$(HOST_PLATFORM))\ + $(if $(filter AIX,$(OS)),CFLAGS="-D_LINUX_SOURCE_COMPAT") \ + $(if $(filter C53,$(COM)),CFLAGS="-xc99=none") \ + $(if $(filter-out WNTGCC,$(OS)$(COM)),,LDFLAGS="-Wl,--enable-runtime-pseudo-reloc-v2") \ + && $(MAKE) \ + ) + +# vim: set noet sw=4 ts=4: diff --git a/external/hunspell/Makefile b/external/hunspell/Makefile new file mode 100644 index 000000000000..ccb1c85a04da --- /dev/null +++ b/external/hunspell/Makefile @@ -0,0 +1,7 @@ +# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- + +module_directory:=$(dir $(realpath $(firstword $(MAKEFILE_LIST)))) + +include $(module_directory)/../solenv/gbuild/partial_build.mk + +# vim: set noet sw=4 ts=4: diff --git a/external/hunspell/Module_hunspell.mk b/external/hunspell/Module_hunspell.mk new file mode 100644 index 000000000000..505a9fb0cbc1 --- /dev/null +++ b/external/hunspell/Module_hunspell.mk @@ -0,0 +1,25 @@ +# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +$(eval $(call gb_Module_Module,hunspell)) + +$(eval $(call gb_Module_add_targets,hunspell,\ + UnpackedTarball_hunspell \ +)) +ifeq ($(COM),MSC) +$(eval $(call gb_Module_add_targets,hunspell,\ + StaticLibrary_hunspell \ +)) +else +$(eval $(call gb_Module_add_targets,hunspell,\ + ExternalProject_hunspell \ +)) +endif + +# vim: set noet sw=4 ts=4: diff --git a/external/hunspell/README b/external/hunspell/README new file mode 100644 index 000000000000..1221735cad65 --- /dev/null +++ b/external/hunspell/README @@ -0,0 +1,4 @@ +Library for spell checking. + +From: +[http://hunspell.sourceforge.net/]. diff --git a/external/hunspell/StaticLibrary_hunspell.mk b/external/hunspell/StaticLibrary_hunspell.mk new file mode 100644 index 000000000000..29fe6249d37f --- /dev/null +++ b/external/hunspell/StaticLibrary_hunspell.mk @@ -0,0 +1,37 @@ +# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +$(eval $(call gb_StaticLibrary_StaticLibrary,hunspell)) + +$(eval $(call gb_StaticLibrary_use_unpacked,hunspell,hunspell)) + +$(eval $(call gb_StaticLibrary_use_external,hunspell,icu_headers)) + +$(eval $(call gb_StaticLibrary_set_warnings_not_errors,hunspell)) + +$(eval $(call gb_StaticLibrary_add_defs,hunspell,\ + -DHUNSPELL_STATIC \ + -DOPENOFFICEORG \ +)) + +$(eval $(call gb_StaticLibrary_add_generated_cxxobjects,hunspell,\ + UnpackedTarball/hunspell/src/hunspell/affentry \ + UnpackedTarball/hunspell/src/hunspell/affixmgr \ + UnpackedTarball/hunspell/src/hunspell/dictmgr \ + UnpackedTarball/hunspell/src/hunspell/csutil \ + UnpackedTarball/hunspell/src/hunspell/hashmgr \ + UnpackedTarball/hunspell/src/hunspell/suggestmgr \ + UnpackedTarball/hunspell/src/hunspell/phonet \ + UnpackedTarball/hunspell/src/hunspell/hunzip \ + UnpackedTarball/hunspell/src/hunspell/filemgr \ + UnpackedTarball/hunspell/src/hunspell/replist \ + UnpackedTarball/hunspell/src/hunspell/hunspell \ +)) + +# vim: set noet sw=4 ts=4: diff --git a/external/hunspell/UnpackedTarball_hunspell.mk b/external/hunspell/UnpackedTarball_hunspell.mk new file mode 100644 index 000000000000..8c23f0396332 --- /dev/null +++ b/external/hunspell/UnpackedTarball_hunspell.mk @@ -0,0 +1,32 @@ + -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +$(eval $(call gb_UnpackedTarball_UnpackedTarball,hunspell)) + +$(eval $(call gb_UnpackedTarball_set_tarball,hunspell,$(HUNSPELL_TARBALL))) + +$(eval $(call gb_UnpackedTarball_add_patches,hunspell,\ + external/hunspell/hunspell-twoaffixcompound.patch \ + external/hunspell/hunspell-solaris.patch \ + external/hunspell/hunspell-1.3.2-overflow.patch \ + external/hunspell/hunspell-android.patch \ + external/hunspell/hunspell-1.3.2-nullptr.patch \ + external/hunspell/hunspell-1.3.2-literal.patch \ + external/hunspell/hunspell-1.3.2-compound.patch \ + external/hunspell/hunspell.rhbz918938.patch \ + external/hunspell/hunspell-wundef.patch.1 \ +)) + +ifeq ($(COM),MSC) +$(eval $(call gb_UnpackedTarball_set_post_action,hunspell,\ + touch src/hunspell/config.h \ +)) +endif + +# vim: set noet sw=4 ts=4: diff --git a/external/hunspell/hunspell-1.3.2-compound.patch b/external/hunspell/hunspell-1.3.2-compound.patch new file mode 100644 index 000000000000..3629add70ca5 --- /dev/null +++ b/external/hunspell/hunspell-1.3.2-compound.patch @@ -0,0 +1,11 @@ +--- misc/hunspell-1.3.2/src/hunspell/affixmgr.cxx 2010-02-27 12:59:53.000000000 +0100 ++++ misc/build/hunspell-1.3.2/src/hunspell/affixmgr.cxx 2012-09-18 11:50:04.535803282 +0200 +@@ -2125,7 +2125,7 @@ + } + + if (!rv) { +- if (onlycpdrule) break; ++ if (onlycpdrule && strlen(*result) > MAXLNLEN/10) break; + if (compoundflag && + !(rv = prefix_check(st, i, hu_mov_rule ? IN_CPD_OTHER : IN_CPD_BEGIN, compoundflag))) { + if (((rv = suffix_check(st, i, 0, NULL, NULL, 0, NULL, diff --git a/external/hunspell/hunspell-1.3.2-literal.patch b/external/hunspell/hunspell-1.3.2-literal.patch new file mode 100644 index 000000000000..4cbf377c1442 --- /dev/null +++ b/external/hunspell/hunspell-1.3.2-literal.patch @@ -0,0 +1,11 @@ +--- misc/hunspell-1.3.2/src/tools/hunspell.cxx 2012-08-13 12:09:06.107017665 +0200 ++++ misc/build/hunspell-1.3.2/src/tools/hunspell.cxx 2012-08-13 12:14:12.233500532 +0200 +@@ -20,7 +20,7 @@ + #define HUNSPELL_VERSION VERSION + #define INPUTLEN 50 + +-#define HUNSPELL_PIPE_HEADING "@(#) International Ispell Version 3.2.06 (but really Hunspell "VERSION")\n" ++#define HUNSPELL_PIPE_HEADING "@(#) International Ispell Version 3.2.06 (but really Hunspell " VERSION ")\n" + #define HUNSPELL_HEADING "Hunspell " + + //for debugging only diff --git a/external/hunspell/hunspell-1.3.2-nullptr.patch b/external/hunspell/hunspell-1.3.2-nullptr.patch new file mode 100644 index 000000000000..624e6ce6e6c5 --- /dev/null +++ b/external/hunspell/hunspell-1.3.2-nullptr.patch @@ -0,0 +1,20 @@ +--- misc/hunspell-1.3.2/src/hunspell/affentry.hxx 2010-04-15 13:22:08.000000000 +0200 ++++ misc/build/hunspell-1.3.2/src/hunspell/affentry.hxx 2012-08-13 12:08:48.568996730 +0200 +@@ -27,7 +27,7 @@ + struct hentry * checkword(const char * word, int len, char in_compound, + const FLAG needflag = FLAG_NULL); + +- struct hentry * check_twosfx(const char * word, int len, char in_compound, const FLAG needflag = NULL); ++ struct hentry * check_twosfx(const char * word, int len, char in_compound, const FLAG needflag = FLAG_NULL); + + char * check_morph(const char * word, int len, char in_compound, + const FLAG needflag = FLAG_NULL); +@@ -90,7 +90,7 @@ + // const FLAG cclass = FLAG_NULL, const FLAG needflag = FLAG_NULL, char in_compound=IN_CPD_NOT); + const FLAG cclass = FLAG_NULL, const FLAG needflag = FLAG_NULL, const FLAG badflag = 0); + +- struct hentry * check_twosfx(const char * word, int len, int optflags, PfxEntry* ppfx, const FLAG needflag = NULL); ++ struct hentry * check_twosfx(const char * word, int len, int optflags, PfxEntry* ppfx, const FLAG needflag = FLAG_NULL); + + char * check_twosfx_morph(const char * word, int len, int optflags, + PfxEntry* ppfx, const FLAG needflag = FLAG_NULL); diff --git a/external/hunspell/hunspell-1.3.2-overflow.patch b/external/hunspell/hunspell-1.3.2-overflow.patch new file mode 100644 index 000000000000..8500b483d53f --- /dev/null +++ b/external/hunspell/hunspell-1.3.2-overflow.patch @@ -0,0 +1,91 @@ +--- misc/hunspell-1.3.2/src/hunspell/affixmgr.cxx 2010-02-27 12:59:53.000000000 +0100 ++++ misc/build/hunspell-1.3.2/src/hunspell/affixmgr.cxx 2011-05-18 16:29:45.919141893 +0200 +@@ -6,6 +6,8 @@ + #include + #include + ++#include ++ + #include + + #include "affixmgr.hxx" +@@ -4000,7 +4002,10 @@ + case 3: { + np++; + numents = atoi(piece); +- if (numents == 0) { ++ if ((numents <= 0) || ++ ((::std::numeric_limits::max() ++ / sizeof(struct affentry)) < numents)) ++ { + char * err = pHMgr->encode_flag(aflag); + if (err) { + HUNSPELL_WARNING(stderr, "error: line %d: bad entry number\n", +--- misc/hunspell-1.3.2/src/tools/munch.c 2010-02-27 21:49:49.000000000 +0100 ++++ misc/build/hunspell-1.3.2/src/tools/munch.c 2011-05-18 15:53:53.427072106 +0200 +@@ -4,6 +4,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -233,10 +233,19 @@ + case 1: { achar = *piece; break; } + case 2: { if (*piece == 'Y') ff = XPRODUCT; break; } + case 3: { numents = atoi(piece); +- ptr = malloc(numents * sizeof(struct affent)); +- ptr->achar = achar; +- ptr->xpflg = ff; +- fprintf(stderr,"parsing %c entries %d\n",achar,numents); ++ if ((numents < 0) || ++ ((SIZE_MAX/sizeof(struct affent)) < numents)) ++ { ++ fprintf(stderr, ++ "Error: too many entries: %d\n", numents); ++ numents = 0; ++ } else { ++ ptr = malloc(numents * sizeof(struct affent)); ++ ptr->achar = achar; ++ ptr->xpflg = ff; ++ fprintf(stderr,"parsing %c entries %d\n", ++ achar,numents); ++ } + break; + } + default: break; +--- misc/hunspell-1.3.2/src/tools/unmunch.c 2010-02-23 15:53:29.000000000 +0100 ++++ misc/build/hunspell-1.3.2/src/tools/unmunch.c 2011-05-18 20:53:43.843599726 +0200 +@@ -6,6 +6,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -158,10 +159,19 @@ + case 1: { achar = *piece; break; } + case 2: { if (*piece == 'Y') ff = XPRODUCT; break; } + case 3: { numents = atoi(piece); +- ptr = malloc(numents * sizeof(struct affent)); +- ptr->achar = achar; +- ptr->xpflg = ff; +- fprintf(stderr,"parsing %c entries %d\n",achar,numents); ++ if ((numents < 0) || ++ ((SIZE_MAX/sizeof(struct affent)) < numents)) ++ { ++ fprintf(stderr, ++ "Error: too many entries: %d\n", numents); ++ numents = 0; ++ } else { ++ ptr = malloc(numents * sizeof(struct affent)); ++ ptr->achar = achar; ++ ptr->xpflg = ff; ++ fprintf(stderr,"parsing %c entries %d\n", ++ achar,numents); ++ } + break; + } + default: break; diff --git a/external/hunspell/hunspell-android.patch b/external/hunspell/hunspell-android.patch new file mode 100644 index 000000000000..1bfbb4beb0f9 --- /dev/null +++ b/external/hunspell/hunspell-android.patch @@ -0,0 +1,42 @@ +--- misc/hunspell-1.3.2/config.sub 2010-02-23 10:08:48.000000000 +0100 ++++ misc/build/hunspell-1.3.2/config.sub 2011-09-26 23:31:02.000000000 +0200 +@@ -118,7 +118,7 @@ + # Here we must recognize all the valid KERNEL-OS combinations. + maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` + case $maybe_os in +- nto-qnx* | linux-gnu* | linux-dietlibc | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | \ ++ nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | \ + kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*) + os=-$maybe_os + basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` +@@ -1161,7 +1161,7 @@ + | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ + | -chorusos* | -chorusrdb* \ + | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ +- | -mingw32* | -linux-gnu* | -linux-uclibc* | -uxpv* | -beos* | -mpeix* | -udk* \ ++ | -mingw32* | -linux-gnu* | -linux-androideabi* | -linux-uclibc* | -uxpv* | -beos* | -mpeix* | -udk* \ + | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ + | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ + | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ +--- misc/hunspell-1.3.2/src/tools/munch.c ++++ misc/build/hunspell-1.3.2/src/tools/munch.c +@@ -8,7 +8,7 @@ + #include + #include + #include +-#ifdef __linux__ ++#if defined(__linux__) && !defined(__ANDROID__) + #include + #include + #include +--- misc/hunspell-1.3.2/src/tools/unmunch.c ++++ misc/build/hunspell-1.3.2/src/tools/unmunch.c +@@ -8,7 +8,7 @@ + #include + #include + #include +-#ifdef __linux__ ++#if defined(__linux__) && !defined(__ANDROID__) + #include + #include + #include diff --git a/external/hunspell/hunspell-solaris.patch b/external/hunspell/hunspell-solaris.patch new file mode 100644 index 000000000000..b07bbb254c3f --- /dev/null +++ b/external/hunspell/hunspell-solaris.patch @@ -0,0 +1,12 @@ +--- misc/hunspell-1.3.2.orig/src/tools/hunspell.cxx 2010-02-27 23:42:05.000000000 +0000 ++++ misc/build/hunspell-1.3.2/src/tools/hunspell.cxx 2010-02-27 23:43:02.000000000 +0000 +@@ -10,6 +10,9 @@ + #include "hunspell.hxx" + #include "csutil.hxx" + ++// switch off iconv support for tests (fixing Solaris problems) ++#undef HAVE_ICONV ++ + #ifndef HUNSPELL_EXTRA + #define suggest_auto suggest + #endif diff --git a/external/hunspell/hunspell-twoaffixcompound.patch b/external/hunspell/hunspell-twoaffixcompound.patch new file mode 100644 index 000000000000..71881a25ac43 --- /dev/null +++ b/external/hunspell/hunspell-twoaffixcompound.patch @@ -0,0 +1,80 @@ +--- misc/hunspell-1.3.2/src/hunspell/affixmgr.cxx 2010-06-17 15:56:41.000000000 +0200 ++++ misc/build/hunspell-1.3.2/src/hunspell/affixmgr.cxx 2011-02-10 20:47:22.000000000 +0100 +@@ -48,6 +48,7 @@ + compoundroot = FLAG_NULL; // compound word signing flag + compoundpermitflag = FLAG_NULL; // compound permitting flag for suffixed word + compoundforbidflag = FLAG_NULL; // compound fordidden flag for suffixed word ++ compoundmoresuffixes = 0; // allow more suffixes within compound words + checkcompounddup = 0; // forbid double words in compounds + checkcompoundrep = 0; // forbid bad compounds (may be non compound word with a REP substitution) + checkcompoundcase = 0; // forbid upper and lowercase combinations at word bounds +@@ -404,6 +405,10 @@ + } + } + ++ if (strncmp(line,"COMPOUNDMORESUFFIXES",20) == 0) { ++ compoundmoresuffixes = 1; ++ } ++ + if (strncmp(line,"CHECKCOMPOUNDDUP",16) == 0) { + checkcompounddup = 1; + } +@@ -1626,8 +1631,9 @@ + if (onlycpdrule) break; + if (compoundflag && + !(rv = prefix_check(st, i, hu_mov_rule ? IN_CPD_OTHER : IN_CPD_BEGIN, compoundflag))) { +- if ((rv = suffix_check(st, i, 0, NULL, NULL, 0, NULL, +- FLAG_NULL, compoundflag, hu_mov_rule ? IN_CPD_OTHER : IN_CPD_BEGIN)) && !hu_mov_rule && ++ if (((rv = suffix_check(st, i, 0, NULL, NULL, 0, NULL, ++ FLAG_NULL, compoundflag, hu_mov_rule ? IN_CPD_OTHER : IN_CPD_BEGIN)) || ++ (compoundmoresuffixes && (rv = suffix_check_twosfx(st, i, 0, NULL, compoundflag)))) && !hu_mov_rule && + sfx->getCont() && + ((compoundforbidflag && TESTAFF(sfx->getCont(), compoundforbidflag, + sfx->getContLen())) || (compoundend && +@@ -1640,9 +1646,11 @@ + if (rv || + (((wordnum == 0) && compoundbegin && + ((rv = suffix_check(st, i, 0, NULL, NULL, 0, NULL, FLAG_NULL, compoundbegin, hu_mov_rule ? IN_CPD_OTHER : IN_CPD_BEGIN)) || ++ (compoundmoresuffixes && (rv = suffix_check_twosfx(st, i, 0, NULL, compoundbegin))) || // twofold suffixes + compound + (rv = prefix_check(st, i, hu_mov_rule ? IN_CPD_OTHER : IN_CPD_BEGIN, compoundbegin)))) || + ((wordnum > 0) && compoundmiddle && + ((rv = suffix_check(st, i, 0, NULL, NULL, 0, NULL, FLAG_NULL, compoundmiddle, hu_mov_rule ? IN_CPD_OTHER : IN_CPD_BEGIN)) || ++ (compoundmoresuffixes && (rv = suffix_check_twosfx(st, i, 0, NULL, compoundmiddle))) || // twofold suffixes + compound + (rv = prefix_check(st, i, hu_mov_rule ? IN_CPD_OTHER : IN_CPD_BEGIN, compoundmiddle))))) + ) checked_prefix = 1; + // else check forbiddenwords and needaffix +@@ -2118,8 +2126,9 @@ + if (onlycpdrule) break; + if (compoundflag && + !(rv = prefix_check(st, i, hu_mov_rule ? IN_CPD_OTHER : IN_CPD_BEGIN, compoundflag))) { +- if ((rv = suffix_check(st, i, 0, NULL, NULL, 0, NULL, +- FLAG_NULL, compoundflag, hu_mov_rule ? IN_CPD_OTHER : IN_CPD_BEGIN)) && !hu_mov_rule && ++ if (((rv = suffix_check(st, i, 0, NULL, NULL, 0, NULL, ++ FLAG_NULL, compoundflag, hu_mov_rule ? IN_CPD_OTHER : IN_CPD_BEGIN)) || ++ (compoundmoresuffixes && (rv = suffix_check_twosfx(st, i, 0, NULL, compoundflag)))) && !hu_mov_rule && + sfx->getCont() && + ((compoundforbidflag && TESTAFF(sfx->getCont(), compoundforbidflag, + sfx->getContLen())) || (compoundend && +@@ -2132,9 +2141,11 @@ + if (rv || + (((wordnum == 0) && compoundbegin && + ((rv = suffix_check(st, i, 0, NULL, NULL, 0, NULL, FLAG_NULL, compoundbegin, hu_mov_rule ? IN_CPD_OTHER : IN_CPD_BEGIN)) || ++ (compoundmoresuffixes && (rv = suffix_check_twosfx(st, i, 0, NULL, compoundbegin))) || // twofold suffix+compound + (rv = prefix_check(st, i, hu_mov_rule ? IN_CPD_OTHER : IN_CPD_BEGIN, compoundbegin)))) || + ((wordnum > 0) && compoundmiddle && + ((rv = suffix_check(st, i, 0, NULL, NULL, 0, NULL, FLAG_NULL, compoundmiddle, hu_mov_rule ? IN_CPD_OTHER : IN_CPD_BEGIN)) || ++ (compoundmoresuffixes && (rv = suffix_check_twosfx(st, i, 0, NULL, compoundmiddle))) || // twofold suffix+compound + (rv = prefix_check(st, i, hu_mov_rule ? IN_CPD_OTHER : IN_CPD_BEGIN, compoundmiddle))))) + ) { + // char * p = prefix_check_morph(st, i, 0, compound); +--- misc/hunspell-1.3.2/src/hunspell/affixmgr.hxx 2010-06-17 15:56:41.000000000 +0200 ++++ misc/build/hunspell-1.3.2/src/hunspell/affixmgr.hxx 2011-02-10 20:47:22.000000000 +0100 +@@ -41,6 +41,7 @@ + FLAG compoundroot; + FLAG compoundforbidflag; + FLAG compoundpermitflag; ++ int compoundmoresuffixes; + int checkcompounddup; + int checkcompoundrep; + int checkcompoundcase; + diff --git a/external/hunspell/hunspell-wundef.patch.1 b/external/hunspell/hunspell-wundef.patch.1 new file mode 100644 index 000000000000..75131e06a2bc --- /dev/null +++ b/external/hunspell/hunspell-wundef.patch.1 @@ -0,0 +1,11 @@ +--- a/src/hunspell/hunvisapi.h.in 2013-04-01 14:41:16.507546705 +0200 ++++ b/src/hunspell/hunvisapi.h.in 2013-04-01 14:41:24.537547190 +0200 +@@ -9,7 +9,7 @@ + # else + # define LIBHUNSPELL_DLL_EXPORTED __declspec(dllimport) + # endif +-#elif BUILDING_LIBHUNSPELL && @HAVE_VISIBILITY@ ++#elif defined(BUILDING_LIBHUNSPELL) && @HAVE_VISIBILITY@ + # define LIBHUNSPELL_DLL_EXPORTED __attribute__((__visibility__("default"))) + #else + # define LIBHUNSPELL_DLL_EXPORTED diff --git a/external/hunspell/hunspell.rhbz918938.patch b/external/hunspell/hunspell.rhbz918938.patch new file mode 100644 index 000000000000..f1bdbd4ff8ba --- /dev/null +++ b/external/hunspell/hunspell.rhbz918938.patch @@ -0,0 +1,72 @@ +--- misc/hunspell-1.3.2/src/hunspell/hunspell.cxx 2011-02-02 12:04:29.000000000 +0000 ++++ misc/build/hunspell-1.3.2/src/hunspell/hunspell.cxx 2013-03-13 16:50:50.667928521 +0000 +@@ -12,6 +12,8 @@ + #endif + #include "csutil.hxx" + ++#include ++ + Hunspell::Hunspell(const char * affpath, const char * dpath, const char * key) + { + encoding = NULL; +@@ -1710,6 +1712,19 @@ + return n; + } + ++namespace ++{ ++ void myrep(std::string& str, const std::string& search, const std::string& replace) ++ { ++ size_t pos = 0; ++ while ((pos = str.find(search, pos)) != std::string::npos) ++ { ++ str.replace(pos, search.length(), replace); ++ pos += replace.length(); ++ } ++ } ++} ++ + int Hunspell::spellml(char*** slst, const char * word) + { + char *q, *q2; +@@ -1721,26 +1736,26 @@ + q2 = strstr(q2, "'), MAXWORDUTF8LEN - 10)) n = analyze(slst, cw); + if (n == 0) return 0; + // convert the result to ana1ana2 format +- for (int i = 0; i < n; i++) s+= strlen((*slst)[i]); +- char * r = (char *) malloc(6 + 5 * s + 7 * n + 7 + 1); // XXX 5*s->&->& +- if (!r) return 0; +- strcpy(r, ""); ++ std::string r; ++ r.append(""); + for (int i = 0; i < n; i++) { +- int l = strlen(r); +- strcpy(r + l, ""); +- strcpy(r + l + 3, (*slst)[i]); +- mystrrep(r + l + 3, "\t", " "); +- mystrrep(r + l + 3, "<", "<"); +- mystrrep(r + l + 3, "&", "&"); +- strcat(r, ""); ++ r.append(""); ++ ++ std::string entry((*slst)[i]); + free((*slst)[i]); ++ myrep(entry, "\t", " "); ++ myrep(entry, "&", "&"); ++ myrep(entry, "<", "<"); ++ r.append(entry); ++ ++ r.append(""); + } +- strcat(r, ""); +- (*slst)[0] = r; ++ r.append(""); ++ (*slst)[0] = mystrdup(r.c_str()); + return 1; + } else if (check_xml_par(q, "type=", "stem")) { + if (get_xml_par(cw, strchr(q2, '>'), MAXWORDUTF8LEN - 1)) return stem(slst, cw); -- cgit