1PERLSYMBIAN(1) Perl Programmers Reference Guide PERLSYMBIAN(1)
2
3
4
6 README.symbian - Perl version 5 on Symbian OS
7
9 This document describes various features of the Symbian operating
10 system that will affect how Perl version 5 (hereafter just Perl) is
11 compiled and/or runs.
12
13 NOTE: this port (as of 0.4.1) does not compile into a Symbian OS GUI
14 application, but instead it results in a Symbian DLL. The DLL includes
15 a C++ class called CPerlBase, which one can then (derive from and) use
16 to embed Perl into applications, see symbian/README.
17
18 The base port of Perl to Symbian only implements the basic POSIX-like
19 functionality; it does not implement any further Symbian or Series 60,
20 Series 80, or UIQ bindings for Perl.
21
22 It is also possible to generate Symbian executables for "miniperl" and
23 "perl", but since there is no standard command line interface for
24 Symbian (nor full keyboards in the devices), these are useful mainly as
25 demonstrations.
26
27 Compiling Perl on Symbian
28 (0) You need to have the appropriate Symbian SDK installed.
29
30 These instructions have been tested under various Nokia Series 60
31 Symbian SDKs (1.2 to 2.6, 2.8 should also work, 1.2 compiles but
32 does not work), Series 80 2.0, and Nokia 7710 (Series 90) SDK.
33 You can get the SDKs from Forum Nokia (http://www.forum.nokia.com/).
34 A very rough port ("it compiles") to UIQ 2.1 has also been made.
35
36 A prerequisite for any of the SDKs is to install ActivePerl
37 from ActiveState, http://www.activestate.com/Products/ActivePerl/
38
39 Having the SDK installed also means that you need to have either
40 the Metrowerks CodeWarrior installed (2.8 and 3.0 were used in testing)
41 or the Microsoft Visual C++ 6.0 installed (SP3 minimum, SP5 recommended).
42
43 Note that for example the Series 60 2.0 VC SDK installation talks
44 about ActivePerl build 518, which does no more (as of mid-2005) exist
45 at the ActiveState website. The ActivePerl 5.8.4 build 810 was
46 used successfully for compiling Perl on Symbian. The 5.6.x ActivePerls
47 do not work.
48
49 Other SDKs or compilers like Visual.NET, command-line-only
50 Visual.NET, Borland, GnuPoc, or sdk2unix have not been tried.
51
52 These instructions almost certainly won't work with older Symbian
53 releases or other SDKs. Patches to get this port running in other
54 releases, SDKs, compilers, platforms, or devices are naturally welcome.
55
56 (1) Get a Perl source code distribution (for example the file
57 perl-5.9.2.tar.gz is fine) from http://www.cpan.org/src/
58 and unpack it in your the C:/Symbian directory of your Windows
59 system.
60
61 (2) Change to the perl source directory.
62
63 cd c:\Symbian\perl-5.x.x
64
65 (3) Run the following script using the perl coming with the SDK
66
67 perl symbian\config.pl
68
69 You must use the cmd.exe, the Cygwin shell will not work.
70 The PATH must include the SDK tools, including a Perl,
71 which should be the case under cmd.exe. If you do not
72 have that, see the end of symbian\sdk.pl for notes of
73 how your environment should be set up for Symbian compiles.
74
75 (4) Build the project, either by
76
77 make all
78
79 in cmd.exe or by using either the Metrowerks CodeWarrior
80 or the Visual C++ 6.0, or the Visual Studio 8 (the Visual C++
81 2005 Express Edition works fine).
82
83 If you use the VC IDE, you will have to run F<symbian\config.pl>
84 first using the cmd.exe, and then run 'make win.mf vc6.mf' to generate
85 the VC6 makefiles and workspaces. "make vc6" will compile for the VC6,
86 and "make cw" for the CodeWarrior.
87
88 The following SDK and compiler configurations and Nokia phones were
89 tested at some point in time (+ = compiled and PerlApp run, - = not),
90 both for Perl 5.8.x and 5.9.x:
91
92 SDK | VC | CW |
93 --------+----+----+---
94 S60 1.2 | + | + | 3650 (*)
95 S60 2.0 | + | + | 6600
96 S60 2.1 | - | + | 6670
97 S60 2.6 | + | + | 6630
98 S60 2.8 | + | + | (not tested in a device)
99 S80 2.6 | - | + | 9300
100 S90 1.1 | + | - | 7710
101 UIQ 2.1 | - | + | (not tested in a device)
102
103 (*) Compiles but does not work, unfortunately, a problem with Symbian.
104
105 If you are using the 'make' directly, it is the GNU make from the SDKs,
106 and it will invoke the right make commands for the Windows emulator
107 build and the Arm target builds ('thumb' by default) as necessary.
108
109 The build scripts assume the 'absolute style' SDK installs under C:,
110 the 'subst style' will not work.
111
112 If using the VC IDE, to build use for example the File->Open Workspace->
113 C:\Symbian\8.0a\S60_2nd_FP2\epoc32\build\symbian\perl\perl\wins\perl.dsw
114 The emulator binaries will appear in the same directory.
115
116 If using the VC IDE, you will a lot of warnings in the beginning of
117 the build because a lot of headers mentioned by the source cannot
118 be found, but this is not serious since those headers are not used.
119
120 The Metrowerks will give a lot of warnings about unused variables and
121 empty declarations, you can ignore those.
122
123 When the Windows and Arm DLLs are built do not be scared by a very long
124 messages whizzing by: it is the "export freeze" phase where the whole
125 (rather large) API of Perl is listed.
126
127 Once the build is completed you need to create the DLL SIS file by
128
129 make perldll.sis
130
131 which will create the file perlXYZ.sis (the XYZ being the Perl version)
132 which you can then install into your Symbian device: an easy way
133 to do this is to send them via Bluetooth or infrared and just open
134 the messages.
135
136 Since the total size of all Perl SIS files once installed is
137 over 2 MB, it is recommended to do the installation into a
138 memory card (drive E:) instead of the C: drive.
139
140 The size of the perlXYZ.SIS is about 370 kB but once it is in the
141 device it is about one 750 kB (according to the application manager).
142
143 The perlXYZ.sis includes only the Perl DLL: to create an additional
144 SIS file which includes some of the standard (pure) Perl libraries,
145 issue the command
146
147 make perllib.sis
148
149 Some of the standard Perl libraries are included, but not all:
150 see L</HISTORY> or F<symbian\install.cfg> for more details
151 (250 kB -> 700 kB).
152
153 Some of the standard Perl XS extensions (see L</HISTORY> are
154 also available:
155
156 make perlext.sis
157
158 which will create perlXYZext.sis (290 kB -> 770 kB).
159
160 To compile the demonstration application PerlApp you need first to
161 install the Perl headers under the SDK.
162
163 To install the Perl headers and the class CPerlBase documentation
164 so that you no more need the Perl sources around to compile Perl
165 applications using the SDK:
166
167 make sdkinstall
168
169 The destination directory is C:\Symbian\perl\X.Y.Z. For more
170 details, see F<symbian\PerlBase.pod>.
171
172 Once the headers have been installed, you can create a SIS for
173 the PerlApp:
174
175 make perlapp.sis
176
177 The perlapp.sis (11 kB -> 16 kB) will be built in the symbian
178 subdirectory, but a copy will also be made to the main directory.
179
180 If you want to package the Perl DLLs (one for WINS, one for ARMI),
181 the headers, and the documentation:
182
183 make perlsdk.zip
184
185 which will create perlXYZsdk.zip that can be used in another
186 Windows system with the SDK, without having to compile Perl in
187 that system.
188
189 If you want to package the PerlApp sources:
190
191 make perlapp.zip
192
193 If you want to package the perl.exe and miniperl.exe, you
194 can use the perlexe.sis and miniperlexe.sis make targets.
195 You also probably want the perllib.sis for the libraries
196 and maybe even the perlapp.sis for the recognizer.
197
198 The make target 'allsis' combines all the above SIS targets.
199
200 To clean up after compilation you can use either of
201
202 make clean
203 make distclean
204
205 depending on how clean you want to be.
206
207 Compilation problems
208 If you see right after "make" this
209
210 cat makefile.sh >makefile
211 'cat' is not recognized as an internal or external command,
212 operable program or batch file.
213
214 it means you need to (re)run the symbian\config.pl.
215
216 If you get the error
217
218 'perl' is not recognized as an internal or external command,
219 operable program or batch file.
220
221 you may need to reinstall the ActivePerl.
222
223 If you see this
224
225 ren makedef.pl nomakedef.pl
226 The system cannot find the file specified.
227 C:\Symbian\...\make.exe: [rename_makedef] Error 1 (ignored)
228
229 please ignore it since it is nothing serious (the build process of
230 renames the Perl makedef.pl as nomakedef.pl to avoid confusing it with
231 a makedef.pl of the SDK).
232
233 PerlApp
234 The PerlApp application demonstrates how to embed Perl interpreters to
235 a Symbian application. The "Time" menu item runs the following Perl
236 code: "print "Running in ", $^O, "\n", scalar localtime", the
237 "Oneliner" allows one to type in Perl code, and the "Run" opens a file
238 chooser for selecting a Perl file to run.
239
240 The PerlApp also is started when the "Perl recognizer" (also included
241 and installed) detects a Perl file being activated througg the GUI, and
242 offers either to install it under \Perl (if the Perl file is in the
243 inbox of the messaging application) or to run it (if the Perl file is
244 under \Perl).
245
246 sisify.pl
247 In the symbian subdirectory there is sisify.pl utility which can be
248 used to package Perl scripts and/or Perl library directories into SIS
249 files, which can be installed to the device. To run the sisify.pl
250 utility, you will need to have the 'makesis' and 'uidcrc' utilities
251 already installed. If you don't have the Win32 SDKs, you may try for
252 example http://gnupoc.sourceforge.net/ or
253 http://symbianos.org/~andreh/.
254
255 Using Perl in Symbian
256 First of all note that you have full access to the Symbian device when
257 using Perl: you can do a lot of damage to your device (like removing
258 system files) unless you are careful. Please do take backups before
259 doing anything.
260
261 The Perl port has been done for the most part using the Symbian
262 standard POSIX-ish STDLIB library. It is a reasonably complete library,
263 but certain corners of such emulation libraries that tend to be left
264 unimplemented on non-UNIX platforms have been left unimplemented also
265 this time: fork(), signals(), user/group ids, select() working for
266 sockets, non-blocking sockets, and so forth. See the file
267 symbian/config.sh and look for 'undef' to find the unsupported APIs (or
268 from Perl use Config).
269
270 The filesystem of Symbian devices uses DOSish syntax, "drives"
271 separated from paths by a colon, and backslashes for the path. The
272 exact assignment of the drives probably varies between platforms, but
273 for example in Series 60 you might see C: as the (flash) main memory,
274 D: as the RAM drive, E: as the memory card (MMC), Z: as the ROM. In
275 Series 80 D: is the memory card. As far the devices go the NUL: is the
276 bit bucket, the COMx: are the serial lines, IRCOMx: are the IR ports,
277 TMP: might be C:\System\Temp. Remember to double those backslashes in
278 doublequoted strings.
279
280 The Perl DLL is installed in \System\Libs\. The Perl libraries and
281 extension DLLs are installed in \System\Libs\Perl\X.Y.Z\. The PerlApp
282 is installed in \System\Apps\, and the SIS also installs a couple of
283 demo scripts in \Perl\ (C:\Mydocs\Perl\ on Nokia 7710).
284
285 Note that the Symbian filesystem is very picky: it strongly prefers the
286 \ instead of the /.
287
288 When doing XS / Symbian C++ programming include first the Symbian
289 headers, then any standard C/POSIX headers, then Perl headers, and
290 finally any application headers.
291
292 New() and Copy() are unfortunately used by both Symbian and Perl code
293 so you'll have to play cpp games if you need them. PerlBase.h
294 undefines the Perl definitions and redefines them as PerlNew() and
295 PerlCopy().
296
298 Lots. See symbian\TODO.
299
301 As of Perl Symbian port version 0.4.1 any part of Perl's standard
302 regression test suite has not been run on a real Symbian device using
303 the ported Perl, so innumerable bugs may lie in wait. Therefore there
304 is absolutely no warranty.
305
307 When creating and extending application programming interfaces (APIs)
308 for Symbian or Series 60 or Series 80 or Series 90 it is suggested that
309 trademarks, registered trademarks, or trade names are not used in the
310 API names. Instead, developers should consider basing the API naming
311 in the existing (C++, or maybe Java) public component and API naming,
312 modified as appropriate by the rules of the programming language the
313 new APIs are for.
314
315 Nokia is a registered trademark of Nokia Corporation. Nokia's product
316 names are trademarks or registered trademarks of Nokia. Other product
317 and company names mentioned herein may be trademarks or trade names of
318 their respective owners.
319
321 Jarkko Hietaniemi
322
324 Copyright (c) 2004-2005 Nokia. All rights reserved.
325
326 Copyright (c) 2006-2007 Jarkko Hietaniemi.
327
329 The Symbian port is licensed under the same terms as Perl itself.
330
332 · 0.1.0: April 2005
333
334 (This will show as "0.01" in the Symbian Installer.)
335
336 - The console window is a very simple console indeed: one can
337 get the newline with "000" and the "C" button is a backspace.
338 Do not expect a terminal capable of vt100 or ANSI sequences.
339 The console is also "ASCII", you cannot input e.g. any accented
340 letters. Because of obvious physical constraints the console is
341 also very small: (in Nokia 6600) 22 columns, 17 rows.
342 - The following libraries are available:
343 AnyDBM_File AutoLoader base Carp Config Cwd constant
344 DynaLoader Exporter File::Spec integer lib strict Symbol
345 vars warnings XSLoader
346 - The following extensions are available:
347 attrs Compress::Zlib Cwd Data::Dumper Devel::Peek Digest::MD5 DynaLoader
348 Fcntl File::Glob Filter::Util::Call IO List::Util MIME::Base64
349 PerlIO::scalar PerlIO::via SDBM_File Socket Storable Time::HiRes
350 - The following extensions are missing for various technical reasons:
351 B ByteLoader Devel::DProf Devel::PPPort Encode GDBM_File
352 I18N::Langinfo IPC::SysV NDBM_File Opcode PerlIO::encoding POSIX
353 re Safe Sys::Hostname Sys::Syslog
354 threads threads::shared Unicode::Normalize
355 - Using MakeMaker or the Module::* to build and install modules
356 is not supported.
357 - Building XS other than the ones in the core is not supported.
358
359 Since this is 0.something release, any future releases are almost
360 guaranteed to be binary incompatible. As a sign of this the
361 Symbian symbol exports are kept unfrozen and the .def files fully
362 rebuilt every time.
363
364 · 0.2.0: October 2005
365
366 - Perl 5.9.3 (patch level 25741)
367 - Compress::Zlib and IO::Zlib supported
368 - sisify.pl added
369
370 We maintain the binary incompatibility.
371
372 · 0.3.0: October 2005
373
374 - Perl 5.9.3 (patch level 25911)
375 - Series 80 2.0 and UIQ 2.1 support
376
377 We maintain the binary incompatibility.
378
379 · 0.4.0: November 2005
380
381 - Perl 5.9.3 (patch level 26052)
382 - adding a sample Symbian extension
383
384 We maintain the binary incompatibility.
385
386 · 0.4.1: December 2006
387
388 - Perl 5.9.5-to-be (patch level 30002)
389 - added extensions: Compress/Raw/Zlib, Digest/SHA,
390 Hash/Util, Math/BigInt/FastCalc, Text/Soundex, Time/Piece
391 - port to S90 1.1 by alexander smishlajev
392
393 We maintain the binary incompatibility.
394
395 · 0.4.2: March 2007
396
397 - catchup with Perl 5.9.5-to-be (patch level 30812)
398 - tested to build with Microsoft Visual C++ 2005 Express Edition
399 (which uses Microsoft Visual C 8, instead of the old VC6),
400 SDK used for testing S60_2nd_FP3 aka 8.1a
401
402 We maintain the binary incompatibility.
403
404
405
406perl v5.10.1 2009-08-22 PERLSYMBIAN(1)