summaryrefslogtreecommitdiff
path: root/os2/README.OS2
blob: e3934b85b65d65710455fd3e28db2ba5c96c8f54 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161

Welcome!
========

This is the OS/2 port of GNU gettext 0.10.40 and possibly later versions.


Compatibility
=============

The library has been compiled with -Zmt flag, but it doesn't matter as soon
as you use the EMX single-threaded runtime fix (emx-strt-fix-0.0.2.zip).

The library is fully compatible with the previous port of gettext library
which is largely used especialy by XFree86 programs. All the old programs
that I have with gettext support run fine with the new version of the DLL.


Installation
============

If you set the GNULOCALEDIR environment variable to point to your
x:/xxx/share/locale directory, it will override any other setting. That is,
unpack the binary distribution over /emx, set GNULOCALEDIR=x:/emx/share/locale
(where x: is the drive letter of your EMX installation) and that's all.

If you use the UNIXROOT environment variable, the default catalogue search
paths will be like on Unices, e.g. $(UNIXROOT)/usr/lib and
$(UNIXROOT)/usr/share/locale. GNULOCALEDIR always overrides this.

Also this port supports character set conversions. This means that if your
.mo files were written using new gettext guidelines, e.g. they contain a
message like this:

msgid ""
msgstr "Content-Type: text/plain; charset=koi8-r\n"

the messages will be properly converted to your active codepage using OS/2
Unicode API. For example, russian message catalog gettext.mo is in the
KOI8-R (codepage 878) encoding while OS/2 uses codepage 866. Now when you
run any of these tools it detects that the active OS/2 codepage is 866 and
performs the translation from CP878 -> CP866 for every message.

If you want to override the character set used to output messages (for example
in XFree86 for Russian the KOI8-R encoding (codepage 878) is used) you can
set the OUTPUT_CHARSET environment variable like this:

set OUTPUT_CHARSET=KOI8-R

or (equivalent):

set OUTPUT_CHARSET=CP878

or (same effect):

set OUTPUT_CHARSET=IBM-878

Note that you don't need to set the OUTPUT_CHARSET initially; you may want to
set it just if you want to override the OS/2 active codepage (for example,
you can put it into your XFree86 startup script).


XFree86 setup
=============

If you use XFree86 and the OS/2 default character set is different from the
XFree86 default character set (e.g. for Russain CP866 vs KOI8-R), you can add
the following (or similar) statement to your startx.cmd file (after the
commands dealing with HOME and X11SHELL):

call VALUE 'OUTPUT_CHARSET', 'KOI8-R', env

Otherwise you can get incorrect (wrong codepage) output from programs that
previously worked (e.g. GIMP 1.22). This is because earlier versions of gettext
didn't support character set translations.


Implementation remarks
======================

The codepage conversion code uses OS/2 Unicode API, thus it falls under the
limits that OS/2 Unicode API has. For example, OS/2 Unicode API does not
support the BIG5 Chinese character set nor ISO-8859-X where X > 9 (at least
with Warp4 with fixpack 14 that I have). Also libintl relies on a feature of
the GNU iconv which works differently in OS/2 Unicode API (well, someone may
call it even a bug in OS/2 API); as a results it is impossible to msgfmt any
.po files written in the UTF-8 character set; if someone is interested I can
explain the bug more detailed.


Additional API
==============

This package provides additionaly the iconv() API that can be used by
developers for doing more feature-full Unix ports. The iconv() API is used
to convert text between various codepages. The intl.h header file contains
the prototypes and definitions needed for iconv(); if you configure software
with autoconf it possibly will find intl.h and set up the software accordingly.

Also it provides an limited implementation of the nl_langinfo function which
is used for querying the active system codepage. Other software may find it
useful as well.

All these functions are exported from INTL.DLL, thus if you use either iconv
or nl_langinfo you should link with it (-lintl).


Rebuilding the library
======================

The library is quite easy to rebuild. First of all, get and install the
original source code package, as of today it is gettext-0.10.40. Now copy
the contents of the src/gettext-$(VERSION)/ directory on top of the source
tree, e.g. intl/os2compat.c goes into the respective intl/ directory of the
original source package. As of today the support/ directory is missing from
the gettext source tree, thus you should just copy it recursively into the
root directory of the source code.

Now apply the diff file, and resolve any conflicts (if you happen to compile
a newer version than the one the diff is supplied for).

Now if you're a masochist you can go the clumsy configure/make Unix way, but
it is highly recommended to use an alternate way: go to support/os2 and just
run `make'. If you have all the required tools, it should painlessly compile.
Now if you want a binary distribution archive, do `make distr'.

WARNING: Due to a bug in GNU Make 3.76.1 (at least in its OS/2 port) you will
have to do sometimes "make distr" twice to get a complete distribution archive;
if you see warnings from zip like these:

zip warning: name not matched: emx/src/gettext-0.10.40/support/os2/iconv.h
zip warning: name not matched: emx/src/gettext-0.10.40/support/os2/langinfo.h

it is best to interrupt zip and re-run make distr once more time. This happens
because make fails to execute two different rules that tells him to make two
different destination files from the same source file (e.g. iconv.h is copied
both to emx/src/gettext/support/os2 and to emx/include).

If you want a debug version of library, you can do `make install DEBUG=1'.

If you have no LxLite tool installed, do `make LXLITE=0'

NB: For best results, it is highly recommended that you use at least emxbind.exe
and ld.exe from gcc 3.0.2 or later, since they contain a number of fixes that
will help you generate a more optimal DLL.


Contributors
============

Hung-Chi Chu <hcchu@r350.ee.ntu.edu.tw>
	the original port of gettext (0.10.35)

Jun SAWATAISHI <jsawa@attglobal.net>
	some more work on it and submitted the patches to GNU team, although
	they were not completely integrated.

Andrew Zabolotny <zap@cobra.ru>
	Succeeded to remove almost all OS/2-specific #ifdef's from mainstream
	source code, wrote the dedicated OS/2 makefile, wrote the iconv wrapper
	around OS/2 Unicode API, added support for locale translations.