9 do "sanity.pl" or die $@;
11 my $CoreBuild = -d "ext" && -f "perl.h" && -d "symbian" && -f "perl.c";
15 if (exists $ENV{EPOCROOT}) {
16 if ($ENV{EPOCROOT} =~ m!\\Symbian\\UIQ_21\\$!i) {
17 $SymbianVersion = '7.0s'; # TODO: other UIQ versions
18 } elsif ($ENV{EPOCROOT} =~ m!\\Symbian\\(.+?)\\!i) {
23 $SymbianVersion = $ENV{XSBUILD_SYMBIAN_VERSION}
24 if exists $ENV{XSBUILD_SYMBIAN_VERSION};
26 my $PerlVersion = $ENV{XSBUILD_PERL_VERSION};
37 $0: Usage: $0 [--symbian=version] [--perl=version]
39 [--csuffix=csuffix] [--cplusplus|--cpp]
40 [--win=win] [--arm=arm]
41 [--config|--build|--clean|--distclean|--sis] ext
52 my $BUILDROOT = getcwd();
54 if ( !defined $PerlVersion && $0 =~ m:\\symbian\\perl\\(.+)\\bin\\xsbuild.pl:i )
59 if ( !defined $SymbianVersion) {
60 ($SymbianVersion) = ($ENV{PATH} =~ m!\\Symbian\\(.+?)\\!i);
63 my ($SYMBIAN_ROOT, $SYMBIAN_VERSION, $SDK_NAME, $SDK_VARIANT, $SDK_VERSION);
66 unshift @INC, "symbian";
67 do "sanity.pl" or die $@;
68 my %VERSION = %{ do "version.pl" or die $@ };
69 ($SYMBIAN_ROOT, $SYMBIAN_VERSION, $SDK_NAME, $SDK_VARIANT, $SDK_VERSION) =
70 @{ do "sdk.pl" or die $@ };
71 $VERSION = "$VERSION{REVISION}$VERSION{VERSION}$VERSION{SUBVERSION}";
72 $R_V_SV = "$VERSION{REVISION}.$VERSION{VERSION}.$VERSION{SUBVERSION}";
73 $BUILDROOT = do "cwd.pl" or die $@;
74 $PerlVersion = $R_V_SV;
81 'symbian=s' => \$SymbianVersion,
82 'perl=s' => \$PerlVersion,
83 'extversion=s' => \$CONF{EXTVERSION},
84 'csuffix=s' => \$CSuffix,
85 'cplusplus|cpp' => \$CPlusPlus,
91 'distclean' => \$DistClean,
97 $CSuffix = '.cpp' if $CPlusPlus;
98 $Build = !( $Config || $Clean || $DistClean ) || $Sis unless defined $Build;
100 die "$0: Symbian version undefined\n" unless defined $SymbianVersion;
102 $SymbianVersion =~ s:/:\\:g;
104 #die "$0: Symbian version '$SymbianVersion' not found\n"
105 # unless -d "\\Symbian\\$SymbianVersion";
107 die "$0: Perl version undefined\n" unless defined $PerlVersion;
109 $PERLSDK = "$SYMBIAN_ROOT\\Perl\\$PerlVersion";
111 die "$0: Perl version '$PerlVersion' not found\n"
112 if !$CoreBuild && !-d $PERLSDK;
114 print "Configuring with Symbian $SymbianVersion and Perl $PerlVersion...\n";
116 $R_V_SV = $PerlVersion;
118 $VERSION = $PerlVersion unless defined $VERSION;
120 $VERSION =~ tr/.//d if defined $VERSION;
122 $ENV{SDK} = $SYMBIAN_ROOT; # For the Errno extension
123 $ENV{CROSS} = 1; # For the Encode extension (unbuilt now)
126 my $UREL = "$SYMBIAN_ROOT\\epoc32\\release\\-ARM-\\$UARM";
128 if (exists $ENV{UREL}) {
129 $UREL = $ENV{UREL}; # from sdk.pl
130 $UREL =~ s/-ARM-/$ARM/;
131 $UARM = $ENV{UARM}; # from sdk.pl
132 $SRCDBG = $UARM eq 'udeb' ? "SRCDBG" : "";
140 open( BLD_INF, ">bld.inf" ) or die "$0: bld.inf: $!\n";
141 print BLD_INF <<__EOF__;
152 print "xsbuild: ", $cmd, "\n";
157 my ( $PL, $dir, $file ) = @_;
158 if ( defined $file ) {
159 print "\t(Running $dir\\$PL to create $file)\n";
163 print "\t(Running $dir\\$PL)\n";
168 # Problem: the Config.pm we have in $BUILDROOT\\lib carries the
169 # version number of the Perl we are building, while the Perl
170 # we are running might have some other version. Solution:
171 # temporarily replace the Config.pm with a patched version.
172 my $V = sprintf "%vd", $^V;
173 unlink("$BUILDROOT\\lib\\Config.pm.bak");
174 print "(patching $BUILDROOT\\lib\\Config.pm)\n";
175 system_echo("perl -pi.bak -e \"s:\\Q$R_V_SV:$V:\" $BUILDROOT\\lib\\Config.pm");
177 system_echo("perl -I$BUILDROOT\\lib -I$BUILDROOT\\xlib\\symbian -I$BUILDROOT\\t\\lib $PL") == 0
178 or warn "$0: $PL failed.\n";
180 system_echo("copy $BUILDROOT\\lib\\Config.pm.bak $BUILDROOT\\lib\\Config.pm");
182 if ( defined $file ) { -s $file or die "$0: No $file created.\n" }
186 my ( $conf, $k ) = @_;
187 push @{ $conf->{$k} }, split( ' ', $1 ) if /^$k\s(.+)$/;
190 sub uniquefy_filenames {
193 for my $i (@{$_[0]}) {
195 $i = lc $i if $i =~ m!\\!;
197 push @$b, $i unless $c{$i}++;
203 my ( $conf, $mmp ) = @_;
204 if ( -r $mmp && open( MMP, "<$mmp" ) ) {
205 print "\tReading $mmp...\n";
208 $conf->{TARGET} = $1 if /^TARGET\s+(.+)$/;
209 $conf->{TARGETPATH} = $1 if /^TARGETPATH\s+(.+)$/;
210 $conf->{EXTVERSION} = $1 if /^EXTVERSION\s+(.+)$/;
211 read_old_multi( $conf, "SOURCE" );
212 read_old_multi( $conf, "SOURCEPATH" );
213 read_old_multi( $conf, "USERINCLUDE" );
214 read_old_multi( $conf, "SYSTEMINCLUDE" );
215 read_old_multi( $conf, "LIBRARY" );
216 read_old_multi( $conf, "MACRO" );
223 my ( $ext, $base, $userinclude, @src ) = @_;
225 my $extdash = $ext; $extdash =~ s!\\!-!g;
227 print "\t$base.mmp\n";
228 $CONF{TARGET} = "perl$VERSION-$extdash.dll";
229 $CONF{TARGETPATH} = "\\System\\Libs\\Perl\\$R_V_SV";
230 $CONF{SOURCE} = [@src];
231 $CONF{SOURCEPATH} = [ $CWD, $BUILDROOT ];
232 $CONF{USERINCLUDE} = [ $CWD, $BUILDROOT ];
233 $CONF{SYSTEMINCLUDE} = ["$PERLSDK\\include"] unless $CoreBuild;
234 $CONF{SYSTEMINCLUDE} = [ $BUILDROOT, "$BUILDROOT\\symbian" ] if $CoreBuild;
237 read_mmp( \%CONF, "_init.mmp" );
238 read_mmp( \%CONF, "$base.mmp" );
240 if ($base eq 'Zlib') {
241 push @{$CONF{USERINCLUDE}}, "$CWD\\zlib-src";
244 for my $ui ( @{$userinclude} ) {
246 if ( $ui =~ m!^(?:[CD]:)?\\! ) {
247 push @{ $CONF{USERINCLUDE} }, $ui;
250 push @{ $CONF{USERINCLUDE} }, "$BUILDROOT\\$ui";
253 push @{ $CONF{SYSTEMINCLUDE} }, "\\epoc32\\include";
254 push @{ $CONF{SYSTEMINCLUDE} }, "\\epoc32\\include\\libc";
255 push @{ $CONF{LIBRARY} }, "euser.lib";
256 push @{ $CONF{LIBRARY} }, "estlib.lib";
257 push @{ $CONF{LIBRARY} }, "perl$VERSION.lib";
258 push @{ $CONF{MACRO} }, "SYMBIAN" unless $CoreBuild;
259 push @{ $CONF{MACRO} }, "PERL_EXT" if $CoreBuild;
260 push @{ $CONF{MACRO} }, "MULTIPLICITY";
261 push @{ $CONF{MACRO} }, "PERL_IMPLICIT_CONTEXT";
262 push @{ $CONF{MACRO} }, "PERL_GLOBAL_STRUCT";
263 push @{ $CONF{MACRO} }, "PERL_GLOBAL_STRUCT_PRIVATE";
265 if ($SDK_VARIANT eq 'S60') {
266 push @{ $CONF{MACRO} }, '__SERIES60__'
267 unless grep { $_ eq '__SERIES60__' } @{ $CONF{MACRO} };
269 if ($SDK_VARIANT eq 'S80') {
270 push @{ $CONF{MACRO} }, '__SERIES80__'
271 unless grep { $_ eq '__SERIES80__' } @{ $CONF{MACRO} };
273 if ($SDK_VARIANT eq 'S90') {
274 push @{ $CONF{MACRO} }, '__SERIES90__'
275 unless grep { $_ eq '__SERIES90__' } @{ $CONF{MACRO} };
277 if ($SDK_VARIANT eq 'UIQ') {
278 push @{ $CONF{MACRO} }, '__UIQ__'
279 unless grep { $_ eq '__UIQ__' } @{ $CONF{MACRO} };
282 for my $u (qw(SOURCE SOURCEPATH SYSTEMINCLUDE USERINCLUDE LIBRARY MACRO)) {
283 $CONF{$u} = uniquefy_filenames( $CONF{$u} );
285 open( BASE_MMP, ">$base.mmp" ) or die "$0: $base.mmp: $!\n";
287 print BASE_MMP <<__EOF__;
290 TARGETPATH $CONF{TARGETPATH}
291 SOURCE @{$CONF{SOURCE}}
294 for my $u (qw(SOURCEPATH SYSTEMINCLUDE USERINCLUDE)) {
295 for my $v ( @{ $CONF{$u} } ) {
296 print BASE_MMP "$u\t$v\n";
299 # OPTION does not work in MMPs for pre-2.0 SDKs?
300 print BASE_MMP <<__EOF__;
301 LIBRARY @{$CONF{LIBRARY}}
302 MACRO @{$CONF{MACRO}}
303 // OPTION MSVC /P // Uncomment for creating .i (cpp'ed .cpp)
304 // OPTION GCC -E // Uncomment for creating .i (cpp'ed .cpp)
306 # if (-f "$base.rss") {
307 # print BASE_MMP "RESOURCE\t$base.rss\n";
314 my ( $base, $build ) = @_;
316 print "\tMakefile\n";
318 my $windef1 = "$SYMBIAN_ROOT\\Epoc32\\Build$CWD\\$base\\$WIN\\$base.def";
319 my $windef2 = "..\\BWINS\\${base}u.def";
320 my $armdef1 = "$SYMBIAN_ROOT\\Epoc32\\Build$CWD\\$base\\$ARM\\$base.def";
321 my $armdef2 = "..\\BMARM\\${base}u.def";
323 my $wrap = $SYMBIAN_ROOT && defined $SDK_VARIANT eq 'S60' && $SDK_VERSION eq '1.2' && $SYMBIAN_ROOT !~ /_CW$/;
324 my $ABLD = $wrap ? 'perl b.pl' : 'abld';
326 open( MAKEFILE, ">Makefile" ) or die "$0: Makefile: $!\n";
327 print MAKEFILE <<__EOF__;
334 sis: build_arm freeze_arm
336 build: abld.bat build_win build_arm
343 \$(ABLD) build \$(WIN) udeb
347 \$(ABLD) build \$(ARM) $UARM
349 win: build_win freeze_win
351 arm: build_arm freeze_arm
353 freeze: freeze_win freeze_arm
357 \$(ABLD) freeze \$(WIN) $base
361 \$(ABLD) freeze \$(ARM) $base
363 defrost: defrost_win defrost_arm
373 clean: clean_win clean_arm
376 \$(ABLD) clean \$(WIN)
379 \$(ABLD) clean \$(ARM)
381 realclean: clean realclean_win realclean_arm
383 -del /f $base.c $base.mmp
386 \$(ABLD) reallyclean \$(WIN)
389 \$(ABLD) reallyclean \$(ARM)
391 distclean: defrost realclean
392 -rmdir ..\\BWINS ..\\BMARM
393 -del /f const-c.inc const-xs.inc
394 -del /f Makefile abld.bat bld.inf
398 if(open(B,">b.pl")) {
402 # nmake doesn't like MFLAGS and MAKEFLAGS being set to -w and w.
404 delete $ENV{MAKEFLAGS};
406 print "abld @ARGV\n";
407 system_echo("abld @ARGV");
411 warn "$0: failed to create b.pl: $!\n";
417 print "[chdir from ", getcwd(), " to ";
418 chdir(shift) or return;
420 print getcwd(), "]\n";
424 my ( $ext, $dir ) = @_;
425 print "Configuring for $ext, directory '$dir'...\n";
426 my $extu = $CoreBuild ? "$BUILDROOT\\lib\\ExtUtils" : "$PERLSDK\\lib\\ExtUtils";
427 update_dir($dir) or die "$0: chdir '$dir': $!\n";
428 my $build = dirname($ext);
429 my $base = basename($ext);
430 my $basexs = "$base.xs";
431 my $basepm = "$base.pm";
432 my $basec = "$base$CSuffix";
434 if ( $dir =~ m:^ext\\(.+): ) {
437 elsif ( $dir ne "." ) {
440 my $extdirdir = dirname($extdir);
441 my $targetroot = "\\System\\Libs\\Perl\\$R_V_SV";
442 write_bld_inf($base) if -f $basexs;
447 $extdirdir = $extdirdir eq "." ? "" : "$extdirdir\\";
449 my $extdash = $ext; $extdash =~ s!\\!-!g;
452 $lst{"$UREL\\perl$VERSION-$extdash.dll"} =
453 "$targetroot\\$ARM-symbian\\$base.dll"
455 $lst{"$dir\\$base.pm"} = "$targetroot\\$extdirdir$base.pm"
456 if -f $basepm && $base ne 'XSLoader';
463 find( sub { push @found, $File::Find::name if -f $_ }, 'lib' );
464 for my $found (@found) {
465 next if $found =~ /\.bak$/i; # Zlib
466 my ($short) = ( $found =~ m/^lib.(.+)/ );
469 $lst{"$dir\\$found"} = "$targetroot\\$short";
472 if ( my @pm = glob("*.pm */*.pm") ) {
474 next if $pm =~ m:^t/:;
476 $lst{"$dir\\$pm"} = "$targetroot\\$extdirdir$pm";
479 if ( my @c = glob("*.c *.cpp */*.c */*.cpp") ) {
480 @c = grep { ! m:^zlib-src/: } @c if $ext eq 'ext\Compress\Raw\Zlib';
486 if ( my @h = glob("*.h */*.h") ) {
487 @h = grep { ! m:^zlib-src/: } @h if $ext eq 'ext\Compress\Raw\Zlib';
491 $incdir{"$dir\\$h"}++ unless $h eq ".";
494 if ( exists $EXTCFG{$ext} ) {
495 for my $cfg ( @{ $EXTCFG{$ext} } ) {
496 if ( $cfg =~ /^([-+])?(.+\.(c|cpp|h))$/ ) {
497 my $o = defined $1 ? $1 : '+';
500 for my $f ( glob($f) ) {
502 warn "$0: no source file $dir\\$f\n" unless -f $f;
503 $src{$f}++ unless $cfg =~ /\.h$/;
504 if ( $f =~ m:^(.+)\\[^\\]+$: ) {
508 elsif ( $o eq '-' ) {
513 if ( $cfg =~ /^([-+])?(.+\.(pm|pl|inc))$/ ) {
514 my $o = defined $1 ? $1 : '+';
517 for my $f ( glob($f) ) {
519 warn "$0: no Perl file $dir\\$f\n" unless -f $f;
520 $lst{"$dir\\$f"} = "$targetroot\\$extdir\\$f";
522 elsif ( $o eq '-' ) {
523 delete $lst{"$dir\\$f"};
527 if ( $cfg eq 'CONST' && !$ran_PL++ ) {
528 run_PL( "Makefile.PL", $dir, "const-xs.inc" );
532 unless ( $ran_PL++ ) {
533 run_PL( "Makefile.PL", $dir ) if -f "Makefile.PL";
535 if ( $dir eq "ext\\Errno" ) {
536 run_PL( "Errno_pm.PL", $dir, "Errno.pm" );
537 $lst{"$dir\\Errno.pm"} = "$targetroot\\Errno.pm";
539 elsif ( $dir eq "ext\\Devel\\PPPort" ) {
540 run_PL( "ppport_h.PL", $dir, "ppport.h" );
542 elsif ( $dir eq "ext\\DynaLoader" ) {
543 run_PL( "XSLoader_pm.PL", $dir, "XSLoader.pm" );
544 $lst{"ext\\DynaLoader\\XSLoader.pm"} = "$targetroot\\XSLoader.pm";
546 elsif ( $dir eq "ext\\Encode" ) {
547 system_echo("perl bin\\enc2xs -Q -O -o def_t.c -f def_t.fnm") == 0
548 or die "$0: running enc2xs failed: $!\n";
551 my @lst = sort keys %lst;
553 read_mmp( \%CONF, "_init.mmp" );
554 read_mmp( \%CONF, "$base.mmp" );
557 my %MM; # MakeMaker results
558 my @MM = qw(VERSION XS_VERSION);
559 if ( -f "Makefile" ) {
560 print "\tReading MakeMaker Makefile...\n";
561 if ( open( MAKEFILE, "Makefile" ) ) {
573 warn "$0: Makefile: $!";
575 print "\tDeleting MakeMaker Makefile.\n";
581 if ( defined $CONF{EXTVERSION} ) {
582 my $EXTVERSION = $CONF{EXTVERSION};
583 print "\tUsing $EXTVERSION for version...\n";
584 $MM{VERSION} = $MM{XS_VERSION} = $EXTVERSION;
586 die "$0: VERSION or XS_VERSION undefined\n"
587 unless defined $MM{VERSION} && defined $MM{XS_VERSION};
588 if ( open( BASE_C, ">$basec" ) ) {
589 print BASE_C <<__EOF__;
591 #define VERSION "$MM{VERSION}"
594 #define XS_VERSION "$MM{XS_VERSION}"
600 warn "$0: $basec: $!";
604 "perl -I$BUILDROOT\\lib -I$PERLSDK\\lib $extu\\xsubpp -csuffix .cpp -typemap $extu\\typemap -noprototypes $basexs >> $basec"
609 die "$0: perl xsubpp failed: $!\n";
613 open( _INIT_C, ">_init.c" ) or die "$!: _init.c: $!\n";
614 print _INIT_C <<__EOF__;
617 EXPORT_C void _init(void *handle) {
622 my @src = ( "_init.c", sort keys %src );
624 if ( $base eq "Encode" ) { # Currently unused.
625 for my $submf ( glob("*/Makefile") ) {
626 my $d = dirname($submf);
627 print "Configuring Encode::$d...\n";
628 if ( open( SUBMF, $submf ) ) {
629 if ( update_dir($d) ) {
632 next if 1 .. /postamble/;
633 if (m!^(\w+_t)\.c : !) {
635 "perl ..\\bin\\enc2xs -Q -o $1.c -f $1.fnm")
637 or warn "$0: enc2xs: $!\n";
638 push @subsrc, "$1.c";
644 $subbase =~ s!/!::!g;
645 write_mmp( $ext, $subbase, ["..\\Encode"], "$subbase.c",
647 write_makefile( $subbase, $build );
648 write_bld_inf($subbase);
652 "perl -I$BUILDROOT\\lib ..\\$extu\\xsubpp -csuffix .cpp -typemap ..\\$extu\\typemap -noprototypes $subbase.xs > $subbase.c"
657 die "$0: perl xsubpp failed: $!\n";
662 warn "$0: chdir $d: $!\n";
666 warn "$0: $submf: $!";
669 print "Configuring Encode...\n";
672 write_mmp( $ext, $base, [ keys %incdir ], @src );
673 write_makefile( $base, $build );
676 $lstname =~ s:^ext\\::;
677 $lstname =~ s:\\:-:g;
678 print "\t$lstname.lst\n";
680 $CoreBuild ? "$BUILDROOT/symbian/$lstname.lst" : "$BUILDROOT/$lstname.lst";
681 if ( open( my $lst, ">$lstout" ) ) {
682 for my $f (@lst) { print $lst qq["$f"-"!:$lst{$f}"\n] }
686 die "$0: $lstout: $!\n";
688 update_dir($BUILDROOT);
693 $CWD =~ s!^[A-Z]:!!i;
697 for my $ext (@ARGV) {
700 my $extdash = $ext =~ /ext\\/ ? $ext : "ext\\$ext"; $extdash =~ s!\\!-!g;
705 $cfg = $2 if $ext =~ s/(.+?),(.+)/$1/;
710 if ( $ext =~ /\.xs$/ && !-f $ext ) {
711 if ( -f "ext\\$ext" ) {
713 $dir = dirname($ext);
717 if ( -d "ext\\$ext" ) {
722 $dir = "." unless defined $dir;
725 if ( $ext =~ /\.xs$/ && -f $ext ) {
726 $ext = dirname($ext);
734 if ( $ext eq "XSLoader" ) {
735 $ext = "ext\\XSLoader";
737 if ( $ext eq "ext\\XSLoader" ) {
738 $dir = "ext\\DynaLoader";
741 $EXTCFG{$ext} = [ split( /,/, $cfg ) ] if defined $cfg;
743 die "$0: no lib\\Config.pm\n"
744 if $CoreBuild && $Build && !-f "lib\\Config.pm";
747 open( my $cfg, "symbian/install.cfg" )
748 or die "$0: symbian/install.cfg: $!\n";
750 $extdir =~ s:^ext\\::;
752 next unless /^ext\s+(.+)/;
755 my @ext = split( ' ', $ext );
756 $EXTCFG{"ext\\$ext[0]"} = [@ext];
761 if ( $Config || $Build ) {
762 xsconfig( $ext, $dir ) or die "$0: xsconfig '$ext' failed\n";
767 warn "$0: No directory for $ext, skipping...\n";
771 my $chdir = $ext eq "ext\\XSLoader" ? "ext\\DynaLoader" : $dir;
772 die "$0: no directory '$chdir'\n" unless -d $chdir;
773 update_dir($chdir) or die "$0: chdir '$chdir' failed: $!\n";
777 my @ext = split( /\\/, $ext );
780 if ( $Clean || $DistClean ) {
781 print "Cleaning $ext...\n";
785 unlink("const-c.inc");
786 unlink("const-xs.inc");
790 if ( $Build && $ext ne "ext\\XSLoader" && $ext ne "ext\\Errno" ) {
792 # We compile the extension three (3) times.
793 # (1) Only the _init.c to get _init() as the ordinal 1 function in the DLL.
794 # (2) With the rest and the _init.c to get ordinals for the rest.
795 # (3) With an updated _init.c that carries the symbols from step (2).
797 system_echo("make clean");
798 system_echo("make defrost") == 0 or warn "$0: make defrost failed\n";
802 push @TARGET, 'sis' if $Sis;
805 # Hide all but the _init.c.
806 print "\n*** $ext - Compile 1 of 3.\n\n";
807 print "(patching $base.mmp)\n";
809 "perl -pi.bak -e \"s:^SOURCE\\s+_init.c:SOURCE\\t_init.c // :\" $base.mmp"
811 system_echo("bldmake bldfiles");
812 system_echo("make @TARGET") == 0 or die "$0: make #1 failed\n";
815 # Reveal the rest again.
816 print "\n*** $ext - Compile 2 of 3.\n\n";
817 print "(patching $base.mmp)\n";
819 "perl -pi.bak -e \"s:^SOURCE\\t_init.c // :SOURCE\\t_init.c :\" $base.mmp"
821 system_echo("make @TARGET") == 0 or die "$0: make #2 failed\n";
822 unlink("$base.mmp.bak");
824 open( _INIT_C, ">_init.c" ) or die "$0: _init.c: $!\n";
825 print _INIT_C <<'__EOF__';
829 /* This is a different but matching definition from in dl_symbian.xs. */
834 } PerlSymbianLibHandle;
836 EXPORT_C void _init(void* handle) {
842 for my $f ("$SYMBIAN_ROOT\\Epoc32\\Build$CWD\\$base\\WINS\\perl$VERSION-$extdash.def",
843 "..\\BMARM\\perl$VERSION-${extdash}u.def") {
845 if ( open( $def, $f ) ) {
853 unless (defined $basef) {
854 die "$0: failed to find .def for $base\n";
857 next while 1 .. /^EXPORTS/;
858 if (/^\s*(\w+) \@ (\d+) /) {
864 my @symbol = sort keys %symbol;
866 print _INIT_C <<'__EOF__';
868 PerlSymbianLibHandle* h = (PerlSymbianLibHandle*)handle;
870 h->symbols = newHV();
873 for my $sym (@symbol) {
874 my $len = length($sym);
875 print _INIT_C <<__EOF__;
876 hv_store(h->symbols, "$sym", $len, newSViv($symbol{$sym}), 0);
881 die "$0: $basef: no exports found\n";
884 print _INIT_C <<'__EOF__';
890 # Compile #3. This is for real.
891 print "\n*** $ext - Compile 3 of 3.\n\n";
892 system_echo("make @TARGET") == 0 or die "$0: make #3 failed\n";
895 elsif ( $Clean || $DistClean ) {
896 if ( $ext eq "ext\\Errno" ) {
897 unlink( "Errno.pm", "Makefile" );
900 if ( -f "Makefile" ) {
902 system_echo("make clean") == 0 or die "$0: make clean failed\n";
905 system_echo("make distclean") == 0
906 or die "$0: make distclean failed\n";
909 if ( $ext eq "ext\\Compress\\Raw\\Zlib" ) {
911 find( sub { push @bak, $File::Find::name if /\.bak$/ }, "." );
912 unlink(@bak) if @bak;
914 find( sub { push @src, $_ if -f $_ }, "zlib-src" );
915 unlink(@src) if @src;
916 unlink("constants.xs");
918 if ( $ext eq "ext\\Devel\\PPPort" ) {
922 my @D = glob("../BMARM/*.def ../BWINS/*.def");
924 my @B = glob("ext/BWINS ext/BMARM ext/*/BWINS ext/*/BMARM Makefile");
928 update_dir($BUILDROOT);