diff options
Diffstat (limited to 'external/libnumbertext')
-rw-r--r-- | external/libnumbertext/ExternalPackage_numbertext.mk | 61 | ||||
-rw-r--r-- | external/libnumbertext/ExternalProject_libnumbertext.mk | 42 | ||||
-rw-r--r-- | external/libnumbertext/MSVCNonBMPBug.patch1 | 69 | ||||
-rw-r--r-- | external/libnumbertext/Makefile | 7 | ||||
-rw-r--r-- | external/libnumbertext/Module_libnumbertext.mk | 32 | ||||
-rw-r--r-- | external/libnumbertext/README | 3 | ||||
-rw-r--r-- | external/libnumbertext/StaticLibrary_libnumbertext.mk | 22 | ||||
-rw-r--r-- | external/libnumbertext/UnpackedTarball_libnumbertext.mk | 22 |
8 files changed, 258 insertions, 0 deletions
diff --git a/external/libnumbertext/ExternalPackage_numbertext.mk b/external/libnumbertext/ExternalPackage_numbertext.mk new file mode 100644 index 000000000..5379d08fc --- /dev/null +++ b/external/libnumbertext/ExternalPackage_numbertext.mk @@ -0,0 +1,61 @@ +# -*- 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_ExternalPackage_ExternalPackage,libnumbertext_numbertext,libnumbertext)) + +$(eval $(call gb_ExternalPackage_add_unpacked_files,libnumbertext_numbertext,$(LIBO_SHARE_FOLDER)/numbertext,\ + data/af.sor \ + data/bg.sor \ + data/ca.sor \ + data/cs.sor \ + data/da.sor \ + data/de.sor \ + data/el.sor \ + data/en.sor \ + data/eo.sor \ + data/es.sor \ + data/et.sor \ + data/fi.sor \ + data/fr.sor \ + data/fr.sor \ + data/gl.sor \ + data/he.sor \ + data/hr.sor \ + data/hu.sor \ + data/hu_Hung.sor \ + data/id.sor \ + data/is.sor \ + data/it.sor \ + data/ja.sor \ + data/ko.sor \ + data/lb.sor \ + data/lt.sor \ + data/lv.sor \ + data/ms.sor \ + data/no.sor \ + data/nl.sor \ + data/pl.sor \ + data/pt.sor \ + data/Roman.sor \ + data/ro.sor \ + data/ru.sor \ + data/sh.sor \ + data/sl.sor \ + data/sq.sor \ + data/sr.sor \ + data/Suzhou.sor \ + data/sv.sor \ + data/th.sor \ + data/tr.sor \ + data/uk.sor \ + data/vi.sor \ + data/zh.sor \ +)) + +# vim: set noet sw=4 ts=4: diff --git a/external/libnumbertext/ExternalProject_libnumbertext.mk b/external/libnumbertext/ExternalProject_libnumbertext.mk new file mode 100644 index 000000000..f4dbe5f65 --- /dev/null +++ b/external/libnumbertext/ExternalProject_libnumbertext.mk @@ -0,0 +1,42 @@ +# -*- 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,libnumbertext)) + +$(eval $(call gb_ExternalProject_use_externals,libnumbertext, \ +)) + +$(eval $(call gb_ExternalProject_register_targets,libnumbertext,\ + build \ +)) + +libnumbertext_CXXFLAGS=$(CXXFLAGS) $(CXXFLAGS_CXX11) + +ifneq (,$(filter ANDROID DRAGONFLY FREEBSD iOS LINUX NETBSD OPENBSD,$(OS))) +ifneq (,$(gb_ENABLE_DBGUTIL)) +libnumbertext_CPPFLAGS+=-D_GLIBCXX_DEBUG +endif +endif + +$(call gb_ExternalProject_get_state_target,libnumbertext,build): + $(call gb_Trace_StartRange,libnumbertext,EXTERNAL) + $(call gb_ExternalProject_run,build,\ + LIBS="$(gb_STDLIBS) $(LIBS)" \ + $(SHELL) ./configure --disable-shared --with-pic \ + $(if $(verbose),--disable-silent-rules,--enable-silent-rules) \ + $(if $(ENABLE_WERROR),--enable-werror,--disable-werror) \ + $(if $(CROSS_COMPILING),--build=$(BUILD_PLATFORM) --host=$(HOST_PLATFORM))\ + $(if $(filter AIX,$(OS)),CFLAGS="-D_LINUX_SOURCE_COMPAT") \ + $(if $(libnumbertext_CPPFLAGS),CPPFLAGS='$(libnumbertext_CPPFLAGS)') \ + CXXFLAGS="$(libnumbertext_CXXFLAGS) $(if $(ENABLE_OPTIMIZED),$(gb_COMPILEROPTFLAGS),$(gb_COMPILERNOOPTFLAGS)) $(if $(debug),$(gb_DEBUGINFO_FLAGS)) $(gb_VISIBILITY_FLAGS) $(gb_VISIBILITY_FLAGS_CXX)" \ + && cd src && $(MAKE) \ + ) + $(call gb_Trace_EndRange,libnumbertext,EXTERNAL) + +# vim: set noet sw=4 ts=4: diff --git a/external/libnumbertext/MSVCNonBMPBug.patch1 b/external/libnumbertext/MSVCNonBMPBug.patch1 new file mode 100644 index 000000000..8ced22165 --- /dev/null +++ b/external/libnumbertext/MSVCNonBMPBug.patch1 @@ -0,0 +1,69 @@ +MSVC's std::codecvt_utf8 has a bug converting non-BMP codepoints like U+10CFA. +Use MultiByteToWideChar/WideCharToMultiByte instead on Windows. + +diff --git a/src/Numbertext.cxx b/src/Numbertext.cxx +index 5f05b48579af..eb83e59f366f 100755 +--- a/src/Numbertext.cxx ++++ b/src/Numbertext.cxx +@@ -7,6 +7,10 @@ + #include <sstream> + #include <fstream> + ++#ifdef _WIN32 ++#include <Windows.h> ++#endif ++ + #include "Numbertext.hxx" + + #ifdef NUMBERTEXT_BOOST +@@ -22,6 +26,14 @@ + + bool readfile(const std::string& filename, std::wstring& result) + { ++#ifdef _WIN32 ++ std::ifstream ifs(filename); ++ if (ifs.fail()) ++ return false; ++ std::stringstream ss; ++ ss << ifs.rdbuf(); ++ result = Numbertext::string2wstring(ss.str()); ++#else + std::wifstream wif(filename); + if (wif.fail()) + return false; +@@ -29,6 +44,7 @@ bool readfile(const std::string& filename, std::wstring& result) + std::wstringstream wss; + wss << wif.rdbuf(); + result = wss.str(); ++#endif + return true; + } + +@@ -99,7 +112,12 @@ + + std::wstring Numbertext::string2wstring(const std::string& s) + { +-#ifndef NUMBERTEXT_BOOST ++#ifdef _WIN32 ++ int nSize = MultiByteToWideChar(CP_UTF8, 0, s.c_str(), -1, nullptr, 0); ++ std::unique_ptr<wchar_t[]> wstr(new wchar_t[nSize]); ++ MultiByteToWideChar(CP_UTF8, 0, s.c_str(), -1, wstr.get(), nSize); ++ return wstr.get(); ++#elif !defined NUMBERTEXT_BOOST + typedef std::codecvt_utf8<wchar_t> convert_type; + std::wstring_convert<convert_type, wchar_t> converter; + return converter.from_bytes( s ); +@@ -110,7 +128,12 @@ + + std::string Numbertext::wstring2string(const std::wstring& s) + { +-#ifndef NUMBERTEXT_BOOST ++#ifdef _WIN32 ++ int nSize = WideCharToMultiByte(CP_UTF8, 0, s.c_str(), -1, nullptr, 0, nullptr, nullptr); ++ std::unique_ptr<char[]> str(new char[nSize]); ++ WideCharToMultiByte(CP_UTF8, 0, s.c_str(), -1, str.get(), nSize, nullptr, nullptr); ++ return str.get(); ++#elif !defined NUMBERTEXT_BOOST + typedef std::codecvt_utf8<wchar_t> convert_type; + std::wstring_convert<convert_type, wchar_t> converter; + return converter.to_bytes( s ); diff --git a/external/libnumbertext/Makefile b/external/libnumbertext/Makefile new file mode 100644 index 000000000..e4968cf85 --- /dev/null +++ b/external/libnumbertext/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/libnumbertext/Module_libnumbertext.mk b/external/libnumbertext/Module_libnumbertext.mk new file mode 100644 index 000000000..1bca2233c --- /dev/null +++ b/external/libnumbertext/Module_libnumbertext.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_Module_Module,libnumbertext)) + +$(eval $(call gb_Module_add_targets,libnumbertext,\ + ExternalPackage_numbertext \ + UnpackedTarball_libnumbertext \ +)) +ifeq ($(COM),MSC) +$(eval $(call gb_Module_add_targets,libnumbertext,\ + StaticLibrary_libnumbertext \ +)) +else + +ifeq ($(ENABLE_LIBNUMBERTEXT),TRUE) + +$(eval $(call gb_Module_add_targets,libnumbertext,\ + ExternalProject_libnumbertext \ +)) + +endif + +endif + +# vim: set noet sw=4 ts=4: diff --git a/external/libnumbertext/README b/external/libnumbertext/README new file mode 100644 index 000000000..922f19df1 --- /dev/null +++ b/external/libnumbertext/README @@ -0,0 +1,3 @@ +Number to Number Name Conversion Library + +It is hosted at: [https://github.com/Numbertext/libnumbertext] diff --git a/external/libnumbertext/StaticLibrary_libnumbertext.mk b/external/libnumbertext/StaticLibrary_libnumbertext.mk new file mode 100644 index 000000000..78b384a55 --- /dev/null +++ b/external/libnumbertext/StaticLibrary_libnumbertext.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,libnumbertext)) + +$(eval $(call gb_StaticLibrary_use_unpacked,libnumbertext,libnumbertext)) + +$(eval $(call gb_StaticLibrary_set_warnings_disabled,libnumbertext)) + +$(eval $(call gb_StaticLibrary_add_generated_exception_objects,libnumbertext,\ + UnpackedTarball/libnumbertext/src/Soros \ + UnpackedTarball/libnumbertext/src/Numbertext \ +)) + + +# vim: set noet sw=4 ts=4: diff --git a/external/libnumbertext/UnpackedTarball_libnumbertext.mk b/external/libnumbertext/UnpackedTarball_libnumbertext.mk new file mode 100644 index 000000000..d2efd2f85 --- /dev/null +++ b/external/libnumbertext/UnpackedTarball_libnumbertext.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_UnpackedTarball_UnpackedTarball,libnumbertext)) + +$(eval $(call gb_UnpackedTarball_set_tarball,libnumbertext,$(LIBNUMBERTEXT_TARBALL))) + +$(eval $(call gb_UnpackedTarball_update_autoconf_configs,libnumbertext)) + +$(eval $(call gb_UnpackedTarball_set_patchlevel,libnumbertext,1)) + +$(eval $(call gb_UnpackedTarball_add_patches,libnumbertext, \ + external/libnumbertext/MSVCNonBMPBug.patch1 \ +)) + +# vim: set noet sw=4 ts=4: |