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