ICU-3258 Deprecate the pkgdata -O option

X-SVN-Rev: 13150
This commit is contained in:
George Rhoten 2003-09-20 19:27:38 +00:00
parent 2781c969ac
commit a81fa53a61
6 changed files with 135 additions and 121 deletions

View file

@ -129,17 +129,6 @@ ICUTOOLS=$(ICUP)\source\tools
PATH = $(PATH);$(ICUP)\bin
# We have to prepare params for pkgdata - to help it find the tools
!IF "$(CFG)" == "Debug" || "$(CFG)" == "debug"
!MESSAGE makedata.mak: doing a Debug build.
PKGOPT=D:$(ICUP)
!ELSE
!MESSAGE makedata.mak: doing a Release build.
PKGOPT=R:$(ICUP)
!ENDIF
# Suffixes for data files
.SUFFIXES : .ucm .cnv .dll .dat .res .txt .c
@ -249,7 +238,7 @@ ALL : GODATA "$(DLL_OUTPUT)\$(U_ICUDATA_NAME).dll" "$(TESTDATAOUT)\testdata.dat"
"$(TESTDATAOUT)\testdata.dat": $(ICUDT)ucadata.icu $(TRANSLIT_FILES) $(MISC_FILES) $(RB_FILES) {"$(ICUTOOLS)\genrb\$(CFG)"}genrb.exe
@cd "$(TESTDATA)"
@echo building testdata...
nmake /nologo /f "$(TESTDATA)\testdata.mk" TESTDATA=. ICUTOOLS="$(ICUTOOLS)" PKGOPT="$(PKGOPT)" CFG=$(CFG) TESTDATAOUT="$(TESTDATAOUT)" ICUDATA="$(ICUDATA)" TESTDATABLD="$(TESTDATABLD)"
nmake /nologo /f "$(TESTDATA)\testdata.mk" TESTDATA=. ICUTOOLS="$(ICUTOOLS)" ICUP="$(ICUP)" CFG=$(CFG) TESTDATAOUT="$(TESTDATAOUT)" ICUDATA="$(ICUDATA)" TESTDATABLD="$(TESTDATABLD)"
#
# Break iterator data files.
@ -261,10 +250,10 @@ BRK_FILES = $(ICUDT)sent.brk $(ICUDT)char.brk $(ICUDT)line.brk $(ICUDT)word.brk
# move the .dll and .lib files to their final destination afterwards.
# The $(U_ICUDATA_NAME).lib and $(U_ICUDATA_NAME).exp should already be in the right place due to stubdata.
#
"$(DLL_OUTPUT)\$(U_ICUDATA_NAME).dll" : "$(ICUTOOLS)\pkgdata\$(CFG)\pkgdata.exe" $(CNV_FILES) $(BRK_FILES) "$(ICUBLD)\$(ICUDT)uprops.icu" "$(ICUBLD)\$(ICUDT)unames.icu" "$(ICUBLD)\$(ICUDT)pnames.icu" "$(ICUBLD)\$(ICUDT)unorm.icu" "$(ICUBLD)\$(ICUDT)cnvalias.icu" "$(ICUBLD)\$(ICUDT)ucadata.icu" "$(ICUBLD)\$(ICUDT)invuca.icu" "$(ICUBLD)\$(ICUDT)uidna.spp" $(ALL_RES) "$(ICUBLD)\$(ICUDT)icudata.res" "$(ICUP)\source\stubdata\stubdatabuilt.txt"
"$(DLL_OUTPUT)\$(U_ICUDATA_NAME).dll" : "$(ICUP)\bin\pkgdata.exe" $(CNV_FILES) $(BRK_FILES) "$(ICUBLD)\$(ICUDT)uprops.icu" "$(ICUBLD)\$(ICUDT)unames.icu" "$(ICUBLD)\$(ICUDT)pnames.icu" "$(ICUBLD)\$(ICUDT)unorm.icu" "$(ICUBLD)\$(ICUDT)cnvalias.icu" "$(ICUBLD)\$(ICUDT)ucadata.icu" "$(ICUBLD)\$(ICUDT)invuca.icu" "$(ICUBLD)\$(ICUDT)uidna.spp" $(ALL_RES) "$(ICUBLD)\$(ICUDT)icudata.res" "$(ICUP)\source\stubdata\stubdatabuilt.txt"
@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
@"$(ICUP)\bin\pkgdata" -f -e $(U_ICUDATA_NAME) -v -m dll -c -p $(ICUPKG) -d "$(ICUBLD)" -s . <<pkgdatain.txt
$(ICUDT)unorm.icu
$(ICUDT)uprops.icu
$(ICUDT)pnames.icu

