1PERLCE(1) Perl Programmers Reference Guide PERLCE(1)
2
3
4
6 perlce - Perl for WinCE
7
9 WARNING
10 Much of this document has become very out of date and needs updating,
11 rewriting or deleting. The build process was overhauled during the 5.19
12 development track and the current instructions as of that time are
13 given in "CURRENT BUILD INSTRUCTIONS"; the previous build instructions,
14 which are largely superseded but may still contain some useful
15 information, are left in "OLD BUILD INSTRUCTIONS" but really need
16 removing after anything of use has been extracted from them.
17
18 DESCRIPTION
19 This file gives the instructions for building Perl5.8 and above for
20 WinCE. Please read and understand the terms under which this software
21 is distributed.
22
23 General explanations on cross-compiling WinCE
24 · miniperl is built. This is a single executable (without DLL),
25 intended to run on Win32, and it will facilitate remaining build
26 process; all binaries built after it are foreign and should not run
27 locally.
28
29 miniperl is built using ./win32/Makefile; this is part of normal
30 build process invoked as dependency from wince/Makefile.ce
31
32 · After miniperl is built, configpm is invoked to create right
33 Config.pm in right place and its corresponding Cross.pm.
34
35 Unlike Win32 build, miniperl will not have Config.pm of host within
36 reach; it rather will use Config.pm from within cross-compilation
37 directories.
38
39 File Cross.pm is dead simple: for given cross-architecture places
40 in @INC a path where perl modules are, and right Config.pm in that
41 place.
42
43 That said, "miniperl -Ilib -MConfig -we 1" should report an error,
44 because it can not find Config.pm. If it does not give an error --
45 wrong Config.pm is substituted, and resulting binaries will be a
46 mess.
47
48 "miniperl -MCross -MConfig -we 1" should run okay, and it will
49 provide right Config.pm for further compilations.
50
51 · During extensions build phase, a script ./win32/buildext.pl is
52 invoked, which in turn steps in ./ext subdirectories and performs a
53 build of each extension in turn.
54
55 All invokes of Makefile.PL are provided with "-MCross" so to enable
56 cross- compile.
57
58 CURRENT BUILD INSTRUCTIONS
59 (These instructions assume the host is 32-bit Windows. If you're on
60 64-bit Windows then change "C:\Program Files" to "C:\Program Files
61 (x86)" throughout.)
62
63 1. Install EVC4 from
64
65 http://download.microsoft.com/download/c/3/f/c3f8b58b-9753-4c2e-8b96-2dfe3476a2f7/eVC4.exe
66
67 Use the key mentioned at
68
69 http://download.cnet.com/Microsoft-eMbedded-Visual-C/3000-2212_4-10108490.html?tag=bc
70
71 The installer is ancient and has a few bugs on the paths it uses. You
72 will have to fix them later. Basically, some things go into "C:/Program
73 Files/Windows CE Tools", others go into "C:/Windows CE Tools"
74 regardless of the path you gave to the installer (the default will be
75 "C:/Windows CE Tools"). Reboots will be required for the installer to
76 proceed. Also .c and .h associations with Visual Studio might get
77 overridden when installing EVC4. You have been warned.
78
79 2. Download celib from GitHub (using "Download ZIP") at
80
81 https://github.com/bulk88/celib
82
83 Extract it to a spaceless path but not into the perl build source. I
84 call this directory "celib-palm-3.0" but in the GitHub snapshot it will
85 be called "celib-master". Make a copy of the
86 "wince-arm-pocket-wce300-release" folder and rename the copy to
87 "wince-arm-pocket-wce400". This is a hack so we can build a CE 4.0
88 binary by linking in CE 3.0 ARM asm; the linker doesn't care. Windows
89 Mobile/WinCE are backwards compatible with machine code like Desktop
90 Windows.
91
92 3. Download console-1.3-src.tar.gz from
93
94 http://sourceforge.net/projects/perlce/files/PerlCE%20support%20files/console/
95
96 Extract it to a spaceless path but not into the perl build source.
97 Don't extract it into the same directory as celib. Make a copy of the
98 "wince-arm-pocket-wce300" folder and rename the copy to
99 "wince-arm-pocket-wce400". This is a hack so we can build a CE 4.0
100 binary by linking in CE 3.0 ARM asm; the linker doesn't care. Windows
101 Mobile/WinCE are backwards compatible with machine code like Desktop
102 Windows.
103
104 4. Open a command prompt, run your regular batch file to set the
105 environment for desktop Visual C building, goto the perl source
106 directory, cd into win32/, fill out Makefile, and do a "nmake all" to
107 build a Desktop Perl.
108
109 5. Open win32/Makefile.ce in a text editor and do something similar to
110 the following patch.
111
112 -CELIBDLLDIR = h:\src\wince\celib-palm-3.0
113 -CECONSOLEDIR = h:\src\wince\w32console
114 +CELIBDLLDIR = C:\sources\celib-palm-3.0
115 +CECONSOLEDIR = C:\sources\w32console
116
117 Also change
118
119 !if "$(MACHINE)" == ""
120 MACHINE=wince-arm-hpc-wce300
121 #MACHINE=wince-arm-hpc-wce211
122 #MACHINE=wince-sh3-hpc-wce211
123 #MACHINE=wince-mips-hpc-wce211
124 #MACHINE=wince-sh3-hpc-wce200
125 #MACHINE=wince-mips-hpc-wce200
126 #MACHINE=wince-arm-pocket-wce300
127 #MACHINE=wince-mips-pocket-wce300
128 #MACHINE=wince-sh3-pocket-wce300
129 #MACHINE=wince-x86em-pocket-wce300
130 #MACHINE=wince-mips-palm-wce211
131 #MACHINE=wince-sh3-palm-wce211
132 #MACHINE=wince-x86em-palm-wce211
133 #MACHINE=wince-x86-hpc-wce300
134 #MACHINE=wince-arm-pocket-wce400
135 !endif
136
137 to
138
139 !if "$(MACHINE)" == ""
140 #MACHINE=wince-arm-hpc-wce300
141 #MACHINE=wince-arm-hpc-wce211
142 #MACHINE=wince-sh3-hpc-wce211
143 #MACHINE=wince-mips-hpc-wce211
144 #MACHINE=wince-sh3-hpc-wce200
145 #MACHINE=wince-mips-hpc-wce200
146 #MACHINE=wince-arm-pocket-wce300
147 #MACHINE=wince-mips-pocket-wce300
148 #MACHINE=wince-sh3-pocket-wce300
149 #MACHINE=wince-x86em-pocket-wce300
150 #MACHINE=wince-mips-palm-wce211
151 #MACHINE=wince-sh3-palm-wce211
152 #MACHINE=wince-x86em-palm-wce211
153 #MACHINE=wince-x86-hpc-wce300
154 MACHINE=wince-arm-pocket-wce400
155 !endif
156
157 so wince-arm-pocket-wce400 is the MACHINE type.
158
159 6. Use a text editor to open "C:\Program Files\Microsoft eMbedded C++
160 4.0\EVC\WCE400\BIN\WCEARMV4.BAT". Look for
161
162 if "%SDKROOT%"=="" set SDKROOT=...
163
164 On a new install it is "C:\Windows CE Tools". Goto "C:\Windows CE
165 Tools" in a file manager and see if "C:\Windows CE
166 Tools\wce400\STANDARDSDK\Include\Armv4" exists on your disk. If not the
167 SDKROOT need to be changed to "C:\Program Files\Windows CE Tools".
168
169 Goto celib-palm-3.0\inc\cewin32.h, search for
170
171 typedef struct _ABC {
172
173 and uncomment the struct.
174
175 7. Open another command prompt, ensure PLATFORM is not set to anything
176 already unless you know what you're doing (so that the correct default
177 value is set by the next command), and run "C:\Program Files\Microsoft
178 eMbedded C++ 4.0\EVC\WCE400\BIN\WCEARMV4.BAT"
179
180 8. In the WinCE command prompt you made with WCEARMV4.BAT, goto the
181 perl source directory, cd into win32/ and run "nmake -f Makefile.ce".
182
183 9. The ARM perl interpreter (perl519.dll and perl.exe) will be in
184 something like "C:\perl519\src\win32\wince-arm-pocket-wce400", with the
185 XS DLLs in "C:\perl519\src\xlib\wince-arm-hpc-wce400\auto".
186
187 To prove success on the host machine, run "dumpbin /headers
188 wince-arm-pocket-wce400\perl.exe" from the win32/ folder and look for
189 "machine (ARM)" in the FILE HEADER VALUES and "subsystem (Windows CE
190 GUI)" in the OPTIONAL HEADER VALUES.
191
192 OLD BUILD INSTRUCTIONS
193 This section describes the steps to be performed to build PerlCE. You
194 may find additional information about building perl for WinCE at
195 <http://perlce.sourceforge.net> and some pre-built binaries.
196
197 Tools & SDK
198
199 For compiling, you need following:
200
201 · Microsoft Embedded Visual Tools
202
203 · Microsoft Visual C++
204
205 · Rainer Keuchel's celib-sources
206
207 · Rainer Keuchel's console-sources
208
209 Needed source files can be downloaded at
210 <http://perlce.sourceforge.net>
211
212 Make
213
214 Normally you only need to edit ./win32/ce-helpers/compile.bat to
215 reflect your system and run it.
216
217 File ./win32/ce-helpers/compile.bat is actually a wrapper to call
218 "nmake -f makefile.ce" with appropriate parameters and it accepts extra
219 parameters and forwards them to "nmake" command as additional
220 arguments. You should pass target this way.
221
222 To prepare distribution you need to do following:
223
224 · go to ./win32 subdirectory
225
226 · edit file ./win32/ce-helpers/compile.bat
227
228 · run
229 compile.bat
230
231 · run
232 compile.bat dist
233
234 Makefile.ce has "CROSS_NAME" macro, and it is used further to refer to
235 your cross-compilation scheme. You could assign a name to it, but this
236 is not necessary, because by default it is assigned after your machine
237 configuration name, such as "wince-sh3-hpc-wce211", and this is enough
238 to distinguish different builds at the same time. This option could be
239 handy for several different builds on same platform to perform, say,
240 threaded build. In a following example we assume that all required
241 environment variables are set properly for C cross-compiler (a special
242 *.bat file could fit perfectly to this purpose) and your compile.bat
243 has proper "MACHINE" parameter set, to, say,
244 "wince-mips-pocket-wce300".
245
246 compile.bat
247 compile.bat dist
248 compile.bat CROSS_NAME=mips-wce300-thr "USE_ITHREADS=define" ^
249 "USE_IMP_SYS=define" "USE_MULTI=define"
250 compile.bat CROSS_NAME=mips-wce300-thr "USE_ITHREADS=define" ^
251 "USE_IMP_SYS=define" "USE_MULTI=define" dist
252
253 If all goes okay and no errors during a build, you'll get two
254 independent distributions: "wince-mips-pocket-wce300" and
255 "mips-wce300-thr".
256
257 Target "dist" prepares distribution file set. Target "zipdist" performs
258 same as "dist" but additionally compresses distribution files into zip
259 archive.
260
261 NOTE: during a build there could be created a number (or one) of
262 Config.pm for cross-compilation ("foreign" Config.pm) and those are
263 hidden inside ../xlib/$(CROSS_NAME) with other auxiliary files, but,
264 and this is important to note, there should be no Config.pm for host
265 miniperl. If you'll get an error that perl could not find Config.pm
266 somewhere in building process this means something went wrong. Most
267 probably you forgot to specify a cross-compilation when invoking
268 miniperl.exe to Makefile.PL When building an extension for cross-
269 compilation your command line should look like
270
271 ..\miniperl.exe -I..\lib -MCross=mips-wce300-thr Makefile.PL
272
273 or just
274
275 ..\miniperl.exe -I..\lib -MCross Makefile.PL
276
277 to refer a cross-compilation that was created last time.
278
279 All questions related to building for WinCE devices could be asked in
280 perlce-user@lists.sourceforge.net mailing list.
281
283 DESCRIPTION
284 PerlCE is currently linked with a simple console window, so it also
285 works on non-hpc devices.
286
287 The simple stdio implementation creates the files stdin.txt, stdout.txt
288 and stderr.txt, so you might examine them if your console has only a
289 limited number of cols.
290
291 When exitcode is non-zero, a message box appears, otherwise the console
292 closes, so you might have to catch an exit with status 0 in your
293 program to see any output.
294
295 stdout/stderr now go into the files /perl-stdout.txt and
296 /perl-stderr.txt.
297
298 PerlIDE is handy to deal with perlce.
299
300 LIMITATIONS
301 No fork(), pipe(), popen() etc.
302
303 ENVIRONMENT
304 All environment vars must be stored in HKLM\Environment as strings.
305 They are read at process startup.
306
307 PERL5LIB
308 Usual perl lib path (semi-list).
309
310 PATH
311 Semi-list for executables.
312
313 TMP - Tempdir.
314
315 UNIXROOTPATH
316 - Root for accessing some special files, i.e. /dev/null,
317 /etc/services.
318
319 ROWS/COLS
320 - Rows/cols for console.
321
322 HOME
323 - Home directory.
324
325 CONSOLEFONTSIZE
326 - Size for console font.
327
328 You can set these with cereg.exe, a (remote) registry editor or via the
329 PerlIDE.
330
331 REGISTRY
332 To start perl by clicking on a perl source file, you have to make the
333 according entries in HKCR (see ce-helpers/wince-reg.bat). cereg.exe
334 (which must be executed on a desktop pc with ActiveSync) is reported
335 not to work on some devices. You have to create the registry entries
336 by hand using a registry editor.
337
338 XS
339 The following Win32-Methods are built-in:
340
341 newXS("Win32::GetCwd", w32_GetCwd, file);
342 newXS("Win32::SetCwd", w32_SetCwd, file);
343 newXS("Win32::GetTickCount", w32_GetTickCount, file);
344 newXS("Win32::GetOSVersion", w32_GetOSVersion, file);
345 newXS("Win32::IsWinNT", w32_IsWinNT, file);
346 newXS("Win32::IsWin95", w32_IsWin95, file);
347 newXS("Win32::IsWinCE", w32_IsWinCE, file);
348 newXS("Win32::CopyFile", w32_CopyFile, file);
349 newXS("Win32::Sleep", w32_Sleep, file);
350 newXS("Win32::MessageBox", w32_MessageBox, file);
351 newXS("Win32::GetPowerStatus", w32_GetPowerStatus, file);
352 newXS("Win32::GetOemInfo", w32_GetOemInfo, file);
353 newXS("Win32::ShellEx", w32_ShellEx, file);
354
355 BUGS
356 Opening files for read-write is currently not supported if they use
357 stdio (normal perl file handles).
358
359 If you find bugs or if it does not work at all on your device, send
360 mail to the address below. Please report the details of your device
361 (processor, ceversion, devicetype (hpc/palm/pocket)) and the date of
362 the downloaded files.
363
364 INSTALLATION
365 Currently installation instructions are at
366 <http://perlce.sourceforge.net/>.
367
368 After installation & testing processes will stabilize, information will
369 be more precise.
370
372 The port for Win32 was used as a reference.
373
375 5.6.0
376 Initial port of perl to WinCE. It was performed in separate
377 directory named wince. This port was based on contents of ./win32
378 directory. miniperl was not built, user must have HOST perl and
379 properly edit makefile.ce to reflect this.
380
381 5.8.0
382 wince port was kept in the same ./wince directory, and
383 wince/Makefile.ce was used to invoke native compiler to create HOST
384 miniperl, which then facilitates cross-compiling process.
385 Extension building support was added.
386
387 5.9.4
388 Two directories ./win32 and ./wince were merged, so perlce build
389 process comes in ./win32 directory.
390
392 Rainer Keuchel <coyxc@rainer-keuchel.de>
393 provided initial port of Perl, which appears to be most essential
394 work, as it was a breakthrough on having Perl ported at all. Many
395 thanks and obligations to Rainer!
396
397 Vadim Konovalov
398 made further support of WinCE port.
399
400 Daniel Dragan
401 updated the build process during the 5.19 development track.
402
403
404
405perl v5.26.3 2018-03-01 PERLCE(1)