|
1 // Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0"" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // makesis main function |
|
15 // INCLUDES |
|
16 // |
|
17 // |
|
18 |
|
19 /** |
|
20 @file |
|
21 @internalComponent |
|
22 @released |
|
23 */ |
|
24 #include <iostream> |
|
25 #include <new> |
|
26 #include <fstream> |
|
27 |
|
28 |
|
29 #include "utils.h" |
|
30 #include "utility_interface.h" |
|
31 #include "openssllicense.h" |
|
32 #include "makesis.h" |
|
33 |
|
34 // =========================================================================== |
|
35 // CONSTANTS |
|
36 // =========================================================================== |
|
37 |
|
38 #ifndef _UNICODE |
|
39 #error _UNICODE expected |
|
40 #endif // _UNICODE |
|
41 |
|
42 // =========================================================================== |
|
43 // CMakeSIS |
|
44 // The main application object. Controls the SIS file generation process |
|
45 // =========================================================================== |
|
46 |
|
47 void CMakeSIS::ShowBanner() |
|
48 // Displays the copyright... |
|
49 { |
|
50 std::wcout << std::endl << L"MAKESIS " << L" Version 5.3.0.0" << std::endl; |
|
51 std::wcout << L"A utility for creating Software Installation (SIS) files" << std::endl; |
|
52 std::wcout << L"Copyright (c) Symbian Software Ltd. 2000-2008 All rights reserved. " << std::endl; |
|
53 #ifdef _DEBUG |
|
54 std::wcout << std::endl << L"Development Version" << std::endl; |
|
55 #endif |
|
56 std::wcout << std::endl; |
|
57 } |
|
58 |
|
59 |
|
60 void CMakeSIS::DoMsg(const wchar_t* aText1, const wchar_t* aText2) const |
|
61 // Purpose : Displays 'verbose' output text - if appropriate |
|
62 // Inputs : pszText - The text to display |
|
63 { |
|
64 if(iLineNo > 0) |
|
65 { |
|
66 char fileName[PATHMAX] = "\0"; |
|
67 ConvertWideCharToMultiByte(iCmdOptions.SourceFile() , -1 , fileName , PATHMAX); |
|
68 unsigned long bytesWritten; |
|
69 void *hndl = GetStdHandle(STD_OUTPUT_HANDLE); |
|
70 WriteConsole(hndl,iCmdOptions.SourceFile(),wcslen(iCmdOptions.SourceFile()),&bytesWritten,0); |
|
71 std::wcout << L"(" << iLineNo << L")" << L" : "; |
|
72 } |
|
73 |
|
74 std::wcout << aText1 << aText2 << std::endl; |
|
75 } |
|
76 |
|
77 void CMakeSIS::DoMsg(const wchar_t* aText) const |
|
78 { |
|
79 std::wcout << aText << std::endl; |
|
80 } |
|
81 |
|
82 void CMakeSIS::DoErrMsg(const wchar_t* aText) const |
|
83 { |
|
84 DoMsg(L"error: ", aText); |
|
85 } |
|
86 |
|
87 void CMakeSIS::DoVerbage(const wchar_t* aText) const |
|
88 // Purpose : Displays 'verbose' output text - if appropriate |
|
89 // Inputs : pszText - The text to display |
|
90 { |
|
91 if(Verbose()) |
|
92 DoMsg(L"", aText); |
|
93 } |
|
94 |
|
95 void CMakeSIS::ShowUtilsError(TUtilsException aError) |
|
96 // Purpose : Write message for any error which occured whilst parsing the input pkg file |
|
97 // Inputs : err - the error ID |
|
98 { |
|
99 switch(aError) |
|
100 { |
|
101 case ErrNotEnoughMemory: |
|
102 DoErrMsg(L"not enough memory"); |
|
103 break; |
|
104 case ErrCannotOpenFile: |
|
105 DoErrMsg(L"cannot open file, check filename and access rights"); |
|
106 break; |
|
107 case ErrCannotReadFile: |
|
108 DoErrMsg(L"cannot read file, check access rights"); |
|
109 break; |
|
110 case ErrCannotWriteFile: |
|
111 DoErrMsg(L"cannot write file, check disk space"); |
|
112 break; |
|
113 case ErrCannotConvertFile: |
|
114 DoErrMsg(L"cannot convert file to unicode"); |
|
115 DoErrMsg(L"make sure .PKG and .TXT files are either UTF8 or UNICODE"); |
|
116 break; |
|
117 case ErrCertFileKeyFileMismatch: |
|
118 DoErrMsg(L"key file does not match certificate(s) given"); |
|
119 DoErrMsg(L"make sure key and certificate(s) specified correspond"); |
|
120 break; |
|
121 } |
|
122 } |
|
123 |
|
124 void CMakeSIS::AddErrMsg(const wchar_t* aText) |
|
125 { |
|
126 iInterpretSisReport.push_back(InterpretSisError(aText, iLineNo)); |
|
127 } |
|
128 |
|
129 void CMakeSIS::AddInterpretSisError(TInterpretSisException aError) |
|
130 // Purpose : Write message for any error which occured whilst parsing the input pkg file |
|
131 // Inputs : err - the error ID |
|
132 { |
|
133 switch(aError) |
|
134 { |
|
135 case ErrInvalidAppType: |
|
136 AddErrMsg(L"Invalid Application Type. Package type PP not supported"); |
|
137 break; |
|
138 case ErrEmbeddedSisNotSupported: |
|
139 AddErrMsg(L"Embedded SIS file will not be installed by InterpretSis"); |
|
140 break; |
|
141 case ErrUserOptionsNotSupported: |
|
142 AddErrMsg(L"User options are not supported"); |
|
143 break; |
|
144 default: |
|
145 AddErrMsg(L"General error"); |
|
146 break; |
|
147 } |
|
148 } |
|
149 |
|
150 |
|
151 void CMakeSIS::ShowParseError(TParseException aError) |
|
152 // Purpose : Write message for any error which occured whilst parsing the input pkg file |
|
153 // Inputs : err - the error ID |
|
154 { |
|
155 switch(aError) |
|
156 { |
|
157 case ErrUnknownLine: |
|
158 DoErrMsg(L"unknown line"); |
|
159 break; |
|
160 case ErrHeaderAlreadyDefined: |
|
161 DoErrMsg(L"installation header already found"); |
|
162 break; |
|
163 case ErrUnknownLanguagesId: |
|
164 DoErrMsg(L"unknown language specified"); |
|
165 std::wcout << L" Usage : &aa[(dddd)],bb,...zz" << std::endl; |
|
166 std::wcout << L" AF - Afrikaans, SQ - Albanian, AH - Amharic" << std::endl; |
|
167 std::wcout << L" AR - Arabic, HY - Armenian, AU - Australian" << std::endl; |
|
168 std::wcout << L" AS - Austrian, BA - Basque, BE - Belarussian, BN - Bengali"<< std::endl; |
|
169 std::wcout << L" BG - Bulgarian, MY - Burmese, CA - Catalan" << std::endl; |
|
170 std::wcout << L" TC - Taiwan Chinese, HK - Hong Kong Chinese"<< std::endl; |
|
171 std::wcout << L" ZH - PRC Chinese"<< std::endl; |
|
172 std::wcout << L" HR - Croatian, CS - Czech, DA - Danish, DU - Dutch" << std::endl; |
|
173 std::wcout << L" EN - English, AM - American English, CE - Canadian English"<< std::endl; |
|
174 std::wcout << L" IE - International English, SA - SOUTh African English" << std::endl; |
|
175 std::wcout << L" ET - Estonian, FA - Farsi, FI - Finnish, BL - Belgian Flemish" << std::endl; |
|
176 std::wcout << L" FR - French, BF - Belgian French, CF - Canadian French"<< std::endl; |
|
177 std::wcout << L" IF - International French, SF - Swiss French"<< std::endl; |
|
178 std::wcout << L" GD - Scots Gaelic, GL - Galician, KA - Georgian, GE - German" << std::endl; |
|
179 std::wcout << L" SG - Swiss German, EL - Greek, GU - Gujarati"<< std::endl; |
|
180 std::wcout << L" HE - Hebrew, HI - Hindi, HU - Hungarian" << std::endl; |
|
181 std::wcout << L" IC - Icelandic, IN - Indonesian, GA - Irish"<< std::endl; |
|
182 std::wcout << L" IT - Italian, SZ - Swiss Italian, JA - Japanese, " << std::endl; |
|
183 std::wcout << L" KN - Kannada, KK - Kazakh, KM - Khmer"<< std::endl; |
|
184 std::wcout << L" KO - Korean, LO - Laothian, LV - Latvian" << std::endl; |
|
185 std::wcout << L" LT - Lithuanian, MK - Macedonian, MS - Malay" << std::endl; |
|
186 std::wcout << L" ML - Malayalam, MR - Marathi, MO - Moldovian" << std::endl; |
|
187 std::wcout << L" MN - Mongolian, NZ - New Zealand, NO - Norwegian" << std::endl; |
|
188 std::wcout << L" NN - Norwegian Nynorsk, PL - Polish, PO - Portuguese"<< std::endl; |
|
189 std::wcout << L" BP - Brazilian Portuguese, PA - Punjabi, RO - Romanian" << std::endl; |
|
190 std::wcout << L" RU - Russian, SR - Serbian, SI - Sinhalese" << std::endl; |
|
191 std::wcout << L" SK - Slovak, SL - Slovenian, SO - Somali"<< std::endl; |
|
192 std::wcout << L" SP - Spanish, OS - International Spanish" << std::endl; |
|
193 std::wcout << L" LS - Latin American Spanish"<< std::endl; |
|
194 std::wcout << L" SH - Swahili, SW - Swedish, FS - Finland Swedish" << std::endl; |
|
195 std::wcout << L" TL - Tagalog, TA - Tamil, TE - Telugu, TH - Thai" << std::endl; |
|
196 std::wcout << L" BO - Tibetan, TI - Tigrinya, TU - Turkish"<< std::endl; |
|
197 std::wcout << L" CT - Cyprus Turkish, TK - Turkmen, UK - Ukrainian" << std::endl; |
|
198 std::wcout << L" UR - Urdu" << std::endl; |
|
199 //Put reserved here |
|
200 std::wcout << L" VI - Vietnamese, CY - Welsh, ZU - Zulu" << std::endl; |
|
201 std::wcout << std::endl |
|
202 << L" (dddd) - optional dialect ID" << std::endl; |
|
203 break; |
|
204 case ErrLanguagesAlreadyDefined: |
|
205 DoErrMsg(L"the languages have already been defined"); |
|
206 break; |
|
207 case ErrLanguagesNotDefined: |
|
208 DoErrMsg(L"languages have not been defined yet"); |
|
209 break; |
|
210 case ErrHeaderNotDefined: |
|
211 DoErrMsg(L"the installation header has not been defined"); |
|
212 break; |
|
213 case ErrNoMainDependency: |
|
214 DoErrMsg(L"missing main component dependency"); |
|
215 std::wcout << L"the header UID should equal the UID of the main component and dependency" << std::endl; |
|
216 break; |
|
217 case ErrFileNotFound: |
|
218 DoErrMsg(L"file not found"); |
|
219 break; |
|
220 case ErrPackageNotASISFile: |
|
221 DoErrMsg(L"component is not a SIS file"); |
|
222 break; |
|
223 case ErrBadCondFormat: |
|
224 DoErrMsg(L"incorrect condition format"); |
|
225 std::wcout << L" Usage : IF condition" << std::endl; |
|
226 std::wcout << L" ELSEIF condition" << std::endl; |
|
227 std::wcout << L" ELSE" << std::endl; |
|
228 std::wcout << L" ENDIF" << std::endl << std::endl; |
|
229 std::wcout << L" condition : var op \"string\"" << std::endl; |
|
230 std::wcout << L" var op number" << std::endl; |
|
231 std::wcout << L" EXISTS \"filename\"" << std::endl; |
|
232 std::wcout << L" (condition)AND(condition)" << std::endl; |
|
233 std::wcout << L" (condition)OR(condition)" << std::endl; |
|
234 std::wcout << L" NOT(condition)" << std::endl << std::endl; |
|
235 std::wcout << L" op : = <> > < >= <=" << std::endl; |
|
236 break; |
|
237 case ErrReadFailed: |
|
238 DoErrMsg(L"failed to read file"); |
|
239 break; |
|
240 case ErrBadOption: |
|
241 DoErrMsg(L"invalid option"); |
|
242 break; |
|
243 case ErrBadString: |
|
244 DoErrMsg(L"invalid string"); |
|
245 break; |
|
246 case ErrUnexpectedToken: |
|
247 DoErrMsg(L"unexpected text"); |
|
248 break; |
|
249 case ErrInvalidEscape: |
|
250 DoErrMsg(L"invalid UNICODE character value"); |
|
251 break; |
|
252 case ErrNumberOutOfRange: |
|
253 DoErrMsg(L"number std::wcout of range"); |
|
254 break; |
|
255 case ErrUnknownVariable: |
|
256 DoErrMsg(L"unknown variable name"); |
|
257 std::wcout << L" Known variables :" << std::endl; |
|
258 std::wcout << L" Manufacturer, ManufacturerHardwareRev, ManufacturerSoftwareRev," << std::endl; |
|
259 std::wcout << L" ManufacturerSoftwareBuild" << std::endl; |
|
260 std::wcout << L" Model" << std::endl; |
|
261 std::wcout << L" MachineUid" << std::endl; |
|
262 std::wcout << L" DeviceFamily, DeviceFamilyRev" << std::endl; |
|
263 std::wcout << L" CPU, CPUArch, CPUABI, CPUSpeed" << std::endl; |
|
264 std::wcout << L" SystemTickPeriod" << std::endl; |
|
265 std::wcout << L" MemoryRAM, MemoryRAMFree, MemoryROM, MemoryPageSize" << std::endl; |
|
266 std::wcout << L" PowerBackup" << std::endl; |
|
267 std::wcout << L" Keyboard, KeyboardDeviceKeys, KeyboardAppKeys, KeyboardClick," << std::endl; |
|
268 std::wcout << L" KeyboardClickVolumeMax" << std::endl; |
|
269 std::wcout << L" DisplayXPixels, DisplayYPixels, DisplayXTwips, DisplayYTwips," << std::endl; |
|
270 std::wcout << L" DisplayColors, DisplayContrastMax" << std::endl; |
|
271 std::wcout << L" Backlight" << std::endl; |
|
272 std::wcout << L" Pen, PenX, PenY, PenDisplayOn, PenClick, PenClickVolumeMax" << std::endl; |
|
273 std::wcout << L" Mouse, MouseX, MouseY, MouseButtons" << std::endl; |
|
274 std::wcout << L" CaseSwitch" << std::endl; |
|
275 std::wcout << L" LEDs" << std::endl; |
|
276 std::wcout << L" IntegratedPhone" << std::endl; |
|
277 std::wcout << L" NumHalAttributes" << std::endl; |
|
278 std::wcout << L" Language" << std::endl; |
|
279 std::wcout << L" RemoteInstall" << std::endl; |
|
280 break; |
|
281 case ErrUninstallNeedsWaitEnd: |
|
282 DoErrMsg(L"RW/RUNWAITEND option required with RR/RUNREMOVE or RB/RUNBOTH options"); |
|
283 break; |
|
284 case ErrUIDMismatch: |
|
285 DoErrMsg(L"UID in the embedded SIS file is not the same as the UID given in the package file."); |
|
286 break; |
|
287 case ErrCannotGetFullPath: |
|
288 DoErrMsg(L"Cannot get full path of embedded SIS file."); |
|
289 break; |
|
290 case ErrBadDestinationPath: |
|
291 DoErrMsg(L"Bad destination path for file."); |
|
292 break; |
|
293 case ErrDuplicateUID: |
|
294 DoErrMsg(L"UID in the embedded SIS file is the same as the UID of the main component."); |
|
295 break; |
|
296 case ErrExceedVersionNumber: |
|
297 DoErrMsg(L"The version numbers cannot be more than 32767."); |
|
298 break; |
|
299 case ErrUnBalancedParenthesis: |
|
300 DoErrMsg(L"parenthesis are not balanced"); |
|
301 break; |
|
302 case ErrHeaderRejectPreInstalledNonRemovable: |
|
303 DoErrMsg(L"Pre-installed packages can not be marked as non-removable."); |
|
304 break; |
|
305 case ErrInvalidInstallFlagOption: |
|
306 DoErrMsg(L"Install flag option is not supported with the given install type."); |
|
307 break; |
|
308 case ErrVersionInvalidRelationalOperator: |
|
309 DoErrMsg(L"Invalid Relational Operator within VERSION() condition"); |
|
310 ShowVersionFunctionSyntax(); |
|
311 break; |
|
312 case ErrVersionWildcardsNotSupported: |
|
313 DoErrMsg(L"Wildcards are not supported within VERSION() conditions"); |
|
314 ShowVersionFunctionSyntax(); |
|
315 break; |
|
316 case ErrVersionNegativesNotSupported: |
|
317 DoErrMsg(L"Negative version components are not supported within VERSION() conditions"); |
|
318 ShowVersionFunctionSyntax(); |
|
319 break; |
|
320 case ErrBadIntegerToStringConversion: |
|
321 DoErrMsg(L"Failed to successfully convert integer value to string"); |
|
322 break; |
|
323 default: |
|
324 DoErrMsg(L"syntax error"); |
|
325 break; |
|
326 } |
|
327 } |
|
328 void CMakeSIS::ShowCommandLineError(TCommandLineException aError) |
|
329 // Purpose : Write message for any error which occured whilst processing the command line (to |
|
330 // STDOUT ) |
|
331 // Inputs : err - the error ID |
|
332 { |
|
333 switch(aError) |
|
334 { |
|
335 case ErrInsufficientArgs: |
|
336 DoErrMsg(L"wrong number of arguments"); |
|
337 break; |
|
338 case ErrBadCommandFlag: |
|
339 DoErrMsg(L"unknown flag"); |
|
340 break; |
|
341 case ErrBadSourceFile: |
|
342 DoErrMsg(L"invalid source file"); |
|
343 break; |
|
344 case ErrNoSourceFile: |
|
345 DoErrMsg(L"no source file specified"); |
|
346 break; |
|
347 case ErrCannotOpenSourceFile: |
|
348 DoErrMsg(L"cannot open source file"); |
|
349 break; |
|
350 case ErrBadTargetFile: |
|
351 DoErrMsg(L"invalid destination file"); |
|
352 break; |
|
353 default: |
|
354 DoErrMsg(L"bad command line argumants"); |
|
355 break; |
|
356 } |
|
357 } |
|
358 |
|
359 void CMakeSIS::ShowUsage() |
|
360 { |
|
361 std::wcout << L"Usage : MakeSIS [-h] [-i] [-s] [-v] [-c] [-d directory] pkgfile [sisfile]" << std::endl << std::endl; |
|
362 std::wcout << L" Options : [-h] Show help page and PKG file format" << std::endl; |
|
363 std::wcout << L" Options : [-i] Show Open SSL licence" << std::endl; |
|
364 std::wcout << L" Options : [-s] Generate a ROM Stub" << std::endl; |
|
365 std::wcout << L" Options : [-v] Verbose output to screen" << std::endl; |
|
366 std::wcout << L" Options : [-c] Reports errors where the SIS file being generated will not be installable by InterpretSis" << std::endl; |
|
367 std::wcout << L" Options : [-d directory] Directory path to search" << std::endl; |
|
368 std::wcout << L" Options : [pkgfile] Name of the PKG file" << std::endl; |
|
369 std::wcout << L" Options : [sisfile] Output SIS filename. If not specified, the filename will be derived from the name of the PKG file" << std::endl; |
|
370 } |
|
371 |
|
372 void CMakeSIS::ShowSSL() |
|
373 { |
|
374 for (int index = 0; index < (sizeof(openSSLLicenseString)/sizeof(openSSLLicenseString[0])); index++) |
|
375 std::cout << openSSLLicenseString [index] << std::endl; |
|
376 } |
|
377 |
|
378 void CMakeSIS::ShowSyntax() |
|
379 // Writes a PKG syntax summary to STDOUT |
|
380 { |
|
381 // Show the title |
|
382 ShowBanner(); |
|
383 std::wcout << L"MakeSIS PKG File format help" << std::endl; |
|
384 std::wcout << L"============================" << std::endl << std::endl; |
|
385 std::wcout << L"&aa[(dddd)],bb,...,zz Define languages used in installation. Choose from:-" << std::endl; |
|
386 std::wcout << L" AF - Afrikaans, SQ - Albanian, AH - Amharic" << std::endl; |
|
387 std::wcout << L" AR - Arabic, HY - Armenian, AU - Australian" << std::endl; |
|
388 std::wcout << L" AS - Austrian, BA - Basque, BE - Belarussian, BN - Bengali"<< std::endl; |
|
389 std::wcout << L" BG - Bulgarian, MY - Burmese, CA - Catalan" << std::endl; |
|
390 std::wcout << L" TC - Taiwan Chinese, HK - Hong Kong Chinese"<< std::endl; |
|
391 std::wcout << L" ZH - PRC Chinese"<< std::endl; |
|
392 std::wcout << L" HR - Croatian, CS - Czech, DA - Danish, DU - Dutch" << std::endl; |
|
393 std::wcout << L" EN - English, AM - American English, CE - Canadian English"<< std::endl; |
|
394 std::wcout << L" IE - International English, SA - South African English" << std::endl; |
|
395 std::wcout << L" ET - Estonian, FA - Farsi, FI - Finnish, BL - Belgian Flemish" << std::endl; |
|
396 std::wcout << L" FR - French, BF - Belgian French, CF - Canadian French"<< std::endl; |
|
397 std::wcout << L" IF - International French, SF - Swiss French"<< std::endl; |
|
398 std::wcout << L" GD - Scots Gaelic, GL - Galician, KA - Georgian, GE - German" << std::endl; |
|
399 std::wcout << L" SG - Swiss German, EL - Greek, GU - Gujarati"<< std::endl; |
|
400 std::wcout << L" HE - Hebrew, HI - Hindi, HU - Hungarian" << std::endl; |
|
401 std::wcout << L" IC - Icelandic, IN - Indonesian, GA - Irish"<< std::endl; |
|
402 std::wcout << L" IT - Italian, SZ - Swiss Italian, JA - Japanese, " << std::endl; |
|
403 std::wcout << L" KN - Kannada, KK - Kazakh, KM - Khmer"<< std::endl; |
|
404 std::wcout << L" KO - Korean, LO - Laothian, LV - Latvian" << std::endl; |
|
405 std::wcout << L" LT - Lithuanian, MK - Macedonian, MS - Malay" << std::endl; |
|
406 std::wcout << L" ML - Malayalam, MR - Marathi, MO - Moldovian" << std::endl; |
|
407 std::wcout << L" MN - Mongolian, NZ - New Zealand, NO - Norwegian" << std::endl; |
|
408 std::wcout << L" NN - Norwegian Nynorsk, PL - Polish, PO - Portuguese"<< std::endl; |
|
409 std::wcout << L" BP - Brazilian Portuguese, PA - Punjabi, RO - Romanian" << std::endl; |
|
410 std::wcout << L" RU - Russian, SR - Serbian, SI - Sinhalese" << std::endl; |
|
411 std::wcout << L" SK - Slovak, SL - Slovenian, SO - Somali"<< std::endl; |
|
412 std::wcout << L" SP - Spanish, OS - International Spanish" << std::endl; |
|
413 std::wcout << L" LS - Latin American Spanish"<< std::endl; |
|
414 std::wcout << L" SH - Swahili, SW - Swedish, FS - Finland Swedish" << std::endl; |
|
415 std::wcout << L" TL - Tagalog, TA - Tamil, TE - Telugu, TH - Thai" << std::endl; |
|
416 std::wcout << L" BO - Tibetan, TI - Tigrinya, TU - Turkish"<< std::endl; |
|
417 std::wcout << L" CT - Cyprus Turkish, TK - Turkmen, UK - Ukrainian" << std::endl; |
|
418 std::wcout << L" UR - Urdu" << std::endl; |
|
419 //Put reserved here |
|
420 std::wcout << L" VI - Vietnamese, CY - Welsh, ZU - Zulu" << std::endl; |
|
421 std::wcout << std::endl |
|
422 << L" (dddd) - optional dialect ID" << std::endl << std::endl; |
|
423 std::wcout << L"#{\"NAMEaa\", ... \"NAMEzz\"},(UID), Major, Minor, Build, Options" << std::endl; |
|
424 std::wcout << L" Define file header, including name, uid and version" << std::endl; |
|
425 std::wcout << L"%{\"Vendor-EN\", ... \"Vendor-FR\"}" << std::endl; |
|
426 std::wcout << L" Localised vendor names" << std::endl; |
|
427 std::wcout << L":\"Symbian Software Ltd\"" << std::endl; |
|
428 std::wcout << L" The non-localised vendor name" << std::endl; |
|
429 std::wcout << L"=\"logo.jpg\",\"image/jpeg\",\"target.jpg\"" << std::endl; |
|
430 std::wcout << L" Define the logo using file, mimetype, and optional target" << std::endl; |
|
431 std::wcout << L"\"Source\"-\"Destination\",Options" << std::endl; |
|
432 std::wcout << L" File to be installed/viewed" << std::endl; |
|
433 std::wcout << L"@\"Component\",(UID)" << std::endl; |
|
434 std::wcout << L" Sub-component with UID to be installed" << std::endl; |
|
435 std::wcout << L"(UID),<versionrange>,{\"DEPENDaa\", ... \"DEPENDzz\"}" << std::endl; |
|
436 std::wcout << L" Define a dependency on another component version" << std::endl; |
|
437 std::wcout << L"[UID],<versionrange>,{\"DEPENDaa\", ... \"DEPENDzz\"}" << std::endl; |
|
438 std::wcout << L" Define a dependency on target hardware" << std::endl; |
|
439 std::wcout << L"Where <versionrange> is defined as:" << std::endl; |
|
440 std::wcout << L" Minimally, a single version of the form number major,minor,build" << std::endl; |
|
441 std::wcout << L" optionally, you may specify a range of versions in the form" << std::endl; |
|
442 std::wcout << L" major,minor,build~major,minor,build" << std::endl; |
|
443 std::wcout << L" Versions may include the wildcard '*' or -1" << std::endl; |
|
444 std::wcout << L"{ Start of a language block" << std::endl; |
|
445 std::wcout << L"\"Source\" A file to install within a language block" << std::endl; |
|
446 std::wcout << L"@\"Component\" A component to install within a language block" << std::endl; |
|
447 std::wcout << L"}-\"Destination\", Options" << std::endl; |
|
448 std::wcout << L" End a language block containing files" << std::endl; |
|
449 std::wcout << L"},(UID) End a language block containing components" << std::endl; |
|
450 std::wcout << L"IF condition Start of block which is installed if condition evaluates" << std::endl; |
|
451 std::wcout << L" to TRUE at install time. Condition format is of the form:-" << std::endl; |
|
452 std::wcout << L" condition : variable op number" << std::endl; |
|
453 std::wcout << L" EXISTS \"filename\"" << std::endl; |
|
454 std::wcout << L" (condition)AND(condition)" << std::endl; |
|
455 std::wcout << L" (condition)OR(condition)" << std::endl; |
|
456 std::wcout << L" NOT(condition)" << std::endl; |
|
457 std::wcout << L" op : = <> > < >= <=" << std::endl; |
|
458 std::wcout << L"ELSEIF condition Block which is installed if a previous condition block" << std::endl; |
|
459 std::wcout << L" was not evaluated and condition is TRUE" << std::endl; |
|
460 std::wcout << L"ELSE Block which is installed if no previous condition blocks" << std::endl; |
|
461 std::wcout << L" were evaluated" << std::endl; |
|
462 std::wcout << L"ENDIF Marks end of condition block(s)" << std::endl; |
|
463 } |
|
464 |
|
465 |
|
466 |
|
467 void CMakeSIS::DisplayInterpretSisReport() const |
|
468 { |
|
469 char fileName[PATHMAX] = "\0"; |
|
470 ConvertWideCharToMultiByte(iCmdOptions.SourceFile() , -1 , fileName , PATHMAX); |
|
471 unsigned long bytesWritten; |
|
472 void *hndl = GetStdHandle(STD_OUTPUT_HANDLE); |
|
473 for (InterpretSisErrors::const_iterator curr = iInterpretSisReport.begin() ; |
|
474 curr != iInterpretSisReport.end(); |
|
475 ++curr) |
|
476 { |
|
477 WriteConsole(hndl,iCmdOptions.SourceFile(),wcslen(iCmdOptions.SourceFile()),&bytesWritten,0); |
|
478 std::wcout << L"(" << curr->second << L")" << L" : " << curr->first << std::endl; |
|
479 } |
|
480 } |
|
481 |
|
482 void CMakeSIS::ShowVersionFunctionSyntax() const |
|
483 // Writes the correct usage of the VERSION() condition syntax to the command line |
|
484 { |
|
485 std::wcout << std::endl; |
|
486 std::wcout << L"Usage : VERSION( <Package Uid> , <Operator> , <vMajor> , <vMinor> , <vBuild> )" << std::endl << std::endl; |
|
487 std::wcout << L"<Package Uid> : UID of the installed package which is being queried in Hexadecimal" << std::endl; |
|
488 std::wcout << L"<Operator> : Relational comparison operator ( = <> > >= < <= )" << std::endl; |
|
489 std::wcout << L"<vMajor> : Major component of the version (Range 0 - 127)" << std::endl; |
|
490 std::wcout << L"<vMinor> : Minor component of the version (Range 0 - 99)" << std::endl; |
|
491 std::wcout << L"<vBuild> : Build component of the version (Range 0 - 32767)" << std::endl; |
|
492 } |
|
493 |
|
494 |
|
495 CMakeSIS::CMakeSIS() : |
|
496 iLineNo(0), |
|
497 iDump(false), |
|
498 iVerbose(false) |
|
499 {} |
|
500 |
|
501 int CMakeSIS::Run(int argc, wchar_t* argv[]) |
|
502 // Inputs : argc, argv, envp - The command line passed to the process |
|
503 { |
|
504 int err=1; |
|
505 |
|
506 try |
|
507 { |
|
508 iCmdOptions.ParseCommandLine(argc, argv); |
|
509 bool bAbort = false; |
|
510 if(iCmdOptions.ShowSSL ()) |
|
511 { |
|
512 ShowSSL (); |
|
513 bAbort = true; |
|
514 } |
|
515 if(iCmdOptions.ShowSyntax ()) |
|
516 { |
|
517 ShowSyntax(); |
|
518 bAbort = true; |
|
519 } |
|
520 if (bAbort) |
|
521 { |
|
522 return 0; |
|
523 } |
|
524 // We now have valid parameters |
|
525 iVerbose = iCmdOptions.Flags() & CParseCmd::EOptVerbose; |
|
526 iDump = (iCmdOptions.Flags() & CParseCmd::EOptDump) != 0; |
|
527 |
|
528 if (iCmdOptions.Flags() & CParseCmd::EOptPassword) |
|
529 { |
|
530 std::wcout << L"Warning: MakeSIS no longer signs. Use SignSIS." << std::endl; |
|
531 } |
|
532 |
|
533 std::wcout << L"Processing " << iCmdOptions.SourceFile() << L"..." << std::endl; |
|
534 |
|
535 SISLogger::SetStream(std::wcout); |
|
536 CPackageParser pkgParser(*this); |
|
537 |
|
538 if(iCmdOptions.Flags() & CParseCmd::EOptDirectory) |
|
539 { |
|
540 pkgParser.SetSearchDirectory(iCmdOptions.SearchPath()); |
|
541 } |
|
542 |
|
543 |
|
544 bool isStubFile= (iCmdOptions.Flags() & CParseCmd::EOptMakeStub) != 0; |
|
545 pkgParser.MakeSis(iCmdOptions.SourceFile(), iCmdOptions.TargetFile(), isStubFile, iCmdOptions.InterpretSisReport()); |
|
546 err = 0; |
|
547 |
|
548 if (iCmdOptions.InterpretSisReport()) |
|
549 { |
|
550 if ( iInterpretSisReport.empty() ) |
|
551 { |
|
552 std::wcout << L"*** SIS installation file VALID for InterpretSis ***" << std::endl; |
|
553 } |
|
554 else |
|
555 { |
|
556 std::wcout << L"*** SIS installation file INVALID for InterpretSis ***" << std::endl; |
|
557 DisplayInterpretSisReport(); |
|
558 err = 1; |
|
559 } |
|
560 } |
|
561 #if defined (_DEBUG) |
|
562 if (Dump ()) |
|
563 pkgParser.Dump (std::cout); |
|
564 #endif // _DEBUG |
|
565 |
|
566 std::wcout << L"Created " << iCmdOptions.TargetFile() << L"."; |
|
567 } |
|
568 catch(TCommandLineException err) |
|
569 { |
|
570 // Show the title |
|
571 ShowBanner(); |
|
572 ShowCommandLineError(err); |
|
573 ShowUsage(); |
|
574 } |
|
575 catch(CSISException oops) |
|
576 { |
|
577 DoErrMsg (oops.widewhat ()); |
|
578 err = 1; |
|
579 } |
|
580 catch(TParseException x) |
|
581 { |
|
582 ShowParseError(x); |
|
583 } |
|
584 catch(TUtilsException err) |
|
585 { |
|
586 ShowUtilsError(err); |
|
587 } |
|
588 return err; |
|
589 |
|
590 } |
|
591 |
|
592 // main function - constructs a CMakeSIS object and calls it's run method |
|
593 int main(int argc, char *argv[]) |
|
594 { |
|
595 /* |
|
596 MinGW doesn't support wide main() and wide character stuff also |
|
597 But CommandLineArgs works as a wide main for MinGW and STLPort |
|
598 is used for wide characters stuff. |
|
599 */ |
|
600 wchar_t **argv1 = CommandLineArgs(argc,argv); |
|
601 CMakeSIS app; |
|
602 int reply = app.Run(argc, argv1); |
|
603 cleanup(argc,argv1); |
|
604 return reply; |
|
605 } |
|
606 |