summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRaph Levien <raph@google.com>2015-09-03 16:18:30 -0700
committerRoozbeh Pournader <roozbeh@google.com>2015-10-14 19:13:32 +0000
commitc15709c28e9623c1937038f08af603c492901cbd (patch)
tree757ac71eb3f90f79e5c6580e524c8cf787bebf89
parent7104a91f415b1001b75909f837f3b54d54671ea3 (diff)
downloadhyphenation-patterns-marshmallow-dr-dragon-release.tar.gz
Makefile updates to compile the hyphenation patterns to binary format on the device. Bug: 21562869 Bug: 21826930 Bug: 24570591 Change-Id: I8b92ed16626d11dce299415280d2e1a075436481 (cherry picked from commit 9c07dd308499248830f6f9c423fdb0c7bc10ff24)
-rw-r--r--Android.mk35
-rw-r--r--build-hyb.mk13
-rw-r--r--patterns.mk10
3 files changed, 33 insertions, 25 deletions
diff --git a/Android.mk b/Android.mk
index 7e7c73e..18ff133 100644
--- a/Android.mk
+++ b/Android.mk
@@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-HYPHENS_DIR := $(call my-dir)
+LOCAL_PATH := $(call my-dir)
pattern_locales := \
en-US/en-us \
@@ -21,35 +21,32 @@ pattern_locales := \
hu/hu \
hy/hy \
nb/nb \
- nn/nn \
- sa/sa
+ nn/nn
-pattern_src_files := \
- $(foreach locale, $(pattern_locales), \
- $(addprefix $(dir $(locale)), \
- $(addprefix hyph-, $(addprefix $(notdir $(locale)), \
- .chr.txt .hyp.txt .lic.txt .pat.txt))))
-pattern_locales :=
+# TODO: we have data for sa/sa, but it requires special case handling for case
+# folding and normalization, so don't build it until that's fixed.
-# We have to use BUILD_PREBUILT instead of PRODUCT_COPY_FILES,
-# to copy over the NOTICE file.
+BUILD_HYB := $(LOCAL_PATH)/build-hyb.mk
#############################################################################
-# $(1): The source file name in LOCAL_PATH.
-# It also serves as the module name and the dest file name.
+# $(1): The subdirectory where the source files live.
+$ $(2): The file name fragment.
+# It is used to find source files, and also generate the resulting binary.
#############################################################################
define build-one-pattern-module
$(eval include $(CLEAR_VARS))\
-$(eval LOCAL_PATH := $(abspath $(addprefix $(HYPHENS_DIR)/, $(dir $(1)))))\
-$(eval LOCAL_MODULE := $(notdir $(1)))\
-$(eval LOCAL_SRC_FILES := $(notdir $(1)))\
+$(eval LOCAL_MODULE := $(addprefix hyph-, $(2)))\
+$(eval LOCAL_SRC_FILES := $(addprefix $(1)/hyph-, $(addprefix $(2), .pat.txt .chr.txt .hyp.txt)))\
+$(eval include $(BUILD_HYB))\
+$(eval include $(CLEAR_VARS))\
+$(eval LOCAL_MODULE := $(addprefix $(addprefix hyph-, $(2)), .lic.txt))\
+$(eval LOCAL_SRC_FILES := $(addprefix $(1)/hyph-, $(addprefix $(2), .lic.txt)))\
$(eval LOCAL_MODULE_CLASS := ETC)\
$(eval LOCAL_MODULE_TAGS := optional)\
$(eval LOCAL_MODULE_PATH := $(TARGET_OUT)/usr/hyphen-data)\
$(eval include $(BUILD_PREBUILT))
endef
-$(foreach f, $(pattern_src_files), $(call build-one-pattern-module, $(f)))
+$(foreach l, $(pattern_locales), $(call build-one-pattern-module, $(dir $(l)), $(notdir $l)))
build-one-pattern-module :=
-pattern_src_files :=
-HYPHENS_DIR :=
+pattern_locales :=
diff --git a/build-hyb.mk b/build-hyb.mk
new file mode 100644
index 0000000..a809c91
--- /dev/null
+++ b/build-hyb.mk
@@ -0,0 +1,13 @@
+
+LOCAL_MODULE_CLASS := ETC
+LOCAL_MODULE_TAGS := optional
+LOCAL_MODULE_SUFFIX := .hyb
+LOCAL_MODULE_PATH := $(TARGET_OUT)/usr/hyphen-data
+
+include $(BUILD_SYSTEM)/base_rules.mk
+
+MK_HYB_FILE := frameworks/minikin/tools/mk_hyb_file.py
+$(LOCAL_BUILT_MODULE) : $(addprefix $(LOCAL_PATH)/, $(LOCAL_SRC_FILES)) $(MK_HYB_FILE)
+ @echo "Build hyb $@ <- $<"
+ @mkdir -p $(dir $@)
+ $(hide) $(MK_HYB_FILE) $< $@
diff --git a/patterns.mk b/patterns.mk
index 82ee76e..bae5ea9 100644
--- a/patterns.mk
+++ b/patterns.mk
@@ -12,17 +12,15 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-# We have to use PRODUCT_PACKAGES (together with BUILD_PREBUILT) instead of
+# We have to use PRODUCT_PACKAGES (together with BUILD_HYPH) instead of
# PRODUCT_COPY_FILES to install the pattern files, so that the NOTICE file can
# get installed too.
pattern_locales := \
en-us eu hu hy \
- nb nn sa und-ethi
+ nb nn und-ethi
-PRODUCT_PACKAGES := \
- $(foreach locale, $(pattern_locales), \
- $(addprefix hyph-, $(addprefix $(locale), \
- .chr.txt .hyp.txt .lic.txt .pat.txt)))
+PRODUCT_PACKAGES := $(addprefix hyph-,$(pattern_locales)) \
+ $(addsuffix .lic.txt,$(addprefix hyph-,$(pattern_locales)))
pattern_locales :=