taskswitcher/testapplications/generator/generator/devide_sis.pl
changeset 117 c63ee96dbe5f
equal deleted inserted replaced
115:3ab5c078b490 117:c63ee96dbe5f
       
     1 use strict;
       
     2 
       
     3 my $pkgbase = ";Language - standard language definitions
       
     4 \&EN,FI,ZH,JA
       
     5 
       
     6 ; standard SIS file header
       
     7 \#{\"HelloWorldBasicREPLACE1\", \"HelloWorldBasicREPLACE1\", \"HelloWorldBasicREPLACE1\", \"HelloWorldBasicREPLACE1\"},(REPLACEUID),1,0,0
       
     8 
       
     9 ;Localised Vendor name
       
    10 \%{\"Vendor-EN\", \"Vendor-FI\", \"Vendor-ZH\", \"Vendor-JA\"}
       
    11 
       
    12 ;Unique Vendor name
       
    13 :\"Vendor\"
       
    14 
       
    15 ;Supports Series 60 v 3.0
       
    16 [0x101F7961], 0, 0, 0, {\"S60ProductID\", \"S60ProductID\", \"S60ProductID\", \"S60ProductID\"}
       
    17 
       
    18 ";
       
    19 
       
    20 my $pkgfiles = ";Files
       
    21 \"\\epoc32\\release\\armv5\\urel\\HelloWorldBasicREPLACE2.exe\" -\"!:\\sys\\bin\\HelloWorldBasicREPLACE2.exe\"
       
    22 
       
    23 \"\\epoc32\\data\\z\\resource\\apps\\HelloWorldBasicREPLACE2.rsc\" -\"!:\\resource\\apps\\HelloWorldBasicREPLACE2.rsc\"
       
    24 \"\\epoc32\\data\\z\\resource\\apps\\HelloWorldBasicREPLACE2.r09\" -\"!:\\resource\\apps\\HelloWorldBasicREPLACE2.r09\"
       
    25 \"\\epoc32\\data\\z\\resource\\apps\\HelloWorldBasicREPLACE2.r31\" -\"!:\\resource\\apps\\HelloWorldBasicREPLACE2.r31\"
       
    26 \"\\epoc32\\data\\z\\resource\\apps\\HelloWorldBasicREPLACE2.r32\" -\"!:\\resource\\apps\\HelloWorldBasicREPLACE2.r32\"
       
    27 
       
    28 \"\\epoc32\\data\\z\\private\\10003a3f\\import\\apps\\HelloWorldBasicREPLACE2_reg.rsc\" -\"!:\\private\\10003a3f\\import\\apps\\HelloWorldBasicREPLACE2_reg.rsc\"
       
    29 \"\\epoc32\\data\\z\\private\\10003a3f\\import\\apps\\HelloWorldBasicREPLACE2_reg.r09\" -\"!:\\private\\10003a3f\\import\\apps\\HelloWorldBasicREPLACE2_reg.r09\"
       
    30 \"\\epoc32\\data\\z\\private\\10003a3f\\import\\apps\\HelloWorldBasicREPLACE2_reg.r31\" -\"!:\\private\\10003a3f\\import\\apps\\HelloWorldBasicREPLACE2_reg.r31\"
       
    31 \"\\epoc32\\data\\z\\private\\10003a3f\\import\\apps\\HelloWorldBasicREPLACE2_reg.r32\" -\"!:\\private\\10003a3f\\import\\apps\\HelloWorldBasicREPLACE2_reg.r32\"
       
    32 \"\\epoc32\\data\\z\\resource\\apps\\helloworldbasicREPLACE2_aif.mif\" -\"!:\\resource\\apps\\helloworldbasicREPLACE2_aif.mif\"
       
    33 ;end
       
    34 ";
       
    35 
       
    36 my $appnum = shift;
       
    37 my $baseuid = 0xA000018A;
       
    38 my $defaultappforpkg = 5;
       
    39 my $filenum = $appnum/$defaultappforpkg;
       
    40 if ($appnum%$defaultappforpkg > 0) 
       
    41     {
       
    42     $filenum++;
       
    43     }
       
    44 
       
    45 generate();
       
    46 
       
    47 sub generate()
       
    48     {
       
    49     my $i = 0;
       
    50     for ( $i=1; $i<=$filenum; $i++ ) 
       
    51         {
       
    52         my $filepart =".\\sis\\helloworldbasicPart".$i."\.pkg";
       
    53         open FW, ">$filepart" or die "Couldn't open $filepart to write";
       
    54         binmode FW;
       
    55         print FW replaceheader($i);
       
    56         my $fb = filesbegin($i);
       
    57         my $fe = filesend($i);
       
    58         for(my $f=$fb; $f<=$fe; $f++)
       
    59             {
       
    60             print FW replacefiles($f);
       
    61             }        
       
    62         close FW;    
       
    63         }    
       
    64     }
       
    65     
       
    66 sub filesend()
       
    67     {
       
    68     my $fileiter = shift;
       
    69     my $fend = $fileiter*$defaultappforpkg;
       
    70     if($fend>$appnum)
       
    71         {
       
    72         $fend = $appnum;
       
    73         }
       
    74     return $fend;
       
    75     }
       
    76     
       
    77 sub filesbegin()
       
    78     {
       
    79     my $fileiter = shift;
       
    80     my $fbegin = ($fileiter-1)*$defaultappforpkg+1;
       
    81     return $fbegin;
       
    82     }    
       
    83     
       
    84 sub replaceheader()
       
    85     {
       
    86     my $it = shift;
       
    87     my $tempbuf = $pkgbase;
       
    88     $tempbuf =~ s/REPLACE1/$it/sg;
       
    89     $it = ($it-1)*$defaultappforpkg + 1;
       
    90     my $tempuid = uid($it);
       
    91     $tempbuf =~ s/REPLACEUID/$tempuid/sg;
       
    92     return $tempbuf;
       
    93     }
       
    94     
       
    95 sub replacefiles()
       
    96     {
       
    97     my $it = shift;
       
    98     my $tempbuf = $pkgfiles;
       
    99     $tempbuf =~ s/REPLACE2/$it/sg;
       
   100     return $tempbuf;
       
   101     }    
       
   102     
       
   103 sub uid
       
   104     {
       
   105     my $iter = shift;
       
   106     my $uuid = $baseuid + $iter -1;
       
   107     my $hu = sprintf '%#X',  $uuid;
       
   108     $hu =~s/X/x/;
       
   109     return $hu;
       
   110     }