summaryrefslogtreecommitdiffstats
path: root/os2
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2002-03-15 18:21:40 +0000
committerBruno Haible <bruno@clisp.org>2009-06-23 12:07:51 +0200
commit0382ac87360ebd393e2b887ebdae00d5556fbbad (patch)
tree49e79cba2949726df20a13149f19a187b1567e00 /os2
parent81edb4f06997af8928109cf38963d7ad59ec38d7 (diff)
downloadexternal_gettext-0382ac87360ebd393e2b887ebdae00d5556fbbad.zip
external_gettext-0382ac87360ebd393e2b887ebdae00d5556fbbad.tar.gz
external_gettext-0382ac87360ebd393e2b887ebdae00d5556fbbad.tar.bz2
Update from Andrew Zabolotny.
Diffstat (limited to 'os2')
-rw-r--r--os2/Makefile21
-rw-r--r--os2/README.OS24
-rw-r--r--os2/iconv/Makefile64
-rw-r--r--os2/iconv/iconv.c14
4 files changed, 94 insertions, 9 deletions
diff --git a/os2/Makefile b/os2/Makefile
index 09d78e5..cb31fb4 100644
--- a/os2/Makefile
+++ b/os2/Makefile
@@ -47,12 +47,14 @@ INST = emx/
# Tools
CC = gcc -c
CFLAGS = -Wall -Zmt $(INCLUDE) $(DEFS)
-INCLUDE = -I. -I$(ROOT) -I$(ROOT)intl -I$(ROOT)src -I$(ROOT)lib
+INCLUDE = -I. -I$(ROOT) -I$(ROOT)intl -I$(ROOT)src -I$(ROOT)lib -I$(ROOT)libuniname
DEFS = -DHAVE_CONFIG_H -DLIBDIR=\"/usr/lib\" \
-DLOCALEDIR=\"/usr/share/locale\" -DLOCALE_ALIAS_PATH=\"/usr/share/locale\" \
+ -DGETTEXTDATADIR=\"/usr/share/gettext\" \
-DPROJECTSDIR=\"/usr/share/gettext/projects\" \
-DGETTEXTJAR=\"/usr/share/gettext/gettext.jar\"
+
LD = gcc
LDFLAGS = -Zmt -Zcrtdll
LDFLAGS.SHARED = -Zmt -Zcrtdll -Zdll
@@ -113,7 +115,15 @@ LIB.SOURCES = $(addprefix $(ROOT)lib/, error.c stpcpy.c stpncpy.c mkdtemp.c getl
$(shell sed $(ROOT)lib/Makefile.am -ne "/^libgettextlib_la_SOURCES =/,/[^\]$$/p"))))))
LIB.OBJECTS = $(addprefix $(OUT),$(subst $(ROOT),,$(LIB.SOURCES:.c=.o)))
-OUTDIRS = $(OUT) $(sort $(dir $(INTL.OBJECTS) $(SRC.OBJECTS) $(LIB.OBJECTS) $(INSTALL.FILES)))
+LIBUNINAME.SOURCES = $(addprefix $(ROOT)libuniname/, \
+ $(subst libuniname_a_SOURCES = ,,\
+ $(subst \,,\
+ $(patsubst %.h,,\
+ $(shell sed $(ROOT)libuniname/Makefile.am -ne "/^libuniname_a_SOURCES =/,/^$$/p")))))
+LIBUNINAME.OBJECTS = $(addprefix $(OUT),$(subst $(ROOT),,$(LIBUNINAME.SOURCES:.c=.o)))
+
+OUTDIRS = $(OUT) $(sort $(dir $(INTL.OBJECTS) $(SRC.OBJECTS) $(LIB.OBJECTS) \
+ $(LIBUNINAME.OBJECTS) $(INSTALL.FILES)))
INSTALL.FILES = $(addprefix $(INST)bin/,$(PROGRAMS)) \
$(INST)lib/intl.a $(INST)lib/intl_s.a $(INST)include/libintl.h \
@@ -136,7 +146,7 @@ $(OUT)%.o: $(ROOT)%.c
# instead a library containing all the object files from src directory, and
# then link the library against the main program module, so that linker can
# pull all the required functions from there
-$(OUT)%.exe: $(OUT)src/%.o $(OUT)util.a $(LINKINTL)
+$(OUT)%.exe: $(OUT)src/%.o $(OUT)util.a $(OUT)uniname.a $(LINKINTL)
$(LD) $(LDFLAGS) -o $@ $^ $(LIBS)
ifeq ($(LXLITE),1)
lxlite /b- $@
@@ -182,7 +192,7 @@ $(OUT)intl.def: $(INTL.OBJECTS)
@echo DATA MULTIPLE NONSHARED>>$@
@echo EXPORTS>>$@
type backward.def>>$@
- emxexp $^ >>$@
+ emxexp -u $^ >>$@
$(OUT)intl$(INTLDLLVER).dll: $(INTL.OBJECTS) $(OUT)intl.def
@echo *********************************************************
@@ -200,6 +210,9 @@ $(OUT)%.a: $(OUT)%.def
$(OUT)util.a: $(SRC.OBJECTS) $(LIB.OBJECTS)
$(AR) $(ARFLAGS) $@ $^
+$(OUT)uniname.a: $(LIBUNINAME.OBJECTS)
+ $(AR) $(ARFLAGS) $@ $^
+
$(ROOT)src/po-gram-gen2.h: $(ROOT)src/po-gram-gen.h
sed -e "s/[yY][yY]/po_gram_/g" $< > $@
diff --git a/os2/README.OS2 b/os2/README.OS2
index 2ba274b..80487e4 100644
--- a/os2/README.OS2
+++ b/os2/README.OS2
@@ -102,6 +102,10 @@ listed in the \language\codepage\ucstbl.lst file but the codepage files
themselves are missing; I believe they are ommited from European OS/2's
due to their large size.
+Also I have added "support" for the BIG5 codeset as an alias for IBM-950
+codepage. However, I'm not very sure about this; in any case OS/2 does not
+support (as far as I know) anything closer to BIG5.
+
Additional API
==============
diff --git a/os2/iconv/Makefile b/os2/iconv/Makefile
new file mode 100644
index 0000000..268932e
--- /dev/null
+++ b/os2/iconv/Makefile
@@ -0,0 +1,64 @@
+#
+# OS/2 GNU Makefile for building libiconv with GNU Make and GNU C compiler
+#
+# This makefile will build iconv.dll, iconv.a (the import library for ICONV.DLL)
+# and iconv_s.a (static library).
+#
+# You will need the Unicode API add-on for EMX, which is included with latest
+# distributions of gcc for OS/2 (gcc 3.0 and later).
+#
+
+# Use CMD.EXE as shell since its way faster
+SHELL = $(COMSPEC)
+
+# Pack the DLL and executables with lxlite
+LXLITE = 1
+
+# Tools
+CC = gcc -c
+CFLAGS = -s -O2 -Wall -Zmt $(INCLUDE) $(DEFS)
+INCLUDE = -I.
+
+LD = gcc
+LDFLAGS.SHARED = -s -Zmt -Zcrtdll -Zdll
+LIBS = -lgcc
+
+AR = ar
+ARFLAGS = crs
+
+.SUFFIXES:
+.SUFFIXES: .o .a .def .dll
+
+.PHONY: all clean
+
+ICONV.VERSION = 0.0.1
+ICONV.OBJECTS = iconv.o
+
+# How to compile a .c file
+$(OUT)%.o: %.c
+ $(CC) $(CFLAGS) -o $@ $<
+
+# How to build an import library from a .DEF file
+$(OUT)%.a: $(OUT)%.def
+ emximp -o $@ $<
+
+all: iconv.dll iconv.a iconv_s.a
+
+clean:
+ rm -rf *.o iconv.dll iconv*.a iconv.def
+
+iconv_s.a: $(ICONV.OBJECTS)
+ $(AR) $(ARFLAGS) $@ $^
+
+$(OUT)iconv.def: $(ICONV.OBJECTS)
+ @echo LIBRARY ICONV INITINSTANCE TERMINSTANCE>$@
+ @echo DESCRIPTION "iconv API library version $(ICONV.VERSION)">>$@
+ @echo DATA MULTIPLE NONSHARED>>$@
+ @echo EXPORTS>>$@
+ emxexp $^ >>$@
+
+$(OUT)iconv.dll: $(ICONV.OBJECTS) $(OUT)iconv.def
+ $(LD) $(LDFLAGS.SHARED) -o $@ $^ $(LIBS)
+ifeq ($(LXLITE),1)
+ lxlite $@
+endif
diff --git a/os2/iconv/iconv.c b/os2/iconv/iconv.c
index f26ab45..0ca50f3 100644
--- a/os2/iconv/iconv.c
+++ b/os2/iconv/iconv.c
@@ -32,6 +32,8 @@ typedef struct _iconv_t
#define _ICONV_T
#include "iconv.h"
+#include <string.h>
+#include <malloc.h>
#include <errno.h>
#include <alloca.h>
@@ -41,14 +43,16 @@ cp_convert (const char *cp, UniChar *ucp)
{
size_t sl = 0;
- if (!strcasecmp (cp, "EUC-JP"))
+ if (!stricmp (cp, "EUC-JP"))
memcpy (ucp, L"IBM-954", 8*2);
- else if (!strcasecmp (cp, "EUC-KR"))
+ else if (!stricmp (cp, "EUC-KR"))
memcpy (ucp, L"IBM-970", 8*2);
- else if (!strcasecmp (cp, "EUC-TW"))
+ else if (!stricmp (cp, "EUC-TW"))
memcpy (ucp, L"IBM-964", 8*2);
- else if (!strcasecmp (cp, "EUC-CN"))
+ else if (!stricmp (cp, "EUC-CN"))
memcpy (ucp, L"IBM-1383", 9*2);
+ else if (!stricmp (cp, "BIG5"))
+ memcpy (ucp, L"IBM-950", 8*2);
else
{
/* Transform CPXXX naming style to IBM-XXX style */
@@ -129,7 +133,7 @@ iconv (iconv_t conv,
goto error;
sl = ucs - orig_ucs;
ucs = orig_ucs;
- /* UniUconvFromUcs will stop at first NULL byte
+ /* UniUconvFromUcs will stop at first nul byte (huh? indeed?)
while we want ALL the bytes converted. */
#if 1
rc = UniUconvFromUcs (conv->to, &ucs, &sl, (void **)out, out_left, &nonid);