This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Re: Bug in perlguts documentation?
[perl5.git] / README.dos
CommitLineData
a9226780
JH
1If you read this file _as_is_, just ignore the funny characters you
2see. It is written in the POD format (see perlpod manpage) which is
3specially designed to be readable as is.
4
5=head1 NAME
6
7perldos - Perl under DOS, W31, W95.
8
9=head1 SYNOPSIS
10
11These are instructions for building Perl under DOS (or w??), using
de32c820 12DJGPP v2.03 or later. Under w95 long filenames are supported.
a9226780
JH
13
14=head1 DESCRIPTION
15
16Before you start, you should glance through the README file
17found in the top-level directory where the Perl distribution
18was extracted. Make sure you read and understand the terms under
19which this software is being distributed.
20
21This port currently supports MakeMaker (the set of modules that
22is used to build extensions to perl). Therefore, you should be
23able to build and install most extensions found in the CPAN sites.
24
de32c820
PFI
25Detailed instructions on how to build and install perl extension
26modules, including XS-type modules, is included. See 'BUILDING AND
27INSTALLING MODULES'.
28
a9226780
JH
29=head2 Prerequisites
30
31=over 4
32
33=item DJGPP
34
35DJGPP is a port of GNU C/C++ compiler and development tools to 32-bit,
36protected-mode environment on Intel 32-bit CPUs running MS-DOS and compatible
37operating systems, by DJ Delorie <dj@delorie.com> and friends.
38
39For more details (FAQ), check out the home of DJGPP at:
40
41 http://www.delorie.com/djgpp/
42
43If you have questions about DJGPP, try posting to the DJGPP newsgroup:
44comp.os.msdos.djgpp, or use the email gateway djgpp@delorie.com.
45
46You can find the full DJGPP distribution on any SimTel.Net mirror all over
47the world. Like:
48
49 ftp://ftp.simtel.net/pub/simtelnet/gnu/djgpp/v2*
50
51You need the following files to build perl (or add new modules):
52
de32c820
PFI
53 v2/djdev203.zip
54 v2/bnu2951b.zip
55 v2gnu/gcc2952b.zip
56 v2gnu/bsh204b.zip
57 v2gnu/mak3791b.zip
a9226780 58 v2gnu/fil316b.zip
de32c820
PFI
59 v2gnu/sed302b.zip
60 v2gnu/txt20b.zip
61 v2gnu/dif272b.zip
62 v2gnu/grep24b.zip
a9226780
JH
63 v2gnu/shl112b.zip
64 v2gnu/gawk303b.zip
de32c820 65 v2misc/csdpmi4b.zip
a9226780
JH
66
67or possibly any newer version.
68
69=item Pthreads
70
71Thread support is not tested in this version of the djgpp perl.
72
73=back
74
75=head2 Shortcomings of Perl under DOS
76
77Perl under DOS lacks some features of perl under UNIX because of
78deficiencies in the UNIX-emulation, most notably:
79
80=over 4
81
82=item *
83
84fork() and pipe()
85
86=item *
87
88some features of the UNIX filesystem regarding link count and file dates
89
90=item *
91
92in-place operation is a little bit broken with short filenames
93
94=item *
95
96sockets
97
98=back
99
100=head2 Building
101
102=over 4
103
104=item *
105
106Unpack the source package F<perl5.6*.tar.gz> with djtarx. If you want
107to use long file names under w95 and also to get Perl to pass all its
108tests, don't forget to use
109
110 set LFN=y
de32c820 111 set FNCASE=y
a9226780
JH
112
113before unpacking the archive.
114
115=item *
116
117Create a "symlink" or copy your bash.exe to sh.exe in your C<($DJDIR)/bin>
118directory.
119
120 ln -s bash.exe sh.exe
121
de32c820
PFI
122[If you have the recommended version of bash for DJGPP, this is already
123done for you.]
124
a9226780
JH
125And make the C<SHELL> environment variable point to this F<sh.exe>:
126
127 set SHELL=c:/djgpp/bin/sh.exe (use full path name!)
128
129You can do this in F<djgpp.env> too. Add this line BEFORE any section
130definition:
131
132 +SHELL=%DJDIR%/bin/sh.exe
133
134=item *
135
136If you have F<split.exe> and F<gsplit.exe> in your path, then rename
137F<split.exe> to F<djsplit.exe>, and F<gsplit.exe> to F<split.exe>.
138Copy or link F<gecho.exe> to F<echo.exe> if you don't have F<echo.exe>.
139Copy or link F<gawk.exe> to F<awk.exe> if you don't have F<awk.exe>.
140
de32c820
PFI
141[If you have the recommended versions of djdev, shell utilities and
142gawk, all these are already done for you, and you will not need to do
143anything.]
144
a9226780
JH
145=item *
146
147Chdir to the djgpp subdirectory of perl toplevel and type the following
de32c820 148commands:
a9226780 149
de32c820 150 set FNCASE=y
a9226780
JH
151 configure.bat
152
153This will do some preprocessing then run the Configure script for you.
de32c820
PFI
154The Configure script is interactive, but in most cases you just need to
155press ENTER. The "set" command ensures that DJGPP preserves the letter
156case of file names when reading directories. If you already issued this
157set command when unpacking the archive, and you are in the same DOS
158session as when you unpacked the archive, you don't have to issue the
159set command again. This command is necessary *before* you start to
160(re)configure or (re)build perl in order to ensure both that perl builds
161correctly and that building XS-type modules can succeed. See the DJGPP
162info entry for "_preserve_fncase" for more information:
163
164 info libc alphabetical _preserve_fncase
a9226780
JH
165
166If the script says that your package is incomplete, and asks whether
167to continue, just answer with Y (this can only happen if you don't use
de32c820 168long filenames or forget to issue "set FNCASE=y" first).
a9226780
JH
169
170When Configure asks about the extensions, I suggest IO and Fcntl,
171and if you want database handling then SDBM_File or GDBM_File
172(you need to install gdbm for this one). If you want to use the
173POSIX extension (this is the default), make sure that the stack
174size of your F<cc1.exe> is at least 512kbyte (you can check this
175with: C<stubedit cc1.exe>).
176
177You can use the Configure script in non-interactive mode too.
178When I built my F<perl.exe>, I used something like this:
179
180 configure.bat -des
181
182You can find more info about Configure's command line switches in
183the F<INSTALL> file.
184
185When the script ends, and you want to change some values in the
186generated F<config.sh> file, then run
187
188 sh Configure -S
189
190after you made your modifications.
191
192IMPORTANT: if you use this C<-S> switch, be sure to delete the CONFIG
193environment variable before running the script:
194
195 set CONFIG=
196
197=item *
198
199Now you can compile Perl. Type:
200
201 make
202
203=back
204
205=head2 Testing
206
207Type:
208
209 make test
210
211If you're lucky you should see "All tests successful". But there can be
212a few failed subtests (less than 5 hopefully) depending on some external
213conditions (e.g. some subtests fail under linux/dosemu or plain dos
214with short filenames only).
215
216=head2 Installation
217
218Type:
219
220 make install
221
222This will copy the newly compiled perl and libraries into your DJGPP
223directory structure. Perl.exe and the utilities go into C<($DJDIR)/bin>,
224and the library goes under C<($DJDIR)/lib/perl5>. The pod documentation
225goes under C<($DJDIR)/lib/perl5/pod>.
226
de32c820
PFI
227=head1 BUILDING AND INSTALLING MODULES
228
229
b5ab5069 230=head2 Building Prerequisites
de32c820 231
de32c820
PFI
232For building and installing non-XS modules, all you need is a working
233perl under DJGPP. Non-XS modules do not require re-linking the perl
234binary, and so are simpler to build and install.
235
236XS-type modules do require re-linking the perl binary, because part of
237an XS module is written in "C", and has to be linked together with the
238perl binary to be executed. This is required because perl under DJGPP
239is built with the "static link" option, due to the lack of "dynamic
240linking" in the DJGPP environment.
241
242Because XS modules require re-linking of the perl binary, you need both
243the perl binary distribution and the perl source distribution to build
244an XS extension module. In addition, you will have to have built your
245perl binary from the source distribution so that all of the components
246of the perl binary are available for the required link step.
247
de32c820
PFI
248=head2 Unpacking CPAN Modules
249
de32c820
PFI
250First, download the module package from CPAN (e.g., the "Comma Separated
251Value" text package, Text-CSV-0.01.tar.gz). Then expand the contents of
252the package into some location on your disk. Most CPAN modules are
253built with an internal directory structure, so it is usually safe to
254expand it in the root of your DJGPP installation. Some people prefer to
255locate source trees under /usr/src (i.e., C<($DJDIR)/usr/src>), but you may
256put it wherever seems most logical to you, *EXCEPT* under the same
257directory as your perl source code. There are special rules that apply
258to modules which live in the perl source tree that do not apply to most
259of the modules in CPAN.
260
261Unlike other DJGPP packages, which are normal "zip" files, most CPAN
262module packages are "gzipped tarballs". Recent versions of WinZip will
263safely unpack and expand them, *UNLESS* they have zero-length files. It
264is a known WinZip bug (as of v7.0) that it will not extract zero-length
265files.
266
267From the command line, you can use the djtar utility provided with DJGPP
268to unpack and expand these files. For example:
269
270 C:\djgpp>djtarx -v Text-CSV-0.01.tar.gz
271
272This will create the new directory C<($DJDIR)/Text-CSV-0.01>, filling
273it with the source for this module.
274
de32c820
PFI
275=head2 Building Non-XS Modules
276
277To build a non-XS module, you can use the standard module-building
278instructions distributed with perl modules.
279
de32c820
PFI
280 perl Makefile.PL
281 make
282 make test
283 make install
284
285This is sufficient because non-XS modules install only ".pm" files and
286(sometimes) pod and/or man documentation. No re-linking of the perl
287binary is needed to build, install or use non-XS modules.
288
de32c820
PFI
289=head2 Building XS Modules
290
291To build an XS module, you must use the standard module-building
292instructions distributed with perl modules *PLUS* three extra
293instructions specific to the DJGPP "static link" build environment.
294
de32c820
PFI
295 set FNCASE=y
296 perl Makefile.PL
297 make
298 make perl
299 make test
300 make -f Makefile.aperl inst_perl MAP_TARGET=perl.exe
301 make install
302
303The first extra instruction sets DJGPP's FNCASE environment variable so
304that the new perl binary which you must build for an XS-type module will
305build correctly. The second extra instruction re-builds the perl binary
306in your module directory before you run "make test", so that you are
307testing with the new module code you built with "make". The third extra
308instruction installs the perl binary from your module directory into the
309standard DJGPP binary directory, C<($DJDIR)/bin>, replacing your
310previous perl binary.
311
312Note that the MAP_TARGET value *must* have the ".exe" extension or you
313will not create a "perl.exe" to replace the one in C<($DJDIR)/bin>.
314
315When you are done, the XS-module install process will have added information
316to yout "perllocal" information telling that the perl binary has been replaced,
317and what module was installed. you can view this information at any time
318by using the command:
319
320 perl -S perldoc perllocal
321
a9226780
JH
322=head1 AUTHOR
323
de32c820
PFI
324Laszlo Molnar, F<laszlo.molnar@eth.ericsson.se> [Installing/building perl]
325
326Peter J. Farley III F<pjfarley@banet.net> [Building/installing modules]
a9226780
JH
327
328=head1 SEE ALSO
329
330perl(1).
331
332=cut
333