From dceb440f6fde4cf93e4059ddd183d1293ff5fee3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= Date: Tue, 21 Feb 2017 11:24:02 +0000 Subject: [PATCH] allow disabling liblangtag for internal libetonyek Change-Id: I3a649f3460759cbcd290cef2e90398b2868983a9 --- configure.ac | 4 +- .../libetonyek/UnpackedTarball_libetonyek.mk | 1 + ...etonyek-support-disable-liblangtag.patch.0 | 130 ++++++++++++++++++ 3 files changed, 132 insertions(+), 3 deletions(-) create mode 100644 external/libetonyek/libetonyek-support-disable-liblangtag.patch.0 diff --git a/configure.ac b/configure.ac index 42bab2e99e76..4f3872e737e7 100644 --- a/configure.ac +++ b/configure.ac @@ -11581,10 +11581,8 @@ if test "$enable_liblangtag" = "yes" -o "$enable_liblangtag" = ""; then fi AC_DEFINE(ENABLE_LIBLANGTAG) else - if test "x$SYSTEM_ETONYEK" = "x"; then - AC_MSG_ERROR([internal libetonyek requires liblangtag]) - fi AC_MSG_RESULT([no]) + LIBLANGTAG_CFLAGS="-DDISABLE_LIBLANGTAG" fi AC_SUBST(ENABLE_LIBLANGTAG) AC_SUBST(SYSTEM_LIBLANGTAG) diff --git a/external/libetonyek/UnpackedTarball_libetonyek.mk b/external/libetonyek/UnpackedTarball_libetonyek.mk index eba2f6a8b574..e95fb13348e6 100644 --- a/external/libetonyek/UnpackedTarball_libetonyek.mk +++ b/external/libetonyek/UnpackedTarball_libetonyek.mk @@ -24,6 +24,7 @@ ifneq ($(OS),MACOSX) ifneq ($(OS),WNT) $(eval $(call gb_UnpackedTarball_add_patches,libetonyek,\ external/libetonyek/libetonyek-bundled-soname.patch.0 \ + external/libetonyek/libetonyek-support-disable-liblangtag.patch.0 \ )) endif endif diff --git a/external/libetonyek/libetonyek-support-disable-liblangtag.patch.0 b/external/libetonyek/libetonyek-support-disable-liblangtag.patch.0 new file mode 100644 index 000000000000..9f1db3f6761c --- /dev/null +++ b/external/libetonyek/libetonyek-support-disable-liblangtag.patch.0 @@ -0,0 +1,130 @@ +--- src/lib/IWORKLanguageManager.cpp.orig 2017-02-21 10:28:39.646017140 +0000 ++++ src/lib/IWORKLanguageManager.cpp 2017-02-21 10:29:26.601817549 +0000 +@@ -12,7 +12,9 @@ + #include + #include + ++#if !defined(DISABLE_LIBLANGTAG) + #include ++#endif + + #include "libetonyek_utils.h" + +@@ -27,6 +29,7 @@ + + using std::string; + ++#if !defined(DISABLE_LIBLANGTAG) + namespace + { + +@@ -56,6 +59,7 @@ + } + + } ++#endif + + struct IWORKLanguageManager::LangDB + { +@@ -67,6 +71,7 @@ + IWORKLanguageManager::LangDB::LangDB() + : m_db() + { ++#if !defined(DISABLE_LIBLANGTAG) + shared_ptr langDB(lt_db_get_lang(), lt_lang_db_unref); + shared_ptr it(LT_ITER_INIT(langDB.get()), lt_iter_finish); + lt_pointer_t key(0); +@@ -77,6 +82,7 @@ + lt_lang_t *const lang = reinterpret_cast(value); + m_db[lt_lang_get_name(lang)] = tag; + } ++#endif + } + + IWORKLanguageManager::IWORKLanguageManager() +@@ -102,6 +108,10 @@ + if (invIt != m_invalidTags.end()) + return ""; + ++#if defined(DISABLE_LIBLANGTAG) ++ m_invalidTags.insert(tag); ++ return ""; ++#else + const shared_ptr &langTag = parseTag(tag); + if (!langTag) + { +@@ -114,6 +124,7 @@ + addProperties(fullTag); + + return fullTag; ++#endif + } + + const std::string IWORKLanguageManager::addLanguage(const std::string &lang) +@@ -134,6 +145,10 @@ + return ""; + } + ++#if defined(DISABLE_LIBLANGTAG) ++ m_invalidLangs.insert(lang); ++ return ""; ++#else + const shared_ptr &langTag = parseTag(langIt->second); + if (!langTag) + throw std::logic_error("cannot parse tag that came from liblangtag language DB"); +@@ -143,6 +158,7 @@ + addProperties(fullTag); + + return fullTag; ++#endif + } + + const std::string IWORKLanguageManager::addLocale(const std::string &locale) +@@ -156,6 +172,9 @@ + if (invIt != m_invalidLocales.end()) + return ""; + ++#if defined(DISABLE_LIBLANGTAG) ++ return ""; ++#else + lt_error_t *error = 0; + const shared_ptr tag(lt_tag_convert_from_locale_string(locale.c_str(), &error), lt_tag_unref); + if ((error && lt_error_is_set(error, LT_ERR_ANY)) || !tag) +@@ -170,14 +189,19 @@ + addProperties(fullTag); + + return fullTag; ++#endif + } + + const std::string IWORKLanguageManager::getLanguage(const std::string &tag) const + { ++#if defined(DISABLE_LIBLANGTAG) ++ return ""; ++#else + const shared_ptr &langTag = parseTag(tag); + if (!langTag) + throw std::logic_error("cannot parse tag that has been successfully parsed before"); + return lt_lang_get_name(lt_tag_get_language(langTag.get())); ++#endif + } + + const IWORKLanguageManager::LangDB &IWORKLanguageManager::getLangDB() const +@@ -189,6 +213,9 @@ + + void IWORKLanguageManager::addProperties(const std::string &tag) + { ++#if defined(DISABLE_LIBLANGTAG) ++ return; ++#else + const shared_ptr &langTag = parseTag(tag); + if (!langTag) + throw std::logic_error("cannot parse tag that has been successfully parsed before"); +@@ -205,6 +232,7 @@ + props.insert("fo:script", lt_script_get_tag(script)); + + m_propsMap[tag] = props; ++#endif + } + + void IWORKLanguageManager::writeProperties(const std::string &tag, librevenge::RVNGPropertyList &props) const