As using -C to turn on utf8 IO is equivalent to the open pragma,
[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 }
ed76c0e4 339 # In S60 3.0 there will be no more recognizers.
340 my $mdl = qq["$UREL\\PerlRecog.mdl"-"!:\\system\\recogs\\PerlRecog.mdl";];
27da23d5 341 print PERLAPP_PKG <<__EOF__;
342; !!!!!! DO NOT EDIT THIS FILE !!!!!!
343; This file is built by symbian\\config.pl.
344; Any changes made here will be lost!
345;
346; PerlApp.pkg
347;
348; Note that the demo_pl needs to be run to create the demo .pl scripts.
349;
350; Languages
351&EN;
352
353; Standard SIS file header
f26f4a2f 354#{"PerlApp"},(0x102015F6),0,2,0
27da23d5 355
ed76c0e4 356$ProductId
27da23d5 357
358; Files
359"$UREL\\PerlApp.APP"-"!:\\system\\apps\\PerlApp\\PerlApp.app"
ed76c0e4 360$mdl
27da23d5 361"$APPS\\PerlApp.rsc"-"!:\\system\\apps\\PerlApp\\PerlApp.rsc"
362"$APPS\\PerlApp.aif"-"!:\\system\\apps\\PerlApp\\PerlApp.aif"
363__EOF__
364 if ( open( DEMOS, "perl symbian\\demo_pl list |" ) ) {
365 while (<DEMOS>) {
366 chomp;
367 print PERLAPP_PKG qq["$_"-"!:\\Perl\\$_"\n];
368 }
369 close(DEMOS);
370 }
371 close(PERLAPP_PKG);
372 }
373 else {
374 die "$0: symbian\\PerlApp.pkg: $!\n";
375 }
376 push @unclean, 'symbian\PerlApp.pkg';
377}
378
379print "Creating...\n";
380create_mmp(
381 'miniperl', 'exe',
382 'miniperlmain.c', 'symbian\symbian_stubs.c',
c8f896e5 383 'symbian\PerlBase.cpp',
d0d72822 384 'symbian\PerlUi.cpp',
c8f896e5 385 'symbian\PerlUtil.cpp',
386 'symbian\symbian_utils.cpp',
27da23d5 387);
388create_mmp(
389 "perl", 'exe',
390 'perlmain.c', 'symbian\symbian_stubs.c',
d0d72822 391 'symbian\symbian_utils.cpp',
392 'symbian\PerlBase.cpp',
393 'symbian\PerlUi.cpp',
c8f896e5 394 'symbian\PerlUtil.cpp',
27da23d5 395 'ext\DynaLoader\DynaLoader.cpp',
396);
397
398create_mmp(
399 "perl$VERSION", 'dll',
400 'symbian\symbian_dll.cpp', 'symbian\symbian_stubs.c',
d0d72822 401 'symbian\symbian_utils.cpp',
402 'symbian\PerlBase.cpp',
403 'symbian\PerlUi.cpp',
c8f896e5 404 'symbian\PerlUtil.cpp',
27da23d5 405 'ext\DynaLoader\DynaLoader.cpp',
406);
407
408create_bld_inf();
409create_config_h();
410create_perlmain_c();
411create_symbian_port_h();
412create_DynaLoader_cpp();
413create_PerlApp_pkg();
414
415if ( open( PERLAPP_MMP, ">symbian/PerlApp.mmp" ) ) {
416 my @MACRO;
ed76c0e4 417 my @LIB;
d0d72822 418 push @MACRO, 'PERL_IMPLICIT_CONTEXT';
419 push @MACRO, 'MULTIPLICITY';
ed76c0e4 420 if (defined $S60SDK) {
421 push @MACRO, '__SERIES60__';
422 push @MACRO, '__SERIES60_1X__' if $S60SDK =~ /^1\./;
423 push @MACRO, '__SERIES60_2X__' if $S60SDK =~ /^2\./;
424 push @LIB, <<__EOF__;
425LIBRARY avkon.lib
426LIBRARY commondialogs.lib
427__EOF__
428 }
429 if (defined $S80SDK) {
430 push @MACRO, '__SERIES80__';
431 push @MACRO, '__SERIES80_1X__' if $S80SDK =~ /^1\./;
432 push @MACRO, '__SERIES80_2X__' if $S80SDK =~ /^2\./;
433 push @LIB, <<__EOF__;
434LIBRARY eikctl.lib
435LIBRARY eikcoctl.lib
c7a4d1c0 436LIBRARY eikdlg.lib
ed76c0e4 437LIBRARY ckndlg.lib
438__EOF__
439 }
25ca88e0 440 if (defined $UIQSDK) {
441 push @MACRO, '__UIQ__';
442 push @MACRO, '__UIQ_1X__' if $UIQSDK =~ /^1\./;
443 push @MACRO, '__UIQ_2X__' if $UIQSDK =~ /^2\./;
444 push @LIB, <<__EOF__;
445LIBRARY eikctl.lib
446LIBRARY eikcoctl.lib
447LIBRARY eikdlg.lib
448LIBRARY qikctl.lib
449__EOF__
450 }
27da23d5 451 print PERLAPP_MMP <<__EOF__;
452// !!!!!! DO NOT EDIT THIS FILE !!!!!!
453// This file is built by symbian\\config.pl.
454// Any changes made here will be lost!
455TARGET PerlApp.app
456TARGETTYPE app
457UID 0x100039CE 0x102015F6
458TARGETPATH \\system\\apps\\PerlApp
459SRCDBG
460EXPORTUNFROZEN
461SOURCEPATH .
462SOURCE PerlApp.cpp
463
27da23d5 464USERINCLUDE .
465USERINCLUDE ..
466USERINCLUDE \\symbian\\perl\\$R_V_SV\\include
467
468SYSTEMINCLUDE \\epoc32\\include
469SYSTEMINCLUDE \\epoc32\\include\\libc
470
471LIBRARY apparc.lib
27da23d5 472LIBRARY bafl.lib
473LIBRARY charconv.lib
d0d72822 474LIBRARY cone.lib
27da23d5 475LIBRARY efsrv.lib
d0d72822 476LIBRARY eikcore.lib
27da23d5 477LIBRARY estlib.lib
478LIBRARY euser.lib
479LIBRARY perl$VERSION.lib
ed76c0e4 480@LIB
d0d72822 481RESOURCE perlapp.rss
27da23d5 482__EOF__
483 if (@MACRO) {
484 for my $macro (@MACRO) {
485 print PERLAPP_MMP <<__EOF__;
486MACRO $macro
487__EOF__
488 }
489 }
25ca88e0 490 if ($SDK_VARIANT =~ /^S[68]0$/) {
491 print PERLAPP_MMP <<__EOF__;
492AIF PerlApp.aif . PerlAppAif.rss
493__EOF__
494 }
27da23d5 495 close(PERLAPP_MMP);
496 push @unclean, 'symbian\PerlApp.mmp';
497}
498else {
499 warn "$0: failed to create symbian\\PerlApp.mmp";
500}
501
502if ( open( MAKEFILE, ">Makefile" ) ) {
503 my $perl = "perl$VERSION";
ed76c0e4 504 my $windef1 = "$SYMBIAN_ROOT\\Epoc32\\Build$CWD\\$perl\\$WIN\\$perl.def";
27da23d5 505 my $windef2 = "..\\BWINS\\${perl}u.def";
ed76c0e4 506 my $armdef1 = "$SYMBIAN_ROOT\\Epoc32\\Build$CWD\\$perl\\$ARM\\$perl.def";
27da23d5 507 my $armdef2 = "..\\BMARM\\${perl}u.def";
d0d72822 508 my $MF = $WIN eq 'wins' ? 'vc6' : $WIN eq 'winscw' ? 'cw_ide' : "UNKNOWN";
27da23d5 509 print "\tMakefile\n";
510 print MAKEFILE <<__EOF__;
511help:
512 \@echo === Perl for Symbian ===
513 \@echo Useful targets:
514 \@echo all win arm clean
515 \@echo perldll.sis perlext.sis perlsdk.zip
516
517WIN = ${WIN}
518ARM = ${ARM}
519
520all: build
521
ed76c0e4 522build: rename_makedef build_${WIN} build_arm
27da23d5 523
524@unclean: symbian\\config.pl
525 perl symbian\\config.pl
526
d0d72822 527build_${WIN}: abld.bat perldll_${WIN}
ed76c0e4 528
d0d72822 529build_vc6: abld.bat perldll_wins
27da23d5 530
d0d72822 531build_vc7: abld.bat perldll_wins
c7a4d1c0 532
d0d72822 533build_cw: abld.bat perldll_winscw
27da23d5 534
d0d72822 535build_arm: abld.bat perl_arm miniperl_arm perldll_arm
27da23d5 536
d0d72822 537miniperl_win miniperl_${WIN}: miniperl.mmp abld.bat rename_makedef
ed76c0e4 538 abld build ${WIN} udeb miniperl
27da23d5 539
d0d72822 540miniperl_arm: miniperl.mmp abld.bat rename_makedef
27da23d5 541 abld build \$(ARM) $UARM miniperl
542
ed76c0e4 543miniperl: miniperl_${WIN} miniperl_arm
27da23d5 544
ed76c0e4 545perl: perl_${WIN} perl_arm
27da23d5 546
d0d72822 547perl_win perl_${WIN}: perl.mmp abld.bat rename_makedef
ed76c0e4 548 abld build ${WIN} perl
27da23d5 549
d0d72822 550perl_arm: perl.mmp abld.bat rename_makedef
27da23d5 551 abld build \$(ARM) $UARM perl
552
ed76c0e4 553perldll_win perldll_${WIN}: perl${VERSION}_${WIN} freeze_${WIN} perl${VERSION}_${WIN}
27da23d5 554
ed76c0e4 555perl${VERSION}_win perl${VERSION}_${WIN}: perl$VERSION.mmp abld.bat rename_makedef
556 abld build ${WIN} perl$VERSION
27da23d5 557
558perldll_arm: perl${VERSION}_arm freeze_arm perl${VERSION}_arm
559
d0d72822 560perl${VERSION}_arm: perl$VERSION.mmp abld.bat rename_makedef
27da23d5 561 abld build \$(ARM) $UARM perl$VERSION
562
ed76c0e4 563perldll perl$VERSION: perldll_${WIN} perldll_arm
27da23d5 564
ed76c0e4 565win ${WIN}: miniperl_${WIN} perl_${WIN} perldll_${WIN}
27da23d5 566
ed76c0e4 567thumb arm: miniperl_arm perl_arm perldll_arm
27da23d5 568
569rename_makedef:
570 -ren makedef.pl nomakedef.pl
571
572# Symbian SDK has a makedef.pl of its own,
573# and we don't need Perl's.
574rerename_makedef:
575 -ren nomakedef.pl makedef.pl
576
d0d72822 577symbian\\PerlUi.rss: symbian\\PerlUi$SDK_VARIANT.rss
578 copy symbian\\PerlUi$SDK_VARIANT.rss symbian\\PerlUi.rss
27da23d5 579
d0d72822 580abld.bat abld: bld.inf symbian\\PerlUi.rss
581 bldmake bldfiles
27da23d5 582
583vc6: win.mf vc6.mf build_vc6
584
c7a4d1c0 585vc7: win.mf vc7.mf build_vc7
586
ed76c0e4 587cw: win.mf cw.mf build_cw
27da23d5 588
ed76c0e4 589${WIN}_miniperl.mf: abld.bat symbian\\config.pl
d0d72822 590 abld makefile ${MF} miniperl
ed76c0e4 591 echo > ${WIN}_miniperl.mf
27da23d5 592
ed76c0e4 593${WIN}_perl.mf: abld.bat symbian\\config.pl
d0d72822 594 abld makefile ${MF} perl
ed76c0e4 595 echo > ${WIN}_perl.mf
27da23d5 596
ed76c0e4 597${WIN}_${VERSION}.mf: abld.bat symbian\\config.pl
d0d72822 598 abld makefile ${MF} perl${VERSION}
ed76c0e4 599 echo > ${WIN}_${VERSION}.mf
27da23d5 600
ed76c0e4 601symbian\\${WIN}.mf:
602 cd symbian; make ${WIN}.mf
603
604${WIN}.mf: ${WIN}_miniperl.mf ${WIN}_perl.mf ${WIN}_${VERSION}.mf symbian\\${WIN}.mf
27da23d5 605
606arm_miniperl.mf: abld.bat symbian\\config.pl
27da23d5 607 echo > arm_miniperl.mf
608
609arm_perl.mf: abld.bat symbian\\config.pl
27da23d5 610 echo > arm_perl.mf
611
612arm_${VERSION}.mf: abld.bat symbian\\config.pl
27da23d5 613 echo > arm_${VERSION}.mf
614
615arm.mf: arm_miniperl.mf arm_perl.mf arm_${VERSION}.mf
616
ed76c0e4 617win.mf: vc6.mf cw.mf
618 echo > win.mf
619
27da23d5 620vc6.mf: abld.bat symbian\\config.pl
621 abld makefile vc6
622 echo > vc6.mf
623
c7a4d1c0 624vc7.mf: abld.bat symbian\\config.pl
625 abld makefile vc7
626 echo > vc7.mf
627
ed76c0e4 628cw.mf: abld.bat symbian\\config.pl
629 abld makefile cw_ide
630 echo > cw.mf
631
27da23d5 632PM = lib\\Config.pm lib\\Cross.pm lib\\lib.pm ext\\DynaLoader\\DynaLoader.pm ext\\DynaLoader\\XSLoader.pm ext\\Errno\\Errno.pm
633POD = lib\\Config.pod
634
635pm: \$(PM)
636
637XLIB = -Ixlib\\symbian
638
639XSBOPT = --win=\$(WIN) --arm=\$(ARM)
640
641lib\\Config.pm:
642 copy symbian\\config.sh config.sh
643 perl -pi.bak -e "s:x\\.y\\.z+:$R_V_SV:g" config.sh
644 perl \$(XLIB) configpm --cross=symbian
645 copy xlib\\symbian\\Config.pm lib\\Config.pm
646 perl -pi.bak -e "s:x\\.y\\.z:$R_V_SV:g" lib\\Config.pm
647 perl -pi.bak -e "s:5\\.\\d+\\.\\d+:$R_V_SV:g" lib\\Config.pm
648 -perl -pi.bak -e "s:x\\.y\\.z:$R_V_SV:g" xlib\\symbian\\Config_heavy.pl
649
650lib\\lib.pm:
651 perl lib\\lib_pm.PL
652
653ext\\DynaLoader\\DynaLoader.pm:
654 -del /f ext\\DynaLoader\\DynaLoader.pm
655 perl -Ixlib\\symbian ext\\DynaLoader\\DynaLoader_pm.PL
656 perl -pi.bak -e "s/__END__//" DynaLoader.pm
657 copy /y DynaLoader.pm ext\\DynaLoader\\DynaLoader.pm
658 -del /f DynaLoader.pm DynaLoader.pm.bak
659
660ext\\DynaLoader\\XSLoader.pm:
661 perl \$(XLIB) symbian\\xsbuild.pl \$(XSBOPT) XSLoader
662
663ext\\Errno\\Errno.pm:
664 perl \$(XLIB) symbian\\xsbuild.pl \$(XSBOPT) Errno
665
666miniperlexe.sis: miniperl_arm symbian\\makesis.pl
667 perl \$(XLIB) symbian\\makesis.pl miniperl
668
669perlexe.sis: perl_arm symbian\\makesis.pl
670 perl \$(XLIB) symbian\\makesis.pl perl
671
672
673allsis: all miniperlexe.sis perlexe.sis perldll.sis perllib.sis perlext.sis perlapp.sis
674
675perldll.sis perl$VERSION.sis: perldll_arm pm symbian\\makesis.pl
676 perl \$(XLIB) symbian\\makesis.pl perl${VERSION}dll
677
c8f896e5 678perl${VERSION}lib.sis perllib.sis: \$(PM)
27da23d5 679 perl \$(XLIB) symbian\\makesis.pl perl${VERSION}lib
680
c8f896e5 681perl${VERSION}ext.sis perlext.sis: perldll_arm buildext_sis
27da23d5 682 perl symbian\\makesis.pl perl${VERSION}ext
683
c042ae3a 684EXT = 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 685
c042ae3a 686buildext: perldll symbian\\xsbuild.pl lib\\Config.pm
27da23d5 687 perl \$(XLIB) symbian\\xsbuild.pl \$(XSBOPT) \$(EXT)
688
25ca88e0 689buildextcpp: perldll symbian\\xsbuild.pl lib\\Config.pm
690 perl \$(XLIB) symbian\\xsbuild.pl --csuffix .cpp \$(XSBOPT) \$(EXT)
691
c042ae3a 692buildext_sis: perldll.sis symbian\\xsbuild.pl lib\\Config.pm
27da23d5 693 perl \$(XLIB) symbian\\xsbuild.pl \$(XSBOPT) --sis \$(EXT)
694
25ca88e0 695buildextcpp_sis: perldll.sis symbian\\xsbuild.pl lib\\Config.pm
696 perl \$(XLIB) symbian\\xsbuild.pl --csuffix .cpp \$(XSBOPT) --sis \$(EXT)
697
27da23d5 698cleanext: symbian\\xsbuild.pl
699 perl \$(XLIB) symbian\\xsbuild.pl \$(XSBOPT) --clean \$(EXT)
700
701distcleanext: symbian\\xsbuild.pl
702 perl \$(XLIB) symbian\\xsbuild.pl \$(XSBOPT) --distclean \$(EXT)
703
704sis makesis: miniperl perl perldll pm buildext perlapp.sis
705 perl \$(XLIB) symbian\\makesis.pl
706
707APIDIR = \\Symbian\\perl\\$R_V_SV
708
709sdkinstall:
710 -mkdir \\Symbian\\perl
711 -mkdir \\Symbian\\perl\\$R_V_SV
712 -mkdir \$(APIDIR)\\include
713 -mkdir \$(APIDIR)\\include\\symbian
714 -mkdir \$(APIDIR)\\lib
715 -mkdir \$(APIDIR)\\lib\\ExtUtils
716 -mkdir \$(APIDIR)\\pod
717 -mkdir \$(APIDIR)\\bin
718 -mkdir \$(BINDIR)
719 copy /y *.h \$(APIDIR)\\include
25ca88e0 720 -copy /y *.inc \$(APIDIR)\\include
27da23d5 721 copy /y lib\\ExtUtils\\xsubpp \$(APIDIR)\\lib\\ExtUtils
722 copy /y lib\\ExtUtils\\typemap \$(APIDIR)\\lib\\ExtUtils
c8f896e5 723 copy /y lib\\ExtUtils\\ParseXS.pm \$(APIDIR)\\lib\\ExtUtils
27da23d5 724 copy /y symbian\\xsbuild.pl \$(APIDIR)\\bin
c8f896e5 725 copy /y symbian\\sisify.pl \$(APIDIR)\\bin
27da23d5 726 copy /y symbian\\PerlBase.h \$(APIDIR)\\include
d0d72822 727 copy /y symbian\\PerlUi.h \$(APIDIR)\\include
c8f896e5 728 copy /y symbian\\PerlUtil.h \$(APIDIR)\\include
27da23d5 729 copy /y symbian\\symbian*.h \$(APIDIR)\\include\\symbian
730 copy /y symbian\\PerlBase.pod \$(APIDIR)\\pod
c8f896e5 731 copy /y symbian\\PerlUtil.pod \$(APIDIR)\\pod
27da23d5 732
ed76c0e4 733RELDIR = $SYMBIAN_ROOT\\epoc32\\release
27da23d5 734RELWIN = \$(RELDIR)\\\$(WIN)\\udeb
735RELARM = \$(RELDIR)\\\$(ARM)\\$UARM
c8f896e5 736SDKZIP = perl${VERSION}sdk.zip
27da23d5 737
c8f896e5 738
739\$(SDKZIP) perlsdk.zip: perldll sdkinstall
740 -del /f perl${VERSION}sdk.zip
27da23d5 741 zip -r perl${VERSION}sdk.zip \$(RELWIN)\\perl$VERSION.* \$(RELARM)\\perl$VERSION.* \$(APIDIR)
742 \@echo perl${VERSION}sdk.zip created.
743
c8f896e5 744PERLSIS = perl${VERSION}.SIS perl${VERSION}lib.SIS perl${VERSION}ext.SIS
745ALLSIS = \$(PERLSIS) perlapp.sis
746ETC = README.symbian symbian\\PerlBase.pod symbian\\PerlUtil.pod symbian\\sisify.pl symbian\\TODO
747
748perl${VERSION}dist.zip perldist.zip: \$(ALLSIS) \$(SDKZIP) \$(ETC)
749 -del /f perl${VERSION}dist.zip
750 zip -r perl${VERSION}dist.zip \$(ALLSIS) \$(SDKZIP) \$(ETC)
751
ed76c0e4 752perlapp: sdkinstall perlapp_${WIN} perlapp_arm
27da23d5 753
c7a4d1c0 754perlapp_arm_minimal sisify_hex perlappmin.hex perlrscmin.hex: sdkinstall config.h
755 cd symbian; make perlapp_arm USERDEFS=-DCreatePerlAppMinimal
756 perl symbian\\hexdump.pl
757
ed76c0e4 758perlapp_win perlapp_${WIN}: config.h
759 cd symbian; make perlapp_${WIN}
27da23d5 760
761perlapp_arm: config.h
762 cd symbian; make perlapp_arm
763
c7a4d1c0 764perlapp_arm_clean:
765 cd symbian; make clean
766
27da23d5 767perlapp_demo_extract:
768 cd symbian; make perlapp_demo_extract
769
770perlapp.sis: perlapp_arm
771 cd symbian; make perlapp.sis
772
773perlapp.zip:
c8f896e5 774 cd symbian; zip perlapp.zip PerlApp.* PerlRecog.* PerlBase.* PerlUtil.* demo_pl
27da23d5 775
776zip: perlsdk.zip perlapp.zip
777
ed76c0e4 778freeze: freeze_${WIN} freeze_arm
27da23d5 779
ed76c0e4 780freeze_${WIN}:
781 abld freeze ${WIN} perl$VERSION
27da23d5 782
783freeze_arm:
784 abld freeze \$(ARM) perl$VERSION
785
ed76c0e4 786defrost: defrost_${WIN} defrost_arm
27da23d5 787
ed76c0e4 788defrost_${WIN}:
27da23d5 789 -del /f $windef1
790 -del /f $windef2
791
792defrost_arm:
793 -del /f $armdef1
794 -del /f $armdef2
795
ed76c0e4 796clean_${WIN}: abld.bat
797 abld clean ${WIN}
27da23d5 798
799clean_arm: abld.bat
800 abld clean \$(ARM)
801
ed76c0e4 802clean: clean_${WIN} clean_arm rerename_makedef
27da23d5 803 -del /f \$(PM)
804 -del /f \$(POD)
805 -del /f lib\\Config.pm.bak
806 -del /f xlib\\symbian\\Config_heavy.pl
807 -rmdir /s /q xlib
808 -del /f config.sh
809 -del /f DynaLoader.pm ext\\DynaLoader\\DynaLoader.pm
810 -del /f ext\\DynaLoader\\Makefile
811 -del /f ext\\SDBM_File\\sdbm\\Makefile
812 -del /f symbian\\*.lst
813 -del /f abld.bat @unclean *.pkg *.sis *.zip
814 -del /f symbian\\abld.bat symbian\\*.sis symbian\\*.zip
815 -del /f symbian\\perl5*.pkg symbian\\miniperl.pkg
c7a4d1c0 816 -del arm_*.mf ${WIN}_*.mf vc*.mf cw*.mf
d0d72822 817 -del symbian\\PerlUi.rss
c7a4d1c0 818 -del perlappmin.hex perlrscmin.hex
27da23d5 819 -perl symbian\\xsbuild.pl \$(XSBOPT) --clean \$(EXT)
820 -rmdir /s /q perl${VERSION}_Data
821 -cd symbian; make clean
822
823reallyclean: abld.bat
824 abld reallyclean
825
826distclean: defrost reallyclean clean
827 -perl symbian\\xsbuild.pl \$(XSBOPT) --distclean \$(EXT)
828 -del /f config.h config.sh.bak symbian\\symbian_port.h
829 -del /f Makefile symbian\\PerlApp.mmp
830 -del /f BMARM\\*.def
831 -del /f *.cwlink *.resources *.pref
832 -del /f perl${VERSION}.xml perl${VERSION}.mcp uid.cpp
833 -rmdir /s /q BMARM
834 cd symbian; make distclean
835 -del /f symbian\\Makefile
836__EOF__
837 close MAKEFILE;
838}
839else {
840 warn "$0: failed to create Makefile: $!\n";
841}
842
843if ( open( MAKEFILE, ">symbian/Makefile")) {
ed76c0e4 844 my $wrap = defined $S60SDK && $S60SDK eq '1.2' && $WIN ne '${WIN}cw';
27da23d5 845 my $ABLD = $wrap ? 'perl b.pl': 'abld';
846 print "\tsymbian/Makefile\n";
d0d72822 847 my $MF = $WIN eq 'wins' ? 'vc6' : $WIN eq 'winscw' ? 'cw_ide' : "UNKNOWN";
27da23d5 848 print MAKEFILE <<__EOF__;
849WIN = $WIN
850ARM = $ARM
851ABLD = $ABLD
d0d72822 852MF = $MF
27da23d5 853
854abld.bat:
855 bldmake bldfiles
856
ed76c0e4 857perlapp_${WIN}: abld.bat ..\\config.h PerlApp.h PerlApp.cpp
d0d72822 858 copy PerlUi$SDK_VARIANT.rss PerlApp.rss
27da23d5 859 bldmake bldfiles
ed76c0e4 860 \$(ABLD) build ${WIN} udeb
27da23d5 861
862perlapp_arm: ..\\config.h PerlApp.h PerlApp.cpp
d0d72822 863 copy PerlUi$SDK_VARIANT.rss PerlApp.rss
27da23d5 864 bldmake bldfiles
ed76c0e4 865 \$(ABLD) build ${ARM} $UARM
27da23d5 866
d0d72822 867$MF:
868 abld makefile $MF
869
27da23d5 870win.mf:
871 bldmake bldfiles
d0d72822 872 abld makefile $MF
27da23d5 873
874perlapp_demo_extract:
875 perl demo_pl extract
876
877perlapp.sis: perlapp_arm perlapp_demo_extract
878 -del /f perlapp.SIS
879 makesis perlapp.pkg
880 copy /y perlapp.SIS ..\\perlapp.SIS
881
882clean:
883 -perl demo_pl cleanup
884 -del /f perlapp.sis
885 -del /f b.pl
d0d72822 886 -del PerlApp.rss
c7a4d1c0 887 abld clean $WIN
888 abld clean thumb
27da23d5 889
890distclean: clean
891 -del /f *.cwlink *.resources *.pref
892 -del /f PerlApp.xml PerlApp.mcp uid.cpp
893 -rmdir /s /q PerlApp_Data
894 -del /f abld.bat
895__EOF__
896 close(MAKEFILE);
897 if ($wrap) {
898 if ( open( B_PL, ">symbian/b.pl")) {
899 print B_PL <<'__EOF__';
900# abld.pl wrapper.
901
902# nmake doesn't like MFLAGS and MAKEFLAGS being set to -w and w.
903delete $ENV{MFLAGS};
904delete $ENV{MAKEFLAGS};
905
906system("abld @ARGV");
907__EOF__
908 close(B_PL);
909 } else {
910 warn "$0: failed to create symbian/b.pl: $!\n";
911 }
912 }
913} else {
914 warn "$0: failed to create symbian/Makefile: $!\n";
915}
916
917print "Deleting...\n";
918for my $config (
919 # Do not delete config.h here.
920 "config.sh",
921 "lib\\Config.pm",
922 "xlib\\symbian\\Config.pm",
923 "xlib\\symbian\\Config_heavy.pl",
924 ) {
925 print "\t$config\n";
926 unlink($config);
927}
928
929print <<__EOM__;
930Configuring done.
931Now you can run:
932 make all
933 make allsis
934__EOM__
935
9361; # Happy End.