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