ICU-2858 Make it easier to remove data from the data library
X-SVN-Rev: 11799
This commit is contained in:
parent
962c18923a
commit
b95dc6d27d
@ -234,7 +234,7 @@ ALL : GODATA "$(DLL_OUTPUT)\$(U_ICUDATA_NAME).dll" "$(TESTDATAOUT)\testdata.dat"
|
||||
#
|
||||
# Break iterator data files.
|
||||
#
|
||||
BRK_FILES = "$(ICUBLD)\$(ICUDT)sent.brk" "$(ICUBLD)\$(ICUDT)char.brk" "$(ICUBLD)\$(ICUDT)line.brk" "$(ICUBLD)\$(ICUDT)word.brk" "$(ICUBLD)\$(ICUDT)title.brk" "$(ICUBLD)\$(ICUDT)line_th.brk" "$(ICUBLD)\$(ICUDT)word_th.brk"
|
||||
BRK_FILES = $(ICUDT)sent.brk $(ICUDT)char.brk $(ICUDT)line.brk $(ICUDT)word.brk $(ICUDT)title.brk $(ICUDT)line_th.brk $(ICUDT)word_th.brk
|
||||
|
||||
#invoke pkgdata for ICU common data
|
||||
# pkgdata will drop all output files (.dat, .dll, .lib) into the target (ICUBLD) directory.
|
||||
@ -245,20 +245,20 @@ BRK_FILES = "$(ICUBLD)\$(ICUDT)sent.brk" "$(ICUBLD)\$(ICUDT)char.brk" "$(ICUBLD)
|
||||
@echo Building icu data
|
||||
@cd "$(ICUBLD)"
|
||||
@"$(ICUTOOLS)\pkgdata\$(CFG)\pkgdata" -f -e $(U_ICUDATA_NAME) -v -m dll -c -p $(ICUPKG) -O "$(PKGOPT)" -d "$(ICUBLD)" -s . <<pkgdatain.txt
|
||||
$(ICUDT)uprops.icu
|
||||
$(ICUDT)unames.icu
|
||||
$(ICUDT)pnames.icu
|
||||
$(ICUDT)unorm.icu
|
||||
$(ICUDT)cnvalias.icu
|
||||
$(ICUDT)tz.icu
|
||||
$(ICUDT)uprops.icu
|
||||
$(ICUDT)pnames.icu
|
||||
$(ICUDT)unames.icu
|
||||
$(ICUDT)ucadata.icu
|
||||
$(ICUDT)invuca.icu
|
||||
$(ICUDT)uidna.icu
|
||||
$(ICUDT)tz.icu
|
||||
$(ICUDT)cnvalias.icu
|
||||
$(CNV_FILES:.cnv =.cnv
|
||||
)
|
||||
$(ALL_RES:.res =.res
|
||||
)
|
||||
$(BRK_FILES:.brk" =.brk"
|
||||
$(BRK_FILES:.brk =.brk
|
||||
)
|
||||
<<KEEP
|
||||
copy "$(ICUPKG).dll" "$(DLL_OUTPUT)"
|
||||
@ -274,26 +274,26 @@ $(BRK_FILES:.brk" =.brk"
|
||||
|
||||
BRKDEPS = "$(ICUBLD)\$(ICUDT)uprops.icu" "$(ICUBLD)\$(ICUDT)unames.icu" "$(ICUBLD)\$(ICUDT)pnames.icu" "$(ICUBLD)\$(ICUDT)unorm.icu"
|
||||
|
||||
"$(ICUBLD)\$(ICUDT)char.brk" : "$(ICUBRK)\char.txt" $(BRKDEPS)
|
||||
genbrk -r "$(ICUBRK)\char.txt" -o "$(ICUBLD)\$(ICUDT)char.brk" -i "$(ICUBLD)\\"
|
||||
$(ICUDT)char.brk : "$(ICUBRK)\char.txt" $(BRKDEPS)
|
||||
genbrk -r "$(ICUBRK)\char.txt" -o $@ -d"$(ICUBLD)" -i "$(ICUBLD)\\"
|
||||
|
||||
"$(ICUBLD)\$(ICUDT)word.brk" : "$(ICUBRK)\word.txt" $(BRKDEPS)
|
||||
genbrk -r "$(ICUBRK)\word.txt" -o "$(ICUBLD)\$(ICUDT)word.brk" -i "$(ICUBLD)\\"
|
||||
$(ICUDT)word.brk : "$(ICUBRK)\word.txt" $(BRKDEPS)
|
||||
genbrk -r "$(ICUBRK)\word.txt" -o $@ -d"$(ICUBLD)" -i "$(ICUBLD)\\"
|
||||
|
||||
"$(ICUBLD)\$(ICUDT)line.brk" : "$(ICUBRK)\line.txt" $(BRKDEPS)
|
||||
genbrk -r "$(ICUBRK)\line.txt" -o "$(ICUBLD)\$(ICUDT)line.brk" -i "$(ICUBLD)\\"
|
||||
$(ICUDT)line.brk : "$(ICUBRK)\line.txt" $(BRKDEPS)
|
||||
genbrk -r "$(ICUBRK)\line.txt" -o $@ -d"$(ICUBLD)" -i "$(ICUBLD)\\"
|
||||
|
||||
"$(ICUBLD)\$(ICUDT)sent.brk" : "$(ICUBRK)\sent.txt" $(BRKDEPS)
|
||||
genbrk -r "$(ICUBRK)\sent.txt" -o "$(ICUBLD)\$(ICUDT)sent.brk" -i "$(ICUBLD)\\"
|
||||
$(ICUDT)sent.brk : "$(ICUBRK)\sent.txt" $(BRKDEPS)
|
||||
genbrk -r "$(ICUBRK)\sent.txt" -o $@ -d"$(ICUBLD)" -i "$(ICUBLD)\\"
|
||||
|
||||
"$(ICUBLD)\$(ICUDT)title.brk" : "$(ICUBRK)\title.txt" $(BRKDEPS)
|
||||
genbrk -r "$(ICUBRK)\title.txt" -o "$(ICUBLD)\$(ICUDT)title.brk" -i "$(ICUBLD)\\"
|
||||
$(ICUDT)title.brk : "$(ICUBRK)\title.txt" $(BRKDEPS)
|
||||
genbrk -r "$(ICUBRK)\title.txt" -o $@ -d"$(ICUBLD)" -i "$(ICUBLD)\\"
|
||||
|
||||
"$(ICUBLD)\$(ICUDT)word_th.brk" : "$(ICUBRK)\word_th.txt" $(BRKDEPS)
|
||||
genbrk -r "$(ICUBRK)\word_th.txt" -o "$(ICUBLD)\$(ICUDT)word_th.brk" -i "$(ICUBLD)\\"
|
||||
$(ICUDT)word_th.brk : "$(ICUBRK)\word_th.txt" $(BRKDEPS)
|
||||
genbrk -r "$(ICUBRK)\word_th.txt" -o $@ -d"$(ICUBLD)" -i "$(ICUBLD)\\"
|
||||
|
||||
"$(ICUBLD)\$(ICUDT)line_th.brk" : "$(ICUBRK)\line_th.txt" $(BRKDEPS)
|
||||
genbrk -r "$(ICUBRK)\line_th.txt" -o "$(ICUBLD)\$(ICUDT)line_th.brk" -i "$(ICUBLD)\\"
|
||||
$(ICUDT)line_th.brk : "$(ICUBRK)\line_th.txt" $(BRKDEPS)
|
||||
genbrk -r "$(ICUBRK)\line_th.txt" -o $@ -d"$(ICUBLD)" -i "$(ICUBLD)\\"
|
||||
|
||||
|
||||
# utility target to send us to the right dir
|
||||
@ -340,8 +340,7 @@ CLEAN : GODATA
|
||||
@echo Making Transliterator Resource Bundle files
|
||||
@"$(ICUTOOLS)\genrb\$(CFG)\genrb" -k -t -p"$(ICUPKG)" -d"$(ICUBLD)" $<
|
||||
|
||||
# Inference rule for creating resource bundle files
|
||||
{$(ICUSRCDATA_RELATIVE_PATH)\$(ICULOC)}.txt.res::
|
||||
$(INDEX_RES_FILES):
|
||||
@echo Generating <<res_index.txt
|
||||
// Warning this file is automatically generated
|
||||
res_index {
|
||||
@ -351,8 +350,12 @@ res_index {
|
||||
}
|
||||
}
|
||||
<<KEEP
|
||||
echo Making Locale Resource Bundle files
|
||||
@"$(ICUTOOLS)\genrb\$(CFG)\genrb" -k -t -p"$(ICUPKG)" -d"$(ICUBLD)" .\res_index.txt $<
|
||||
@"$(ICUTOOLS)\genrb\$(CFG)\genrb" -k -t -p"$(ICUPKG)" -d"$(ICUBLD)" .\res_index.txt
|
||||
|
||||
# Inference rule for creating resource bundle files
|
||||
{$(ICUSRCDATA_RELATIVE_PATH)\$(ICULOC)}.txt.res::
|
||||
@echo Making Locale Resource Bundle files
|
||||
@"$(ICUTOOLS)\genrb\$(CFG)\genrb" -k -t -p"$(ICUPKG)" -d"$(ICUBLD)" $<
|
||||
|
||||
# DLL version information
|
||||
"$(ICUBLD)\$(ICUDT)icudata.res": "$(ICUMISC)\icudata.rc"
|
||||
@ -410,5 +413,5 @@ res_index {
|
||||
|
||||
$(UCM_SOURCE) : {"$(ICUTOOLS)\makeconv\$(CFG)"}makeconv.exe
|
||||
|
||||
$(TRANSLIT_SOURCE) $(GENRB_SOURCE) $(ICUDT)root.res : {"$(ICUTOOLS)\genrb\$(CFG)"}genrb.exe $(ICUDT)ucadata.icu $(ICUDT)uprops.icu $(ICUDT)unorm.icu
|
||||
$(TRANSLIT_SOURCE) $(GENRB_SOURCE) "$(ICUBLD)\$(ICUDT)root.res" : {"$(ICUTOOLS)\genrb\$(CFG)"}genrb.exe "$(ICUBLD)\$(ICUDT)ucadata.icu" "$(ICUBLD)\$(ICUDT)uprops.icu" "$(ICUBLD)\$(ICUDT)unorm.icu"
|
||||
|
||||
|
@ -51,7 +51,8 @@ static UOption options[]={
|
||||
UOPTION_VERBOSE, /* 2 */
|
||||
{ "rules", NULL, NULL, NULL, 'r', UOPT_REQUIRES_ARG, 0 }, /* 3 */
|
||||
{ "out", NULL, NULL, NULL, 'o', UOPT_REQUIRES_ARG, 0 }, /* 4 */
|
||||
UOPTION_ICUDATADIR /* 5 */
|
||||
UOPTION_ICUDATADIR, /* 5 */
|
||||
UOPTION_DESTDIR /* 6 */
|
||||
};
|
||||
|
||||
void usageAndDie(int retCode) {
|
||||
@ -111,6 +112,9 @@ int main(int argc, char **argv) {
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
const char *ruleFileName;
|
||||
const char *outFileName;
|
||||
const char *outDir = NULL;
|
||||
char *outFullFileName;
|
||||
int32_t outFullFileNameLen;
|
||||
|
||||
//
|
||||
// Pick up and check the command line arguments,
|
||||
@ -136,11 +140,25 @@ int main(int argc, char **argv) {
|
||||
}
|
||||
ruleFileName = options[3].value;
|
||||
outFileName = options[4].value;
|
||||
outFullFileNameLen = strlen(outFileName);
|
||||
|
||||
if (options[5].doesOccur) {
|
||||
u_setDataDirectory(options[5].value);
|
||||
}
|
||||
|
||||
/* Combine the directory with the file name */
|
||||
if(options[6].doesOccur) {
|
||||
outDir = options[6].value;
|
||||
outFullFileNameLen += strlen(outDir);
|
||||
}
|
||||
outFullFileName = (char*)malloc(outFullFileNameLen + 2);
|
||||
outFullFileName[0] = 0;
|
||||
if (outDir) {
|
||||
strcpy(outFullFileName, outDir);
|
||||
strcat(outFullFileName, U_FILE_SEP_STRING);
|
||||
}
|
||||
strcat(outFullFileName, outFileName);
|
||||
|
||||
#if UCONFIG_NO_BREAK_ITERATION
|
||||
|
||||
UNewDataMemory *pData;
|
||||
@ -292,9 +310,9 @@ int main(int argc, char **argv) {
|
||||
// Create the output file
|
||||
//
|
||||
size_t bytesWritten;
|
||||
file = fopen(outFileName, "wb");
|
||||
file = fopen(outFullFileName, "wb");
|
||||
if (file == 0) {
|
||||
fprintf(stderr, "Could not open output file \"%s\"\n", outFileName);
|
||||
fprintf(stderr, "Could not open output file \"%s\"\n", outFullFileName);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
@ -305,7 +323,7 @@ int main(int argc, char **argv) {
|
||||
//
|
||||
bytesWritten = fwrite(outData, 1, outDataSize, file);
|
||||
if (bytesWritten != outDataSize) {
|
||||
fprintf(stderr, "Error writing to output file \"%s\"\n", outFileName);
|
||||
fprintf(stderr, "Error writing to output file \"%s\"\n", outFullFileName);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
@ -313,6 +331,7 @@ int main(int argc, char **argv) {
|
||||
delete bi;
|
||||
delete[] ruleSourceU;
|
||||
delete[] ruleBufferC;
|
||||
free(outFullFileName);
|
||||
u_cleanup();
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user