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