Subversion Repositories DevTools

Rev

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

Rev 6198 Rev 6276
Line 27... Line 27...
27
use Pod::Usage;
27
use Pod::Usage;
28
use Getopt::Long;
28
use Getopt::Long;
29
use File::Path;
29
use File::Path;
30
use XML::Writer;
30
use XML::Writer;
31
use ArrayHashUtils;
31
use ArrayHashUtils;
-
 
32
use Storable qw(dclone);
32
 
33
 
33
our $BuildVersion           = "2.1.0";
34
our $BuildVersion           = "2.1.0";
34
 
35
 
35
#.. Switchs
36
#.. Switchs
36
#
37
#
Line 65... Line 66...
65
our @BUILDSETENV            = ();               # BuildSetenv()
66
our @BUILDSETENV            = ();               # BuildSetenv()
66
our $BUILDINTERFACE         = "";               # BuildInterface()
67
our $BUILDINTERFACE         = "";               # BuildInterface()
67
our $BUILDLOCAL             = "";               # BuildInterface()
68
our $BUILDLOCAL             = "";               # BuildInterface()
68
our $BUILDDIRTREE           = "";               # BuildDirTree()
69
our $BUILDDIRTREE           = "";               # BuildDirTree()
69
our @BUILD_BADNAME          = ();               # Unknown platforms
70
our @BUILD_BADNAME          = ();               # Unknown platforms
70
our @GENERIC_TARGETS        = ();               # Generic targets - only one allowed    
71
our @GENERIC_TARGETS        = ();               # Generic targets - only one allowed
71
 
72
 
72
our $BUILDNAME              = "";               # BuildName()
73
our $BUILDNAME              = "";               # BuildName()
73
our $BUILDVERSION           = "";               # BuildName()
74
our $BUILDVERSION           = "";               # BuildName()
74
our $BUILDNAME_PACKAGE;                         # Name
75
our $BUILDNAME_PACKAGE;                         # Name
75
our $BUILDNAME_VERSION;                         # Version
76
our $BUILDNAME_VERSION;                         # Version
Line 87... Line 88...
87
our $BUILDPHASE             = 0;                # In Build Phase
88
our $BUILDPHASE             = 0;                # In Build Phase
88
our @CLOBBERDIRS            = ();               # Directories to clobber
89
our @CLOBBERDIRS            = ();               # Directories to clobber
89
our @REMOVEDIRS             = ();               # Directories to remove - if empty
90
our @REMOVEDIRS             = ();               # Directories to remove - if empty
90
our %BUILD_KNOWNFILES       = ();               # Files that will be known
91
our %BUILD_KNOWNFILES       = ();               # Files that will be known
91
our @BUILDEXCLUDE           = ();               # Platforms to be excluded
92
our @BUILDEXCLUDE           = ();               # Platforms to be excluded
-
 
93
our @BUILDARGUMENTS         = ();               # Build Atguments
92
 
94
 
93
our $Makelib                = "";
95
our $Makelib                = "";
94
our $GBE_CORE;                                  # Root of JATS
96
our $GBE_CORE;                                  # Root of JATS
95
our $InterfaceVersion;                          # Interface directory format version
97
our $InterfaceVersion;                          # Interface directory format version
96
our $ScmRoot;                                   # Package Root
98
our $ScmRoot;                                   # Package Root
Line 107... Line 109...
107
 
109
 
108
my  $genToolsetPlatform     = 0;                # BuildToolset directive has been seen
110
my  $genToolsetPlatform     = 0;                # BuildToolset directive has been seen
109
my  $genToolsetActive       = 0;                # TOOLSET platform required:1, Error:2
111
my  $genToolsetActive       = 0;                # TOOLSET platform required:1, Error:2
110
my  $toolsetPlatform        = 'NONE';           # TOOLSET Display Value
112
my  $toolsetPlatform        = 'NONE';           # TOOLSET Display Value
111
my  @genToolsetArgs;                            # Args for a generated TOOLSET
113
my  @genToolsetArgs;                            # Args for a generated TOOLSET
-
 
114
my  $descpkgPath;                               # Path to the dscpkg file
112
 
115
 
113
BuildLibInit();
116
BuildLibInit();
114
 
117
 
115
sub BuildLibInit
118
sub BuildLibInit
116
{
119
{
Line 128... Line 131...
128
    EnvImport( 'USER' );
131
    EnvImport( 'USER' );
129
    EnvImport( 'GBE_HOSTNAME');
132
    EnvImport( 'GBE_HOSTNAME');
130
    EnvImport( 'GBE_DRV' )
133
    EnvImport( 'GBE_DRV' )
131
        if ( $ScmHost ne 'Unix' );            # DOS or WIN special
134
        if ( $ScmHost ne 'Unix' );            # DOS or WIN special
132
 
135
 
-
 
136
    EnvImportOptional ( 'GBE_DPKG_ESCROW','' );
133
    EnvImportOptional ( 'GBE_DPKG_REPLICA','' );
137
    EnvImportOptional ( 'GBE_DPKG_REPLICA','' );
134
    EnvImportOptional ( 'GBE_DPKG_STORE','' );
138
    EnvImportOptional ( 'GBE_DPKG_STORE','' );
135
    EnvImportOptional ( 'GBE_DPKG_CACHE','' );
139
    EnvImportOptional ( 'GBE_DPKG_CACHE','' );
136
    EnvImportOptional ( 'GBE_DPKG_LOCAL','' );
140
    EnvImportOptional ( 'GBE_DPKG_LOCAL','' );
137
    EnvImportOptional ( 'GBE_DPKG_SBOX' ,'' );
141
    EnvImportOptional ( 'GBE_DPKG_SBOX' ,'' );
Line 150... Line 154...
150
    Require( "$::GBE_CONFIG/PLATFORM", "PLATFORM_CFG.PM"  );
154
    Require( "$::GBE_CONFIG/PLATFORM", "PLATFORM_CFG.PM"  );
151
 
155
 
152
#.. Parse command line
156
#.. Parse command line
153
#
157
#
154
    $ScmBuildSrc = $0;                          # Name of the build file
158
    $ScmBuildSrc = $0;                          # Name of the build file
155
    $Cwd = shift @ARGV;
-
 
156
    $Cwd =~ tr~\\/~/~s;;                        # Need / in path, Remove doubles
159
    shift @ARGV;                                # No longer used
157
    $::ScmRoot = StripDrive($Cwd);
160
    $::ScmRoot = $CwdFull;                      # $CwdFull does not have a driver letter. $CwdFull does
158
    $Makelib = shift @ARGV;                     # Only for legacy build.pl files
161
    $Makelib = shift @ARGV;                     # Only for legacy build.pl files
159
 
162
 
160
    Verbose ("Command Line: @ARGV");
163
    Verbose ("Command Line: @ARGV");
161
    my $result = GetOptions( "help|h:+"      => \$opt_help,
164
    my $result = GetOptions( "help|h:+"      => \$opt_help,
162
                             "man:3"         => \$opt_help,
165
                             "man:3"         => \$opt_help,
Line 172... Line 175...
172
                             "generic!"      => \$GenericBuild,
175
                             "generic!"      => \$GenericBuild,
173
                             );
176
                             );
174
    Usage() if ( $opt_help || !$result );
177
    Usage() if ( $opt_help || !$result );
175
 
178
 
176
    Debug( "Host:          ", $ScmHost );
179
    Debug( "Host:          ", $ScmHost );
177
    Debug( "Cwd:           ", $Cwd );
180
    Debug( "Cwd:           ", $CwdFull );
-
 
181
    Debug( "ScmRoot:       ", $::ScmRoot );
178
    Debug( "Makelib:       ", $Makelib );
182
    Debug( "Makelib:       ", $Makelib );
179
    Debug( "BuildFile:     ", $ScmBuildSrc );
183
    Debug( "BuildFile:     ", $ScmBuildSrc );
180
    Debug( "Debug:         ", $::ScmDebug );
184
    Debug( "Debug:         ", $::ScmDebug );
181
    Debug( "Verbose:       ", $::ScmVerbose );
185
    Debug( "Verbose:       ", $::ScmVerbose );
182
    Debug( "Expert:        ", $Expert );
186
    Debug( "Expert:        ", $Expert );
Line 492... Line 496...
492
                    {
496
                    {
493
                        push @pargs, '--NotDefault' if ( $notdefault );
497
                        push @pargs, '--NotDefault' if ( $notdefault );
494
                        push @pargs, '--FunctionName=BuildAlias';
498
                        push @pargs, '--FunctionName=BuildAlias';
495
                        BuildPlatforms( $platform, @pargs );
499
                        BuildPlatforms( $platform, @pargs );
496
                    }
500
                    }
-
 
501
                    else
-
 
502
                    {
-
 
503
                        my @badArgs = grep (/^--/, @pargs) ;
-
 
504
                        if (@badArgs) {
-
 
505
                            Warning("Platform arguments in define mode are ignored:($platform)", @badArgs);
-
 
506
                        }
-
 
507
                        
-
 
508
                    }
497
                }
509
                }
498
 
510
 
499
                #
511
                #
500
                #   Start collecting args for the next platform
512
                #   Start collecting args for the next platform
501
                #
513
                #
Line 531... Line 543...
531
#
543
#
532
# Returns         : Nothing
544
# Returns         : Nothing
533
#
545
#
534
sub Process_TargetAlias
546
sub Process_TargetAlias
535
{
547
{
536
 
-
 
537
    #
548
    #
538
    #   Merge any delayed aliases with the complete set of alias
549
    #   Merge any delayed aliases with the complete set of alias
539
    #   Delayed alias are not used in expansions during the processing
550
    #   Delayed alias are not used in expansions during the processing
540
    #   of platforms and targets, but can be used to pick up errors
551
    #   of platforms and targets, but can be used to pick up errors
541
    #
552
    #
Line 548... Line 559...
548
        }
559
        }
549
        $BUILDALIAS{$key} = $value;
560
        $BUILDALIAS{$key} = $value;
550
    }
561
    }
551
    ErrorDoExit();
562
    ErrorDoExit();
552
 
563
 
-
 
564
    #
-
 
565
    #   Empty so that its not seen in Buildfile.
-
 
566
    #
-
 
567
    %BUILDALIAS_DELAY =();
-
 
568
 
553
    foreach my $alias ( keys %BUILDALIAS_TARGETS )
569
    foreach my $alias ( keys %BUILDALIAS_TARGETS )
