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
This commit is contained in:
Tor Lillqvist
2012-08-07 18:01:37 +03:00
parent 4d6dab2cde
commit 57aae2766d
3 changed files with 139 additions and 3 deletions

View File

@@ -10975,16 +10975,23 @@ GLIB_CFLAGS=''
GLIB_LIBS='' GLIB_LIBS=''
if test "$SYSTEM_GLIB" = YES; then if test "$SYSTEM_GLIB" = YES; then
PKG_CHECK_MODULES( GLIB, glib-2.0 ) PKG_CHECK_MODULES( GLIB, glib-2.0 )
else elif test "$enable_librsvg" = fully-internal; then
BUILD_TYPE="$BUILD_TYPE GLIB" BUILD_TYPE="$BUILD_TYPE GLIB"
fi fi
AC_SUBST(GLIB_CFLAGS) AC_SUBST(GLIB_CFLAGS)
AC_SUBST(GLIB_LIBS) AC_SUBST(GLIB_LIBS)
dnl So far AFAIK no system has liblangtag, set this unconditionally for now. 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 SYSTEM_LIBLANGTAG=NO
BUILD_TYPE="$BUILD_TYPE LIBLANGTAG" case "$_os" in
iOS|Android)
;;
*)
BUILD_TYPE="$BUILD_TYPE LIBLANGTAG"
;;
esac
AC_SUBST(SYSTEM_LIBLANGTAG) AC_SUBST(SYSTEM_LIBLANGTAG)

View File

@@ -53,9 +53,13 @@ $(eval $(call gb_Library_add_exception_objects,i18nisolang1,\
i18npool/source/languagetag/languagetag \ 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)) $(eval $(call gb_Library_use_external,i18nisolang1,liblangtag))
endif
endif
$(eval $(call gb_Library_use_external,i18nisolang1,libxml2)) $(eval $(call gb_Library_use_external,i18nisolang1,libxml2))

View File

@@ -12,8 +12,133 @@
#include <rtl/ustrbuf.hxx> #include <rtl/ustrbuf.hxx>
#include <rtl/bootstrap.hxx> #include <rtl/bootstrap.hxx>
#include <osl/file.hxx> #include <osl/file.hxx>
#if !defined(ANDROID) && !defined(IOS)
#include <liblangtag/langtag.h> #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 //#define erDEBUG
using rtl::OUString; using rtl::OUString;