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