554
    {
570
    {
555
        Debug( "BuildTargetAlias($alias)" );
571
        Debug( "BuildTargetAlias($alias)" );
556
 
572
 
557
        #
573
        #
Line 600... Line 616...
600
{
616
{
601
    #
617
    #
602
    #   Clean up Aliases
618
    #   Clean up Aliases
603
    #
619
    #
604
#DebugDumpData("BEFORE CleanUp_Aliases", \%BUILDALIAS);
620
#DebugDumpData("BEFORE CleanUp_Aliases", \%BUILDALIAS);
-
 
621
 
605
    foreach my $alias ( keys %BUILDALIAS )
622
    foreach my $alias ( keys %BUILDALIAS )
606
    {
623
    {
-
 
624
        #
-
 
625
        #   Build hash of bits to be added and bits to be removed
-
 
626
        #   Remove all options - only need platforms
-
 
627
        #
607
        my @aliasList = split(/ /, $BUILDALIAS{$alias});
628
        my @aliasList = split(/ /, $BUILDALIAS{$alias});
608
        my @expanded =  ExpandPlatforms(@aliasList);
629
        my @expanded =  ExpandPlatforms(@aliasList);
609
 
630
 
610
        my %add;
631
        my %add;
611
        my %remove;
632
        my %remove;
Line 623... Line 644...
623
        #
644
        #
624
        #   If there are NO additive expressions in the alias, then
645
        #   If there are NO additive expressions in the alias, then
625
        #   assume all the active targets
646
        #   assume all the active targets
626
        #
647
        #
627
        unless (keys %add) {
648
        unless (keys %add) {
628
            foreach  ( @BUILD_ACTIVEPLATFORMS)
649
            %add = map { $_ => 1 } @BUILD_ACTIVEPLATFORMS;
629
            {
-
 
630
                 $add{$_} = 1;
-
 
631
            }
-
 
632
        }
650
        }
633
 
651
 
634
 
-
 
635
        foreach ( keys %remove) {
652
        foreach ( keys %remove) {
636
            delete $add { $_};
653
            delete $add { $_};
637
        }
654
        }
638
 
655
 
-
 
656
        #
-
 
657
        #   Delete ALIAS if it has no expansion
-
 
658
        #       May cause issues with the Platforms directive
-
 
659
        #
-
 
660
        if (keys %add) {
639
        $BUILDALIAS{$alias} = join(' ',keys %add);
661
            $BUILDALIAS{$alias} = join(' ',keys %add);
-
 
662
        } else {
-
 
663
            delete $BUILDALIAS{$alias};
-
 
664
        }
640
    }
665
    }
641
#DebugDumpData("AFTER CleanUp_Aliases", \%BUILDALIAS);
666
#DebugDumpData("AFTER CleanUp_Aliases", \%BUILDALIAS);
642
}
667
}
643
 
668
 
-
 
669
#-------------------------------------------------------------------------------
-
 
670
# Function        : ProcessBuildExclude  
-
 
671
#
-
 
672
# Description     : Process BuildExclude directive info
-
 
673
#                   A list of targets to be excluded
-
 
674
#                   INSTRUMENT is a key word
-
 
675
#  
-
 
676
#
-
 
677
# Inputs          : None
-
 
678
#
-
 
679
# Returns         : Modifies BUILDINFO
-
 
680
#
-
 
681
sub ProcessBuildExclude
-
 
682
{
-
 
683
    for my $word (@BUILDEXCLUDE)
-
 
684
    {
-
 
685
        Debug("ProcessBuildExclude: $word");
-
 
686
        Error('BuildExclude: Unknown option: ' . $word) if ($word =~ m~^-~);
-
 
687
        Error('BuildExclude: Invalid format: ' . $word) if ($word =~ m~^!~);
-
 
688
 
-
 
689
        #
-
 
690
        #   INSTRUMENT is a key word
-
 
691
        #       Remove all instrumented builds
-
 
692
        #
-
 
693
        if ($word eq 'INSTRUMENT')
-
 
694
        {
-
 
695
            foreach my $platform ( keys %BUILDINFO )
-
 
696
            {
-
 
697
                if ( PlatformConfig::targetHasTag( $platform, 'INSTRUMENT') ) {
-
 
698
                    $BUILDINFO{$platform}{NOT_AVAILABLE} = 2;
-
 
699
                    Debug("ProcessBuildExclude. Remove $platform ");
-
 
700
                }
-
 
701
            }
-
 
702
        }
-
 
703
        elsif (exists $BUILDINFO{$word} )
-
 
704
        {
-
 
705
            $BUILDINFO{$word}{NOT_AVAILABLE} = 2;
-
 
706
            Debug("ProcessBuildExclude. Remove $word ");
-
 
707
 
-
 
708
        } else {
-
 
709
            abtWarning(0,'BuildExclude: Unknown target:' . $word ) 
-
 
710
        }
-
 
711
    }
-
 
712
    ErrorDoExit();
-
 
713
}
644
 
714
 
645
#-------------------------------------------------------------------------------
715
#-------------------------------------------------------------------------------
646
# Function        : BuildProduct
716
# Function        : BuildProduct
647
#
717
#
648
# Description     : Create a family of Platforms with a common product line
718
# Description     : Create a family of Platforms with a common product line
Line 795... Line 865...
795
 
865
 
796
    #
866
    #
797
    #   Create a basic BUILDINFO entry
867
    #   Create a basic BUILDINFO entry
798
    #
868
    #
799
    $buildentry{FNAME} = $fname;
869
    $buildentry{FNAME} = $fname;
800
    $buildentry{NOT_DEFAULT} = $notdefault;
870
    $buildentry{NOT_DEFAULT} = $notdefault if $notdefault;
801
    $buildentry{PRODUCT} = $product;
871
    $buildentry{PRODUCT} = $product;
802
    $buildentry{TARGET} = $target;
872
    $buildentry{TARGET} = $target;
803
    $buildentry{BASE} = $target;
873
    $buildentry{BASE} = $target;
804
    foreach ( @$pArgs )
874
    foreach ( @$pArgs )
805
    {
875
    {
Line 826... Line 896...
826
        Error("Invalid use of the platform alias $reserved","The $reserved alias cannot be used to define build platforms")
896
        Error("Invalid use of the platform alias $reserved","The $reserved alias cannot be used to define build platforms")
827
            if (uc($target) eq uc($reserved));
897
            if (uc($target) eq uc($reserved));
828
    }
898
    }
829
 
899
 
830
    #
900
    #
831
    #   Allow per-platform processing to alter the basic information
-
 
832
    #   Special processing may be perform to extend the information
-
 
833
    #   Allows special processing to be enabled on a per-target basis
-
 
834
    #
-
 
835
    #   There are three forms of processing that have been allowed for:
901
    #   Expand families of platforms into multiple platforms
836
    #       1) None:        There is not platform specific extension
-
 
837
    #       2) Basic:       The extension will add or extend build information
-
 
838
    #       3) Advanced:    The extension will generate additional build information
-
 
839
    #                       structures.
902
    #       ie: DEVLINUX -> COBRA, VIPER, ....
840
    #
903
    #
841
 
-
 
842
    #
-
 
843
    #   Locate the optional PLATFORM configuration file
904
    foreach my $name (@PlatformConfig::BuildFamilies)
844
    #   If it does exist then it can alter build-time information
-
 
845
    #
-
 
846
    if ( my $build_cfg = Require( "$::GBE_CONFIG/PLATFORM", "$target.cfg"  ) )
-
 
847
    {
905
    {
848
        Verbose ("Processing(new) Platform Configuration file: $build_cfg");
-
 
849
 
-
 
850
        #
906
        #
851
        #   Create package name with an uppercase target
-
 
852
        #   Target should be UC, but under windows its not detected
-
 
853
        #   at this time
907
        #   Is this target a buildFamily alias
854
        #
908
        #
855
        my $package_name = uc($target) . '_Build';
-
 
856
 
-
 
857
        #
-
 
858
        #   Ensure that the CFG is correctly formed
-
 
859
        #       Perhaps the package that it implements was misnamed
-
 
860
        #
-
 
861
        Error ("INTERNAL: $target.cfg does not satisfy API " )
-
 
862
            unless ( $package_name->can('new_platform') || $package_name->can('add_platform') );
-
 
863
 
-
 
864
        if ( $package_name->can('new_platform') )
909
        if (uc($target) eq uc($name))
865
        {
910
        {
-
 
911
            #
-
 
912
            #   Get the list of targets that have been tagged with the family name
-
 
913
            #   Must exist - else its an internal error
-
 
914
            #   
866
            Verbose ("Processing(new) Platform Configuration: $package_name");
915
            my @targets = PlatformConfig::getTargetsByTag($name);
-
 
916
            Error ("Internal: No platforms are tagged as members of $name") unless @targets;
-
 
917
 
-
 
918
            #   Instantiate all targets
-
 
919
            #       Give them an ALIAS for the Family name
867
            $package_name->new_platform( \%buildentry );
920
            #       Register new enrty with the build system
868
        }
921
            #
-
 
922
            foreach my $target ( @targets )
869
        else
923
            {
-
 
924
                my $pInfo = dclone(\%buildentry);
-
 
925
                $pInfo->{ALIAS} = $pInfo->{TARGET};
-
 
926
                $pInfo->{TARGET} = $target;
-
 
927
                AddBuildPlatformEntry( $pInfo );
870
        {
928
            }
871
            Debug ("Processing(new) Platform Configuration: $package_name. 'new_platform' function not found");
929
            #   Mark the original entry as a TEMPLATE so that it won't be added
-
 
930
            $buildentry{TEMPLATE} = 1;
-
 
931
            last;
872
        }
932
        }
873
    }
933
    }
874
 
934
    
875
    #
935
    #
876
    #   Add the basic entry into the build system, unless its been
936
    #   Add the basic entry into the build system, unless its been flagged as a TEMPLATE
877
    #   flagged as a TEMPLATE
-
 
878
    #
937
    #
879
    AddBuildPlatformEntry (\%buildentry )
938
    AddBuildPlatformEntry (\%buildentry )
880
        unless ( $buildentry{TEMPLATE} );
939
        unless ( $buildentry{TEMPLATE} );
881
}
940
}
882
 
941
 
883
 
-
 
