summaryrefslogtreecommitdiffstats
path: root/external/hyphen
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--external/hyphen/ExternalProject_hyphen.mk28
-rw-r--r--external/hyphen/Makefile7
-rw-r--r--external/hyphen/Module_hyphen.mk30
-rw-r--r--external/hyphen/README1
-rw-r--r--external/hyphen/StaticLibrary_hyphen.mk22
-rw-r--r--external/hyphen/UnpackedTarball_hyphen.mk21
-rw-r--r--external/hyphen/hyphen-build.patch38
-rw-r--r--external/hyphen/hyphen-fdo48017-wfopen.patch49
8 files changed, 196 insertions, 0 deletions
diff --git a/external/hyphen/ExternalProject_hyphen.mk b/external/hyphen/ExternalProject_hyphen.mk
new file mode 100644
index 000000000..21cef66d8
--- /dev/null
+++ b/external/hyphen/ExternalProject_hyphen.mk
@@ -0,0 +1,28 @@
+# -*- 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,hyphen))
+
+$(eval $(call gb_ExternalProject_use_external,hyphen,hunspell))
+
+$(eval $(call gb_ExternalProject_register_targets,hyphen,\
+ build \
+))
+
+$(call gb_ExternalProject_get_state_target,hyphen,build):
+ $(call gb_Trace_StartRange,hyphen,EXTERNAL)
+ $(call gb_ExternalProject_run,build,\
+ ./configure --disable-shared \
+ $(if $(filter-out iOS,$(OS)),--with-pic) \
+ $(if $(CROSS_COMPILING),--build=$(BUILD_PLATFORM) --host=$(HOST_PLATFORM) gio_can_sniff=no) \
+ && $(MAKE) \
+ )
+ $(call gb_Trace_EndRange,hyphen,EXTERNAL)
+
+# vim: set noet sw=4 ts=4:
diff --git a/external/hyphen/Makefile b/external/hyphen/Makefile
new file mode 100644
index 000000000..e4968cf85
--- /dev/null
+++ b/external/hyphen/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/hyphen/Module_hyphen.mk b/external/hyphen/Module_hyphen.mk
new file mode 100644
index 000000000..527def321
--- /dev/null
+++ b/external/hyphen/Module_hyphen.mk
@@ -0,0 +1,30 @@
+# -*- 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,hyphen))
+
+$(eval $(call gb_Module_add_targets,hyphen,\
+ UnpackedTarball_hyphen \
+))
+
+ifeq ($(COM),MSC)
+
+$(eval $(call gb_Module_add_targets,hyphen,\
+ StaticLibrary_hyphen \
+))
+
+else
+
+$(eval $(call gb_Module_add_targets,hyphen,\
+ ExternalProject_hyphen \
+))
+
+endif # $(COM)
+
+# vim: set noet sw=4 ts=4:
diff --git a/external/hyphen/README b/external/hyphen/README
new file mode 100644
index 000000000..327b5b6e8
--- /dev/null
+++ b/external/hyphen/README
@@ -0,0 +1 @@
+Hyphenator library from [http://hunspell.sourceforge.net]
diff --git a/external/hyphen/StaticLibrary_hyphen.mk b/external/hyphen/StaticLibrary_hyphen.mk
new file mode 100644
index 000000000..e911feb9b
--- /dev/null
+++ b/external/hyphen/StaticLibrary_hyphen.mk
@@ -0,0 +1,22 @@
+# -*- 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,hyphen))
+
+$(eval $(call gb_StaticLibrary_use_unpacked,hyphen,hyphen))
+
+$(eval $(call gb_StaticLibrary_set_warnings_disabled,hyphen))
+
+$(eval $(call gb_StaticLibrary_add_generated_cobjects,hyphen,\
+ UnpackedTarball/hyphen/hyphen \
+ UnpackedTarball/hyphen/hnjalloc \
+))
+
+
+# vim: set noet sw=4 ts=4:
diff --git a/external/hyphen/UnpackedTarball_hyphen.mk b/external/hyphen/UnpackedTarball_hyphen.mk
new file mode 100644
index 000000000..c4bbb0226
--- /dev/null
+++ b/external/hyphen/UnpackedTarball_hyphen.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,hyphen))
+
+$(eval $(call gb_UnpackedTarball_set_tarball,hyphen,$(HYPHEN_TARBALL)))
+
+$(eval $(call gb_UnpackedTarball_update_autoconf_configs,hyphen))
+
+$(eval $(call gb_UnpackedTarball_add_patches,hyphen,\
+ external/hyphen/hyphen-build.patch \
+ external/hyphen/hyphen-fdo48017-wfopen.patch \
+))
+
+# vim: set noet sw=4 ts=4:
diff --git a/external/hyphen/hyphen-build.patch b/external/hyphen/hyphen-build.patch
new file mode 100644
index 000000000..6df2bb680
--- /dev/null
+++ b/external/hyphen/hyphen-build.patch
@@ -0,0 +1,38 @@
+--- misc/hyphen-2.8.4/Makefile.am 2010-07-19 11:23:17.000000000 +0200
++++ misc/build/hyphen-2.8.4/Makefile.am 2010-12-02 10:15:44.390625000 +0100
+@@ -25,13 +25,13 @@
+
+ hyphen.us3:
+ cp -f $(srcdir)/hyphen.tex hyphen.us
+- patch < $(srcdir)/hyphen.patch
++ $(GNUPATCH) < $(srcdir)/hyphen.patch
+ $(srcdir)/tbhyphext.sh <$(srcdir)/tbhyphext.tex >hyphen.us2
+ cat hyphen.us hyphen.us2 | $(AWK) -f $(srcdir)/lig.awk >hyphen.us3
+ cat $(srcdir)/ligpatch.txt >>hyphen.us3
+
+-hyph_en_US.dic: hyphen.us3
+- perl $(srcdir)/substrings.pl hyphen.us3 hyph_en_US.dic UTF-8 2 3 >/dev/null
++hyph_en_US.dic:
++ @echo "hyph_en_US.txt distributed with Hyphen library"
+
+ clean-local:
+ rm -rf hyphen.us* hyph_en_US.dic
+--- misc/hyphen-2.8.4/Makefile.in 2010-12-01 02:31:29.000000000 +0100
++++ misc/build/hyphen-2.8.4/Makefile.in 2010-12-02 10:17:16.546875000 +0100
+@@ -940,13 +940,13 @@
+
+ hyphen.us3:
+ cp -f $(srcdir)/hyphen.tex hyphen.us
+- patch < $(srcdir)/hyphen.patch
++ $(GNUPATCH) < $(srcdir)/hyphen.patch
+ $(srcdir)/tbhyphext.sh <$(srcdir)/tbhyphext.tex >hyphen.us2
+ cat hyphen.us hyphen.us2 | $(AWK) -f $(srcdir)/lig.awk >hyphen.us3
+ cat $(srcdir)/ligpatch.txt >>hyphen.us3
+
+-hyph_en_US.dic: hyphen.us3
+- perl $(srcdir)/substrings.pl hyphen.us3 hyph_en_US.dic UTF-8 2 3 >/dev/null
++hyph_en_US.dic:
++ @echo "hyph_en_US.txt distributed with Hyphen library"
+
+ clean-local:
+ rm -rf hyphen.us* hyph_en_US.dic
diff --git a/external/hyphen/hyphen-fdo48017-wfopen.patch b/external/hyphen/hyphen-fdo48017-wfopen.patch
new file mode 100644
index 000000000..815eeda79
--- /dev/null
+++ b/external/hyphen/hyphen-fdo48017-wfopen.patch
@@ -0,0 +1,49 @@
+diff -u hyphen/hyphen.c build/hyphen/hyphen.c
+--- hyphen/hyphen.c 2014-05-22 00:28:13.164587974 +0200
++++ build/hyphen/hyphen.c 2015-05-22 11:08:55.000000000 +0200
+@@ -44,6 +44,11 @@
+ #include <unistd.h> /* for exit */
+ #endif
+
++#ifdef _WIN32
++#include <windows.h>
++#include <wchar.h>
++#endif
++
+ #define noVERBOSE
+
+ /* calculate hyphenmin values with long ligature length (2 or 3 characters
+@@ -371,12 +376,32 @@
+ }
+ }
+
++FILE * hnj_fopen(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);
++}
++
+ HyphenDict *
+ hnj_hyphen_load (const char *fn)
+ {
+ HyphenDict *result;
+ FILE *f;
+- f = fopen (fn, "r");
++ f = hnj_fopen (fn, "r");
+ if (f == NULL)
+ return NULL;
+