View file

@ -37,7 +37,7 @@ CFG=Debug
!ENDIF
!MESSAGE ICU path is $(ICUP)
RESNAME=uconvmsg
RESDIR=. #$(ICUP)\..\icuapps\uconv\$(RESNAME)
RESDIR=.
RESFILES=resfiles.mk
ICUDATA=$(ICUP)\data
@ -50,20 +50,6 @@ ICD=$(ICUDATA)^\
DATA_PATH=$(ICUP)\data^\
ICUTOOLS=$(ICUP)\bin
# We have to prepare params for pkgdata - to help it find the tools
!IF "$(CFG)" == "Debug" || "$(CFG)" == "debug"
PKGOPT=D:$(ICUP)
!ELSE
PKGOPT=R:$(ICUP)
!ENDIF
# This appears in original Microsofts makefiles
!IF "$(OS)" == "Windows_NT"
NULL=
!ELSE
NULL=nul
!ENDIF
PATH = $(PATH);$(ICUP)\bin
# Suffixes for data files
@ -86,41 +72,30 @@ OUTPUT = "$(DLL_OUTPUT)\$(RESNAME).dll"
OUTPUT = "$(DLL_OUTPUT)\$(RESNAME).lib"
!ENDIF
ALL : GODATA $(OUTPUT) GOBACK #$(RESNAME).dat
ALL : $(OUTPUT)
@echo All targets are up to date (mode $(PKGMODE))
# invoke pkgdata - static
"$(DLL_OUTPUT)\$(RESNAME).lib" : $(RB_FILES) $(RESFILES)
"$(DLL_OUTPUT)\$(RESNAME).lib" : $(RB_FILES) $(RESFILES)
@echo Building $(RESNAME).lib
@"$(ICUTOOLS)\pkgdata" -f -v -m static -c -p $(RESNAME) -O "$(PKGOPT)" -d "$(DLL_OUTPUT)" -s "$(RESDIR)" <<pkgdatain.txt
@"$(ICUTOOLS)\pkgdata" -f -v -m static -c -p $(RESNAME) -d "$(DLL_OUTPUT)" -s "$(RESDIR)" <<pkgdatain.txt
$(RB_FILES:.res =.res
)
<<KEEP
# utility to send us to the right dir
GODATA :
# cd "$(RESDIR)"
# utility to get us back to the right dir
GOBACK :
# cd "$(RESDIR)\.."
# This is to remove all the data files
CLEAN :
@cd "$(RESDIR)"
-@erase "*.res"
-@erase "uconvmsg*.*"
-@erase "*.obj"
-@erase "base*.*"
@cd "$(ICUTOOLS)"
-@erase "$(RB_FILES)"
-@"$(ICUTOOLS)\pkgdata" -f --clean -v -m static -c -p $(RESNAME) -O "$(PKGOPT)" -d "$(DLL_OUTPUT)" -s "$(RESDIR)" pkgdatain.txt
-@erase "$(RESDIR)\uconvmsg*.*"
-@erase "$(CFG)\*uconvmsg*.*"
-@"$(ICUTOOLS)\pkgdata" -f --clean -v -m static -c -p $(RESNAME) -d "$(DLL_OUTPUT)" -s "$(RESDIR)" pkgdatain.txt
# Inference rule for creating resource bundles
.txt.res:
@echo Making Resource Bundle files
"$(ICUTOOLS)\genrb" -t -p $(RESNAME) -s $(@D) -d $(@D) $(?F)
"$(ICUTOOLS)\genrb" -t -p $(RESNAME) -s $(@D) -d $(@D) $(?F)
$(RESSRC) : {"$(ICUTOOLS)"}genrb.exe