884
#-------------------------------------------------------------------------------
942
#-------------------------------------------------------------------------------
885
# Function        : AddBuildPlatformEntry
943
# Function        : AddBuildPlatformEntry
886
#
944
#
887
# Description     : Internal routine to add a Build Entry into the build system
945
# Description     : Internal routine to add a Build Entry into the build system
888
#                   This function MAY be called from the build extensions
946
#                   This function MAY be called from the build extensions
Line 902... Line 960...
902
{
960
{
903
    my ($pInfo) = @_;
961
    my ($pInfo) = @_;
904
    my $fname = $pInfo->{FNAME};
962
    my $fname = $pInfo->{FNAME};
905
 
963
 
906
    #
964
    #
907
    #   Locate the optional PLATFORM configuration file
-
 
908
    #   If it does exist then it can extend build-time information
965
    #   Ensure that it exsists and is numeric
909
    #
966
    #
910
    my $target = $pInfo->{TARGET};
967
    $pInfo->{NOT_AVAILABLE} = 0;
911
 
968
 
912
    #
969
    #
913
    #   Yukky Kludge
-
 
914
    #   JATS has a mechanism whereby packages can create new platforms
-
 
915
    #   Luckily this has only been done for LMOS - don't every do it again
970
    #   Locate the optional PLATFORM configuration file
916
    #   One problem is that we can't validate the target name at this point
-
 
917
    #   in time: as the packages are loaded much later.
971
    #   If it does exist then it can extend build-time information
918
    #
-
 
919
    #   Kludge. Assume that a leading LMOS_ can be removed when determing
-
 
920
    #           validity of the target platform.
-
 
921
    #
972
    #
922
    my $base_target = $target;
973
    my $target = $pInfo->{TARGET};
923
    $base_target =~ s~^LMOS_~~;
-
 
924
 
974
 
925
    #
975
    #
926
    #   Detect GENERIC targets
976
    #   Detect GENERIC targets
927
    #       The Build file is only allowed to have one that can be built on any one machine
977
    #       The Build file is only allowed to have one that can be built on any one machine
928
    #
978
    #
929
    my $buildAvailability = PlatformConfig::targetHasTag( $base_target, 'KNOWN' );
979
    my $buildAvailability = PlatformConfig::targetHasTag( $target, 'MACHTYPE' );
930
    if (PlatformConfig::targetHasTag( $base_target, 'GENERIC' ) )
980
    if (PlatformConfig::targetHasTag( $target, 'GENERIC' ) )
931
    {
981
    {
932
        UniquePush (\@GENERIC_TARGETS, $target );
982
        UniquePush (\@GENERIC_TARGETS, $target );
933
    }
983
    }
934
 
984
 
935
    #
985
    #
936
    #   Detect GENERIC_<machType> targets
986
    #   Detect GENERIC_<machType> targets
937
    #
987
    #
938
    if (PlatformConfig::targetHasTag( $base_target, 'GENERIC_MACHTYPE' ) )
988
    if (PlatformConfig::targetHasTag( $target, 'GENERIC_MACHTYPE' ) )
939
    {
989
    {
940
        $pInfo->{IS_GENERIC} = 1;
990
        $pInfo->{IS_GENERIC} = 1;
941
        $pInfo->{ALIAS} = 'GENERIC';
991
        $pInfo->{ALIAS} = 'GENERIC';
942
        $pInfo->{NOT_AVAILABLE} = 1 unless needToolset();
992
        $pInfo->{NOT_AVAILABLE} = 1 unless needToolset();
943
        $All = 1;
-
 
944
    }
993
    }
945
 
994
 
946
    #
995
    #
947
    #   Ensure target is known to JATS
996
    #   Ensure target is known to JATS
948
    #   Remove unknown targets from the build. Create a list of unknown
997
    #   Remove unknown targets from the build. 
949
    #   targets and report them later.
998
    #   Create a list of unknown targets and report them later.
950
    #
-
 
951
    #   If there are signs that the target has been processed, then it may be
-
 
952
    #   an alias that has not been expanded.
-
 
953
    #
999
    #
954
    #   One result will be that alias platforms, such as DEVLINUX, that don't
-
 
955
    #   expand on WIN32 will be shown as DEVLINUX and not its components.
-
 
956
    #
-
 
957
    unless ( $pInfo->{NOT_AVAILABLE} || exists $BUILDINFO{$target} || $pInfo->{IS_GENERIC} || ($base_target =~ m~^GENERIC_~) )
1000
    unless ( $pInfo->{NOT_AVAILABLE} || exists $BUILDINFO{$target} || $pInfo->{IS_GENERIC}  )
958
    {
1001
    {
-
 
1002
        my $base_target = PlatformConfig::targetHasTag( $target, 'BASE_TARGET' ) || $target;
959
        unless ( Exists( "$::GBE_CONFIG/PLATFORM", $base_target  ) )
1003
        unless ( Exists( "$::GBE_CONFIG/PLATFORM", $base_target  ) )
960
        {
1004
        {
961
            UniquePush (\@BUILD_BADNAME, $target ); 
1005
            UniquePush (\@BUILD_BADNAME, $target ); 
962
            $pInfo->{NOT_AVAILABLE} = 1;
1006
            $pInfo->{NOT_AVAILABLE} = 3;
-
 
1007
            $pInfo->{BADNAME} = 1;
963
        }
1008
        }
964
    }
1009
    }
965
 
1010
 
966
    #
1011
    #
967
    #   Mark as NOT_AVAILABLE platforms that are not available on this machine
1012
    #   Mark as NOT_AVAILABLE platforms that are not available on this machine
968
    #
1013
    #
969
    unless ($pInfo->{NOT_AVAILABLE} )
1014
    if ($buildAvailability)
970
    {
1015
    {
971
        $pInfo->{NOT_AVAILABLE} = 1
1016
         $pInfo->{MACHTYPE} = $buildAvailability;
972
            if ($buildAvailability == 0 )
1017
         $pInfo->{NOT_AVAILABLE} = 1 unless ($buildAvailability eq $::GBE_MACHTYPE)
973
    }
1018
    }
974
 
1019
 
-
 
1020
    #
-
 
1021
    #   Extend the build information
-
 
1022
    #
975
    unless ($pInfo->{NOT_AVAILABLE} )
1023
    unless ($pInfo->{NOT_AVAILABLE} )
976
    {
1024
    {
977
        my $target_cfg = $pInfo->{TARGET_CFG} || $target;
-
 
978
        if ( my $build_cfg = Require( "$::GBE_CONFIG/PLATFORM", "${target_cfg}.cfg"  ) )
1025
        if ( my $build_cfg = Require( "$::GBE_CONFIG/PLATFORM", "${target}.cfg"  ) )
979
        {
1026
        {
980
            Verbose ("Processing(add) Platform Configuration file: $build_cfg");
1027
            Verbose ("Processing(add) Platform Configuration file: $build_cfg");
981
            my $package_name = "${target_cfg}_Build";
1028
            my $package_name = "${target}_Build";
982
 
1029
 
983
            if ( $package_name->can('add_platform') )
1030
            if ( $package_name->can('add_platform') )
984
            {
1031
            {
985
                Verbose ("Processing(add) Platform Configuration: $package_name");
1032
                Verbose ("Processing(add) Platform Configuration: $package_name");
986
                $package_name->add_platform( $pInfo );
1033
                $package_name->add_platform( $pInfo );
Line 1042... Line 1089...
1042
    }
1089
    }
1043
 
1090
 
1044
    #
1091
    #
1045
    #   Add platform (tag) to various lists
1092
    #   Add platform (tag) to various lists
1046
    #
1093
    #
1047
    UniquePush( \@BUILDPLATFORMS, $platform );
1094
    UniquePush( \@BUILDPLATFORMS, $platform )    unless exists ($pInfo->{BADNAME});
1048
    UniquePush( \@DEFBUILDPLATFORMS, $platform ) unless ( $pInfo->{NOT_DEFAULT} );
1095
    UniquePush( \@DEFBUILDPLATFORMS, $platform ) unless ( $pInfo->{NOT_DEFAULT} );
1049
 
1096
 
1050
    #
1097
    #
1051
    #   Create a simple alias if requested
1098
    #   Create a simple alias if requested
1052
    #   Used if a platform creates multiple entires
1099
    #   Used if a platform creates multiple entires
Line 1062... Line 1109...
1062
        HashJoin( \%BUILDALIAS_DELAY, ' ', $_, $platform )
1109
        HashJoin( \%BUILDALIAS_DELAY, ' ', $_, $platform )
1063
            foreach ( ArrayList($pInfo->{USERALIAS}) );
1110
            foreach ( ArrayList($pInfo->{USERALIAS}) );
1064
    }
1111
    }
1065
    
1112
    
1066
    #
1113
    #
1067
    #   Create a HARDWARE type alias if requested
-
 
1068
    #   ie: SOLARIS_SPARC or SOLARIS_X86
-
 
1069
    #
-
 
1070
    if ( $pInfo->{HARDWARE} )
-
 
1071
    {
-
 
1072
        HashJoin( \%BUILDALIAS_DELAY, ' ',  $pInfo->{BASE} . '_' . $pInfo->{HARDWARE}, $platform );
-
 
1073
    }
-
 
1074
 
-
 
1075
    #
-
 
1076
    #   Create the 'parts' of the platform. This is a list of unique
1114
    #   Create the 'parts' of the platform. This is a list of unique
1077
    #   bits to search. It will consist of:
1115
    #   bits to search. It will consist of:
1078
    #       [0]     - platform
1116
    #       [0]     - platform
1079
    #       [1]     - product
1117
    #       [1]     - product
1080
    #       ...     - Uses bits ...
1118
    #       ...     - Uses bits ...
Line 1156... Line 1194...
1156
 
1194
 
1157
 
1195
 
1158
sub BuildArgument
1196
sub BuildArgument
1159
{
1197
{
1160
    my( $platform, @arguments ) = @_;
1198
    my( $platform, @arguments ) = @_;
1161
    my( @platforms );
-
 
1162
 
1199
 
1163
    Debug( "BuildArgument($platform, @arguments)" );
1200
    Debug( "BuildArgument($platform, @arguments)" );
1164
 
-
 
1165
    Error( "BuildArgument must appear before BuildName()..." )
1201
    Error( "BuildArgument must appear before BuildName()..." ) if ( $BUILDNAME ne "" );
1166
        if ( $BUILDNAME ne "" );
-
 
1167
 
1202
 
1168
    #
1203
    #
1169
    #   Allow a wildcard to apply a single argument to all platforms
1204
    #   Just save the arguments for later processing
1170
    #   Should only be used AFTER all the platforms have been specified
-
 
1171
    #
1205
    #
1172
    if ( $platform eq '*' )
1206
    push @BUILDARGUMENTS, \@_;
1173
    {
-
 
1174
        @platforms = @BUILDPLATFORMS;          # Simple Wildcard
-
 
1175
    }
-
 
1176
    else
-
 
1177
    {
-
 
1178
        @platforms = ExpandPlatforms( $platform );  # aliasing
-
 
1179
    }
1207
}
1180
 
1208
 
-
 
1209
#-------------------------------------------------------------------------------
-
 
1210
# Function        : ProcessBuildArgument  
-
 
1211
#
-
 
1212
# Description     : Process BuildArgument operations
-
 
1213
#                   This needs to be done AFTER aliases have been created (cleaned up )
-
 
1214
#
-
 
1215
# Inputs          : Global data: @BUILDARGUMENTS 
-
 
1216
#
-
 
1217
# Returns         : 
-
 
1218
#
-
 
1219
sub ProcessBuildArgument 
-
 
1220
{
1181
    foreach my $platform ( @platforms )
1221
    foreach my $set ( @BUILDARGUMENTS )
1182
    {
1222
    {
-
 
1223
        my ($platform, @arguments ) = @{$set};
-
 
1224
        my @platforms;
-
 
1225
        #
-
 
1226
        #   Allow a wildcard to apply a single argument to all platforms
-
 
1227
        #   Should only be used AFTER all the platforms have been specified
-
 
1228
        #
-
 
1229
        if ( $platform eq '*' )
-
 
1230
        {
1183
        next if ( $platform =~ /^--/ );         # argument, ignore
1231
            @platforms = @BUILDPLATFORMS;          # Simple Wildcard
-
 
1232
        }
-
 
1233
        else
-
 
1234
        {
-
 
1235
            @platforms = ExpandPlatforms( $platform );  # aliasing
-
 
1236
        }
1184
 
1237
 
-
 
1238
        foreach my $platform ( @platforms )
-
 
1239
        {
-
 
1240
            next if ( $platform =~ /^--/ );         # argument, ignore
1185
        PlatformArgument( $platform, @arguments );
1241
            PlatformArgument( $platform, @arguments );
-
 
1242
        }
1186
    }
1243
    }
1187
}
1244
}
1188
 
1245
 
1189
 
1246
 
1190
sub BuildPlatforms
1247
sub BuildPlatforms
Line 1200... Line 1257...
1200
    #
1257
    #
1201
    #   Expand the user specified platforms to allow the use of BuildAlias
1258
    #   Expand the user specified platforms to allow the use of BuildAlias
1202
    #   The (bad) side effect of this is that platform options get reorganised
1259
    #   The (bad) side effect of this is that platform options get reorganised
1203
    #       PLATFORM,--Uses=ANOTHER  ==> PLATFORM --Uses=ANOTHER
1260
    #       PLATFORM,--Uses=ANOTHER  ==> PLATFORM --Uses=ANOTHER
1204
    #
1261
    #
1205
    #   Insert markers(++) into @aruments to mark when to process collected data
1262
    #   Insert markers(++) into @arguments to mark when to process collected data
1206
    #   Insert before each PLATFORM and at the end of the list
1263
    #   Insert before each PLATFORM and at the end of the list
1207
    #   platform specifier or the end of the list. Scan the arguments
1264
    #   platform specifier or the end of the list. Scan the arguments
1208
    #
1265
    #
1209
    @arguments = ExpandPlatforms( @arguments );
1266
    @arguments = ExpandPlatforms( @arguments );
1210
    my @new_args;
1267
    my @new_args;
Line 1297... Line 1354...
1297
#                           in this version.
1354
#                           in this version.
1298
#                   Multiple BuildExclude directives are allowed
1355
#                   Multiple BuildExclude directives are allowed
1299
#                   Order or location is not important        
1356
#                   Order or location is not important        
1300
#
1357
#
1301
# Inputs          : Platforms names and options
1358
# Inputs          : Platforms names and options
1302
#                   Format:
-
 
1303
#                       --PLATFORM=xxxxx    (Marginal use)
-
 
1304
#                       --PRODUCT=yyyy      (Not very useful)
-
 
1305
#                       --TARGET=zzzz       (Default)
1359
#                       zzzz                Build Platform Name
1306
#                       zzzz                (Same as --TARGET=ZZZZ)
1360
#                       INSTRUMENT          (Keyword - no instrumented builds)
1307
#                       
1361
#                       
1308
#
1362
#
1309
# Returns         : Nothing 
1363
# Returns         : Nothing 
1310
#
1364
#
1311
sub BuildExclude
1365
sub BuildExclude
Line 1320... Line 1374...
1320
    #   Simply save the arguments for later
1374
    #   Simply save the arguments for later
1321
    #   Allow multiple specs in the one definition
1375
    #   Allow multiple specs in the one definition
1322
    #
1376
    #
1323
    foreach ( @arguments)
1377
    foreach ( @arguments)
1324
    {
1378
    {
1325
        Error ("Invalid format: $_") if m/[,\s]/;
1379
        Error ("Invalid format: $_") if m/[\s]/;
1326
        UniquePush (\@BUILDEXCLUDE, split(/\s*,\s*/,$_));
1380
        UniquePush (\@BUILDEXCLUDE, split(/\s*,\s*/,$_));
1327
    }
1381
    }
1328
}
1382
}
1329
 
1383
 
1330
#-------------------------------------------------------------------------------
1384
#-------------------------------------------------------------------------------
Line 1477... Line 1531...
1477
    Log( "DeployPatch. $DEPLOY_PATCH" ) if ($DEPLOY_PATCH);
1531
    Log( "DeployPatch. $DEPLOY_PATCH" ) if ($DEPLOY_PATCH);
1478
    Log( "Project .... $BUILDNAME_PROJECT" )if ($BUILDNAME_PROJECT);
1532
    Log( "Project .... $BUILDNAME_PROJECT" )if ($BUILDNAME_PROJECT);
1479
    Log( "Project .... ****** Specifically supressed ******" )unless ($BUILDNAME_PROJECT);
1533
    Log( "Project .... ****** Specifically supressed ******" )unless ($BUILDNAME_PROJECT);
1480
    Log( "DateTime ... $::CurrentTime" );
1534
    Log( "DateTime ... $::CurrentTime" );
1481
    Log( "AutoBuild... Enabled:$::GBE_ABT" ) if defined($::GBE_ABT) ;
1535
    Log( "AutoBuild... Enabled:$::GBE_ABT" ) if defined($::GBE_ABT) ;
1482
    Log( "Build dir... $Cwd" ) if defined($::GBE_ABT) || $::GBE_DPKG_SBOX;
1536
    Log( "Build dir... $CwdFull" ) if defined($::GBE_ABT) || $::GBE_DPKG_SBOX;
1483
    Log( "Build Mach.. $::GBE_HOSTNAME" ) if defined($::GBE_ABT);
1537
    Log( "Build Mach.. $::GBE_HOSTNAME" ) if defined($::GBE_ABT);
-
 
1538
    Log( "Build Cmd .. $CmdSwitch") if $CmdSwitch;
1484
 
1539
 
1485
    Log( "PERL ....... $::GBE_PERL" );
1540
    Log( "PERL ....... $::GBE_PERL" );
1486
    Log( "BIN  ....... $::GBE_BIN" );
1541
    Log( "BIN  ....... $::GBE_BIN" );
1487
    Log( "TOOLS ...... $::GBE_TOOLS" );
1542
    Log( "TOOLS ...... $::GBE_TOOLS" );
1488
    Log( "CONFIG ..... $::GBE_CONFIG" );
1543
    Log( "CONFIG ..... $::GBE_CONFIG" );
Line 1493... Line 1548...
1493
    Log( "BUILDFILTER. " . PrintList([split(' ', $::GBE_BUILDFILTER)], $sep) ) if defined ($::GBE_BUILDFILTER);
1548
    Log( "BUILDFILTER. " . PrintList([split(' ', $::GBE_BUILDFILTER)], $sep) ) if defined ($::GBE_BUILDFILTER);
1494
 
1549
 
1495
    Log( "DPKG_STORE.. $::GBE_DPKG_STORE" );
1550
    Log( "DPKG_STORE.. $::GBE_DPKG_STORE" );
1496
    Log( "DPKG ....... $::GBE_DPKG" );
1551
    Log( "DPKG ....... $::GBE_DPKG" );
1497
    Log( "DPKG_REPLI . $::GBE_DPKG_REPLICA" );
1552
    Log( "DPKG_REPLI . $::GBE_DPKG_REPLICA" );
-
 
1553
    Log( "DPKG_ESCROW. $::GBE_DPKG_ESCROW" ) if $::GBE_DPKG_ESCROW;
1498
    Log( "DPKG_CACHE . $::GBE_DPKG_CACHE" );
1554
    Log( "DPKG_CACHE . $::GBE_DPKG_CACHE" );
1499
    Log( "DPKG_LOCAL . $::GBE_DPKG_LOCAL" );
1555
    Log( "DPKG_LOCAL . $::GBE_DPKG_LOCAL" );
1500
    Log( "DPKG_SBOX .. $::GBE_DPKG_SBOX" );
1556
    Log( "DPKG_SBOX .. $::GBE_DPKG_SBOX" );
1501
    Log( "Sandbox .... " . ($sandbox_exact ? "Exact" : "Development") );
1557
    Log( "Sandbox .... " . ($sandbox_exact ? "Exact" : "Development") );
1502
    Log( "LocalFilter. $::GBE_DPKG_SBOX/buildfilter") if ( $::GBE_DPKG_SBOX && -f $::GBE_DPKG_SBOX . '/buildfilter' );
1558
    Log( "LocalFilter. $::GBE_DPKG_SBOX/buildfilter") if ( $::GBE_DPKG_SBOX && -f $::GBE_DPKG_SBOX . '/buildfilter' );
1503
 
1559
 
1504
    #
1560
    #
1505
    #   Generate a list of platforms that are completely unknown to JATS
-
 
1506
    #   May be the result of a user typo or a guess
-
 
1507
    #
-
 
1508
    if ( @BUILD_BADNAME )
-
 
1509
    {
-
 
1510
        Log( "Unknown Pl . " . PrintPlatforms(\@BUILD_BADNAME, $sep) );
-
 
1511
        Warning ("The following platform names are not known to JATS", "@BUILD_BADNAME");
-
 
1512
    }
-
 
1513
 
-
 
1514
    #
-
 
1515
    #   Detect multiple GENERIC targets
-
 
1516
    #       Only one such target can be processed on any one machine
-
 
1517
    #
-
 
1518
    if ($#GENERIC_TARGETS > 0)
-
 
1519
    {
-
 
1520
        Error ("Multiple GENERIC targets detected", PrintPlatforms(\@GENERIC_TARGETS, $sep));
-
 
1521
    }
-
 
1522
    if ($#GENERIC_TARGETS >= 0 )
-
 
1523
    {
-
 
1524
        $All = 1;
-
 
1525
    }
-
 
1526
 
-
 
1527
    #
-
 
1528
    #   Generate a list of active platforms
1561
    #   Generate a list of active platforms
1529
    #   Ensure that there are some active platforms
1562
    #   Ensure that there are some active platforms
1530
    #
1563
    #
-
 
1564
    ProcessBuildExclude();
1531
    GeneratePlatformList();
1565
    GeneratePlatformList();
1532
    Log( "Platforms .. " . PrintPlatforms(\@BUILDPLATFORMS, $sep) );
1566
    Log( "Platforms .. " . PrintPlatforms(\@BUILDPLATFORMS, $sep) );
1533
 
1567
 
1534
    #
1568
    #
1535
    #   Detect a mix of Generic and non Generic targets
1569
    #   Detect a mix of Generic and non Generic targets
Line 1573... Line 1607...
1573
            #   Flag for jmake to do very little
1607
            #   Flag for jmake to do very little
1574
            #
1608
            #
1575
            CreateBuildPlatformEntry('Internal', 0, undef, 'NOBUILD');
1609
            CreateBuildPlatformEntry('Internal', 0, undef, 'NOBUILD');
1576
            $IgnorePkgs = 1;
1610
            $IgnorePkgs = 1;
1577
            $NoBuild = 1;
1611
            $NoBuild = 1;
-
 
1612
            $genToolsetActive = 0;
1578
            Log( "Build for .. ". PrintPlatforms(['NOBUILD - ' . $msg], $sep));
1613
            Log( "Build for .. ". PrintPlatforms(['NOBUILD - ' . $msg], $sep));
1579
 
1614
 
1580
        } else {
1615
        } else {
1581
            Error( $msg );
1616
            Error( $msg );
1582
        }
1617
        }
Line 1619... Line 1654...
1619
            Log( "Make for ... ". PrintPlatforms(\@MAKE_PLATFORMS, $sep));
1654
            Log( "Make for ... ". PrintPlatforms(\@MAKE_PLATFORMS, $sep));
1620
        }
1655
        }
