• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

gettext_xs/H26-Oct-2020-547409

lib/Locale/H26-Oct-2020-150,662107,273

sample/H26-Oct-2020-2,3801,792

tests/H26-Oct-2020-60,38653,232

COPYINGH A D08-Oct-201834.3 KiB675553

ChangesH A D26-Oct-20206.3 KiB246146

CreditsH A D08-Oct-20181.3 KiB3627

FAQH A D08-Oct-2018304 65

MANIFESTH A D26-Oct-202010.9 KiB399398

MANIFEST.SKIPH A D08-Oct-2018476 3635

META.jsonH A D26-Oct-20201.3 KiB5655

META.ymlH A D26-Oct-2020821 3130

Makefile.PLH A D08-Oct-20188.1 KiB277169

MyInstall.pmH A D08-Oct-20181,013 4431

NEWSH A D26-Oct-20206.3 KiB246146

READMEH A D08-Oct-20189.5 KiB250190

README-oldversionsH A D08-Oct-2018179 116

README.mdH A D08-Oct-20189.5 KiB250190

README.solarisH A D08-Oct-20186.3 KiB126107

README.win32H A D08-Oct-20184.1 KiB11181

REFERENCESH A D08-Oct-20181.7 KiB6141

SIGNATUREH A D26-Oct-202038.7 KiB421414

THANKSH A D08-Oct-20181.3 KiB3627

TODOH A D08-Oct-2018887 2315

test.plH A D19-Nov-20184.5 KiB152101

README

