sbsv1/abld/e32util/checkgcc.pm
author Ross Qin <ross.qin@nokia.com>
Tue, 30 Nov 2010 13:59:58 +0800
changeset 712 df89378e9223
parent 599 fa7a3cc6effd
permissions -rw-r--r--
Fix these errors: Some cases of PREQ1230 fail because of buildrom issue rombuild crashs when create ext-romimage readimage crashes on reading wk42 vasco_ui core image vc2008 compiling issues
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
599
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
     1
# Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
     2
# All rights reserved.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
     3
# This component and the accompanying materials are made available
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
     4
# under the terms of "Eclipse Public License v1.0"
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
     5
# which accompanies this distribution, and is available
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
     6
# at the URL "http://www.eclipse.org/legal/epl-v10.html".
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
     7
#
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
     8
# Initial Contributors:
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
     9
# Nokia Corporation - initial contribution.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    10
#
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    11
# Contributors:
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    12
#
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    13
# Description:
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    14
# module for checking gcc is set up correctly
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    15
# 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    16
#
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    17
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    18
package CheckGcc;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    19
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    20
use Preprocessor;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    21
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    22
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    23
sub CheckGcc_Default()
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    24
{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    25
 	# die if CPP.EXE (or whatever) in a dodgy place in the path
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    26
	my $pbp = $ENV{PBUILDPID};
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    27
	my @Paths=split ';', $ENV{Path};
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    28
	unshift @Paths,'.';	# add the current directory
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    29
	foreach (@Paths) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    30
		s-/-\\-go;	# for those working with UNIX shells
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    31
		s-^(.*[^\\])$-$1\\-o;   # ensure path ends with a backslash
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    32
		if ((-e $_.'CPP.EXE') or (-e $_.'CPP.BAT') or (-e $_.'CPP.CMD')) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    33
			unless (/\\GCC(\w\w)?\\BIN\\$/i) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    34
				unless (lc($1) eq lc($pbp)) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    35
					die
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    36
						"ERROR: First CPP executable found in path is in $_,\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    37
						"but the required CPP.EXE was expected to be found in a directory\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    38
						"with a name ending in \\GCC$pbp\\BIN\\, where the Cygnus tools\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    39
						"this program depends upon are stored.\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    40
						"Is your path set up correctly?\n"
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    41
					;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    42
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    43
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    44
			return;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    45
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    46
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    47
	die "ERROR: CPP executable not found in path\n";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    48
}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    49
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    50
sub CheckGcc_Generic()
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    51
{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    52
	# die if CPP.EXE (or whatever pre processor) in a dodgy place in the path
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    53
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    54
	my @Paths=split ';', $ENV{Path};
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    55
	unshift @Paths,'.';	# add the current directory
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    56
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    57
	my $exe = &PreprocessorToUseExe();
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    58
	my $path = &PreprocessorToUsePath();
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    59
	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    60
	foreach (@Paths) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    61
		s-/-\\-go;	# for those working with UNIX shells
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    62
		s-^(.*[^\\])$-$1\\-o;   # ensure path ends with a backslash
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    63
		s-$-$path-;	# add in the path relative to gcc\bin.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    64
		if ((-e $_.$exe.'.EXE') or (-e $_.$exe.'.BAT') or (-e $_.$exe.'.CMD')) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    65
			unless (/\\EPOC32\\TOOLS\\\Q$path\E$/i) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    66
				die
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    67
					"ERROR: First $exe executable found in path is in $_,\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    68
					"but the required $exe.EXE was expected to be found in a directory\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    69
					"with a name ending in \\EPOC32\\TOOLS\\$path, where the tools\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    70
					"this program depends upon are stored.\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    71
					"Is your path set up correctly?\n"
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    72
				;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    73
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    74
			return;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    75
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    76
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    77
	die "ERROR: $exe executable not found in path\n";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    78
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    79
}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    80
BEGIN {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    81
	my $preprocessor_to_use = &PreprocessorToUseId();
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    82
	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    83
	if ( $preprocessor_to_use eq "DEFAULT" )
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    84
	{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    85
		&CheckGcc_Default();	# pre processor & cpp same. 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    86
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    87
	elsif ( $preprocessor_to_use eq "MINGW_NO_CYGWIN" )
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    88
	{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    89
		&CheckGcc_Generic();	# check for preprocessor.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    90
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    91
	else
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    92
	{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    93
		die("CHECKGCC.PM :  error should never happen\n");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    94
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    95
}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    96
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    97
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    98
1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    99