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