summaryrefslogtreecommitdiffstats
path: root/external/mythes
diff options
context:
space:
mode:
Diffstat (limited to 'external/mythes')
-rw-r--r--external/mythes/ExternalProject_mythes.mk32
-rw-r--r--external/mythes/Makefile7
-rw-r--r--external/mythes/Module_mythes.mk25
-rw-r--r--external/mythes/README1
-rw-r--r--external/mythes/StaticLibrary_mythes.mk21
-rw-r--r--external/mythes/UnpackedTarball_mythes.mk21
-rw-r--r--external/mythes/mythes-1.2.0-vanilla-th-gen-idx.patch90
-rw-r--r--external/mythes/mythes-fdo48017-wfopen.patch77
8 files changed, 274 insertions, 0 deletions
diff --git a/external/mythes/ExternalProject_mythes.mk b/external/mythes/ExternalProject_mythes.mk
new file mode 100644
index 000000000..b0e0a6bbd
--- /dev/null
+++ b/external/mythes/ExternalProject_mythes.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_ExternalProject_ExternalProject,mythes))
+
+ifneq ($(ENABLE_WASM_STRIP_HUNSPELL),TRUE)
+$(eval $(call gb_ExternalProject_use_external,mythes,hunspell))
+endif
+
+$(eval $(call gb_ExternalProject_register_targets,mythes,\
+ build \
+))
+
+$(call gb_ExternalProject_get_state_target,mythes,build):
+ $(call gb_Trace_StartRange,mythes,EXTERNAL)
+ $(call gb_ExternalProject_run,build,\
+ CXXFLAGS=" $(CXXFLAGS) $(call gb_ExternalProject_get_build_flags,mythes)" \
+ LDFLAGS="$(call gb_ExternalProject_get_link_flags,mythes)" \
+ LIBS="$(gb_STDLIBS) $(LIBS)" $(gb_RUN_CONFIGURE) ./configure --disable-shared --with-pic \
+ $(gb_CONFIGURE_PLATFORMS) \
+ $(if $(CROSS_COMPILING),gio_can_sniff=no) \
+ && $(MAKE) \
+ )
+ $(call gb_Trace_EndRange,mythes,EXTERNAL)
+
+# vim: set noet sw=4 ts=4:
diff --git a/external/mythes/Makefile b/external/mythes/Makefile
new file mode 100644
index 000000000..e4968cf85
--- /dev/null
+++ b/external/mythes/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/mythes/Module_mythes.mk b/external/mythes/Module_mythes.mk
new file mode 100644
index 000000000..56d95fc91
--- /dev/null
+++ b/external/mythes/Module_mythes.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,mythes))
+
+$(eval $(call gb_Module_add_targets,mythes,\
+ UnpackedTarball_mythes \
+))
+ifeq ($(COM),MSC)
+$(eval $(call gb_Module_add_targets,mythes,\
+ StaticLibrary_mythes \
+))
+else
+$(eval $(call gb_Module_add_targets,mythes,\
+ ExternalProject_mythes \
+))
+endif
+
+# vim: set noet sw=4 ts=4:
diff --git a/external/mythes/README b/external/mythes/README
new file mode 100644
index 000000000..8a1792ee0
--- /dev/null
+++ b/external/mythes/README
@@ -0,0 +1 @@
+Library for handling thesaurus files from [http://hunspell.sourceforge.net].
diff --git a/external/mythes/StaticLibrary_mythes.mk b/external/mythes/StaticLibrary_mythes.mk
new file mode 100644
index 000000000..74a9e07c4
--- /dev/null
+++ b/external/mythes/StaticLibrary_mythes.mk
@@ -0,0 +1,21 @@
+# -*- 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,mythes))
+
+$(eval $(call gb_StaticLibrary_use_unpacked,mythes,mythes))
+
+$(eval $(call gb_StaticLibrary_set_warnings_disabled,mythes))
+
+$(eval $(call gb_StaticLibrary_add_generated_exception_objects,mythes,\
+ UnpackedTarball/mythes/mythes \
+))
+
+
+# vim: set noet sw=4 ts=4:
diff --git a/external/mythes/UnpackedTarball_mythes.mk b/external/mythes/UnpackedTarball_mythes.mk
new file mode 100644
index 000000000..cba16fd56
--- /dev/null
+++ b/external/mythes/UnpackedTarball_mythes.mk
@@ -0,0 +1,21 @@
+# -*- 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,mythes))
+
+$(eval $(call gb_UnpackedTarball_set_tarball,mythes,$(MYTHES_TARBALL)))
+
+$(eval $(call gb_UnpackedTarball_update_autoconf_configs,mythes))
+
+$(eval $(call gb_UnpackedTarball_add_patches,mythes,\
+ external/mythes/mythes-1.2.0-vanilla-th-gen-idx.patch \
+ external/mythes/mythes-fdo48017-wfopen.patch \
+))
+
+# vim: set noet sw=4 ts=4:
diff --git a/external/mythes/mythes-1.2.0-vanilla-th-gen-idx.patch b/external/mythes/mythes-1.2.0-vanilla-th-gen-idx.patch
new file mode 100644
index 000000000..3752e2912
--- /dev/null
+++ b/external/mythes/mythes-1.2.0-vanilla-th-gen-idx.patch
@@ -0,0 +1,90 @@
+--- misc/mythes-1.2.3.orig/th_gen_idx.pl
++++ misc/build/mythes-1.2.3/th_gen_idx.pl
+@@ -1,11 +1,25 @@
+-#!/usr/bin/perl
+-
+-# perl program to take a thesaurus structured text data file
+-# and create the proper sorted index file (.idx)
++:
++eval 'exec perl -wS $0 ${1+"$@"}'
++ if 0;
++#
++# 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/.
++#
++# This file incorporates work covered by the following license notice:
++#
++# Licensed to the Apache Software Foundation (ASF) under one or more
++# contributor license agreements. See the NOTICE file distributed
++# with this work for additional information regarding copyright
++# ownership. The ASF licenses this file to you under the Apache
++# License, Version 2.0 (the "License"); you may not use this file
++# except in compliance with the License. You may obtain a copy of
++# the License at http://www.apache.org/licenses/LICENSE-2.0 .
++#
+ #
+-# typically invoked as follows:
+-# cat th_en_US_new.dat | ./th_gen_idx.pl > th_en_US_new.idx
+ #
+
+ sub by_entry {
+ my ($aent, $aoff) = split('\|',$a);
+@@ -13,6 +34,27 @@ sub by_entry {
+ $aent cmp $bent;
+ }
+
++#FIXME: someone may want "infile" or even parameter parsing
++sub get_outfile {
++ my $next_is_file = 0;
++ foreach ( @ARGV ) {
++ if ( $next_is_file ) {
++ return $_
++ }
++ if ( $_ eq "-o" ) {
++ $next_is_file = 1;
++ }
++ }
++ return "";
++}
++
++sub usage {
++ print "usage:\n";
++ print "$0 -o outfile < input\n";
++
++ exit 99;
++}
++
+ # main routine
+ my $ne = 0; # number of entries in index
+ my @tindex=(); # the index itself
+@@ -24,6 +66,10 @@ my $nm=0; # number of meaning fo
+ my $meaning=""; # current meaning and synonyms
+ my $p; # misc uses
+ my $encoding; # encoding used by text file
++my $outfile = "";
++
++$outfile = get_outfile();
++usage() if ( $outfile eq "" );
+
+ # top line of thesaurus provides encoding
+ $encoding=<STDIN>;
+@@ -51,9 +97,13 @@ while ($rec=<STDIN>){
+ # now we have all of the information
+ # so sort it and then output the encoding, count and index data
+ @tindex = sort by_entry @tindex;
+-print STDOUT "$encoding\n";
+-print STDOUT "$ne\n";
++
++print "$outfile\n";
++open OUTFILE, ">$outfile" or die "ERROR: Can't open $outfile for writing!";
++print OUTFILE "$encoding\n";
++print OUTFILE "$ne\n";
+ foreach $one (@tindex) {
+- print STDOUT "$one\n";
++ print OUTFILE "$one\n";
+ }
++close OUTFILE;
+
diff --git a/external/mythes/mythes-fdo48017-wfopen.patch b/external/mythes/mythes-fdo48017-wfopen.patch
new file mode 100644
index 000000000..82d69ad66
--- /dev/null
+++ b/external/mythes/mythes-fdo48017-wfopen.patch
@@ -0,0 +1,77 @@
+diff -u mythes/mythes.cxx build/mythes/mythes.cxx
+--- mythes/mythes.cxx 2014-05-22 00:27:38.508588487 +0200
++++ build/mythes/mythes.cxx 2014-05-22 10:07:06.107547417 +0200
+@@ -8,6 +8,11 @@
+
+ #include "mythes.hxx"
+
++#ifdef _WIN32
++#include <windows.h>
++#include <wchar.h>
++#endif
++
+ MyThes::MyThes(const char* idxpath, const char * datpath)
+ {
+ nw = 0;
+@@ -35,7 +40,7 @@
+ {
+
+ // open the index file
+- FILE * pifile = fopen(idxpath,"r");
++ FILE * pifile = myfopen(idxpath,"r");
+ if (!pifile) {
+ return 0;
+ }
+@@ -90,7 +95,7 @@
+ fclose(pifile);
+
+ /* next open the data file */
+- pdfile = fopen(datpath,"r");
++ pdfile = myfopen(datpath,"r");
+ if (!pdfile) {
+ return 0;
+ }
+@@ -373,3 +378,22 @@
+ return -1;
+ }
+
++FILE * MyThes::myfopen(const char * path, const char * mode) {
++#ifdef _WIN32
++#define WIN32_LONG_PATH_PREFIX "\\\\?\\"
++ if (strncmp(path, WIN32_LONG_PATH_PREFIX, 4) == 0) {
++ int len = MultiByteToWideChar(CP_UTF8, 0, path, -1, NULL, 0);
++ wchar_t *buff = (wchar_t *) malloc(len * sizeof(wchar_t));
++ wchar_t *buff2 = (wchar_t *) malloc(len * sizeof(wchar_t));
++ FILE * f = NULL;
++ MultiByteToWideChar(CP_UTF8, 0, path, -1, buff, len);
++ if (_wfullpath( buff2, buff, len ) != NULL) {
++ f = _wfopen(buff2, (strcmp(mode, "r") == 0) ? L"r" : L"rb");
++ }
++ free(buff);
++ free(buff2);
++ return f;
++ }
++#endif
++ return fopen(path, mode);
++}
+diff -u mythes/mythes.hxx build/mythes/mythes.hxx
+--- mythes/mythes.hxx 2010-03-04 12:56:23.000000000 +0100
++++ build/mythes/mythes.hxx 2014-05-22 10:11:14.363543731 +0200
+@@ -30,6 +30,7 @@
+ MyThes & operator = (const MyThes &);
+
+ public:
++ // use UTF-8 encoded paths in WIN32 environment
+ MyThes(const char* idxpath, const char* datpath);
+ ~MyThes();
+
+@@ -66,6 +67,9 @@
+ // return index of char in string
+ int mystr_indexOfChar(const char * d, int c);
+
++ // fopen or _wfopen
++ FILE * myfopen(const char * path, const char * mode);
++
+ };
+
+ #endif