0
|
1 |
#
|
|
2 |
# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
|
3 |
# All rights reserved.
|
|
4 |
# This component and the accompanying materials are made available
|
|
5 |
# under the terms of "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 |
# Nokia Corporation - initial contribution.
|
|
11 |
#
|
|
12 |
# Contributors:
|
|
13 |
#
|
|
14 |
# Description:
|
|
15 |
#
|
|
16 |
#!/usr/bin/perl
|
|
17 |
#
|
|
18 |
# $Id: sdk_env.pl,v 1.10 2006/02/22 03:09:50 slava Exp $
|
|
19 |
#
|
|
20 |
# Common Perl code shared by sdk_build.pl and sdk_dist.pl scripts.
|
|
21 |
# Used mostly to set the right environment.
|
|
22 |
#
|
|
23 |
|
|
24 |
use FindBin;
|
|
25 |
use Env qw(JAVA_HOME MWCIncludes PATH RVCTROOT ARMLMD_LICENSE_FILE);
|
|
26 |
|
|
27 |
$FS = '/'; # File separator
|
|
28 |
$PS = ';'; # Path separator
|
|
29 |
|
|
30 |
($BUILD_ROOT = $FindBin::RealBin) =~ s/\/[^\/]+\/[^\/]+\/[^\/]+$//g;
|
|
31 |
($BUILD_ROOT = $BUILD_ROOT . $FS) unless $BUILD_ROOT =~ m/$FS$/;
|
|
32 |
($EPOCROOT = $BUILD_ROOT) =~ s/^([A-Z]|[a-z])\://g;
|
|
33 |
$EPOCROOT =~ s/$FS$/\\/;
|
|
34 |
|
|
35 |
$ENV{BUILD_ROOT} = $BUILD_ROOT;
|
|
36 |
|
|
37 |
# Find java (at least 1.4.x)
|
|
38 |
if (!defined $ENV{JAVA_HOME}) {
|
|
39 |
# Should we check Java version?
|
|
40 |
$javac_dir = find_prog_or_die ("javac.exe");
|
|
41 |
($ENV{JAVA_HOME} = $javac_dir) =~ s/$FS[^$FS]+$//g;
|
|
42 |
}
|
|
43 |
$ENV{JAVA_HOME} =~ s/\\/$FS/g;
|
|
44 |
$ENV{JAVA_HOME} =~ s/$FS*$//g;
|
|
45 |
|
|
46 |
# Get the path to the Metrowerks tools
|
|
47 |
$cw_tool_exe = "mwccsym2.exe";
|
|
48 |
$cw_tool_dir = find_prog ($cw_tool_exe);
|
|
49 |
$cw_bin_dir = "";
|
|
50 |
|
|
51 |
# CW 3.1 requires that its bin directory is in the PATH
|
|
52 |
# Otherwise some command line tools can't find lmgr8c.dll
|
|
53 |
if (-d $cw_tool_dir) {
|
|
54 |
($cw_bin_dir = $cw_tool_dir) =~ s/$FS[^$FS]+$FS[^$FS]+$//g;
|
|
55 |
$cw_bin_dir .= "/Bin";
|
|
56 |
} else {
|
|
57 |
$cw_bin_dir = find_prog_or_die ("IDE.exe");
|
|
58 |
($cw_tool_dir = $cw_bin_dir) =~ s/[^$FS]+$//g;
|
|
59 |
$cw_tool_dir .= "/Symbian_Tools/Command_Line_Tools";
|
|
60 |
if (-x "$cw_tool_dir/$cw_tool_exe") {
|
|
61 |
die "ERROR: cound not find $cw_tool_exe in $cw_tool_dir\n";
|
|
62 |
}
|
|
63 |
}
|
|
64 |
|
|
65 |
# Get paths to MSDEV, cl and link
|
|
66 |
$msdev_dir = find_prog_or_die("msdev.exe");
|
|
67 |
$cl_dir = find_prog_or_die("cl.exe");
|
|
68 |
($msdev_home = $cl_dir) =~ s/\\/$FS/g;
|
|
69 |
$msdev_home =~ s/$FS[^$FS]+$//g;
|
|
70 |
|
|
71 |
# Get path for MWCIncludes
|
|
72 |
($mwc_inc = $cw_tool_dir) =~ s/$FS[^$FS]+$FS[^$FS]+$//g;
|
|
73 |
$mwc_inc = "+$mwc_inc$FS" . "Symbian_Support";
|
|
74 |
|
|
75 |
# Get path to the perl
|
|
76 |
($perl_path = $^X) =~ s/\\/$FS/g;
|
|
77 |
$perl_path =~ s/$FS[^$FS]+$//g;
|
|
78 |
|
|
79 |
# Get path to the ant tool.
|
|
80 |
# Ant is needed only for building Java component
|
|
81 |
$ant_dir = "";
|
|
82 |
|
|
83 |
if (!defined($ENV{ANT_HOME})) {
|
|
84 |
$ant_dir = find_prog ("ant.bat");
|
|
85 |
$ant_dir =~ s/\\/$FS/g;
|
|
86 |
$ant_dir =~ s/$FS[^$FS]+$//g
|
|
87 |
} else {
|
|
88 |
$ant_dir = $ENV{ANT_HOME};
|
|
89 |
$ant_dir =~ s/\\/$FS/g;
|
|
90 |
}
|
|
91 |
|
|
92 |
if ($ant_dir eq "") {
|
|
93 |
warn "***** ACHTUNG! Couldn't find ANT! Java code won't be built! ****\n";
|
|
94 |
}
|
|
95 |
|
|
96 |
# Get path to the python tool.
|
|
97 |
# Python is needed only for building Java AMS in the S60 platform
|
|
98 |
$python_dir = find_prog ("python.exe");
|
|
99 |
$python_dir =~ s/\\/$FS/g;
|
|
100 |
$python_dir =~ s/$FS[^$FS]+$//g; #I wonder if this ever matches
|
|
101 |
|
|
102 |
if ($python_dir eq "") {
|
|
103 |
warn "***** ACHTUNG! Couldn't find Python! Java Platform code won't be built! ****\n";
|
|
104 |
}
|
|
105 |
|
|
106 |
# RVCT environment
|
|
107 |
$rvct_bin = find_prog ("armcc.exe");
|
|
108 |
unless ( $rvct_bin ){
|
|
109 |
if (defined($ENV{RVCTROOT})) {
|
|
110 |
$rvct_bin = $ENV{RVCTROOT} . "${FS}bin$PS";
|
|
111 |
} else {
|
|
112 |
warn "***** RVCT compiler not found in $rvct_bin ****\n";
|
|
113 |
$rvct_bin = "";
|
|
114 |
}
|
|
115 |
}
|
|
116 |
# Allow the user to redefine license information
|
|
117 |
if (!defined ($ENV{ARMLMD_LICENSE_FILE})) {
|
|
118 |
# Default to US configuration
|
|
119 |
$ENV{ARMLMD_LICENSE_FILE} = "8224@bslic02.americas.nokia.com";
|
|
120 |
}
|
|
121 |
|
|
122 |
# doxygen
|
|
123 |
# doxygen is needed only, if s60 c++ example application finalize is done
|
|
124 |
$doxy_bin = find_prog ("doxygen.exe");
|
|
125 |
if ($doxy_bin eq "") {
|
|
126 |
warn "***** NOTE! Couldn't find Doxygen! S60Ex document generation cannot be done ****\n";
|
|
127 |
}
|
|
128 |
|
|
129 |
# This one if for CodeWarrior
|
|
130 |
$ENV{MWCIncludes} = $mwc_inc;
|
|
131 |
|
|
132 |
# These are for Microsoft Visual C++
|
|
133 |
$ENV{INCLUDE} = "$ENV{JAVA_HOME}$FS" . "include$PS" .
|
|
134 |
"$ENV{JAVA_HOME}$FS" . "include$FS" . "win32$PS" .
|
|
135 |
"$msdev_home$FS" . "include$PS" .
|
|
136 |
"$msdev_home$FS" . "mfc$FS" . "include";
|
|
137 |
$ENV{LIB} = "$msdev_home$FS" . "lib$PS$msdev_home$FS" . "mfc$FS" . "lib";
|
|
138 |
|
|
139 |
# These affect everything...
|
|
140 |
$ENV{EPOCROOT} = $EPOCROOT;
|
1
|
141 |
$ENV{SBS_HOME} = "C:/apps/sbs";
|
0
|
142 |
$ENV{PATH} = $rvct_bin . "$PS$ENV{JAVA_HOME}$FS" . "bin$PS" .
|
|
143 |
"$ant_dir$FS" . "bin$PS" .
|
|
144 |
"$python_dir$PS" .
|
|
145 |
$BUILD_ROOT . "epoc32$FS" . "tools$PS" .
|
|
146 |
$BUILD_ROOT . "epoc32$FS" . "gcc$FS" . "bin$PS" .
|
|
147 |
"$cw_tool_dir$PS$cw_bin_dir$PS" .
|
|
148 |
"$msdev_dir$PS$cl_dir$PS$perl_path$PS" .
|
|
149 |
"$ENV{SystemRoot}$PS" . "$ENV{SystemRoot}$FS" . "system32$PS" .
|
1
|
150 |
"$doxy_bin" . "C:/apps/sbs/bin";
|
0
|
151 |
|
1
|
152 |
print "$ENV{JAVA_HOME}\n$ENV{EPOCROOT}\n$ENV{BUILD_ROOT}\n$ENV{MWCIncludes}\n$ENV{PATH}\n$ENV{RVCT21INC}\n$ENV{RVCT21LIB}\n$ENV{ARMROOT}\n";
|
0
|
153 |
|
|
154 |
# ======================================================================+
|
|
155 |
sub find_prog_or_die
|
|
156 |
# =======================================================================
|
|
157 |
{
|
|
158 |
my $prog = @_[0];
|
|
159 |
my $dir = find_prog($prog);
|
|
160 |
die "ERROR: $prog not found in the PATH\n" unless $dir;
|
|
161 |
return $dir;
|
|
162 |
}
|
|
163 |
|
|
164 |
# =======================================================================
|
|
165 |
sub find_prog
|
|
166 |
# =======================================================================
|
|
167 |
{
|
|
168 |
my $prog = @_[0];
|
|
169 |
for $dir (split /;/, $ENV{PATH}) {
|
|
170 |
if (-x "$dir/$prog") {
|
|
171 |
$dir =~ s/\\/$FS/g;
|
|
172 |
$dir =~ s/$FS*$//g;
|
|
173 |
return $dir;
|
|
174 |
}
|
|
175 |
}
|
|
176 |
return "";
|
|
177 |
}
|
|
178 |
|
|
179 |
#
|
|
180 |
# Code style configuration for Emacs:
|
|
181 |
#
|
|
182 |
# Local Variables:
|
|
183 |
# perl-indent-level: 2
|
|
184 |
# perl-continued-statement-offset: 2
|
|
185 |
# perl-continued-brace-offset: -2
|
|
186 |
# indent-tabs-mode: nil
|
|
187 |
# End:
|
|
188 |
#
|