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