Reland "Experimental ICU runtime linking"
This is a reland of f4aab0584dc844b1fa38e299ff1a9c1922c06a99
Original change's description:
> Experimental ICU runtime linking
>
> Introduce a build config option where ICU symbols are resolved at
> runtime, against existing system libs.
>
> Change-Id: I2325537438de0063fcc4a7c0f8411764cf550f09
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/431037
> Commit-Queue: Florin Malita <fmalita@chromium.org>
> Commit-Queue: Florin Malita <fmalita@google.com>
> Reviewed-by: Ben Wagner <bungeman@google.com>
Change-Id: I6f67a5eb842743d2486ccc4519e2d8cb9fac3458
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/433277
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Florin Malita <fmalita@google.com>
diff --git a/modules/skunicode/src/SkUnicode_icu.h b/modules/skunicode/src/SkUnicode_icu.h
new file mode 100644
index 0000000..ece8abd
--- /dev/null
+++ b/modules/skunicode/src/SkUnicode_icu.h
@@ -0,0 +1,61 @@
+/*
+ * Copyright 2021 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+#ifndef SkUnicode_icu_DEFINED
+#define SkUnicode_icu_DEFINED
+
+#include <unicode/ubidi.h>
+#include <unicode/ubrk.h>
+#include <unicode/uscript.h>
+#include <unicode/ustring.h>
+#include <unicode/utext.h>
+#include <unicode/utypes.h>
+
+#include "include/private/SkTemplates.h"
+
+#define SKICU_EMIT_FUNCS \
+ SKICU_FUNC(u_errorName) \
+ SKICU_FUNC(u_getIntPropertyValue) \
+ SKICU_FUNC(u_iscntrl) \
+ SKICU_FUNC(u_isspace) \
+ SKICU_FUNC(u_isWhitespace) \
+ SKICU_FUNC(ubidi_close) \
+ SKICU_FUNC(ubidi_getLength) \
+ SKICU_FUNC(ubidi_getLevelAt) \
+ SKICU_FUNC(ubidi_openSized) \
+ SKICU_FUNC(ubidi_reorderVisual) \
+ SKICU_FUNC(ubidi_setPara) \
+ SKICU_FUNC(ubrk_close) \
+ SKICU_FUNC(ubrk_current) \
+ SKICU_FUNC(ubrk_first) \
+ SKICU_FUNC(ubrk_following) \
+ SKICU_FUNC(ubrk_getRuleStatus) \
+ SKICU_FUNC(ubrk_next) \
+ SKICU_FUNC(ubrk_open) \
+ SKICU_FUNC(ubrk_preceding) \
+ SKICU_FUNC(ubrk_setText) \
+ SKICU_FUNC(ubrk_setUText) \
+ SKICU_FUNC(uloc_getDefault) \
+ SKICU_FUNC(uscript_getScript) \
+ SKICU_FUNC(utext_close) \
+ SKICU_FUNC(utext_openUChars) \
+ SKICU_FUNC(utext_openUTF8) \
+
+#define SKICU_FUNC(funcname) decltype(funcname)* f_##funcname;
+struct SkICULib {
+ SKICU_EMIT_FUNCS
+
+ // ubrk_clone added as draft in ICU69 and Android API 31 (first ICU NDK).
+ // ubrk_safeClone deprecated in ICU69 and not exposed by Android.
+ UBreakIterator* (*f_ubrk_clone_)(const UBreakIterator*, UErrorCode*);
+ UBreakIterator* (*f_ubrk_safeClone_)(const UBreakIterator*, void*, int32_t*, UErrorCode*);
+};
+#undef SKICU_FUNC
+
+// Platform/config specific ICU factory.
+std::unique_ptr<SkICULib> SkLoadICULib();
+
+#endif // SkUnicode_icu_DEFINED