sbsv1/abld/e32util/set-rvct.bat
author jjkang
Wed, 30 Jun 2010 11:35:58 +0800
changeset 607 378360dbbdba
parent 599 fa7a3cc6effd
permissions -rw-r--r--
Merge missed changeset 11 (raptor v2.14 and helium 10.0)
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
599
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
     1
@rem
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
     2
@rem Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
     3
@rem All rights reserved.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
     4
@rem This component and the accompanying materials are made available
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
     5
@rem under the terms of "Eclipse Public License v1.0"
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
     6
@rem which accompanies this distribution, and is available
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
     7
@rem at the URL "http://www.eclipse.org/legal/epl-v10.html".
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
     8
@rem
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
     9
@rem Initial Contributors:
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    10
@rem Nokia Corporation - initial contribution.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    11
@rem
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    12
@rem Contributors:
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    13
@rem
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    14
@rem Description:
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    15
@rem
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    16
@rem = '--*-Perl-*--
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    17
@echo off
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    18
if "%OS%" == "Windows_NT" goto WinNT
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    19
perl -x -S "%0" %1 %2 %3 %4 %5 %6 %7 %8 %9
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    20
goto endofperl
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    21
:WinNT
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    22
perl -x -S %0 %*
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    23
if NOT "%COMSPEC%" == "%SystemRoot%\system32\cmd.exe" goto endofperl
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    24
if %errorlevel% == 9009 echo You do not have Perl in your PATH.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    25
if errorlevel 1 goto script_failed_so_exit_with_non_zero_val 2>nul
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    26
goto endofperl
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    27
@rem ';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    28
#!perl
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    29
#line 15
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    30
use FindBin;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    31
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    32
my $SELF_NAME = "set-rvct";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    33
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    34
my $self_path;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    35
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    36
BEGIN
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    37
{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    38
    $self_path = $FindBin::Bin;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    39
}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    40
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    41
use lib $self_path;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    42
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    43
use RVCT_ver2set;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    44
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    45
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    46
# Some internal helper functions.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    47
sub _usage_and_die(@);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    48
sub _err_and_die(@);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    49
sub _warning(@);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    50
sub _fixup_path($$);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    51
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    52
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    53
sub main(@)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    54
{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    55
    my @available = RVCT_ver2set::get_versions();
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    56
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    57
    _err_and_die("no RVCT versions found; check that ABLD_RVCT_INI is set.")
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    58
        unless(@available);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    59
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    60
    my ($vers, @junk) = @_;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    61
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    62
    _usage_and_die(@available)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    63
        if ( !$vers || @junk || !RVCT_ver2set::compiler_exists($vers) );
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    64
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    65
    if ($ENV{ABLD_PLAT_INI})
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    66
    {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    67
        _warning("ABLD_PLAT_INI is set; the build system might clobber your settings.");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    68
    }
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    69
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    70
    my $path = _fixup_path( $ENV{PATH}, RVCT_ver2set::get_bin_path($vers) );
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    71
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    72
    # Create the batch file.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    73
    {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    74
        my $fname = "..__.bat";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    75
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    76
        open (my $file,  ">",  $fname)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    77
            or _err_and_die("couldn't create $fname.");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    78
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    79
        print $file "set PATH=$path\n";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    80
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    81
        my ($n, $p);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    82
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    83
        $n = RVCT_ver2set::get_bin_name($vers);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    84
        $p = RVCT_ver2set::get_bin_path($vers);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    85
        print $file "set $n=$p\n";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    86
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    87
        $n = RVCT_ver2set::get_inc_name($vers);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    88
        $p = RVCT_ver2set::get_inc_path($vers);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    89
        print $file "set $n=$p\n";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    90
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    91
        $n = RVCT_ver2set::get_lib_name($vers);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    92
        $p = RVCT_ver2set::get_lib_path($vers);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    93
        print $file "set $n=$p\n";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    94
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    95
        print $file "echo.\n";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    96
        print $file "armcc --vsn\n";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    97
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    98
        close $file or _err_and_die("couldn't close $fname.");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    99
    }
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   100
}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   101
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   102
sub _usage_and_die(@)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   103
{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   104
    for (@_)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   105
    {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   106
        print STDERR "    $SELF_NAME $_\n";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   107
    }
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   108
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   109
    exit 1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   110
}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   111
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   112
sub _err_and_die(@)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   113
{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   114
    print STDERR "error: @_\n";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   115
    exit 1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   116
}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   117
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   118
sub _warning(@)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   119
{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   120
    print STDERR "warning: @_\n";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   121
}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   122
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   123
sub _fixup_path($$)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   124
{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   125
    my @path = split(/;/, shift);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   126
    my $bin  = shift;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   127
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   128
    my @result = ();
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   129
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   130
    foreach (@path)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   131
    {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   132
        push @result, ($_) unless ($_ eq $bin);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   133
    }
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   134
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   135
    return join(";", $bin, @result);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   136
}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   137
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   138
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   139
main(@ARGV);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   140
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   141
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   142
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   143
__END__
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   144
:endofperl
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   145
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   146
if "%errorlevel%" == "0" (if exist ..__.bat call ..__.bat & del ..__.bat)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   147
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   148
:: vim:ft=perl
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   149