[PATCH] perlcommunity.pod: add information about OSDC.fr
[p5sagit/p5-mst-13.2.git] / symbian / config.pl
CommitLineData
27da23d5 1#!/usr/bin/perl -w
2
3# Copyright (c) 2004-2005 Nokia. All rights reserved.
a0fd4948 4# This utility is licensed under the same terms as Perl itself.
27da23d5 5
6use strict;
7use lib "symbian";
8
9print "Configuring...\n";
10print "Configuring with: Perl version $] ($^X)\n";
11
e81465be 12do "sanity.pl" or die $@;
27da23d5 13
e81465be 14my %VERSION = %{ do "version.pl" or die $@ };
27da23d5 15
16printf "Configuring for: Perl version $VERSION{REVISION}.%03d%03d\n",
17 $VERSION{VERSION}, $VERSION{SUBVERSION};
18
19my $VERSION = "$VERSION{REVISION}$VERSION{VERSION}$VERSION{SUBVERSION}";
20my $R_V_SV = "$VERSION{REVISION}.$VERSION{VERSION}.$VERSION{SUBVERSION}";
21
ed76c0e4 22my ($SYMBIAN_ROOT, $SYMBIAN_VERSION, $SDK_NAME, $SDK_VARIANT, $SDK_VERSION) =
e81465be 23 @{ do "sdk.pl" or die $@ };
24my %PORT = %{ do "port.pl" or die $@ };
27da23d5 25
ed76c0e4 26if ($SYMBIAN_ROOT eq 'C:\Symbian\Series60_1_2_CW') {
27da23d5 27 ( $SYMBIAN_VERSION, $SDK_VERSION ) = qw(6.1 1.2);
28}
29
30my $WIN = $ENV{WIN} ; # 'wins', 'winscw' (from sdk.pl)
7df62229 31my $ARM = 'thumb'; # 'thumb', 'armv5'
27da23d5 32my $S60SDK = $ENV{S60SDK}; # qw(1.2 2.0 2.1 2.6) (from sdk.pl)
7df62229 33 if ($SDK_VARIANT eq 'S60' && $S60SDK =~ /^5\./) {
34 $ARM = 'armv5'; # 'thumb', 'armv5' # Configuration for S60 5th Edition SDK v1.0
35 }
ed76c0e4 36my $S80SDK = $ENV{S80SDK}; # qw(2.0) (from sdk.pl)
53d44271 37my $S90SDK = $ENV{S90SDK}; # qw(1.1) (from sdk.pl)
25ca88e0 38my $UIQSDK = $ENV{UIQSDK}; # qw(2.0 2.1) (from sdk.pl)
27da23d5 39
40my $UREL = $ENV{UREL}; # from sdk.pl
41$UREL =~ s/-ARM-/$ARM/;
42my $UARM = $ENV{UARM}; # from sdk.pl
43
44die "$0: SDK not recognized\n"
ed76c0e4 45 if !defined($SYMBIAN_VERSION) ||
46 !defined($SDK_VERSION) ||
53d44271 47 (!defined($S60SDK) && !defined($S80SDK) && !defined($S90SDK) && !defined($UIQSDK));
27da23d5 48
49die "$0: does not know which Windows compiler to use\n"
50 unless defined $WIN;
51
ed76c0e4 52print "Symbian $SYMBIAN_VERSION SDK $SDK_VARIANT $SDK_VERSION ($WIN) installed at $SYMBIAN_ROOT\n";
27da23d5 53
e81465be 54my $CWD = do "cwd.pl" or die $@;
27da23d5 55print "Build directory $CWD\n";
56
ed76c0e4 57die "$0: '+' in cwd does not work with Series 60 SDK 1.2\n"
58 if defined $S60SDK && $S60SDK eq '1.2' && $CWD =~ /\+/;
27da23d5 59
60my @unclean;
61my @mmp;
62
63sub create_mmp {
64 my ( $target, $type, @x ) = @_;
65 my $miniperl = $target eq 'miniperl';
66 my $perl = $target eq 'perl';
67 my $mmp = "$target.mmp";
68 my $targetpath = $miniperl
69 || $perl ? "TARGETPATH\t\\System\\Apps\\Perl" : "";
70 if ( open( my $fh, ">$mmp" ) ) {
71 print "\t$mmp\n";
72 push @mmp, $mmp;
73 push @unclean, $mmp;
74 print $fh <<__EOF__;
75TARGET $target.$type
76TARGETTYPE $type
7df62229 77__EOF__
78 if ($SDK_VARIANT eq 'S60' && $S60SDK =~ /^5\./) {
79 print $fh "UID\t0 0xEA3E9181\n" if $miniperl;
80 print $fh "UID\t0 0xED04DD86\n" if $perl;
81 print $fh "UID\t0x1000008d 0xE8667302\n" unless $miniperl || $perl;
82 print $fh "CAPABILITY\tNONE\n";
83 } else {
84 print $targetpath;
85 print $fh "EPOCHEAPSIZE\t1024 8388608";
86 print $fh "EPOCSTACKSIZE\t65536";
87 }
88 print $fh <<__EOF__;
27da23d5 89EXPORTUNFROZEN
90SRCDBG
91__EOF__
ed76c0e4 92 if ($SDK_VARIANT eq 'S60') {
7df62229 93 print $fh "MACRO\t__SERIES60__\n";
94 print $fh "MACRO\t__SERIES60_1X__\n" if $S60SDK =~ /^1\./;
95 print $fh "MACRO\t__SERIES60_2X__\n" if $S60SDK =~ /^2\./;
96 print $fh "MACRO\t__SERIES60_3X__\n" if $S60SDK =~ /^5\./;
ed76c0e4 97 }
98 if ($SDK_VARIANT eq 'S80') {
99 print $fh "MACRO\t__SERIES80__\n";
100 print $fh "MACRO\t__SERIES80_1X__\n" if $S80SDK =~ /^1\./;
101 print $fh "MACRO\t__SERIES80_2X__\n" if $S80SDK =~ /^2\./;
102 }
53d44271 103 if ($SDK_VARIANT eq 'S90') {
104 print $fh "MACRO\t__SERIES90__\n";
105 }
25ca88e0 106 if ($SDK_VARIANT eq 'UIQ') {
107 print $fh "MACRO\t__UIQ__\n";
108 print $fh "MACRO\t__UIQ_1X__\n" if $UIQSDK =~ /^1\./;
109 print $fh "MACRO\t__UIQ_2X__\n" if $UIQSDK =~ /^2\./;
110 }
27da23d5 111 my ( @c, %c );
112 @c = map { glob } qw(*.c); # Find the .c files.
113 @c = map { lc } @c; # Lowercase the names.
114 @c = grep { !/malloc\.c/ } @c; # Use the system malloc.
53d44271 115 @c = grep { !/madly\.c/ } @c; # mad is undef.
27da23d5 116 @c = grep { !/main\.c/ } @c; # main.c must be explicit.
117 push @c, map { lc } @x;
118 @c = map { s:^\.\./::; $_ } @c; # Remove the leading ../
119 @c = map { $c{$_}++ } @c; # Uniquefy.
120 @c = sort keys %c; # Beautify.
121
122 for (@c) {
123 print $fh "SOURCE\t\t$_\n";
124 }
125 print $fh <<__EOF__;
126SOURCEPATH $CWD
127USERINCLUDE $CWD
128USERINCLUDE $CWD\\ext\\DynaLoader
129USERINCLUDE $CWD\\symbian
130SYSTEMINCLUDE \\epoc32\\include\\libc
131SYSTEMINCLUDE \\epoc32\\include
132LIBRARY euser.lib
133LIBRARY estlib.lib
d0d72822 134LIBRARY eikcore.lib
135LIBRARY cone.lib
136LIBRARY efsrv.lib
27da23d5 137__EOF__
138 if ( $miniperl || $perl || $type eq 'dll' ) {
139 print $fh <<__EOF__;
140LIBRARY charconv.lib
27da23d5 141LIBRARY hal.lib
142LIBRARY estor.lib
143__EOF__
144 }
53d44271 145 if ($SDK_VARIANT =~ /^S[689]0$/) {
25ca88e0 146 print $fh <<__EOF__;
147LIBRARY commonengine.lib
148__EOF__
149 }
d0d72822 150 if (defined $S60SDK) {
151 print $fh <<__EOF__;
152LIBRARY avkon.lib
153LIBRARY commondialogs.lib
154__EOF__
155 }
53d44271 156 if ((defined $S80SDK) or (defined $S90SDK)) {
d0d72822 157 print $fh <<__EOF__;
158LIBRARY eikctl.lib
159LIBRARY eikcoctl.lib
160LIBRARY eikdlg.lib
161LIBRARY ckndlg.lib
162__EOF__
163 }
164 if (defined $UIQSDK) {
165 print $fh <<__EOF__;
166LIBRARY eikctl.lib
167LIBRARY eikcoctl.lib
168LIBRARY eikdlg.lib
169LIBRARY qikctl.lib
170__EOF__
171 }
27da23d5 172 if ( $type eq 'exe' ) {
173 print $fh <<__EOF__;
174STATICLIBRARY ecrt0.lib
175__EOF__
176 }
177 if ($miniperl) {
178 print $fh <<__EOF__;
179MACRO PERL_MINIPERL
180__EOF__
181 }
182 if ($perl) {
183 print $fh <<__EOF__;
184MACRO PERL_PERL
185__EOF__
186 }
187 print $fh <<__EOF__;
188MACRO PERL_CORE
189MACRO MULTIPLICITY
190MACRO PERL_IMPLICIT_CONTEXT
191__EOF__
192 unless ( $miniperl || $perl ) {
193 print $fh <<__EOF__;
194MACRO PERL_GLOBAL_STRUCT
195MACRO PERL_GLOBAL_STRUCT_PRIVATE
196__EOF__
7df62229 197 }
198 unless ($miniperl || $perl ) {
199 if ($SDK_VARIANT eq 'S60' && $S60SDK =~ /^5\./) {
200 print $fh "START RESOURCE\tsymbian\\PerlUi.rss\nEND\n";
201 } else {
202 print $fh "RESOURCE\tsymbian\\PerlUi.rss";
203 }
204 }
27da23d5 205 close $fh;
206 }
207 else {
208 warn "$0: failed to open $mmp for writing: $!\n";
209 }
210}
211
212sub create_bld_inf {
213 if ( open( BLD_INF, ">bld.inf" ) ) {
214 print "\tbld.inf\n";
215 push @unclean, "bld.inf";
216 print BLD_INF <<__EOF__;
217PRJ_PLATFORMS
218${WIN} ${ARM}
219PRJ_MMPFILES
220__EOF__
221 for (@mmp) { print BLD_INF $_, "\n" }
222 close BLD_INF;
223 }
224 else {
225 warn "$0: failed to open bld.inf for writing: $!\n";
226 }
227}
228
229my %config;
230
231sub load_config_sh {
232 if ( open( CONFIG_SH, "symbian/config.sh" ) ) {
233 while (<CONFIG_SH>) {
234 if (/^(\w+)=['"]?(.*?)["']?$/) {
235 my ( $var, $val ) = ( $1, $2 );
236 $val =~ s/x.y.z/$R_V_SV/gi;
237 $val =~ s/thumb/$ARM/gi;
53d44271 238 $val = "C:$val" if (defined($S90SDK) and ($val =~ /^(\/|\\\\)system[\/\\]/i));
27da23d5 239 $val = "'$SYMBIAN_VERSION'" if $var eq 'osvers';
240 $val = "'$SDK_VERSION'" if $var eq 'sdkvers';
241 $config{$var} = $val;
242 }
243 }
244 close CONFIG_SH;
245 }
246 else {
247 warn "$0: failed to open symbian\\config.sh for reading: $!\n";
248 }
249}
250
251sub create_config_h {
252 load_config_sh();
253 if ( open( CONFIG_H, ">config.h" ) ) {
254 print "\tconfig.h\n";
255 push @unclean, "config.h";
256 if ( open( CONFIG_H_SH, "config_h.SH" ) ) {
257 while (<CONFIG_H_SH>) {
258 last if /\#ifndef _config_h_/;
259 }
260 print CONFIG_H <<__EOF__;
261/*
262 * Package name : perl
263 * Source directory : .
264 * Configuration time:
265 * Configured by :
266 * Target system : symbian
267 */
268
269#ifndef _config_h_
270__EOF__
271 while (<CONFIG_H_SH>) {
272 last if /!GROK!THIS/;
d0d72822 273 s/\$(\w+)/exists $config{$1} ? $config{$1} : (warn "$0: config.sh missing '$1'\n", "")/eg;
27da23d5 274 s/^#undef\s+(\S+).+/#undef $1/g;
275 s:\Q/**/::;
276 print CONFIG_H;
277 }
278 close CONFIG_H_SH;
279 }
280 else {
281 warn "$0: failed to open ../config_h.SH for reading: $!\n";
282 }
283 close CONFIG_H;
284 }
285 else {
286 warn "$0: failed to open config.h for writing: $!\n";
287 }
288}
289
290sub create_DynaLoader_cpp {
291 print "\text\\DynaLoader\\DynaLoader.cpp\n";
292 system(
53d44271 293q[xsubpp ext\DynaLoader\dl_symbian.xs >ext\DynaLoader\DynaLoader.cpp]
27da23d5 294 ) == 0
295 or die "$0: creating DynaLoader.cpp failed: $!\n";
296 push @unclean, 'ext\DynaLoader\DynaLoader.cpp';
297
298}
299
300sub create_symbian_port_h {
301 print "\tsymbian\\symbian_port.h\n";
302 if ( open( SYMBIAN_PORT_H, ">symbian/symbian_port.h" ) ) {
ed76c0e4 303 my ($sdkmajor, $sdkminor);
304 if ($SDK_VARIANT eq 'S60') {
305 $S60SDK =~ /^(\d+)\.(\d+)$/;
306 ($sdkmajor, $sdkminor) = ($1, $2);
307 }
308 if ($SDK_VARIANT eq 'S80') {
309 $S80SDK =~ /^(\d+)\.(\d+)$/;
310 ($sdkmajor, $sdkminor) = ($1, $2);
311 }
53d44271 312 if ($SDK_VARIANT eq 'S90') {
313 $S90SDK =~ /^(\d+)\.(\d+)$/;
314 ($sdkmajor, $sdkminor) = ($1, $2);
315 }
25ca88e0 316 if ($SDK_VARIANT eq 'UIQ') {
317 $UIQSDK =~ /^(\d+)\.(\d+)$/;
318 ($sdkmajor, $sdkminor) = ($1, $2);
319 }
27da23d5 320 print SYMBIAN_PORT_H <<__EOF__;
321/* Copyright (c) 2004-2005, Nokia. All rights reserved. */
322
323#ifndef __symbian_port_h__
324#define __symbian_port_h__
325
326#define PERL_SYMBIANPORT_MAJOR $PORT{dll}->{MAJOR}
327#define PERL_SYMBIANPORT_MINOR $PORT{dll}->{MINOR}
328#define PERL_SYMBIANPORT_PATCH $PORT{dll}->{PATCH}
329
ed76c0e4 330#define PERL_SYMBIANSDK_FLAVOR L"$SDK_VARIANT"
27da23d5 331#define PERL_SYMBIANSDK_MAJOR $sdkmajor
332#define PERL_SYMBIANSDK_MINOR $sdkminor
333
334#endif /* #ifndef __symbian_port_h__ */
335__EOF__
336 close(SYMBIAN_PORT_H);
337 push @unclean, 'symbian\symbian_port.h';
338 }
339 else {
340 warn "$0: failed to open symbian/symbian_port.h for writing: $!\n";
341 }
342}
343
344sub create_perlmain_c {
345 print "\tperlmain.c\n";
346 system(
53d44271 347q[perl -ne "print qq[ char *file = __FILE__;\n] if /dXSUB_SYS/;print unless /PERL_UNUSED_CONTEXT/;print qq[ newXS(\"DynaLoader::boot_DynaLoader\", boot_DynaLoader, file);\n] if /dXSUB_SYS/;print qq[EXTERN_C void boot_DynaLoader (pTHX_ CV* cv);\n] if /Do not delete this line/" miniperlmain.c > perlmain.c]
27da23d5 348 ) == 0
349 or die "$0: Creating perlmain.c failed: $!\n";
350 push @unclean, 'perlmain.c';
351}
352
353sub create_PerlApp_pkg {
354 print "\tsymbian\\PerlApp.pkg\n";
355 if ( open( PERLAPP_PKG, ">symbian\\PerlApp.pkg" ) ) {
ed76c0e4 356 my $ProductId =
357 defined $S60SDK ?
358qq[;Supports Series 60 v0.9\n(0x101F6F88), 0, 0, 0, {"Series60ProductID"}\n] :
359 defined $S80SDK ?
360qq[;Supports Series 80 v2.0\n(0x101F8ED2), 0, 0, 0, {"Series80ProductID"}\n] :
53d44271 361 defined $S90SDK ?
362qq[;Supports Series 90 v1.1\n(0x101FBE05), 0, 0, 0, {"Series90ProductID"}\n] :
25ca88e0 363 defined $UIQSDK && $SDK_VERSION =~ /^(\d)\.(\d)$/ ?
364qq[;Supports UIQ v2.1\n(0x101F617B), $1, $2, 0, {"UIQ21ProductID"}\n] :
ed76c0e4 365 ";Supports Series NN";
27da23d5 366 my $APPS = $UREL;
53d44271 367 if (($SDK_VARIANT eq 'S60' && $SDK_VERSION ne '1.2' || $WIN eq 'winscw') || defined $S80SDK || defined $S90SDK) { # Do only if not in S60 1.2 VC.
27da23d5 368 $APPS =~ s!\\epoc32\\release\\(.+)\\$UARM$!\\epoc32\\data\\z\\system\\apps\\PerlApp!i;
369 }
db5886f1 370 # TODO: in S60 3.0 there will be no more recognizers.
ed76c0e4 371 my $mdl = qq["$UREL\\PerlRecog.mdl"-"!:\\system\\recogs\\PerlRecog.mdl";];
53d44271 372 my $AIF = $SDK_VARIANT =~ /^S[689]0/ ? qq["$APPS\\PerlApp.aif"-"!:\\system\\apps\\PerlApp\\PerlApp.aif"] : "";
27da23d5 373 print PERLAPP_PKG <<__EOF__;
374; !!!!!! DO NOT EDIT THIS FILE !!!!!!
375; This file is built by symbian\\config.pl.
376; Any changes made here will be lost!
377;
378; PerlApp.pkg
379;
380; Note that the demo_pl needs to be run to create the demo .pl scripts.
381;
382; Languages
383&EN;
384
385; Standard SIS file header
f26f4a2f 386#{"PerlApp"},(0x102015F6),0,2,0
27da23d5 387
ed76c0e4 388$ProductId
27da23d5 389
390; Files
391"$UREL\\PerlApp.APP"-"!:\\system\\apps\\PerlApp\\PerlApp.app"
ed76c0e4 392$mdl
27da23d5 393"$APPS\\PerlApp.rsc"-"!:\\system\\apps\\PerlApp\\PerlApp.rsc"
db5886f1 394$AIF
27da23d5 395__EOF__
396 if ( open( DEMOS, "perl symbian\\demo_pl list |" ) ) {
397 while (<DEMOS>) {
398 chomp;
53d44271 399 if (defined $S90SDK) {
400 print PERLAPP_PKG qq["$_"-"!:\\Mydocs\\Perl\\$_"\n];
401 } else {
402 print PERLAPP_PKG qq["$_"-"!:\\Perl\\$_"\n];
403 }
27da23d5 404 }
405 close(DEMOS);
406 }
407 close(PERLAPP_PKG);
408 }
409 else {
410 die "$0: symbian\\PerlApp.pkg: $!\n";
411 }
412 push @unclean, 'symbian\PerlApp.pkg';
413}
414
415print "Creating...\n";
416create_mmp(
417 'miniperl', 'exe',
418 'miniperlmain.c', 'symbian\symbian_stubs.c',
c8f896e5 419 'symbian\PerlBase.cpp',
d0d72822 420 'symbian\PerlUi.cpp',
c8f896e5 421 'symbian\PerlUtil.cpp',
422 'symbian\symbian_utils.cpp',
27da23d5 423);
424create_mmp(
425 "perl", 'exe',
426 'perlmain.c', 'symbian\symbian_stubs.c',
d0d72822 427 'symbian\symbian_utils.cpp',
428 'symbian\PerlBase.cpp',
429 'symbian\PerlUi.cpp',
c8f896e5 430 'symbian\PerlUtil.cpp',
27da23d5 431 'ext\DynaLoader\DynaLoader.cpp',
432);
433
434create_mmp(
435 "perl$VERSION", 'dll',
436 'symbian\symbian_dll.cpp', 'symbian\symbian_stubs.c',
d0d72822 437 'symbian\symbian_utils.cpp',
438 'symbian\PerlBase.cpp',
439 'symbian\PerlUi.cpp',
c8f896e5 440 'symbian\PerlUtil.cpp',
27da23d5 441 'ext\DynaLoader\DynaLoader.cpp',
442);
443
444create_bld_inf();
445create_config_h();
446create_perlmain_c();
447create_symbian_port_h();
448create_DynaLoader_cpp();
449create_PerlApp_pkg();
450
451if ( open( PERLAPP_MMP, ">symbian/PerlApp.mmp" ) ) {
452 my @MACRO;
ed76c0e4 453 my @LIB;
d0d72822 454 push @MACRO, 'PERL_IMPLICIT_CONTEXT';
455 push @MACRO, 'MULTIPLICITY';
ed76c0e4 456 if (defined $S60SDK) {
457 push @MACRO, '__SERIES60__';
458 push @MACRO, '__SERIES60_1X__' if $S60SDK =~ /^1\./;
459 push @MACRO, '__SERIES60_2X__' if $S60SDK =~ /^2\./;
460 push @LIB, <<__EOF__;
461LIBRARY avkon.lib
462LIBRARY commondialogs.lib
463__EOF__
464 }
465 if (defined $S80SDK) {
466 push @MACRO, '__SERIES80__';
467 push @MACRO, '__SERIES80_1X__' if $S80SDK =~ /^1\./;
468 push @MACRO, '__SERIES80_2X__' if $S80SDK =~ /^2\./;
469 push @LIB, <<__EOF__;
470LIBRARY eikctl.lib
471LIBRARY eikcoctl.lib
c7a4d1c0 472LIBRARY eikdlg.lib
ed76c0e4 473LIBRARY ckndlg.lib
474__EOF__
475 }
53d44271 476 if (defined $S90SDK) {
477 push @MACRO, '__SERIES90__';
478 push @LIB, <<__EOF__;
479LIBRARY eikctl.lib
480LIBRARY eikcoctl.lib
481LIBRARY eikdlg.lib
482LIBRARY ckndlg.lib
483__EOF__
484 }
25ca88e0 485 if (defined $UIQSDK) {
486 push @MACRO, '__UIQ__';
487 push @MACRO, '__UIQ_1X__' if $UIQSDK =~ /^1\./;
488 push @MACRO, '__UIQ_2X__' if $UIQSDK =~ /^2\./;
489 push @LIB, <<__EOF__;
490LIBRARY eikctl.lib
491LIBRARY eikcoctl.lib
492LIBRARY eikdlg.lib
493LIBRARY qikctl.lib
494__EOF__
495 }
27da23d5 496 print PERLAPP_MMP <<__EOF__;
497// !!!!!! DO NOT EDIT THIS FILE !!!!!!
498// This file is built by symbian\\config.pl.
499// Any changes made here will be lost!
500TARGET PerlApp.app
501TARGETTYPE app
502UID 0x100039CE 0x102015F6
503TARGETPATH \\system\\apps\\PerlApp
504SRCDBG
505EXPORTUNFROZEN
506SOURCEPATH .
507SOURCE PerlApp.cpp
508
27da23d5 509USERINCLUDE .
510USERINCLUDE ..
511USERINCLUDE \\symbian\\perl\\$R_V_SV\\include
512
513SYSTEMINCLUDE \\epoc32\\include
514SYSTEMINCLUDE \\epoc32\\include\\libc
515
516LIBRARY apparc.lib
27da23d5 517LIBRARY bafl.lib
518LIBRARY charconv.lib
d0d72822 519LIBRARY cone.lib
27da23d5 520LIBRARY efsrv.lib
d0d72822 521LIBRARY eikcore.lib
27da23d5 522LIBRARY estlib.lib
523LIBRARY euser.lib
524LIBRARY perl$VERSION.lib
ed76c0e4 525@LIB
d0d72822 526RESOURCE perlapp.rss
27da23d5 527__EOF__
528 if (@MACRO) {
529 for my $macro (@MACRO) {
530 print PERLAPP_MMP <<__EOF__;
531MACRO $macro
532__EOF__
533 }
534 }
53d44271 535 if ($SDK_VARIANT =~ /^S[689]0$/) {
25ca88e0 536 print PERLAPP_MMP <<__EOF__;
537AIF PerlApp.aif . PerlAppAif.rss
538__EOF__
539 }
27da23d5 540 close(PERLAPP_MMP);
541 push @unclean, 'symbian\PerlApp.mmp';
542}
543else {
544 warn "$0: failed to create symbian\\PerlApp.mmp";
545}
546
547if ( open( MAKEFILE, ">Makefile" ) ) {
548 my $perl = "perl$VERSION";
ed76c0e4 549 my $windef1 = "$SYMBIAN_ROOT\\Epoc32\\Build$CWD\\$perl\\$WIN\\$perl.def";
27da23d5 550 my $windef2 = "..\\BWINS\\${perl}u.def";
ed76c0e4 551 my $armdef1 = "$SYMBIAN_ROOT\\Epoc32\\Build$CWD\\$perl\\$ARM\\$perl.def";
27da23d5 552 my $armdef2 = "..\\BMARM\\${perl}u.def";
d0d72822 553 my $MF = $WIN eq 'wins' ? 'vc6' : $WIN eq 'winscw' ? 'cw_ide' : "UNKNOWN";
27da23d5 554 print "\tMakefile\n";
555 print MAKEFILE <<__EOF__;
556help:
557 \@echo === Perl for Symbian ===
558 \@echo Useful targets:
559 \@echo all win arm clean
560 \@echo perldll.sis perlext.sis perlsdk.zip
561
562WIN = ${WIN}
563ARM = ${ARM}
564
565all: build
566
ed76c0e4 567build: rename_makedef build_${WIN} build_arm
27da23d5 568
569@unclean: symbian\\config.pl
570 perl symbian\\config.pl
571
d0d72822 572build_${WIN}: abld.bat perldll_${WIN}
ed76c0e4 573
d0d72822 574build_vc6: abld.bat perldll_wins
27da23d5 575
d0d72822 576build_vc7: abld.bat perldll_wins
c7a4d1c0 577
d0d72822 578build_cw: abld.bat perldll_winscw
27da23d5 579
d0d72822 580build_arm: abld.bat perl_arm miniperl_arm perldll_arm
27da23d5 581
d0d72822 582miniperl_win miniperl_${WIN}: miniperl.mmp abld.bat rename_makedef
ed76c0e4 583 abld build ${WIN} udeb miniperl
27da23d5 584
d0d72822 585miniperl_arm: miniperl.mmp abld.bat rename_makedef
27da23d5 586 abld build \$(ARM) $UARM miniperl
587
ed76c0e4 588miniperl: miniperl_${WIN} miniperl_arm
27da23d5 589
ed76c0e4 590perl: perl_${WIN} perl_arm
27da23d5 591
d0d72822 592perl_win perl_${WIN}: perl.mmp abld.bat rename_makedef
ed76c0e4 593 abld build ${WIN} perl
27da23d5 594
d0d72822 595perl_arm: perl.mmp abld.bat rename_makedef
27da23d5 596 abld build \$(ARM) $UARM perl
597
ed76c0e4 598perldll_win perldll_${WIN}: perl${VERSION}_${WIN} freeze_${WIN} perl${VERSION}_${WIN}
27da23d5 599
ed76c0e4 600perl${VERSION}_win perl${VERSION}_${WIN}: perl$VERSION.mmp abld.bat rename_makedef
601 abld build ${WIN} perl$VERSION
27da23d5 602
603perldll_arm: perl${VERSION}_arm freeze_arm perl${VERSION}_arm
604
d0d72822 605perl${VERSION}_arm: perl$VERSION.mmp abld.bat rename_makedef
27da23d5 606 abld build \$(ARM) $UARM perl$VERSION
607
ed76c0e4 608perldll perl$VERSION: perldll_${WIN} perldll_arm
27da23d5 609
ed76c0e4 610win ${WIN}: miniperl_${WIN} perl_${WIN} perldll_${WIN}
27da23d5 611
ed76c0e4 612thumb arm: miniperl_arm perl_arm perldll_arm
27da23d5 613
614rename_makedef:
615 -ren makedef.pl nomakedef.pl
616
617# Symbian SDK has a makedef.pl of its own,
618# and we don't need Perl's.
619rerename_makedef:
620 -ren nomakedef.pl makedef.pl
621
d0d72822 622symbian\\PerlUi.rss: symbian\\PerlUi$SDK_VARIANT.rss
623 copy symbian\\PerlUi$SDK_VARIANT.rss symbian\\PerlUi.rss
27da23d5 624
d0d72822 625abld.bat abld: bld.inf symbian\\PerlUi.rss
626 bldmake bldfiles
27da23d5 627
628vc6: win.mf vc6.mf build_vc6
629
c7a4d1c0 630vc7: win.mf vc7.mf build_vc7
631
ed76c0e4 632cw: win.mf cw.mf build_cw
27da23d5 633
ed76c0e4 634${WIN}_miniperl.mf: abld.bat symbian\\config.pl
d0d72822 635 abld makefile ${MF} miniperl
ed76c0e4 636 echo > ${WIN}_miniperl.mf
27da23d5 637
ed76c0e4 638${WIN}_perl.mf: abld.bat symbian\\config.pl
d0d72822 639 abld makefile ${MF} perl
ed76c0e4 640 echo > ${WIN}_perl.mf
27da23d5 641
ed76c0e4 642${WIN}_${VERSION}.mf: abld.bat symbian\\config.pl
d0d72822 643 abld makefile ${MF} perl${VERSION}
ed76c0e4 644 echo > ${WIN}_${VERSION}.mf
27da23d5 645
ed76c0e4 646symbian\\${WIN}.mf:
647 cd symbian; make ${WIN}.mf
648
649${WIN}.mf: ${WIN}_miniperl.mf ${WIN}_perl.mf ${WIN}_${VERSION}.mf symbian\\${WIN}.mf
27da23d5 650
651arm_miniperl.mf: abld.bat symbian\\config.pl
27da23d5 652 echo > arm_miniperl.mf
653
654arm_perl.mf: abld.bat symbian\\config.pl
27da23d5 655 echo > arm_perl.mf
656
657arm_${VERSION}.mf: abld.bat symbian\\config.pl
27da23d5 658 echo > arm_${VERSION}.mf
659
660arm.mf: arm_miniperl.mf arm_perl.mf arm_${VERSION}.mf
661
ed76c0e4 662win.mf: vc6.mf cw.mf
663 echo > win.mf
664
27da23d5 665vc6.mf: abld.bat symbian\\config.pl
666 abld makefile vc6
667 echo > vc6.mf
668
c7a4d1c0 669vc7.mf: abld.bat symbian\\config.pl
670 abld makefile vc7
671 echo > vc7.mf
672
ed76c0e4 673cw.mf: abld.bat symbian\\config.pl
674 abld makefile cw_ide
675 echo > cw.mf
676
27da23d5 677PM = lib\\Config.pm lib\\Cross.pm lib\\lib.pm ext\\DynaLoader\\DynaLoader.pm ext\\DynaLoader\\XSLoader.pm ext\\Errno\\Errno.pm
678POD = lib\\Config.pod
679
680pm: \$(PM)
681
682XLIB = -Ixlib\\symbian
683
684XSBOPT = --win=\$(WIN) --arm=\$(ARM)
685
686lib\\Config.pm:
687 copy symbian\\config.sh config.sh
53d44271 688__EOF__
689 if (defined $S90SDK) {
690 print MAKEFILE <<__EOF__;
691 perl -pi.bak -e "s:x\\.y\\.z+:$R_V_SV:g; s!='(\\\\\\\\system)!='C:\\1!" config.sh
692__EOF__
693 } else {
694 print MAKEFILE <<__EOF__;
27da23d5 695 perl -pi.bak -e "s:x\\.y\\.z+:$R_V_SV:g" config.sh
53d44271 696__EOF__
697 };
698 print MAKEFILE <<__EOF__;
27da23d5 699 perl \$(XLIB) configpm --cross=symbian
700 copy xlib\\symbian\\Config.pm lib\\Config.pm
701 perl -pi.bak -e "s:x\\.y\\.z:$R_V_SV:g" lib\\Config.pm
702 perl -pi.bak -e "s:5\\.\\d+\\.\\d+:$R_V_SV:g" lib\\Config.pm
703 -perl -pi.bak -e "s:x\\.y\\.z:$R_V_SV:g" xlib\\symbian\\Config_heavy.pl
704
705lib\\lib.pm:
706 perl lib\\lib_pm.PL
707
708ext\\DynaLoader\\DynaLoader.pm:
709 -del /f ext\\DynaLoader\\DynaLoader.pm
710 perl -Ixlib\\symbian ext\\DynaLoader\\DynaLoader_pm.PL
711 perl -pi.bak -e "s/__END__//" DynaLoader.pm
712 copy /y DynaLoader.pm ext\\DynaLoader\\DynaLoader.pm
713 -del /f DynaLoader.pm DynaLoader.pm.bak
714
715ext\\DynaLoader\\XSLoader.pm:
716 perl \$(XLIB) symbian\\xsbuild.pl \$(XSBOPT) XSLoader
717
718ext\\Errno\\Errno.pm:
719 perl \$(XLIB) symbian\\xsbuild.pl \$(XSBOPT) Errno
720
721miniperlexe.sis: miniperl_arm symbian\\makesis.pl
722 perl \$(XLIB) symbian\\makesis.pl miniperl
723
724perlexe.sis: perl_arm symbian\\makesis.pl
725 perl \$(XLIB) symbian\\makesis.pl perl
726
727
728allsis: all miniperlexe.sis perlexe.sis perldll.sis perllib.sis perlext.sis perlapp.sis
729
730perldll.sis perl$VERSION.sis: perldll_arm pm symbian\\makesis.pl
731 perl \$(XLIB) symbian\\makesis.pl perl${VERSION}dll
732
c8f896e5 733perl${VERSION}lib.sis perllib.sis: \$(PM)
27da23d5 734 perl \$(XLIB) symbian\\makesis.pl perl${VERSION}lib
735
c8f896e5 736perl${VERSION}ext.sis perlext.sis: perldll_arm buildext_sis
27da23d5 737 perl symbian\\makesis.pl perl${VERSION}ext
738
48462a74 739EXT = Compress::Raw::Zlib Cwd Data::Dumper Devel::Peek Digest::MD5 Errno Fcntl File::Glob Filter::Util::Call IO List::Util MIME::Base64 PerlIO::scalar PerlIO::via SDBM_File Socket Storable Time::HiRes XSLoader attributes
27da23d5 740
c042ae3a 741buildext: perldll symbian\\xsbuild.pl lib\\Config.pm
27da23d5 742 perl \$(XLIB) symbian\\xsbuild.pl \$(XSBOPT) \$(EXT)
743
25ca88e0 744buildextcpp: perldll symbian\\xsbuild.pl lib\\Config.pm
745 perl \$(XLIB) symbian\\xsbuild.pl --csuffix .cpp \$(XSBOPT) \$(EXT)
746
c042ae3a 747buildext_sis: perldll.sis symbian\\xsbuild.pl lib\\Config.pm
27da23d5 748 perl \$(XLIB) symbian\\xsbuild.pl \$(XSBOPT) --sis \$(EXT)
749
25ca88e0 750buildextcpp_sis: perldll.sis symbian\\xsbuild.pl lib\\Config.pm
751 perl \$(XLIB) symbian\\xsbuild.pl --csuffix .cpp \$(XSBOPT) --sis \$(EXT)
752
27da23d5 753cleanext: symbian\\xsbuild.pl
754 perl \$(XLIB) symbian\\xsbuild.pl \$(XSBOPT) --clean \$(EXT)
755
756distcleanext: symbian\\xsbuild.pl
757 perl \$(XLIB) symbian\\xsbuild.pl \$(XSBOPT) --distclean \$(EXT)
758
759sis makesis: miniperl perl perldll pm buildext perlapp.sis
760 perl \$(XLIB) symbian\\makesis.pl
761
762APIDIR = \\Symbian\\perl\\$R_V_SV
763
764sdkinstall:
765 -mkdir \\Symbian\\perl
766 -mkdir \\Symbian\\perl\\$R_V_SV
767 -mkdir \$(APIDIR)\\include
768 -mkdir \$(APIDIR)\\include\\symbian
769 -mkdir \$(APIDIR)\\lib
770 -mkdir \$(APIDIR)\\lib\\ExtUtils
771 -mkdir \$(APIDIR)\\pod
772 -mkdir \$(APIDIR)\\bin
773 -mkdir \$(BINDIR)
774 copy /y *.h \$(APIDIR)\\include
25ca88e0 775 -copy /y *.inc \$(APIDIR)\\include
27da23d5 776 copy /y lib\\ExtUtils\\xsubpp \$(APIDIR)\\lib\\ExtUtils
777 copy /y lib\\ExtUtils\\typemap \$(APIDIR)\\lib\\ExtUtils
c8f896e5 778 copy /y lib\\ExtUtils\\ParseXS.pm \$(APIDIR)\\lib\\ExtUtils
27da23d5 779 copy /y symbian\\xsbuild.pl \$(APIDIR)\\bin
c8f896e5 780 copy /y symbian\\sisify.pl \$(APIDIR)\\bin
27da23d5 781 copy /y symbian\\PerlBase.h \$(APIDIR)\\include
d0d72822 782 copy /y symbian\\PerlUi.h \$(APIDIR)\\include
c8f896e5 783 copy /y symbian\\PerlUtil.h \$(APIDIR)\\include
27da23d5 784 copy /y symbian\\symbian*.h \$(APIDIR)\\include\\symbian
785 copy /y symbian\\PerlBase.pod \$(APIDIR)\\pod
c8f896e5 786 copy /y symbian\\PerlUtil.pod \$(APIDIR)\\pod
27da23d5 787
ed76c0e4 788RELDIR = $SYMBIAN_ROOT\\epoc32\\release
27da23d5 789RELWIN = \$(RELDIR)\\\$(WIN)\\udeb
790RELARM = \$(RELDIR)\\\$(ARM)\\$UARM
c8f896e5 791SDKZIP = perl${VERSION}sdk.zip
27da23d5 792
c8f896e5 793
794\$(SDKZIP) perlsdk.zip: perldll sdkinstall
795 -del /f perl${VERSION}sdk.zip
27da23d5 796 zip -r perl${VERSION}sdk.zip \$(RELWIN)\\perl$VERSION.* \$(RELARM)\\perl$VERSION.* \$(APIDIR)
797 \@echo perl${VERSION}sdk.zip created.
798
c8f896e5 799PERLSIS = perl${VERSION}.SIS perl${VERSION}lib.SIS perl${VERSION}ext.SIS
800ALLSIS = \$(PERLSIS) perlapp.sis
801ETC = README.symbian symbian\\PerlBase.pod symbian\\PerlUtil.pod symbian\\sisify.pl symbian\\TODO
802
803perl${VERSION}dist.zip perldist.zip: \$(ALLSIS) \$(SDKZIP) \$(ETC)
804 -del /f perl${VERSION}dist.zip
805 zip -r perl${VERSION}dist.zip \$(ALLSIS) \$(SDKZIP) \$(ETC)
806
ed76c0e4 807perlapp: sdkinstall perlapp_${WIN} perlapp_arm
27da23d5 808
c7a4d1c0 809perlapp_arm_minimal sisify_hex perlappmin.hex perlrscmin.hex: sdkinstall config.h
810 cd symbian; make perlapp_arm USERDEFS=-DCreatePerlAppMinimal
811 perl symbian\\hexdump.pl
812
ed76c0e4 813perlapp_win perlapp_${WIN}: config.h
814 cd symbian; make perlapp_${WIN}
27da23d5 815
816perlapp_arm: config.h
817 cd symbian; make perlapp_arm
818
c7a4d1c0 819perlapp_arm_clean:
820 cd symbian; make clean
821
27da23d5 822perlapp_demo_extract:
823 cd symbian; make perlapp_demo_extract
824
825perlapp.sis: perlapp_arm
826 cd symbian; make perlapp.sis
827
828perlapp.zip:
c8f896e5 829 cd symbian; zip perlapp.zip PerlApp.* PerlRecog.* PerlBase.* PerlUtil.* demo_pl
27da23d5 830
831zip: perlsdk.zip perlapp.zip
832
ed76c0e4 833freeze: freeze_${WIN} freeze_arm
27da23d5 834
ed76c0e4 835freeze_${WIN}:
836 abld freeze ${WIN} perl$VERSION
27da23d5 837
838freeze_arm:
839 abld freeze \$(ARM) perl$VERSION
840
ed76c0e4 841defrost: defrost_${WIN} defrost_arm
27da23d5 842
ed76c0e4 843defrost_${WIN}:
27da23d5 844 -del /f $windef1
845 -del /f $windef2
846
847defrost_arm:
848 -del /f $armdef1
849 -del /f $armdef2
850
ed76c0e4 851clean_${WIN}: abld.bat
852 abld clean ${WIN}
27da23d5 853
854clean_arm: abld.bat
855 abld clean \$(ARM)
856
ed76c0e4 857clean: clean_${WIN} clean_arm rerename_makedef
27da23d5 858 -del /f \$(PM)
859 -del /f \$(POD)
860 -del /f lib\\Config.pm.bak
861 -del /f xlib\\symbian\\Config_heavy.pl
862 -rmdir /s /q xlib
863 -del /f config.sh
864 -del /f DynaLoader.pm ext\\DynaLoader\\DynaLoader.pm
865 -del /f ext\\DynaLoader\\Makefile
866 -del /f ext\\SDBM_File\\sdbm\\Makefile
867 -del /f symbian\\*.lst
868 -del /f abld.bat @unclean *.pkg *.sis *.zip
869 -del /f symbian\\abld.bat symbian\\*.sis symbian\\*.zip
870 -del /f symbian\\perl5*.pkg symbian\\miniperl.pkg
c7a4d1c0 871 -del arm_*.mf ${WIN}_*.mf vc*.mf cw*.mf
db5886f1 872 -del symbian\\Makefile
873 -del symbian\\PerlUi.rss symbian\\PerlApp.rss
c7a4d1c0 874 -del perlappmin.hex perlrscmin.hex
27da23d5 875 -perl symbian\\xsbuild.pl \$(XSBOPT) --clean \$(EXT)
876 -rmdir /s /q perl${VERSION}_Data
877 -cd symbian; make clean
878
879reallyclean: abld.bat
880 abld reallyclean
881
882distclean: defrost reallyclean clean
883 -perl symbian\\xsbuild.pl \$(XSBOPT) --distclean \$(EXT)
884 -del /f config.h config.sh.bak symbian\\symbian_port.h
885 -del /f Makefile symbian\\PerlApp.mmp
886 -del /f BMARM\\*.def
887 -del /f *.cwlink *.resources *.pref
888 -del /f perl${VERSION}.xml perl${VERSION}.mcp uid.cpp
889 -rmdir /s /q BMARM
890 cd symbian; make distclean
891 -del /f symbian\\Makefile
892__EOF__
893 close MAKEFILE;
894}
895else {
896 warn "$0: failed to create Makefile: $!\n";
897}
898
899if ( open( MAKEFILE, ">symbian/Makefile")) {
ed76c0e4 900 my $wrap = defined $S60SDK && $S60SDK eq '1.2' && $WIN ne '${WIN}cw';
27da23d5 901 my $ABLD = $wrap ? 'perl b.pl': 'abld';
902 print "\tsymbian/Makefile\n";
d0d72822 903 my $MF = $WIN eq 'wins' ? 'vc6' : $WIN eq 'winscw' ? 'cw_ide' : "UNKNOWN";
27da23d5 904 print MAKEFILE <<__EOF__;
905WIN = $WIN
906ARM = $ARM
907ABLD = $ABLD
d0d72822 908MF = $MF
27da23d5 909
910abld.bat:
911 bldmake bldfiles
912
ed76c0e4 913perlapp_${WIN}: abld.bat ..\\config.h PerlApp.h PerlApp.cpp
d0d72822 914 copy PerlUi$SDK_VARIANT.rss PerlApp.rss
27da23d5 915 bldmake bldfiles
ed76c0e4 916 \$(ABLD) build ${WIN} udeb
27da23d5 917
918perlapp_arm: ..\\config.h PerlApp.h PerlApp.cpp
d0d72822 919 copy PerlUi$SDK_VARIANT.rss PerlApp.rss
27da23d5 920 bldmake bldfiles
ed76c0e4 921 \$(ABLD) build ${ARM} $UARM
27da23d5 922
d0d72822 923$MF:
924 abld makefile $MF
925
27da23d5 926win.mf:
927 bldmake bldfiles
d0d72822 928 abld makefile $MF
27da23d5 929
930perlapp_demo_extract:
931 perl demo_pl extract
932
933perlapp.sis: perlapp_arm perlapp_demo_extract
934 -del /f perlapp.SIS
935 makesis perlapp.pkg
936 copy /y perlapp.SIS ..\\perlapp.SIS
937
938clean:
939 -perl demo_pl cleanup
940 -del /f perlapp.sis
941 -del /f b.pl
d0d72822 942 -del PerlApp.rss
c7a4d1c0 943 abld clean $WIN
944 abld clean thumb
db5886f1 945 -del Makefile
27da23d5 946
947distclean: clean
948 -del /f *.cwlink *.resources *.pref
949 -del /f PerlApp.xml PerlApp.mcp uid.cpp
950 -rmdir /s /q PerlApp_Data
951 -del /f abld.bat
952__EOF__
953 close(MAKEFILE);
954 if ($wrap) {
955 if ( open( B_PL, ">symbian/b.pl")) {
956 print B_PL <<'__EOF__';
957# abld.pl wrapper.
958
959# nmake doesn't like MFLAGS and MAKEFLAGS being set to -w and w.
960delete $ENV{MFLAGS};
961delete $ENV{MAKEFLAGS};
962
963system("abld @ARGV");
964__EOF__
965 close(B_PL);
966 } else {
967 warn "$0: failed to create symbian/b.pl: $!\n";
968 }
969 }
970} else {
971 warn "$0: failed to create symbian/Makefile: $!\n";
972}
973
974print "Deleting...\n";
975for my $config (
976 # Do not delete config.h here.
977 "config.sh",
978 "lib\\Config.pm",
979 "xlib\\symbian\\Config.pm",
980 "xlib\\symbian\\Config_heavy.pl",
db5886f1 981 "symbian\\PerlUi.rss",
982 "symbian\\PerlApp.rss",
27da23d5 983 ) {
984 print "\t$config\n";
985 unlink($config);
986}
987
988print <<__EOM__;
989Configuring done.
990Now you can run:
991 make all
992 make allsis
993__EOM__
994
9951; # Happy End.