diff options
Diffstat (limited to 'bin/patch_capabilities.pl')
-rw-r--r-- | bin/patch_capabilities.pl | 29 |
1 files changed, 23 insertions, 6 deletions
diff --git a/bin/patch_capabilities.pl b/bin/patch_capabilities.pl index ca80891..cf8353e 100644 --- a/bin/patch_capabilities.pl +++ b/bin/patch_capabilities.pl @@ -26,17 +26,26 @@ if (@ARGV) # Parse the first given script argument as a ".pkg" file name. my $pkgFileName = shift(@ARGV); - # Check if using template .pkg and do preprocessing if needed + # These variables will only be set for template .pkg files. + my $target; + my $platform; + + # Check if using template .pkg and set target/platform variables if (($pkgFileName =~ m|_template\.pkg$|i) && -r($pkgFileName)) { - my $target; - unless ($target = shift(@ARGV)) + my $targetplatform; + unless ($targetplatform = shift(@ARGV)) { Usage(); } - system ("createpackage.bat -p ".$pkgFileName." ".$target); - $pkgFileName =~ s/_template\.pkg/_${target}\.pkg/; + my @tmpvalues = split('-', $targetplatform); + $target = $tmpvalues[0]; + $platform = $tmpvalues[1]; + + # Convert visual target to real target (debug->udeb and release->urel) + $target =~ s/debug/udeb/i; + $target =~ s/release/urel/i; } # If the specified ".pkg" file exists (and can be read), @@ -80,8 +89,16 @@ if (@ARGV) my $destinationPath = $2; # If the given file is a binary, check the target and binary type (+ the actual filename) from its path. - if ($sourcePath =~ m:/epoc32/release/([^/]+)/(udeb|urel)/(\w+(\.dll|\.exe)):i) + if ($sourcePath =~ m:/epoc32/release/([^/]+)/(udeb|urel|\$\(TARGET\))/(\w+(\.dll|\.exe)):i) { + # Do preprocessing for template pkg, + # In case of template pkg target and platform variables are set + if(length($target) && length($platform)) + { + $sourcePath =~ s/\$\(PLATFORM\)/$platform/gm; + $sourcePath =~ s/\$\(TARGET\)/$target/gm; + } + push (@binaries, $sourcePath); } } |