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