[Libreoffice-commits] .: configure.in i18npool/Library_i18nisolang1.mk i18npool/source

Tor Lillqvist tml at kemper.freedesktop.org
Tue Aug 7 08:19:09 PDT 2012


 configure.in                                |   11 ++
 i18npool/Library_i18nisolang1.mk            |    6 +
 i18npool/source/languagetag/languagetag.cxx |  125 ++++++++++++++++++++++++++++
 3 files changed, 139 insertions(+), 3 deletions(-)

New commits:
commit 57aae2766dca48830d18828bb88b21cbbcb9e7de
Author: Tor Lillqvist <tml at iki.fi>
Date:   Tue Aug 7 18:01:37 2012 +0300

    We don't want to use liblangtag on Android or iOS
    
    We don't need GLib then either. For now just a quick dummy replacement
    for liblangtag in i18npool that will crash at run-time. Improve once
    it starts to get used, and once it is clear what functionality is
    needed.
    
    Change-Id: I9777c2c776dd6e479e1d6f0fb073f289ea6ff2f4

diff --git a/configure.in b/configure.in
index c9e625d..6635473 100644
--- a/configure.in
+++ b/configure.in
@@ -10975,16 +10975,23 @@ GLIB_CFLAGS=''
 GLIB_LIBS=''
 if test "$SYSTEM_GLIB" = YES; then
     PKG_CHECK_MODULES( GLIB, glib-2.0 )
-else
+elif test "$enable_librsvg" = fully-internal; then
     BUILD_TYPE="$BUILD_TYPE GLIB"
 fi
 AC_SUBST(GLIB_CFLAGS)
 AC_SUBST(GLIB_LIBS)
 
 dnl So far AFAIK no system has liblangtag, set this unconditionally for now.
+dnl Except for Android and iOS where we don't want liblangtag.
 
 SYSTEM_LIBLANGTAG=NO
-BUILD_TYPE="$BUILD_TYPE LIBLANGTAG"
+case "$_os" in
+iOS|Android)
+    ;;
+*)
+    BUILD_TYPE="$BUILD_TYPE LIBLANGTAG"
+    ;;
+esac
 AC_SUBST(SYSTEM_LIBLANGTAG)
 
 
diff --git a/i18npool/Library_i18nisolang1.mk b/i18npool/Library_i18nisolang1.mk
index 066f6f9..e022680 100644
--- a/i18npool/Library_i18nisolang1.mk
+++ b/i18npool/Library_i18nisolang1.mk
@@ -53,9 +53,13 @@ $(eval $(call gb_Library_add_exception_objects,i18nisolang1,\
 	i18npool/source/languagetag/languagetag \
 ))
 
-$(eval $(call gb_Library_use_external,i18nisolang1,glib))
 
+ifneq ($(OS),ANDROID)
+ifneq ($(OS),IOS)
+$(eval $(call gb_Library_use_external,i18nisolang1,glib))
 $(eval $(call gb_Library_use_external,i18nisolang1,liblangtag))
+endif
+endif
 
 $(eval $(call gb_Library_use_external,i18nisolang1,libxml2))
 
diff --git a/i18npool/source/languagetag/languagetag.cxx b/i18npool/source/languagetag/languagetag.cxx
index d5cfacd..728e70a 100644
--- a/i18npool/source/languagetag/languagetag.cxx
+++ b/i18npool/source/languagetag/languagetag.cxx
@@ -12,8 +12,133 @@
 #include <rtl/ustrbuf.hxx>
 #include <rtl/bootstrap.hxx>
 #include <osl/file.hxx>
+
+#if !defined(ANDROID) && !defined(IOS)
 #include <liblangtag/langtag.h>
 
+#elif defined(ANDROID) || defined(IOS)
+
+// Completely dummy implementation, once this actually starts getting used at
+// run-time will need to do something.
+
+// For iOS probably can use NSLocale, that should have more or less required
+// functionality. If it is good enough, it could be used for Mac OS X,
+// too. For Android, maybe java.util.Locale, although it definitely lacks in
+// functionality.
+
+typedef char gchar;
+typedef struct {
+    char *message;
+} GError;
+
+static void g_free(void *p)
+{
+    free(p);
+}
+
+static void g_error_free(GError *error)
+{
+    (void) error;
+}
+
+typedef void lt_tag_t;
+typedef void lt_lang_t;
+typedef void lt_script_t;
+typedef void lt_region_t;
+
+static void lt_db_initialize(void)
+{
+}
+
+static void lt_db_finalize(void)
+{
+}
+
+static void lt_db_set_datadir(const char *dir)
+{
+    (void) dir;
+}
+
+static lt_tag_t *lt_tag_new(void)
+{
+    return NULL;
+}
+
+static lt_tag_t *lt_tag_copy(lt_tag_t *tag)
+{
+    (void) tag;
+    return NULL;
+}
+
+static void lt_tag_unref(lt_tag_t *tag)
+{
+    (void) tag;
+}
+
+static int lt_tag_parse(lt_tag_t *tag,
+                        const char *tag_string,
+                        GError **error)
+{
+    (void) tag;
+    (void) tag_string;
+    (void) error;
+
+    return -1;
+}
+
+static char *lt_tag_canonicalize(lt_tag_t *tag,
+                                 GError **error)
+{
+    (void) tag;
+    (void) error;
+
+    return NULL;
+}
+
+static const lt_lang_t *lt_tag_get_language(const lt_tag_t  *tag)
+{
+    (void) tag;
+
+    return NULL;
+}
+
+static const lt_script_t *lt_tag_get_script(const lt_tag_t  *tag)
+{
+    (void) tag;
+
+    return NULL;
+}
+
+static const lt_region_t *lt_tag_get_region(const lt_tag_t  *tag)
+{
+    (void) tag;
+
+    return NULL;
+}
+
+static const gchar *lt_lang_get_tag(const lt_lang_t *lang)
+{
+    (void) lang;
+
+    return NULL;
+}
+
+static const gchar *lt_script_get_tag(const lt_script_t *script)
+{
+    (void) script;
+
+    return NULL;
+}
+
+static const gchar *lt_region_get_tag(const lt_region_t *region)
+{
+    (void) region;
+
+    return NULL;
+}
+
+#endif
+
 //#define erDEBUG
 
 using rtl::OUString;


More information about the Libreoffice-commits mailing list