1621
 
1656
 
1622
    }
1657
    }
1623
 
1658
 
-
 
1659
    #
-
 
1660
    #   NoBuilds do not generate warnings
-
 
1661
    #
-
 
1662
    return if $NoBuild;
-
 
1663
 
-
 
1664
    #
-
 
1665
    #   Generate a list of platforms that are completely unknown to JATS
-
 
1666
    #   May be the result of a user typo or a guess
-
 
1667
    #
-
 
1668
    if ( @BUILD_BADNAME )
-
 
1669
    {
-
 
1670
        Log( "Unknown Pl . " . PrintPlatforms(\@BUILD_BADNAME, $sep) );
-
 
1671
        Error ("The following platform names are not known to JATS", "@BUILD_BADNAME");
-
 
1672
    }
-
 
1673
 
-
 
1674
    #
-
 
1675
    #   Detect multiple GENERIC targets
-
 
1676
    #       Only one such target can be processed on any one machine
-
 
1677
    #
-
 
1678
    if ($#GENERIC_TARGETS > 0)
-
 
1679
    {
-
 
1680
        Error ("Multiple GENERIC targets detected", PrintPlatforms(\@GENERIC_TARGETS, $sep));
-
 
1681
    }
-
 
1682
 
1624
    return 1;
1683
    return 1;
1625
}
1684
}
1626
 
1685
 
1627
#-------------------------------------------------------------------------------
1686
#-------------------------------------------------------------------------------
1628
# Function        : needToolset 
1687
# Function        : needToolset 
Line 1959... Line 2018...
1959
 
2018
 
1960
    #
2019
    #
1961
    #   Locate the package ONCE
2020
    #   Locate the package ONCE
1962
    #
2021
    #
1963
    Log( "LinkPkgArchive .. $name ($version)" );
2022
    Log( "LinkPkgArchive .. $name ($version)" );
1964
    my ($pkg, $local ) = PackageLocate( $name, $version );
2023
    my ($pkg, $local, $pkgSig ) = PackageLocate( $name, $version );
1965
    if ( $pkg )
2024
    if ( $pkg )
1966
    {
2025
    {
1967
        #
2026
        #
-
 
2027
        #   Create a Package Entry
-
 
2028
        #
-
 
2029
        my $entry = PackageEntry::New( $pkg, $name, $version, 'link', $local, $pkgSig );
-
 
2030
 
-
 
2031
        #
1968
        #   Generate package rules for each active platform
2032
        #   Generate package rules for each active platform
1969
        #
2033
        #
1970
        IncludePkg ( $name, $pkg );
2034
        IncludePkg ( $name, $pkg );
1971
        foreach my $platform ( @BUILD_ACTIVEPLATFORMS, '--' )
2035
        foreach my $platform ( @BUILD_ACTIVEPLATFORMS ) {
1972
        {
-
 
1973
            LinkEntry( $platform, $pkg, $name, $version, 0, $local );
2036
            LinkEntry( $platform, $entry );
1974
        }
2037
        }
1975
    }
2038
    }
1976
}
2039
}
1977
 
2040
 
1978
#-------------------------------------------------------------------------------
2041
#-------------------------------------------------------------------------------
Line 1985... Line 2048...
1985
# Inputs          : package name
2048
# Inputs          : package name
1986
#                   package version
2049
#                   package version
1987
#
2050
#
1988
# Returns         : path to the package
2051
# Returns         : path to the package
1989
#                   local       1 - From local package repository
2052
#                   local       1 - From local package repository
-
 
2053
#                   Package Signature
1990
#
2054
#
1991
sub PackageLocate
2055
sub PackageLocate
1992
{
2056
{
1993
    my ($name, $uversion ) = @_;
2057
    my ($name, $uversion ) = @_;
1994
    my $pkg;
2058
    my $pkg;
Line 2006... Line 2070...
2006
                       '--NotSandbox',
2070
                       '--NotSandbox',
2007
                       split( $::ScmPathSep, $::GBE_DPKG_LOCAL),
2071
                       split( $::ScmPathSep, $::GBE_DPKG_LOCAL),
2008
                       '--NotLocal',
2072
                       '--NotLocal',
2009
                       split( $::ScmPathSep, $::GBE_DPKG_CACHE),
2073
                       split( $::ScmPathSep, $::GBE_DPKG_CACHE),
2010
                       '--NotCache',
2074
                       '--NotCache',
-
 
2075
                       split( $::ScmPathSep, $::GBE_DPKG_ESCROW),
-
 
2076
                       '--NotEscrow',
2011
                       split( $::ScmPathSep, $::GBE_DPKG_REPLICA),
2077
                       split( $::ScmPathSep, $::GBE_DPKG_REPLICA),
2012
                       split( $::ScmPathSep, $::GBE_DPKG),
2078
                       split( $::ScmPathSep, $::GBE_DPKG),
2013
                       split( $::ScmPathSep, $::GBE_DPLY),
2079
                       split( $::ScmPathSep, $::GBE_DPLY),
2014
                       split( $::ScmPathSep, $::GBE_DPKG_STORE) )
2080
                       split( $::ScmPathSep, $::GBE_DPKG_STORE) )
