ICU-6501 Set data path when building data in archive mode.

X-SVN-Rev: 28389
This commit is contained in:
Michael Ow 2010-07-29 23:37:19 +00:00
parent d715640dce
commit ce3a205cc9
2 changed files with 17 additions and 2 deletions

View File

@ -68,6 +68,11 @@ LDFLAGS += $(LDFLAGSICUUC)
# for plugin configuration
CPPFLAGS += "-DDEFAULT_ICU_PLUGINS=\"$(libdir)/icu\" "
# for icu data location
ifeq ($(PKGDATA_MODE),common)
CPPFLAGS += "-DU_ICU_DATA_DEFAULT_DIR=\"$(ICUDATA_DIR)\""
endif
# $(LIBICUDT) is either stub data or the real DLL common data.
LIBS = $(LIBICUDT) $(DEFAULT_LIBS)

View File

@ -1184,10 +1184,20 @@ u_getDataDirectory(void) {
path=getenv("ICU_DATA");
# endif
/* ICU_DATA_DIR may be set as a compile option */
# ifdef ICU_DATA_DIR
/* ICU_DATA_DIR may be set as a compile option.
* U_ICU_DATA_DEFAULT_DIR is provided and is set by ICU at compile time
* and is used only when data is built in archive mode eliminating the need
* for ICU_DATA_DIR to be set. U_ICU_DATA_DEFAULT_DIR is set to the installation
* directory of the data dat file. Users should use ICU_DATA_DIR if they want to
* set their own path.
*/
#if defined(ICU_DATA_DIR) || defined(U_ICU_DATA_DEFAULT_DIR)
if(path==NULL || *path==0) {
# ifdef ICU_DATA_DIR
path=ICU_DATA_DIR;
# else
path=U_ICU_DATA_DEFAULT_DIR;
# endif
#if defined(U_DARWIN) && TARGET_IPHONE_SIMULATOR
simulator_root=getenv("IPHONE_SIMULATOR_ROOT");
if (simulator_root != NULL) {