(?p{}) has been deprecated for a long time.
[p5sagit/p5-mst-13.2.git] / README.ce
CommitLineData
e1caacb4 1If you read this file _as_is_, just ignore the funny characters you
2see. It is written in the POD format (see pod/perlpod.pod) which is
3specifically designed to be readable as is.
4
c7bcd97d 5=head1 NAME
e1caacb4 6
c7bcd97d 7perlce - Perl for WinCE
e1caacb4 8
75472953 9=head1 Building Perl for WinCE
10
11=head2 DESCRIPTION
e1caacb4 12
2e64bfdb 13This file gives the instructions for building Perl5.8 and above for
e1caacb4 14WinCE. Please read and understand the terms under which this
15software is distributed.
16
75472953 17=head2 General explanations on cross-compiling WinCE
e1caacb4 18
75472953 19=over
20
21=item *
22
23C<miniperl> is built. This is a single executable (without DLL), intended
24to run on Win32, and it will facilitate remaining build process; all binaries
25built after it are foreign and should not run locally.
26
45496817 27C<miniperl> is built using C<./win32/Makefile>; this is part of normal
75472953 28build process invoked as dependency from wince/Makefile.ce
29
30=item *
31
45496817 32After C<miniperl> is built, C<configpm> is invoked to create right C<Config.pm>
75472953 33in right place and its corresponding Cross.pm.
2e64bfdb 34
45496817 35Unlike Win32 build, miniperl will not have C<Config.pm> of host within reach;
36it rather will use C<Config.pm> from within cross-compilation directories.
2e64bfdb 37
45496817 38File C<Cross.pm> is dead simple: for given cross-architecture places in @INC
39a path where perl modules are, and right C<Config.pm> in that place.
e1caacb4 40
75472953 41That said, C<miniperl -Ilib -MConfig -we 1> should report an error, because
45496817 42it can not find C<Config.pm>. If it does not gives an error -- wrong C<Config.pm>
75472953 43is substituted, and resulting binaries will be a mess.
44
45C<miniperl -MCross -MConfig -we 1> should run okay, and it will provide right
45496817 46C<Config.pm> for further compilations.
75472953 47
48=item *
49
50During extensions build phase, a script C<./win32/buldext.pl> is invoked,
45496817 51which in turn steps in C<./ext> subdirectories and performs a build of
75472953 52each extension in turn.
53
45496817 54All invokes of C<Makefile.PL> are provided with C<-MCross> so to enable cross-
75472953 55compile.
56
75472953 57=back
8f33b42a 58
75472953 59=head2 BUILD
60
61This section describes the steps to be performed to build PerlCE.
62You may find additional information about building perl for WinCE
63at L<http://perlce.sourceforge.net> and some pre-built binaries.
64
65=head3 Tools & SDK
e1caacb4 66
2e64bfdb 67For compiling, you need following:
68
69=over 4
70
71=item * Microsoft Embedded Visual Tools
72
73=item * Microsoft Visual C++
74
75=item * Rainer Keuchel's celib-sources
76
77=item * Rainer Keuchel's console-sources
78
79=back
e1caacb4 80
75472953 81Needed source files can be downloaded at
82L<http://www.rainer-keuchel.de/wince/dirlist.html>
e1caacb4 83
75472953 84=head3 Make
e1caacb4 85
45496817 86Normally you only need to edit C<./win32/ce-helpers/compile.bat>
2e64bfdb 87to reflect your system and run it.
e1caacb4 88
01e90026 89File C<./win32/ce-helpers/compile.bat> is actually a wrapper to call
45496817 90C<nmake -f makefile.ce> with appropriate parameters and it accepts extra
91parameters and forwards them to C<nmake> command as additional
2e64bfdb 92arguments. You should pass target this way.
e1caacb4 93
8f33b42a 94To prepare distribution you need to do following:
2e64bfdb 95
96=over 4
97
45496817 98=item * go to C<./win32> subdirectory
2e64bfdb 99
01e90026 100=item * edit file C<./win32/ce-helpers/compile.bat>
e1caacb4 101
2e64bfdb 102=item * run
103 compile.bat
e1caacb4 104
2e64bfdb 105=item * run
106 compile.bat dist
e1caacb4 107
2e64bfdb 108=back
109
45496817 110C<Makefile.ce> has C<CROSS_NAME> macro, and it is used further to refer to
8f33b42a 111your cross-compilation scheme. You could assign a name to it, but this
112is not necessary, because by default it is assigned after your machine
113configuration name, such as "wince-sh3-hpc-wce211", and this is enough
114to distinguish different builds at the same time. This option could be
115handy for several different builds on same platform to perform, say,
116threaded build. In a following example we assume that all required
117environment variables are set properly for C cross-compiler (a special
45496817 118*.bat file could fit perfectly to this purpose) and your C<compile.bat>
119has proper "MACHINE" parameter set, to, say, C<wince-mips-pocket-wce300>.
8f33b42a 120
121 compile.bat
122 compile.bat dist
123 compile.bat CROSS_NAME=mips-wce300-thr "USE_ITHREADS=define" "USE_IMP_SYS=define" "USE_MULTI=define"
124 compile.bat CROSS_NAME=mips-wce300-thr "USE_ITHREADS=define" "USE_IMP_SYS=define" "USE_MULTI=define" dist
125
126If all goes okay and no errors during a build, you'll get two independent
45496817 127distributions: C<wince-mips-pocket-wce300> and C<mips-wce300-thr>.
8f33b42a 128
45496817 129Target C<dist> prepares distribution file set. Target C<zipdist> performs
130same as C<dist> but additionally compresses distribution files into zip
8f33b42a 131archive.
132
45496817 133NOTE: during a build there could be created a number (or one) of C<Config.pm>
134for cross-compilation ("foreign" C<Config.pm>) and those are hidden inside
135C<../xlib/$(CROSS_NAME)> with other auxilary files, but, and this is important to
136note, there should be B<no> C<Config.pm> for host miniperl.
8f33b42a 137If you'll get an error that perl could not find Config.pm somewhere in building
138process this means something went wrong. Most probably you forgot to
139specify a cross-compilation when invoking miniperl.exe to Makefile.PL
140When building an extension for cross-compilation your command line should
141look like
142
143 ..\miniperl.exe -I..\lib -MCross=mips-wce300-thr Makefile.PL
144
145or just
146
147 ..\miniperl.exe -I..\lib -MCross Makefile.PL
148
149to refer a cross-compilation that was created last time.
150
8f33b42a 151All questions related to building for WinCE devices could be asked in
ef39d023 152F<perlce-user@lists.sourceforge.net> mailing list.
e1caacb4 153
75472953 154=head1 Using Perl on WinCE
155
156=head2 DESCRIPTION
157
158PerlCE is currently linked with a simple console window, so it also
159works on non-hpc devices.
160
45496817 161The simple stdio implementation creates the files C<stdin.txt>,
162C<stdout.txt> and C<stderr.txt>, so you might examine them if your
75472953 163console has only a liminted number of cols.
164
165When exitcode is non-zero, a message box appears, otherwise the
166console closes, so you might have to catch an exit with
167status 0 in your program to see any output.
168
45496817 169stdout/stderr now go into the files C</perl-stdout.txt> and
170C</perl-stderr.txt.>
171
172PerlIDE is handy to deal with perlce.
75472953 173
174=head2 LIMITATIONS
175
176No fork(), pipe(), popen() etc.
177
178=head2 ENVIRONMENT
179
180All environment vars must be stored in HKLM\Environment as
181strings. They are read at process startup.
182
45496817 183=over
184
185=item PERL5LIB
186
187Usual perl lib path (semi-list).
188
189=item PATH
190
191Semi-list for executables.
192
193=item TMP
194
195- Tempdir.
196
197=item UNIXROOTPATH
198
199- Root for accessing some special files, i.e. C</dev/null>, C</etc/services>.
200
201=item ROWS/COLS
202
203- Rows/cols for console.
204
205=item HOME
206
207- Home directory.
208
209=item CONSOLEFONTSIZE
210
211- Size for console font.
212
213=back
75472953 214
215You can set these with cereg.exe, a (remote) registry editor
216or via the PerlIDE.
217
218=head2 REGISTRY
219
220To start perl by clicking on a perl source file, you have
45496817 221to make the according entries in HKCR (see C<ce-helpers/wince-reg.bat>).
75472953 222cereg.exe (which must be executed on a desktop pc with
223ActiveSync) is reported not to work on some devices.
224You have to create the registry entries by hand using a
225registry editor.
226
75472953 227=head2 XS
228
229The following Win32-Methods are built-in:
230
231 newXS("Win32::GetCwd", w32_GetCwd, file);
232 newXS("Win32::SetCwd", w32_SetCwd, file);
233 newXS("Win32::GetTickCount", w32_GetTickCount, file);
234 newXS("Win32::GetOSVersion", w32_GetOSVersion, file);
235 newXS("Win32::IsWinNT", w32_IsWinNT, file);
236 newXS("Win32::IsWin95", w32_IsWin95, file);
237 newXS("Win32::IsWinCE", w32_IsWinCE, file);
238 newXS("Win32::CopyFile", w32_CopyFile, file);
239 newXS("Win32::Sleep", w32_Sleep, file);
240 newXS("Win32::MessageBox", w32_MessageBox, file);
241 newXS("Win32::GetPowerStatus", w32_GetPowerStatus, file);
242 newXS("Win32::GetOemInfo", w32_GetOemInfo, file);
243 newXS("Win32::ShellEx", w32_ShellEx, file);
244
245=head2 BUGS
246
247Opening files for read-write is currently not supported if
248they use stdio (normal perl file handles).
249
250If you find bugs or if it does not work at all on your
251device, send mail to the address below. Please report
252the details of your device (processor, ceversion,
253devicetype (hpc/palm/pocket)) and the date of the downloaded
254files.
255
256=head2 INSTALLATION
257
258Currently installation instructions are at L<http://perlce.sourceforge.net/>.
259
260After installation & testing processes will stabilize, information will
261be more precise.
262
c7bcd97d 263=head1 ACKNOWLEDGEMENTS
e1caacb4 264
265The port for Win32 was used as a reference.
266
45496817 267=head1 History of WinCE port
268
269=over
270
271=item 5.6.0
272
273Initial port of perl to WinCE. It was performed in separate directory
274named C<wince>. This port was based on contents of C<./win32> directory.
275C<miniperl> was not built, user must have HOST perl and properly edit
276C<makefile.ce> to reflect this.
277
278=item 5.8.0
279
280wince port was kept in the same C<./wince> directory, and C<wince/Makefile.ce>
281was used to invoke native compiler to create HOST miniperl, which then
282facilitates cross-compiling process.
283Extension building support was added.
284
285=item 5.9.4
286
287Two directories C<./win32> and C<./wince> were merged, so perlce build
288process comes in C<./win32> directory.
289
ef39d023 290=back
45496817 291
2e64bfdb 292=head1 AUTHORS
e1caacb4 293
75472953 294=over
295
296=item Rainer Keuchel <coyxc@rainer-keuchel.de>
297
298provided initial port of Perl, which appears to be most essential work, as
299it was a breakthrough on having Perl ported at all.
300Many thanks and obligations to Rainer!
301
302=item Vadim Konovalov
303
304made further support of WinCE port.
305
306=back