aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Bornstein <danfuzz@android.com>2009-11-13 13:25:21 -0800
committerDan Bornstein <danfuzz@android.com>2009-11-13 14:49:02 -0800
commit47a68d3fbd2591734eaac7a65620025528d430c2 (patch)
tree8e53402bc3c3c2348feeb3f89477c1bcc096f2ea
parentb88f7f55bac098642b707a2846ea06c089211bf3 (diff)
downloadicu4c-47a68d3fbd2591734eaac7a65620025528d430c2.tar.gz
Clean up the Android makefiles for ICU, and add some support for
building it on the host (though the latter isn't yet complete). Change-Id: Ia6a14dc301649d837dc8f38637d438d32ff289b6
-rw-r--r--Android.mk14
-rw-r--r--common/Android.mk65
-rw-r--r--i18n/Android.mk63
-rw-r--r--stubdata/Android.mk183
-rw-r--r--stubdata/IcuData.mk62
5 files changed, 239 insertions, 148 deletions
diff --git a/Android.mk b/Android.mk
index a49d2736..5d8af9ee 100644
--- a/Android.mk
+++ b/Android.mk
@@ -1,3 +1,17 @@
+# Copyright (C) 2008 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
diff --git a/common/Android.mk b/common/Android.mk
index 95372f8d..c35a371b 100644
--- a/common/Android.mk
+++ b/common/Android.mk
@@ -1,9 +1,25 @@
+# Copyright (C) 2008 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+
LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-# LOCAL_ARM_MODE := arm
+#
+# Common definitions.
+#
-LOCAL_SRC_FILES:= \
+src_files := \
cmemory.c cstring.c \
cwchar.c locmap.c \
punycode.c putil.c \
@@ -41,7 +57,7 @@ LOCAL_SRC_FILES:= \
utrace.c utrie.c \
utypes.c wintz.c
-LOCAL_SRC_FILES += \
+src_files += \
bmpset.cpp unisetspan.cpp \
brkeng.cpp brkiter.cpp \
caniter.cpp chariter.cpp \
@@ -73,16 +89,47 @@ LOCAL_SRC_FILES += \
util.cpp util_props.cpp \
uvector.cpp uvectr32.cpp
-LOCAL_C_INCLUDES += \
- $(LOCAL_PATH) \
+c_includes := \
+ $(LOCAL_PATH) \
$(LOCAL_PATH)/../i18n
-LOCAL_CFLAGS += -D_REENTRANT -DPIC -DU_COMMON_IMPLEMENTATION -fPIC
-LOCAL_CFLAGS += -O3
+
+#
+# Build for the target (device).
+#
+
+include $(CLEAR_VARS)
+
+LOCAL_SRC_FILES := $(src_files)
+LOCAL_C_INCLUDES := $(c_includes)
+
+LOCAL_CFLAGS += -D_REENTRANT -DPIC -DU_COMMON_IMPLEMENTATION -fPIC
+LOCAL_CFLAGS += -O3
LOCAL_SHARED_LIBRARIES += libicudata
-LOCAL_LDLIBS += -lpthread -lm
+LOCAL_LDLIBS += -lpthread -lm
LOCAL_MODULE := libicuuc
include $(BUILD_SHARED_LIBRARY)
+
+
+#
+# Build for the host.
+#
+
+ifeq ($(WITH_HOST_DALVIK),true)
+
+ LOCAL_SRC_FILES := $(src_files)
+ LOCAL_C_INCLUDES := $(c_includes)
+
+ LOCAL_CFLAGS += -D_REENTRANT -DU_COMMON_IMPLEMENTATION
+
+ LOCAL_SHARED_LIBRARIES += libicudata
+ LOCAL_LDLIBS += -lpthread -lm
+
+ LOCAL_MODULE := libicuuc
+
+ include $(BUILD_HOST_SHARED_LIBRARY)
+
+endif
diff --git a/i18n/Android.mk b/i18n/Android.mk
index e37510b7..699e122d 100644
--- a/i18n/Android.mk
+++ b/i18n/Android.mk
@@ -1,13 +1,31 @@
+# Copyright (C) 2008 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+
LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-# LOCAL_ARM_MODE := arm
+#
+# Common definitions.
+#
+
+include $(CLEAR_VARS)
-LOCAL_SRC_FILES := \
+src_files := \
bocsu.c ucln_in.c ucol_wgt.c \
ulocdata.c utmscale.c
-LOCAL_SRC_FILES += \
+src_files += \
indiancal.cpp dtptngen.cpp dtrule.cpp \
persncal.cpp rbtz.cpp reldtfmt.cpp \
taiwncal.cpp tzrule.cpp tztrans.cpp \
@@ -46,16 +64,47 @@ LOCAL_SRC_FILES += \
usearch.cpp utrans.cpp windtfmt.cpp \
winnmfmt.cpp zonemeta.cpp zstrfmt.cpp
-LOCAL_C_INCLUDES = \
- $(LOCAL_PATH) \
+c_includes = \
+ $(LOCAL_PATH) \
$(LOCAL_PATH)/../common
+
+#
+# Build for the target (device).
+#
+
+include $(CLEAR_VARS)
+
+LOCAL_SRC_FILES := $(src_files)
+LOCAL_C_INCLUDES := $(c_includes)
+
LOCAL_CFLAGS += -D_REENTRANT -DPIC -DU_I18N_IMPLEMENTATION -fPIC
LOCAL_CFLAGS += -O3
LOCAL_SHARED_LIBRARIES += libicuuc libicudata
-LOCAL_LDLIBS += -lpthread -lm
+LOCAL_LDLIBS += -lpthread -lm
LOCAL_MODULE := libicui18n
include $(BUILD_SHARED_LIBRARY)
+
+
+#
+# Build for the host.
+#
+
+ifeq ($(WITH_HOST_DALVIK),true)
+
+ LOCAL_SRC_FILES := $(src_files)
+ LOCAL_C_INCLUDES := $(c_includes)
+
+ LOCAL_CFLAGS += -D_REENTRANT -DU_I18N_IMPLEMENTATION
+
+ LOCAL_SHARED_LIBRARIES += libicuuc libicudata
+ LOCAL_LDLIBS += -lpthread -lm
+
+ LOCAL_MODULE := libicui18n
+
+ include $(BUILD_HOST_SHARED_LIBRARY)
+
+endif
diff --git a/stubdata/Android.mk b/stubdata/Android.mk
index e2359257..d90b40b1 100644
--- a/stubdata/Android.mk
+++ b/stubdata/Android.mk
@@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-# ######################################################################
+#
# To get your own ICU userdata:
#
# Go to http://apps.icu-project.org/datacustom/ and configure yourself
@@ -23,18 +23,15 @@
# make sure to pick all of the following options, as they are required
# by the system. Things will fail quietly if you don't have them:
#
-# >>> base list goes here once we have it <<<
+# TODO: >>> base list goes here once we have it <<<
#
-# ######################################################################
-LOCAL_PATH:= $(call my-dir)
-# This sets LOCAL_PRELINK_MODULE := false because the prelink map requires
-# a unique address for each shared library, but I think all the variants
-# of libicudata.so actually need to be mapped at the same address so they
-# can be interchangable.
+#
+# Common definitions for all variants.
+#
-##
+LOCAL_PATH:= $(call my-dir)
# Build configuration:
#
@@ -44,7 +41,6 @@ LOCAL_PATH:= $(call my-dir)
# Default is suitable for CS, DE, EN, ES, FR, NL
# US has only EN and ES
-
config := $(word 1, \
$(if $(findstring ar,$(PRODUCT_LOCALES)),large) \
$(if $(findstring da,$(PRODUCT_LOCALES)),large) \
@@ -76,156 +72,79 @@ config := $(word 1, \
us)
icu_var_name := icudt38_dat
-##
-###### Japanese
+#
+# Japanese
+#
include $(CLEAR_VARS)
+
LOCAL_MODULE := libicudata-jp
-LOCAL_MODULE_CLASS := SHARED_LIBRARIES
-LOCAL_PRELINK_MODULE := false
-
-ifeq ($(config),us-japan)
- LOCAL_MODULE_STEM := libicudata
- LOCAL_MODULE_TAGS := user
-else
- LOCAL_MODULE_TAGS := optional
-endif
-
-intermediates := $(call local-intermediates-dir)
-icu_data_file := $(LOCAL_PATH)/icudt38l-us-japan.dat
-
-asm_file := $(intermediates)/icu_data_jp.S
-LOCAL_GENERATED_SOURCES += $(asm_file)
-$(asm_file): PRIVATE_VAR_NAME := $(icu_var_name)
-$(asm_file): $(icu_data_file) $(ICUDATA)
- @echo icudata: $@
- $(hide) mkdir -p $(dir $@)
- $(hide) $(ICUDATA) $(PRIVATE_VAR_NAME) < $< > $@
-
-LOCAL_CFLAGS += -D_REENTRANT -DPIC -fPIC
-LOCAL_CFLAGS += -O3 -nodefaultlibs -nostdlib
+required_config := us-japan
+data_file_name := icudt38l-us-japan.dat
+output_file_name := icu_data_jp.S
+
+include $(LOCAL_PATH)/IcuData.mk
include $(BUILD_SHARED_LIBRARY)
-###### Large
+
+#
+# Large
+#
include $(CLEAR_VARS)
LOCAL_MODULE := libicudata-large
-LOCAL_MODULE_CLASS := SHARED_LIBRARIES
-LOCAL_PRELINK_MODULE := false
-
-ifeq ($(config),large)
- LOCAL_MODULE_STEM := libicudata
- LOCAL_MODULE_TAGS := user
-else
- LOCAL_MODULE_TAGS := optional
-endif
-
-intermediates := $(call local-intermediates-dir)
-icu_data_file := $(LOCAL_PATH)/icudt38l-large.dat
-
-asm_file := $(intermediates)/icu_data_large.S
-LOCAL_GENERATED_SOURCES += $(asm_file)
-$(asm_file): PRIVATE_VAR_NAME := $(icu_var_name)
-$(asm_file): $(icu_data_file) $(ICUDATA)
- @echo icudata: $@
- $(hide) mkdir -p $(dir $@)
- $(hide) $(ICUDATA) $(PRIVATE_VAR_NAME) < $< > $@
-
-LOCAL_CFLAGS += -D_REENTRANT -DPIC -fPIC
-LOCAL_CFLAGS += -O3 -nodefaultlibs -nostdlib
+required_config := large
+data_file_name := icudt38l-large.dat
+output_file_name := icu_data_large.S
+
+include $(LOCAL_PATH)/IcuData.mk
include $(BUILD_SHARED_LIBRARY)
-###### Euro
+
+#
+# Euro
+#
include $(CLEAR_VARS)
LOCAL_MODULE := libicudata-eu
-LOCAL_MODULE_CLASS := SHARED_LIBRARIES
-LOCAL_PRELINK_MODULE := false
-
-ifeq ($(config),us-euro)
- LOCAL_MODULE_STEM := libicudata
- LOCAL_MODULE_TAGS := user
-else
- LOCAL_MODULE_TAGS := optional
-endif
-
-intermediates := $(call local-intermediates-dir)
-icu_data_file := $(LOCAL_PATH)/icudt38l-us-euro.dat
-
-asm_file := $(intermediates)/icu_data_eu.S
-LOCAL_GENERATED_SOURCES += $(asm_file)
-$(asm_file): PRIVATE_VAR_NAME := $(icu_var_name)
-$(asm_file): $(icu_data_file) $(ICUDATA)
- @echo icudata: $@
- $(hide) mkdir -p $(dir $@)
- $(hide) $(ICUDATA) $(PRIVATE_VAR_NAME) < $< > $@
-
-LOCAL_CFLAGS += -D_REENTRANT -DPIC -fPIC
-LOCAL_CFLAGS += -O3 -nodefaultlibs -nostdlib
+required_config := us-euro
+data_file_name := icudt38l-us-euro.dat
+output_file_name := icu_data_eu.S
+
+include $(LOCAL_PATH)/IcuData.mk
include $(BUILD_SHARED_LIBRARY)
-###### Default
+
+#
+# Default
+#
include $(CLEAR_VARS)
LOCAL_MODULE := libicudata-default
-LOCAL_MODULE_CLASS := SHARED_LIBRARIES
-LOCAL_PRELINK_MODULE := false
-
-ifeq ($(config),default)
- LOCAL_MODULE_STEM := libicudata
- LOCAL_MODULE_TAGS := user
-else
- LOCAL_MODULE_TAGS := optional
-endif
-
-intermediates := $(call local-intermediates-dir)
-icu_data_file := $(LOCAL_PATH)/icudt38l-default.dat
-
-asm_file := $(intermediates)/icu_data_default.S
-LOCAL_GENERATED_SOURCES += $(asm_file)
-$(asm_file): PRIVATE_VAR_NAME := $(icu_var_name)
-$(asm_file): $(icu_data_file) $(ICUDATA)
- @echo icudata: $@
- $(hide) mkdir -p $(dir $@)
- $(hide) $(ICUDATA) $(PRIVATE_VAR_NAME) < $< > $@
-
-LOCAL_CFLAGS += -D_REENTRANT -DPIC -fPIC
-LOCAL_CFLAGS += -O3 -nodefaultlibs -nostdlib
+required_config := default
+data_file_name := icudt38l-default.dat
+output_file_name := icu_data_default.S
+
+include $(LOCAL_PATH)/IcuData.mk
include $(BUILD_SHARED_LIBRARY)
-###### US
+
+#
+# US
+#
include $(CLEAR_VARS)
LOCAL_MODULE := libicudata-us
-LOCAL_MODULE_CLASS := SHARED_LIBRARIES
-LOCAL_PRELINK_MODULE := false
-
-ifeq ($(config),us)
- LOCAL_MODULE_STEM := libicudata
- LOCAL_MODULE_TAGS := user
-else
- LOCAL_MODULE_TAGS := optional
-endif
-
-intermediates := $(call local-intermediates-dir)
-icu_data_file := $(LOCAL_PATH)/icudt38l-us.dat
-
-asm_file := $(intermediates)/icu_data_us.S
-LOCAL_GENERATED_SOURCES += $(asm_file)
-$(asm_file): PRIVATE_VAR_NAME := $(icu_var_name)
-$(asm_file): $(icu_data_file) $(ICUDATA)
- @echo icudata: $@
- $(hide) mkdir -p $(dir $@)
- $(hide) $(ICUDATA) $(PRIVATE_VAR_NAME) < $< > $@
-
-LOCAL_CFLAGS += -D_REENTRANT -DPIC -fPIC
-LOCAL_CFLAGS += -O3 -nodefaultlibs -nostdlib
+required_config := us
+data_file_name := icudt38l-us.dat
+output_file_name := icu_data_us.S
+
+include $(LOCAL_PATH)/IcuData.mk
include $(BUILD_SHARED_LIBRARY)
-######
diff --git a/stubdata/IcuData.mk b/stubdata/IcuData.mk
new file mode 100644
index 00000000..41e57d6b
--- /dev/null
+++ b/stubdata/IcuData.mk
@@ -0,0 +1,62 @@
+# Copyright (C) 2008 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+#
+# Common definitions used for building ICU data files.
+#
+# Prior to including this file, the following variables should be
+# set for each variant:
+#
+# LOCAL_MODULE -- set (as usual) to name the module being built
+# data_file_name -- the name of the prebuilt data file to use
+# output_file_name -- the name of the output source file
+# required_config -- the name of the configuration that requires this data
+#
+# And these variables need to be set before the first variant is defined.
+# This is done in the preamble of the Android.mk file in this directory:
+#
+# config -- current configuration
+# icu_var_name -- name of the symbol that needs to be defined in the
+# data file
+#
+
+LOCAL_MODULE_CLASS := SHARED_LIBRARIES
+
+# This sets LOCAL_PRELINK_MODULE := false because the prelink map
+# requires a unique address for each shared library, but all the
+# variants of libicudata.so actually need to be mapped at the same
+# address so they can be interchangable.
+LOCAL_PRELINK_MODULE := false
+
+ifeq ($(config),$(required_config))
+ LOCAL_MODULE_STEM := libicudata
+ LOCAL_MODULE_TAGS := user
+else
+ LOCAL_MODULE_TAGS := optional
+endif
+
+intermediates := $(call local-intermediates-dir)
+icu_data_file := $(LOCAL_PATH)/$(data_file_name)
+
+asm_file := $(intermediates)/$(output_file_name)
+LOCAL_GENERATED_SOURCES += $(asm_file)
+
+$(asm_file): PRIVATE_VAR_NAME := $(icu_var_name)
+$(asm_file): $(icu_data_file) $(ICUDATA)
+ @echo icudata: $@
+ $(hide) mkdir -p $(dir $@)
+ $(hide) $(ICUDATA) $(PRIVATE_VAR_NAME) < $< > $@
+
+LOCAL_CFLAGS += -D_REENTRANT -DPIC -fPIC
+LOCAL_CFLAGS += -O3 -nodefaultlibs -nostdlib