diff options
Diffstat (limited to 'backends/platform/symbian/AdaptAllMMPs.pl')
-rw-r--r-- | backends/platform/symbian/AdaptAllMMPs.pl | 231 |
1 files changed, 144 insertions, 87 deletions
diff --git a/backends/platform/symbian/AdaptAllMMPs.pl b/backends/platform/symbian/AdaptAllMMPs.pl index 99c037379d..b576bb3993 100644 --- a/backends/platform/symbian/AdaptAllMMPs.pl +++ b/backends/platform/symbian/AdaptAllMMPs.pl @@ -6,31 +6,37 @@ chdir("../../../"); # list of project files to process @mmp_files = ( - "mmp/scummvm_scumm.mmp", - "mmp/scummvm_queen.mmp", - "mmp/scummvm_agos.mmp", - "mmp/scummvm_sky.mmp", - "mmp/scummvm_gob.mmp", - "mmp/scummvm_saga.mmp", - "mmp/scummvm_kyra.mmp", - "mmp/scummvm_sword1.mmp", - "mmp/scummvm_sword2.mmp", - "mmp/scummvm_lure.mmp", - "mmp/scummvm_cine.mmp", - "mmp/scummvm_agi.mmp", - "mmp/scummvm_touche.mmp", - "mmp/scummvm_parallaction.mmp", - "mmp/scummvm_cruise.mmp", - "mmp/scummvm_drascula.mmp", - "mmp/scummvm_igor.mmp", - "mmp/scummvm_made.mmp", + + # Engine Project files + "mmp/scummvm_agi.mmp", + "mmp/scummvm_agos.mmp", + "mmp/scummvm_cine.mmp", + "mmp/scummvm_cruise.mmp", + "mmp/scummvm_drascula.mmp", + "mmp/scummvm_gob.mmp", + "mmp/scummvm_igor.mmp", + "mmp/scummvm_kyra.mmp", + "mmp/scummvm_lure.mmp", "mmp/scummvm_m4.mmp", - "S60/ScummVM_S60.mmp", - "S60v3/ScummVM_S60v3.mmp", - "S80/ScummVM_S80.mmp", + "mmp/scummvm_made.mmp", + "mmp/scummvm_parallaction.mmp", + "mmp/scummvm_queen.mmp", + "mmp/scummvm_saga.mmp", + "mmp/scummvm_scumm.mmp", + "mmp/scummvm_sky.mmp", + "mmp/scummvm_sword1.mmp", + "mmp/scummvm_sword2.mmp", + "mmp/scummvm_touche.mmp", + + + # Target Platform Project Files + "S60/ScummVM_S60.mmp", + "S60v3/ScummVM_S60v3.mmp", + "S80/ScummVM_S80.mmp", "S90/ScummVM_S90.mmp", - "UIQ2/ScummVM_UIQ2.mmp", - "UIQ3/ScummVM_UIQ3.mmp" + "UIQ2/ScummVM_UIQ2.mmp", + "UIQ3/ScummVM_UIQ3.mmp" + ); # do this first to set all *.mmp & *.inf files to *.*.in states @@ -43,7 +49,7 @@ Updating slave MACRO settings in MMP files from master 'scummvm_base.mmp' "; -# do this first so we have @DisableDefines for correct inclusion of SOURCE files later +# do this first so we have @EnabledDefines and @DisabledDefines for correct inclusion of SOURCE files later UpdateSlaveMacros(); print " @@ -53,33 +59,40 @@ Preparing to update all the Symbian MMP project files with objects from module.m "; + +# some modules.mk files have #ifndef ENABLE_XXXX blocks: my @section_empty = (""); # section standard: no #ifdef's in module.mk files -my @sections_scumm = ("", "DISABLE_SCUMM_7_8", "DISABLE_HE"); # special sections for engine SCUMM +my @sections_scumm = ("", "ENABLE_SCUMM_7_8", "ENABLE_HE"); # special sections for engine SCUMM + # files excluded from build, case insensitive, will be matched in filename string only -my @excludes_snd = ( - "mt32", - "fluidsynth", - "i386", - "part.cpp", - "partial.cpp", - "partialmanager.cpp", +my @excludes_snd = ( + "mt32.*", + "fluidsynth.cpp", + "i386.cpp", + "part.*", "synth.cpp", "tables.cpp", - "freeverb.cpp" -); + "freeverb.cpp", + "rate.*" # not really needed, USE_ARM_SOUND_ASM currently not parsed correctly, + # "rate[_arm|_arm_asm].(cpp|s)" will be added later based on WINS/ARM build! + # These #defines for compile time are set in portdefs.h +); -my @excludes_graphics = ( -"iff.cpp" -); +my @excludes_graphics = ( + "iff.cpp" +); +# the USE_ARM_* defines not parsed correctly, exclude manually: my @excludes_scumm = ( - "codec47ARM.cpp", - "gfxARM.cpp", - "proc3arm.cpp" + ".*ARM.*", # the *ARM.s files are added in .mpp files based on WINS/ARM build! + # USE_ARM_SMUSH_ASM codec47ARM.s + # USE_ARM_GFX_ASM gfxARM.s + # USE_ARM_COSTUME_ASM proc3ARM.s compiled, linked?, but *not* used :P (portdefs.h) ); -#arseModule(mmpStr, dirStr, ifdefArray, [exclusionsArray]) + +#arseModule(mmpStr, dirStr, ifdefArray, [exclusionsArray]) ParseModule("_base", "base", \@section_empty); # now in ./TRG/ScummVM_TRG.mmp, these never change anyways... ParseModule("_base", "common", \@section_empty); ParseModule("_base", "gui", \@section_empty); @@ -98,14 +111,14 @@ ParseModule("_sword1", "sword1", \@section_empty); ParseModule("_sword2", "sword2", \@section_empty); ParseModule("_lure", "lure", \@section_empty); ParseModule("_cine", "cine", \@section_empty); -ParseModule("_agi", "agi", \@section_empty); +ParseModule("_agi", "agi", \@section_empty); ParseModule("_touche", "touche", \@section_empty); ParseModule("_parallaction","parallaction",\@section_empty); ParseModule("_cruise", "cruise", \@section_empty); ParseModule("_drascula","drascula", \@section_empty); ParseModule("_igor", "igor", \@section_empty); ParseModule("_made", "made", \@section_empty); -ParseModule("_m4", "m4", \@section_empty); +ParseModule("_m4", "m4", \@section_empty); print " ======================================================================================= Done. Enjoy :P @@ -115,7 +128,7 @@ Done. Enjoy :P ################################################################################################################## ################################################################################################################## -# parses multiple sections per mmp/module +# parses multiple sections per mmp/module sub ParseModule { my ($mmp,$module,$sections,$exclusions) = @_; @@ -140,7 +153,7 @@ sub CheckForModuleMK if (-d $item) { #print "$item\n"; - + opendir DIR, $item; #my @Files = readdir DIR; my @Files = grep s/^([^\.].*)$/$1/, readdir DIR; @@ -156,9 +169,10 @@ sub CheckForModuleMK if (-f $item and $item =~ /.*\/module.mk$/) { my $sec = ""; + my $isenable; my $ObjectsSelected = 0; my $ObjectsTotal = 0; - + print "$item for section '$section' ... "; open FILE, $item; @@ -167,14 +181,24 @@ sub CheckForModuleMK my $count = @lines; print "$count lines"; - + A: foreach $line (@lines) { - # found a section? reset + # all things we need are inside #ifdef sections, + # there is nothing we need in #ifndef sections: so ignore these for now + + # found a section? reset + if ($line =~ /^ifdef (.*)/) + { + $sec = $1; + $isenable = 1; + } if ($line =~ /^ifndef (.*)/) { $sec = $1; + $isenable = 0; } + # found an object? Not uncommented! if (!($line =~ /^#/) && $line =~ s/\.o/.cpp/) { @@ -187,27 +211,47 @@ sub CheckForModuleMK $line =~ s/ \\//; # remove possible trailing ' \' $line =~ s/\//\\/g; # replace / with \ chop($line); # remove \n - + # do we need to skip this file? According to our own @exclusions array foreach $exclusion (@exclusions) { if ($line =~ /$exclusion/i) { - print "\n ! $line (excluded, \@exclusions[$exclusion])"; + my $reason = "excluded, \@exclusions[$exclusion]"; + print "\n ! $line ($reason)"; + $output .= "//SOURCE $line ($reason)\n"; next A; } } - - # do we need to skip this file? According to MACROs in .MMPs - foreach $DisableDefine (@DisableDefines) + + # do we need to do this file? According to MACROs in .MMPs + my $found = 0; + foreach $EnableDefine (@EnabledDefines) { - if ($DisableDefine eq $section && $section ne '') + if (($EnableDefine eq $section) && ($section ne '')) { - print "\n !$line (excluded, MACRO $DisableDefine)"; - next A; + $found = 1; + last; } } - + foreach $DisableDefine (@DisabledDefines) + { + if (($DisableDefine eq $section) && ($section ne '')) + { + $found = 0; + last; + } + } + # always allow non-sections + $found = 1 if ($section eq ''); + if (!$found) + { + my $reason = "excluded, MACRO $section"; + print "\n !$line ($reason)"; + $output .= "//SOURCE $line ($reason)\n"; + next A; + } + $ObjectsSelected++; #print "\n $line"; $output .= "SOURCE $line\n"; @@ -230,7 +274,7 @@ sub UpdateProjectFile my $updated = " Updated @ ".localtime(); my $name; my @mmp_files_plus_one = @mmp_files; - unshift @mmp_files_plus_one, "mmp/scummvm_base.mmp"; + unshift @mmp_files_plus_one, "mmp/scummvm_base.mmp"; foreach $name (@mmp_files_plus_one) { @@ -239,23 +283,23 @@ sub UpdateProjectFile open FILE, "$file"; my @lines = <FILE>; close FILE; - + my $onestr = join("",@lines); - + if ($onestr =~ /$n/) { print " - $name @ $n updating ... "; - + $onestr =~ s/$a.*$b/$a$updated\n$output$b/s; open FILE, ">$file"; print FILE $onestr; close FILE; - + print "done.\n"; } } - + $output = ""; } @@ -265,7 +309,7 @@ sub UpdateSlaveMacros { my $updated = " Updated @ ".localtime(); - my $name = "mmp/scummvm_base.mmp"; + my $name = "mmp/scummvm_base.mmp"; my $file = "$buildDir/$name"; print "Reading master MACROS from backends/symbian/$name ... "; @@ -279,7 +323,7 @@ sub UpdateSlaveMacros my $b = "\/\/STOP_$n\/\/"; $onestr =~ /$a(.*)$b/s; my $macros = $1; - + my $libs_first = "\n// automagically enabled static libs from macros above\n"; my $libs_second = "STATICLIBRARY scummvm_base.lib // must be above USE_* .libs\n"; my $macro_counter = 0; @@ -292,32 +336,45 @@ sub UpdateSlaveMacros if ($line =~ /^.*MACRO\s*([0-9A-Z_]*)\s*\/\/\s*LIB\:(.*)$/) { my $macro = $1; my $lib = $2; - + # this macro enabled? then also add the .lib if ($line =~ /^\s*MACRO\s*$macro/m) { - # these are the USE_ libs + # add an USE_ lib? (these need to be added @ the beginning, before _base) $libs_second .= "STATICLIBRARY $lib\n" if ($macro =~ /^USE_/); + + # add an ENABLE_ lib? (these need to be added @ the end, after _base) + if ($macro =~ /^ENABLE_/) + { + $libs_first .= "STATICLIBRARY $lib\n"; + + # add projects for BLD.INF's + my $projectname = substr("$lib",0,-4); + $projects .= "..\\mmp\\$projectname.mmp\n"; + } } else { - # these are the non DISABLED_ libs - $libs_first .= "STATICLIBRARY $lib\n" if ($macro =~ /^DISABLE_/); - - # add projects for BLD.INF's - my $projectname = substr("$lib",0,-4); - $projects .= "..\\mmp\\$projectname.mmp\n" if ($macro =~ /^DISABLE_/); + # skip lines not beginning with "MACRO" (like "//MACRO") } $macro_counter++; } + # not commented out? then add the macro to output string if ($line =~ /^\s*MACRO\s*([0-9A-Z_]*)\s*/) { my $macro = $1; $macros2 .= "$line\n"; - push @DisableDefines, $macro; # used in CheckForModuleMK()!! + if ($macro =~ /^ENABLE_/) + { + push @EnabledDefines, $macro; # used in CheckForModuleMK()!! + } + elsif ($macro =~ /^DISABLE_/) + { + push @DisabledDefines, $macro; # used in CheckForModuleMK()!! + } } - } + } print "$macro_counter macro lines.\n"; @@ -328,23 +385,23 @@ sub UpdateSlaveMacros $m = "AUTO_PROJECTS"; $p = "\/\/START_$m\/\/"; $q = "\/\/STOP_$m\/\/"; - + foreach $name (@mmp_files) { $file = "$buildDir/$name"; $fileBLDINF = $buildDir .'/'. substr($name, 0, rindex($name, "/")) . "/BLD.INF"; print "Updating macros in $file ... "; #print "Updating macros in backends/symbian/$name ... "; - + open FILE, "$file"; @lines = <FILE>; close FILE; $onestr = join("",@lines); - + my $extralibs = ""; # output # slash in name means it's a phone specific build file: add LIBs $extralibs .= "$libs_first$libs_second" if (-e $fileBLDINF); - + $onestr =~ s/$a.*$b/$a$updated$macros2$extralibs$b/s; - + open FILE, ">$file"; print FILE $onestr; close FILE; my $count = @lines; @@ -358,13 +415,13 @@ sub UpdateSlaveMacros open FILE, "$fileBLDINF"; @lines = <FILE>; close FILE; $onestr = join("",@lines); - + $onestr =~ s/$p.*$q/$p$updated$projects$q/s; - + open FILE, ">$fileBLDINF"; print FILE $onestr; close FILE; } } -} +} ################################################################################################################## @@ -372,10 +429,10 @@ sub ResetProjectFiles() { my $onestr, @lines; my @mmp_files_plus_one = @mmp_files; -# unshift @mmp_files_plus_one, "mmp/scummvm_base.mmp"; - +# unshift @mmp_files_plus_one, "mmp/scummvm_base.mmp"; + print "Resetting project files: "; - + # we don't need to do mmp/scummvm_base.mmp", it was done in BuildPackageUpload.pl before the call to this script foreach $name (@mmp_files_plus_one) { @@ -395,7 +452,7 @@ sub ResetProjectFiles() $onestr = join("",@lines); open FILE, ">$fileBLDINF"; print FILE $onestr; close FILE; } - } + } print "... done.\n"; } |