2015
    {
2081
    {
Line 2033... Line 2099...
2033
        if ( $dpkg eq '--NotCache' )
2099
        if ( $dpkg eq '--NotCache' )
2034
        {
2100
        {
2035
            $isa_cache = 0;
2101
            $isa_cache = 0;
2036
            next;
2102
            next;
2037
        }
2103
        }
-
 
2104
        if ( $dpkg eq '--NotEscrow' )
-
 
2105
        {
-
 
2106
            last if ($::GBE_DPKG_ESCROW);
-
 
2107
            next;
-
 
2108
        }
-
 
2109
 
2038
        
2110
        
2039
        #
2111
        #
2040
        #   If we are playing in a sandbox, then the version number is
2112
        #   If we are playing in a sandbox, then the version number is
2041
        #   not used. The Package suffix is still used so that we can
2113
        #   not used. The Package suffix is still used so that we can
2042
        #   differentiate sysbasetypes.xxxxx.mas and sysbasetypes.xxxxx.syd
2114
        #   differentiate sysbasetypes.xxxxx.mas and sysbasetypes.xxxxx.syd
Line 2138... Line 2210...
2138
#-------------------------------------------------------------------------------
2210
#-------------------------------------------------------------------------------
2139
# Function        : LinkEntry
2211
# Function        : LinkEntry
2140
#
2212
#
2141
# Description     : Scan a package an locate platform specific directories
2213
# Description     : Scan a package an locate platform specific directories
2142
#                   Create data structures to capture the information
2214
#                   Create data structures to capture the information
2143
#                   This function is used by LinkPkgArchive and LinkSandbox
2215
#                   This function is used by LinkPkgArchive
2144
#                   to perfom the bulk of package inclusion work.
2216
#                   to perfom the bulk of package inclusion work.
2145
#
2217
#
2146
# Inputs          : platform being processed
2218
# Inputs          : $platform   - Platform being processed
2147
#                   path to the package
-
 
2148
#                   name of the package
-
 
2149
#                   version of the package
2219
#                   $entry      - Reference to a PackageEntry
2150
#                   sandbox support (non-zero)
-
 
2151
#                   local package
-
 
2152
#
2220
#
2153
sub LinkEntry
2221
sub LinkEntry
2154
{
2222
{
2155
    my( $platform, $pkg, $name, $version, $sandbox, $local ) = @_;
2223
    my( $platform, $base_entry ) = @_;
2156
    my( $entry );
-
 
2157
 
2224
 
2158
    #   Create entry record
-
 
2159
    #
2225
    #
-
 
2226
    #   Clone the entry - we will add platform specific data into it
2160
    #..
2227
    #
2161
    $entry = PackageEntry::New( $pkg, $name, $version, $sandbox, 'link', $local );
2228
    my $entry = dclone($base_entry);
-
 
2229
 
2162
 
2230
 
2163
    #   Populate includes:
2231
    #   Populate includes:
2164
    #
2232
    #
2165
    #   - include/$platform                 (eg include/solaris)
2233
    #   - include/$platform                 (eg include/solaris)
2166
    #   - inc/$platform                     (eg inc/solaris)
2234
    #   - inc/$platform                     (eg inc/solaris)
Line 2179... Line 2247...
2179
    #..
2247
    #..
2180
    my $parts = $BUILDINFO{$platform}{PARTS};
2248
    my $parts = $BUILDINFO{$platform}{PARTS};
2181
 
2249
 
2182
    foreach my $part ( @$parts )
2250
    foreach my $part ( @$parts )
2183
    {
2251
    {
2184
        $entry->RuleInc( "/include." . $part ) if ( !$sandbox );
2252
        $entry->RuleInc( "/include." . $part );
2185
        $entry->RuleInc( "/inc." . $part )     if ( !$sandbox );
2253
        $entry->RuleInc( "/inc." . $part );
2186
        $entry->RuleInc( "/include/" . $part ) if ( !$sandbox );
2254
        $entry->RuleInc( "/include/" . $part );
2187
        $entry->RuleInc( "/inc/" . $part );
2255
        $entry->RuleInc( "/inc/" . $part );
2188
    }
2256
    }
2189
 
2257
 
2190
    #
2258
    #
2191
    #   Also search the root include directory - last
2259
    #   Also search the root include directory - last
2192
    #
2260
    #
2193
    $entry->RuleInc( "/include" )               if ( !$sandbox );
2261
    $entry->RuleInc( "/include" );
2194
    $entry->RuleInc( "/inc" );
2262
    $entry->RuleInc( "/inc" );
2195
 
2263
 
2196
    #   Populate libraries:
2264
    #   Populate libraries:
2197
    #
2265
    #
2198
    #   - lib/lib.$platform[D|P]            (eg lib/lib.sparcD)
2266
    #   - lib/lib.$platform[D|P]            (eg lib/lib.sparcD)
Line 2209... Line 2277...
2209
    #..
2277
    #..
2210
    $parts = $BUILDINFO{$platform}{PARTS};
2278
    $parts = $BUILDINFO{$platform}{PARTS};
2211
 
2279
 
2212
    foreach my $part ( @$parts )
2280
    foreach my $part ( @$parts )
2213
    {
2281
    {
2214
        $entry->RuleLib("/lib" . ".$part" )     if ( !$sandbox );
2282
        $entry->RuleLib("/lib" . ".$part" );
2215
        $entry->RuleLib("/lib" . "/lib.$part" ) if ( !$sandbox );
2283
        $entry->RuleLib("/lib" . "/lib.$part" );
2216
        $entry->RuleLib("/lib" . "/$part" );
2284
        $entry->RuleLib("/lib" . "/$part" );
2217
    }
2285
    }
2218
 
2286
 
2219
    #
2287
    #
2220
    #   Some extra places to search
2288
    #   Some extra places to search
Line 2292... Line 2360...
2292
    #
2360
    #
2293
    #   Locate the package
2361
    #   Locate the package
2294
    #   Use the first instance of the package that is found
2362
    #   Use the first instance of the package that is found
2295
    #
2363
    #
2296
    Log( "BuildPkgArchive . $name ($version)" );
2364
    Log( "BuildPkgArchive . $name ($version)" );
2297
    my ( $pkg, $local ) = PackageLocate( $name, $version );
2365
    my ( $pkg, $local, $pkgSig ) = PackageLocate( $name, $version );
2298
    if ( $pkg )
2366
    if ( $pkg )
2299
    {
2367
    {
2300
        #
2368
        #
2301
        #   Create a Package Entry
2369
        #   Create a Package Entry
2302
        #
2370
        #
2303
        my $entry = PackageEntry::New( $pkg, $name, $version, 0, 'build', $local );
2371
        my $entry = PackageEntry::New( $pkg, $name, $version, 'build', $local, $pkgSig );
2304
 
2372
 
2305
        #
2373
        #
2306
        #   Determine if the package needs to be installed:
2374
        #   Determine if the package needs to be installed:
2307
        #       If the package is a 'local' package then force transfer
2375
        #       If the package is a 'local' package then force transfer
2308
        #       If the user has specified --cache then force transfer
2376
        #       If the user has specified --cache then force transfer
2309
        #       If package is newer that copy, then force transfer
2377
        #       If package is newer that copy, then force transfer
2310
        #       If copy does not exist, then force a transfer
2378
        #       If copy does not exist, then force a transfer
2311
        #
2379
        #
2312
        my $tag_dir = "$Cwd/$BUILDINTERFACE/BuildTags";
2380
        my $tag_dir = "$CwdFull/$BUILDINTERFACE/BuildTags";
2313
        my $tag_file = "$tag_dir/${name}_${version}.tag";
2381
        my $tag_file = "$tag_dir/${name}_${version}.tag";
2314
        my $arglist = GenerateInstallArgumentList();
2382
        my $arglist = GenerateInstallArgumentList();
2315
 
2383
 
2316
        my $package_installed;
2384
        my $package_installed;
2317
        $package_installed = 1
2385
        $package_installed = 1
Line 2347... Line 2415...
2347
                #
2415
                #
2348
                #   Determine all the Platforms, Products and Targets
2416
                #   Determine all the Platforms, Products and Targets
2349
                #   that need to be installed
2417
                #   that need to be installed
2350
                #
2418
                #
2351
                
2419
                
2352
                System( "cd $pkg; $::GBE_PERL $::GBE_TOOLS/installpkg.pl $Cwd/$BUILDINTERFACE $Cwd @opts $arglist");
2420
                System( "cd $pkg; $::GBE_PERL $::GBE_TOOLS/installpkg.pl $CwdFull/$BUILDINTERFACE $CwdFull @opts $arglist");
2353
                Error( "Package installation error" ) if ( $? != 0 );
2421
                Error( "Package installation error" ) if ( $? != 0 );
2354
            }
2422
            }
2355
            else
2423
            else
2356
            {
2424
            {
2357
                Error ("Unknown package format for package $name/$version found in $pkg");
2425
                Error ("Unknown package format for package $name/$version found in $pkg");
Line 2397... Line 2465...
2397
#
2465
#
2398
sub CreateInterfacePackage
2466
sub CreateInterfacePackage
2399
{
2467
{
2400
    foreach my $platform ( @BUILD_ACTIVEPLATFORMS )
2468
    foreach my $platform ( @BUILD_ACTIVEPLATFORMS )
2401
    {
2469
    {
2402
        my $entry = PackageEntry::Interface( "$::Cwd/$BUILDINTERFACE" );
2470
        my $entry = PackageEntry::Interface( "$CwdFull/$BUILDINTERFACE" );
2403
 
2471
 
2404
        #
2472
        #
2405
        #   Locate include and lib bits within the interface
2473
        #   Locate include and lib bits within the interface
2406
        #   This is much simpler than for a LinkPkgArchive as the form
2474
        #   This is much simpler than for a LinkPkgArchive as the form
2407
        #   has been sanitized
2475
        #   has been sanitized
Line 2511... Line 2579...
2511
# Inputs          : GBE_BUILDFILTER from the environment
2579
# Inputs          : GBE_BUILDFILTER from the environment
2512
#
2580
#
2513
# Returns         : An array of platforms to include in the build
2581
# Returns         : An array of platforms to include in the build
2514
#                   Maintains @BUILD_ACTIVEPLATFORMS  - the last calculated result
2582
#                   Maintains @BUILD_ACTIVEPLATFORMS  - the last calculated result
2515
#                   Ensures that @DEFBUILDPLATFORMS is a subset of @BUILD_ACTIVEPLATFORMS
2583
#                   Ensures that @DEFBUILDPLATFORMS is a subset of @BUILD_ACTIVEPLATFORMS
-
 
2584
#                   Rebuilds BUILDPLATFORMS to ensure that excluded platforms are not present
2516
#
2585
#
2517
sub GeneratePlatformList
2586
sub GeneratePlatformList
2518
{
2587
{
2519
    #
2588
    #
2520
    #   Return the cached result for speed
2589
    #   Return the cached result for speed
Line 2523... Line 2592...
2523
    unless ( @BUILD_ACTIVEPLATFORMS )
2592
    unless ( @BUILD_ACTIVEPLATFORMS )
2524
    {
2593
    {
2525
        my ($platform_filter);
2594
        my ($platform_filter);
2526
        my %result;
2595
        my %result;
2527
        my %part_to_platform;
2596
        my %part_to_platform;
-
 
2597
        my @New_BUILDPLATFORMS = ();
2528
 
2598
 
2529
        #
2599
        #
2530
        #   Create a data structure to assist in the production of the platform list
2600
        #   Create a data structure to assist in the production of the platform list
2531
        #   The structure will be a hash of hashes of arrays
2601
        #   The structure will be a hash of hashes of arrays
2532
        #
2602
        #
Line 2537... Line 2607...
2537
        for my $platform (keys (%::BUILDINFO))
2607
        for my $platform (keys (%::BUILDINFO))
2538
        {
2608
        {
2539
            my $pParts = $::BUILDINFO{$platform};
2609
            my $pParts = $::BUILDINFO{$platform};
2540
 
2610
 
2541
            #
2611
            #
-
 
2612
            #   Include into New_BUILDPLATFORMS 
-
 
2613
            #
-
 
2614
            if ($pParts->{NOT_AVAILABLE} <= 1) {
-
 
2615
                push @New_BUILDPLATFORMS, $platform;
-
 
2616
            }
-
 
2617
 
-
 
2618
            #
2542
            #   Skip platforms that are known to be unavailable on this build
2619
            #   Skip platforms that are known to be unavailable on this build
2543
            #   machine. Self configure
2620
            #   machine. Self configure
2544
            #
2621
            #
2545
            next if ( $pParts->{NOT_AVAILABLE} );
2622
            next if ( $pParts->{NOT_AVAILABLE} );
2546
 
2623
 
Line 2563... Line 2640...
2563
            $platform_filter = "";
2640
            $platform_filter = "";
2564
        }
2641
        }
2565
        else
2642
        else
2566
        {
2643
        {
2567
            $platform_filter = "";
2644
            $platform_filter = "";
2568
            $platform_filter = $::GBE_BUILDFILTER
2645
            $platform_filter = uc $::GBE_BUILDFILTER
2569
                if ( defined($::GBE_BUILDFILTER) );
2646
                if ( defined($::GBE_BUILDFILTER) );
2570
        }
2647
        }
2571
        Debug( "GeneratePlatformList: Filter:$platform_filter" );
2648
        Debug( "GeneratePlatformList: Filter:$platform_filter" );
2572
 
2649
 
2573
        #
2650
        #
Line 2582... Line 2659...
2582
        {
2659
        {
2583
            %result = %{$part_to_platform{'PLATFORM'}}
2660
            %result = %{$part_to_platform{'PLATFORM'}}
2584
                if exists $part_to_platform{'PLATFORM'} ;
2661
                if exists $part_to_platform{'PLATFORM'} ;
2585
        }
2662
        }
2586
 
2663
 
-
 
2664
        #
-
 
2665
        # Add GENERIC platforms to the platform filter, if available
-
 
2666
        #
-
 
2667
        if (exists $part_to_platform{'PLATFORM'})
-
 
2668
        {
-
 
2669
            foreach my $platform( 'GENERIC', 'GENERIC_' . uc($::GBE_MACHTYPE) )
-
 
2670
            {
-
 
2671
                $result{$platform} = 1 if (exists $part_to_platform{'PLATFORM'}{$platform}) 
-
 
2672
            }
-
 
2673
        }
-
 
2674
 
2587
#DebugDumpData( "PartToPlatform", \%part_to_platform );
2675
#DebugDumpData( "PartToPlatform", \%part_to_platform );
-
 
2676
#DebugDumpData("Result", \%result);
2588
 
2677
 
2589
        #
2678
        #
2590
        #   Process each element in the user filter list
2679
        #   Process each element in the user filter list
2591
        #   Expand platforms into known aliases
2680
        #   Expand platforms into known aliases
2592
        #
2681
        #
Line 2636... Line 2725...
2636
                print "GBE_BUILDFILTER filter term not understood: $word\n";
2725
                print "GBE_BUILDFILTER filter term not understood: $word\n";
2637
            }
2726
            }
2638
        }
2727
        }
2639
 
2728
 
2640
        #
2729
        #
2641
        #   Process BuildExclude
-
 
2642
        #   A list of targets to be excluded
-
 
2643
        #       INSTRUMENT is a key word
-
 
2644
        #
-
 
2645
        for my $word (@BUILDEXCLUDE)
-
 
2646
        {
-
 
2647
            my $platform;
-
 
2648
 
-
 
2649
            Error('BuildExclude: Unknown option: ' . $word) if ($word =~ m~^-~);
-
 
2650
            Error('BuildExclude: Invalid format: ' . $word) if ($word =~ m~^!~);
-
 
2651
 
-
 
2652
            #
-
 
2653
            #   INSTRUMENT is a key word
-
 
2654
            #       Remove all instrumented builds
-
 
2655
            #
-
 
2656
            if ($word eq 'INSTRUMENT')
-
 
2657
            {
-
 
2658
                for ( keys %result) {
-
 
2659
                    if ( PlatformConfig::targetHasTag( $_, 'INSTRUMENT') ) {
-
 
2660
                        delete $result{$_} ;
-
 
2661
                    }
-
 
2662
                }
-
 
2663
            }
-
 
2664
            else
-
 
2665
            {
-
 
2666
                #
-
 
2667
                #   Remove items from the result
-
 
2668
                #
-
 
2669
                my $table = "PLATFORM";
-
 
2670
                my $plist = $part_to_platform{$table}{$word};
-
 
2671
                if ($plist) {
-
 
2672
                    for ( @{$plist}) {
-
 
2673
                        delete $result{$_};
-
 
2674
                    }
-
 
2675
                }
-
 
2676
                else  {
-
 
2677
                    Warning('BuildExclude: Unknown target:' . $word ) 
-
 
2678
                        unless exists $::BUILDINFO{$word};
-
 
2679
                }
-
 
2680
            }
-
 
2681
        }
-
 
2682
 
-
 
2683
        #
-
 
2684
        #   Return an array of platforms to process
2730
        #   Return an array of platforms to process
2685
        #
2731
        #
2686
        @BUILD_ACTIVEPLATFORMS = sort keys %result;
2732
        @BUILD_ACTIVEPLATFORMS = sort keys %result;
2687
 
2733
 
2688
        #
2734
        #
Line 2693... Line 2739...
2693
        {
2739
        {
2694
            push @NEW_DEFBUILDPLATFORMS, $_
2740
            push @NEW_DEFBUILDPLATFORMS, $_
2695
                if ( exists $result{$_} );
2741
                if ( exists $result{$_} );
2696
        }
2742
        }
2697
        @DEFBUILDPLATFORMS = @NEW_DEFBUILDPLATFORMS;
2743
        @DEFBUILDPLATFORMS = @NEW_DEFBUILDPLATFORMS;
-
 
2744
 
-
 
2745
        #
-
 
2746
        #   Update BUILDPLATFORMS
-
 
2747
        #
-
 
2748
        @BUILDPLATFORMS = @New_BUILDPLATFORMS;
2698
    }
2749
    }
2699
 
2750
 
2700
    Debug("GeneratePlatformList: Result:@BUILD_ACTIVEPLATFORMS");
2751
    Debug("GeneratePlatformList: Result:@BUILD_ACTIVEPLATFORMS");
2701
    return @BUILD_ACTIVEPLATFORMS;
2752
    return @BUILD_ACTIVEPLATFORMS;
2702
}
2753
}
2703
 
2754
 
2704
#-------------------------------------------------------------------------------
2755
#-------------------------------------------------------------------------------
2705
# Function        : PrintPlatforms
2756
# Function        : PrintPlatforms
2706
#
2757
#
2707
# Description     : Petty print the specified platform list, breaking line
2758
# Description     : Petty print the specified platform list, breaking line
2708
#                   on either a primary key change or length width >78.
2759
#                   on either a primary key change or length width >100.
2709
#
2760
#
-
 
2761
# Inputs          : $list           - Reference to an array
-
 
2762
#                   $nl             - New line stuff.
-
 
2763
#                                     Use to prefix new lines
-
 
2764
#
2710
# Returns         : Formated string
2765
# Returns         : Formatted string
2711
#
2766
#
2712
# Example Output :
2767
# Example Output :
2713
#
2768
#
2714
#           DDU_LMOS_WIN32 DDU_LMOS_linux_armv4 DDU_LMOS_linux_i386
2769
#           DDU_LMOS_WIN32 DDU_LMOS_linux_armv4 DDU_LMOS_linux_i386
2715
#           IDFC_LMOS_WIN32 IDFC_LMOS_linux_armv4 IDFC_LMOS_linux_i386
2770
#           IDFC_LMOS_WIN32 IDFC_LMOS_linux_armv4 IDFC_LMOS_linux_i386
Line 2717... Line 2772...
2717
#           LMOS_linux_i386
2772
#           LMOS_linux_i386
2718
#..
2773
#..
2719
sub PrintPlatforms
2774
sub PrintPlatforms
2720
{
2775
{
2721
    my ($platforms, $nl) = @_;
2776
    my ($platforms, $nl) = @_;
2722
    my ($string) = "";                          # result
2777
    my ($string) = "";
-
 
2778
    my $maxLen = 100 - length($nl);
2723
 
2779
 
2724
    if ( @$platforms )
2780
    if ( @$platforms )
2725
    {
2781
    {
2726
        my ($key_run) = 0;
2782
        my $line = "";
2727
        my ($pkey);                             # previous key
-
 
2728
 
-
 
2729
        #   Perform a simple formatting and determine if there is key 
-
 
2730
        #   change greater then 1 or whether the total length exceeds 78.
-
 
2731
        #
2783
        my $pel = "";
2732
        #   If the line exceeds 78, the printer shall then reformat 
-
 
2733
        #   breaking based on line length and possiblity keys.
-
 
2734
        #
2784
        my $first = 1;
2735
        $pkey = "";
2785
        my $prefix = '';
2736
        for my $k (sort @$platforms) 
2786
        foreach my $k ( sort @$platforms)
2737
        {
2787
        {
2738
            my ($d);                            # delimitor
2788
            my $k2 = substr($k, 0 , 2);
2739
 
-
 
2740
            if (($d = index( $k, '_' )) != index( $pkey, '_' ) ||
-
 
2741
                    substr( $k, 0, $d ) ne substr( $pkey, 0, $d )) {
2789
            if (( $k2 ne $pel  || (length($line) + length ($k) > $maxLen) ) && (!$first)) {
2742
                $key_run = 1
2790
                $string .= $line;
2743
                    if ($key_run <= 1);         # change, reset run if <= 1
-
 
2744
            } else {
2791
                $line = $nl;
2745
                $key_run++;                     # same primary key
2792
                $prefix = '';
2746
            }
2793
            }
2747
 
-
 
2748
            $string .= " " if ($pkey);
2794
            $line .= $prefix . $k;
-
 
2795
            $pel = $k2;
2749
            $string .= $k;
2796
            $first = 0;
2750
            $pkey = $k;
2797
            $prefix = ' ';
2751
        }
2798
        }
2752
 
-
 
2753
        #   Reprint if required.
-
 
2754
        #
-
 
2755
        if (length($nl)+length($string) > 78)
-
 
2756
        {
-
 
2757
            my ($llen);                         # line length
-
 
2758
 
-
 
2759
            $llen = length($nl);
-
 
2760
 
-
 
2761
            $pkey = "";
-
 
2762
            $string = "";
2799
        $string .= $line;
2763
 
-
 
2764
            for my $k (sort @$platforms)
-
 
2765
            {
-
 
2766
                my ($klen, $d);                 # key length, delimitor
-
 
2767
 
-
 
2768
                $klen = length($k);
-
 
2769
                if ($pkey ne "")
-
 
2770
                {
-
 
2771
                    if ($llen + $klen > 78 ||
-
 
2772
                        ($key_run > 1 && (
-
 
2773
                            ($d = index( $k, '_' )) != index( $pkey, '_' ) ||
-
 
2774
                            substr( $k, 0, $d ) ne substr( $pkey, 0, $d ) )) )
-
 
2775
                    {                           # line >70 or key change
-
 
2776
                        $string .= $nl;
-
 
2777
                        $llen = length($nl);
-
 
2778
                    }
-
 
2779
                    else
-
 
2780
                    {
-
 
2781
                        $string .= " ";
-
 
2782
                        $llen++;
-
 
2783
                    }
-
 
2784
                }
-
 
2785
                $string .= $k;
-
 
2786
                $pkey = $k;
-
 
2787
                $llen += $klen;
-
 
2788
            }
-
 
2789
        }    
-
 
2790
    }
2800
    }
2791
    return $string;
2801
    return $string;
2792
}
2802
}
2793
#-------------------------------------------------------------------------------
2803
#-------------------------------------------------------------------------------
2794
# Function        : PrintList
2804
# Function        : PrintList
Line 2802... Line 2812...
2802
#
2812
#
2803
# Returns         : string
2813
# Returns         : string
2804
#
2814
#
2805
sub PrintList
2815
sub PrintList
2806
{
2816
{
2807
    my ($list, $nl) = @_;
2817
    my ($platforms, $nl) = @_;
2808
    my ($string) = '';                          # result
2818
    my ($string) = "";
2809
    my $sep;
2819
    my $maxLen = 100 - length($nl);
2810
 
2820
 
2811
    if ( @$list )
2821
    if ( @$platforms )
2812
    {
2822
    {
2813
        my ($llen) = length($nl);
2823
        my $line = "";
2814
 
-
 
2815
        for my $k (@$list)
2824
        my $first = 1;
2816
        {
-
 
2817
            my $klen = length($k);
2825
        my $prefix = '';
2818
            if ($llen + $klen > 78 )
2826
        foreach my $k ( sort @$platforms)
2819
            {
2827
        {
2820
                $string .= $nl;
-
 
2821
                $llen = length($nl);
2828
            if ((length($line) + length ($k) > $maxLen) && (!$first)) {
2822
            }
-
 
2823
            else
-
 
2824
            {
-
 
2825
                if ( $sep )
-
 
2826
                {
-
 
2827
                    $string .= $sep;
2829
                $string .= $line;
2828
                    $llen++;
2830
                $line = $nl;
2829
                }
-
 
2830
                else
2831
                $prefix = '';
2831
                {
2832
            }
2832
                    $sep = ' ';
2833
            $line .= $prefix . $k;
2833
                }
-
 
2834
            }
-
 
2835
            $string .= $k;
2834
            $first = 0;
2836
            $llen += $klen;
2835
            $prefix = ' ';
2837
        }
2836
        }
-
 
2837
        $string .= $line;
2838
    }
2838
    }
2839
    return $string;
2839
    return $string;
2840
}
2840
}
2841
 
2841
 
2842
#-------------------------------------------------------------------------------
2842
#-------------------------------------------------------------------------------
Line 3148... Line 3148...
3148
    Process_TargetAlias();
3148
    Process_TargetAlias();
3149
 
3149
 
3150
    #
3150
    #
3151
    #   Calculate defined aliases
3151
    #   Calculate defined aliases
3152
    #       Limit the Aliases to active platforms
3152
    #       Limit the Aliases to active platforms
3153
    #       Another LMOS kudge. LMOS targets pick up alias from their base target
-
 
3154
    #       ie: NATIVE INSTRUMENT PKG_WIN PKG_RPM PKG_DEB SK
3153
    #       ie: NATIVE INSTRUMENT PKG_WIN PKG_RPM PKG_DEB SK
3155
    #
3154
    #
-
 
3155
    my %activePlatformMap;
-
 
3156
    foreach my $item ( keys %BUILDINFO) {
-
 
3157
           my $pInfo = $BUILDINFO{$item};
-
 
3158
           next if $pInfo->{NOT_AVAILABLE} > 1; 
-
 
3159
           push @{$activePlatformMap{$pInfo->{TARGET}}}, $item;
-
 
3160
    }
-
 
3161
 
3156
    foreach my $alias ( @PlatformConfig::BuildAliases )
3162
    foreach my $alias ( @PlatformConfig::BuildAliases )
3157
    {
3163
    {
3158
        if (exists $BUILDALIAS{$alias}) 
3164
        if (exists $BUILDALIAS{$alias})  
3159
        {
3165
        {
3160
            # Will occur if GBE_ABT has been set, for backward compatibility
3166
            # Will occur if GBE_ABT has been set, for backward compatibility
3161
            Warning("User has manually specified a $alias alias",'Default alias will not be set.');
3167
            Warning("User has manually specified a $alias alias",'Default alias will not be set.');
-
 
3168
            #DebugDumpData("BUILDALIAS", \%BUILDALIAS);
3162
        }
3169
        }
3163
        else
3170
        else
3164
        {
3171
        {
3165
            my %activePlatformMap;
-
 
3166
            foreach my $item (@BUILD_ACTIVEPLATFORMS) {
-
 
3167
                if ($item =~ m~^LMOS_(.*)~) {
-
 
3168
                    $activePlatformMap{$1} = $item;
-
 
3169
                } else {
-
 
3170
                    $activePlatformMap{$item} = $item;
-
 
3171
                }
-
 
3172
            }
-
 
3173
            
-
 
3174
            my @activeAliases;
3172
            my @activeAliases;
3175
            foreach my $item (PlatformConfig::getTargetsByTag($alias))
3173
            foreach my $item (PlatformConfig::getTargetsByTag($alias)) {
3176
            {
3174
                if (exists($activePlatformMap{$item})) {
3177
                push (@activeAliases, $activePlatformMap{$item}) if exists($activePlatformMap{$item});
3175
                    push (@activeAliases, @{$activePlatformMap{$item}});
-
 
3176
                }
3178
            }
3177
            }
-
 
3178
 
3179
            $BUILDALIAS{$alias} = join(' ', @activeAliases) if (@activeAliases);
3179
            $BUILDALIAS{$alias} = join(' ', @activeAliases) if (@activeAliases);
3180
 
3180
 
3181
            #
3181
            #
3182
            #   Add to the build entry too
3182
            #   Add to the build entry too
3183
            #
3183
            #
3184
            foreach my $aliasTarget (@activeAliases)
3184
            foreach my $aliasTarget (@activeAliases) {
3185
            {
-
 
3186
                push @{$BUILDINFO{$aliasTarget}{USERALIAS}}, $alias;
3185
                push @{$BUILDINFO{$aliasTarget}{USERALIAS}}, $alias;
3187
            }
3186
            }
3188
        }
3187
        }
3189
    }
3188
    }
3190
    CleanUp_Aliases();
3189
    CleanUp_Aliases();
-
 
3190
    ProcessBuildArgument();
3191
 
3191
 
3192
    #
3192
    #
3193
    #   Create dummy package to describe the Interface directory
3193
    #   Create dummy package to describe the Interface directory
3194
    #
3194
    #
3195
    CreateInterfacePackage();
3195
    CreateInterfacePackage();
Line 3261... Line 3261...
3261
    return if ( $Clobber );
3261
    return if ( $Clobber );
3262
 
3262
 
3263
    if ( ! $ForceBuild  )
3263
    if ( ! $ForceBuild  )
3264
    {
3264
    {
3265
        my @build_warn;
3265
        my @build_warn;
3266
        my $bstamp = -M "$Cwd/$ScmBuildSrc";
3266
        my $bstamp = -M "$CwdFull/$ScmBuildSrc";
3267
        my $tstamp = -M "$Cwd/Makefile.gbe";
3267
        my $tstamp = -M "$CwdFull/Makefile.gbe";
3268
 
3268
 
3269
        push @build_warn, "Missing: Makefile.gbe" unless ( defined $tstamp );
3269
        push @build_warn, "Missing: Makefile.gbe" unless ( defined $tstamp );
3270
        push @build_warn, "Modified build file ($ScmBuildSrc)" if ( $tstamp && $bstamp < $tstamp );
3270
        push @build_warn, "Modified build file ($ScmBuildSrc)" if ( $tstamp && $bstamp < $tstamp );
3271
 
3271
 
3272
        #
3272
        #
Line 3356... Line 3356...
3356
    my $link_file;
3356
    my $link_file;
3357
    my $tag;
3357
    my $tag;
3358
    my $root_path;
3358
    my $root_path;
3359
 
3359
 
3360
    #
3360
    #
-
 
3361
    #   In the build system we do NOT want to consume packages from within the sandbox
-
 
3362
    #   because they may be partially formed. They need to be consumed from a published
-
 
3363
    #   archive.
-
 
3364
    #   
-
 
3365
    #   If we are in an ABT sandbox, then don't create a link file
-
 
3366
    #   
-
 
3367
    return if (defined($::GBE_ABT));
-
 
3368
 
-
 
3369
    #
3361
    #   Determine the path (and name) of the target archive
3370
    #   Determine the path (and name) of the target archive
3362
    #   Use sandbox_dpkg_archive if it exists
3371
    #   Use sandbox_dpkg_archive if it exists
3363
    #   Use local_dpkg_acrhive for backward compatability (should be removed after JATS 2.64.2+)
3372
    #   Use local_dpkg_acrhive for backward compatability (should be removed after JATS 2.64.2+)
3364
    #
3373
    #
3365
    if ( $target_archive = $::GBE_DPKG_SBOX )
3374
    if ( $target_archive = $::GBE_DPKG_SBOX )
Line 3372... Line 3381...
3372
        }
3381
        }
3373
        else
3382
        else
3374
        {
3383
        {
3375
            $link_file  = 'sandbox' . ${BUILDNAME_SUFFIX} . '.lnk';
3384
            $link_file  = 'sandbox' . ${BUILDNAME_SUFFIX} . '.lnk';
3376
        }
3385
        }
3377
        $root_path = 'GBE_SANDBOX' . substr($Cwd, length($::GBE_SANDBOX));
3386
        $root_path = 'GBE_SANDBOX' . substr($CwdFull, length($::GBE_SANDBOX));
3378
        Verbose2("Root Path: $::GBE_SANDBOX, $root_path");
3387
        Verbose2("Root Path: $::GBE_SANDBOX, $root_path");
3379
    }
3388
    }
3380
    elsif ( $target_archive = $::GBE_DPKG_LOCAL )
3389
    elsif ( $target_archive = $::GBE_DPKG_LOCAL )
3381
    {
3390
    {
3382
        $target_archive_name = "local_dpkg_archive";
3391
        $target_archive_name = "local_dpkg_archive";
3383
        $link_file = "$BUILDVERSION.lnk";
3392
        $link_file = "$BUILDVERSION.lnk";
3384
        $tag = "Local";
3393
        $tag = "Local";
3385
        $root_path = $Cwd;
3394
        $root_path = $CwdFull;
3386
    }
3395
    }
3387
    else
3396
    else
3388
    {
3397
    {
3389
        Verbose("Cannot locate local or sandbox archive")
3398
        Verbose("Cannot locate local or sandbox archive")
3390
            unless $Clobber;
3399
            unless $Clobber;
Line 3485... Line 3494...
3485
 
3494
 
3486
        #
3495
        #
3487
        #   File with path to the interface directory
3496
        #   File with path to the interface directory
3488
        #   Relative to the base of the sandbox
3497
        #   Relative to the base of the sandbox
3489
        #
3498
        #
3490
        FileCreate($int_path, catdir('GBE_SANDBOX',RelPath($Cwd,$::GBE_SANDBOX),$BUILDINTERFACE ));
3499
        FileCreate($int_path, CatPaths('GBE_SANDBOX',RelPath($CwdFull,$::GBE_SANDBOX),$BUILDINTERFACE ));
3491
 
3500
 
3492
        #
3501
        #
3493
        #   Indicate packages not build on this machine
3502
        #   Indicate packages not build on this machine
3494
        #
3503
        #
3495
        unlink $nob_path;           # Delete the NoBuild marker
3504
        unlink $nob_path;           # Delete the NoBuild marker
Line 3553... Line 3562...
3553
    }
3562
    }
3554
 
3563
 
3555
    if ( $Clobber )                             # clobber mode ?
3564
    if ( $Clobber )                             # clobber mode ?
3556
    {
3565
    {
3557
        #
3566
        #
3558
        #   Unmake all the makefiles
-
 
3559
        #   No longer needed as we track the file that are created
-
 
3560
        #
-
 
3561
        #if ( -e "Makefile.gbe" )
-
 
3562
        #{
-
 
3563
        #    JatsTool ( 'jmake.pl', 'unmakefiles');
-
 
3564
        #}
-
 
3565
 
-
 
3566
        #
-
 
3567
        #   Delete my own configuration files
3567
        #   Delete my own configuration files
3568
        #
3568
        #
3569
        DeleteCfg();
3569
        DeleteCfg();
3570
 
3570
 
3571
        #
3571
        #
Line 3621... Line 3621...
3621
 
3621
 
3622
        BuildPackageLink();
3622
        BuildPackageLink();
3623
        BuildSandboxData();
3623
        BuildSandboxData();
3624
        return;
3624
        return;
3625
    }
3625
    }
-
 
3626
    #
-
 
3627
    #   Generate the path to the descpkg file
-
 
3628
    #   The file is created later in the build proccess, but the makefile generation 
-
 
3629
    #   needs to have a known path to the file.
-
 
3630
    #    
-
 
3631
    #   It will be a file that is 'known' to JATS
-
 
3632
    #
-
 
3633
    $descpkgPath = BuildAddKnownFile ( $NoBuild ? $CwdFull : $Srcdir, 'descpkg' );
3626
 
3634
 
3627
    #.. Build support files
3635
    #.. Build support files
3628
    #
3636
    #
3629
    DeleteCfg();
3637
    DeleteCfg();
3630
    BuildConfig();
3638
    BuildConfig();
3631
    BuildSharedLibFiles();
3639
    BuildSharedLibFiles();
3632
    WriteParsedBuildConfig();
3640
    WriteParsedBuildConfig();
3633
    BuildPackageLink();
3641
    BuildPackageLink();
3634
    BuildSandboxData();
3642
    BuildSandboxData();
3635
    NoBuildMarker();
-
 
3636
 
3643
 
3637
    #
3644
    #
3638
    #  ONLY (re)building interface dir
3645
    #  ONLY (re)building interface dir
3639
    #
3646
    #
3640
    return
-
 
3641
        if ( $Interface );
3647
    unless ( $Interface ) {
3642
 
3648
 
3643
    #---------------------------------------------------------------------------
3649
        #---------------------------------------------------------------------------
3644
    #
3650
        #
3645
    #.. Make bootstrap "makefile",
3651
        #.. Make bootstrap "makefile",
3646
    #   Simulate a top level makefile
3652
        #   Simulate a top level makefile
3647
    #       Pass argumenst to makelib
3653
        #       Pass argumenst to makelib
3648
    #       Sumulate SubDir() operations
3654
        #       Sumulate SubDir() operations
3649
    #       Sumulate a Platform(*);
3655
        #       Sumulate a Platform(*);
3650
    #
3656
        #
3651
    #       Due to the normal way that makelib.pl is executed,
3657
        #       Due to the normal way that makelib.pl is executed,
3652
    #       the following substitutions are done.
3658
        #       the following substitutions are done.
3653
    #
3659
        #
3654
    @ARGV = ();
3660
        @ARGV = ();
3655
    $0 = "makefile.pl ";
3661
        $0 = "makefile.pl ";
3656
    push @ARGV, "$Cwd";                         # current working directory
3662
        push @ARGV, "$CwdFull";                         # current working directory
3657
    push @ARGV, "$::GBE_TOOLS/makelib.pl";     # makelib.pl image
3663
        push @ARGV, "$::GBE_TOOLS/makelib.pl";      # makelib.pl image
3658
    push @ARGV, "--interface=$BUILDINTERFACE"
3664
        push @ARGV, "--interface=$BUILDINTERFACE"
3659
        if ($BUILDINTERFACE);
3665
            if ($BUILDINTERFACE);
3660
 
-
 
3661
    Debug( "ARGV:      @ARGV" );
-
 
3662
 
-
 
3663
    #.. (re)Build root makefile
-
 
3664
    #
-
 
3665
    $ScmBuildlib = 0;                           # clear Buildlib flag for 'makelib.pl'
-
 
3666
    RootMakefile();                             # inform 'makelib.pl'
-
 
3667
    MakeLibInit();                              # run initialisation
-
 
3668
 
-
 
3669
    #.. Register subdir(s)
-
 
3670
    #
-
 
3671
    UniquePush (\@BUILDSUBDIRS, $Srcdir );
-
 
3672
    SubDir( @BUILDSUBDIRS );
-
 
3673
    Platform( @BUILD_ACTIVEPLATFORMS );
-
 
3674
 
-
 
3675
    #.. (re)build src makefiles and associated information
-
 
3676
    #   JatsTool will not return on error
-
 
3677
    #
-
 
3678
    my @cmds = ('jmake.pl', 'rebuild');
-
 
3679
    push @cmds, 'NORECURSE=1' if ( $RootOnly );
-
 
3680
    JatsTool ( @cmds);
-
 
3681
 
3666
 
-
 
3667
        Debug( "ARGV:      @ARGV" );
-
 
3668
 
-
 
3669
        #.. (re)Build root makefile
-
 
3670
        #
-
 
3671
        $ScmBuildlib = 0;                           # clear Buildlib flag for 'makelib.pl'
-
 
3672
        RootMakefile();                             # inform 'makelib.pl'
-
 
3673
        MakeLibInit();                              # run initialisation
-
 
3674
 
-
 
3675
        #.. Register subdir(s)
-
 
3676
        #
-
 
3677
        UniquePush (\@BUILDSUBDIRS, $Srcdir );
-
 
3678
        SubDir( @BUILDSUBDIRS );
-
 
3679
        Platform( @BUILD_ACTIVEPLATFORMS );
-
 
3680
 
-
 
3681
        #.. (re)build src makefiles and associated information
-
 
3682
        #   JatsTool will not return on error
-
 
3683
        #
-
 
3684
        my @cmds = ('jmake.pl', 'rebuild');
-
 
3685
        push @cmds, 'NORECURSE=1' if ( $RootOnly );
-
 
3686
        JatsTool ( @cmds);
-
 
3687
    }
-
 
3688
 
-
 
3689
    #
-
 
3690
    #   Generate package signature
-
 
3691
    #   Write the descpkg file again - with a signature this time
3682
    #
3692
    #
3683
    ErrorConfig( 'name' => 'buildlib')   ;
3693
    ErrorConfig( 'name' => 'buildlib')   ;
-
 
3694
    WriteDescpkg();
-
 
3695
    NoBuildMarker();
-
 
3696
 
-
 
3697
    #
3684
    #   Generate some warnings that will be seen at the end of the build
3698
    #   Generate some warnings that will be seen at the end of the build
3685
    #
3699
    #
3686
    Warning ("BuildSrcArchive Directive Present","Read JATS Manual for correct usage")
3700
    Warning ("BuildSrcArchive Directive Present","Read JATS Manual for correct usage")
3687
        if ($build_source_pkg);
3701
        if ($build_source_pkg);
3688
}
3702
}
Line 3822... Line 3836...
3822
#                   The format of this file matches that generated by JANTS
3836
#                   The format of this file matches that generated by JANTS
3823
#                   Take care when extending the format
3837
#                   Take care when extending the format
3824
#
3838
#
3825
#                   NOTE: It turns out that JANTS is not a standard and the
3839
#                   NOTE: It turns out that JANTS is not a standard and the
3826
#                         implementors (of JANTS) kept on changing it.
3840
#                         implementors (of JANTS) kept on changing it.
-
 
3841
#                         
-
 
3842
#                   NOTE: This directive is now ignored
-
 
3843
#                         The descpkg file is generated internally
3827
#
3844
#
3828
# Inputs          :
3845
# Inputs          : $mode - 'Internal' - Skip sanity test
3829
#
3846
#
3830
# Returns         :
3847
# Returns         :
3831
#
3848
#
3832
sub BuildDescpkg
3849
sub BuildDescpkg
3833
{
3850
{
3834
    StartBuildPhase();                      # Starting the build phase. No more data collection
3851
    StartBuildPhase();                  # Starting the build phase. No more data collection
3835
    return if ( $Clobber );                 # clobber mode ?
-
 
-
 
3852
}
3836
 
3853
 
-
 
3854
#-------------------------------------------------------------------------------
-
 
3855
# Function        : WriteDescpkg 
3837
    #
3856
#
-
 
3857
# Description     : Create a package description file
3838
    #   Store the files location for use at runtime
3858
#                   The format of this file matches that generated by JANTS
3839
    #   It will be a file that is 'known' to JATS
3859
#                   Take care when extending the format
3840
    #
3860
#
3841
    my $pkgfile = BuildAddKnownFile ( $NoBuild ? $Cwd : $Srcdir, 'descpkg' );
3861
#                   NOTE: It turns out that JANTS is not a standard and the
-
 
3862
#                         implementors (of JANTS) kept on changing it.
-
 
3863
#
-
 
3864
# Inputs          :  
-
 
3865
#
-
 
3866
# Returns         : 
-
 
3867
#
-
 
3868
sub WriteDescpkg
-
 
3869
{
-
 
3870
    return if ( $Clobber );                 # clobber mode ?
3842
 
3871
 
3843
    my @desc;
3872
    my @desc;
3844
    push @desc, "Package Name:  $BUILDNAME_PACKAGE";
3873
    push @desc, "Package Name:  $BUILDNAME_PACKAGE";
3845
    push @desc, "Version:       $BUILDVERSION";
3874
    push @desc, "Version:       $BUILDVERSION";
3846
    push @desc, "Released By:   $::USER";
3875
    push @desc, "Released By:   $::USER";
3847
    push @desc, "Released On:   $::CurrentTime";
3876
    push @desc, "Released On:   $::CurrentTime";
3848
    push @desc, "Build Machine: $::GBE_HOSTNAME";
3877
    push @desc, "Build Machine: $::GBE_HOSTNAME";
3849
    push @desc, "Path:          $Cwd";
3878
    push @desc, "Path:          $CwdFull";
3850
    push @desc, "Jats Version:  $::GBE_VERSION";
3879
    push @desc, "Jats Version:  $::GBE_VERSION";
3851
    push @desc, "Jats Path:     $::GBE_CORE";
3880
    push @desc, "Jats Path:     $::GBE_CORE";
3852
    push @desc, "";
3881
    push @desc, "";
3853
    push @desc, "Build Dependencies:";
3882
    push @desc, "Build Dependencies:";
3854
    push @desc, "";
3883
    push @desc, "";
Line 3864... Line 3893...
3864
        push @attributes, "build=\"true\"" if $type =~ /Build/i;
3893
        push @attributes, "build=\"true\"" if $type =~ /Build/i;
3865
 
3894
 
3866
        push @desc, "<sandbox @attributes/>";
3895
        push @desc, "<sandbox @attributes/>";
3867
    }
3896
    }
3868
 
3897
 
3869
    FileCreate ($pkgfile, \@desc );
3898
    FileCreate ($descpkgPath, \@desc );
3870
}
3899
}
3871
 
