mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-21 12:40:02 +00:00
ICU-3933 Remove unused files and code and update project files and makefiles to reflect this change. Update man page. Add files mode functionality to pkgdata. Clean up code.
X-SVN-Rev: 25383
This commit is contained in:
parent
4c140edc87
commit
f94144a976
16 changed files with 195 additions and 1823 deletions
|
@ -165,6 +165,13 @@ endif
|
|||
## Install ICU data.
|
||||
install-local: $(PKGDATA_LIST) ./icupkg.inc packagedata $(OS390INSTALL)
|
||||
$(MKINSTALLDIRS) $(TMPDATADIR) $(DESTDIR)$(ICUPKGDATA_DIR)
|
||||
ifeq ($(PKGDATA_MODE),files)
|
||||
$(MKINSTALLDIRS) $(ICUPKGDATA_DIR)/$(ICUDATA_NAME)
|
||||
$(MKINSTALLDIRS) $(ICUPKGDATA_DIR)/$(ICUDATA_NAME)/$(BREAK_TREE)
|
||||
$(MKINSTALLDIRS) $(ICUPKGDATA_DIR)/$(ICUDATA_NAME)/$(COLLATION_TREE)
|
||||
$(MKINSTALLDIRS) $(ICUPKGDATA_DIR)/$(ICUDATA_NAME)/$(RBNF_TREE)
|
||||
$(MKINSTALLDIRS) $(ICUPKGDATA_DIR)/$(ICUDATA_NAME)/$(TRANSLIT_TREE)
|
||||
endif
|
||||
ifneq ($(ENABLE_STATIC),)
|
||||
ifeq ($(PKGDATA_MODE),dll)
|
||||
$(PKGDATA_INVOKE) $(PKGDATA) -m static -e $(ICUDATA_ENTRY_POINT) -T $(OUTTMPDIR) -s $(BUILDDIR) -p $(ICUDATA_NAME) $(PKGDATA_LIBSTATICNAME) $(PKGDATA_LIST) -I $(ICUPKGDATA_INSTALL_LIBDIR)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
## pkgdataMakefile.in for ICU data
|
||||
## Copyright (c) 2008, International Business Machines Corporation and
|
||||
## Copyright (c) 2008-2009, International Business Machines Corporation and
|
||||
## others. All Rights Reserved.
|
||||
|
||||
## Source directory information
|
||||
|
@ -32,7 +32,7 @@ all : clean
|
|||
@echo AR=$(AR) >> $(OUTPUTFILE)
|
||||
@echo ARFLAGS=$(ARFLAGS) >> $(OUTPUTFILE)
|
||||
@echo RANLIB=$(RANLIB) >> $(OUTPUTFILE)
|
||||
@echo INSTALL_CMD=$(INSTALL-L) >> $(OUTPUTFILE)
|
||||
@echo INSTALL_CMD=$(INSTALL_DATA) >> $(OUTPUTFILE)
|
||||
|
||||
|
||||
clean :
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
## pkgdataMakefile.in for ICU data
|
||||
## Copyright (c) 2008, International Business Machines Corporation and
|
||||
## Copyright (c) 2008-2009, International Business Machines Corporation and
|
||||
## others. All Rights Reserved.
|
||||
|
||||
## Source directory information
|
||||
|
@ -33,7 +33,7 @@ all : clean
|
|||
@echo AR=$(AR) >> $(OUTPUTFILE)
|
||||
@echo ARFLAGS=$(ARFLAGS) >> $(OUTPUTFILE)
|
||||
@echo RANLIB=$(RANLIB) >> $(OUTPUTFILE)
|
||||
@echo INSTALL_CMD=$(INSTALL-L) >> $(OUTPUTFILE)
|
||||
@echo INSTALL_CMD=$(INSTALL_DATA) >> $(OUTPUTFILE)
|
||||
|
||||
clean :
|
||||
$(RMV) $(OUTPUTFILE)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
## pkgdataMakefile.in for ICU data
|
||||
## Copyright (c) 2008, International Business Machines Corporation and
|
||||
## Copyright (c) 2008-2009, International Business Machines Corporation and
|
||||
## others. All Rights Reserved.
|
||||
|
||||
## Source directory information
|
||||
|
@ -33,7 +33,7 @@ all : clean
|
|||
@echo AR=$(AR) >> $(OUTPUTFILE)
|
||||
@echo ARFLAGS=$(ARFLAGS) >> $(OUTPUTFILE)
|
||||
@echo RANLIB=$(RANLIB) >> $(OUTPUTFILE)
|
||||
@echo INSTALL_CMD=$(INSTALL-L) >> $(OUTPUTFILE)
|
||||
@echo INSTALL_CMD=$(INSTALL_DATA) >> $(OUTPUTFILE)
|
||||
|
||||
clean :
|
||||
$(RMV) $(OUTPUTFILE)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
## Makefile.in for ICU - tools/pkgdata
|
||||
## Copyright (c) 1999-2008, International Business Machines Corporation and
|
||||
## Copyright (c) 1999-2009, International Business Machines Corporation and
|
||||
## others. All Rights Reserved.
|
||||
## Steven R. Loomis
|
||||
|
||||
|
@ -37,7 +37,7 @@ CPPFLAGS += -I$(top_srcdir)/common -I$(srcdir)/../toolutil
|
|||
DEFS += -DUDATA_SO_SUFFIX=\".$(SO)\" -DSTATIC_O=\"$(STATIC_O)\"
|
||||
LIBS = $(LIBICUTOOLUTIL) $(LIBICUI18N) $(LIBICUUC) $(DEFAULT_LIBS) $(LIB_M)
|
||||
|
||||
OBJECTS = pkgdata.o pkgtypes.o make.o dllmode.o cmnmode.o filemode.o sttcmode.o winmode.o
|
||||
OBJECTS = pkgdata.o pkgtypes.o
|
||||
|
||||
DEPS = $(OBJECTS:.o=.d)
|
||||
|
||||
|
|
|
@ -1,105 +0,0 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* Copyright (C) 2000-2006, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
*
|
||||
*******************************************************************************
|
||||
* file name: pkgdata.c
|
||||
* encoding: ANSI X3.4 (1968)
|
||||
* tab size: 8 (not used)
|
||||
* indentation:4
|
||||
*
|
||||
* created on: 2000may15
|
||||
* created by: Steven \u24C7 Loomis
|
||||
*
|
||||
* This program packages the ICU data into different forms
|
||||
* (DLL, common data, etc.)
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "unicode/utypes.h"
|
||||
#include "unicode/putil.h"
|
||||
#include "cmemory.h"
|
||||
#include "cstring.h"
|
||||
#include "filestrm.h"
|
||||
#include "toolutil.h"
|
||||
#include "unewdata.h"
|
||||
#include "uoptions.h"
|
||||
#include "pkgtypes.h"
|
||||
#include "makefile.h"
|
||||
|
||||
void pkg_mode_common(UPKGOptions *o, FileStream *makefile, UErrorCode *status)
|
||||
{
|
||||
char tmp[1024];
|
||||
CharList *tail = NULL;
|
||||
|
||||
uprv_strcpy(tmp, UDATA_CMN_PREFIX);
|
||||
uprv_strcat(tmp, o->shortName);
|
||||
uprv_strcat(tmp, UDATA_CMN_SUFFIX);
|
||||
|
||||
if(!uprv_strcmp(o->mode, "common")) {
|
||||
/* If we're not the main mode.. don't change the output file list */
|
||||
|
||||
/* We should be the only item. So we don't care about the order. */
|
||||
o->outFiles = pkg_appendToList(o->outFiles, &tail, uprv_strdup(tmp));
|
||||
|
||||
if(o->nooutput || o->verbose) {
|
||||
fprintf(stdout, "# Output file: %s%s%s\n", o->targetDir, U_FILE_SEP_STRING, tmp);
|
||||
}
|
||||
|
||||
if(o->nooutput) {
|
||||
*status = U_ZERO_ERROR;
|
||||
return;
|
||||
}
|
||||
|
||||
sprintf(tmp, "# File to make:\nTARGET=%s%s%s\n\nTARGETNAME=%s\n", o->targetDir,
|
||||
U_FILE_SEP_STRING,
|
||||
o->outFiles->str,
|
||||
o->outFiles->str);
|
||||
T_FileStream_writeLine(makefile, tmp);
|
||||
} else {
|
||||
/* We're in another mode. but, set the target so they can find us.. */
|
||||
T_FileStream_writeLine(makefile, "TARGET=");
|
||||
T_FileStream_writeLine(makefile, tmp);
|
||||
T_FileStream_writeLine(makefile, "\n\n");
|
||||
|
||||
} /* end [check to make sure we are in mode 'common' ] */
|
||||
|
||||
sprintf(tmp, "# List file for gencmn:\n"
|
||||
"CMNLIST=%s%s%s_common.lst\n\n",
|
||||
o->tmpDir,
|
||||
U_FILE_SEP_STRING,
|
||||
o->shortName);
|
||||
T_FileStream_writeLine(makefile, tmp);
|
||||
|
||||
sprintf(tmp, "all: $(TARGET)\n\n");
|
||||
T_FileStream_writeLine(makefile, tmp);
|
||||
|
||||
T_FileStream_writeLine(makefile, "$(TARGET): $(CMNLIST) $(DATAFILEPATHS)\n"
|
||||
"\t$(INVOKE) $(ICUPKG) -t$(ICUDATA_CHAR) -c -s $(SRCDIR) -a $(CMNLIST) new $(TARGETDIR)/$(CNAME).dat\n\n");
|
||||
|
||||
if(o->hadStdin == FALSE) { /* shortcut */
|
||||
T_FileStream_writeLine(makefile, "$(CMNLIST): $(LISTFILES)\n"
|
||||
"\tcat $(LISTFILES) > $(CMNLIST)\n\n");
|
||||
} else {
|
||||
T_FileStream_writeLine(makefile, "$(CMNLIST): \n"
|
||||
"\t@echo \"generating $@ (list of data files)\"\n"
|
||||
"\t@-$(RMV) $@\n"
|
||||
"\t@for file in $(DATAFILEPATHS); do \\\n"
|
||||
"\t echo $$file >> $@; \\\n"
|
||||
"\tdone;\n\n");
|
||||
}
|
||||
|
||||
if(!uprv_strcmp(o->mode, "common")) { /* only install/clean in our own mode */
|
||||
T_FileStream_writeLine(makefile, "CLEANFILES= $(CMNLIST) $(TARGET)\n\nclean:\n\t-$(RMV) $(CLEANFILES) $(MAKEFILE)");
|
||||
T_FileStream_writeLine(makefile, "\n\n");
|
||||
|
||||
sprintf(tmp, "install: $(TARGET)\n"
|
||||
"\t$(INSTALL_DATA) $(TARGET) $(INSTALLTO)%s$(TARGETNAME)\n\n",
|
||||
U_FILE_SEP_STRING);
|
||||
|
||||
T_FileStream_writeLine(makefile, tmp);
|
||||
|
||||
}
|
||||
}
|
|
@ -1,297 +0,0 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* Copyright (C) 2000-2008, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
*
|
||||
*******************************************************************************
|
||||
* file name: pkgdata.c
|
||||
* encoding: ANSI X3.4 (1968)
|
||||
* tab size: 8 (not used)
|
||||
* indentation:4
|
||||
*
|
||||
* created on: 2000may15
|
||||
* created by: Steven \u24C7 Loomis
|
||||
*
|
||||
* This program packages the ICU data into different forms
|
||||
* (DLL, common data, etc.)
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "unicode/utypes.h"
|
||||
#include "unicode/putil.h"
|
||||
|
||||
#ifndef U_MAKE_IS_NMAKE
|
||||
#include "cmemory.h"
|
||||
#include "cstring.h"
|
||||
#include "filestrm.h"
|
||||
#include "toolutil.h"
|
||||
#include "unewdata.h"
|
||||
#include "uoptions.h"
|
||||
#include "pkgtypes.h"
|
||||
#include "makefile.h"
|
||||
|
||||
|
||||
void pkg_mode_dll(UPKGOptions *o, FileStream *makefile, UErrorCode *status)
|
||||
{
|
||||
char tmp[1024];
|
||||
CharList *tail = NULL;
|
||||
CharList *objects = NULL;
|
||||
|
||||
if(U_FAILURE(*status)) {
|
||||
return;
|
||||
}
|
||||
|
||||
uprv_strcpy(tmp, LIB_PREFIX "$(LIBNAME)" UDATA_SO_SUFFIX);
|
||||
|
||||
/* We should be the only item. So we don't care about the order. */
|
||||
o->outFiles = pkg_appendToList(o->outFiles, &tail, uprv_strdup(tmp));
|
||||
|
||||
if(o->nooutput || o->verbose) {
|
||||
fprintf(stdout, "# Output file: %s%s%s\n", o->targetDir, U_FILE_SEP_STRING, tmp);
|
||||
}
|
||||
|
||||
if(o->nooutput) {
|
||||
*status = U_ZERO_ERROR;
|
||||
return;
|
||||
}
|
||||
|
||||
/* begin writing makefile ========================= */
|
||||
|
||||
|
||||
/*390port start*/
|
||||
#ifdef OS390BATCH
|
||||
if (uprv_strcmp(o->libName, U_LIBICUDATA_NAME) == 0)
|
||||
sprintf(tmp, "# File to make:\nBATCH_TARGET=\"//'${LOADMOD}(IXMI" U_ICU_VERSION_SHORT "DA)'\"\n\n");
|
||||
else if (uprv_strcmp(o->libName, "testdata") == 0)
|
||||
sprintf(tmp, "# File to make:\nBATCH_TARGET=\"//'${LOADMOD}(IXMI" U_ICU_VERSION_SHORT "TE)'\"\n\n");
|
||||
else if (uprv_strcmp(o->libName, U_LIBICUDATA_NAME"_stub") == 0)
|
||||
sprintf(tmp, "# File to make:\nBATCH_TARGET=\"//'${LOADMOD}(IXMI" U_ICU_VERSION_SHORT "D1)'\"\n\n");
|
||||
else
|
||||
sprintf(tmp, "\n");
|
||||
T_FileStream_writeLine(makefile, tmp);
|
||||
#endif
|
||||
|
||||
T_FileStream_writeLine(makefile, "# Version numbers:\nVERSIONED=");
|
||||
if (o->version) {
|
||||
sprintf(tmp, ".%s", o->version);
|
||||
if (!uprv_strchr(o->version, '.')) {
|
||||
uprv_strcat(tmp, ".0");
|
||||
}
|
||||
T_FileStream_writeLine(makefile, tmp);
|
||||
T_FileStream_writeLine(makefile, "\nDLL_LDFLAGS=$(LD_SONAME) $(RPATH_LDFLAGS) $(BIR_LDFLAGS)\nDLL_DEPS=$(BIR_DEPS)\n");
|
||||
} else {
|
||||
T_FileStream_writeLine(makefile, "\nDLL_LDFLAGS=$(BIR_LDFLAGS)\nDLL_DEPS=$(BIR_DEPS)\n");
|
||||
}
|
||||
T_FileStream_writeLine(makefile, "\n");
|
||||
|
||||
sprintf(tmp, "# File to make:\nTARGET=%s\n\n", o->outFiles->str);
|
||||
T_FileStream_writeLine(makefile, tmp);
|
||||
if (o->version) {
|
||||
char *p;
|
||||
const char *v;
|
||||
|
||||
T_FileStream_writeLine(makefile, "SO_TARGET=$(TARGET)\n");
|
||||
sprintf(tmp, "SO_TARGET_VERSION=%s\n", o->version);
|
||||
T_FileStream_writeLine(makefile, tmp);
|
||||
uprv_strcpy(tmp, "SO_TARGET_VERSION_MAJOR=");
|
||||
for (p = tmp + uprv_strlen(tmp), v = o->version; *v && *v != '.'; ++v) {
|
||||
*p++ = *v;
|
||||
}
|
||||
*p++ = '\n';
|
||||
*p++ = '\n';
|
||||
*p++ = 0;
|
||||
T_FileStream_writeLine(makefile, tmp);
|
||||
} else {
|
||||
T_FileStream_writeLine(makefile, "FINAL_SO_TARGET=$(TARGET)\n");
|
||||
T_FileStream_writeLine(makefile, "MIDDLE_SO_TARGET=$(TARGET)\n");
|
||||
}
|
||||
|
||||
T_FileStream_writeLine(makefile, "DYNAMICCPPFLAGS=$(SHAREDLIBCPPFLAGS)\n");
|
||||
T_FileStream_writeLine(makefile, "DYNAMICCFLAGS=$(SHAREDLIBCFLAGS)\n");
|
||||
T_FileStream_writeLine(makefile, "DYNAMICCXXFLAGS=$(SHAREDLIBCXXFLAGS)\n");
|
||||
T_FileStream_writeLine(makefile, "\n");
|
||||
|
||||
#ifdef OS400
|
||||
sprintf(tmp, "# Force override for iSeries compilation since data does not need to be\n"
|
||||
"# nor can excessively large files be compiled for debug\n"
|
||||
"override COMPILE.c= $(CC) $(DEFS) $(CPPFLAGS) -O4 -c -qTERASPACE=*YES -qSTGMDL=*INHERIT -qPFROPT=*STRDONLY\n\n");
|
||||
T_FileStream_writeLine(makefile, tmp);
|
||||
#endif
|
||||
|
||||
uprv_strcpy(tmp, "all: $(TARGETDIR)/$(FINAL_SO_TARGET) $(BATCH_TARGET)");
|
||||
if (o->version) {
|
||||
uprv_strcat(tmp, " $(TARGETDIR)/$(MIDDLE_SO_TARGET) $(TARGETDIR)/$(SO_TARGET)");
|
||||
}
|
||||
uprv_strcat(tmp, "\n\n");
|
||||
T_FileStream_writeLine(makefile, tmp);
|
||||
|
||||
#ifdef OS400
|
||||
/* New for iSeries: All packaged data in one .c */
|
||||
sprintf(tmp, "# Create a file which contains all .c data files/structures\n"
|
||||
"$(TEMP_DIR)/$(NAME)all.c: $(CMNLIST)\n\n");
|
||||
T_FileStream_writeLine(makefile, tmp);
|
||||
#endif
|
||||
|
||||
/* Write compile rules */
|
||||
pkg_mak_writeObjRules(o, makefile, &objects, OBJ_SUFFIX);
|
||||
|
||||
sprintf(tmp, "# List file for gencmn:\n"
|
||||
"CMNLIST=%s%s$(NAME)_dll.lst\n\n",
|
||||
o->tmpDir,
|
||||
U_FILE_SEP_STRING);
|
||||
T_FileStream_writeLine(makefile, tmp);
|
||||
|
||||
if(o->hadStdin == FALSE) { /* shortcut */
|
||||
T_FileStream_writeLine(makefile, "$(CMNLIST): $(LISTFILES)\n"
|
||||
"\tcat $(LISTFILES) > $(CMNLIST)\n\n");
|
||||
} else {
|
||||
T_FileStream_writeLine(makefile, "$(CMNLIST): \n"
|
||||
"\t@echo \"generating $@ (list of data files)\"\n"
|
||||
"\t@-$(RMV) $@\n"
|
||||
"\t@for file in $(DATAFILEPATHS); do \\\n"
|
||||
"\t echo $$file >> $@; \\\n"
|
||||
"\tdone;\n\n");
|
||||
}
|
||||
|
||||
sprintf(tmp, "TOCSYM= %s_dat \n\n", o->entryName); /* entrypoint not always shortname! */
|
||||
T_FileStream_writeLine(makefile, tmp);
|
||||
|
||||
pkg_mak_writeAssemblyHeader(makefile, o);
|
||||
|
||||
sprintf(tmp,"$(TEMP_DIR)/$(NAME)_dat.o : $(TEMP_DIR)/$(NAME)_dat.c\n"
|
||||
"\t$(COMPILE.c) $(DYNAMICCPPFLAGS) $(DYNAMICCXXFLAGS) -o $@ $<\n\n");
|
||||
T_FileStream_writeLine(makefile, tmp);
|
||||
|
||||
T_FileStream_writeLine(makefile, "# 'TOCOBJ' contains C Table of Contents objects [if any]\n");
|
||||
|
||||
sprintf(tmp, "$(TEMP_DIR)/$(NAME)_dat.c: $(CMNLIST)\n"
|
||||
"\t$(INVOKE) $(GENCMN) -e $(ENTRYPOINT) -n $(NAME) -S -s $(SRCDIR) -d $(TEMP_DIR) 0 $(CMNLIST)\n\n");
|
||||
|
||||
T_FileStream_writeLine(makefile, tmp);
|
||||
sprintf(tmp, "TOCOBJ= $(NAME)_dat%s \n\n", OBJ_SUFFIX);
|
||||
T_FileStream_writeLine(makefile, tmp);
|
||||
|
||||
#ifdef OS400
|
||||
/* New for iSeries: All packaged data in one .c */
|
||||
sprintf(tmp, "$(TEMP_DIR)/$(NAME)all.o : $(TEMP_DIR)/$(NAME)all.c\n"
|
||||
"\t$(COMPILE.c) $(DYNAMICCPPFLAGS) $(DYNAMICCXXFLAGS) -o $@ $<\n\n");
|
||||
T_FileStream_writeLine(makefile, tmp);
|
||||
|
||||
T_FileStream_writeLine(makefile, "# 'ALLDATAOBJ' contains all .c data structures\n");
|
||||
|
||||
sprintf(tmp, "ALLDATAOBJ= $(NAME)all%s \n\n", OBJ_SUFFIX);
|
||||
T_FileStream_writeLine(makefile, tmp);
|
||||
#endif
|
||||
|
||||
T_FileStream_writeLine(makefile, "BASE_OBJECTS= $(TOCOBJ) ");
|
||||
#ifdef OS400
|
||||
T_FileStream_writeLine(makefile, "$(ALLDATAOBJ) ");
|
||||
#else
|
||||
pkg_writeCharListWrap(makefile, objects, " ", " \\\n",0);
|
||||
#endif
|
||||
pkg_mak_writeAssemblyFooter(makefile, o);
|
||||
|
||||
T_FileStream_writeLine(makefile, "\n\n");
|
||||
T_FileStream_writeLine(makefile, "OBJECTS=$(BASE_OBJECTS:%=$(TEMP_DIR)/%)\n\n");
|
||||
|
||||
T_FileStream_writeLine(makefile,"$(TEMP_DIR)/%.o: $(TEMP_DIR)/%.c\n\t$(COMPILE.c) $(DYNAMICCPPFLAGS) $(DYNAMICCXXFLAGS) -o $@ $<\n\n");
|
||||
|
||||
T_FileStream_writeLine(makefile,"build-objs: $(SOURCES) $(OBJECTS)\n\n$(OBJECTS): $(SOURCES)\n\n");
|
||||
|
||||
#ifdef U_HPUX
|
||||
T_FileStream_writeLine(makefile, "$(TARGETDIR)/$(FINAL_SO_TARGET): $(OBJECTS) $(HPUX_JUNK_OBJ) $(LISTFILES) $(DLL_DEPS)\n"
|
||||
"\t$(SHLIB.cc) -o $@ $(OBJECTS) $(HPUX_JUNK_OBJ) $(DLL_LDFLAGS)\n"
|
||||
"\t-ls -l $@\n\n");
|
||||
|
||||
T_FileStream_writeLine(makefile, "$(TEMP_DIR)/hpux_junk_obj.cpp:\n"
|
||||
"\techo \"void to_emit_cxx_stuff_in_the_linker(){}\" >> $(TEMP_DIR)/hpux_junk_obj.cpp\n"
|
||||
"\n"
|
||||
"$(TEMP_DIR)/hpux_junk_obj.o: $(TEMP_DIR)/hpux_junk_obj.cpp\n"
|
||||
"\t$(COMPILE.cc) $(DYNAMICCPPFLAGS) $(DYNAMICCXXFLAGS) -o $@ $<\n"
|
||||
"\n");
|
||||
#else
|
||||
|
||||
/*390port*/
|
||||
#ifdef OS390BATCH
|
||||
T_FileStream_writeLine(makefile, "$(BATCH_TARGET): $(OBJECTS) $(LISTFILES) $(DLL_DEPS)\n"
|
||||
"\t$(SHLIB.c) -o $@ $(OBJECTS) $(DLL_LDFLAGS)\n\n");
|
||||
#endif
|
||||
|
||||
#ifdef U_AIX
|
||||
T_FileStream_writeLine(makefile, "$(TARGETDIR)/$(FINAL_SO_TARGET): $(OBJECTS) $(LISTFILES) $(DLL_DEPS)\n"
|
||||
"\t$(SHLIB.c) -o $(FINAL_SO_TARGET:.$(SO)=.$(SOBJ)) $(OBJECTS) $(DLL_LDFLAGS)\n"
|
||||
"\t$(AR) $(ARFLAGS) $@ $(FINAL_SO_TARGET:.$(SO)=.$(SOBJ))\n"
|
||||
"\t-$(AR) vt $@\n\n");
|
||||
#else
|
||||
T_FileStream_writeLine(makefile, "$(TARGETDIR)/$(FINAL_SO_TARGET): $(OBJECTS) $(LISTFILES) $(DLL_DEPS)\n"
|
||||
"\t$(SHLIB.c) -o $@ $(OBJECTS) $(DLL_LDFLAGS)\n"
|
||||
"\t-ls -l $@\n\n");
|
||||
#endif
|
||||
|
||||
#ifdef OS390
|
||||
/*
|
||||
jdc26: The above link resolves to
|
||||
|
||||
-o ../data/out/libicudata26.0.dll
|
||||
|
||||
the first time or
|
||||
|
||||
-o ../data/out/libicudata_stub26.0.dll
|
||||
|
||||
the second time in the build. OS/390 puts each DLL into
|
||||
the specified directory and the sidedeck into the current
|
||||
directory. Move the sidedeck into the same directory as
|
||||
the DLL so it can be found with the DLL later in the
|
||||
build.
|
||||
|
||||
*/
|
||||
T_FileStream_writeLine(makefile, "\t-cp -f ./$(basename $(FINAL_SO_TARGET))$(IMPORT_LIB_EXT) $(TARGETDIR)/$(basename $(FINAL_SO_TARGET))$(IMPORT_LIB_EXT)\n");
|
||||
#endif /* OS/390 */
|
||||
#endif
|
||||
|
||||
T_FileStream_writeLine(makefile, "CLEANFILES= $(CMNLIST) $(OBJECTS) $(HPUX_JUNK_OBJ) $(TARGETDIR)/$(FINAL_SO_TARGET) $(TARGETDIR)/$(MIDDLE_SO_TARGET) $(TARGETDIR)/$(TARGET)\n\nclean:\n\t-$(RMV) $(CLEANFILES) $(MAKEFILE)");
|
||||
T_FileStream_writeLine(makefile, "\n\n");
|
||||
|
||||
T_FileStream_writeLine(makefile, "install: $(TARGETDIR)/$(FINAL_SO_TARGET)\n"
|
||||
"\t$(INSTALL-L) $(TARGETDIR)/$(FINAL_SO_TARGET) $(INSTALLTO)/$(FINAL_SO_TARGET)\n");
|
||||
|
||||
T_FileStream_writeLine(makefile, "ifneq ($(IMPORT_LIB_EXT),)\n");
|
||||
#ifdef __CYGWIN__
|
||||
T_FileStream_writeLine(makefile, "\t$(INSTALL-L) $(TARGETDIR)/$(basename $(FINAL_IMPORT_LIB)).a $(INSTALLTO)/$(basename $(FINAL_IMPORT_LIB)).a\n");
|
||||
#else
|
||||
T_FileStream_writeLine(makefile, "\t$(INSTALL-L) $(TARGETDIR)/$(basename $(FINAL_SO_TARGET))$(IMPORT_LIB_EXT) $(INSTALLTO)/$(basename( $(FINAL_SO_TARGET))$(IMPORT_LIB_EXT)\n");
|
||||
#endif
|
||||
T_FileStream_writeLine(makefile, "endif\n");
|
||||
if (o->version) {
|
||||
T_FileStream_writeLine(makefile, "ifneq ($(FINAL_SO_TARGET),$(SO_TARGET))\n");
|
||||
T_FileStream_writeLine(makefile, "\tcd $(INSTALLTO) && $(RM) $(SO_TARGET) && ln -s $(FINAL_SO_TARGET) $(SO_TARGET)\n");
|
||||
T_FileStream_writeLine(makefile, "ifneq ($(FINAL_SO_TARGET),$(MIDDLE_SO_TARGET))\n");
|
||||
T_FileStream_writeLine(makefile, "\tcd $(INSTALLTO) && $(RM) $(MIDDLE_SO_TARGET) && ln -s $(FINAL_SO_TARGET) $(MIDDLE_SO_TARGET)\n");
|
||||
T_FileStream_writeLine(makefile, "endif\n");
|
||||
T_FileStream_writeLine(makefile, "endif\n");
|
||||
|
||||
#ifdef OS390
|
||||
T_FileStream_writeLine(makefile, "ifneq ($(IMPORT_LIB_EXT),)\n");
|
||||
T_FileStream_writeLine(makefile, "\tcd $(INSTALLTO) && $(RM) $(basename $(MIDDLE_SO_TARGET))$(IMPORT_LIB_EXT) && ln -s $(basename $(FINAL_SO_TARGET))$(IMPORT_LIB_EXT) $(basename $(MIDDLE_SO_TARGET))$(IMPORT_LIB_EXT)\n");
|
||||
T_FileStream_writeLine(makefile, "\tcd $(INSTALLTO) && $(RM) $(basename $(SO_TARGET))$(IMPORT_LIB_EXT) && ln -s $(basename $(FINAL_SO_TARGET))$(IMPORT_LIB_EXT) $(basename $(SO_TARGET))$(IMPORT_LIB_EXT)\n");
|
||||
T_FileStream_writeLine(makefile, "endif\n");
|
||||
#endif
|
||||
}
|
||||
T_FileStream_writeLine(makefile, "\n");
|
||||
|
||||
#ifdef U_SOLARIS
|
||||
T_FileStream_writeLine(makefile, "$(NAME).map:\n\techo \"{global: $(TOCSYM); local: *; };\" > $@\n\n");
|
||||
#endif
|
||||
|
||||
#ifdef U_AIX
|
||||
T_FileStream_writeLine(makefile, "$(NAME).map:\n\techo \"$(TOCSYM)\" > $@\n\n");
|
||||
#endif
|
||||
|
||||
|
||||
*status = U_ZERO_ERROR;
|
||||
|
||||
}
|
||||
|
||||
#endif /* #ifndef U_MAKE_IS_NMAKE */
|
||||
|
|
@ -1,191 +0,0 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* Copyright (C) 2000-2006, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
*
|
||||
*******************************************************************************
|
||||
* file name: filemode.c
|
||||
* encoding: ANSI X3.4 (1968)
|
||||
* tab size: 8 (not used)
|
||||
* indentation:4
|
||||
*
|
||||
* created on: 2000sep28
|
||||
* created by: Steven \u24C7 Loomis
|
||||
*
|
||||
* The mode which uses raw files (i.e. does nothing until installation).
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "unicode/utypes.h"
|
||||
#include "unicode/putil.h"
|
||||
#include "cmemory.h"
|
||||
#include "cstring.h"
|
||||
#include "filestrm.h"
|
||||
#include "toolutil.h"
|
||||
#include "unewdata.h"
|
||||
#include "uoptions.h"
|
||||
#include "pkgtypes.h"
|
||||
#include "makefile.h"
|
||||
|
||||
/* The file we will make will look like this:
|
||||
|
||||
(where /out is the full path to the output dir)
|
||||
|
||||
SOURCES=/out/filea /out/fileb ./somewhere/filec ../somewhereelse/filed
|
||||
|
||||
TARGETS=/out/filea /out/fileb /out/filec /out/filed
|
||||
|
||||
all: $(TARGETS)
|
||||
|
||||
/out/filec /out/filed: ../somewhere/filec ../somewhereelse/filed
|
||||
$(INSTALL_DATA) $? $(OUTDIR)
|
||||
|
||||
install: all
|
||||
$(INSTALL_DATA) $(TARGETS) $(instdir)
|
||||
|
||||
|
||||
==Note:==
|
||||
The only items in the first '$(INSTALL_DATA)' are files NOT already in the out dir!
|
||||
|
||||
|
||||
*/
|
||||
|
||||
#ifdef U_MAKE_IS_NMAKE
|
||||
#define DEPENDENT_FILE_RULE "$?"
|
||||
#else
|
||||
#define DEPENDENT_FILE_RULE "$<"
|
||||
#endif
|
||||
|
||||
void pkg_mode_files(UPKGOptions *o, FileStream *makefile, UErrorCode *status)
|
||||
{
|
||||
char tmp[1024], tmp2[1024], srcPath[1024];
|
||||
char stanza[3072];
|
||||
|
||||
CharList *tail = NULL, *infiles = NULL;
|
||||
|
||||
CharList *copyFilesLeft = NULL; /* left hand side of the copy rule*/
|
||||
CharList *copyFilesRight = NULL; /* rhs "" "" */
|
||||
CharList *copyFilesInstall = NULL;
|
||||
|
||||
CharList *copyFilesLeftTail = NULL;
|
||||
CharList *copyFilesRightTail = NULL;
|
||||
CharList *copyFilesInstallTail = NULL;
|
||||
|
||||
CharList *copyDirs = NULL; /* list of dirs to create for copying */
|
||||
CharList *installDirs = NULL; /* list of dirs to create for installation */
|
||||
|
||||
/* CharList *copyCommands = NULL;*/
|
||||
|
||||
const char *baseName;
|
||||
|
||||
#ifndef U_MAKE_IS_NMAKE
|
||||
T_FileStream_writeLine(makefile, "\n.PHONY: $(NAME) all install clean\n");
|
||||
#endif
|
||||
T_FileStream_writeLine(makefile, "\nall: $(NAME)\n\n");
|
||||
|
||||
infiles = o->files; /* raw files - no paths other than tree paths */
|
||||
|
||||
/* Dont' copy files already in tmp */
|
||||
for(;infiles;infiles = infiles->next)
|
||||
{
|
||||
uprv_strcpy(tmp, o->targetDir);
|
||||
uprv_strcat(tmp, U_FILE_SEP_STRING);
|
||||
baseName = infiles->str;
|
||||
uprv_strcat(tmp, o->shortName);
|
||||
uprv_strcat(tmp, U_FILE_SEP_STRING);
|
||||
uprv_strcpy(srcPath, "$(SRCDIR)/");
|
||||
uprv_strcat(srcPath, infiles->str);
|
||||
uprv_strcat(tmp, baseName);
|
||||
|
||||
copyDirs = pkg_appendUniqueDirToList(copyDirs, NULL, tmp);
|
||||
|
||||
o->outFiles = pkg_appendToList(o->outFiles, &tail, uprv_strdup(tmp));
|
||||
|
||||
if(strcmp(tmp, infiles->str) == 0)
|
||||
{
|
||||
/* fprintf(stderr, "### NOT copying: %s\n", tmp); */
|
||||
/* no copy needed.. */
|
||||
} else {
|
||||
sprintf(stanza, "%s: %s\n\t$(INSTALL_DATA) "DEPENDENT_FILE_RULE" $@\n", tmp, srcPath);
|
||||
convertToNativePathSeparators(stanza);
|
||||
T_FileStream_writeLine(makefile, stanza);
|
||||
}
|
||||
|
||||
uprv_strcpy(tmp2, "$(INSTALLTO)" U_FILE_SEP_STRING);
|
||||
uprv_strcat(tmp2, o->shortName);
|
||||
uprv_strcat(tmp2, U_FILE_SEP_STRING);
|
||||
uprv_strcat(tmp2, baseName);
|
||||
|
||||
installDirs = pkg_appendUniqueDirToList(installDirs, NULL, tmp2);
|
||||
|
||||
if(strcmp(tmp2, infiles->str) == 0) {
|
||||
/* fprintf(stderr, "### NOT copying: %s\n", tmp2); */
|
||||
/* no copy needed.. */
|
||||
} else {
|
||||
sprintf(stanza, "%s: %s\n\t$(INSTALL_DATA) "DEPENDENT_FILE_RULE" $@\n", tmp2, tmp);
|
||||
convertToNativePathSeparators(stanza);
|
||||
T_FileStream_writeLine(makefile, stanza);
|
||||
|
||||
/* left hand side: target path, target name */
|
||||
copyFilesLeft = pkg_appendToList(copyFilesLeft, ©FilesLeftTail, uprv_strdup(tmp));
|
||||
|
||||
/* fprintf(stderr, "##### COPY %s from %s\n", tmp, infiles->str); */
|
||||
/* rhs: source path */
|
||||
copyFilesRight = pkg_appendToList(copyFilesRight, ©FilesRightTail, uprv_strdup(infiles->str));
|
||||
|
||||
/* install: installed path */
|
||||
copyFilesInstall = pkg_appendToList(copyFilesInstall, ©FilesInstallTail, uprv_strdup(tmp2));
|
||||
}
|
||||
}
|
||||
|
||||
if(o->nooutput || o->verbose) {
|
||||
CharList *i;
|
||||
fprintf(stdout, "# Output files: ");
|
||||
for(i = o->outFiles; i; i=i->next) {
|
||||
printf("%s ", i->str);
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
if(o->nooutput) {
|
||||
*status = U_ZERO_ERROR;
|
||||
return;
|
||||
}
|
||||
|
||||
/* these are also the files to delete */
|
||||
T_FileStream_writeLine(makefile, "COPIEDDEST= ");
|
||||
pkg_writeCharListWrap(makefile, copyFilesLeft, " ", " \\\n", 0);
|
||||
T_FileStream_writeLine(makefile, "\n\n");
|
||||
|
||||
|
||||
T_FileStream_writeLine(makefile, "INSTALLEDDEST= ");
|
||||
pkg_writeCharListWrap(makefile, copyFilesInstall, " ", " \\\n", 0);
|
||||
T_FileStream_writeLine(makefile, "\n\n");
|
||||
|
||||
T_FileStream_writeLine(makefile, "COPYDIRS= ");
|
||||
pkg_writeCharListWrap(makefile, copyDirs, " ", " \\\n", 0);
|
||||
T_FileStream_writeLine(makefile, "\n\n");
|
||||
|
||||
|
||||
T_FileStream_writeLine(makefile, "INSTALLDIRS= ");
|
||||
pkg_writeCharListWrap(makefile, installDirs, " ", " \\\n", 0);
|
||||
T_FileStream_writeLine(makefile, "\n\n");
|
||||
|
||||
if(copyFilesRight != NULL)
|
||||
{
|
||||
T_FileStream_writeLine(makefile, "$(NAME): copy-dirs $(COPIEDDEST)\n\n");
|
||||
|
||||
T_FileStream_writeLine(makefile, "clean:\n\t-$(RMV) $(COPIEDDEST) $(MAKEFILE)");
|
||||
T_FileStream_writeLine(makefile, "\n\n");
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
T_FileStream_writeLine(makefile, "clean:\n\n");
|
||||
}
|
||||
T_FileStream_writeLine(makefile, "install: install-dirs $(INSTALLEDDEST)\n\n");
|
||||
T_FileStream_writeLine(makefile, "install-dirs:\n\t$(MKINSTALLDIRS) $(INSTALLDIRS)\n\n");
|
||||
T_FileStream_writeLine(makefile, "copy-dirs:\n\t$(MKINSTALLDIRS) $(COPYDIRS)\n\n");
|
||||
}
|
||||
|
|
@ -1,399 +0,0 @@
|
|||
/**************************************************************************
|
||||
*
|
||||
* Copyright (C) 2000-2008, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
*
|
||||
***************************************************************************
|
||||
* file name: make.c
|
||||
* encoding: ANSI X3.4 (1968)
|
||||
* tab size: 8 (not used)
|
||||
* indentation:4
|
||||
*
|
||||
* created on: 2000jul18
|
||||
* created by: Vladimir Weinstein
|
||||
* created on: 2000may17
|
||||
* created by: Steven \u24C7 Loomis
|
||||
* merged on: 2003sep14
|
||||
* merged by: George Rhoten
|
||||
* merged from nmake.c and gmake.c
|
||||
*
|
||||
* Emit a NMAKE or GNU makefile
|
||||
*/
|
||||
|
||||
#include "unicode/utypes.h"
|
||||
#include "unicode/putil.h"
|
||||
#include "makefile.h"
|
||||
#include "cstring.h"
|
||||
#include "cmemory.h"
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef U_MAKE_IS_NMAKE
|
||||
|
||||
char linebuf[2048];
|
||||
|
||||
/* Write any setup/initialization stuff */
|
||||
void
|
||||
pkg_mak_writeHeader(FileStream *f, const UPKGOptions *o)
|
||||
{
|
||||
const char *appendVersion = NULL;
|
||||
char *srcDir = convertToNativePathSeparators(uprv_strdup(o->srcDir));
|
||||
|
||||
if(o->version && !uprv_strstr(o->shortName,o->version)) { /* do not append version if
|
||||
already contained in the name */
|
||||
appendVersion = o->version;
|
||||
}
|
||||
|
||||
sprintf(linebuf, "## Makefile for %s (%s) created by pkgdata\n"
|
||||
"## from ICU Version %s\n"
|
||||
"\n",
|
||||
o->shortName,
|
||||
o->libName,
|
||||
U_ICU_VERSION);
|
||||
T_FileStream_writeLine(f, linebuf);
|
||||
|
||||
sprintf(linebuf, "NAME=%s%s\n"
|
||||
"CNAME=%s\n"
|
||||
"LIBNAME=%s\n"
|
||||
"SRCDIR=%s\n"
|
||||
"TARGETDIR=%s\n"
|
||||
"TEMP_DIR=%s\n"
|
||||
"MODE=%s\n"
|
||||
"MAKEFILE=%s\n"
|
||||
"ENTRYPOINT=%s\n"
|
||||
"TARGET_VERSION=%s\n"
|
||||
"MKINSTALLDIRS=mkdir\n"
|
||||
"INSTALL_DATA=copy\n"
|
||||
"RMV=del /F"
|
||||
"\n\n\n",
|
||||
o->shortName,
|
||||
(appendVersion ? appendVersion : ""),
|
||||
o->cShortName,
|
||||
o->libName,
|
||||
srcDir,
|
||||
o->targetDir,
|
||||
o->tmpDir,
|
||||
o->mode,
|
||||
o->makeFile,
|
||||
o->entryName,
|
||||
o->version);
|
||||
T_FileStream_writeLine(f, linebuf);
|
||||
|
||||
sprintf(linebuf, "## List files [%d] containing data files to process (note: - means stdin)\n"
|
||||
"LISTFILES= ",
|
||||
pkg_countCharList(o->fileListFiles));
|
||||
T_FileStream_writeLine(f, linebuf);
|
||||
|
||||
pkg_writeCharListWrap(f, o->fileListFiles, " ", " \\\n", 0);
|
||||
|
||||
T_FileStream_writeLine(f, "\n\n\n");
|
||||
|
||||
sprintf(linebuf, "## Data Files [%d]\n"
|
||||
"DATAFILES= ",
|
||||
pkg_countCharList(o->files));
|
||||
|
||||
T_FileStream_writeLine(f, linebuf);
|
||||
|
||||
pkg_writeCharListWrap(f, o->files, " ", " \\\n", -1);
|
||||
|
||||
T_FileStream_writeLine(f, "\n\n\n");
|
||||
|
||||
sprintf(linebuf, "## Data File Paths [%d]\n"
|
||||
"DATAFILEPATHS= ",
|
||||
pkg_countCharList(o->filePaths));
|
||||
|
||||
T_FileStream_writeLine(f, linebuf);
|
||||
|
||||
pkg_writeCharListWrap(f, o->filePaths, " ", " \\\n", 1);
|
||||
|
||||
T_FileStream_writeLine(f, "\n\n\n");
|
||||
|
||||
uprv_free(srcDir);
|
||||
}
|
||||
|
||||
/* Write a stanza in the makefile, with specified "target: parents... \n\n\tcommands" [etc] */
|
||||
void
|
||||
pkg_mak_writeStanza(FileStream *f, const UPKGOptions *o,
|
||||
const char *target,
|
||||
CharList* parents,
|
||||
CharList* commands )
|
||||
{
|
||||
T_FileStream_write(f, target, (int32_t)uprv_strlen(target));
|
||||
T_FileStream_write(f, " : ", 3);
|
||||
pkg_writeCharList(f, parents, " ",1);
|
||||
T_FileStream_write(f, "\n", 1);
|
||||
|
||||
if(commands)
|
||||
{
|
||||
T_FileStream_write(f, "\t", 1);
|
||||
pkg_writeCharList(f, commands, "\n\t",0);
|
||||
}
|
||||
T_FileStream_write(f, "\n\n", 2);
|
||||
}
|
||||
|
||||
/* write any cleanup/post stuff */
|
||||
void
|
||||
pkg_mak_writeFooter(FileStream *f, const UPKGOptions *o)
|
||||
{
|
||||
char buf[256];
|
||||
sprintf(buf, "\n\n# End of makefile for %s [%s mode]\n\n", o->shortName, o->mode);
|
||||
T_FileStream_write(f, buf, (int32_t)uprv_strlen(buf));
|
||||
}
|
||||
|
||||
#else /* #ifdef U_MAKE_IS_NMAKE */
|
||||
|
||||
#include "cmemory.h"
|
||||
#include "filestrm.h"
|
||||
#include "toolutil.h"
|
||||
#include "unewdata.h"
|
||||
#include "uoptions.h"
|
||||
#include "pkgtypes.h"
|
||||
#include <string.h>
|
||||
|
||||
char linebuf[2048];
|
||||
|
||||
/* Write any setup/initialization stuff */
|
||||
void
|
||||
pkg_mak_writeHeader(FileStream *f, const UPKGOptions *o)
|
||||
{
|
||||
sprintf(linebuf, "## Makefile for %s created by pkgdata\n"
|
||||
"## from ICU Version %s\n"
|
||||
"\n",
|
||||
o->shortName,
|
||||
U_ICU_VERSION);
|
||||
T_FileStream_writeLine(f, linebuf);
|
||||
|
||||
sprintf(linebuf, "NAME=%s\n"
|
||||
"LIBNAME=%s\n"
|
||||
"CNAME=%s\n"
|
||||
"TARGETDIR=%s\n"
|
||||
"TEMP_DIR=%s\n"
|
||||
"srcdir=$(TEMP_DIR)\n"
|
||||
"SRCDIR=%s\n"
|
||||
"MODE=%s\n"
|
||||
"MAKEFILE=%s\n"
|
||||
"ENTRYPOINT=%s\n"
|
||||
"include %s\n"
|
||||
"\n\n\n",
|
||||
o->shortName,
|
||||
o->libName,
|
||||
o->cShortName,
|
||||
o->targetDir,
|
||||
o->tmpDir,
|
||||
o->srcDir,
|
||||
o->mode,
|
||||
o->makeFile,
|
||||
o->entryName,
|
||||
o->options);
|
||||
T_FileStream_writeLine(f, linebuf);
|
||||
|
||||
/* TEMP_PATH and TARG_PATH will be empty if the respective dir is . */
|
||||
/* Avoid //'s and .'s which confuse make ! */
|
||||
if(!strcmp(o->tmpDir,"."))
|
||||
{
|
||||
T_FileStream_writeLine(f, "TEMP_PATH=\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
T_FileStream_writeLine(f, "TEMP_PATH=$(TEMP_DIR)/\n");
|
||||
}
|
||||
|
||||
if(!strcmp(o->targetDir,"."))
|
||||
{
|
||||
T_FileStream_writeLine(f, "TARG_PATH=\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
T_FileStream_writeLine(f, "TARG_PATH=$(TARGETDIR)/\n");
|
||||
}
|
||||
|
||||
sprintf(linebuf, "## List files [%u] containing data files to process (note: - means stdin)\n"
|
||||
"LISTFILES= ",
|
||||
(int)pkg_countCharList(o->fileListFiles));
|
||||
T_FileStream_writeLine(f, linebuf);
|
||||
|
||||
pkg_writeCharListWrap(f, o->fileListFiles, " ", " \\\n",0);
|
||||
|
||||
T_FileStream_writeLine(f, "\n\n\n");
|
||||
|
||||
sprintf(linebuf, "## Data Files [%u]\n"
|
||||
"DATAFILES= ",
|
||||
(int)pkg_countCharList(o->files));
|
||||
|
||||
T_FileStream_writeLine(f, linebuf);
|
||||
|
||||
pkg_writeCharListWrap(f, o->files, " ", " \\\n",-1);
|
||||
|
||||
T_FileStream_writeLine(f, "\n\n\n");
|
||||
|
||||
sprintf(linebuf, "## Data File Paths [%u]\n"
|
||||
"DATAFILEPATHS= ",
|
||||
(int)pkg_countCharList(o->filePaths));
|
||||
|
||||
T_FileStream_writeLine(f, linebuf);
|
||||
|
||||
pkg_writeCharListWrap(f, o->filePaths, " ", " \\\n",0);
|
||||
|
||||
T_FileStream_writeLine(f, "\n\n\n");
|
||||
|
||||
}
|
||||
|
||||
/* Write a stanza in the makefile, with specified "target: parents... \n\n\tcommands" [etc] */
|
||||
void
|
||||
pkg_mak_writeStanza(FileStream *f, const UPKGOptions *o,
|
||||
const char *target,
|
||||
CharList* parents,
|
||||
CharList* commands)
|
||||
{
|
||||
T_FileStream_write(f, target, uprv_strlen(target));
|
||||
T_FileStream_write(f, " : ", 3);
|
||||
pkg_writeCharList(f, parents, " ",0);
|
||||
T_FileStream_write(f, "\n", 1);
|
||||
|
||||
if(commands)
|
||||
{
|
||||
T_FileStream_write(f, "\t", 1);
|
||||
pkg_writeCharList(f, commands, "\n\t",0);
|
||||
}
|
||||
T_FileStream_write(f, "\n\n", 2);
|
||||
}
|
||||
|
||||
/* write any cleanup/post stuff */
|
||||
void
|
||||
pkg_mak_writeFooter(FileStream *f, const UPKGOptions *o)
|
||||
{
|
||||
T_FileStream_writeLine(f, "\nrebuild: clean all\n");
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
pkg_mak_writeObjRules(UPKGOptions *o, FileStream *makefile, CharList **objects, const char* objSuffix)
|
||||
{
|
||||
const char *p, *baseName;
|
||||
char *tmpPtr;
|
||||
char tmp[1024];
|
||||
char stanza[1024];
|
||||
char cfile[1024];
|
||||
CharList *oTail = NULL;
|
||||
CharList *infiles;
|
||||
CharList *parents = NULL, *commands = NULL;
|
||||
char *parentPath;
|
||||
const char *tchar;
|
||||
char tree[1024];
|
||||
|
||||
infiles = o->files; /* raw files - no paths other than tree paths */
|
||||
|
||||
for(;infiles;infiles = infiles->next) {
|
||||
baseName = infiles->str; /* skip the icudt28b/ part */
|
||||
p = uprv_strrchr(baseName, '.');
|
||||
if( (p == NULL) || (*p == '\0' ) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
uprv_strncpy(tmp, baseName, p-baseName);
|
||||
p++;
|
||||
|
||||
uprv_strcpy(tmp+(p-1-baseName), "_"); /* to append */
|
||||
uprv_strcat(tmp, p);
|
||||
uprv_strcat(tmp, objSuffix );
|
||||
|
||||
/* iSeries cannot have '-' in the .o objects. */
|
||||
for( tmpPtr = tmp; *tmpPtr; tmpPtr++ ) {
|
||||
if ( *tmpPtr == U_FILE_SEP_CHAR ) { /* map tree names with underscores */
|
||||
*tmpPtr = '_';
|
||||
}
|
||||
if ( *tmpPtr == '-' ) {
|
||||
*tmpPtr = '_';
|
||||
}
|
||||
}
|
||||
|
||||
*objects = pkg_appendToList(*objects, &oTail, uprv_strdup(tmp));
|
||||
|
||||
/* write source list */
|
||||
uprv_strcpy(cfile,tmp);
|
||||
uprv_strcpy(cfile+uprv_strlen(cfile)-uprv_strlen(objSuffix), ".c" ); /* replace .o with .c */
|
||||
|
||||
/* Make up parents.. */
|
||||
parentPath = uprv_malloc(1+uprv_strlen(baseName) + uprv_strlen("$(SRCDIR)/"));
|
||||
sprintf(parentPath, "$(SRCDIR)/%s", baseName);
|
||||
parents = pkg_appendToList(parents, NULL, parentPath);
|
||||
|
||||
/* make up commands.. */
|
||||
/* search for tree.. */
|
||||
if((tchar=uprv_strchr(baseName, '/'))) {
|
||||
tree[0]='_';
|
||||
strncpy(tree+1,baseName,tchar-baseName);
|
||||
tree[tchar-baseName+1]=0;
|
||||
} else {
|
||||
tree[0] = 0;
|
||||
}
|
||||
#ifdef OS400
|
||||
sprintf(stanza, "$(INVOKE) $(GENCCODE) -n $(CNAME)%s -d $(TEMP_DIR) $(SRCDIR)/%s", tree, infiles->str);
|
||||
#else
|
||||
sprintf(stanza, "$(INVOKE) $(GENCCODE) -n $(CNAME)%s -d $(TEMP_DIR) $<", tree);
|
||||
#endif
|
||||
|
||||
if(uprv_strchr(baseName, '/')) {
|
||||
/* append actual file - ex: coll_en_res otherwise the tree name will be lost */
|
||||
strcat(stanza, " -f ");
|
||||
strncat(stanza, tmp, (strlen(tmp)-strlen(objSuffix)));
|
||||
}
|
||||
|
||||
commands = pkg_appendToList(commands, NULL, uprv_strdup(stanza));
|
||||
|
||||
#ifdef OS400
|
||||
/* This builds the file into one .c file */
|
||||
sprintf(stanza, "@cat $(TEMP_PATH)%s >> $(TEMP_PATH)/$(NAME)all.c", cfile);
|
||||
commands = pkg_appendToList(commands, NULL, uprv_strdup(stanza));
|
||||
|
||||
sprintf(stanza, "@$(RMV) $(TEMP_DIR)/%s", cfile);
|
||||
commands = pkg_appendToList(commands, NULL, uprv_strdup(stanza));
|
||||
|
||||
T_FileStream_write(makefile, "\t", 1);
|
||||
pkg_writeCharList(makefile, commands, "\n\t",0);
|
||||
T_FileStream_write(makefile, "\n\n", 2);
|
||||
#else
|
||||
sprintf(stanza, "@$(COMPILE.c) $(DYNAMICCPPFLAGS) $(DYNAMICCXXFLAGS) -o $@ $(TEMP_DIR)/%s", cfile);
|
||||
commands = pkg_appendToList(commands, NULL, uprv_strdup(stanza));
|
||||
|
||||
sprintf(stanza, "@$(RMV) $(TEMP_DIR)/%s", cfile);
|
||||
commands = pkg_appendToList(commands, NULL, uprv_strdup(stanza));
|
||||
|
||||
sprintf(stanza, "$(TEMP_PATH)%s", tmp);
|
||||
pkg_mak_writeStanza(makefile, o, stanza, parents, commands);
|
||||
#endif
|
||||
|
||||
pkg_deleteList(parents);
|
||||
pkg_deleteList(commands);
|
||||
parents = NULL;
|
||||
commands = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* #ifdef U_MAKE_IS_NMAKE */
|
||||
|
||||
void
|
||||
pkg_mak_writeAssemblyHeader(FileStream *f, const UPKGOptions *o)
|
||||
{
|
||||
T_FileStream_writeLine(f, "\n");
|
||||
T_FileStream_writeLine(f, "ifneq ($(GENCCODE_ASSEMBLY),)\n");
|
||||
T_FileStream_writeLine(f, "\n");
|
||||
T_FileStream_writeLine(f, "BASE_OBJECTS=$(NAME)_dat.o\n");
|
||||
T_FileStream_writeLine(f, "\n");
|
||||
T_FileStream_writeLine(f, "$(TEMP_DIR)/$(NAME).dat: $(CMNLIST) $(DATAFILEPATHS)\n");
|
||||
T_FileStream_writeLine(f, "\t$(INVOKE) $(ICUPKG) -t$(ICUDATA_CHAR) -c -s $(SRCDIR) -a $(CMNLIST) new $(TEMP_DIR)/$(CNAME).dat\n");
|
||||
T_FileStream_writeLine(f, "\n");
|
||||
T_FileStream_writeLine(f, "$(TEMP_DIR)/$(NAME)_dat.o : $(TEMP_DIR)/$(NAME).dat\n");
|
||||
T_FileStream_writeLine(f, "\t$(INVOKE) $(GENCCODE) $(GENCCODE_ASSEMBLY) -n $(NAME) -e $(ENTRYPOINT) -d $(TEMP_DIR) $<\n");
|
||||
T_FileStream_writeLine(f, "\t$(COMPILE.c) $(DYNAMICCPPFLAGS) $(DYNAMICCXXFLAGS) -o $@ $(TEMP_DIR)/$(NAME)_dat"ASM_SUFFIX"\n");
|
||||
T_FileStream_writeLine(f, "\t$(RMV) $(TEMP_DIR)/$(NAME)_dat"ASM_SUFFIX"\n");
|
||||
T_FileStream_writeLine(f, "\n");
|
||||
T_FileStream_writeLine(f, "else\n");
|
||||
T_FileStream_writeLine(f, "\n");
|
||||
}
|
||||
|
||||
void
|
||||
pkg_mak_writeAssemblyFooter(FileStream *f, const UPKGOptions *o)
|
||||
{
|
||||
T_FileStream_writeLine(f, "\nendif\n");
|
||||
}
|
||||
|
|
@ -1,71 +0,0 @@
|
|||
/**************************************************************************
|
||||
*
|
||||
* Copyright (C) 2000-2005, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
*
|
||||
***************************************************************************
|
||||
* file name: makefile.h
|
||||
* encoding: ANSI X3.4 (1968)
|
||||
* tab size: 8 (not used)
|
||||
* indentation:4
|
||||
*
|
||||
* created on: 2000may17
|
||||
* created by: Steven \u24C7 Loomis
|
||||
*
|
||||
* definition for code to create a makefile.
|
||||
* implementation is OS dependent (i.e. gmake.c, nmake.c, .. )
|
||||
*/
|
||||
|
||||
#ifndef _MAKEFILE
|
||||
#define _MAKEFILE
|
||||
|
||||
/* headers */
|
||||
#include "unicode/utypes.h"
|
||||
#include "pkgtypes.h"
|
||||
|
||||
|
||||
/* Write any setup/initialization stuff */
|
||||
void
|
||||
pkg_mak_writeHeader(FileStream *f, const UPKGOptions *o);
|
||||
|
||||
/* Write a stanza in the makefile, with specified "target: parents... \n\n\tcommands" [etc] */
|
||||
void
|
||||
pkg_mak_writeStanza(FileStream *f, const UPKGOptions *o,
|
||||
const char *target,
|
||||
CharList* parents,
|
||||
CharList* commands);
|
||||
|
||||
/* write any cleanup/post stuff */
|
||||
void
|
||||
pkg_mak_writeFooter(FileStream *f, const UPKGOptions *o);
|
||||
|
||||
|
||||
|
||||
#ifdef U_MAKE_IS_NMAKE
|
||||
extern void pkg_mode_windows(UPKGOptions *o, FileStream *makefile, UErrorCode *status);
|
||||
#else /*#ifdef U_MAKE_IS_NMAKE*/
|
||||
/**
|
||||
* Write stanzas for generating .o (and .c) files for each data file in 'o->filePaths'.
|
||||
* @param o Package options struct
|
||||
* @param makefile Current makefile being written
|
||||
* @param objects On output, list of object files
|
||||
* @param objSuffix Suffix of object files including dot, typically OBJ_SUFFIX or ".o" or ".obj"
|
||||
*/
|
||||
extern void
|
||||
pkg_mak_writeObjRules(UPKGOptions *o, FileStream *makefile, CharList **objects, const char* objSuffix);
|
||||
#ifdef UDATA_SO_SUFFIX
|
||||
extern void pkg_mode_dll(UPKGOptions* o, FileStream *stream, UErrorCode *status);
|
||||
extern void pkg_mode_static(UPKGOptions* o, FileStream *stream, UErrorCode *status);
|
||||
#endif /*#ifdef UDATA_SO_SUFFIX*/
|
||||
extern void pkg_mode_common(UPKGOptions* o, FileStream *stream, UErrorCode *status);
|
||||
#endif /*#ifdef U_MAKE_IS_NMAKE*/
|
||||
|
||||
extern void pkg_mode_files(UPKGOptions* o, FileStream *stream, UErrorCode *status);
|
||||
|
||||
|
||||
extern void
|
||||
pkg_mak_writeAssemblyHeader(FileStream *f, const UPKGOptions *o);
|
||||
extern void
|
||||
pkg_mak_writeAssemblyFooter(FileStream *f, const UPKGOptions *o);
|
||||
|
||||
#endif
|
|
@ -2,12 +2,12 @@
|
|||
.\"
|
||||
.\" pkgdata.1: manual page for the pkgdata utility
|
||||
.\"
|
||||
.\" Copyright (C) 2000-2003 IBM, Inc. and others.
|
||||
.\" Copyright (C) 2000-2009 IBM, Inc. and others.
|
||||
.\"
|
||||
.\" Manual page by Yves Arrouye <yves@realnames.com>.
|
||||
.\" Modified by Steven R. Loomis <srl@jtcsv.com>.
|
||||
.\" Modified by Michael Ow <mow@us.ibm.com>.
|
||||
.\"
|
||||
.TH PKGDATA 1 "16 April 2002" "ICU MANPAGE" "ICU @VERSION@ Manual"
|
||||
.TH PKGDATA 1 "6 February 2009" "ICU MANPAGE" "ICU @VERSION@ Manual"
|
||||
.SH NAME
|
||||
.B pkgdata
|
||||
\- package data for use by ICU
|
||||
|
@ -36,24 +36,12 @@
|
|||
.BI "\-r\fP, \fB\-\-revision" " version"
|
||||
]
|
||||
[
|
||||
.BI "\-M" " arg"
|
||||
]
|
||||
[
|
||||
.BI "\-F\fP, \fB\-\-rebuild"
|
||||
]
|
||||
[
|
||||
.BI "\-k\fP, \fB\-\-clean"
|
||||
]
|
||||
[
|
||||
.BI "\-I\fP, \fB\-\-install"
|
||||
]
|
||||
[
|
||||
.BI "\-n\fP, \fB\-\-nooutput"
|
||||
]
|
||||
[
|
||||
.BI "\-N\fP, \fB\-\-numaric"
|
||||
]
|
||||
[
|
||||
.BI "\-s\fP, \fB\-\-sourcedir" " source"
|
||||
]
|
||||
[
|
||||
|
@ -154,10 +142,10 @@ the ICU source distribution for further information on the use of this
|
|||
mode.
|
||||
.PP
|
||||
.B pkgdata
|
||||
relies on GNU
|
||||
.BR make (1)
|
||||
to do the packaging, and generates a makefile with rules to build,
|
||||
package, install, or clean the appropriate data.
|
||||
builds, packages, installs, or cleans the appropriate data based on the options given
|
||||
without the need to call GNU
|
||||
.BR make
|
||||
anymore.
|
||||
.SH OPTIONS
|
||||
.TP
|
||||
.BR "\-h\fP, \fB\-?\fP, \fB\-\-help"
|
||||
|
@ -231,18 +219,9 @@ assumed to be
|
|||
.IR major .0
|
||||
for versioning purposes.
|
||||
.TP
|
||||
.BI "\-M" " arg"
|
||||
Pass
|
||||
.I arg
|
||||
to
|
||||
.BR make (1).
|
||||
.TP
|
||||
.BI "\-F\fP, \fB\-\-rebuild"
|
||||
Force the rebuilding of all data and their repackaging.
|
||||
.TP
|
||||
.BI "\-k\fP, \fB\-\-clean"
|
||||
Clean temporary files and other build residues.
|
||||
.TP
|
||||
.BI "\-I\fP, \fB\-\-install"
|
||||
Install the packaged file (or all the files in the
|
||||
.B files
|
||||
|
@ -250,15 +229,6 @@ mode). If the variable
|
|||
.B DESTDIR
|
||||
is set it will be used for installation.
|
||||
.TP
|
||||
.BI "\-n\fP, \fB\-\-nooutput"
|
||||
Do not produce any output but simply a list of affected files.
|
||||
.TP
|
||||
.BI "\-N\fP, \fB\-\-numeric"
|
||||
Instead of using temporary filenames similar to the input symbols, use numeric filenames such
|
||||
as t0002.c, etc. May be needed for systems which don't allow many similar long filenames, or
|
||||
for systems that tend to run out of argument space. Note, using this option
|
||||
implies "\-F\fP, \fB\-\-rebuild" - all packaging will be rebuilt every time pkgdata is run.
|
||||
.TP
|
||||
.BI "\-s\fP, \fB\-\-sourcedir" " source"
|
||||
Set the source directory to
|
||||
.IR source .
|
||||
|
@ -284,5 +254,5 @@ Yves Arrouye
|
|||
.SH VERSION
|
||||
@VERSION@
|
||||
.SH COPYRIGHT
|
||||
Copyright (C) 2000-2003 IBM, Inc. and others.
|
||||
Copyright (C) 2000-2009 IBM, Inc. and others.
|
||||
|
||||
|
|
|
@ -61,7 +61,6 @@
|
|||
|
||||
U_CDECL_BEGIN
|
||||
#include "pkgtypes.h"
|
||||
#include "makefile.h"
|
||||
U_CDECL_END
|
||||
|
||||
#ifdef U_WINDOWS
|
||||
|
@ -78,6 +77,13 @@ U_CDECL_END
|
|||
#define CAN_WRITE_OBJ_CODE
|
||||
#endif
|
||||
|
||||
/* Need to fix the file seperator character when using MinGW. */
|
||||
#ifdef WINDOWS_WITH_GNUC
|
||||
#define PKGDATA_FILE_SEP_STRING "/"
|
||||
#else
|
||||
#define PKGDATA_FILE_SEP_STRING U_FILE_SEP_STRING
|
||||
#endif
|
||||
|
||||
#define LARGE_BUFFER_MAX_SIZE 2048
|
||||
#define SMALL_BUFFER_MAX_SIZE 512
|
||||
|
||||
|
@ -90,40 +96,19 @@ static int32_t pkg_createWindowsDLL(const char mode, const char *gencFilePath, U
|
|||
#endif
|
||||
static int32_t pkg_createSymLinks(const char *targetDir);
|
||||
static int32_t pkg_installLibrary(const char *installDir, const char *dir);
|
||||
static int32_t pkg_installFileMode(const char *installDir, const char *srcDir, const char *fileListName);
|
||||
|
||||
#ifdef BUILD_DATA_WITHOUT_ASSEMBLY
|
||||
static int32_t pkg_createWithoutAssemblyCode(UPKGOptions *o, const char *targetDir, const char mode);
|
||||
#endif
|
||||
|
||||
static int32_t pkg_createWithAssemblyCode(const char *targetDir, const char mode, const char *gencFilePath);
|
||||
static int32_t pkg_generateLibraryFile(const char *targetDir, const char mode, const char *objectFile, char *command);
|
||||
static int32_t pkg_generateLibraryFile(const char *targetDir, const char mode, const char *objectFile);
|
||||
static int32_t pkg_archiveLibrary(const char *targetDir, const char *version, UBool reverseExt);
|
||||
static void createFileNames(const char *version_major, const char *version, const char *libName, const UBool reverseExt);
|
||||
|
||||
static int32_t pkg_getOptionsFromICUConfig(UOption *option);
|
||||
|
||||
/* This sets the modes that are available */
|
||||
static struct
|
||||
{
|
||||
const char *name, *alt_name;
|
||||
UPKGMODE *fcn;
|
||||
const char *desc;
|
||||
} modes[] =
|
||||
{
|
||||
{ "files", 0, pkg_mode_files, "Uses raw data files (no effect). Installation copies all files to the target location." },
|
||||
#ifdef U_MAKE_IS_NMAKE
|
||||
{ "dll", "library", pkg_mode_windows, "Generates one common data file and one shared library, <package>.dll"},
|
||||
{ "common", "archive", pkg_mode_windows, "Generates just the common file, <package>.dat"},
|
||||
{ "static", "static", pkg_mode_windows, "Generates one statically linked library, " LIB_PREFIX "<package>" UDATA_LIB_SUFFIX }
|
||||
#else /*#ifdef U_MAKE_IS_NMAKE*/
|
||||
#ifdef UDATA_SO_SUFFIX
|
||||
{ "dll", "library", pkg_mode_dll, "Generates one shared library, <package>" UDATA_SO_SUFFIX },
|
||||
#endif
|
||||
{ "common", "archive", pkg_mode_common, "Generates one common data file, <package>.dat" },
|
||||
{ "static", "static", pkg_mode_static, "Generates one statically linked library, " LIB_PREFIX "<package>" UDATA_LIB_SUFFIX }
|
||||
#endif /*#ifdef U_MAKE_IS_NMAKE*/
|
||||
};
|
||||
|
||||
enum {
|
||||
NAME,
|
||||
BLDOPT,
|
||||
|
@ -134,8 +119,6 @@ enum {
|
|||
COPYRIGHT,
|
||||
COMMENT,
|
||||
DESTDIR,
|
||||
CLEAN,
|
||||
NOOUTPUT,
|
||||
REBUILD,
|
||||
TEMPDIR,
|
||||
INSTALL,
|
||||
|
@ -147,6 +130,25 @@ enum {
|
|||
QUIET
|
||||
};
|
||||
|
||||
/* This sets the modes that are available */
|
||||
static struct {
|
||||
const char *name, *alt_name;
|
||||
const char *desc;
|
||||
} modes[] = {
|
||||
{ "files", 0, "Uses raw data files (no effect). Installation copies all files to the target location." },
|
||||
#ifdef U_WINDOWS
|
||||
{ "dll", "library", "Generates one common data file and one shared library, <package>.dll"},
|
||||
{ "common", "archive", "Generates just the common file, <package>.dat"},
|
||||
{ "static", "static", "Generates one statically linked library, " LIB_PREFIX "<package>" UDATA_LIB_SUFFIX }
|
||||
#else
|
||||
#ifdef UDATA_SO_SUFFIX
|
||||
{ "dll", "library", "Generates one shared library, <package>" UDATA_SO_SUFFIX },
|
||||
#endif
|
||||
{ "common", "archive", "Generates one common data file, <package>.dat" },
|
||||
{ "static", "static", "Generates one statically linked library, " LIB_PREFIX "<package>" UDATA_LIB_SUFFIX }
|
||||
#endif
|
||||
};
|
||||
|
||||
static UOption options[]={
|
||||
/*00*/ UOPTION_DEF( "name", 'p', UOPT_REQUIRES_ARG),
|
||||
/*01*/ UOPTION_DEF( "bldopt", 'O', UOPT_REQUIRES_ARG), /* on Win32 it is release or debug */
|
||||
|
@ -157,8 +159,6 @@ static UOption options[]={
|
|||
/*06*/ UOPTION_COPYRIGHT, /* -c */
|
||||
/*07*/ UOPTION_DEF( "comment", 'C', UOPT_REQUIRES_ARG),
|
||||
/*08*/ UOPTION_DESTDIR, /* -d */
|
||||
/*09*/ UOPTION_DEF( "clean", 'k', UOPT_NO_ARG),
|
||||
/*10*/ UOPTION_DEF( "nooutput",'n', UOPT_NO_ARG),
|
||||
/*11*/ UOPTION_DEF( "rebuild", 'F', UOPT_NO_ARG),
|
||||
/*12*/ UOPTION_DEF( "tempdir", 'T', UOPT_REQUIRES_ARG),
|
||||
/*13*/ UOPTION_DEF( "install", 'I', UOPT_REQUIRES_ARG),
|
||||
|
@ -220,8 +220,6 @@ const char options_help[][320]={
|
|||
"Use the standard ICU copyright",
|
||||
"Use a custom comment (instead of the copyright)",
|
||||
"Specify the destination directory for files",
|
||||
"Clean out generated & temporary files",
|
||||
"Suppress output of data, just list files to be created",
|
||||
"Force rebuilding of all data",
|
||||
"Specify temporary dir (default: output dir)",
|
||||
"Install the data (specify target)",
|
||||
|
@ -340,26 +338,6 @@ main(int argc, char* argv[]) {
|
|||
o.mode = options[MODE].value;
|
||||
o.version = options[REVISION].doesOccur ? options[REVISION].value : 0;
|
||||
|
||||
o.makeArgs = NULL;
|
||||
|
||||
o.fcn = NULL;
|
||||
|
||||
for(i=0;i<sizeof(modes)/sizeof(modes[0]);i++) {
|
||||
if(!uprv_strcmp(modes[i].name, o.mode)) {
|
||||
o.fcn = modes[i].fcn;
|
||||
break;
|
||||
} else if (modes[i].alt_name && !uprv_strcmp(modes[i].alt_name, o.mode)) {
|
||||
o.mode = modes[i].name;
|
||||
o.fcn = modes[i].fcn;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(o.fcn == NULL) {
|
||||
fprintf(stderr, "Error: invalid mode '%s' specified. Run '%s --help' to list valid modes.\n", o.mode, progname);
|
||||
return 1;
|
||||
}
|
||||
|
||||
o.shortName = options[NAME].value;
|
||||
{
|
||||
int32_t len = (int32_t)uprv_strlen(o.shortName);
|
||||
|
@ -407,8 +385,6 @@ main(int argc, char* argv[]) {
|
|||
o.targetDir = "."; /* cwd */
|
||||
}
|
||||
|
||||
o.clean = options[CLEAN].doesOccur;
|
||||
o.nooutput = options[NOOUTPUT].doesOccur;
|
||||
o.rebuild = options[REBUILD].doesOccur;
|
||||
|
||||
if( options[TEMPDIR].doesOccur ) {
|
||||
|
@ -438,16 +414,6 @@ main(int argc, char* argv[]) {
|
|||
/* OK options are set up. Now the file lists. */
|
||||
tail = NULL;
|
||||
for( n=1; n<argc; n++) {
|
||||
if ( !uprv_strcmp(argv[n] , "-") ) {
|
||||
/* stdin */
|
||||
if( o.hadStdin == TRUE ) {
|
||||
fprintf(stderr, "Error: can't specify '-' twice!\n"
|
||||
"Run '%s --help' for help.\n", progname);
|
||||
return 1;
|
||||
}
|
||||
o.hadStdin = TRUE;
|
||||
}
|
||||
|
||||
o.fileListFiles = pkg_appendToList(o.fileListFiles, &tail, uprv_strdup(argv[n]));
|
||||
}
|
||||
|
||||
|
@ -458,19 +424,12 @@ main(int argc, char* argv[]) {
|
|||
return 2;
|
||||
}
|
||||
|
||||
o.makeFile = "DO_NOT_USE";
|
||||
|
||||
|
||||
if(o.nooutput == TRUE) {
|
||||
return 0; /* nothing to do. */
|
||||
}
|
||||
|
||||
result = pkg_executeOptions(&o);
|
||||
|
||||
if (pkgDataFlags != NULL) {
|
||||
for (int32_t i = 0; i < PKGDATA_FLAGS_SIZE; i++) {
|
||||
if (pkgDataFlags[i] != NULL) {
|
||||
uprv_free(pkgDataFlags[i]);
|
||||
for (n = 0; n < PKGDATA_FLAGS_SIZE; n++) {
|
||||
if (pkgDataFlags[n] != NULL) {
|
||||
uprv_free(pkgDataFlags[n]);
|
||||
}
|
||||
}
|
||||
uprv_free(pkgDataFlags);
|
||||
|
@ -495,8 +454,6 @@ main(int argc, char* argv[]) {
|
|||
#define LN_CMD "ln -s"
|
||||
#define RM_CMD "rm -f"
|
||||
|
||||
#define ICUDATA_RES_FILE "icudata.res"
|
||||
|
||||
#define MODE_COMMON 'c'
|
||||
#define MODE_STATIC 's'
|
||||
#define MODE_DLL 'd'
|
||||
|
@ -505,6 +462,7 @@ main(int argc, char* argv[]) {
|
|||
static int32_t pkg_executeOptions(UPKGOptions *o) {
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
int32_t result = 0;
|
||||
char cmd[SMALL_BUFFER_MAX_SIZE] = "";
|
||||
const char mode = o->mode[0];
|
||||
char targetDir[SMALL_BUFFER_MAX_SIZE] = "";
|
||||
char tmpDir[SMALL_BUFFER_MAX_SIZE] = "";
|
||||
|
@ -512,30 +470,52 @@ static int32_t pkg_executeOptions(UPKGOptions *o) {
|
|||
char datFileNamePath[LARGE_BUFFER_MAX_SIZE] = "";
|
||||
char checkLibFile[LARGE_BUFFER_MAX_SIZE] = "";
|
||||
|
||||
/* Initialize pkgdataFlags */
|
||||
pkgDataFlags = (char**)uprv_malloc(sizeof(char*) * PKGDATA_FLAGS_SIZE);
|
||||
if (pkgDataFlags != NULL) {
|
||||
for (int32_t i = 0; i < PKGDATA_FLAGS_SIZE; i++) {
|
||||
pkgDataFlags[i] = (char*)uprv_malloc(sizeof(char) * SMALL_BUFFER_MAX_SIZE);
|
||||
if (pkgDataFlags[i] != NULL) {
|
||||
pkgDataFlags[i][0] = 0;
|
||||
} else {
|
||||
fprintf(stderr,"Error allocating memory for pkgDataFlags.\n");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
fprintf(stderr,"Error allocating memory for pkgDataFlags.\n");
|
||||
return -1;
|
||||
}
|
||||
#ifndef WINDOWS_WITH_MSVC
|
||||
/* Read in options file. */
|
||||
parseFlagsFile(o->options, pkgDataFlags, SMALL_BUFFER_MAX_SIZE, (int32_t)PKGDATA_FLAGS_SIZE, &status);
|
||||
if (U_FAILURE(status)) {
|
||||
fprintf(stderr,"Unable to open or read \"%s\" option file.\n", o->options);
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
if (mode == MODE_FILES) {
|
||||
// TODO: Copy files over
|
||||
/* Copy the raw data to the installation directory. */
|
||||
if (o->install != NULL) {
|
||||
uprv_strcpy(targetDir, o->install);
|
||||
if (o->shortName != NULL) {
|
||||
uprv_strcat(targetDir, PKGDATA_FILE_SEP_STRING);
|
||||
uprv_strcat(targetDir, o->shortName);
|
||||
}
|
||||
result = pkg_installFileMode(targetDir, o->srcDir, o->fileListFiles->str);
|
||||
}
|
||||
return result;
|
||||
} else /* if (mode == MODE_COMMON || mode == MODE_STATIC || mode == MODE_DLL) */ {
|
||||
uprv_strcpy(targetDir, o->targetDir);
|
||||
#ifdef WINDOWS_WITH_GNUC
|
||||
/* Need to fix the file seperator character when using MinGW. */
|
||||
uprv_strcat(targetDir, "/");
|
||||
#else
|
||||
uprv_strcat(targetDir, U_FILE_SEP_STRING);
|
||||
#endif
|
||||
uprv_strcat(targetDir, PKGDATA_FILE_SEP_STRING);
|
||||
|
||||
uprv_strcpy(tmpDir, o->tmpDir);
|
||||
#ifdef WINDOWS_WITH_GNUC
|
||||
/* Need to fix the file seperator character when using MinGW. */
|
||||
uprv_strcat(tmpDir, "/");
|
||||
#else
|
||||
uprv_strcat(tmpDir, U_FILE_SEP_STRING);
|
||||
#endif
|
||||
uprv_strcat(tmpDir, PKGDATA_FILE_SEP_STRING);
|
||||
|
||||
uprv_strcpy(datFileNamePath, tmpDir);
|
||||
|
||||
uprv_strcpy(datFileName, o->shortName);
|
||||
uprv_strcat(datFileName, ".dat");
|
||||
uprv_strcat(datFileName, UDATA_CMN_SUFFIX);
|
||||
|
||||
uprv_strcat(datFileNamePath, datFileName);
|
||||
|
||||
|
@ -544,47 +524,23 @@ static int32_t pkg_executeOptions(UPKGOptions *o) {
|
|||
fprintf(stderr,"Error writing package dat file.\n");
|
||||
return result;
|
||||
}
|
||||
|
||||
if (mode == MODE_COMMON) {
|
||||
char targetFileNamePath[LARGE_BUFFER_MAX_SIZE] = "";
|
||||
|
||||
uprv_strcpy(targetFileNamePath, targetDir);
|
||||
uprv_strcat(targetFileNamePath, datFileName);
|
||||
|
||||
/* Move the dat file created to the target directory. */
|
||||
rename(datFileNamePath, targetFileNamePath);
|
||||
/* Install the dat file created to the target directory. */
|
||||
sprintf(cmd, "%s %s %s", pkgDataFlags[INSTALL_CMD], datFileNamePath, targetFileNamePath);
|
||||
|
||||
return result;
|
||||
return system(cmd);
|
||||
} else /* if (mode[0] == MODE_STATIC || mode[0] == MODE_DLL) */ {
|
||||
char gencFilePath[SMALL_BUFFER_MAX_SIZE] = "";
|
||||
char version_major[10] = "";
|
||||
UBool reverseExt = FALSE;
|
||||
|
||||
UBool failedFlagsAllocation = FALSE;
|
||||
/* Allocate memory for pkgDataFlags and initialize it. */
|
||||
pkgDataFlags = (char **)uprv_malloc(sizeof(char *) * PKGDATA_FLAGS_SIZE);
|
||||
if (pkgDataFlags != NULL) {
|
||||
for (int32_t i = 0; i < PKGDATA_FLAGS_SIZE; i++) {
|
||||
pkgDataFlags[i] = (char *)uprv_malloc(sizeof(char) * SMALL_BUFFER_MAX_SIZE);
|
||||
if (pkgDataFlags[i] == NULL) {
|
||||
fprintf(stderr,"Unable to allocated memory for pkgDataFlags.\n");
|
||||
failedFlagsAllocation = TRUE;
|
||||
} else {
|
||||
pkgDataFlags[i][0] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (pkgDataFlags == NULL || failedFlagsAllocation) {
|
||||
fprintf(stderr,"Unable to allocated memory for pkgDataFlags.\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
#ifndef WINDOWS_WITH_MSVC
|
||||
parseFlagsFile(o->options, pkgDataFlags, SMALL_BUFFER_MAX_SIZE, (int32_t)PKGDATA_FLAGS_SIZE, &status);
|
||||
if (U_FAILURE(status)) {
|
||||
fprintf(stderr,"Unable to open or read \"%s\" option file.\n", o->options);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Get the version major number. */
|
||||
if (o->version != NULL) {
|
||||
for (uint32_t i = 0;i < sizeof(version_major);i++) {
|
||||
|
@ -606,7 +562,7 @@ static int32_t pkg_executeOptions(UPKGOptions *o) {
|
|||
/* Using the base libName and version number, generate the library file names. */
|
||||
createFileNames(version_major, o->version, o->libName, reverseExt);
|
||||
|
||||
if (o->version != NULL) {
|
||||
if (o->version != 0 && o->rebuild == FALSE) {
|
||||
/* Check to see if a previous built data library file exists and check if it is the latest. */
|
||||
sprintf(checkLibFile, "%s%s", targetDir, libFileNames[LIB_FILE_VERSION_TMP]);
|
||||
if (T_FileStream_file_exists(checkLibFile)) {
|
||||
|
@ -645,7 +601,7 @@ static int32_t pkg_executeOptions(UPKGOptions *o) {
|
|||
#ifdef CAN_WRITE_OBJ_CODE
|
||||
writeObjectCode(datFileNamePath, o->tmpDir, o->entryName, NULL, NULL, gencFilePath);
|
||||
#ifdef U_LINUX
|
||||
result = pkg_generateLibraryFile(targetDir, mode, gencFilePath, NULL);
|
||||
result = pkg_generateLibraryFile(targetDir, mode, gencFilePath);
|
||||
#elif defined(WINDOWS_WITH_MSVC)
|
||||
return pkg_createWindowsDLL(mode, gencFilePath, o);
|
||||
#endif
|
||||
|
@ -727,8 +683,8 @@ static void createFileNames(const char *version_major, const char *version, cons
|
|||
|
||||
/* Create the symbolic links for the final library file. */
|
||||
static int32_t pkg_createSymLinks(const char *targetDir) {
|
||||
char cmd[LARGE_BUFFER_MAX_SIZE];
|
||||
int32_t result = 0;
|
||||
char cmd[LARGE_BUFFER_MAX_SIZE];
|
||||
|
||||
#ifndef U_CYGWIN
|
||||
sprintf(cmd, "cd %s && %s %s && %s %s %s",
|
||||
|
@ -757,14 +713,14 @@ static int32_t pkg_createSymLinks(const char *targetDir) {
|
|||
}
|
||||
|
||||
static int32_t pkg_installLibrary(const char *installDir, const char *targetDir) {
|
||||
char cmd[SMALL_BUFFER_MAX_SIZE];
|
||||
int32_t result = 0;
|
||||
char cmd[SMALL_BUFFER_MAX_SIZE];
|
||||
|
||||
sprintf(cmd, "cd %s && %s %s %s%s%s",
|
||||
targetDir,
|
||||
pkgDataFlags[INSTALL_CMD],
|
||||
libFileNames[LIB_FILE_VERSION],
|
||||
installDir, U_FILE_SEP_STRING, libFileNames[LIB_FILE_VERSION]
|
||||
installDir, PKGDATA_FILE_SEP_STRING, libFileNames[LIB_FILE_VERSION]
|
||||
);
|
||||
|
||||
result = system(cmd);
|
||||
|
@ -776,12 +732,74 @@ static int32_t pkg_installLibrary(const char *installDir, const char *targetDir)
|
|||
return pkg_createSymLinks(installDir);
|
||||
}
|
||||
|
||||
#ifdef U_WINDOWS_MSVC
|
||||
/* Copy commands for installing the raw data files on Windows. */
|
||||
#define WIN_INSTALL_CMD "xcopy"
|
||||
#define WIN_INSTALL_CMD_FLAGS "/E /Y /K"
|
||||
#endif
|
||||
static int32_t pkg_installFileMode(const char *installDir, const char *srcDir, const char *fileListName) {
|
||||
int32_t result = 0;
|
||||
char cmd[SMALL_BUFFER_MAX_SIZE] = "";
|
||||
|
||||
if (!T_FileStream_file_exists(installDir)) {
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
|
||||
uprv_mkdir(installDir, &status);
|
||||
if (U_FAILURE(status)) {
|
||||
fprintf(stderr, "Error creating installation directory: %s\n", installDir);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
#ifndef U_WINDOWS_WITH_MSVC
|
||||
char buffer[SMALL_BUFFER_MAX_SIZE] = "";
|
||||
|
||||
FileStream *f = T_FileStream_open(fileListName, "r");
|
||||
if (f != NULL) {
|
||||
for(;;) {
|
||||
if (T_FileStream_readLine(f, buffer, SMALL_BUFFER_MAX_SIZE) != NULL) {
|
||||
/* Remove new line character. */
|
||||
buffer[uprv_strlen(buffer)-1] = 0;
|
||||
|
||||
sprintf(cmd, "%s %s%s%s %s%s%s",
|
||||
pkgDataFlags[INSTALL_CMD],
|
||||
srcDir, PKGDATA_FILE_SEP_STRING, buffer,
|
||||
installDir, PKGDATA_FILE_SEP_STRING, buffer);
|
||||
|
||||
result = system(cmd);
|
||||
if (result != 0) {
|
||||
fprintf(stderr, "Failed to install data file with command: %s\n", cmd);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
if (!T_FileStream_eof(f)) {
|
||||
fprintf(stderr, "Failed to read line from file: %s\n", fileListName);
|
||||
result = -1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
T_FileStream_close(f);
|
||||
} else {
|
||||
result = -1;
|
||||
fprintf(stderr, "Unable to open list file: %s\n", fileListName);
|
||||
}
|
||||
#else
|
||||
sprintf(cmd, "%s %s %s %s", WIN_INSTALL_CMD, srcDir, installDir, WIN_INSTALL_CMD_FLAGS);
|
||||
result = system(cmd);
|
||||
if (result != 0) {
|
||||
fprintf(stderr, "Failed to install data file with command: %s\n", cmd);
|
||||
}
|
||||
#endif
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/* Archiving of the library file may be needed depending on the platform and options given.
|
||||
* If archiving is not needed, copy over the library file name.
|
||||
*/
|
||||
static int32_t pkg_archiveLibrary(const char *targetDir, const char *version, UBool reverseExt) {
|
||||
char cmd[LARGE_BUFFER_MAX_SIZE];
|
||||
int32_t result = 0;
|
||||
char cmd[LARGE_BUFFER_MAX_SIZE];
|
||||
|
||||
/* If the shard object suffix and the final object suffix is different and the final object suffix and the
|
||||
* archive file suffix is the same, then the final library needs to be archived.
|
||||
|
@ -828,17 +846,9 @@ static int32_t pkg_archiveLibrary(const char *targetDir, const char *version, UB
|
|||
* Using the compiler information from the configuration file set by -O option, generate the library file.
|
||||
* command may be given to allow for a larger buffer for cmd.
|
||||
*/
|
||||
static int32_t pkg_generateLibraryFile(const char *targetDir, const char mode, const char *objectFile, char *command) {
|
||||
static int32_t pkg_generateLibraryFile(const char *targetDir, const char mode, const char *objectFile) {
|
||||
int32_t result = 0;
|
||||
char *cmd;
|
||||
UBool cmdFree = FALSE;
|
||||
|
||||
if (command != NULL) {
|
||||
cmd = command;
|
||||
} else {
|
||||
cmd = (char *)uprv_malloc(sizeof(char) * LARGE_BUFFER_MAX_SIZE);
|
||||
cmdFree = TRUE;
|
||||
}
|
||||
char cmd[LARGE_BUFFER_MAX_SIZE] = "";;
|
||||
|
||||
if (mode == MODE_STATIC) {
|
||||
sprintf(cmd, "%s %s %s%s.%s %s",
|
||||
|
@ -875,16 +885,12 @@ static int32_t pkg_generateLibraryFile(const char *targetDir, const char mode, c
|
|||
result = system(cmd);
|
||||
}
|
||||
|
||||
if (cmdFree) {
|
||||
uprv_free(cmd);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static int32_t pkg_createWithAssemblyCode(const char *targetDir, const char mode, const char *gencFilePath) {
|
||||
char tempObjectFile[SMALL_BUFFER_MAX_SIZE] = "";
|
||||
char cmd[LARGE_BUFFER_MAX_SIZE];
|
||||
char cmd[LARGE_BUFFER_MAX_SIZE] = "";
|
||||
int32_t result = 0;
|
||||
|
||||
/* Remove the ending .s and replace it with .o for the new object file. */
|
||||
|
@ -903,7 +909,7 @@ static int32_t pkg_createWithAssemblyCode(const char *targetDir, const char mode
|
|||
return result;
|
||||
}
|
||||
|
||||
return pkg_generateLibraryFile(targetDir, mode, tempObjectFile, cmd);
|
||||
return pkg_generateLibraryFile(targetDir, mode, tempObjectFile);
|
||||
}
|
||||
|
||||
#ifdef BUILD_DATA_WITHOUT_ASSEMBLY
|
||||
|
@ -918,19 +924,19 @@ enum {
|
|||
DATA_PREFIX_TRANSLIT,
|
||||
DATA_PREFIX_LENGTH
|
||||
};
|
||||
const static char DATA_PREFIX[DATA_PREFIX_LENGTH][10] = {
|
||||
const static char DATA_PREFIX[DATA_PREFIX_LENGTH][] = {
|
||||
"brkitr",
|
||||
"coll",
|
||||
"rbnf",
|
||||
"translit"
|
||||
};
|
||||
static int32_t pkg_createWithoutAssemblyCode(UPKGOptions *o, const char *targetDir, const char mode) {
|
||||
int32_t result = 0;
|
||||
CharList *list = o->filePaths;
|
||||
CharList *listNames = o->files;
|
||||
int32_t listSize = pkg_countCharList(list);
|
||||
char *buffer;
|
||||
char *cmd;
|
||||
int32_t result = 0;
|
||||
char gencmnFile[SMALL_BUFFER_MAX_SIZE] = "";
|
||||
char tempObjectFile[SMALL_BUFFER_MAX_SIZE] = "";
|
||||
|
||||
|
@ -1029,8 +1035,8 @@ static int32_t pkg_createWithoutAssemblyCode(UPKGOptions *o, const char *targetD
|
|||
#define LINK_FLAGS "/DLL /NOENTRY /MANIFEST:NO /base:0x4ad00000 /implib:"
|
||||
#define LIB_CMD "LIB.exe /nologo /out:"
|
||||
#define LIB_FILE "icudt.lib"
|
||||
#define LIB_EXT ".lib"
|
||||
#define DLL_EXT ".dll"
|
||||
#define LIB_EXT UDATA_LIB_SUFFIX
|
||||
#define DLL_EXT UDATA_SO_SUFFIX
|
||||
|
||||
static int32_t pkg_createWindowsDLL(const char mode, const char *gencFilePath, UPKGOptions *o) {
|
||||
char cmd[LARGE_BUFFER_MAX_SIZE];
|
||||
|
@ -1038,7 +1044,7 @@ static int32_t pkg_createWindowsDLL(const char mode, const char *gencFilePath, U
|
|||
char staticLibFilePath[SMALL_BUFFER_MAX_SIZE] = "";
|
||||
|
||||
uprv_strcpy(staticLibFilePath, o->tmpDir);
|
||||
uprv_strcat(staticLibFilePath, U_FILE_SEP_STRING);
|
||||
uprv_strcat(staticLibFilePath, PKGDATA_FILE_SEP_STRING);
|
||||
|
||||
uprv_strcat(staticLibFilePath, o->entryName);
|
||||
uprv_strcat(staticLibFilePath, LIB_EXT);
|
||||
|
@ -1057,11 +1063,11 @@ static int32_t pkg_createWindowsDLL(const char mode, const char *gencFilePath, U
|
|||
#else
|
||||
uprv_strcpy(dllFilePath, o->srcDir);
|
||||
#endif
|
||||
uprv_strcat(dllFilePath, U_FILE_SEP_STRING);
|
||||
uprv_strcat(dllFilePath, PKGDATA_FILE_SEP_STRING);
|
||||
uprv_strcpy(libFilePath, dllFilePath);
|
||||
|
||||
uprv_strcpy(resFilePath, o->tmpDir);
|
||||
uprv_strcat(resFilePath, U_FILE_SEP_STRING);
|
||||
uprv_strcat(resFilePath, PKGDATA_FILE_SEP_STRING);
|
||||
|
||||
uprv_strcat(dllFilePath, o->entryName);
|
||||
uprv_strcat(dllFilePath, DLL_EXT);
|
||||
|
@ -1073,7 +1079,7 @@ static int32_t pkg_createWindowsDLL(const char mode, const char *gencFilePath, U
|
|||
}
|
||||
|
||||
/* Check if dll file and lib file exists and that it is not newer than genc file. */
|
||||
if ((T_FileStream_file_exists(dllFilePath) && isFileModTimeLater(dllFilePath, gencFilePath)) &&
|
||||
if (!o->rebuild && (T_FileStream_file_exists(dllFilePath) && isFileModTimeLater(dllFilePath, gencFilePath)) &&
|
||||
(T_FileStream_file_exists(libFilePath) && isFileModTimeLater(libFilePath, gencFilePath))) {
|
||||
return 0;
|
||||
}
|
||||
|
@ -1094,6 +1100,7 @@ static int32_t pkg_createWindowsDLL(const char mode, const char *gencFilePath, U
|
|||
|
||||
static void pkg_checkFlag(UPKGOptions *o) {
|
||||
#ifdef U_AIX
|
||||
/* AIX needs a map file. */
|
||||
char *flag = NULL;
|
||||
int32_t length = 0;
|
||||
char tmpbuffer[SMALL_BUFFER_MAX_SIZE];
|
||||
|
@ -1152,13 +1159,14 @@ static void pkg_checkFlag(UPKGOptions *o) {
|
|||
return;
|
||||
}
|
||||
|
||||
sprintf(tmpbuffer, "%s_dat ", o->entryName);
|
||||
sprintf(tmpbuffer, "%s%s ", o->entryName, UDATA_CMN_INTERMEDIATE_SUFFIX);
|
||||
|
||||
T_FileStream_writeLine(f, tmpbuffer);
|
||||
|
||||
T_FileStream_close(f);
|
||||
}
|
||||
#elif defined(U_CYGWIN)
|
||||
/* Cygwin needs to change flag options. */
|
||||
char *flag = NULL;
|
||||
int32_t length = 0;
|
||||
|
||||
|
@ -1178,19 +1186,6 @@ static void pkg_checkFlag(UPKGOptions *o) {
|
|||
#endif
|
||||
}
|
||||
|
||||
#if 0
|
||||
{
|
||||
rc = system(cmd);
|
||||
|
||||
if(rc < 0) {
|
||||
fprintf(stderr, "# Failed, rc=%d\n", rc);
|
||||
}
|
||||
|
||||
return rc < 128 ? rc : (rc >> 8);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
static void loadLists(UPKGOptions *o, UErrorCode *status)
|
||||
{
|
||||
CharList *l, *tail = NULL, *tail2 = NULL;
|
||||
|
@ -1284,7 +1279,7 @@ static void loadLists(UPKGOptions *o, UErrorCode *status)
|
|||
exit(U_ILLEGAL_ARGUMENT_ERROR);
|
||||
}
|
||||
uprv_strcpy(tmp, o->srcDir);
|
||||
uprv_strcat(tmp, o->srcDir[uprv_strlen(o->srcDir)-1]==U_FILE_SEP_CHAR?"":U_FILE_SEP_STRING);
|
||||
uprv_strcat(tmp, o->srcDir[uprv_strlen(o->srcDir)-1] == U_FILE_SEP_CHAR ? "" :PKGDATA_FILE_SEP_STRING);
|
||||
uprv_strcat(tmp, s);
|
||||
o->filePaths = pkg_appendToList(o->filePaths, &tail2, uprv_strdup(tmp));
|
||||
linePtr = lineNext;
|
||||
|
|
|
@ -393,14 +393,6 @@
|
|||
Name="Source Files"
|
||||
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\filemode.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\make.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\pkgdata.cpp"
|
||||
>
|
||||
|
@ -409,23 +401,11 @@
|
|||
RelativePath=".\pkgtypes.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\sttcmode.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\winmode.c"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\makefile.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\pkgtypes.h"
|
||||
>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/**************************************************************************
|
||||
*
|
||||
* Copyright (C) 2000-2007, International Business Machines
|
||||
* Copyright (C) 2000-2009, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
*
|
||||
***************************************************************************
|
||||
|
@ -33,7 +33,7 @@ typedef struct _CharList
|
|||
|
||||
|
||||
|
||||
/*
|
||||
/*
|
||||
* write CharList 'l' into stream 's' using deliminter 'delim' (delim can be NULL). quoted: -1 remove, 0 as is, 1 add quotes
|
||||
*/
|
||||
const char *pkg_writeCharList(FileStream *s, CharList *l, const char *delim, int32_t quoted);
|
||||
|
@ -49,25 +49,25 @@ const char *pkg_writeCharListWrap(FileStream *s, CharList *l, const char *delim,
|
|||
*/
|
||||
uint32_t pkg_countCharList(CharList *l);
|
||||
|
||||
/*
|
||||
/*
|
||||
* Prepend string to CharList. Str is adopted!
|
||||
*/
|
||||
CharList *pkg_prependToList(CharList *l, const char *str);
|
||||
|
||||
/*
|
||||
* append string to CharList. *end or even end can be null if you don't
|
||||
/*
|
||||
* append string to CharList. *end or even end can be null if you don't
|
||||
* know it.[slow]
|
||||
* Str is adopted!
|
||||
*/
|
||||
CharList *pkg_appendToList(CharList *l, CharList** end, const char *str);
|
||||
|
||||
/*
|
||||
/*
|
||||
* strAlias is an alias to a full or relative path to a FILE. This function
|
||||
* will search strAlias for the directory name (with strrchr). Then, it will
|
||||
* will search strAlias for the directory name (with strrchr). Then, it will
|
||||
* determine if that directory is already in list l. If not, it will add it
|
||||
* with strdup(strAlias).
|
||||
* with strdup(strAlias).
|
||||
* @param l list to append to , or NULL
|
||||
* @param end end pointer-to-pointer. Can point to null, or be null.
|
||||
* @param end end pointer-to-pointer. Can point to null, or be null.
|
||||
* @param strAlias alias to full path string
|
||||
* @return new list
|
||||
*/
|
||||
|
@ -79,7 +79,7 @@ CharList *pkg_appendUniqueDirToList(CharList *l, CharList** end, const char *str
|
|||
UBool pkg_listContains(CharList *l, const char *str);
|
||||
|
||||
/*
|
||||
* Delete list
|
||||
* Delete list
|
||||
*/
|
||||
void pkg_deleteList(CharList *l);
|
||||
|
||||
|
@ -90,14 +90,14 @@ struct UPKGOptions_;
|
|||
typedef void (UPKGMODE)(struct UPKGOptions_ *, FileStream *s, UErrorCode *status);
|
||||
|
||||
/*
|
||||
* Static mode - write the readme file
|
||||
* Static mode - write the readme file
|
||||
* @param opt UPKGOptions
|
||||
* @param libName Name of the .lib, etc file
|
||||
* @param status ICU error code
|
||||
*/
|
||||
void pkg_sttc_writeReadme(struct UPKGOptions_ *opt, const char *libName, UErrorCode *status);
|
||||
|
||||
/*
|
||||
/*
|
||||
* Options to be passed throughout the program
|
||||
*/
|
||||
|
||||
|
@ -113,25 +113,18 @@ typedef struct UPKGOptions_
|
|||
const char *entryName; /* special entrypoint name */
|
||||
const char *targetDir; /* dir for packaged data to go */
|
||||
const char *dataDir; /* parent of dir for package (default: tmpdir) */
|
||||
const char *tmpDir;
|
||||
const char *tmpDir;
|
||||
const char *srcDir;
|
||||
const char *options; /* Options arg */
|
||||
const char *mode; /* Mode of building */
|
||||
const char *version; /* Library version */
|
||||
const char *makeArgs; /* XXX Should be a CharList! */
|
||||
const char *comment; /* comment string */
|
||||
const char *makeFile; /* Makefile path */
|
||||
const char *install; /* Where to install to (NULL = don't install) */
|
||||
const char *icuroot; /* where does ICU lives */
|
||||
const char *libName; /* name for library (default: shortName) */
|
||||
UBool rebuild;
|
||||
UBool clean;
|
||||
UBool nooutput;
|
||||
UBool verbose;
|
||||
UBool quiet;
|
||||
UBool hadStdin; /* Stdin was a dependency - don't make anything depend on the file list coming in. */
|
||||
|
||||
UPKGMODE *fcn; /* Handler function */
|
||||
} UPKGOptions;
|
||||
|
||||
char * convertToNativePathSeparators(char *path);
|
||||
|
@ -159,16 +152,17 @@ char * convertToNativePathSeparators(char *path);
|
|||
# define LIB_STATIC_PREFIX "lib"
|
||||
# define OBJ_SUFFIX ".o"
|
||||
# define UDATA_LIB_SUFFIX ".a"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define ASM_SUFFIX ".s"
|
||||
|
||||
|
||||
/* defines for common file names */
|
||||
#define UDATA_CMN_PREFIX ""
|
||||
#define UDATA_CMN_SUFFIX ".dat"
|
||||
#define UDATA_CMN_INTERMEDIATE_SUFFIX "_dat"
|
||||
|
||||
#define ICUDATA_RES_FILE "icudata.res"
|
||||
|
||||
#define PKGDATA_DERIVED_PATH '\t'
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,259 +0,0 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* Copyright (C) 2002-2007, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
*
|
||||
*******************************************************************************
|
||||
* file name: staticmode.c
|
||||
* encoding: ANSI X3.4 (1968)
|
||||
* tab size: 8 (not used)
|
||||
* indentation:4
|
||||
*
|
||||
* created on: 2002mar14
|
||||
* created by: Steven \u24C7 Loomis
|
||||
*
|
||||
* This program packages the ICU data into a static library.
|
||||
* It is *mainly* used by POSIX, but the top function (for writing READMEs) is
|
||||
* shared with Win32.
|
||||
*/
|
||||
|
||||
#include "unicode/utypes.h"
|
||||
#include "unicode/putil.h"
|
||||
#include "unicode/uloc.h"
|
||||
#include "cmemory.h"
|
||||
#include "cstring.h"
|
||||
#include "filestrm.h"
|
||||
#include "toolutil.h"
|
||||
#include "unewdata.h"
|
||||
#include "uoptions.h"
|
||||
#include "pkgtypes.h"
|
||||
#include "filestrm.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
void pkg_sttc_writeReadme(struct UPKGOptions_ *o, const char *libName, UErrorCode *status)
|
||||
{
|
||||
char tmp[1024];
|
||||
FileStream *out;
|
||||
|
||||
if(U_FAILURE(*status))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
/* Makefile pathname */
|
||||
uprv_strcpy(tmp, o->targetDir);
|
||||
uprv_strcat(tmp, U_FILE_SEP_STRING "README_");
|
||||
uprv_strcat(tmp, o->shortName);
|
||||
uprv_strcat(tmp, ".txt");
|
||||
|
||||
out = T_FileStream_open(tmp, "w");
|
||||
if (!out) {
|
||||
fprintf(stderr, "err: couldn't create README file %s\n", tmp);
|
||||
*status = U_FILE_ACCESS_ERROR;
|
||||
return;
|
||||
}
|
||||
|
||||
sprintf(tmp, "## README for \"%s\"'s static data (%s)\n"
|
||||
"## created by pkgdata, ICU Version %s\n",
|
||||
o->shortName,
|
||||
libName,
|
||||
U_ICU_VERSION);
|
||||
|
||||
T_FileStream_writeLine(out, tmp);
|
||||
|
||||
sprintf(tmp, "\n\nTo use this data in your application:\n\n"
|
||||
"1. At the top of your source file, add the following lines:\n"
|
||||
"\n"
|
||||
" #include \"unicode/utypes.h\"\n"
|
||||
" #include \"unicode/udata.h\"\n"
|
||||
" U_CFUNC char %s_dat[];\n",
|
||||
o->cShortName);
|
||||
T_FileStream_writeLine(out, tmp);
|
||||
|
||||
sprintf(tmp, "2. *Early* in your application, call the following function:\n"
|
||||
"\n"
|
||||
" UErrorCode myError = U_ZERO_ERROR;\n"
|
||||
" udata_setAppData( \"%s\", (const void*) %s_dat, &myError);\n"
|
||||
" if(U_FAILURE(myError))\n"
|
||||
" {\n"
|
||||
" handle error condition ...\n"
|
||||
" }\n"
|
||||
"\n",
|
||||
o->cShortName, o->cShortName);
|
||||
T_FileStream_writeLine(out, tmp);
|
||||
|
||||
sprintf(tmp, "3. Link your application against %s\n"
|
||||
"\n\n"
|
||||
"4. Now, you may access this data with a 'path' of \"%s\" as in the following example:\n"
|
||||
"\n"
|
||||
" ... ures_open( \"%s\", NULL /* Get the default locale */, &err ); \n",
|
||||
libName, o->shortName, o->shortName);
|
||||
T_FileStream_writeLine(out, tmp);
|
||||
|
||||
T_FileStream_close(out);
|
||||
}
|
||||
|
||||
|
||||
#ifndef U_MAKE_IS_NMAKE
|
||||
|
||||
|
||||
#include "makefile.h"
|
||||
|
||||
|
||||
void pkg_mode_static(UPKGOptions *o, FileStream *makefile, UErrorCode *status)
|
||||
{
|
||||
char tmp[1024];
|
||||
CharList *tail = NULL;
|
||||
CharList *objects = NULL;
|
||||
|
||||
if(U_FAILURE(*status)) {
|
||||
return;
|
||||
}
|
||||
|
||||
uprv_strcpy(tmp, LIB_STATIC_PREFIX);
|
||||
uprv_strcat(tmp, o->libName);
|
||||
uprv_strcat(tmp, UDATA_LIB_SUFFIX);
|
||||
|
||||
o->outFiles = pkg_appendToList(o->outFiles, &tail, uprv_strdup(tmp));
|
||||
|
||||
if (!o->quiet) {
|
||||
pkg_sttc_writeReadme(o, tmp, status);
|
||||
}
|
||||
if(U_FAILURE(*status)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if(o->nooutput || o->verbose) {
|
||||
fprintf(stdout, "# Output file: %s%s%s\n", o->targetDir, U_FILE_SEP_STRING, tmp);
|
||||
}
|
||||
|
||||
if(o->nooutput) {
|
||||
*status = U_ZERO_ERROR;
|
||||
return;
|
||||
}
|
||||
|
||||
/* begin writing makefile ========================= */
|
||||
|
||||
|
||||
T_FileStream_writeLine(makefile, "# Version numbers:\nVERSIONED=");
|
||||
if (o->version) {
|
||||
sprintf(tmp, ".%s", o->version);
|
||||
if (!uprv_strchr(o->version, '.')) {
|
||||
uprv_strcat(tmp, ".0");
|
||||
}
|
||||
T_FileStream_writeLine(makefile, tmp);
|
||||
T_FileStream_writeLine(makefile, "\nDLL_LDFLAGS=$(LD_SONAME) $(RPATH_LDFLAGS)\n");
|
||||
} else {
|
||||
T_FileStream_writeLine(makefile, "\nDLL_LDFLAGS=$(BIR_LDFLAGS)\n");
|
||||
}
|
||||
T_FileStream_writeLine(makefile, "\n");
|
||||
|
||||
sprintf(tmp, "# File to make:\nTARGET=%s\n\n", o->outFiles->str);
|
||||
T_FileStream_writeLine(makefile, tmp);
|
||||
T_FileStream_writeLine(makefile, "LIB_TARGET=$(TARGET)\n");
|
||||
|
||||
uprv_strcpy(tmp, "all: $(TARG_PATH)$(LIB_TARGET)");
|
||||
uprv_strcat(tmp, "\n\n");
|
||||
T_FileStream_writeLine(makefile, tmp);
|
||||
|
||||
#ifdef OS400
|
||||
/* New for iSeries: All packaged data in one .c */
|
||||
sprintf(tmp, "# Create a file which contains all .c data files/structures\n"
|
||||
"$(TEMP_DIR)/$(NAME)all.c: $(CMNLIST)\n\n");
|
||||
T_FileStream_writeLine(makefile, tmp);
|
||||
#endif
|
||||
|
||||
/* Write compile rules */
|
||||
pkg_mak_writeObjRules(o, makefile, &objects, ".$(STATIC_O)"); /* use special .o suffix */
|
||||
|
||||
sprintf(tmp, "# List file for gencmn:\n"
|
||||
"CMNLIST=%s%s$(NAME)_static.lst\n\n",
|
||||
o->tmpDir,
|
||||
U_FILE_SEP_STRING);
|
||||
T_FileStream_writeLine(makefile, tmp);
|
||||
|
||||
if(o->hadStdin == FALSE) { /* shortcut */
|
||||
T_FileStream_writeLine(makefile, "$(CMNLIST): $(LISTFILES)\n"
|
||||
"\tcat $(LISTFILES) > $(CMNLIST)\n\n");
|
||||
} else {
|
||||
T_FileStream_writeLine(makefile, "$(CMNLIST): \n"
|
||||
"\t@echo \"generating $@ (list of data files)\"\n"
|
||||
"\t@-$(RMV) $@\n"
|
||||
"\t@for file in $(DATAFILEPATHS); do \\\n"
|
||||
"\t echo $$file >> $@; \\\n"
|
||||
"\tdone;\n\n");
|
||||
}
|
||||
|
||||
pkg_mak_writeAssemblyHeader(makefile, o);
|
||||
|
||||
sprintf(tmp,"$(TEMP_PATH)$(NAME)_dat.$(STATIC_O) : $(TEMP_PATH)$(NAME)_dat.c\n"
|
||||
"\t$(COMPILE.c) -o $@ $<\n\n");
|
||||
T_FileStream_writeLine(makefile, tmp);
|
||||
|
||||
T_FileStream_writeLine(makefile, "# 'TOCOBJ' contains C Table of Contents objects [if any]\n");
|
||||
|
||||
sprintf(tmp, "$(TEMP_PATH)$(NAME)_dat.c: $(CMNLIST)\n"
|
||||
"\t$(INVOKE) $(GENCMN) -e $(ENTRYPOINT) -n $(NAME) -S -s $(SRCDIR) -d $(TEMP_DIR) 0 $(CMNLIST)\n\n");
|
||||
T_FileStream_writeLine(makefile, tmp);
|
||||
|
||||
sprintf(tmp, "TOCOBJ= $(NAME)_dat.$(STATIC_O)\n\n");
|
||||
T_FileStream_writeLine(makefile, tmp);
|
||||
|
||||
#ifdef OS400
|
||||
/* New for iSeries: All packaged data in one .c */
|
||||
sprintf(tmp,"$(TEMP_PATH)$(NAME)all.$(STATIC_O) : $(TEMP_PATH)$(NAME)all.c\n"
|
||||
"\t$(COMPILE.c) -o $@ $<\n\n");
|
||||
T_FileStream_writeLine(makefile, tmp);
|
||||
|
||||
T_FileStream_writeLine(makefile, "# 'ALLDATAOBJ' contains all .c data structures\n");
|
||||
|
||||
sprintf(tmp, "ALLDATAOBJ= $(NAME)all%s \n\n", OBJ_SUFFIX);
|
||||
T_FileStream_writeLine(makefile, tmp);
|
||||
#endif
|
||||
|
||||
sprintf(tmp, "TOCSYM= $(ENTRYPOINT)_dat \n\n"); /* entrypoint not always shortname! */
|
||||
T_FileStream_writeLine(makefile, tmp);
|
||||
|
||||
T_FileStream_writeLine(makefile, "BASE_OBJECTS= $(TOCOBJ) ");
|
||||
|
||||
#ifdef OS400
|
||||
T_FileStream_writeLine(makefile, "$(ALLDATAOBJ) ");
|
||||
#else
|
||||
pkg_writeCharListWrap(makefile, objects, " ", " \\\n",0);
|
||||
#endif
|
||||
pkg_mak_writeAssemblyFooter(makefile, o);
|
||||
|
||||
T_FileStream_writeLine(makefile, "\n\n");
|
||||
T_FileStream_writeLine(makefile, "OBJECTS=$(BASE_OBJECTS:%=$(TEMP_PATH)%)\n\n");
|
||||
|
||||
T_FileStream_writeLine(makefile,"$(TEMP_PATH)%.$(STATIC_O): $(TEMP_PATH)%.c\n\t $(COMPILE.c) -o $@ $<\n\n");
|
||||
|
||||
T_FileStream_writeLine(makefile, "$(TARG_PATH)$(LIB_TARGET): $(OBJECTS) $(LISTFILES)\n"
|
||||
"\t$(AR) $(ARFLAGS) $(AR_OUTOPT)$@ $(OBJECTS)\n"
|
||||
"\t$(RANLIB) $@\n\n");
|
||||
|
||||
|
||||
T_FileStream_writeLine(makefile, "CLEANFILES= $(CMNLIST) $(OBJECTS) $(TARG_PATH)$(LIB_TARGET) $(TARG_PATH)$(MIDDLE_STATIC_LIB_TARGET) $(TARG_PATH)$(TARGET)\n\nclean:\n\t-$(RMV) $(CLEANFILES) $(MAKEFILE)");
|
||||
T_FileStream_writeLine(makefile, "\n\n");
|
||||
|
||||
T_FileStream_writeLine(makefile, "# static mode shouldn't need to be installed, but we will install the header and static library for them.\n");
|
||||
|
||||
T_FileStream_writeLine(makefile, "install: $(TARG_PATH)$(LIB_TARGET)\n"
|
||||
"\t$(INSTALL-L) $(TARG_PATH)$(LIB_TARGET) $(INSTALLTO)/$(LIB_TARGET)\n");
|
||||
T_FileStream_writeLine(makefile, "\t$(RANLIB) $(INSTALLTO)/$(LIB_TARGET)\n");
|
||||
if (o->version) {
|
||||
T_FileStream_writeLine(makefile, "\tcd $(INSTALLTO) && $(RM) $(MIDDLE_STATIC_LIB_TARGET) && ln -s $(LIB_TARGET) $(MIDDLE_STATIC_LIB_TARGET)\n\tcd $(INSTALLTO) && $(RM) $(STATIC_LIB_TARGET) && ln -s $(LIB_TARGET) $(STATIC_LIB_TARGET)\n");
|
||||
T_FileStream_writeLine(makefile, "\t$(RANLIB) $(INSTALLTO)/$(STATIC_LIB_TARGET)\n\n");
|
||||
|
||||
}
|
||||
|
||||
*status = U_ZERO_ERROR;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endif
|
|
@ -1,252 +0,0 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* Copyright (C) 2000-2007, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
*
|
||||
*******************************************************************************
|
||||
* file name: winmode.c
|
||||
* encoding: ANSI X3.4 (1968)
|
||||
* tab size: 8 (not used)
|
||||
* indentation:4
|
||||
*
|
||||
* created on: 2000july14
|
||||
* created by: Vladimir Weinstein
|
||||
*
|
||||
* This program packages the ICU data into different forms
|
||||
* (DLL, common data, etc.)
|
||||
*/
|
||||
|
||||
#include "unicode/utypes.h"
|
||||
|
||||
#ifdef U_MAKE_IS_NMAKE
|
||||
|
||||
#include "unicode/putil.h"
|
||||
#include "cmemory.h"
|
||||
#include "cstring.h"
|
||||
#include "filestrm.h"
|
||||
#include "toolutil.h"
|
||||
#include "unewdata.h"
|
||||
#include "uoptions.h"
|
||||
#include "pkgtypes.h"
|
||||
#include "makefile.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
/*
|
||||
MSVC 2005 has the annoying habit of creating a manifest when one isn't needed.
|
||||
The generated library doesn't depend on anything due to the /NOENTRY usage.
|
||||
*/
|
||||
#if defined(_MSC_VER) && _MSC_VER >= 1400
|
||||
#define NO_MANIFEST "/MANIFEST:NO "
|
||||
#else
|
||||
#define NO_MANIFEST ""
|
||||
#endif
|
||||
|
||||
/*#define WINBUILDMODE (*(o->options)=='R'?"Release":"Debug")*/
|
||||
#define CONTAINS_REAL_PATH(o) (*(o->options)==PKGDATA_DERIVED_PATH)
|
||||
|
||||
void writeCmnRules(UPKGOptions *o, const char *targetDirVar, FileStream *makefile)
|
||||
{
|
||||
char tmp[1024];
|
||||
CharList *infiles;
|
||||
|
||||
infiles = o->files;
|
||||
sprintf(tmp, "\"$(%s)\\$(CMNTARGET)\" : $(DATAFILEPATHS)\n"
|
||||
"\t%s\"$(ICUPKG)\" -t%c %s%s%s -s \"$(SRCDIR)\" -a \"$(LISTFILES)\" new \"$(%s)\\$(CMNTARGET)\"\n",
|
||||
targetDirVar,
|
||||
(o->verbose ? "" : "@"),
|
||||
(U_IS_BIG_ENDIAN ? 'b' : 'l'),
|
||||
(o->comment ? "-C \"" : ""),
|
||||
(o->comment ? o->comment : ""),
|
||||
(o->comment ? "\" " : ""),
|
||||
targetDirVar);
|
||||
T_FileStream_writeLine(makefile, tmp);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void pkg_mode_windows(UPKGOptions *o, FileStream *makefile, UErrorCode *status) {
|
||||
char tmp[1024];
|
||||
char tmp2[1024];
|
||||
const char *separator = o->icuroot[uprv_strlen(o->icuroot)-1]=='\\'?"":"\\";
|
||||
UBool isDll = (UBool)(uprv_strcmp(o->mode, "dll") == 0);
|
||||
UBool isStatic = (UBool)(uprv_strcmp(o->mode, "static") == 0);
|
||||
|
||||
if(U_FAILURE(*status)) {
|
||||
return;
|
||||
}
|
||||
|
||||
sprintf(tmp2, "ICUROOT=%s\n\n", o->icuroot);
|
||||
T_FileStream_writeLine(makefile, tmp2);
|
||||
|
||||
if (CONTAINS_REAL_PATH(o)) {
|
||||
sprintf(tmp2,
|
||||
"ICUPKG = $(ICUROOT)%sicupkg.exe\n", separator);
|
||||
}
|
||||
else {
|
||||
sprintf(tmp2,
|
||||
"ICUPKG = $(ICUROOT)%sbin\\icupkg.exe\n", separator);
|
||||
}
|
||||
T_FileStream_writeLine(makefile, tmp2);
|
||||
|
||||
if(isDll) {
|
||||
uprv_strcpy(tmp, LIB_PREFIX);
|
||||
uprv_strcat(tmp, o->libName);
|
||||
if (o->version) {
|
||||
uprv_strcat(tmp, "$(TARGET_VERSION)");
|
||||
}
|
||||
uprv_strcat(tmp, UDATA_SO_SUFFIX);
|
||||
|
||||
if(o->nooutput || o->verbose) {
|
||||
fprintf(stdout, "# Output %s file: %s%s%s\n", UDATA_SO_SUFFIX, o->targetDir, U_FILE_SEP_STRING, tmp);
|
||||
}
|
||||
|
||||
if(o->nooutput) {
|
||||
*status = U_ZERO_ERROR;
|
||||
return;
|
||||
}
|
||||
|
||||
sprintf(tmp2, "# DLL file to make:\nDLLTARGET=%s\n\n", tmp);
|
||||
T_FileStream_writeLine(makefile, tmp2);
|
||||
|
||||
sprintf(tmp2,
|
||||
"LINK32 = link.exe\n"
|
||||
"LINK32_FLAGS = /nologo /release /out:\"$(TARGETDIR)\\$(DLLTARGET)\" /DLL /NOENTRY " NO_MANIFEST "$(LDFLAGS) $(PKGDATA_LDFLAGS) /implib:\"$(TARGETDIR)\\$(LIBNAME).lib\"\n");
|
||||
T_FileStream_writeLine(makefile, tmp2);
|
||||
|
||||
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);
|
||||
|
||||
/* If you modify this, remember to modify makedata.mak too. */
|
||||
T_FileStream_writeLine(makefile, "\n"
|
||||
"# Windows specific DLL version information.\n"
|
||||
"!IF EXISTS(\"$(TEMP_DIR)\\icudata.res\")\n"
|
||||
"DATA_VER_INFO=\"$(TEMP_DIR)\\icudata.res\"\n"
|
||||
"!ELSE\n"
|
||||
"DATA_VER_INFO=\n"
|
||||
"!ENDIF\n\n");
|
||||
|
||||
|
||||
uprv_strcpy(tmp, UDATA_CMN_PREFIX "$(NAME)" UDATA_CMN_INTERMEDIATE_SUFFIX OBJ_SUFFIX);
|
||||
|
||||
sprintf(tmp2, "# intermediate obj file:\nCMNOBJTARGET=%s\n\n", tmp);
|
||||
T_FileStream_writeLine(makefile, tmp2);
|
||||
}
|
||||
else if (isStatic)
|
||||
{
|
||||
uprv_strcpy(tmp, LIB_PREFIX);
|
||||
uprv_strcat(tmp, o->libName);
|
||||
uprv_strcat(tmp, UDATA_LIB_SUFFIX);
|
||||
|
||||
if (!o->quiet) {
|
||||
pkg_sttc_writeReadme(o, tmp, status);
|
||||
}
|
||||
if(U_FAILURE(*status))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if(o->nooutput || o->verbose) {
|
||||
fprintf(stdout, "# Output %s file: %s%s%s\n", UDATA_SO_SUFFIX, o->targetDir, U_FILE_SEP_STRING, tmp);
|
||||
}
|
||||
|
||||
if(o->nooutput) {
|
||||
*status = U_ZERO_ERROR;
|
||||
return;
|
||||
}
|
||||
|
||||
sprintf(tmp2, "# LIB file to make:\nDLLTARGET=%s\n\n", tmp);
|
||||
T_FileStream_writeLine(makefile, tmp2);
|
||||
|
||||
sprintf(tmp2,
|
||||
"LINK32 = LIB.exe\n"
|
||||
"LINK32_FLAGS = /nologo /out:\"$(TARGETDIR)\\$(DLLTARGET)\"\n"
|
||||
);
|
||||
T_FileStream_writeLine(makefile, tmp2);
|
||||
|
||||
|
||||
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);
|
||||
|
||||
uprv_strcpy(tmp, UDATA_CMN_PREFIX "$(NAME)" UDATA_CMN_INTERMEDIATE_SUFFIX OBJ_SUFFIX);
|
||||
|
||||
sprintf(tmp2, "# intermediate obj file\nCMNOBJTARGET=%s\n\n", tmp);
|
||||
T_FileStream_writeLine(makefile, tmp2);
|
||||
}
|
||||
uprv_strcpy(tmp, UDATA_CMN_PREFIX);
|
||||
uprv_strcat(tmp, o->cShortName);
|
||||
if (o->version && !uprv_strstr(o->shortName,o->version)) {
|
||||
uprv_strcat(tmp, "$(TARGET_VERSION)");
|
||||
}
|
||||
uprv_strcat(tmp, UDATA_CMN_SUFFIX);
|
||||
|
||||
if(o->nooutput || o->verbose) {
|
||||
fprintf(stdout, "# Output file: %s%s%s\n", o->targetDir, U_FILE_SEP_STRING, tmp);
|
||||
}
|
||||
|
||||
if(o->nooutput) {
|
||||
*status = U_ZERO_ERROR;
|
||||
return;
|
||||
}
|
||||
|
||||
sprintf(tmp2, "# common file to make:\nCMNTARGET=%s\n\n", tmp);
|
||||
T_FileStream_writeLine(makefile, tmp2);
|
||||
|
||||
|
||||
if(isDll || isStatic) {
|
||||
sprintf(tmp, "all: \"$(TARGETDIR)\\$(DLLTARGET)\"\n\n");
|
||||
T_FileStream_writeLine(makefile, tmp);
|
||||
|
||||
sprintf(tmp, "\"$(TARGETDIR)\\$(DLLTARGET)\": \"$(TEMP_DIR)\\$(CMNOBJTARGET)\"\n"
|
||||
"\t$(LINK32) $(LINK32_FLAGS) \"$(TEMP_DIR)\\$(CMNOBJTARGET)\" $(DATA_VER_INFO)\n\n");
|
||||
T_FileStream_writeLine(makefile, tmp);
|
||||
sprintf(tmp, "\"$(TEMP_DIR)\\$(CMNOBJTARGET)\": \"$(TEMP_DIR)\\$(CMNTARGET)\"\n"
|
||||
"\t@\"$(GENCCODE)\" $(GENCOPTIONS) -e $(ENTRYPOINT) -o -d \"$(TEMP_DIR)\" \"$(TEMP_DIR)\\$(CMNTARGET)\"\n\n");
|
||||
T_FileStream_writeLine(makefile, tmp);
|
||||
|
||||
sprintf(tmp2,
|
||||
"clean:\n"
|
||||
"\t-@erase \"$(TARGETDIR)\\$(DLLTARGET)\"\n"
|
||||
"\t-@erase \"$(TEMP_DIR)\\$(CMNOBJTARGET)\"\n"
|
||||
"\t-@erase \"$(TEMP_DIR)\\$(CMNTARGET)\"\n\n");
|
||||
T_FileStream_writeLine(makefile, tmp2);
|
||||
|
||||
T_FileStream_writeLine(makefile, "install: \"$(TARGETDIR)\\$(DLLTARGET)\"\n"
|
||||
"\tcopy \"$(TARGETDIR)\\$(DLLTARGET)\" \"$(INSTALLTO)\\$(DLLTARGET)\"\n\n");
|
||||
/* Write compile rules */
|
||||
writeCmnRules(o, "TEMP_DIR", makefile);
|
||||
} else { /* common */
|
||||
sprintf(tmp, "all: \"$(TARGETDIR)\\$(CMNTARGET)\"\n\n");
|
||||
T_FileStream_writeLine(makefile, tmp);
|
||||
|
||||
sprintf(tmp2,
|
||||
"clean:\n"
|
||||
"\t-@erase \"$(TARGETDIR)\\$(CMNTARGET)\"\n\n");
|
||||
T_FileStream_writeLine(makefile, tmp2);
|
||||
|
||||
T_FileStream_writeLine(makefile, "install: \"$(TARGETDIR)\\$(CMNTARGET)\"\n"
|
||||
"\tcopy \"$(TARGETDIR)\\$(CMNTARGET)\" \"$(INSTALLTO)\\$(CMNTARGET)\"\n\n");
|
||||
|
||||
/* Write compile rules */
|
||||
writeCmnRules(o, "TARGETDIR", makefile);
|
||||
}
|
||||
|
||||
T_FileStream_writeLine(makefile, "rebuild: clean all\n\n");
|
||||
|
||||
}
|
||||
|
||||
#endif
|
Loading…
Add table
Reference in a new issue