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
    {
86
        #
87
        #   Legacy target. Really solaris8_sparc32, but it has been configured
88
        #   as SOLARIS. This, unfortunately, must continue.
89
        #
90
        $pInfo->{TARGET} = 'SOLARIS';
91
 
92
        #
93
        #   Specify the hardware family
94
        #   Will be used to create an ALIAS
95
        #
96
        $pInfo->{HARDWARE} = 'SPARC';
97
        return;
98
    }
99
 
100
    #
101
    #   Not building for the legacy :)
102
    #   Generate a 32-bit and a 64-bit build target
103
    #
104
 
105
    my $os   = $entry->[0];
106
    my $arch = $entry->[1];
107
 
108
    SOLARIS_generic(  dclone($pInfo), $os, $arch, '32' );
109
    SOLARIS_generic(  dclone($pInfo), $os, $arch, '64' );
110
 
111
    #
112
    #   All done
113
    #   Mark the original entry as a TEMPLATE so that it won't be added
114
    #   We have cloned two copies of SOLARIS
115
    #
116
    $pInfo->{TEMPLATE} = 1;
117
}
118
 
119
#-------------------------------------------------------------------------------
120
# Function        : SOLARIS_generic
121
#
122
# Description     : Take a clone of the buildinfo structure and specialise it
123
#                   for either a 32-bit or a 64-bit build target
124
#
125
# Inputs          : $pInfo       - A clone of the buildinfo data
126
#                   $os         - Current OS
127
#                   $arch       - Current architecture
128
#                   $size       - Length required
129
#
130
# Returns         : Nothing
131
#                   The buildinfo MUST be added to the build system
132
#
133
sub SOLARIS_generic
134
{
135
    my ($pInfo, $os, $arch, $size) = @_;
136
    Debug("SOLARIS_generic: $os, $arch, $size");
137
 
138
    #
139
    #   Request that a simple BuildAlias be created for this platform
140
    #   Use the original name of the TARGET
141
    #
142
    $pInfo->{ALIAS} = $pInfo->{TARGET};
143
 
144
    #
145
    #   Specify the hardware family
146
    #   Will be used to create an ALIAS
147
    #
148
    $pInfo->{HARDWARE} = uc($arch);
149
 
150
    #
151
    #   Alter the 'TARGET' name
152
    #   This is allowed (expected)
153
    #
154
    my $name = $arch_to_name{$arch}{$size};
155
    Error ("Bad table: %arch_to_name") unless ( $name );
156
    $pInfo->{TARGET} = uc("${os}_${name}");
157
 
158
    #
159
    #   Register this 'new' buildinfo entry with the build system
160
    #
161
    ::AddBuildPlatformEntry( $pInfo );
162
}
163
 
164
 
165
#-------------------------------------------------------------------------------
166
# Function        : add_platform
167
#
168
# Description     : This function is invoked just before a 'platform' is about
169
#                   to be added to the build system.
170
#
171
#                   This call is allowed to alter or extend the platform build
172
#                   information.
173
#
174
#                   This particular function, in the SOLARIS.CFG file, is called
175
#                   when the target platform 'SOLARIS'. The SOLARIS target is
176
#                   a complex as it serves two purposes.
177
#
178
#                   1 )SOLARIS is a dynamic platform. It will be chnaged
179
#                      into a machine specific platform.
180
#
181
#                   2) One of the 'dynamic' platforms is itself SOLARIS
182
#                      This name exists for compatability purposes as it is
183
#                      really a SOLARIS8_sparc32, but the name and a stack
184
#                      of kludges must be retained.
185
#
186
# Inputs          : $pInfo          - Reference to the platform build info hash
187
#
188
# Returns         : Nothing yet
189
#
190
sub add_platform
191
{
192
    my $class = shift;              # Not really a class, but its called like a class
193
    my $pInfo  = shift;
194
 
195
    #
196
    #   Insert data into the class
197
    #
198
    #   ALSO_USES
199
    #   An array of other platforms that may be 'used' by this platform.
200
    #   The process is not recursive
201
    #   Similar to the --Uses option in BuildPlatforms()
202
    #   Will be subject to product expansion.
203
    #
204
    #   Intended use: VS2003 can use stuff from WIN32, but only if the
205
    #                 VS2003 stuff is not available.
206
#    $pInfo->{ALSO_USES} = [];
207
 
208
    #
209
    #   EXTRA_USES
210
    #   An array of other platforms to be 'used' by this platform.
211
    #   This list is not expanded in a PRODUCT as the USERS list is.
212
    #
213
    #   Intended use: Extend the SOLARIS on a sparc platform to allow for bad usage.
214
    #                 ie: Stuff is in SOLARIS, SOLARIS_sparc and sparc
215
    #
216
    $pInfo->{EXTRA_USES} = ['SOLARIS', 'SOLARIS_sparc', 'sparc'];
217
 
218
    #
219
    #   SCMMACHTYPE
220
    #   Override for ScmMachType which appears in makefiles as GBE_MACHTYPE
221
    #   Default value is $ScmPlatform
222
    #
223
    #   Intended use: Legacy Support only
224
    #   Many legacy package.pl files use GBE_MACHTYPE to specify bin and lib
225
    #   subdirectores.
226
    #       The legacy SOLARIS on sparc sets this to 'sparc'
227
    #       For some reason WIN32 sets this to 'win32'
228
    #
229
    $pInfo->{SCMMACHTYPE} = 'sparc';
230
 
231
    #
232
    #   EXT_SHARED
233
    #   Set to the value of the shared library extension
234
    #
235
    #   Intended Use
236
    #   Used to locate shared libraries in packgages for use in the
237
    #   generation set_<PLATFORM>.sh/.bat
238
    #
239
    #   If not set then the set_.sh files will no be created
240
    #
241
    $pInfo->{EXT_SHARED} = '.so';
242
 
243
    #
244
    #   OS_COMMON
245
    #   Set the name of a directory to be used to package header files to be
246
    #   used on targets that share a common OS
247
    #
248
    #   Note: Should also be a part of EXTRA_USES
249
    #
250
    #   Intended Use
251
    #   Extend the operation of the PackageHdr directive to allow files
252
    #   common files to be packaged
253
    #
254
    $pInfo->{OS_COMMON} = 'SOLARIS';
255
}
256
 
257
1;
258