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