ICU-212 out of source build.
X-SVN-Rev: 775
This commit is contained in:
parent
e0d232b679
commit
5d96fad42e
@ -65,7 +65,7 @@ EXTRA_DATA = convrtrs.txt UnicodeData-$(UNICODE_VERSION).txt
|
||||
.PHONY : all all-local all-recursive install install-local install-udata install-udata-files install-udata-dlls \
|
||||
install-recursive clean clean-local clean-recursive distclean \
|
||||
distclean-local distclean-recursive doc dist dist-local dist-recursive \
|
||||
check check-local check-recursive
|
||||
check check-local check-recursive builddata
|
||||
|
||||
## Clear suffix list
|
||||
.SUFFIXES :
|
||||
@ -96,8 +96,7 @@ all-recursive install-recursive clean-recursive distclean-recursive dist-recursi
|
||||
$(MAKE) "$$target-local" || exit 1; \
|
||||
fi
|
||||
|
||||
all-local: $(srcdir)/configure
|
||||
|
||||
all-local: $(srcdir)/configure builddata
|
||||
|
||||
install-local:
|
||||
@for file in $(EXTRA_DATA); do \
|
||||
@ -128,7 +127,6 @@ clean-local:
|
||||
distclean-local:
|
||||
rm -f Makefile config.cache config.log config.status config/Makefile
|
||||
rm -f common/unicode/platform.h common/icucfg.h
|
||||
rm -rf data
|
||||
|
||||
check-local:
|
||||
|
||||
@ -141,3 +139,16 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
|
||||
config.status: $(srcdir)/configure
|
||||
$(SHELL) ./config.status --recheck
|
||||
|
||||
builddata: @DATABUILDDIR@/UnicodeData-$(UNICODE_VERSION).txt @DATABUILDDIR@/thaidict.brk @DATABUILDDIR@/../source/test/testdata/default.goo
|
||||
|
||||
@DATABUILDDIR@/UnicodeData-$(UNICODE_VERSION).txt: $(srcdir)/../data/UnicodeData-$(UNICODE_VERSION).txt
|
||||
ln -s `pwd`/$< @DATABUILDDIR@
|
||||
|
||||
@DATABUILDDIR@/thaidict.brk: $(srcdir)/../data/thaidict.brk
|
||||
ln -s `pwd`/$< @DATABUILDDIR@
|
||||
|
||||
@DATABUILDDIR@/../source/test/testdata/default.goo: $(srcdir)/test/testdata/default.goo
|
||||
ln -s `pwd`/$(srcdir)/test/testdata/*.goo `pwd`/$(srcdir)/test/testdata/*.txt `pwd`/$(srcdir)/test/testdata/*.uni @DATABUILDDIR@/../source/test/testdata/
|
||||
|
||||
|
||||
|
41
icu4c/source/configure
vendored
41
icu4c/source/configure
vendored
@ -464,7 +464,7 @@ echo > confdefs.h
|
||||
|
||||
# A filename unique to this package, relative to the directory that
|
||||
# configure is in, which we can look for to find out if srcdir is correct.
|
||||
ac_unique_file=common/utypes.h
|
||||
ac_unique_file=common/unicode/utypes.h
|
||||
|
||||
# Find the source files, if location was not specified.
|
||||
if test -z "$srcdir"; then
|
||||
@ -2590,7 +2590,19 @@ fi
|
||||
if test "$ac_cv_lib_dld_shl_load" = "yes"; then
|
||||
CPPFLAGS="${CPPFLAGS} -DICU_USE_SHL_LOAD"
|
||||
fi
|
||||
|
||||
|
||||
if test -f ./configure.in
|
||||
then
|
||||
# they are normal. Build is in .. (note this is mostly for the top level script)
|
||||
DATABUILDDIR=`pwd`/../data/
|
||||
RELATIVEDATADIR=../data/
|
||||
else
|
||||
DATABUILDDIR=`pwd`/data/
|
||||
RELATIVEDATADIR=data/
|
||||
fi
|
||||
|
||||
|
||||
|
||||
|
||||
trap '' 1 2 15
|
||||
cat > confcache <<\EOF
|
||||
@ -2779,6 +2791,8 @@ s%@platform@%$platform%g
|
||||
/@host_frag@/r $host_frag
|
||||
s%@host_frag@%%g
|
||||
s%@ld_rpath_suf@%$ld_rpath_suf%g
|
||||
s%@DATABUILDDIR@%$DATABUILDDIR%g
|
||||
s%@RELATIVEDATADIR@%$RELATIVEDATADIR%g
|
||||
|
||||
CEOF
|
||||
EOF
|
||||
@ -3009,22 +3023,31 @@ rm -fr confdefs* $ac_clean_files
|
||||
test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1
|
||||
|
||||
|
||||
if test -d data
|
||||
|
||||
if test -d $DATABUILDDIR
|
||||
then
|
||||
:
|
||||
else
|
||||
echo creating data
|
||||
mkdir data
|
||||
echo creating $DATABUILDDIR
|
||||
mkdir -p $DATABUILDDIR
|
||||
fi
|
||||
if test -d data/translit
|
||||
|
||||
if test -d $DATABUILDDIR/translit
|
||||
then
|
||||
:
|
||||
else
|
||||
echo creating data/translit
|
||||
mkdir data/translit
|
||||
echo creating $DATABUILDDIR/translit
|
||||
mkdir $DATABUILDDIR/translit
|
||||
fi
|
||||
|
||||
if test -d $DATABUILDDIR/../source/test/testdata
|
||||
then
|
||||
:
|
||||
else
|
||||
echo creating $DATABUILDDIR/../source/test/testdata
|
||||
mkdir -p $DATABUILDDIR/../source/test/testdata
|
||||
fi
|
||||
|
||||
if test $ICU_USE_THREADS = 0; then
|
||||
echo " *** Note: configuring the ICU without pthread support or testing. If this isn't what you want, then run configure with --enable-threads=yes or check the messages above to see why we couldn't find pthread_create()" 1>&6
|
||||
fi
|
||||
|
||||
|
@ -5,7 +5,7 @@ dnl others. All Rights Reserved.
|
||||
dnl Stephen F. Booth
|
||||
|
||||
dnl Process this file with autoconf to produce a configure script
|
||||
AC_INIT(common/utypes.h)
|
||||
AC_INIT(common/unicode/utypes.h)
|
||||
|
||||
AC_CONFIG_HEADER(common/icucfg.h)
|
||||
PACKAGE="icu"
|
||||
@ -354,7 +354,19 @@ dnl END special
|
||||
if test "$ac_cv_lib_dld_shl_load" = "yes"; then
|
||||
CPPFLAGS="${CPPFLAGS} -DICU_USE_SHL_LOAD"
|
||||
fi
|
||||
|
||||
|
||||
if test -f ./configure.in
|
||||
then
|
||||
# they are normal. Build is in .. (note this is mostly for the top level script)
|
||||
DATABUILDDIR=`pwd`/../data/
|
||||
RELATIVEDATADIR=../data/
|
||||
else
|
||||
DATABUILDDIR=`pwd`/data/
|
||||
RELATIVEDATADIR=data/
|
||||
fi
|
||||
|
||||
AC_SUBST(DATABUILDDIR)
|
||||
AC_SUBST(RELATIVEDATADIR)
|
||||
|
||||
dnl output the Makefiles
|
||||
AC_OUTPUT([Makefile \
|
||||
@ -369,23 +381,32 @@ AC_OUTPUT([Makefile \
|
||||
samples/Makefile samples/date/Makefile samples/cal/Makefile \
|
||||
samples/XMLConverter/Makefile])
|
||||
|
||||
|
||||
dnl create the data directory
|
||||
if test -d data
|
||||
if test -d $DATABUILDDIR
|
||||
then
|
||||
:
|
||||
else
|
||||
echo creating data
|
||||
mkdir data
|
||||
echo creating $DATABUILDDIR
|
||||
mkdir -p $DATABUILDDIR
|
||||
fi
|
||||
if test -d data/translit
|
||||
|
||||
if test -d $DATABUILDDIR/translit
|
||||
then
|
||||
:
|
||||
else
|
||||
echo creating data/translit
|
||||
mkdir data/translit
|
||||
echo creating $DATABUILDDIR/translit
|
||||
mkdir $DATABUILDDIR/translit
|
||||
fi
|
||||
|
||||
if test -d $DATABUILDDIR/../source/test/testdata
|
||||
then
|
||||
:
|
||||
else
|
||||
echo creating $DATABUILDDIR/../source/test/testdata
|
||||
mkdir -p $DATABUILDDIR/../source/test/testdata
|
||||
fi
|
||||
|
||||
if test $ICU_USE_THREADS = 0; then
|
||||
echo " *** Note: configuring the ICU without pthread support or testing. If this isn't what you want, then run configure with --enable-threads=yes or check the messages [above] to see why we couldn't find pthread_create()" 1>&6
|
||||
fi
|
||||
|
||||
|
@ -101,7 +101,7 @@ distclean-local: clean-local
|
||||
rm -f Makefile $(DEPS)
|
||||
|
||||
check-local: $(TARGET)
|
||||
HOME=$(top_srcdir)/../.. ICU_DATA=$(top_srcdir)/../data/ TZ=PST8PDT ./$(TARGET)
|
||||
ICU_DATA=@DATABUILDDIR@/ TZ=PST8PDT ./$(TARGET)
|
||||
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
cd $(top_builddir) \
|
||||
|
@ -71,8 +71,11 @@ ctest_pathnameInContext( char* fullname, int32_t maxsize, const char* relPath )
|
||||
}
|
||||
mainDir=mainDirBuffer;
|
||||
sepChar = '\\';
|
||||
#elif defined(_AIX) || defined(SOLARIS) || defined(LINUX) || defined(HPUX)
|
||||
mainDir = getenv("HOME");
|
||||
#elif defined(_AIX) || defined(SOLARIS) || defined(LINUX) || defined(HPUX) || defined(POSIX)
|
||||
char mainDirBuffer[200];
|
||||
strcpy(mainDirBuffer, u_getDataDirectory());
|
||||
strcat(mainDirBuffer, "/../");
|
||||
mainDir = mainDirBuffer;
|
||||
sepChar = '/';
|
||||
|
||||
#elif defined(XP_MAC)
|
||||
@ -110,7 +113,11 @@ ctest_getTestDirectory()
|
||||
{
|
||||
if (_testDirectory == NULL)
|
||||
{
|
||||
ctest_setTestDirectory("icu|source|test|testdata|");
|
||||
#if defined(_AIX) || defined(SOLARIS) || defined(LINUX) || defined(HPUX) || defined(POSIX)
|
||||
ctest_setTestDirectory("source|test|testdata|");
|
||||
#else
|
||||
ctest_setTestDirectory("icu|source|test|testdata|");
|
||||
#endif
|
||||
}
|
||||
return _testDirectory;
|
||||
}
|
||||
|
@ -98,7 +98,7 @@ distclean-local: clean-local
|
||||
rm -f Makefile $(DEPS)
|
||||
|
||||
check-local: $(TARGET)
|
||||
HOME=$(top_srcdir)/../.. ICU_DATA=$(top_srcdir)/../data/ TZ=PST8PDT ./$(TARGET)
|
||||
ICU_DATA=@DATABUILDDIR@/ TZ=PST8PDT ./$(TARGET)
|
||||
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
cd $(top_builddir) \
|
||||
|
@ -382,8 +382,11 @@ IntlTest::pathnameInContext( char* fullname, int32_t maxsize, const char* relPat
|
||||
mainDirBuffer[0]='\0';
|
||||
}
|
||||
mainDir=mainDirBuffer;
|
||||
#elif defined(_AIX) || defined(SOLARIS) || defined(LINUX) || defined(HPUX)
|
||||
mainDir = getenv("HOME");
|
||||
#elif defined(_AIX) || defined(SOLARIS) || defined(LINUX) || defined(HPUX) || defined(POSIX)
|
||||
char mainDirBuffer[200];
|
||||
strcpy(mainDirBuffer, u_getDataDirectory());
|
||||
strcat(mainDirBuffer, "/../");
|
||||
mainDir = mainDirBuffer;
|
||||
#elif defined(XP_MAC)
|
||||
Str255 volName;
|
||||
int16_t volNum;
|
||||
@ -446,7 +449,11 @@ IntlTest::getTestDirectory()
|
||||
{
|
||||
if (_testDirectory == NULL)
|
||||
{
|
||||
#if defined(_AIX) || defined(SOLARIS) || defined(LINUX) || defined(HPUX) || defined(POSIX)
|
||||
setTestDirectory("source|test|testdata|");
|
||||
#else
|
||||
setTestDirectory("icu|source|test|testdata|");
|
||||
#endif
|
||||
}
|
||||
return _testDirectory;
|
||||
}
|
||||
|
@ -1034,6 +1034,12 @@ LocaleTest::TestThaiCurrencyFormat()
|
||||
Locale("th", "TH"), status);
|
||||
UChar posPrefix = 0x0e3f;
|
||||
UnicodeString temp;
|
||||
|
||||
if(U_FAILURE(status) || !thaiCurrency)
|
||||
{
|
||||
errln("Couldn't get th_TH currency -> " + UnicodeString(u_errorName(status)));
|
||||
return;
|
||||
}
|
||||
if (thaiCurrency->getPositivePrefix(temp) != UnicodeString(&posPrefix, 1, 1))
|
||||
errln("Thai currency prefix wrong: expected 0x0e3f, got \"" +
|
||||
thaiCurrency->getPositivePrefix(temp) + "\"");
|
||||
|
@ -32,14 +32,17 @@ pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
|
||||
ICUDATADIR=$(pkgdatadir)/$(VERSION)
|
||||
SRCDATADIR=$(top_srcdir)/../data
|
||||
OBJDATADIR=$(top_builddir)/data
|
||||
|
||||
## Build directory information
|
||||
top_builddir = ..
|
||||
subdir = tools
|
||||
|
||||
# OBJDATADIR must be a short path (with ..'s) to the data.
|
||||
# @RELATIVEDATADIR@ exists soley for this line.
|
||||
|
||||
ICUDATADIR=$(pkgdatadir)/$(VERSION)
|
||||
SRCDATADIR=$(top_srcdir)/../data
|
||||
OBJDATADIR=$(top_builddir)/@RELATIVEDATADIR@
|
||||
|
||||
## Install program information
|
||||
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
||||
|
||||
@ -105,10 +108,10 @@ DATAFILESB=$(BRK_FILES:%=$(OBJDATADIR)/%)
|
||||
# copy the right endianness
|
||||
|
||||
ifeq (@U_IS_BIG_ENDIAN@,1)
|
||||
%.brk: $(SRCDATADIR)/%BE.brk
|
||||
$(OBJDATADIR)/%.brk: $(SRCDATADIR)/%BE.brk
|
||||
cp $< $@
|
||||
else
|
||||
%.brk: $(SRCDATADIR)/%LE.brk
|
||||
$(OBJDATADIR)/%.brk: $(SRCDATADIR)/%LE.brk
|
||||
cp $< $@
|
||||
endif
|
||||
|
||||
@ -118,13 +121,13 @@ ALL_UCM_SOURCE= $(UCM_SOURCE) $(UCM_SOURCE_LOCAL)
|
||||
|
||||
|
||||
UCM_FILES = $(ALL_UCM_SOURCE:%=$(top_srcdir)/../data/%)
|
||||
CNV_FILES = $(UCM_FILES:$(top_srcdir)/../data/%.ucm=$(OBJDATADIR)/%.cnv)
|
||||
CNV_FILES = $(ALL_UCM_SOURCE:%.ucm=$(OBJDATADIR)/%.cnv)
|
||||
DATAFILESC=$(CNV_FILES)
|
||||
|
||||
|
||||
DATAFILES=$(DATAFILESD) $(DATAFILESC) $(DATAFILESB)
|
||||
|
||||
SRCDATAFILESD=$(DATAFILESD:.dat=_dat.c)
|
||||
SRCDATAFILESD=$(DATAFILESD:%.dat=%_dat.c)
|
||||
SRCDATAFILESC=$(DATAFILESC:%.cnv=%_cnv.c)
|
||||
SRCDATAFILESB=$(DATAFILESB:%.brk=%_brk.c)
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
SHELL = @SHELL@
|
||||
VERSION = @VERSION@
|
||||
|
||||
ICUDATADIR=$(top_builddir)/data/
|
||||
ICUDATADIR=@DATABUILDDIR@/
|
||||
CONVRTRSFILE=$(top_srcdir)/../data/convrtrs.txt
|
||||
|
||||
## Install directory information
|
||||
|
@ -83,7 +83,7 @@ build-data: .sentinel
|
||||
|
||||
.sentinel: $(top_srcdir)/../data/*
|
||||
@echo "Creating binary collation files (may take a while)"
|
||||
@ICU_DATA=$(top_builddir)/../data/ ./$(TARGET) > /dev/null 2>&1
|
||||
@ICU_DATA=@DATABUILDDIR@/ ./$(TARGET) > /dev/null 2>&1
|
||||
@touch .sentinel
|
||||
|
||||
install-local: target-clean-local all-local
|
||||
|
@ -8,7 +8,7 @@ SHELL = @SHELL@
|
||||
VERSION = @VERSION@
|
||||
UNICODE_VERSION = @UNICODE_VERSION@
|
||||
|
||||
ICUDATADIR=$(top_builddir)/data/
|
||||
ICUDATADIR=@DATABUILDDIR@/
|
||||
UNICODEFILE=$(top_srcdir)/../data/UnicodeData-$(UNICODE_VERSION).txt
|
||||
|
||||
## Install directory information
|
||||
|
@ -89,12 +89,12 @@ lgreek.txt fullhalf.txt lhebrew.txt lkana.txt lcyril.txt \
|
||||
quotes.txt ucname.txt index.txt ljamo.txt
|
||||
|
||||
TXT_FILES = $(TXT_SOURCE:%=$(top_srcdir)/../data/%)
|
||||
RES_FILES = $(TXT_FILES:$(top_srcdir)/../data/%.txt=$(top_builddir)/data/%.res)
|
||||
RES_FILES = $(TXT_FILES:$(top_srcdir)/../data/%.txt=@DATABUILDDIR@/%.res)
|
||||
TRANSLIT_FILES = $(TRANSLIT_SOURCE:%=$(top_srcdir)/../data/translit/%)
|
||||
TRANSLIT_RES = $(TRANSLIT_FILES:$(top_srcdir)/../data/translit/%.txt=$(top_builddir)/data/translit/%.res)
|
||||
TEST_FILES = $(top_srcdir)/test/testdata/default.res \
|
||||
$(top_srcdir)/test/testdata/te.res \
|
||||
$(top_srcdir)/test/testdata/te_IN.res
|
||||
TRANSLIT_RES = $(TRANSLIT_SOURCE:%.txt=@DATABUILDDIR@/translit/%.res)
|
||||
TEST_FILES = @DATABUILDDIR@/../source/test/testdata/default.res \
|
||||
@DATABUILDDIR@/../source/test/testdata/te.res \
|
||||
@DATABUILDDIR@/../source/test/testdata/te_IN.res
|
||||
|
||||
## List of phony targets
|
||||
.PHONY : all all-local install install-local clean clean-local \
|
||||
@ -149,16 +149,24 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
$(TARGET) : $(OBJECTS)
|
||||
$(LINK.c) -o $@ $^ $(LIBS)
|
||||
|
||||
## Rule to build a compiled cnv file
|
||||
$(top_builddir)/data/%.res : $(top_srcdir)/../data/%.txt
|
||||
@echo "Creating compiled resource file for $<"
|
||||
@ICU_DATA=$(top_builddir)/data/ ./genrb $< > /dev/null 2>&1
|
||||
## Rule to build a compiled res file.
|
||||
## Note the order of the next three rules here is important!
|
||||
|
||||
# $(top_srcdir)/test/testdata/default.res
|
||||
@DATABUILDDIR@/../source/test/testdata/%.res : $(top_srcdir)/test/testdata/%.txt
|
||||
@echo "Creating testdata resource file for $<"
|
||||
@ICU_DATA=$(top_builddir)/data/ ./genrb -D@DATABUILDDIR@/../source/test/testdata/ $<
|
||||
|
||||
$(top_srcdir)/test/testdata/%.res : $(top_srcdir)/test/testdata/%.txt
|
||||
@DATABUILDDIR@/translit/%.res : $(top_srcdir)/../data/translit/%.txt
|
||||
@echo "Creating translit resource file for $<"
|
||||
@ICU_DATA=$(top_builddir)/data/ ./genrb -D@DATABUILDDIR@/translit/ $<
|
||||
|
||||
@DATABUILDDIR@/%.res : $(top_srcdir)/../data/%.txt
|
||||
@echo "Creating compiled resource file for $<"
|
||||
@ICU_DATA=$(top_builddir)/data/ ./genrb $< > /dev/null 2>&1
|
||||
@ICU_DATA=$(top_builddir)/data/ ./genrb -D@DATABUILDDIR@/ $<
|
||||
|
||||
|
||||
# the 'mv' will always fail if you are building in the source dir
|
||||
|
||||
|
||||
ifneq ($(MAKECMDGOALS),distclean)
|
||||
-include $(DEPS)
|
||||
@ -168,3 +176,5 @@ endif
|
||||
all-local:
|
||||
install-local:
|
||||
|
||||
|
||||
|
||||
|
@ -38,9 +38,9 @@ U_CDECL_END
|
||||
/* Protos */
|
||||
static void usage(void);
|
||||
static void version(void);
|
||||
static void processFile(const char *filename, const char* cp, UErrorCode *status);
|
||||
static char* make_res_filename(const char *filename, UErrorCode *status);
|
||||
static char* make_col_filename(const char *filename, UErrorCode *status);
|
||||
static void processFile(const char *filename, const char* cp, const char *outputDir, UErrorCode *status);
|
||||
static char* make_res_filename(const char *filename, const char *outputDir, UErrorCode *status);
|
||||
static char* make_col_filename(const char *filename, const char *outputDir, UErrorCode *status);
|
||||
static void make_col(const char *filename, UErrorCode *status);
|
||||
int main(int argc, char **argv);
|
||||
|
||||
@ -51,7 +51,8 @@ int main(int argc, char **argv);
|
||||
/* The version of genrb */
|
||||
#define GENRB_VERSION "1.0"
|
||||
|
||||
char *encoding = "";
|
||||
char *encoding = "";
|
||||
|
||||
|
||||
int
|
||||
main(int argc,
|
||||
@ -64,6 +65,7 @@ main(int argc,
|
||||
int i;
|
||||
char *arg;
|
||||
UErrorCode status;
|
||||
char *outputDir = NULL; /* NULL = no output directory, use current */
|
||||
|
||||
|
||||
if(argc == 1)
|
||||
@ -92,6 +94,9 @@ main(int argc,
|
||||
}
|
||||
|
||||
}
|
||||
else if(uprv_strncmp(arg, "-D", 2) == 0) {
|
||||
outputDir = arg+2;
|
||||
}
|
||||
|
||||
/* POSIX.1 says all arguments after -- are not options */
|
||||
else if(uprv_strcmp(arg, "--") == 0) {
|
||||
@ -126,7 +131,7 @@ main(int argc,
|
||||
for(i = optind; i < argc; ++i) {
|
||||
status = U_ZERO_ERROR;
|
||||
arg = getLongPathname(argv[i]);
|
||||
processFile(arg, encoding, &status);
|
||||
processFile(arg, encoding, outputDir, &status);
|
||||
make_col(arg, &status);
|
||||
if(U_FAILURE(status)) {
|
||||
printf("genrb: %s processing file \"%s\"\n", u_errorName(status), arg);
|
||||
@ -148,6 +153,7 @@ usage()
|
||||
puts(" -eEncoding Resource bundle uses specified Encoding");
|
||||
puts(" -h, --help Print this message and exit.");
|
||||
puts(" -v, --version Print the version number of genrb and exit.");
|
||||
puts(" -Ddir Store ALL output files under 'dir'.");
|
||||
encoding!=NULL?puts(encoding):puts("encoding is NULL");
|
||||
}
|
||||
|
||||
@ -162,7 +168,7 @@ version()
|
||||
|
||||
/* Process a file */
|
||||
static void
|
||||
processFile(const char *filename, const char *cp,
|
||||
processFile(const char *filename, const char *cp, const char *outputDir,
|
||||
UErrorCode *status)
|
||||
{
|
||||
FileStream *in;
|
||||
@ -187,7 +193,7 @@ processFile(const char *filename, const char *cp,
|
||||
data = parse(in, cp, status);
|
||||
|
||||
/* Determine the target rb filename */
|
||||
rbname = make_res_filename(filename, status);
|
||||
rbname = make_res_filename(filename, outputDir, status);
|
||||
if(U_FAILURE(*status)) {
|
||||
goto finish;
|
||||
}
|
||||
@ -216,6 +222,7 @@ processFile(const char *filename, const char *cp,
|
||||
/* Generate the target .res file name from the input file name */
|
||||
static char*
|
||||
make_res_filename(const char *filename,
|
||||
const char *outputDir,
|
||||
UErrorCode *status)
|
||||
{
|
||||
char *basename;
|
||||
@ -242,16 +249,35 @@ make_res_filename(const char *filename,
|
||||
}
|
||||
get_dirname(dirname, filename);
|
||||
|
||||
resName = (char*) uprv_malloc(sizeof(char) * (uprv_strlen(dirname)
|
||||
+ uprv_strlen(basename)
|
||||
+ uprv_strlen(RES_SUFFIX) + 1));
|
||||
if(resName == 0) {
|
||||
*status = U_MEMORY_ALLOCATION_ERROR;
|
||||
goto finish;
|
||||
if ( outputDir == NULL )
|
||||
{
|
||||
/* output in same dir as .txt */
|
||||
resName = (char*) uprv_malloc(sizeof(char) * (uprv_strlen(dirname)
|
||||
+ uprv_strlen(basename)
|
||||
+ uprv_strlen(RES_SUFFIX) + 1));
|
||||
if(resName == 0) {
|
||||
*status = U_MEMORY_ALLOCATION_ERROR;
|
||||
goto finish;
|
||||
}
|
||||
uprv_strcpy(resName, dirname);
|
||||
uprv_strcat(resName, basename);
|
||||
uprv_strcat(resName, RES_SUFFIX);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* output in 'outputDir' */
|
||||
resName = (char*) uprv_malloc(sizeof(char) * (uprv_strlen(outputDir)
|
||||
+ uprv_strlen(basename)
|
||||
+ uprv_strlen(RES_SUFFIX) + 1));
|
||||
if(resName == 0) {
|
||||
*status = U_MEMORY_ALLOCATION_ERROR;
|
||||
goto finish;
|
||||
}
|
||||
uprv_strcpy(resName, outputDir);
|
||||
uprv_strcat(resName, basename);
|
||||
uprv_strcat(resName, RES_SUFFIX);
|
||||
|
||||
}
|
||||
uprv_strcpy(resName, dirname);
|
||||
uprv_strcat(resName, basename);
|
||||
uprv_strcat(resName, RES_SUFFIX);
|
||||
|
||||
finish:
|
||||
uprv_free(basename);
|
||||
@ -263,6 +289,7 @@ make_res_filename(const char *filename,
|
||||
/* Generate the target .col file name from the input file name */
|
||||
static char*
|
||||
make_col_filename(const char *filename,
|
||||
const char *outputDir,
|
||||
UErrorCode *status)
|
||||
{
|
||||
char *basename;
|
||||
@ -287,18 +314,40 @@ make_col_filename(const char *filename,
|
||||
*status = U_MEMORY_ALLOCATION_ERROR;
|
||||
goto finish;
|
||||
}
|
||||
get_dirname(dirname, filename);
|
||||
|
||||
colName = (char*) uprv_malloc(sizeof(char) * (uprv_strlen(dirname)
|
||||
+ uprv_strlen(basename)
|
||||
+ uprv_strlen(COL_SUFFIX) + 1));
|
||||
if(colName == 0) {
|
||||
*status = U_MEMORY_ALLOCATION_ERROR;
|
||||
goto finish;
|
||||
if(outputDir == NULL)
|
||||
{
|
||||
|
||||
get_dirname(dirname, filename);
|
||||
|
||||
colName = (char*) uprv_malloc(sizeof(char) * (uprv_strlen(dirname)
|
||||
+ uprv_strlen(basename)
|
||||
+ uprv_strlen(COL_SUFFIX) + 1));
|
||||
if(colName == 0) {
|
||||
*status = U_MEMORY_ALLOCATION_ERROR;
|
||||
goto finish;
|
||||
}
|
||||
uprv_strcpy(colName, dirname);
|
||||
uprv_strcat(colName, basename);
|
||||
uprv_strcat(colName, COL_SUFFIX);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
get_dirname(dirname, filename);
|
||||
|
||||
colName = (char*) uprv_malloc(sizeof(char) * (uprv_strlen(outputDir)
|
||||
+ uprv_strlen(basename)
|
||||
+ uprv_strlen(COL_SUFFIX) + 1));
|
||||
if(colName == 0) {
|
||||
*status = U_MEMORY_ALLOCATION_ERROR;
|
||||
goto finish;
|
||||
}
|
||||
uprv_strcpy(colName, outputDir);
|
||||
uprv_strcat(colName, basename);
|
||||
uprv_strcat(colName, COL_SUFFIX);
|
||||
}
|
||||
uprv_strcpy(colName, dirname);
|
||||
uprv_strcat(colName, basename);
|
||||
uprv_strcat(colName, COL_SUFFIX);
|
||||
|
||||
finish:
|
||||
uprv_free(basename);
|
||||
|
@ -7,7 +7,7 @@
|
||||
SHELL = @SHELL@
|
||||
VERSION = @VERSION@
|
||||
|
||||
ICUDATADIR=$(top_builddir)/data/
|
||||
ICUDATADIR=@DATABUILDDIR@/
|
||||
TZFILE=$(srcdir)/tz.txt
|
||||
TZALIAS=$(srcdir)/tz.alias
|
||||
|
||||
|
@ -64,7 +64,7 @@ DEPS = $(OBJECTS:.o=.d)
|
||||
|
||||
ALL_UCM = $(UCM_SOURCE) $(UCM_SOURCE_LOCAL)
|
||||
UCM_FILES = $(ALL_UCM:%=$(top_srcdir)/../data/%)
|
||||
CNV_FILES = $(UCM_FILES:$(top_srcdir)/../data/%.ucm=$(top_builddir)/data/%.cnv)
|
||||
CNV_FILES = $(ALL_UCM:%.ucm=@DATABUILDDIR@/%.cnv)
|
||||
|
||||
## List of phony targets
|
||||
.PHONY : all all-local install install-local clean clean-local \
|
||||
@ -120,9 +120,9 @@ $(TARGET) : $(OBJECTS)
|
||||
$(LINK.c) -o $@ $^ $(LIBS)
|
||||
|
||||
# Rule to build a compiled cnv file
|
||||
$(top_builddir)/data/%.cnv : $(top_srcdir)/../data/%.ucm
|
||||
@DATABUILDDIR@/%.cnv : $(top_srcdir)/../data/%.ucm
|
||||
@echo -n "$< -> "
|
||||
@ICU_DATA=$(top_builddir)/data ./makeconv $<
|
||||
@ICU_DATA=@DATABUILDDIR@/ ./makeconv $<
|
||||
|
||||
ifneq ($(MAKECMDGOALS),distclean)
|
||||
-include $(DEPS)
|
||||
|
Loading…
Reference in New Issue
Block a user