From eb495b139a06d1f8083bd32c3c2bcf5a9f0b4b88 Mon Sep 17 00:00:00 2001
From: Robert Drab <robert.drab@huawei.com>
Date: Thu, 8 Apr 2021 13:09:26 +0200
Subject: [PATCH] meta-ohos-acts: Add global-i18n-lite component

ohos-global-i18n-lite is a shared library providing i18n functions
like formatting date/time strings.

Signed-off-by: Robert Drab <robert.drab@huawei.com>
---
 .../ohos-global-i18n-lite/GNUmakefile         | 32 +++++++++++++++++++
 .../ohos-global-i18n-lite_git.bb              | 31 ++++++++++++++++++
 2 files changed, 63 insertions(+)
 create mode 100644 meta-ohos-acts/recipes-ohos-global-i18n-lite/ohos-global-i18n-lite/ohos-global-i18n-lite/GNUmakefile
 create mode 100644 meta-ohos-acts/recipes-ohos-global-i18n-lite/ohos-global-i18n-lite/ohos-global-i18n-lite_git.bb

diff --git a/meta-ohos-acts/recipes-ohos-global-i18n-lite/ohos-global-i18n-lite/ohos-global-i18n-lite/GNUmakefile b/meta-ohos-acts/recipes-ohos-global-i18n-lite/ohos-global-i18n-lite/ohos-global-i18n-lite/GNUmakefile
new file mode 100644
index 00000000..dd7c36c8
--- /dev/null
+++ b/meta-ohos-acts/recipes-ohos-global-i18n-lite/ohos-global-i18n-lite/ohos-global-i18n-lite/GNUmakefile
@@ -0,0 +1,32 @@
+# SPDX-FileCopyrightText: Huawei Inc.
+#
+# SPDX-License-Identifier: Apache-2.0
+
+include z.mk
+
+Project.Name=ohos-global-i18n-lite
+Project.Version=1
+
+$(eval $(call ZMK.Import,Configure))
+
+libglobal_i18n.so: CPPFLAGS += -iquote $(ZMK.OutOfTreeSourcePath)interfaces/kits/i18n/include
+libglobal_i18n.so: CPPFLAGS += -iquote $(ZMK.OutOfTreeSourcePath)frameworks/i18n/include
+libglobal_i18n.so: LDLIBS += -lsec
+libglobal_i18n.so.Sources = $(wildcard $(ZMK.OutOfTreeSourcePath)frameworks/i18n/src/*.cpp)
+$(eval $(call ZMK.Expand,Library.So,libglobal_i18n.so))
+
+# Public header files
+global-i18n-lite-headers-public.InstallDir = $(includedir)
+global-i18n-lite-headers-public.Headers = $(wildcard $(ZMK.OutOfTreeSourcePath)interfaces/kits/i18n/include/*.h)
+$(eval $(call ZMK.Expand,HeaderGroup,global-i18n-lite-headers-public))
+
+# XXX: OHOS locale/i18n resource data base file that is expected to be present
+# in the /storage/data directory on the target. There are others expectations
+# regarding this particular location, e.g. that it is mounted on a jffs2 fs.
+# To avoid unnecessary rootfs structure constraints placing it in
+# /usr/share/ohos-global-i18n-lite location for the time being to be put in an
+# appropriate place by the ACTS global_lite test suite spread task.
+frameworks/i18n/i18n.dat.InstallDir = $(datadir)/$(Project.Name)
+# FIXME: This installs a binary blob that's required by the shard library.
+# Issue on gitee: https://gitee.com/openharmony/global_i18n_lite/issues/I3HZXS
+$(eval $(call ZMK.Expand,InstallUninstall,frameworks/i18n/i18n.dat))
\ No newline at end of file
diff --git a/meta-ohos-acts/recipes-ohos-global-i18n-lite/ohos-global-i18n-lite/ohos-global-i18n-lite_git.bb b/meta-ohos-acts/recipes-ohos-global-i18n-lite/ohos-global-i18n-lite/ohos-global-i18n-lite_git.bb
new file mode 100644
index 00000000..4958874c
--- /dev/null
+++ b/meta-ohos-acts/recipes-ohos-global-i18n-lite/ohos-global-i18n-lite/ohos-global-i18n-lite_git.bb
@@ -0,0 +1,31 @@
+# SPDX-FileCopyrightText: Huawei Inc.
+#
+# SPDX-License-Identifier: Apache-2.0
+
+SUMMARY = "OpenHarmony i18n library"
+DESCRIPTION = "OpenHarmony library providing i18n capabilities like date, \
+time and numbers formatting or months and weekdays handling."
+
+LICENSE = "Apache-2.0"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=a832eda17114b48ae16cda6a500941c2"
+
+SRC_URI = "git://gitee.com/openharmony/global_i18n_lite.git;protocol=https \
+           file://GNUmakefile \
+"
+SRCREV = "1de9116474acc560b79dc5b5ecf5354c4d7089c0"
+PV = "0.0+git${SRCPV}"
+S = "${WORKDIR}/git"
+
+inherit zmk
+
+DEPENDS += "ohos-libsec"
+
+# The OHOS uses unversioned versioned libraries.
+# Move the naked .so files to the primary package.
+SOLIBS = ".so"
+FILES_SOLIBSDEV = ""
+
+do_configure_prepend() {
+    # global_i18n_lite component is being built using zmk compatible makefile
+    cp ${WORKDIR}/GNUmakefile ${S}
+}
-- 
GitLab