From ce3a205cc9ba5488beadc30b92e1321173052a07 Mon Sep 17 00:00:00 2001 From: Michael Ow Date: Thu, 29 Jul 2010 23:37:19 +0000 Subject: [PATCH] ICU-6501 Set data path when building data in archive mode. X-SVN-Rev: 28389 --- icu4c/source/common/Makefile.in | 5 +++++ icu4c/source/common/putil.c | 14 ++++++++++++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/icu4c/source/common/Makefile.in b/icu4c/source/common/Makefile.in index dbe30ed5ae..b3fb587ee9 100644 --- a/icu4c/source/common/Makefile.in +++ b/icu4c/source/common/Makefile.in @@ -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) diff --git a/icu4c/source/common/putil.c b/icu4c/source/common/putil.c index cc47430442..667ef2934e 100644 --- a/icu4c/source/common/putil.c +++ b/icu4c/source/common/putil.c @@ -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) {