my $CoreBuild = -d "ext" && -f "perl.h" && -d "symbian" && -f "perl.c";
-my $SymbianVersion = $ENV{XSBUILD_SYMBIAN_VERSION};
+my $SymbianVersion;
+
+if (exists $ENV{EPOCROOT}) {
+ if ($ENV{EPOCROOT} =~ m!\\Symbian\\UIQ_21\\$!i) {
+ $SymbianVersion = '7.0s'; # TODO: other UIQ versions
+ } elsif ($ENV{EPOCROOT} =~ m!\\Symbian\\(.+?)\\!i) {
+ $SymbianVersion = $1;
+ }
+}
+
+$SymbianVersion = $ENV{XSBUILD_SYMBIAN_VERSION}
+ if exists $ENV{XSBUILD_SYMBIAN_VERSION};
+
my $PerlVersion = $ENV{XSBUILD_PERL_VERSION};
my $CSuffix = '.c';
my $CPlusPlus;
sub usage {
die <<__EOF__;
$0: Usage: $0 [--symbian=version] [--perl=version]
- [--csuffix=csuffix] [--cplusplus]
- [--win=win] [--arm=arm]
+ [--extversion=x.y]
+ [--csuffix=csuffix] [--cplusplus|--cpp]
+ [--win=win] [--arm=arm]
[--config|--build|--clean|--distclean|--sis] ext
__EOF__
}
}
if ( !defined $SymbianVersion) {
- ($SymbianVersion) = ($ENV{PATH} =~ m!C:\\Symbian\\(.+?)\\!i);
+ ($SymbianVersion) = ($ENV{PATH} =~ m!\\Symbian\\(.+?)\\!i);
}
-my $S60SDK;
+my ($SYMBIAN_ROOT, $SYMBIAN_VERSION, $SDK_NAME, $SDK_VARIANT, $SDK_VERSION);
if ($CoreBuild) {
unshift @INC, "symbian";
do "sanity.pl";
my %VERSION = %{ do "version.pl" };
- $SDK = do "sdk.pl";
+ ($SYMBIAN_ROOT, $SYMBIAN_VERSION, $SDK_NAME, $SDK_VARIANT, $SDK_VERSION) =
+ @{ do "sdk.pl" };
$VERSION = "$VERSION{REVISION}$VERSION{VERSION}$VERSION{SUBVERSION}";
$R_V_SV = "$VERSION{REVISION}.$VERSION{VERSION}.$VERSION{SUBVERSION}";
$BUILDROOT = do "cwd.pl";
- $SymbianVersion = $1 if $SDK =~ m:\\Symbian\\([^\\]+):;
$PerlVersion = $R_V_SV;
- $S60SDK = $ENV{S60SDK}; # from sdk.pl
}
+my %CONF;
+
usage()
unless GetOptions(
- 'symbian=s' => \$SymbianVersion,
- 'perl=s' => \$PerlVersion,
- 'csuffix=s' => \$CSuffix,
- 'cplusplus' => \$CPlusPlus,
- 'win=s' => \$WIN,
- 'arm=s' => \$ARM,
- 'config' => \$Config,
- 'build' => \$Build,
- 'clean' => \$Clean,
- 'distclean' => \$DistClean,
- 'sis' => \$Sis
+ 'symbian=s' => \$SymbianVersion,
+ 'perl=s' => \$PerlVersion,
+ 'extversion=s' => \$CONF{EXTVERSION},
+ 'csuffix=s' => \$CSuffix,
+ 'cplusplus|cpp' => \$CPlusPlus,
+ 'win=s' => \$WIN,
+ 'arm=s' => \$ARM,
+ 'config' => \$Config,
+ 'build' => \$Build,
+ 'clean' => \$Clean,
+ 'distclean' => \$DistClean,
+ 'sis' => \$Sis
);
usage() unless @ARGV;
print "Configuring with Symbian $SymbianVersion and Perl $PerlVersion...\n";
-$SDK = "\\Symbian\\$SymbianVersion" unless defined $SDK;
$PERLSDK = "\\Symbian\\Perl\\$PerlVersion";
$R_V_SV = $PerlVersion;
$VERSION =~ tr/.//d if defined $VERSION;
-$ENV{SDK} = $SDK; # For the Errno extension
-$ENV{CROSS} = 1; # For the Encode extension
+$ENV{SDK} = $SYMBIAN_ROOT; # For the Errno extension
+$ENV{CROSS} = 1; # For the Encode extension (unbuilt now)
my $UARM = 'urel';
-my $UREL = "$SDK\\epoc32\\release\\-ARM-\\$UARM";
+my $UREL = "$SYMBIAN_ROOT\\epoc32\\release\\-ARM-\\$UARM";
my $SRCDBG;
if (exists $ENV{UREL}) {
$UREL = $ENV{UREL}; # from sdk.pl
$SRCDBG = $UARM eq 'udeb' ? "SRCDBG" : "";
}
-my %CONF;
my %EXTCFG;
sub write_bld_inf {
$CONF{SOURCEPATH} = [ $CWD, $BUILDROOT ];
$CONF{USERINCLUDE} = [ $CWD, $BUILDROOT ];
$CONF{SYSTEMINCLUDE} = ["$PERLSDK\\include"] unless $CoreBuild;
- $CONF{SYSTEMINCLUDE} = [ $BUILDROOT ] if $CoreBuild;
+ $CONF{SYSTEMINCLUDE} = [ $BUILDROOT, "$BUILDROOT\\symbian" ] if $CoreBuild;
$CONF{LIBRARY} = [];
$CONF{MACRO} = [];
read_mmp( \%CONF, "_init.mmp" );
push @{ $CONF{MACRO} }, "PERL_GLOBAL_STRUCT";
push @{ $CONF{MACRO} }, "PERL_GLOBAL_STRUCT_PRIVATE";
+ if ($SDK_VARIANT eq 'S60') {
+ push @{ $CONF{MACRO} }, '__SERIES60__'
+ unless grep { $_ eq '__SERIES60__' } @{ $CONF{MACRO} };
+ }
+ if ($SDK_VARIANT eq 'S80') {
+ push @{ $CONF{MACRO} }, '__SERIES80__'
+ unless grep { $_ eq '__SERIES80__' } @{ $CONF{MACRO} };
+ }
+ if ($SDK_VARIANT eq 'UIQ') {
+ push @{ $CONF{MACRO} }, '__UIQ__'
+ unless grep { $_ eq '__UIQ__' } @{ $CONF{MACRO} };
+ }
+
for my $u (qw(SOURCE SOURCEPATH SYSTEMINCLUDE USERINCLUDE LIBRARY MACRO)) {
$CONF{$u} = uniquefy_filenames( $CONF{$u} );
}
print BASE_MMP <<__EOF__;
LIBRARY @{$CONF{LIBRARY}}
MACRO @{$CONF{MACRO}}
-// OPTION MSVC /P
-// OPTION GCC -E
+// OPTION MSVC /P // Uncomment for creating .i (cpp'ed .cpp)
+// OPTION GCC -E // Uncomment for creating .i (cpp'ed .cpp)
__EOF__
+# if (-f "$base.rss") {
+# print BASE_MMP "RESOURCE\t$base.rss\n";
+# }
close(BASE_MMP);
}
print "\tMakefile\n";
- my $windef1 = "$SDK\\Epoc32\\Build$CWD\\$base\\$WIN\\$base.def";
+ my $windef1 = "$SYMBIAN_ROOT\\Epoc32\\Build$CWD\\$base\\$WIN\\$base.def";
my $windef2 = "..\\BWINS\\${base}u.def";
- my $armdef1 = "$SDK\\Epoc32\\Build$CWD\\$base\\$ARM\\$base.def";
+ my $armdef1 = "$SYMBIAN_ROOT\\Epoc32\\Build$CWD\\$base\\$ARM\\$base.def";
my $armdef2 = "..\\BMARM\\${base}u.def";
- my $wrap = $SDK && $S60SDK eq '1.2' && $SDK !~ /_CW$/;
+ my $wrap = $SYMBIAN_ROOT && defined $SDK_VARIANT eq 'S60' && $SDK_VERSION eq '1.2' && $SYMBIAN_ROOT !~ /_CW$/;
my $ABLD = $wrap ? 'perl b.pl' : 'abld';
open( MAKEFILE, ">Makefile" ) or die "$0: Makefile: $!\n";
print "\tUsing $EXTVERSION for version...\n";
$MM{VERSION} = $MM{XS_VERSION} = $EXTVERSION;
}
- die "VERSION or XS_VERSION undefined\n"
+ die "$0: VERSION or XS_VERSION undefined\n"
unless defined $MM{VERSION} && defined $MM{XS_VERSION};
if ( open( BASE_C, ">$basec" ) ) {
print BASE_C <<__EOF__;
for my $ext (@ARGV) {
$ext =~ s!::!\\!g;
- my $extdash = "ext\\$ext"; $extdash =~ s!\\!-!g;
+ my $extdash = $ext =~ /ext\\/ ? $ext : "ext\\$ext"; $extdash =~ s!\\!-!g;
$ext =~ s!/!\\!g;
my $cfg;
my %symbol;
my $def;
my $basef;
- for my $f ("$SDK\\Epoc32\\Build$CWD\\$base\\WINS\\perl$VERSION-$extdash.def",
+ for my $f ("$SYMBIAN_ROOT\\Epoc32\\Build$CWD\\$base\\WINS\\perl$VERSION-$extdash.def",
"..\\BMARM\\perl$VERSION-${extdash}u.def") {
print "\t($f - ";
if ( open( $def, $f ) ) {