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