Symbian/beginnings of Series 80 support
[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         $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     }
32 }
33
34 if (open(GCC, "gcc -v 2>&1|")) {
35    while (<GCC>) {
36      if (/Reading specs from ((?:C:)?\\Symbian.+?)\\Epoc32\\/i) {
37        $SYMBIAN_ROOT = $1;
38        # The S60SDK/S60SDK tells the Series 60 SDK version.
39        if ($ENV{S60SDK}) {
40            if ($SYMBIAN_ROOT eq 'C:\Symbian\6.1\Shared') { # Visual C. 
41                $SYMBIAN_ROOT = 'C:\Symbian\6.1\Series60';
42                $SDK_VERSION = $ENV{S60SDK} = '1.2';
43            } elsif ($SYMBIAN_ROOT eq 'C:\Symbian\Series60_1_2_CW') { # CodeWarrior.
44                $SDK_VERSION = $ENV{S60SDK} = '1.2';
45            }
46        }
47        last;
48      }
49    }
50    close GCC;
51 } else {
52   die "$0: failed to run gcc: $!\n";
53 }
54
55 die "$0: failed to locate the Symbian SDK\n" unless defined $SYMBIAN_ROOT;
56
57 my $UARM = $ENV{UARM} ? $ENV{UARM} : "urel";
58 my $UREL = "$SYMBIAN_ROOT\\epoc32\\release\\-ARM-\\$UARM";
59 if ($SYMBIAN_ROOT eq 'C:\Symbian\6.1\Series60' && $ENV{WIN} eq 'winscw') {
60     $UREL = "C:\\Symbian\\Series60_1_2_CW\\epoc32\\release\\-ARM-\\urel";
61 }
62 $ENV{UREL} = $UREL;
63 $ENV{UARM} = $UARM;
64
65 [ $SYMBIAN_ROOT, $SYMBIAN_VERSION, $SDK_NAME, $SDK_VARIANT, $SDK_VERSION ];
66
67 # The following is a cheat sheet for the right S60/S80 SDK settings.
68 #
69 # macro.bat:
70 # set EPOC_BIN=%EPOCROOT%Epoc32\gcc\bin;%EPOCROOT%Epoc32\Tools
71 # set MWCW=C:\Program Files\Metrowerks\CodeWarrior for Symbian OEM v2.8
72 # set MSVC=C:\Program Files\Microsoft Visual Studio
73 # set MSVC_BIN=%MSVC%\VC98\Bin;%MSVC%\Common\MSDev98\Bin
74 # set MSVC_INC=%MSVC%\VC98\atl\include;%MSVC%\mfc\include;%MSVC%\include
75 # set MSVC_LIB=%MSVC%\mfc\lib;%MSVC%\lib
76 #
77 # s60-1.2-cw:
78 #
79 # set EPOCROOT=\Symbian\Series60_1_2_CW\
80 # macro
81 # set PATH=%EPOC_BIN%;%MSVC_BIN%;%MWCW%\Bin;%MWCW%\Symbian_Tools\Command_Line_Tools;%PATH%
82 # set USERDEFS=%USERDEFS% -D__SERIES60_12__ -D__SERIES60_MAJOR__=1 -D__SERIES60_MINOR__=2 -D__SERIES60_1X__
83 #
84 # s60-1.2-vc:
85 #
86 # set EPOCROOT=\Symbian\6.1\Series60\
87 # macro
88 # set PATH=\Symbian\6.1\Shared\Epoc32\gcc\bin;\Symbian\6.1\Shared\Epoc32\Tools;%MSVC_BIN%;%PATH%
89 # set INCLUDE=%MSVC_INC%
90 # set LIB=%MSVC_LIB%
91 # set USERDEFS=%USERDEFS% -D__SERIES60_12__ -D__SERIES60_MAJOR__=1 -D__SERIES60_MINOR__=2 -D__SERIES60_1X__
92
93 # s60-2.0-cw:
94 #
95 # set EPOCROOT=\Symbian\7.0s\Series60_v20_CW\
96 # set EPOCDEVICE=Series60_2_0_CW:com.Nokia.Series60_2_0_CW
97 # macro
98 # set PATH=%EPOC_BIN%;%MWCW%\Bin;%MWCW%\Symbian_Tools\Command_Line_Tools;%PATH%
99 # set USERDEFS=%USERDEFS% -D__SERIES60_20__ -D__SERIES60_MAJOR__=2 -D__SERIES60_MINOR__=0 -D__SERIES60_2X__
100
101 # s60-2.0-vc:
102 #
103 # set EPOCROOT=\Symbian\7.0s\Series60_v20\
104 # set EPOCDEVICE=Series60_v20:com.nokia.series60
105 # macro
106 # set PATH=%EPOC_BIN%;%MSVC_BIN%;%PATH%
107 # set INCLUDE=%MSVC_INC%
108 # set LIB=%MSVC_LIB%
109 # set USERDEFS=%USERDEFS% -D__SERIES60_20__ -D__SERIES60_MAJOR__=2 -D__SERIES60_MINOR__=0 -D__SERIES60_2X__
110
111 # s60-2.1-cw:
112 #
113 # set EPOCROOT=\Symbian\7.0s\Series60_v21_CW\
114 # set EPOCDEVICE=Series60_v21_CW:com.Nokia.series60
115 # macro
116 # set PATH=%EPOC_BIN%;%MWCW%\Bin;%MWCW%\Symbian_Tools\Command_Line_Tools;%PATH%
117 # set USERDEFS=%USERDEFS% -D__SERIES60_21__ -D__SERIES60_MAJOR__=2 -D__SERIES60_MINOR__=1 -D__SERIES60_2X__
118
119 # s60-2.6-cw:
120 #
121 # set EPOCROOT=\Symbian\8.0a\S60_2nd_FP2_CW\
122 # set EPOCDEVICE=S60_2nd_FP2_CW:com.nokia.series60
123 # macro
124 # set PATH=%EPOC_BIN%;%MWCW%\Bin;%MWCW%\Symbian_Tools\Command_Line_Tools;%PATH%
125 # set USERDEFS=%USERDEFS% -D__SERIES60_26__ -D__SERIES60_MAJOR__=2 -D__SERIES60_MINOR__=6 -D__SERIES60_2X__ -D__BLUETOOTH_API_V2__
126
127 # s60-2.6-vc:
128 #
129 # set EPOCROOT=\Symbian\8.0a\S60_2nd_FP2\
130 # set EPOCDEVICE=S60_2nd_FP2:com.nokia.Series60
131 # macro
132 # set PATH=%EPOC_BIN%;%MSVC_BIN%;%PATH%
133 # set INCLUDE=%MSVC_INC%
134 # set LIB=%MSVC_LIB%
135 # set USERDEFS=%USERDEFS% -D__SERIES60_26__ -D__SERIES60_MAJOR__=2 -D__SERIES60_MINOR__=6 -D__SERIES60_2X__ -D__BLUETOOTH_API_V2__
136
137 # s60-2.8-cw:
138 #
139 # set EPOCROOT=\Symbian\8.1a\S60_2nd_FP3\
140 # set EPOCDEVICE=S60_2nd_FP3:com.nokia.series60
141 # macro
142 # set PATH=%EPOC_BIN%;%MWCW%\Bin;%MWCW%\Symbian_Tools\Command_Line_Tools;%PATH%
143 # set USERDEFS=%USERDEFS% -D__SERIES60_28__ -D__SERIES60_MAJOR__=2 -D__SERIES60_MINOR__=8 -D__SERIES60_2X__ -D__BLUETOOTH_API_V2__
144
145 # s80-2.0-cw:
146 #
147 # set EPOCROOT=\Symbian\7.0s\S80_DP2_0_SDK_CW\
148 # set EPOCDEVICE=Series80_DP2_0_SDK_CW:com.nokia.Series80
149 # macro
150 # set PATH=%EPOC_BIN%;%MWCW%\Bin;%MWCW%\Symbian_Tools\Command_Line_Tools;%PATH%
151 # set USERDEFS=%USERDEFS% -D__SERIES80_20__ -D__SERIES80_MAJOR__=2 -D__SERIES80_MINOR__=0 -D__SERIES80_2X__
152 #
153 # s80-2.0-vc:
154 #
155 # set EPOCROOT=\Symbian\7.0s\S80_DP2_0_SDK\
156 # set EPOCDEVICE=Series80_DP2_0_SDK:com.nokia.Series80
157 # macro
158 # set PATH=%EPOC_BIN%;%MWCW%\Bin;%MWCW%\Symbian_Tools\Command_Line_Tools;%PATH%
159 # set USERDEFS=%USERDEFS% -D__SERIES80_20__ -D__SERIES80_MAJOR__=2 -D__SERIES80_MINOR__=0 -D__SERIES80_2X__
160 #
161 # EOF
162