author | Joe Branton <joe.branton@accenture.com> |
Thu, 29 Jul 2010 12:05:54 +1000 | |
changeset 16 | 18a55d594fba |
parent 4 | c061fa280d92 |
child 24 | 0653c7ef68b2 |
permissions | -rw-r--r-- |
0
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
1 |
#!perl |
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
2 |
# fsh-buildsis |
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
3 |
# |
4
c061fa280d92
copyright header tidy up
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
3
diff
changeset
|
4 |
# Copyright (c) 2008 - 2010 Accenture. All rights reserved. |
0
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
5 |
# This component and the accompanying materials are made available |
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
6 |
# under the terms of the "Eclipse Public License v1.0" |
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
7 |
# which accompanies this distribution, and is available |
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
8 |
# at the URL "http://www.eclipse.org/legal/epl-v10.html". |
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
9 |
# |
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
10 |
# Initial Contributors: |
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
11 |
# Accenture - Initial contribution |
4
c061fa280d92
copyright header tidy up
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
3
diff
changeset
|
12 |
|
0
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
13 |
# Description: |
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
14 |
# fsh-buildsis - A tool that generates SIS files. |
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
15 |
|
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
16 |
use strict; |
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
17 |
use Cwd; |
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
18 |
use Getopt::Long; |
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
19 |
use File::Basename; |
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
20 |
use File::Copy; |
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
21 |
use FindBin; |
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
22 |
use lib "$FindBin::Bin"; |
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
23 |
use fshu; |
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
24 |
|
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
25 |
|
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
26 |
# |
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
27 |
# Constants. |
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
28 |
# |
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
29 |
|
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
30 |
# Have to hard-code the old GCC CPP path, because SBS puts the new version in %PATH%, and that breaks our macros. Need to fix properly or fix the actual macros |
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
31 |
#my $kCpp = "cpp -P -I../../include -I. -include ltk_makesis_defs.iby"; |
2
68b921ce1944
Fixes for building on a non-substed drive.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
0
diff
changeset
|
32 |
my $kCpp = "$ENV{EPOCROOT}epoc32\\gcc\\bin\\cpp -P -I../../include -I. -include fsh_makesis_defs.iby"; |
0
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
33 |
|
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
34 |
# |
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
35 |
# Globals. |
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
36 |
# |
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
37 |
|
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
38 |
my %options = (); |
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
39 |
|
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
40 |
|
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
41 |
# |
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
42 |
# Main. |
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
43 |
# |
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
44 |
|
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
45 |
BuildSis(ProcessCommandLine()); |
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
46 |
|
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
47 |
# |
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
48 |
# Subs. |
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
49 |
# |
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
50 |
|
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
51 |
sub ProcessCommandLine { |
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
52 |
my $help; |
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
53 |
GetOptions('h|help' => \$help, |
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
54 |
'k|keep-pkg-file' => \$options{keepPkgFile}, |
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
55 |
'u|keep-unsigned-sis' => \$options{keepUnsignedSis}, |
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
56 |
'v|verbose' => \$options{verbose}) or DisplayHelp(); |
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
57 |
DisplayHelp() if ($help); |
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
58 |
warn "Invalid arguments\n" and DisplayHelp() unless ((@ARGV == 3) or (@ARGV == 5)); |
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
59 |
return @ARGV; |
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
60 |
} |
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
61 |
|
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
62 |
sub DisplayHelp { |
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
63 |
require Pod::Text; |
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
64 |
print "\n"; |
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
65 |
my $parser = Pod::Text->new(); |
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
66 |
$parser->parse_from_file($0); |
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
67 |
exit; |
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
68 |
} |
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
69 |
|
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
70 |
sub BuildSis { |
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
71 |
my $platform = shift; |
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
72 |
my $ibyFileName = shift; |
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
73 |
my $sisFileName = shift; |
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
74 |
my $certFileName = shift; |
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
75 |
my $keyFileName = shift; |
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
76 |
|
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
77 |
# |
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
78 |
# 1) Run the pre-processor over the supplied .iby file and capture the output |
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
79 |
# to a temporary file. |
3
859da167ccfe
Fixing some epocroot build issues. Added tefcons for hooking fshell into TestExecute.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
2
diff
changeset
|
80 |
my $tempFileName = "$ENV{TEMP}\\fsh-buildsis_temp.pkg"; |
0
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
81 |
if (-e $tempFileName) { |
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
82 |
unlink $tempFileName; |
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
83 |
} |
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
84 |
my $ibyDirName = dirname($ibyFileName); |
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
85 |
$ibyFileName = basename($ibyFileName); |
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
86 |
my $cwd = cwd(); |
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
87 |
chdir ($ibyDirName) or die "Error: Couldn't chdir to \"$ibyDirName\": $!\n"; |
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
88 |
my $command = "$kCpp -D$platform $ibyFileName 2>&1 >$tempFileName |"; |
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
89 |
print "Running \"$command\"\n" if ($options{verbose}); |
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
90 |
open (CPP, $command) or die "Error: Couldn't run \"cpp.exe\": $!\n"; |
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
91 |
my $error = 0; |
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
92 |
while (my $line = <CPP>) { |
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
93 |
print STDERR $line; |
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
94 |
$error = 1; |
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
95 |
} |
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
96 |
close (CPP); |
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
97 |
chdir ($cwd) or die "Error: Couldn't chdir back to \"$cwd\": $!\n"; |
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
98 |
if ($error) { |
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
99 |
die "Aborting due to the above error(s)\n"; |
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
100 |
} |
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
101 |
|
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
102 |
# |
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
103 |
# 2) Change the \n line endings in the temporary file to \r\n (that makesis.exe expects). |
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
104 |
# Also, substitute some version information. |
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
105 |
# |
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
106 |
my $version = fshu::Version(); |
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
107 |
$version =~ s/[^\d]//g; |
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
108 |
if ($version =~ /^\s*$/) { |
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
109 |
$version = 0; |
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
110 |
} |
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
111 |
my $timestamp = int ((time() % (24*60*60)) / 4); # Number of seconds since midnight, munged to fit in the buildnum (max 2^16) |
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
112 |
copy ($tempFileName, "$tempFileName.bak") or die "Error: Couldn't copy \"$tempFileName\" to \"$tempFileName.bak\": $!\n"; |
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
113 |
open (ORIG, "$tempFileName.bak") or die "Error: Couldn't open \"$tempFileName.bak\" for reading: $!\n"; |
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
114 |
open (NEW, ">$tempFileName") or die "Error: Couldn't open \"$tempFileName\" for writing: $!\n"; |
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
115 |
while (my $line = <ORIG>) { |
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
116 |
$line =~ s/FSHELL_VERSION/$version/; |
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
117 |
$line =~ s/FSHELL_TIMESTAMP/$timestamp/; |
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
118 |
print NEW $line; |
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
119 |
} |
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
120 |
close (NEW); |
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
121 |
close (ORIG); |
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
122 |
unlink "$tempFileName.bak"; |
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
123 |
|
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
124 |
# |
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
125 |
# 3) Run makesis.exe itself. |
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
126 |
# |
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
127 |
my $unsignedSisFileName = $sisFileName; |
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
128 |
$unsignedSisFileName =~ s/\.sis/\.unsigned\.sis/i; |
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
129 |
fshu::MakePath(dirname($unsignedSisFileName)); |
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
130 |
$command = "makesis -d$ENV{EPOCROOT} $tempFileName $unsignedSisFileName 2>&1"; |
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
131 |
print "Running \"$command\"\n" if ($options{verbose}); |
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
132 |
my $exitcode = system($command) >> 8; |
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
133 |
print "\n"; # Makesis doesn't do this |
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
134 |
print "Exit code from makesis: $exitcode\n" if ($options{verbose}); |
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
135 |
|
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
136 |
if ($exitcode) { |
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
137 |
die "Aborting due to the above error(s) - check $tempFileName\n"; |
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
138 |
} |
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
139 |
elsif ($options{keepPkgFile}) { |
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
140 |
print "Kept \"$tempFileName\"\n"; |
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
141 |
} |
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
142 |
else { |
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
143 |
unlink $tempFileName; |
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
144 |
} |
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
145 |
|
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
146 |
# |
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
147 |
# 4) Run signsis.exe. |
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
148 |
# |
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
149 |
if (defined $certFileName and defined $keyFileName) { |
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
150 |
$command = "signsis $unsignedSisFileName $sisFileName $certFileName $keyFileName"; |
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
151 |
print "Running \"$command\"\n" if ($options{verbose}); |
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
152 |
system ($command); |
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
153 |
} |
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
154 |
|
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
155 |
unless ($options{keepUnsignedSis}) { |
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
156 |
unlink $unsignedSisFileName; |
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
157 |
} |
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
158 |
} |
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
159 |
|
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
160 |
__END__ |
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
161 |
|
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
162 |
=head1 NAME |
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
163 |
|
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
164 |
fsh-buildsis - A tool that generates SIS files. |
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
165 |
|
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
166 |
=head1 SYNOPSIS |
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
167 |
|
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
168 |
fsh-buildsis <platform> <input_iby_file_name> <output_sis_file_name> [<certificate_file_name> <private_key_file_name>] |
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
169 |
|
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
170 |
options: |
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
171 |
|
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
172 |
-h (--help) Display this help page. |
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
173 |
-v (--verbose) Verbose output. |
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
174 |
-k (--keep-pkg-file) Don't delete the generated .pkg file. |
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
175 |
-u (--keep-unsigned-sis) Keep a copy the .SIS file before it is signed. |
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
176 |
Appends ".unsigned" to the base file name. |
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
177 |
|
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
178 |
=head1 DESCRIPTION |
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
179 |
|
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
180 |
FShell uses pre-processor magic to allow its F<.iby> files to be used by both C<BUILDROM> and C<MAKESIS>. Because C<BUILDROM> runs the pre-processor over any files it reads, this arrangement just works when building ROMs. However, C<MAKESIS> doesn't use the pre-processor. This script is responsible for generating a temporary file that contains suitably pre-processed F<.iby> data. It then runs C<MAKESIS> on this temporary file. |
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
181 |
|
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
182 |
The <platform> argument must be one of gcce or armv5. |
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
183 |
|
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
184 |
=head1 KNOWN BUGS |
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
185 |
|
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
186 |
None known. |
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
187 |
|
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
188 |
=head1 COPYRIGHT |
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
189 |
|
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
190 |
Copyright (c) 2008-2010 Accenture. All rights reserved. |
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
191 |
|
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
192 |
=cut |