Subversion Repositories DevTools

Rev

Rev 339 | Rev 373 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 339 Rev 369
Line 16... Line 16...
16
##############################################################################
16
##############################################################################
17
#   Configuration information
17
#   Configuration information
18
#   Cross reference from CrossCompiler Alias to actual paths
18
#   Cross reference from CrossCompiler Alias to actual paths
19
#   Structure:
19
#   Structure:
20
#   Hash reference: Array of toolchain information
20
#   Hash reference: Array of toolchain information
21
#           Root of compiler
-
 
22
#           Path to gcc
21
#       Mandatory
23
#           Path to ar
22
#          ROOT             => Root of compiler
24
#
-
 
25
#
-
 
26
my %ToolsetConfig = (
-
 
27
    #
-
 
28
    #   Preferred version of the embedded toolchain
23
#          BASE             => Base for binaries
29
    #
24
#       Optional
30
    'i386-unknown-linux-gnu'    => ['/opt/crosstool/gcc-4.1.1-glibc-2.5/i586-unknown-linux-gnu',
-
 
31
                                    'bin/i586-unknown-linux-gnu-gcc' ],
25
#          CC_OPTS          => Additonal Compiler options
32
 
-
 
33
    'arm-9tdmi-linux-gnu'       => ['/opt/crosstool/gcc-4.1.1-glibc-2.5/arm-9tdmi-linux-gnu',
-
 
34
                                    'bin/arm-9tdmi-linux-gnu-gcc' ],
26
#          UNCONTROLLED     => Boolean to create warning
35
 
27
 
36
    'powerpc-603e-linux-gnu'    => ['/opt/crosstool/gcc-4.1.1-glibc-2.5/powerpc-603e-linux-gnu',
-
 
37
                                    'bin/powerpc-603e-linux-gnu-gcc'],
28
my %ToolsetConfig = (
38
 
29
 
-
 
30
    'i386-unknown-linux-gnu'    => {
-
 
31
        ROOT => '/opt/crosstool/gcc-4.1.1-glibc-2.5/i586-unknown-linux-gnu',
-
 
32
        BASE => 'bin/i586-unknown-linux-gnu-',
-
 
33
    },
-
 
34
 
-
 
35
    'arm-9tdmi-linux-gnu'       => {
-
 
36
        ROOT => '/opt/crosstool/gcc-4.1.1-glibc-2.5/arm-9tdmi-linux-gnu',
-
 
37
        BASE => 'bin/arm-9tdmi-linux-gnu-'
-
 
38
        },
-
 
39
 
-
 
40
    'powerpc-603e-linux-gnu'    => {
-
 
41
       ROOT => '/opt/crosstool/gcc-4.1.1-glibc-2.5/powerpc-603e-linux-gnu',
-
 
42
       BASE => 'bin/powerpc-603e-linux-gnu-'
-
 
43
    },
-
 
44
 
-
 
45
    'arm-926ejs-linux-gnueabi'  => {
39
    'arm-926ejs-linux-gnueabi'  => ['/opt/crosstool/gcc-4.4.3-glibc-2.9/arm-926ejs-linux-gnueabi',
46
       ROOT => '/opt/crosstool/gcc-4.4.3-glibc-2.9/arm-926ejs-linux-gnueabi',
40
                                    'bin/arm-926ejs-linux-gnueabi-gcc' ],
47
       BASE => 'bin/arm-926ejs-linux-gnueabi-',
-
 
48
       CC_OPTS => '-Wno-psabi',
-
 
49
    },
41
 
50
 
42
    #
51
    #
43
    #   Old (not to be used) version of the embedded toolchain
52
    #   Old (not to be used) version of the embedded toolchain
44
    #   This was depricated in favor of gcc-4.1.1-glibc-2.5
53
    #   This was depricated in favor of gcc-4.1.1-glibc-2.5
45
    #   It is not possible to reproduce old packages using the old compiler
54
    #   It is not possible to reproduce old packages using the old compiler
46
    #   This is a known issue
55
    #   This is a known issue
47
    #
56
    #
-
 
57
    'i386-unknown-linux-gnu.glibc-2.3.2' => {
48
    'i386-unknown-linux-gnu.glibc-2.3.2' => ['/opt/crosstool/gcc-4.1.0-glibc-2.3.2/i386-unknown-linux-gnu',
58
       ROOT => '/opt/crosstool/gcc-4.1.0-glibc-2.3.2/i386-unknown-linux-gnu',
49
                                 'bin/i386-unknown-linux-gnu-gcc' ],
59
       BASE => 'bin/i386-unknown-linux-gnu-'
-
 
60
    },
50
 
61
 
-
 
62
    'arm-9tdmi-linux-gnu.glibc-2.3.2' => {
51
    'arm-9tdmi-linux-gnu.glibc-2.3.2'    => ['/opt/crosstool/gcc-4.1.0-glibc-2.3.2/arm-9tdmi-linux-gnu',
63
       ROOT => '/opt/crosstool/gcc-4.1.0-glibc-2.3.2/arm-9tdmi-linux-gnu',
52
                                 'bin/arm-9tdmi-linux-gnu-gcc' ],
64
       BASE => 'bin/arm-9tdmi-linux-gnu-'
-
 
65
    },
53
 
66
 
54
    #
67
    #
55
    #   Not too sure where this is used
68
    #   Not too sure where this is used
56
    #
69
    #
57
    'armv4l-unknown-linux-gcc' => [ '/opt/host/armv4l',
70
    'armv4l-unknown-linux-gcc' => {
-
 
71
       ROOT => '/opt/host/armv4l',
58
                                    'bin/armv4l-unknown-linux-gcc' ],
72
       BASE => 'bin/armv4l-unknown-linux-'
-
 
73
    },
59
 
74
 
60
    #
75
    #
61
    #   The compiler for the current local machine
76
    #   The compiler for the current local machine
62
    #
77
    #
63
    'i386-unknown-linux-gcc' => [ '/opt/host/i386',
78
    'i386-unknown-linux-gcc' => {
-
 
79
       ROOT => '/usr',
64
                                  'bin/i386-unknown-linux-gcc' ],
80
       BASE => 'bin/',
65
 
-
 
-
 
81
       UNCONTROLLED => 1,
66
    );
82
    },
-
 
83
);
67
 
