ICU-1596 Added support for the -V option to version libraries.

Added alternate names for common and dll (respectively archive and library)
so that people can use the same names with configure and pkgdata.

X-SVN-Rev: 7365
This commit is contained in:
Yves Arrouye 2001-12-21 20:09:18 +00:00
parent c99b118274
commit d8facfd734
9 changed files with 101 additions and 32 deletions

View File

@ -19,8 +19,10 @@ CPPFLAGS=@CPPFLAGS@ -I$(top_builddir)/common -I$(top_srcdir)/common
CXXFLAGS=@CXXFLAGS@
FFLAGS=@FFLAGS@
DEFS=@DEFS@
# We're not linking anything with ICU libs
#LDFLAGS=@LDFLAGS@ -L$(prefix)/lib $(LD_RPATH)$(LD_RPATH_PRE)$(libdir)
ENABLE_RPATH=@ENABLE_RPATH@
ifeq ($(ENABLE_RPATH),YES)
RPATH_LDFLAGS=$(LD_RPATH)$(LD_RPATH_PRE)$(libdir)
endif
LIBS=@LIBS@
ICULIBS=$(LIBS) -licu-uc -licu-i18n
exec_prefix=@exec_prefix@

View File

@ -19,8 +19,10 @@ CPPFLAGS=@CPPFLAGS@ -I$(top_builddir)/common -I$(top_srcdir)/common
CXXFLAGS=@CXXFLAGS@
FFLAGS=@FFLAGS@
DEFS=@DEFS@
# We're not linking anything with ICU libs
#LDFLAGS=@LDFLAGS@ -L$(prefix)/lib $(LD_RPATH)$(LD_RPATH_PRE)$(libdir)
ENABLE_RPATH=@ENABLE_RPATH@
ifeq ($(ENABLE_RPATH),YES)
RPATH_LDFLAGS=$(LD_RPATH)$(LD_RPATH_PRE)$(libdir)
endif
LIBS=@LIBS@
ICULIBS=$(LIBS) -licu-uc -licu-i18n
exec_prefix=@exec_prefix@

View File

