Subversion Repositories DevTools

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
227 dpurdie 1
###############################################################################
2
# Copyright (c) ERG Transit Systems. 1996-2006
3
#
4
# File:         PLATFORM/SOLARIS.cfg
5
#
6
# Contents:     SOLARIS Build support
7
#
8
#               This package is used during the processing of the build.pl file
9
#               Values provided by this package are used to extend the Platform
10
#               information as platforms are being created. This provides a
11
#               powerful set of mechanism to extend the entire JATS toolset
12
#
13
#
14
# Version   Who      Date       Description
15
#           DDP      01-Aug-06  Created
16
###############################################################################
17
 
18
use strict;
19
use warnings;
20
 
21
package SOLARIS_Build;
22
use JatsError;
23
use Storable qw(dclone);
24
 
25
#
26
#   Create a hash of GBE_MACHTYPEs for which the SOLARIS platform is available
27
#   It won't just build on any only machine
28
#
29
#   Hash values are an array of:
30
#           Operating System
31
#           architecture
32
#
33
my %valid_machines = (
34
    'sparc'             => [ 'SOLARIS8' , 'sparc' ],
35
    'solaris10_sparc32' => [ 'SOLARIS10', 'sparc' ],
36
    'solaris10_sparc64' => [ 'SOLARIS10', 'sparc' ],
37
    'solaris10_x86'     => [ 'SOLARIS10', 'amd' ],
38
    'solaris10_x64'     => [ 'SOLARIS10', 'amd' ],
39
);
40
 
41
my %arch_to_name = (
42
    'sparc' => { '32' => 'sparc32', '64' => 'sparc64' },
43
    'amd'   => { '32' => 'x86'    , '64' => 'x64' },
44
);
45
 
46
#-------------------------------------------------------------------------------
47
# Function        : new_platform
48
#
49
# Description     : Called when a new platform is being created
50
#                   The function can extend the build information
51
#
52
#                   The 'SOLARIS' platform will be converted into a 'suitable'
53
#                   platform for the current machine.
54
#
55
#                   There a few legacy issues to contend with.
56
#
57
# Inputs          : $pInfo          - Reference to the platform build info hash
58
#
59
# Returns         : Nothing yet
60
#
61
 
62
sub new_platform
63
{
64
    my $class = shift;              # Not really a class, but its called like a class
65
    my $pInfo  = shift;
66
 
67
    #
68
    #   Ignore this platform if there is no way that it can be built on the
69
    #   current machine.
70
    #
71
    my $entry = $valid_machines{$::GBE_MACHTYPE};
72
    unless ( $entry )
73
    {
74
        Verbose ("SOLARIS will not build on this machine type: $::GBE_MACHTYPE");
75
        $pInfo->{NOT_AVAILABLE} = 1;
76
        return;
77
    }
78
 
79
    #-------------------------------------------------------------------------------
80
    #
81
    #   Determine the type of system we are dealing with the GBE_MACHTYPE
82
    #   is the only real way of doing this
83
    #
84
    if ( $::GBE_MACHTYPE eq 'sparc' )
85
    {
313 dpurdie 86
 
227 dpurdie 87
        #
313 dpurdie 88
        #   Provide an alais for the name that we would really like to call
89
        #   this platform.
90
        #
91
        $pInfo->{ALIAS} = 'SOLARIS8_SPARC32';
92
 
93
        #
227 dpurdie 94
        #   Legacy target. Really solaris8_sparc32, but it has been configured
95
        #   as SOLARIS. This, unfortunately, must continue.
96
        #
97
        $pInfo->{TARGET} = 'SOLARIS';
98
 
99
        #
100
        #   Specify the hardware family
101
        #   Will be used to create an ALIAS
102
        #
103
        $pInfo->{HARDWARE} = 'SPARC';
104
        return;
105
    }
106
 
107
    #
108
    #   Not building for the legacy :)
109
    #   Generate a 32-bit and a 64-bit build target
110
    #
111
 
112
    my $os   = $entry->[0];
113
    my $arch = $entry->[1];
114
 
115
    SOLARIS_generic(  dclone($pInfo), $os, $arch, '32' );
116
    SOLARIS_generic(  dclone($pInfo), $os, $arch, '64' );
117
 
118
    #
119
    #   All done
120
    #   Mark the original entry as a TEMPLATE so that it won't be added
121
    #   We have cloned two copies of SOLARIS
122
    #
123
    $pInfo->{TEMPLATE} = 1;
124
}
125
 