View file

@ -17,7 +17,7 @@ ALL : "$(TESTDATAOUT)\testdata.dat"
"$(TESTDATAOUT)\testdata.dat" : "$(TESTDATABLD)\casing.res" "$(TESTDATABLD)\conversion.res" "$(TESTDATABLD)\mc.res" "$(TESTDATABLD)\root.res" "$(TESTDATABLD)\te.res" "$(TESTDATABLD)\te_IN.res" "$(TESTDATABLD)\testaliases.res" "$(TESTDATABLD)\testtypes.res" "$(TESTDATABLD)\testempty.res" "$(TESTDATABLD)\$(TESTDT)iscii.res" "$(TESTDATABLD)\$(TESTDT)idna_rules.res" "$(TESTDATABLD)\DataDrivenCollationTest.res" $(TESTDATABLD)\$(TESTDT)test.icu "$(TESTDATABLD)\$(TESTDT)test1.cnv" "$(TESTDATABLD)\$(TESTDT)test3.cnv" "$(TESTDATABLD)\$(TESTDT)test4.cnv" "$(TESTDATABLD)\$(TESTDT)ibm9027.cnv" "$(TESTDATABLD)\$(TESTDT)nfscsi.spp" "$(TESTDATABLD)\$(TESTDT)nfscss.spp" "$(TESTDATABLD)\$(TESTDT)nfscis.spp" "$(TESTDATABLD)\$(TESTDT)nfsmxs.spp" "$(TESTDATABLD)\$(TESTDT)nfsmxp.spp"
@echo Building test data
@copy "$(TESTDATABLD)\$(TESTDT)te.res" "$(TESTDATAOUT)\$(TESTDT)nam.typ"
@"$(ICUTOOLS)\pkgdata\$(CFG)\pkgdata" -f -v -m common -c -p"$(TESTPKG)" -O "$(PKGOPT)" -d "$(TESTDATAOUT)" -T "$(TESTDATABLD)" -s "$(TESTDATABLD)" <<
@"$(ICUP)\bin\pkgdata" -f -v -m common -c -p"$(TESTPKG)" -d "$(TESTDATAOUT)" -T "$(TESTDATABLD)" -s "$(TESTDATABLD)" <<
$(TESTDT)casing.res
$(TESTDT)conversion.res
$(TESTDT)mc.res

View file

