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