ICU-1568 use static mode for uconv by default

X-SVN-Rev: 7848
This commit is contained in:
Steven R. Loomis 2002-03-01 22:44:21 +00:00
parent df88d97213
commit c0fd3f923e
5 changed files with 53 additions and 9 deletions

2
.gitignore vendored
View File

@ -98,7 +98,9 @@ icu4c/source/extra/uconv/*.d
icu4c/source/extra/uconv/Debug
icu4c/source/extra/uconv/Makefile
icu4c/source/extra/uconv/Release
icu4c/source/extra/uconv/pkgdata.inc
icu4c/source/extra/uconv/uconv
icu4c/source/extra/uconv/uconv.1
icu4c/source/extra/uconv/uconvmsg
icu4c/source/extra/ustdio/*.d
icu4c/source/extra/ustdio/Debug

View File

@ -4,4 +4,5 @@ Debug
Release
Makefile
uconvmsg
uconv.1
pkgdata.inc

View File

@ -7,6 +7,10 @@
## Makefile.in for ICU - uconv
## Steven R. Loomis
## Set the following to 'YES' to statically link uconv's data.
UCONVMSG_STATIC=YES
##############################################################
srcdir=@srcdir@
top_srcdir=@top_srcdir@
@ -15,13 +19,15 @@ subdir = extra/uconv
include $(top_builddir)/icudefs.mk
MSGNAME=uconvmsg
## Platform-specific setup
include @platform_make_fragment@
# RESSRC comes from resfiles.mk
include $(srcdir)/resfiles.mk
RESDIR=uconvmsg
RESDIR=$(MSGNAME)
RESFILES=$(RESSRC:%.txt=$(RESDIR)/%.res)
##
@ -47,13 +53,20 @@ endif
LDFLAGS = @LDFLAGS@ $(RPATHLDFLAGS)
LIBS = $(LIBICUI18N) $(LIBICUUC) @LIBS@ @LIB_M@
ifeq ($(UCONVMSG_STATIC),YES)
LIBS += -L$(MSGNAME) -l$(MSGNAME)
CPPFLAGS += -DUCONVMSG_STATIC=$(MSGNAME) -I$(RESDIR)
UCONVMSG_LIB=$(RESDIR)/lib$(MSGNAME).a
UCONVMSG_HDR=$(RESDIR)/$(MSGNAME).h
endif
OBJECTS = uconv.o uwmsg.o
DEPS = $(OBJECTS:.o=.d)
## List of phony targets
.PHONY : all all-local install install-local clean clean-local \
distclean distclean-local dist dist-local check check-local resfiles package-resfiles install-resfiles install-man
distclean resclean distclean-local dist dist-local check check-local resfiles package-resfiles install-resfiles install-man
## Clear suffix list
.SUFFIXES :
@ -76,9 +89,11 @@ install-target: all-local
dist-local:
clean-local:
clean-local: resclean
test -z "$(CLEANFILES)" || $(RMV) $(CLEANFILES) $(RESFILES)
$(RMV) $(OBJECTS) $(TARGET)
resclean:
$(RMV) $(RESDIR)
distclean-local: clean-local
@ -94,13 +109,20 @@ pkgdata.inc: $(srcdir)/pkgdata.inc.in $(top_builddir)/config.status
cd $(top_builddir) \
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
$(TARGET) : $(OBJECTS)
$(LINK.cc) -o $@ $^ $(LIBS)
$(TARGET) : $(OBJECTS) $(UCONVMSG_LIB)
$(LINK.cc) -o $@ $^ $(LIBS) $(LDFLAGS)
resfiles: $(RESFILES) package-resfiles
ifeq ($(UCONVMSG_STATIC),YES)
$(UCONVMSG_HDR) $(UCONVMSG_LIB): resfiles
uconv.o: $(UCONVMSG_HDR)
endif
package-resfiles: $(RESDIR)/$(RESDIR).lst pkgdata.inc
$(INVOKE) $(top_builddir)/tools/pkgdata/pkgdata -p $(RESDIR) -O pkgdata.inc -m common -d uconvmsg -T $(RESDIR) $(RESDIR)/$(RESDIR).lst
$(INVOKE) $(top_builddir)/tools/pkgdata/pkgdata -p $(RESDIR) -O pkgdata.inc -m static -d $(RESDIR) -T $(RESDIR) $(RESDIR)/$(RESDIR).lst
$(RESDIR)/$(RESDIR).lst: Makefile pkgdata.inc $(srcdir)/resfiles.mk
@$(MKINSTALLDIRS) $(RESDIR)
@ -109,9 +131,11 @@ $(RESDIR)/$(RESDIR).lst: Makefile pkgdata.inc $(srcdir)/resfiles.mk
echo `pwd`/$$file >> $@; \
done;
ifneq ($(UCONVMSG_STATIC),YES)
install-resfiles: $(RESFILES)
$(MKINSTALLDIRS) $(DESTDIR)$(ICUDATA_DIR)
$(INVOKE) $(top_builddir)/tools/pkgdata/pkgdata -p $(RESDIR) -O pkgdata.inc -m common -d uconvmsg -I $(DESTDIR)$(ICUDATA_DIR) -T $(RESDIR) $(RESDIR)/$(RESDIR).lst
$(INVOKE) $(top_builddir)/tools/pkgdata/pkgdata -p $(RESDIR) -O pkgdata.inc -m static -d $(RESDIR) -I $(DESTDIR)$(ICUDATA_DIR) -T $(RESDIR) $(RESDIR)/$(RESDIR).lst
endif
$(RESDIR)/%.res: $(srcdir)/%.txt
@$(MKINSTALLDIRS) $(RESDIR)

View File

@ -44,6 +44,7 @@ PACKAGE=@PACKAGE@
VERSION=@VERSION@
CC=@CC@
CXX=@CXX@
RANLIB=@RANLIB@
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@

View File

@ -21,6 +21,7 @@
#include <string.h>
#include <stdlib.h>
#include <unicode/utypes.h>
#include <unicode/ucnv.h>
#include <unicode/unistr.h>
#include <unicode/translit.h>
@ -37,6 +38,10 @@
#include <fcntl.h>
#endif
#ifdef UCONVMSG_STATIC
# include "uconvmsg.h"
#endif
#define DEFAULT_BUFSZ 4096
static UResourceBundle *gBundle = 0; /* Bundle containing messages. */
@ -56,6 +61,17 @@ static void initMsg(const char *pname) {
ps = 1;
/* Set up our static data - if any */
#ifdef UCONVMSG_STATIC
udata_install_uconvmsg(&err);
if (U_FAILURE(err)) {
fprintf(stderr, "%s: warning, problem installing our static resource bundle data uconvmsg: %s - trying anyways.\n",
pname, u_errorName(err));
err = U_ZERO_ERROR; /* It may still fail */
}
#endif
/* Get messages. */
strcpy(dataPath, u_getDataDirectory());