3900
 
3872
#-------------------------------------------------------------------------------
3901
#-------------------------------------------------------------------------------
3873
# Function        : NoBuildMarker
3902
# Function        : NoBuildMarker
3874
#
3903
#
Line 4007... Line 4036...
4007
#   Contains per platform options extracted from alias and platform args
4036
#   Contains per platform options extracted from alias and platform args
4008
#
4037
#
4009
    my %ScmBuildPlatforms;
4038
    my %ScmBuildPlatforms;
4010
    foreach my $key ( @platforms_merged ) {
4039
    foreach my $key ( @platforms_merged ) {
4011
 
4040
 
-
 
4041
        my $pInfo = $BUILDINFO{$key};
-
 
4042
        next if ($pInfo->{NOT_AVAILABLE});
-
 
4043
 
4012
        my( @arguments ) = ();
4044
        my( @arguments ) = ();
4013
        UniquePush( \@arguments, split( /$;/, $BUILDPLATFORMARGS{ $key } ))
4045
        UniquePush( \@arguments, split( /$;/, $BUILDPLATFORMARGS{ $key } ))
4014
            if ( exists $BUILDPLATFORMARGS{ $key } );
4046
            if ( exists $BUILDPLATFORMARGS{ $key } );
4015
 
4047
 
4016
        UniquePush( \@arguments, split( /$;/, $platform_args{ $key } ))
4048
        UniquePush( \@arguments, split( /$;/, $platform_args{ $key } ))
Line 4021... Line 4053...
4021
 
4053
 
4022
    $fh->DumpData(
4054
    $fh->DumpData(
4023
        "# Platform and global argument list.\n#\n",
4055
        "# Platform and global argument list.\n#\n",
4024
        "ScmBuildPlatforms", \%ScmBuildPlatforms );
4056
        "ScmBuildPlatforms", \%ScmBuildPlatforms );
4025
 
4057
 
-
 
4058
#.. Create ScmBuildMatrix
-
 
4059
#   Contains information on all the platforms that the package builds for and target machines
-
 
4060
#   
-
 
4061
    my %ScmBuildMatrix;
-
 
4062
    foreach my $key ( keys %BUILDINFO ) {
-
 
4063
        my $pInfo = $BUILDINFO{$key};
-
 
4064
        next if exists ($pInfo->{BADNAME});
-
 
4065
        next if ($pInfo->{NOT_AVAILABLE} > 1);
-
 
4066
        Error ("Internal: No MACHTYPE provided for $key") unless exists $pInfo->{MACHTYPE};
-
 
4067
        $ScmBuildMatrix{$key} = $pInfo->{MACHTYPE};
-
 
4068
    }
-
 
4069
 
-
 
4070
    $fh->DumpData(
-
 
4071
        "# Build Matrix.\n#\n",
-
 
4072
        "ScmBuildMatrix", \%ScmBuildMatrix );
4026
 
4073
 
4027
# .. Create BuildPkgRules
4074
# .. Create BuildPkgRules
4028
#
4075
#
4029
#    This is most of the information contained within %PKGRULES, which
4076
#    This is most of the information contained within %PKGRULES, which
4030
#    requires additional processing within makelib.
4077
#    requires additional processing within makelib.