1README for libintl-perl
2=======================
3
4The package libintl-perl is an internationalization library for Perl
5that aims to be compatible with the Uniforum message translations
6system as implemented for example in GNU gettext.
7
8See the file COPYING and the source code for licensing.
9
10Requirements
11------------
12
13The library is entirely written in Perl.  It should run on every
14system with a Perl5 interpreter.  The minimum required Perl version
15should be 5.004.
16
17The behavior of the package varies a little depending on the Perl
18version:
19
20- Perl 5.8 or better
21
22Recommended.  Perl 5.8 offers maximum performance and support for
23various multi-byte encodings (even more if Encode::Han is installed).
24Additionally the output charset is chosen automatically according to
25the information provided by I18N::Langinfo.  In fact, I18N::Langinfo
26is already available for Perl 5.7 but this developer version is
27probably not much in use any more.
28
29- Perl 5.6 or better
30
31Still offers high-performance UTF-8 handling but no support for other
32multi-byte encodings unless the package Encode is installed.
33
34- Earlier Perl versions
35
36Full UTF-8 support but quiet slow since all conversion routines are
37written in Perl.  More exactly: Encoding from 8 bit charsets into
38UTF-8 is reasonably fast and usable.  Decoding UTF-8 is slow, however.
39
40Note that these are actually the requirements for the *users* of your
41software internationalized with libintl-perl.
42
43As a maintainer of a Perl package that uses libintl-perl, you will
44also need a recent version of GNU gettext (see the file README in the
45subdirectory "sample/" of the source distribution of libintl-perl).
46Translators of your software can basically do their job with any text
47editor, but it usually makes sense for them, too, to have GNU gettext
48installed.  End users of your software, or people that install an
49internationalized Perl package do *not* need it, unless they want to
50add a new language to your software.
51
52Installation
53------------
54
55If libintl-perl is not installed on your system, you have to build it
56from the sources, which is a lot easier than you may think.  You need
57the program "make" for that and a command line shell.  No C compiler is
58required.
59
60Unpack the package in a directory of your choice, cd into that
61directory and then type
62
63     perl Makefile.PL
64     make
65
66This will build the package.  You can then run the tests with
67
68     make test
69
70To install the package, type
71
72     make install
73
74You will probably need root permissions to do that.
75
76Of course, you can also use the CPAN module to install the package.
77
78Feedback
79--------
80
81Send negative (and positive!) feedback to me.  Bug reports can be send
82directly to me or you can use the
83[RT bugtracking system](http://rt.cpan.org/ "Link to RT").
84
85If you use libintl-perl for your project, private or public, free or
86commercial, please let me know.  I am interested in such information.
87
88If you really like (or dislike?) libintl-perl, tell the world about.
89You can star it on [github](http://github.com/gflohr/libintl-perl).  You
90can rate it and even write a review at
91[cpanratings](http://cpanratings.perl.org/)
92(search for "libintl-perl").
93
94Design Goals
95------------
96
97The primary design goal of libintl-perl is maximum compatibility with
98the gettext functions available for other programming languages.  It
99is intended that programmers, translators, and end users can fully
100benefit from all existing i18n tools like xgettext for message
101extraction, msgfmt, msgmerge, etc. for catalog manipulation, Emacs PO
102mode (or KBabel, PO-Edit, ...) for catalog editing and so on.
103
104Another design goal is maximum portability.  The library should be
105functional without any additional software but with a wide range of
106Perl versions.  Wherever possible, hooks have been inserted to benefit
107from advanced features in the runtime environment, but the basic
108functionality should be present everywhere.
109
110Overview
111--------
112
113The core of the library is the module Locale::gettext_pp.  It is a
114pure Perl re-implementation of the module Locale::gettext available on
115CPAN.  However, the XS version Locale::gettext lacks some functions
116(notably plural handling and output conversion) that are already
117present in Locale::gettext_pp.  Locale::gettext_pp provides the
118internationalization functions that are available in your system
119library (libc) or additional C libraries (for example libintl in the
120case of GNU gettext).
121
122The class Locale::Messages is an additional abstraction layer that is
123prepared for dynamic switching between different gettext implementations (for
124example Locale::gettext_pp and Locale::gettext).  It provides
125basically the same interface as Locale::gettext_pp but in an
126implementation-independent manner.
127
128The module Locale::TextDomain is the only module that you should
129actually use in your software.  It represents the message translation
130system for a particular text domain (a text domain is a unique
131identifier for your software package), makes use of Locale::Messages
132for message translation and catalog location, and it provides
133additional utility functions, for example common shortcut names for
134i18n routines, tied hashes for hash-like lookups into the translation
135database, and finally an interpolation mechanism suitable for
136internationalized messages.
137
138The package also contains a charset conversion library
139Locale::Recode.  This library is used internally by Locale::gettext_pp
140to allow on-the-fly charset conversion between the charset in a
141message catalog and the preferred (end) user charset.  Its main
142advantage about the Encode package available for recent Perl versions
143is its portability, since it does not require the Unicode capabilities
144of Perl that were introduced with Perl 5.6.  It fully supports UTF-8
145with every Perl version and a wealth of common 8 bit encodings.  If
146you have to do charset conversion with older Perl versions, then
147Locale::Recode may be worth a try although it is really only a helper
148library, not intended as a competitor to Encode.
149
150Documentation
151-------------
152
153For a basic understanding of message translation in Perl with
154libintl-perl you should read the perldoc of Locale::TextDomain.  Don't
155bother about the documentation of the other modules in the library,
156you will not need it unless you want to hack the library yourself.
157
158In order to make use of the software, you will also need various tools
159from GNU gettext [savannah](http://savannah.gnu.org/projects/gettext/). The documentation is located at [www.gnu.org](http://www.gnu.org/manual/gettext/).
160You will find there a language-independent overview of
161internationalization with GNU gettext, and in the Perl-specific
162sections you will find details about the parser that extracts
163translatable messages from your Perl sources.
164
165Quick-Start
166-----------
167
168The subdirectory "sample" of the source distribution of libintl-perl
169contains a full-fledged example for an internationalized Perl package,
170including a working Makefile.  The README of that subdirectory
171explains all necessary steps.
172
173However, if you are on a recent GNU/Linux system or similar (cygwin
174should also do), chances are that you can get the following example to
175run:
176
177	#! /usr/local/bin/perl -w
178
179	use strict;
180
181	# This assumes that the textdomain 'libc' is available on your
182	# system.  Try "locate libc.mo" or "locate libc.gmo" (or
183	# "find / -type f -name libc.mo" if locate is not available on
184	# your system).
185	#
186	# By the way, the "use Locale::TextDomain (TEXTDOMAIN) is the
187	# equivalent of
188	#
189	#      textdomain ("TEXTDOMAIN");
190	#
191	# in C or similar languages.
192	use Locale::TextDomain ('libc');
193
194	# The locale category LC_MESSAGES is not exported by the POSIX
195	# module on older Perl versions.
196	use Locale::Messages qw (LC_MESSAGES);
197
198	use POSIX ('setlocale');
199
200	# Set the locale according to our environment.
201	setlocale (LC_MESSAGES, '');
202
203	# This makes the assumption that your system libc defines a
204	# message "No such file or directory".  Check the exact
205	# spelling on your system with something like
206	# "ls NON-EXISTANT".
207	# Note the double underscore in front of the string.  This is
208	# really a function call to the function __() that is
209	# automagically imported by Locale::TextDomain into your
210	# namespace.  This function takes its argument, looks up a
211	# translation for it, and returns that, or the unmodified
212	# string in case of failure.
213	print __"No such file or directory", ".\n";
214
215	__END__
216
217Now run the command "locale -a" or "nlsinfo" to get a list of
218available locales on your system.  Try the section "Finding locales"
219in "perldoc perllocale" if you have problems.
220
221If, for example, the locale "fr_FR" is available on your system, set
222the environment variable LANG to that value, for a POSIX shell
223
224     LANG=fr_FR
225     export LANG
226
227for the C shell
228
229     setenv LANG fr_FR
230
231and run your little Perl script.  It should tell you what the error
232message for "No such file or directory" is in French, or whatever
233language you chose.  Not a real example, because we have "stolen" a
234message from a system catalog.  But it should give you the general
235idea, especially if you are already familiar with gettext in C.
236
237If you still see the English message, this does not necessarily mean a
238failure, since the string is maybe not translated on your system (try
239"locate libc.mo" to get a list of available translations).  Even for
240the translations listed there, that particular message might be
241missing.  Try a common locale like "de_DE" or "fr_FR" that are usually
242fully translated then.
243
244Your next steps should be "perldoc Locale::TextDomain", and then study
245the example in the subdirectory "sample" of this distribution.
246
247Have fun with libintl-perl!
248
249Guido Flohr
250

README-oldversions

1Hi,
2
3old versions of my modules can be found here:
4
5	http://history.perl.org/backpan/authors/id/G/GU/GUIDO/
6
7This is an effort to keep CPAN and its mirrors clean.
8
9Regards,
10Guido
11

README.md

1README for libintl-perl
2=======================
3
4The package libintl-perl is an internationalization library for Perl
5that aims to be compatible with the Uniforum message translations
6system as implemented for example in GNU gettext.
7
8See the file COPYING and the source code for licensing.
9
10Requirements
11------------
12
13The library is entirely written in Perl.  It should run on every
14system with a Perl5 interpreter.  The minimum required Perl version
15should be 5.004.
16
17The behavior of the package varies a little depending on the Perl
18version:
19
20- Perl 5.8 or better
21
22Recommended.  Perl 5.8 offers maximum performance and support for
23various multi-byte encodings (even more if Encode::Han is installed).
24Additionally the output charset is chosen automatically according to
25the information provided by I18N::Langinfo.  In fact, I18N::Langinfo
26is already available for Perl 5.7 but this developer version is
27probably not much in use any more.
28
29- Perl 5.6 or better
30
31Still offers high-performance UTF-8 handling but no support for other
32multi-byte encodings unless the package Encode is installed.
33
34- Earlier Perl versions
35
36Full UTF-8 support but quiet slow since all conversion routines are
37written in Perl.  More exactly: Encoding from 8 bit charsets into
38UTF-8 is reasonably fast and usable.  Decoding UTF-8 is slow, however.
39
40Note that these are actually the requirements for the *users* of your
41software internationalized with libintl-perl.
42
43As a maintainer of a Perl package that uses libintl-perl, you will
44also need a recent version of GNU gettext (see the file README in the
45subdirectory "sample/" of the source distribution of libintl-perl).
46Translators of your software can basically do their job with any text
47editor, but it usually makes sense for them, too, to have GNU gettext
48installed.  End users of your software, or people that install an
49internationalized Perl package do *not* need it, unless they want to
50add a new language to your software.
51
52Installation
53------------
54
55If libintl-perl is not installed on your system, you have to build it
56from the sources, which is a lot easier than you may think.  You need
57the program "make" for that and a command line shell.  No C compiler is
58required.
59
60Unpack the package in a directory of your choice, cd into that
61directory and then type
62
63     perl Makefile.PL
64     make
65
66This will build the package.  You can then run the tests with
67
68     make test
69
70To install the package, type
71
72     make install
73
74You will probably need root permissions to do that.
75
76Of course, you can also use the CPAN module to install the package.
77
78Feedback
79--------
80
81Send negative (and positive!) feedback to me.  Bug reports can be send
82directly to me or you can use the
83[RT bugtracking system](http://rt.cpan.org/ "Link to RT").
84
85If you use libintl-perl for your project, private or public, free or
86commercial, please let me know.  I am interested in such information.
87
88If you really like (or dislike?) libintl-perl, tell the world about.
89You can star it on [github](http://github.com/gflohr/libintl-perl).  You
90can rate it and even write a review at
91[cpanratings](http://cpanratings.perl.org/)
92(search for "libintl-perl").
93
94Design Goals
95------------
96
97The primary design goal of libintl-perl is maximum compatibility with
98the gettext functions available for other programming languages.  It
99is intended that programmers, translators, and end users can fully
100benefit from all existing i18n tools like xgettext for message
101extraction, msgfmt, msgmerge, etc. for catalog manipulation, Emacs PO
102mode (or KBabel, PO-Edit, ...) for catalog editing and so on.
103
104Another design goal is maximum portability.  The library should be
105functional without any additional software but with a wide range of
106Perl versions.  Wherever possible, hooks have been inserted to benefit
107from advanced features in the runtime environment, but the basic
108functionality should be present everywhere.
109
110Overview
111--------
112
113The core of the library is the module Locale::gettext_pp.  It is a
114pure Perl re-implementation of the module Locale::gettext available on
115CPAN.  However, the XS version Locale::gettext lacks some functions
116(notably plural handling and output conversion) that are already
117present in Locale::gettext_pp.  Locale::gettext_pp provides the
118internationalization functions that are available in your system
119library (libc) or additional C libraries (for example libintl in the
120case of GNU gettext).
121
122The class Locale::Messages is an additional abstraction layer that is
123prepared for dynamic switching between different gettext implementations (for
124example Locale::gettext_pp and Locale::gettext).  It provides
125basically the same interface as Locale::gettext_pp but in an
126implementation-independent manner.
127
128The module Locale::TextDomain is the only module that you should
129actually use in your software.  It represents the message translation
130system for a particular text domain (a text domain is a unique
131identifier for your software package), makes use of Locale::Messages
132for message translation and catalog location, and it provides
133additional utility functions, for example common shortcut names for
134i18n routines, tied hashes for hash-like lookups into the translation
135database, and finally an interpolation mechanism suitable for
136internationalized messages.
137
138The package also contains a charset conversion library
139Locale::Recode.  This library is used internally by Locale::gettext_pp
140to allow on-the-fly charset conversion between the charset in a
141message catalog and the preferred (end) user charset.  Its main
142advantage about the Encode package available for recent Perl versions
143is its portability, since it does not require the Unicode capabilities
144of Perl that were introduced with Perl 5.6.  It fully supports UTF-8
145with every Perl version and a wealth of common 8 bit encodings.  If
146you have to do charset conversion with older Perl versions, then
147Locale::Recode may be worth a try although it is really only a helper
148library, not intended as a competitor to Encode.
149
150Documentation
151-------------
152
153For a basic understanding of message translation in Perl with
154libintl-perl you should read the perldoc of Locale::TextDomain.  Don't
155bother about the documentation of the other modules in the library,
156you will not need it unless you want to hack the library yourself.
157
158In order to make use of the software, you will also need various tools
159from GNU gettext [savannah](http://savannah.gnu.org/projects/gettext/). The documentation is located at [www.gnu.org](http://www.gnu.org/manual/gettext/).
160You will find there a language-independent overview of
161internationalization with GNU gettext, and in the Perl-specific
162sections you will find details about the parser that extracts
163translatable messages from your Perl sources.
164
165Quick-Start
166-----------
167
168The subdirectory "sample" of the source distribution of libintl-perl
169contains a full-fledged example for an internationalized Perl package,
170including a working Makefile.  The README of that subdirectory
171explains all necessary steps.
172
173However, if you are on a recent GNU/Linux system or similar (cygwin
174should also do), chances are that you can get the following example to
175run:
176
177	#! /usr/local/bin/perl -w
178
179	use strict;
180
181	# This assumes that the textdomain 'libc' is available on your
182	# system.  Try "locate libc.mo" or "locate libc.gmo" (or
183	# "find / -type f -name libc.mo" if locate is not available on
184	# your system).
185	#
186	# By the way, the "use Locale::TextDomain (TEXTDOMAIN) is the
187	# equivalent of
188	#
189	#      textdomain ("TEXTDOMAIN");
190	#
191	# in C or similar languages.
192	use Locale::TextDomain ('libc');
193
194	# The locale category LC_MESSAGES is not exported by the POSIX
195	# module on older Perl versions.
196	use Locale::Messages qw (LC_MESSAGES);
197
198	use POSIX ('setlocale');
199
200	# Set the locale according to our environment.
201	setlocale (LC_MESSAGES, '');
202
203	# This makes the assumption that your system libc defines a
204	# message "No such file or directory".  Check the exact
205	# spelling on your system with something like
206	# "ls NON-EXISTANT".
207	# Note the double underscore in front of the string.  This is
208	# really a function call to the function __() that is
209	# automagically imported by Locale::TextDomain into your
210	# namespace.  This function takes its argument, looks up a
211	# translation for it, and returns that, or the unmodified
212	# string in case of failure.
213	print __"No such file or directory", ".\n";
214
215	__END__
216
217Now run the command "locale -a" or "nlsinfo" to get a list of
218available locales on your system.  Try the section "Finding locales"
219in "perldoc perllocale" if you have problems.
220
221If, for example, the locale "fr_FR" is available on your system, set
222the environment variable LANG to that value, for a POSIX shell
223
224     LANG=fr_FR
225     export LANG
226
227for the C shell
228
229     setenv LANG fr_FR
230
231and run your little Perl script.  It should tell you what the error
232message for "No such file or directory" is in French, or whatever
233language you chose.  Not a real example, because we have "stolen" a
234message from a system catalog.  But it should give you the general
235idea, especially if you are already familiar with gettext in C.
236
237If you still see the English message, this does not necessarily mean a
238failure, since the string is maybe not translated on your system (try
239"locate libc.mo" to get a list of available translations).  Even for
240the translations listed there, that particular message might be
241missing.  Try a common locale like "de_DE" or "fr_FR" that are usually
242fully translated then.
243
244Your next steps should be "perldoc Locale::TextDomain", and then study
245the example in the subdirectory "sample" of this distribution.
246
247Have fun with libintl-perl!
248
249Guido Flohr
250

README.solaris

1Special Notes for Sun Solaris
2=============================
3
4Recent versions of Solaris ship with a libintl that is mostly compatible
5with GNU gettext.  Even the plural handling functions (ngettext,
6dngettext, dcngettext, ...) and output character conversion functions
7(bind_textdomain_codeset) are included.
8
9On my test system, the behavior of the Solaris version differs in one
10important point from the pure Perl version or the GNU gettext version:
11In a locale environment that is a regional variant of another locale
12(for example "fr_CA" is a regional variant of "fr"), both the pure Perl
13version from libintl-perl and the C version from GNU gettext will fall
14back to translations for the superordinate message catalog ("fr") if
15no special translation for the selected locale ("fr_CA") can be found.
16This fallback mechanism is missing in the Solaris implementation.
17
18This could be considered harmless, because Solaris users are probably
19used to this behavior.  On the other hand, the pure Perl version of
20gettext in libintl-perl aims to be as compatible as possible to the
21GNU gettext implementation.  Furthermore, if the pure Perl and the
22C/XS version behave differently, users may be unnecessarily confused.
23
24If you think you can live with that little inconsistence, you are not
25completely lost: Edit the toplevel Makefile.PL, in the function
26WriteMakefile(), change the value for the hash slot "DIR" from
27the value depending on "$result" to simply "['gettext_xs']".  If you
28have a look at the source code of Makefile.PL, you will see that this
29has already been prepared.
30
31If you do this, the test suite will fail, because the above described
32behavior ("fr_CA" vs. "fr" ...) is checked by the tests.  In this case,
33expect the following failures:
34
35Failed Test                    Stat Wstat Total Fail  Failed  List of Failed
36-------------------------------------------------------------------------------
37./tests/03bind_textdomain_codeset_xs.t        9    2  22.22%  5 9
38./tests/03dcgettext_xs.t                      9    2  22.22%  3 7
39./tests/03dcngettext_xs.t                    83   51  61.45%  22-31 43-83
40./tests/03dgettext_xs.t                       9    2  22.22%  3 7
41./tests/03dngettext_xs.t                     83   51  61.45%  22-31 43-83
42./tests/03gettext_xs.t                        6    1  16.67%  3
43./tests/03ngettext_xs.t                      85   51  60.00%  23-32 45-85
44
45But even if you have installed GNU gettext, you may run into this error
46when trying to compile the XS version:
47
48"gettext_xs.xs", line 32: #error: "<libintl.h> is not GNU gettext.  Maybe you have to adjust your include path."
49cc: acomp failed for gettext_xs.c
50make[1]: *** [gettext_xs.o] Error 2
51make[1]: Leaving directory `/root/libintl-perl-1.15/gettext_xs'
52make: *** [subdirs] Error 2
53
54What has happened here?  Have a look at the source code of <libintl.h>
55that ships with GNU gettext:
56
57/* We define an additional symbol to signal that we use the GNU
58   implementation of gettext.  */
59#define __USE_GNU_GETTEXT 1
60
61...
62
63/* We redirect the functions to those prefixed with "libintl_".  This is
64   necessary, because some systems define gettext/textdomain/... in the C
65   library (namely, Solaris 2.4 and newer, and GNU libc 2.0 and newer).
66   If we used the unprefixed names, there would be cases where the
67   definition in the C library would override the one in the libintl.so
68   shared library.  Recall that on ELF systems, the symbols are looked
69   up in the following order:
70     1. in the executable,
71     2. in the shared libraries specified on the link command line, in order,
72     3. in the dependencies of the shared libraries specified on the link
73        command line,
74     4. in the dlopen()ed shared libraries, in the order in which they were
75        dlopen()ed.
76   The definition in the C library would override the one in libintl.so if
77   either
78     * -lc is given on the link command line and -lintl isn't, or
79     * -lc is given on the link command line before -lintl, or
80     * libintl.so is a dependency of a dlopen()ed shared library but not
81       linked to the executable at link time.
82   Since Solaris gettext() behaves differently than GNU gettext(), this
83   would be unacceptable.
84
85   The redirection happens by default through macros in C, so that &gettext
86   is independent of the compilation unit, but through inline functions in
87   C++, in order not to interfere with the name mangling of class fields or
88   class methods called 'gettext'.  */
89
90In brief: The GNU libraries libintl.so and libintl.a prefix all functions
91with "libintl_" in order to avoid symbol name conflicts with the vanilla
92Solaris verssion.  These precautions still give room to a popular
93misconfiguration: If you install GNU gettext with the default prefix
94"/usr/local", libraries will get installed in "/usr/local/lib", the
95header files - notably <libintl.h> - will get installed in
96"/usr/local/include", so far so good.  Now set the environment variable
97LD_LIBRARY_PATH to "/usr/local/lib", so that the GNU version of libintl.so
98will be found by the dynamic loader at runtime.  Yet, if
99"/usr/local/include" comes after "/usr/include" in your C compiler's
100include path, the above described trick does not work, the functions
101like "gettext", "dgettext" etc. will not get re-defined to "libintl_gettext",
102"libintl_dgettext" and so on.  Remember, the preprocessor trick used by
103GNU gettext will change every reference to the function gettext() into
104a reference to libintl_gettext() for gettext() into a definition for
105libintl_gettext().  If your C compiler includes the "wrong" include file
106(/usr/include/libintl.h) instead of the "correct" one
107(/usr/local/include/libintl.h), your C sources will still reference
108gettext() instead of libintl_gettext().  At run-time, even if the dynamic
109loader considers the GNU version of libintl.so (in "/usr/local/lib"), it
110will not use it, because it looks for the "wrong" symbol gettext()
111instead of libintl_gettext().
112
113Too complicated? Okay: The order for C header files for the C compiler
114(actually the preprocessor) differs from the inclusion order for
115libraries and this must lead to trouble.  If you understand WHY, you
116will find a way to fix it.  If not, ignore the problem: Do not
117build the problem, and be assured, that the pure Perl version is
118fast enough.  It is very, very unlikely that using the pure Perl
119instead of the XS version of will be the bottleneck of any application
120you use.
121
122Life is complicated under the sun, ain't it? ;-)
123
124Guido
125
126

README.win32

1When building libintl-perl under 32 bit versions of MS-DOS, you have several
2options, depending on the facilities available on your system, and on the Perl
3version you use.
4
5Cygwin Perl
6===========
7
8When using the Perl interpreter that ships with cygwin, you are in a pretty
9Unix-like environment, and you should be able to build and use libintl-perl
10like on ordinary operating system.
11
12ActiveState Perl
13================
14
15By default, the XS version of libintl-perl is not built.  You will not win
16a lot, by trying to build the XS version, but if you can't help, here are
17the instructions that worked on my system.  Your mileage may vary, however.
18
19C Compiler
20----------
21
22Windows does not ship with a C compiler.  Since ActiveState Perl is built
23with Microsoft Visual C, you probably will not have a choice, and have to
24purchase MSVC.
25
26Building libiconv and GNU gettext
27---------------------------------
28
29The XS version of libintl-perl requires the runtime facilities provided by
30GNU gettext, which in turn rely on libiconv.  You can both in source form
31from ftp://ftp.gnu.org/pub/gnu.
32
33First, unpack both the libiconv and gettext sources in a directory of your
34choice, open the MS-DOS cripple shell ("cmd.exe"), and cd into the directory
35where you have unpacked the libiconv sources.  There read the file
36"README.woe32" or just type
37
38    nmake -f Makefile.msvc MFLAGS=-MD DLL=1 NO_NLS=1
39    nmake -f Makefile.msvc MFLAGS=-MD DLL=1 NO_NLS=1 check
40    nmake -f Makefile.msvc MFLAGS=-MD DLL=1 NO_NLS=1 install
41
42The second command line will run the test suite (you may omit this step).
43
44Now cd to the directory where you have unpacked the gettext sources, and
45read "README.woe32", or just type
46
47    nmake -f Makefile.msvc MFLAGS=-MD DLL=1
48    nmake -f Makefile.msvc MFLAGS=-MD DLL=1 check
49    nmake -f Makefile.msvc MFLAGS=-MD DLL=1 install
50
51You should now go back into the libiconv build directory, and re-build
52the package again with native language support:
53
54    nmake -f Makefile.msvc MFLAGS=-MD DLL=1 NO_NLS=1 distclean
55    nmake -f Makefile.msvc MFLAGS=-MD DLL=1
56    nmake -f Makefile.msvc MFLAGS=-MD DLL=1 check
57    nmake -f Makefile.msvc MFLAGS=-MD DLL=1 install
58
59You should now have the gettext and libiconv DLLs installed in "\usr\bin",
60and libraries in "\usr\lib".  It should be theoretically possible to build
61static versions (instead of DLLs) of both gettext and libiconv, but I
62did not manage to do so here.
63
64Build libintl-perl
65------------------
66
67The Makefile.PL provided with libintl-perl normally autodetects the presence
68of the required gettext shared libraries, but this test (intentionally) fails
69under Windows.  You have to bypass the mechanism by saying
70
71    perl Makefile.PL DIR=gettext_xs
72
73This should produce an output like this:
74
75    Checking whether we can compile the XS version ... no
76    => Cannot build the XS version of libintl-perl (see 'config.log' for
77    => details).  This is harmless!
78    Writing Makefile Locale::gettext_xs
79    Writing Makefile for libintl-perl
80
81Ignore the warning, that the XS version cannot be built.  It will be
82built anyhow.
83
84Now do the usual:
85
86    nmake
87    nmake test
88    nmake install
89
90Please run the testsuite!  If it fails, and you cannot sort out the reason,
91re-build the module without the XS version.
92
93Distribution
94------------
95
96If you want a binary version of libintl-perl, you either have to bundle it
97with the DLLs and libraries for GNU gettext and libiconv, or you have to
98build and link against static versions of the two libraries (which I didn't
99manage to do).  In any case, please take care that your distribution does
100not violate the licenses under which GNU gettext, libiconv, and libintl-perl
101are provided! Please read the following statement by Bruno Haible,
102maintainer of GNU gettext and libiconv:
103
104  Note that DLLs created with MSVC 7.0 cannot be distributed: They depend
105  on a closed-source library 'msvcr70.dll' which is not normally part of a
106  Woe32 installation, therefore the distribution of such DLLs - with or
107  without msvcr70.dll - would be a violation of the LGPL. This problem does
108  not occur with MSVC 6.0 and earlier.
109
110Guido Flohr <guido.flohr@cantanea.com>
111