@ -76,7 +76,7 @@ void pkg_mode_common(UPKGOptions *o, FileStream *makefile, UErrorCode *status)
T_FileStream_writeLine(makefile, tmp);
T_FileStream_writeLine(makefile, "$(TARGET): $(CMNLIST) $(DATAFILEPATHS)\n"
"\t$(INVOKE) $(GENCMN) -n $(NAME) -c -d $(TARGETDIR) 10000000 $(CMNLIST)\n\n");
"\t$(INVOKE) $(GENCMN) -n $(NAME) -c -d $(TARGETDIR) 0 $(CMNLIST)\n\n");
if(o->hadStdin == FALSE) { /* shortcut */
T_FileStream_writeLine(makefile, "$(CMNLIST): $(LISTFILES)\n"

View File

@ -123,10 +123,45 @@ void pkg_mode_dll(UPKGOptions *o, FileStream *makefile, UErrorCode *status)
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)\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;
sprintf(tmp, "all: $(TARGETDIR)/$(TARGET) $(BATCH_TARGET)\n\n");
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");
}
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);
/* Write compile rules */
@ -178,8 +213,8 @@ void pkg_mode_dll(UPKGOptions *o, FileStream *makefile, UErrorCode *status)
T_FileStream_writeLine(makefile,"build-objs: $(SOURCES) $(OBJECTS)\n\n$(OBJECTS): $(SOURCES)\n\n");
#ifdef HPUX
T_FileStream_writeLine(makefile, "$(TARGETDIR)/$(TARGET): $(OBJECTS) $(HPUX_JUNK_OBJ) $(LISTFILES) $(BIR_DEPS)\n"
"\t$(SHLIB.cc) -o $@ $(OBJECTS) $(HPUX_JUNK_OBJ) $(BIR_LDFLAGS)\n"
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"
@ -192,21 +227,25 @@ void pkg_mode_dll(UPKGOptions *o, FileStream *makefile, UErrorCode *status)
/*390port*/
#ifdef OS390BATCH
T_FileStream_writeLine(makefile, "$(BATCH_TARGET): $(OBJECTS) $(LISTFILES) $(BIR_DEPS)\n"
"\t$(SHLIB.c) -o $@ $(OBJECTS) $(BIR_LDFLAGS)\n"
T_FileStream_writeLine(makefile, "$(BATCH_TARGET): $(OBJECTS) $(LISTFILES) $(DLL_DEPS)\n"
"\t$(SHLIB.c) -o $@ $(OBJECTS) $(DLL_LDFLAGS)\n"
"# \t-ls -l $@\n\n");
#endif
T_FileStream_writeLine(makefile, "$(TARGETDIR)/$(TARGET): $(OBJECTS) $(LISTFILES) $(BIR_DEPS)\n"
"\t$(SHLIB.c) -o $@ $(OBJECTS) $(BIR_LDFLAGS)\n"
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
T_FileStream_writeLine(makefile, "CLEANFILES= $(OBJECTS) $(HPUX_JUNK_OBJ) $(TARGETDIR)/$(TARGET)\n\nclean:\n\t-$(RMV) $(CLEANFILES) $(MAKEFILE)");
T_FileStream_writeLine(makefile, "CLEANFILES= $(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)/$(TARGET)\n"
"\t$(INSTALL-L) $(TARGETDIR)/$(TARGET) $(INSTALLTO)/$(TARGET)\n\n");
T_FileStream_writeLine(makefile, "install: $(TARGETDIR)/$(FINAL_SO_TARGET)\n"
"\t$(INSTALL-L) $(TARGETDIR)/$(FINAL_SO_TARGET) $(INSTALLTO)/$(FINAL_SO_TARGET)\n");
if (o->version) {
T_FileStream_writeLine(makefile, "\tcd $(INSTALLTO) && $(RM) $(MIDDLE_SO_TARGET) && ln -s $(FINAL_SO_TARGET) $(MIDDLE_SO_TARGET)\n\tcd $(INSTALLTO) && $(RM) $(SO_TARGET) && ln -s $(FINAL_SO_TARGET) $(SO_TARGET)\n");
}
T_FileStream_writeLine(makefile, "\n");
#ifdef U_SOLARIS
T_FileStream_writeLine(makefile, "$(NAME).map:\n\techo \"{global: $(TOCSYM); local: *; };\" > $@\n\n");

View File

@ -154,9 +154,9 @@ void pkg_mode_files(UPKGOptions *o, FileStream *makefile, UErrorCode *status)
}
sprintf(tmp, "install: \n"
"\techo Installing to $(INSTALLTO) - be patient\n"
"\t@for file in $(DATAFILEPATHS) ; do \\\n"
"\t\t$(INSTALL_DATA) $$file $$INSTALLTO; \\\n"
"\t\techo $(INSTALL_DATA) $$file $$INSTALLTO; \\\n"
"\t\t$(INSTALL_DATA) $$file $$INSTALLTO; \\\n"
"\tdone;\n\n");

View File

@ -19,8 +19,10 @@ CPPFLAGS=@CPPFLAGS@ -I$(top_builddir)/common -I$(top_srcdir)/common
CXXFLAGS=@CXXFLAGS@
FFLAGS=@FFLAGS@
DEFS=@DEFS@
# We're not linking anything with ICU libs
#LDFLAGS=@LDFLAGS@ -L$(prefix)/lib $(LD_RPATH)$(LD_RPATH_PRE)$(libdir)
ENABLE_RPATH=@ENABLE_RPATH@
ifeq ($(ENABLE_RPATH),YES)
RPATH_LDFLAGS=$(LD_RPATH)$(LD_RPATH_PRE)$(libdir)
endif
LIBS=@LIBS@
ICULIBS=$(LIBS) -licu-uc -licu-i18n
exec_prefix=@exec_prefix@

View File

@ -75,7 +75,9 @@ different purposes.
The default packaging
.I mode
is
.IR common .
.BR common ,
or
.BR archive .
In this mode, the different data files are bundled together as an
architecture-dependent file that can later be memory mapped for use by
ICU. Data packaged using this mode will be looked up under the ICU
@ -84,7 +86,9 @@ bundles, for example, as long as the application can install the
packaged file in the ICU data directory.
.PP
Another packaging mode is the
.I dll
.BR dll ,
or
.BR library ,
mode, where the data files are compiled into a shared library. ICU
used to be able to dynamically load these shared libraries, but as of
ICU 2.0, such support has been removed. This mode is still useful for
@ -98,8 +102,8 @@ the ICU data directory.
Finally,
.B pkgdata
supports a
.I files
mode which simply moves the data files around instead of packaging
.B files
mode which simply copies the data files instead of packaging
them as a single file or library. This mode is mainly intended to
provide support for building ICU before it is packaged as separate
small packages for distribution with operating systems such as Debian
@ -129,7 +133,15 @@ to be used by
.BR pkgdata .
The different modes and their meaning are explained in the
.B DESCRIPTION
section above.
section above. The valid mode names are
.BR common
(or
.BR archive ),
.BR dll
(or
.BR library ),
and
.BR files .
.TP
.BI "\-O\fP, \fB\-\-bldopt" " options"
Specify options for the builder. The builder is used internally by
@ -174,7 +186,7 @@ Clean temporary files and other build residues.
.TP
.BI "\-I\fP, \fB\-\-install"
Install the packaged file (or all the files in the
.I files
.B files
mode). If the variable
.B DESTDIR
is set it will be used for installation.

View File

@ -38,20 +38,20 @@ static void loadLists(UPKGOptions *o, UErrorCode *status);
/* This sets the modes that are available */
static struct
{
const char *name;
const char *name, *alt_name;
UPKGMODE *fcn;
const char *desc;
} modes[] =
{
{ "files", pkg_mode_files, "Uses raw data files (no effect). Installation copies all files to the target location." },
{ "files", 0, pkg_mode_files, "Uses raw data files (no effect). Installation copies all files to the target location." },
#ifdef WIN32
{ "dll", pkg_mode_windows, "Generates one common data file and one shared library, <package>.dll"},
{ "common", pkg_mode_windows, "Generates just the common file, <package>.dat"}
{ "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"}
#else /*#ifdef WIN32*/
#ifdef UDATA_SO_SUFFIX
{ "dll", pkg_mode_dll, "Generates one shared library, <package>" UDATA_SO_SUFFIX },
{ "dll", "library", pkg_mode_dll, "Generates one shared library, <package>" UDATA_SO_SUFFIX },
#endif
{ "common", pkg_mode_common, "Generates one common data file, <package>.dat" }
{ "common", "archive", pkg_mode_common, "Generates one common data file, <package>.dat" }
#endif /*#ifdef WIN32*/
};
@ -166,7 +166,13 @@ main(int argc, char* argv[]) {
fprintf(stderr, "modes: (-m option)\n");
for(i=0;i<(sizeof(modes)/sizeof(modes[0]));i++) {
fprintf(stderr, " %-10s %s\n", modes[i].name, modes[i].desc);
fprintf(stderr, " %-10s ", modes[i].name);
if (modes[i].alt_name) {
fprintf(stderr, "(or %-10s)", modes[i].alt_name);
} else {
fprintf(stderr, " ");
}
fprintf(stderr, "%s\n", modes[i].name, modes[i].desc);
}
return 1;
}
@ -175,6 +181,7 @@ main(int argc, char* argv[]) {
uprv_memset(&o, 0, sizeof(o));
o.mode = options[2].value;
o.version = options[16].doesOccur ? options[16].value : 0;
o.fcn = NULL;
@ -182,6 +189,10 @@ main(int argc, char* argv[]) {
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;
}
}

View File

@ -98,6 +98,7 @@ typedef struct UPKGOptions_
const char *srcDir;
const char *options; /* Options arg */
const char *mode; /* Mode of building */
const char *version; /* Library version */
const char *comment; /* comment string */
const char *makeFile; /* Makefile path */
const char *install; /* Where to install to (NULL = don't install) */