Fix compiler warning:
[p5sagit/p5-mst-13.2.git] / symbian / sdk.pl
1 use strict;
2
3 my $SYMBIAN_VERSION;
4 my $SYMBIAN_ROOT;
5 my $SDK_NAME;
6 my $SDK_VARIANT;
7 my $SDK_VERSION;
8 my $WIN;
9
10 if ($ENV{PATH} =~ m!\\Symbian\\(.+?)\\(.+?)\\Epoc32\\gcc\\bin!i) {
11     $SYMBIAN_VERSION = $1;
12     $SDK_NAME = $2;
13     $WIN = ($SDK_NAME =~ m!_CW!i || $SDK_NAME eq '8.1a') ?
14         'winscw' : 'wins';
15     $ENV{WIN} = $WIN;
16     if ($SDK_NAME =~ m!Series60_v20!) {
17         $SDK_VARIANT = 'S60';
18         $SDK_VERSION = $ENV{S60SDK} = '2.0';
19     } elsif ($SDK_NAME =~ m!Series60_v21!) {
20         $SDK_VARIANT = 'S60';
21         $SDK_VERSION = $ENV{S60SDK} = '2.1';
22     } elsif ($SDK_NAME =~ m!S60_2nd_FP2!) {
23         $SDK_VARIANT = 'S60';
24         $SDK_VERSION = $ENV{S60SDK} = '2.6';
25     } elsif ($SDK_NAME =~ m!S60_2nd_FP3!) {
26         $SDK_VARIANT = 'S60';
27         $SDK_VERSION = $ENV{S60SDK} = '2.8';
28     } elsif ($SDK_NAME =~ m!S80_DP2_0_SDK!) {
29         $SDK_VARIANT = 'S80';
30         $SDK_VERSION = $ENV{S80SDK} = '2.0';
31     } elsif ($SDK_NAME =~ m!Nokia_7710_SDK!) {
32         $SDK_VARIANT = 'S90';
33         $SDK_VERSION = $ENV{S90SDK} = '1.1';
34     }
35 } elsif ($ENV{PATH} =~ m!\\S60\\devices\\(.+?)\\epoc32\\gcc\\bin!i) {
36         $SDK_VARIANT = 'S60';
37         $SDK_NAME = $1;
38         $WIN = $ENV{WIN} = 'winscw';
39         $SYMBIAN_VERSION = '9.4';
40         $SDK_VERSION = $ENV{S60SDK} = '5.0';
41         $SYMBIAN_ROOT = $ENV{EPOCROOT};
42 } elsif ($ENV{PATH} =~ m!\\Symbian\\UIQ_(\d)(\d)\\Epoc32\\gcc\\bin!i) {
43     $SDK_NAME    = 'UIQ';
44     $SDK_VARIANT = 'UIQ';
45     $SDK_VERSION = $ENV{UIQSDK} = "$1.$2";
46     if ($SDK_VERSION =~ /^2\./) {
47         $SYMBIAN_VERSION = '7.0s';
48     } else {
49         die "$0: Unknown UIQ version '$SDK_VERSION'\n";
50     }
51     $WIN = 'winscw'; # This is CodeWarrior, how about Borland?
52     $ENV{WIN} = $WIN;
53 }
54
55 if (open(GCC, "gcc -v 2>&1 |")) {
56    while (<GCC>) {
57      # print;
58      if (/Reading specs from (.+?)\\Epoc32\\/i) {
59        $SYMBIAN_ROOT = $1;
60        # The S60SDK tells the Series 60 SDK version.
61        if ($ENV{S60SDK}) {
62            if ($SYMBIAN_ROOT eq 'C:\Symbian\6.1\Shared') { # Visual C.
63                $SYMBIAN_ROOT = 'C:\Symbian\6.1\Series60';
64                $SDK_VERSION = $ENV{S60SDK} = '1.2';
65            } elsif ($SYMBIAN_ROOT eq 'C:\Symbian\Series60_1_2_CW') { # CodeWarrior.
66                $SDK_VERSION = $ENV{S60SDK} = '1.2';
67            }
68        }
69        last;
70      }
71    }
72    close GCC;
73 } else {
74   die "$0: failed to run gcc: $!\n";
75 }
76
77 die "$0: failed to locate the Symbian SDK\n" unless defined $SYMBIAN_ROOT;
78
79 my $UARM = $ENV{UARM} ? $ENV{UARM} : "urel";
80 my $UREL = "$SYMBIAN_ROOT\\epoc32\\release\\-ARM-\\$UARM";
81 if ($SYMBIAN_ROOT eq 'C:\Symbian\6.1\Series60' && $ENV{WIN} eq 'winscw') {
82     $UREL = "C:\\Symbian\\Series60_1_2_CW\\epoc32\\release\\-ARM-\\urel";
83 }
84 $ENV{UREL} = $UREL;
85 $ENV{UARM} = $UARM;
86
87 [ $SYMBIAN_ROOT, $SYMBIAN_VERSION, $SDK_NAME, $SDK_VARIANT, $SDK_VERSION ];
88
89 # The following is a cheat sheet for the right S60/S80 SDK settings.
90 #
91 # symbiancommon.bat:
92 # set EPOC_BIN=%EPOCROOT%Epoc32\gcc\bin;%EPOCROOT%Epoc32\Tools
93 # set MWCW=C:\Program Files\Metrowerks\CodeWarrior for Symbian OEM v2.8
94 # set MSVC=C:\Program Files\Microsoft Visual Studio
95 # set MSVC_BIN=%MSVC%\VC98\Bin;%MSVC%\Aux\MSDev98\Bin
96 # set MSVC_INC=%MSVC%\VC98\atl\include;%MSVC%\VC98\include;%MSVC%\mfc\include;%MSVC%\include
97 # set MSVC_LIB=%MSVC%\mfc\lib;%MSVC%\lib
98 #
99 # Note that if you are using Microsoft Visual Studio 8
100 # (for example because you are using the Microsoft Visual C++
101 #  2005 Express Edition), the MSVC settings will be different:
102 # set MSVC=C:\Program Files\Microsoft Visual Studio 8\VC
103 # set MSVC_BIN=%MSVC%\bin
104 # set MSVC_INC=%MSVC%\include
105 # set MSVC_LIB=%MSVC%\lib
106 #
107 # s60-1.2-cw:
108 #
109 # set EPOCROOT=\Symbian\Series60_1_2_CW\
110 # symbiancommon
111 # set PATH=%EPOC_BIN%;%MSVC_BIN%;%MWCW%\Bin;%MWCW%\Symbian_Tools\Command_Line_Tools;%MSVC_BIN%;C:\perl\bin;C:\winnt\system32;%PATH%
112 # set USERDEFS=%USERDEFS% -D__SERIES60_12__ -D__SERIES60_MAJOR__=1 -D__SERIES60_MINOR__=2 -D__SERIES60_1X__
113 #
114 # s60-1.2-vc:
115 #
116 # set EPOCROOT=\Symbian\6.1\Series60\
117 # symbiancommon
118 # set PATH=\Symbian\6.1\Shared\Epoc32\gcc\bin;\Symbian\6.1\Shared\Epoc32\Tools;%MSVC_BIN%;C:\perl\bin;C:\winnt\system32;%PATH%
119 # set INCLUDE=%MSVC_INC%
120 # set LIB=%MSVC_LIB%
121 # set USERDEFS=%USERDEFS% -D__SERIES60_12__ -D__SERIES60_MAJOR__=1 -D__SERIES60_MINOR__=2 -D__SERIES60_1X__
122 #
123 # s60-2.0-cw:
124 #
125 # set EPOCROOT=\Symbian\7.0s\Series60_v20_CW\
126 # set EPOCDEVICE=Series60_2_0_CW:com.Nokia.Series60_2_0_CW
127 # symbiancommon
128 # set PATH=%EPOC_BIN%;%MWCW%\Bin;%MWCW%\Symbian_Tools\Command_Line_Tools;%MSVC_BIN%;C:\perl\bin;C:\winnt\system32;%PATH%
129 # set USERDEFS=%USERDEFS% -D__SERIES60_20__ -D__SERIES60_MAJOR__=2 -D__SERIES60_MINOR__=0 -D__SERIES60_2X__
130 #
131 # s60-2.0-vc:
132 #
133 # set EPOCROOT=\Symbian\7.0s\Series60_v20\
134 # set EPOCDEVICE=Series60_v20:com.nokia.series60
135 # symbiancommon
136 # set PATH=%EPOC_BIN%;%MSVC_BIN%;C:\perl\bin;C:\winnt\system32;%PATH%
137 # set INCLUDE=%MSVC_INC%
138 # set LIB=%MSVC_LIB%
139 # set USERDEFS=%USERDEFS% -D__SERIES60_20__ -D__SERIES60_MAJOR__=2 -D__SERIES60_MINOR__=0 -D__SERIES60_2X__
140 #
141 # s60-2.1-cw:
142 #
143 # set EPOCROOT=\Symbian\7.0s\Series60_v21_CW\
144 # set EPOCDEVICE=Series60_v21_CW:com.Nokia.series60
145 # symbiancommon
146 # set PATH=%EPOC_BIN%;%MWCW%\Bin;%MWCW%\Symbian_Tools\Command_Line_Tools;%MSVC_BIN%;C:\perl\bin;C:\winnt\system32;%PATH%
147 # set USERDEFS=%USERDEFS% -D__SERIES60_21__ -D__SERIES60_MAJOR__=2 -D__SERIES60_MINOR__=1 -D__SERIES60_2X__
148 #
149 # s60-2.6-cw:
150 #
151 # set EPOCROOT=\Symbian\8.0a\S60_2nd_FP2_CW\
152 # set EPOCDEVICE=S60_2nd_FP2_CW:com.nokia.series60
153 # symbiancommon
154 # set PATH=%EPOC_BIN%;%MWCW%\Bin;%MWCW%\Symbian_Tools\Command_Line_Tools;%MSVC_BIN%;C:\perl\bin;C:\winnt\system32;%PATH%
155 # set USERDEFS=%USERDEFS% -D__SERIES60_26__ -D__SERIES60_MAJOR__=2 -D__SERIES60_MINOR__=6 -D__SERIES60_2X__ -D__BLUETOOTH_API_V2__
156 #
157 # s60-2.6-vc:
158 #
159 # set EPOCROOT=\Symbian\8.0a\S60_2nd_FP2\
160 # set EPOCDEVICE=S60_2nd_FP2:com.nokia.Series60
161 # symbiancommon
162 # set PATH=%EPOC_BIN%;%MSVC_BIN%;C:\perl\bin;C:\winnt\system32;%PATH%
163 # set INCLUDE=%MSVC_INC%
164 # set LIB=%MSVC_LIB%
165 # set USERDEFS=%USERDEFS% -D__SERIES60_26__ -D__SERIES60_MAJOR__=2 -D__SERIES60_MINOR__=6 -D__SERIES60_2X__ -D__BLUETOOTH_API_V2__
166 #
167 # s60-2.8-cw:
168 #
169 # set EPOCROOT=\Symbian\8.1a\S60_2nd_FP3\
170 # set EPOCDEVICE=S60_2nd_FP3:com.nokia.series60
171 # symbiancommon
172 # set PATH=%EPOC_BIN%;%MWCW%\Bin;%MWCW%\Symbian_Tools\Command_Line_Tools;%MSVC_BIN%;C:\perl\bin;C:\winnt\system32;%PATH%
173 # set USERDEFS=%USERDEFS% -D__SERIES60_28__ -D__SERIES60_MAJOR__=2 -D__SERIES60_MINOR__=8 -D__SERIES60_2X__ -D__BLUETOOTH_API_V2__
174 #
175 # s60-2.8-vc:
176 #
177 # set EPOCROOT=\Symbian\8.1a\S60_2nd_FP3\
178 # set EPOCDEVICE=S60_2nd_FP3:com.nokia.series60
179 # symbiancommon
180 # set PATH=%EPOC_BIN%;%MSVC_BIN%;C:\perl\bin;C:\winnt\system32;%PATH%
181 # set USERDEFS=%USERDEFS% -D__SERIES60_28__ -D__SERIES60_MAJOR__=2 -D__SERIES60_MINOR__=8 -D__SERIES60_2X__ -D__BLUETOOTH_API_V2__
182 #
183 # s60-5.0  - S60 5th Edition SDK v1.0:
184 #
185 # set EPOCROOT=\S60\devices\S60_5th_Edition_SDK_v1.0\
186 # set PATH=%EPOCROOT%Epoc32\gcc\bin;%EPOCROOT%Epoc32\tools;%PATH%
187 #
188 # s80-2.0-cw:
189 #
190 # set EPOCROOT=\Symbian\7.0s\S80_DP2_0_SDK_CW\
191 # set EPOCDEVICE=Series80_DP2_0_SDK_CW:com.nokia.Series80
192 # symbiancommon
193 # set PATH=%EPOC_BIN%;%MWCW%\Bin;%MWCW%\Symbian_Tools\Command_Line_Tools;%MSVC_BIN%;C:\perl\bin;C:\winnt\system32;%PATH%
194 # set USERDEFS=%USERDEFS% -D__SERIES80_20__ -D__SERIES80_MAJOR__=2 -D__SERIES80_MINOR__=0 -D__SERIES80_2X__
195 #
196 # s80-2.0-vc:
197 #
198 # set EPOCROOT=\Symbian\7.0s\S80_DP2_0_SDK\
199 # set EPOCDEVICE=Series80_DP2_0_SDK:com.nokia.Series80
200 # symbiancommon
201 # set PATH=%EPOC_BIN%;%MWCW%\Bin;%MWCW%\Symbian_Tools\Command_Line_Tools;%MSVC_BIN%;C:\perl\bin;C:\winnt\system32;%PATH%
202 # set USERDEFS=%USERDEFS% -D__SERIES80_20__ -D__SERIES80_MAJOR__=2 -D__SERIES80_MINOR__=0 -D__SERIES80_2X__
203 #
204 # UIQ-2.1-vc:
205 # set EPOCROOT=\Symbian\UIQ_21\
206 # set EPOCDEVICE=
207 # set EPOC_BIN=%EPOCROOT%Epoc32\gcc\bin;%EPOCROOT%Epoc32\Tools
208 # set MWCW=C:\APPS\codewarrior_3.0
209 # set MSVC=C:\Program Files\Microsoft Visual Studio
210 # set MSVC_BIN=%MSVC%;%MSVC%\Common\MSDev98\Bin
211 # set MSVC_INC=%MSVC%\VC98\atl\include;%MSVC%\mfc\include;%MSVC%\include
212 # set MSVC_LIB=%MSVC%\mfc\lib;%MSVC%\lib
213 # set PATH=%EPOC_BIN%;%MWCW%\Bin;%MWCW%\Symbian_Tools\Command_Line_Tools;%MSVC_BIN%;C:\perl\bin;C:\winnt\system32;%PATH%
214 # set USERDEFS=%USERDEFS% -D__UIQ_21__ -D__UIQ_MAJOR__=2 -D__UIQ_MINOR__=1 -D__UIQ_2X__
215 #
216 # EOF