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