126
#-------------------------------------------------------------------------------
127
# Function        : SOLARIS_generic
128
#
129
# Description     : Take a clone of the buildinfo structure and specialise it
130
#                   for either a 32-bit or a 64-bit build target
131
#
132
# Inputs          : $pInfo       - A clone of the buildinfo data
133
#                   $os         - Current OS
134
#                   $arch       - Current architecture
135
#                   $size       - Length required
136
#
137
# Returns         : Nothing
138
#                   The buildinfo MUST be added to the build system
139
#
140
sub SOLARIS_generic
141
{
142
    my ($pInfo, $os, $arch, $size) = @_;
143
    Debug("SOLARIS_generic: $os, $arch, $size");
144
 
145
    #
146
    #   Request that a simple BuildAlias be created for this platform
147
    #   Use the original name of the TARGET
148
    #
149
    $pInfo->{ALIAS} = $pInfo->{TARGET};
150
 
151
    #
152
    #   Specify the hardware family
153
    #   Will be used to create an ALIAS
154
    #
155
    $pInfo->{HARDWARE} = uc($arch);
156
 
157
    #
158
    #   Alter the 'TARGET' name
159
    #   This is allowed (expected)
160
    #
161
    my $name = $arch_to_name{$arch}{$size};
162
    Error ("Bad table: %arch_to_name") unless ( $name );
163
    $pInfo->{TARGET} = uc("${os}_${name}");
164
 
165
    #
166
    #   Register this 'new' buildinfo entry with the build system
167
    #
168
    ::AddBuildPlatformEntry( $pInfo );
169
}
170
 
171
 
172
#-------------------------------------------------------------------------------
173
# Function        : add_platform
174
#
175
# Description     : This function is invoked just before a 'platform' is about
176
#                   to be added to the build system.
177
#
178
#                   This call is allowed to alter or extend the platform build
179
#                   information.
180
#
181
#                   This particular function, in the SOLARIS.CFG file, is called
182
#                   when the target platform 'SOLARIS'. The SOLARIS target is
183
#                   a complex as it serves two purposes.
184
#
185
#                   1 )SOLARIS is a dynamic platform. It will be chnaged
186
#                      into a machine specific platform.
187
#
188
#                   2) One of the 'dynamic' platforms is itself SOLARIS
189
#                      This name exists for compatability purposes as it is
190
#                      really a SOLARIS8_sparc32, but the name and a stack
191
#                      of kludges must be retained.
192
#
193
# Inputs          : $pInfo          - Reference to the platform build info hash
194
#
195
# Returns         : Nothing yet
196
#
197
sub add_platform
198
{
199
    my $class = shift;              # Not really a class, but its called like a class
200
    my $pInfo  = shift;
201
 
202
    #
203
    #   Insert data into the class
204
    #
205
    #   ALSO_USES
206
    #   An array of other platforms that may be 'used' by this platform.
207
    #   The process is not recursive
208
    #   Similar to the --Uses option in BuildPlatforms()
209
    #   Will be subject to product expansion.
210
    #
211
    #   Intended use: VS2003 can use stuff from WIN32, but only if the
212
    #                 VS2003 stuff is not available.
213
#    $pInfo->{ALSO_USES} = [];
214
 
215
    #
216
    #   EXTRA_USES
217
    #   An array of other platforms to be 'used' by this platform.
218
    #   This list is not expanded in a PRODUCT as the USERS list is.
219
    #
220
    #   Intended use: Extend the SOLARIS on a sparc platform to allow for bad usage.
221
    #                 ie: Stuff is in SOLARIS, SOLARIS_sparc and sparc
222
    #
223
    $pInfo->{EXTRA_USES} = ['SOLARIS', 'SOLARIS_sparc', 'sparc'];
224
 
225
    #
226
    #   SCMMACHTYPE
227
    #   Override for ScmMachType which appears in makefiles as GBE_MACHTYPE
228
    #   Default value is $ScmPlatform
229
    #
230
    #   Intended use: Legacy Support only
231
    #   Many legacy package.pl files use GBE_MACHTYPE to specify bin and lib
232
    #   subdirectores.
233
    #       The legacy SOLARIS on sparc sets this to 'sparc'
234
    #       For some reason WIN32 sets this to 'win32'
235
    #
236
    $pInfo->{SCMMACHTYPE} = 'sparc';
237
 
238
    #
239
    #   EXT_SHARED
240
    #   Set to the value of the shared library extension
241
    #
242
    #   Intended Use
243
    #   Used to locate shared libraries in packgages for use in the
244
    #   generation set_<PLATFORM>.sh/.bat
245
    #
246
    #   If not set then the set_.sh files will no be created
247
    #
248
    $pInfo->{EXT_SHARED} = '.so';
249
 
250
    #
251
    #   OS_COMMON
252
    #   Set the name of a directory to be used to package header files to be
253
    #   used on targets that share a common OS
254
    #
255
    #   Note: Should also be a part of EXTRA_USES
256
    #
257
    #   Intended Use
258
    #   Extend the operation of the PackageHdr directive to allow files
259
    #   common files to be packaged
260
    #
261
    $pInfo->{OS_COMMON} = 'SOLARIS';
262
}
263
 
264
1;
265