summaryrefslogtreecommitdiffstats
path: root/bin/patch_capabilities.pl
diff options
context:
space:
mode:
Diffstat (limited to 'bin/patch_capabilities.pl')
-rw-r--r--bin/patch_capabilities.pl35
1 files changed, 26 insertions, 9 deletions
diff --git a/bin/patch_capabilities.pl b/bin/patch_capabilities.pl
index 005d587..cf8353e 100644
--- a/bin/patch_capabilities.pl
+++ b/bin/patch_capabilities.pl
@@ -13,7 +13,7 @@ sub Usage() {
print("If no capabilities are given, the binaries will be given the\n");
print("capabilities supported by self-signed certificates.\n");
print("\nUsage: patch_capabilities.pl pkg_filename [target-platform] [capability list]\n");
- print(" If template .pkg file is given, next agrument must be 'target-platform'.\n");
+ print(" If template .pkg file is given, next agrument must be 'target-platform'.\n");
print("\nE.g. patch_capabilities.pl myapp_template.pkg release-armv5 \"All -TCB\"\n");
exit();
}
@@ -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
- if (($pkgFileName =~ m|_template\.pkg$|i) && -r($pkgFileName))
+ # 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);
}
}