84
 
68
#
85
#
69
#   Cross reference from GCCTarget to GBE_MACHTYPE for which it can
86
#   Cross reference from GCCTarget to GBE_MACHTYPE for which it can
70
#   build using the 'native gcc'. This is NOT the preferred mode of operation
87
#   build using the 'native gcc'. This is NOT the preferred mode of operation
71
#   as the compiler is not as controlled as the cross compilers.
88
#   as the compiler is not as controlled as the cross compilers.
Line 82... Line 99...
82
 
99
 
83
ToolsetInit();
100
ToolsetInit();
84
 
101
 
85
sub ToolsetInit
102
sub ToolsetInit
86
{
103
{
87
    my( $GCCTarget, @GCCToolchain, $GCCRoot, $GCCBin, $GCCAr );
104
    my( $GCCTarget, $GCCToolchain, $GCCRoot, $GCCBin, $GCCAr, $GCCFlags );
88
    my( $arg_alias, $tools_found );
105
    my( $arg_alias, $tools_found );
89
 
106
 
90
#.. Toolset configuration
107
#.. Toolset configuration
91
#
108
#
92
    $::ScmToolsetVersion = "1.0.0";             # our version
109
    $::ScmToolsetVersion = "1.0.0";             # our version
Line 134... Line 151...
134
#
151
#
135
    if ( $arg_alias )
152
    if ( $arg_alias )
136
    {
153
    {
137
        if ( exists $ToolsetConfig{ $arg_alias } )
154
        if ( exists $ToolsetConfig{ $arg_alias } )
138
        {
155
        {
139
            @GCCToolchain = @{$ToolsetConfig{ $arg_alias }};
156
            $GCCToolchain = $ToolsetConfig{ $arg_alias };
140
            $tools_found = (-d $GCCToolchain[0]);
157
            $tools_found = (-d $GCCToolchain->{ROOT});
141
            Warning ("gcc toolset: CrossPlatform toolchain not found for: $arg_alias",
158
            Warning ("gcc toolset: CrossPlatform toolchain not found for: $arg_alias",
142
                     "Path: $GCCToolchain[0]" ) unless $tools_found;
159
                     "Path: $GCCToolchain->{ROOT}" ) unless $tools_found;
143
        }
160
        }
144
        else
161
        else
145
        {
162
        {
146
            Error("gcc toolset: CrossPlatform Alias not configured: $arg_alias");
163
            Error("gcc toolset: CrossPlatform Alias not configured: $arg_alias");
147
        }
164
        }
-
 
165
 
-
 
166
        Warning ("Uncontrolled toolchain used: $arg_alias")
-
 
167
            if ( exists($GCCToolchain->{UNCONTROLLED}) && $GCCToolchain->{UNCONTROLLED} );
148
    }
168
    }
149
 
169
 
150
    #
170
    #
151
    #   If no Cross compiler toolchain is found (preferred method), then attempt
171
    #   If no Cross compiler toolchain is found (preferred method), then attempt
152
    #   to match a native compiler. Only known targets allow a native build
172
    #   to match a native compiler. Only known targets allow a native build
Line 156... Line 176...
156
        if ( exists ( $NativeCompilers{$GCCTarget} ))
176
        if ( exists ( $NativeCompilers{$GCCTarget} ))
157
        {
177
        {
158
            if ( $NativeCompilers{$GCCTarget} eq $::GBE_MACHTYPE )
178
            if ( $NativeCompilers{$GCCTarget} eq $::GBE_MACHTYPE )
159
            {
179
            {
160
                $tools_found = 1;
180
                $tools_found = 1;
161
                @GCCToolchain = ();
181
                $GCCToolchain = undef;
162
            }
182
            }
163
        }
183
        }
164
    }
184
    }
165
 
185
 
166
    #
186
    #
Line 168... Line 188...
168
    #
188
    #
169
    Error ("gcc toolset: Toolchain not found for: $GCCTarget" )
