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