############################################################################### # Copyright (c) ERG Transit Systems. 1996-2006 # # File: PLATFORM/SOLARIS.cfg # # Contents: SOLARIS Build support # # This package is used during the processing of the build.pl file # Values provided by this package are used to extend the Platform # information as platforms are being created. This provides a # powerful set of mechanism to extend the entire JATS toolset # # # Version Who Date Description # DDP 01-Aug-06 Created ############################################################################### use strict; use warnings; package SOLARIS_Build; use JatsError; use Storable qw(dclone); # # Create a hash of GBE_MACHTYPEs for which the SOLARIS platform is available # It won't just build on any only machine # # Hash values are an array of: # Operating System # architecture # my %valid_machines = ( 'sparc' => [ 'SOLARIS8' , 'sparc' ], 'solaris10_sparc32' => [ 'SOLARIS10', 'sparc' ], 'solaris10_sparc64' => [ 'SOLARIS10', 'sparc' ], 'solaris10_x86' => [ 'SOLARIS10', 'amd' ], 'solaris10_x64' => [ 'SOLARIS10', 'amd' ], ); my %arch_to_name = ( 'sparc' => { '32' => 'sparc32', '64' => 'sparc64' }, 'amd' => { '32' => 'x86' , '64' => 'x64' }, ); #------------------------------------------------------------------------------- # Function : new_platform # # Description : Called when a new platform is being created # The function can extend the build information # # The 'SOLARIS' platform will be converted into a 'suitable' # platform for the current machine. # # There a few legacy issues to contend with. # # Inputs : $pInfo - Reference to the platform build info hash # # Returns : Nothing yet # sub new_platform { my $class = shift; # Not really a class, but its called like a class my $pInfo = shift; # # Ignore this platform if there is no way that it can be built on the # current machine. # my $entry = $valid_machines{$::GBE_MACHTYPE}; unless ( $entry ) { Verbose ("SOLARIS will not build on this machine type: $::GBE_MACHTYPE"); $pInfo->{NOT_AVAILABLE} = 1; return; } #------------------------------------------------------------------------------- # # Determine the type of system we are dealing with the GBE_MACHTYPE # is the only real way of doing this # if ( $::GBE_MACHTYPE eq 'sparc' ) { # # Legacy target. # Really SOLARIS8_SPARC32, but it has been configured # as SOLARIS. This, unfortunately, must continue. # $pInfo->{TARGET} = 'SOLARIS'; # # Specify the Platform config file that should be used for the # remainder of the configuration information. # $pInfo->{TARGET_CFG} = 'SOLARIS8_SPARC32'; return; } # # Not building for the legacy :) # Generate a 32-bit and a 64-bit build target # my $os = $entry->[0]; my $arch = $entry->[1]; SOLARIS_generic( dclone($pInfo), $os, $arch, '32' ); SOLARIS_generic( dclone($pInfo), $os, $arch, '64' ); # # All done # Mark the original entry as a TEMPLATE so that it won't be added # We have cloned two copies of SOLARIS # $pInfo->{TEMPLATE} = 1; } #------------------------------------------------------------------------------- # Function : SOLARIS_generic # # Description : Take a clone of the buildinfo structure and specialise it # for either a 32-bit or a 64-bit build target # # Inputs : $pInfo - A clone of the buildinfo data # $os - Current OS # $arch - Current architecture # $size - Length required # # Returns : Nothing # The buildinfo MUST be added to the build system # sub SOLARIS_generic { my ($pInfo, $os, $arch, $size) = @_; Debug("SOLARIS_generic: $os, $arch, $size"); # # Request that a simple BuildAlias be created for this platform # Use the original name of the TARGET # $pInfo->{ALIAS} = $pInfo->{TARGET}; # # Specify the hardware family # Will be used to create an ALIAS # $pInfo->{HARDWARE} = uc($arch); # # Alter the 'TARGET' name # This is allowed (expected) # my $name = $arch_to_name{$arch}{$size}; Error ("Bad table: %arch_to_name") unless ( $name ); $pInfo->{TARGET} = uc("${os}_${name}"); # # Register this 'new' buildinfo entry with the build system # ::AddBuildPlatformEntry( $pInfo ); } 1;