189
    Error ("gcc toolset: Toolchain not found for: $GCCTarget" )
170
        unless ( $tools_found );
190
        unless ( $tools_found );
171
 
191
 
172
 
192
 
173
    if ( @GCCToolchain )
193
    if ( defined $GCCToolchain )
174
    {
194
    {
175
        #
195
        #
176
        #   Parse GCCToolchain. Potentially three parts
196
        #   Parse GCCToolchain. Potential parts to create
177
        #   [0] - GCCRoot - Location to find the effective /usr/include directory
197
        #       GCCRoot     - Location to find the effective /usr/include directory
178
        #   [1] - GCCBin  - Path to the gcc executable
198
        #       GCCBin      - Path to the gcc executable
179
        #                   If relative, then its relative to GCCRoot
-
 
180
        #   [2] - GCCAr   - Path to the ar executable
199
        #       GCCAr       - Path to the ar executable
181
        #                   If relative, then its relative to GCCRoot
-
 
182
        #                   If not defined then its the same as GCCBin with gcc replaced with ar
-
 
183
        #
-
 
184
        $GCCRoot = $GCCToolchain[0];
-
 
185
 
-
 
186
        #   GCC_CC definition
-
 
187
        #
-
 
188
        if ( $GCCToolchain[1] )
-
 
189
        {                                           # user specification
-
 
190
            if ( substr($GCCToolchain[1],0,1) ne "/") {
-
 
191
                $GCCBin = $GCCToolchain[0].'/'.$GCCToolchain[1];
-
 
192
            } else {
-
 
193
                $GCCBin = $GCCToolchain[1];         # abs path
-
 
194
            }
-
 
195
        }
-
 
196
        else
-
 
197
        {                                           # default
200
        #       GCCFlags    - Additional compiler flags
198
            $GCCBin = $GCCToolchain[0] . '/bin/gcc';
-
 
199
        }
-
 
200
 
-
 
201
        #   GCC_AR definition
-
 
202
        #
201
        #
203
        if ( defined($GCCToolchain[2]) && $GCCToolchain[2] )
202
        $GCCRoot = $GCCToolchain->{ROOT};
204
        {                                           # user specification
-
 
205
            if ( substr($GCCToolchain[2],0,1) ne "/") {
203
        $GCCBin = '${GCC_ROOT}/' . $GCCToolchain->{BASE} . 'gcc';
206
                $GCCAr = $GCCToolchain[0].'/'.$GCCToolchain[2];
204
        $GCCAr =  '${GCC_ROOT}/' . $GCCToolchain->{BASE} . 'ar';
207
            } else {
-
 
208
                $GCCAr = $GCCToolchain[2];          # abs path
205
        $GCCFlags = $GCCToolchain->{CC_OPTS};
209
            }
-
 
210
        } 
-
 
211
        else 
-
 
212
        {                                           # default, base on GCCBin
-
 
213
            $GCCAr = substr($GCCBin,0,length($GCCBin)-3)."ar";
-
 
214
        }
-
 
215
    }
206
    }
216
    else
207
    else
217
    {
208
    {
218
        $GCCRoot = "/usr";
209
        $GCCRoot = "/usr";
219
        $GCCBin = "gcc";
210
        $GCCBin = "gcc";
Line 225... Line 216...
225
    PlatformDefine( "
216
    PlatformDefine( "
226
#################################################
217
#################################################
227
# GCC toolchain definitions 
218
# GCC toolchain definitions 
228
#
219
#
229
#..");
220
#..");
230
    PlatformDefine( "GCC_TARGET\t".     ":=$GCCTarget" );
221
    PlatformDefine( "GCC_TARGET         := $GCCTarget" );
231
    PlatformDefine( "GCC_ROOT\t".       ":=$GCCRoot" );
222
    PlatformDefine( "GCC_ROOT           := $GCCRoot" );
232
    PlatformDefine( "GCC_CC\t\t".       ":=$GCCBin" );
223
    PlatformDefine( "GCC_CC             := $GCCBin" );
233
    PlatformDefine( "GCC_AR\t\t".       ":=$GCCAr" );
224
    PlatformDefine( "GCC_AR             := $GCCAr" );
234
    PlatformDefine( "" );
225
    PlatformDefine( "" );
235
 
226
 
-
 
227
    PlatformDefine( "GCC_CFLAGS         := $GCCFlags" ) if defined $GCCFlags;
-
 
228
 
-
 
229
 
236
    #
230
    #
237
    #   Required since this toolset advertises: ScmToolsetCompilerPath
231
    #   Required since this toolset advertises: ScmToolsetCompilerPath
238
    #
232
    #
239
    PlatformDefine( "SCM_COMPILERPATH\t\t".       ":=$GCCBin" );
233
    PlatformDefine( "SCM_COMPILERPATH   := \$\{GCC_CC\}" );
-
 
234
    PlatformDefine( "" );
240
 
235
 
241
 
236
 
242
#.. Piece the world together
237
#.. Piece the world together
243
#
238
#
244
    Init( "gcc" );
239
    Init( "gcc" );