@ -155,21 +155,28 @@ main(int argc, char* argv[]) {
}
if(!options[1].doesOccur) {
/* Try to fill in from icu-config or equivalent */
fillInMakefileFromICUConfig(&options[1]);
/* Try to fill in from icu-config or equivalent */
fillInMakefileFromICUConfig(&options[1]);
}
#ifdef WIN32
else {
fprintf(stderr, "Warning: You are using the deprecated -O option\n"
"\tYou can fix this warning by installing pkgdata, gencmn and genccode\n"
"\tinto the same directory and not specifying the -O option to pkgdata.\n");
}
#endif
if(!options[1].doesOccur) {
fprintf(stderr, " required parameter is missing: -O is required \n");
fprintf(stderr, "Run '%s --help' for help.\n", progname);
return 1;
fprintf(stderr, " required parameter is missing: -O is required \n");
fprintf(stderr, "Run '%s --help' for help.\n", progname);
return 1;
}
if(!options[0].doesOccur) /* -O we already have - don't report it. */
{
fprintf(stderr, " required parameter -p is missing \n");
fprintf(stderr, "Run '%s --help' for help.\n", progname);
return 1;
fprintf(stderr, " required parameter -p is missing \n");
fprintf(stderr, "Run '%s --help' for help.\n", progname);
return 1;
}
if(argc == 1) {
@ -254,33 +261,36 @@ main(int argc, char* argv[]) {
o.cShortName = csname;
}
o.verbose = options[5].doesOccur;
#ifdef WIN32 /* format is R:pathtoICU or D:pathtoICU */
{
char *pathstuff = (char *)options[1].value;
if(options[1].value[uprv_strlen(options[1].value)-1] == '\\') {
pathstuff[uprv_strlen(options[1].value)-1] = '\0';
}
if(*pathstuff == 'R' || *pathstuff == 'D') {
if(*pathstuff == PKGDATA_DERIVED_PATH || *pathstuff == 'R' || *pathstuff == 'D') {
o.options = pathstuff;
pathstuff++;
if(*pathstuff == ':') {
*pathstuff = '\0';
pathstuff++;
}
/* else {
fprintf(stderr, "Error: invalid windows build mode, should be R (release) or D (debug).\n", o.mode, progname);
else {
fprintf(stderr, "Error: invalid windows build mode, should be R (release) or D (debug).\n");
return 1;
}
} else {
fprintf(stderr, "Error: invalid windows build mode, should be R (release) or D (debug).\n", o.mode, progname);
return 1;*/
fprintf(stderr, "Error: invalid windows build mode, should be R (release) or D (debug).\n");
return 1;
}
o.icuroot = pathstuff;
if (o.verbose) {
fprintf(stdout, "# ICUROOT is %s\n", o.icuroot);
}
}
#else /* on UNIX, we'll just include the file... */
o.options = options[1].value;
#endif
o.verbose = options[5].doesOccur;
if(options[6].doesOccur) {
o.comment = U_COPYRIGHT_STRING;
} else if (options[7].doesOccur) {
@ -591,58 +601,77 @@ static void loadLists(UPKGOptions *o, UErrorCode *status)
void fillInMakefileFromICUConfig(UOption *option)
{
#if U_HAVE_POPEN
FILE *p;
size_t n;
static char buf[512] = "";
static const char cmd[] = "icu-config --incfile";
if(options[5].doesOccur)
{
/* informational */
fprintf(stderr, "%s: No -O option found, trying '%s'.\n", progname, cmd);
}
p = popen(cmd, "r");
if(p == NULL)
{
fprintf(stderr, "%s: icu-config: No icu-config found. (fix PATH or use -O option)\n", progname);
return;
}
n = fread(buf, 1, 511, p);
pclose(p);
if(n<=0)
{
fprintf(stderr,"%s: icu-config: Could not read from icu-config. (fix PATH or use -O option)\n", progname);
return;
}
if(buf[strlen(buf)-1]=='\n')
{
buf[strlen(buf)-1]=0;
}
if(buf[0] == 0)
{
fprintf(stderr, "%s: icu-config: invalid response from icu-config (fix PATH or use -O option)\n", progname);
return;
}
if(options[5].doesOccur)
{
/* informational */
fprintf(stderr, "%s: icu-config: using '-O %s'\n", progname, buf);
}
option->value = buf;
option->doesOccur = TRUE;
FILE *p;
size_t n;
static char buf[512] = "";
static const char cmd[] = "icu-config --incfile";
if(options[5].doesOccur)
{
/* informational */
fprintf(stderr, "%s: No -O option found, trying '%s'.\n", progname, cmd);
}
p = popen(cmd, "r");
if(p == NULL)
{
fprintf(stderr, "%s: icu-config: No icu-config found. (fix PATH or use -O option)\n", progname);
return;
}
n = fread(buf, 1, 511, p);
pclose(p);
if(n<=0)
{
fprintf(stderr,"%s: icu-config: Could not read from icu-config. (fix PATH or use -O option)\n", progname);
return;
}
if(buf[strlen(buf)-1]=='\n')
{
buf[strlen(buf)-1]=0;
}
if(buf[0] == 0)
{
fprintf(stderr, "%s: icu-config: invalid response from icu-config (fix PATH or use -O option)\n", progname);
return;
}
if(options[5].doesOccur)
{
/* informational */
fprintf(stderr, "%s: icu-config: using '-O %s'\n", progname, buf);
}
option->value = buf;
option->doesOccur = TRUE;
#else /* ! U_HAVE_POPEN */
/* no popen available */
/* Put other OS specific ways to search for the Makefile.inc type
information or else fail.. */
#ifdef WIN32
char tmp[1024];
char *fullEXEpath = _fullpath(tmp, progname, sizeof(tmp));
char *pathstuff = (char *)options[1].value;
if (fullEXEpath) {
pathstuff = strrchr(fullEXEpath, U_FILE_SEP_CHAR);
if (pathstuff) {
pathstuff[1] = 0;
uprv_memmove(fullEXEpath + 2, fullEXEpath, uprv_strlen(fullEXEpath)+1);
fullEXEpath[0] = PKGDATA_DERIVED_PATH;
fullEXEpath[1] = ':';
option->value = uprv_strdup(fullEXEpath);
option->doesOccur = TRUE;
}
}
/* else can't determine the path */
#endif
/* no popen available */
/* Put other OS specific ways to search for the Makefile.inc type
information or else fail.. */
#endif
}

View file

@ -147,5 +147,6 @@ typedef struct UPKGOptions_
#define UDATA_CMN_SUFFIX ".dat"
#define UDATA_CMN_INTERMEDIATE_SUFFIX "_dat"
#define PKGDATA_DERIVED_PATH '\t'
#endif

View file

@ -32,7 +32,8 @@
#include <stdio.h>
#include <stdlib.h>
#define WINBUILDMODE (*(o->options)=='R'?"Release":"Debug")
/*#define WINBUILDMODE (*(o->options)=='R'?"Release":"Debug")*/
#define CONTAINS_REAL_PATH(o) (*(o->options)==PKGDATA_DERIVED_PATH)
void writeCmnRules(UPKGOptions *o, FileStream *makefile)
{
@ -79,8 +80,14 @@ void pkg_mode_windows(UPKGOptions *o, FileStream *makefile, UErrorCode *status)
sprintf(tmp2, "ICUROOT=%s\n\n", o->icuroot);
T_FileStream_writeLine(makefile, tmp2);
sprintf(tmp2,
"GENCMN = $(ICUROOT)%sbin\\gencmn.exe\n", separator);
if (CONTAINS_REAL_PATH(o)) {
sprintf(tmp2,
"GENCMN = $(ICUROOT)%sgencmn.exe\n", separator);
}
else {
sprintf(tmp2,
"GENCMN = $(ICUROOT)%sbin\\gencmn.exe\n", separator);
}
T_FileStream_writeLine(makefile, tmp2);
if(isDll) {
@ -110,8 +117,14 @@ void pkg_mode_windows(UPKGOptions *o, FileStream *makefile, UErrorCode *status)
);
T_FileStream_writeLine(makefile, tmp2);
sprintf(tmp2,
"GENCCODE = $(ICUROOT)%sbin\\genccode.exe\n", separator);
if (CONTAINS_REAL_PATH(o)) {
sprintf(tmp2,
"GENCCODE = $(ICUROOT)%sgenccode.exe\n", separator);
}
else {
sprintf(tmp2,
"GENCCODE = $(ICUROOT)%sbin\\genccode.exe\n", separator);
}
T_FileStream_writeLine(makefile, tmp2);
T_FileStream_writeLine(makefile, "\n"
@ -159,8 +172,15 @@ void pkg_mode_windows(UPKGOptions *o, FileStream *makefile, UErrorCode *status)
);
T_FileStream_writeLine(makefile, tmp2);
sprintf(tmp2,
"GENCCODE = $(ICUROOT)%sbin\\genccode.exe\n", separator);
if (CONTAINS_REAL_PATH(o)) {
sprintf(tmp2,
"GENCCODE = $(ICUROOT)%sgenccode.exe\n", separator);
}
else {
sprintf(tmp2,
"GENCCODE = $(ICUROOT)%sbin\\genccode.exe\n", separator);
}
T_FileStream_writeLine(makefile, tmp2);
T_FileStream_writeLine(makefile, "\n"