|
1 # genver.pl |
|
2 # |
|
3 # Copyright (c) 2010 Accenture. All rights reserved. |
|
4 # This component and the accompanying materials are made available |
|
5 # under the terms of the "Eclipse Public License v1.0" |
|
6 # which accompanies this distribution, and is available |
|
7 # at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 # |
|
9 # Initial Contributors: |
|
10 # Accenture - Initial contribution |
|
11 # |
|
12 use strict; |
|
13 use lib "../../tools"; |
|
14 use fshu; |
|
15 |
|
16 my $platform = shift @ARGV; |
|
17 my $version = fshu::Version(); |
|
18 my $localTime = scalar(localtime); |
|
19 my $gmTime = scalar(gmtime); |
|
20 my $builder = $ENV{USERNAME}; |
|
21 my $compilerVersion = CompilerVersion(); |
|
22 |
|
23 |
|
24 print " |
|
25 #include <fshell/iocli.h> |
|
26 |
|
27 extern void PrintVersionInfo(RIoWriteHandle& aOut, TBool aVerbose) |
|
28 { |
|
29 if (aVerbose) |
|
30 { |
|
31 aOut.Write(_L(\"Version: $version\\r\\n\")); |
|
32 aOut.Write(_L(\"Local build time: $localTime\\r\\n\")); |
|
33 aOut.Write(_L(\"GMT build time: $gmTime\\r\\n\")); |
|
34 aOut.Write(_L(\"User-name of builder: $builder\\r\\n\")); |
|
35 aOut.Write(_L(\"Compiler version: $compilerVersion\\r\\n\")); |
|
36 #ifdef _DEBUG |
|
37 aOut.Write(_L(\"Build configuration: debug\\r\\n\")); |
|
38 #else |
|
39 aOut.Write(_L(\"Build configuration: release\\r\\n\")); |
|
40 #endif |
|
41 } |
|
42 else |
|
43 { |
|
44 aOut.Write(_L(\"$version\\r\\n\")); |
|
45 } |
|
46 } |
|
47 "; |
|
48 |
|
49 sub CompilerVersion { |
|
50 my $version = 'Unknown'; |
|
51 if ($platform =~ /^armv5$/i) { |
|
52 open (COMPILER, "armcc 2>&1 |") or die "Couldn't run \"armcc\": $!\n"; |
|
53 while (my $line = <COMPILER>) { |
|
54 if ($line =~ /\[Build\s+\d+\]/) { |
|
55 chomp $line; |
|
56 $version = $line; |
|
57 last; |
|
58 } |
|
59 } |
|
60 close (COMPILER); |
|
61 } |
|
62 elsif ($platform =~ /^gcce$/i) { |
|
63 open (COMPILER, "arm-none-symbianelf-gcc.exe -v 2>&1 |") or die "Couldn't run \"arm-none-symbianelf-gcc.exe -v\": $!\n"; |
|
64 while (my $line = <COMPILER>) { |
|
65 if ($line =~ /^gcc version/) { |
|
66 chomp $line; |
|
67 $version = $line; |
|
68 last; |
|
69 } |
|
70 } |
|
71 close (COMPILER); |
|
72 } |
|
73 elsif ($platform =~ /^(arm4|armi|thumb)$/i) { |
|
74 open (COMPILER, "gcc.exe -v 2>&1 |") or die "Couldn't run \"gcc.exe -v\": $!\n"; |
|
75 while (my $line = <COMPILER>) { |
|
76 if ($line =~ /^gcc version/) { |
|
77 chomp $line; |
|
78 $version = $line; |
|
79 last; |
|
80 } |
|
81 } |
|
82 close (COMPILER); |
|
83 } |
|
84 return $version; |
|
85 } |