Subversion Repositories DevTools

Rev

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

Rev 361 Rev 363
Line 1... Line 1...
1
# -*- mode: perl; tabs: 8; indent-width: 4; show-tabs: yes; -*-
1
########################################################################
2
# Copyright 1995-2004 ERG Transit Systems, All Rights Reserved
2
# Copyright (C) 1998-2011 Vix Technology, All rights reserved
3
#
3
#
4
# Module name   : buildlib.pl
4
# Module name   : buildlib.pl
5
# Module type   : Makefile system
5
# Module type   : Makefile system
6
# Compiler(s)   : ANSI C
6
# Compiler(s)   : Perl
7
# Environment(s): n/a
7
# Environment(s): jats
8
#
8
#
9
# Description:
-
 
10
#       This is the standard bootstrap script for sandboxs.
9
# Description   : Process build.pl file and create the build environment
11
#
10
#
12
# Notes:
-
 
13
#
-
 
14
#                       *** DO NOT DETAB ***
-
 
15
#
-
 
16
#       Beware the use of space v's tab characters within the
11
# Usage         : Refer to documentation at the end of the file
17
#       makefile generation sessions.
-
 
18
#
-
 
19
#.........................................................................
-
 
20
#
12
#
-
 
13
#......................................................................#
21
 
14
 
22
use strict;
15
use strict;
23
use warnings;
16
use warnings;
24
 
17
 
-
 
18
use JatsError;
25
use BuildVersion;
19
use BuildVersion;
26
use BuildName;
20
use BuildName;
27
use PackageEntry;
21
use PackageEntry;
28
use JatsEnv;
22
use JatsEnv;
29
use JatsSystem;
23
use JatsSystem;
Line 92... Line 86...
92
 
86
 
93
our $Makelib                = "";
87
our $Makelib                = "";
94
our $GBE_CORE;                                  # Root of JATS
88
our $GBE_CORE;                                  # Root of JATS
95
our $InterfaceVersion;                          # Interface directory format version
89
our $InterfaceVersion;                          # Interface directory format version
96
our $ScmInterface;                              # Interface directory
90
our $ScmInterface;                              # Interface directory
97
 
-
 
-
 
91
our $ScmBuildFilter;                            # Build Filter when build was created
98
 
92
 
99
 
93
 
100
my  $DeleteDPACKAGE         = 0;                # Must clobber DPACKAGE
94
my  $DeleteDPACKAGE         = 0;                # Must clobber DPACKAGE
101
my  $build_source_pkg       = 0;                # Flag to build source package
95
my  $build_source_pkg       = 0;                # Flag to build source package
102
my  $opt_help               = 0;
96
my  $opt_help               = 0;
Line 395... Line 389...
395
 
389
 
396
    #   Define alias
390
    #   Define alias
397
    #
391
    #
398
    if ( $alias eq "GENERIC" )
392
    if ( $alias eq "GENERIC" )
399
    {
393
    {
400
        Error( "BuildAlias() cannot create a alias named GENERIC" );
394
        Error( "BuildAlias() cannot create an alias named GENERIC" );
401
    }
395
    }
402
    elsif ( $alias ne quotemeta( $alias ) )
396
    elsif ( $alias ne quotemeta( $alias ) )
403
    {
397
    {
404
        Warning( "BuildAlias() alias '$alias' contains invalid characters -- ignored" );
398
        Warning( "BuildAlias() alias '$alias' contains invalid characters -- ignored" );
405
    }
399
    }
Line 710... Line 704...
710
    $buildentry{NOT_DEFAULT} = $notdefault;
704
    $buildentry{NOT_DEFAULT} = $notdefault;
711
    $buildentry{PRODUCT} = $product;
705
    $buildentry{PRODUCT} = $product;
712
    $buildentry{TARGET} = $target;
706
    $buildentry{TARGET} = $target;
713
    $buildentry{BASE} = $target;
707
    $buildentry{BASE} = $target;
714
    $buildentry{USES} = [ @$pUses ] if $pUses;
708
    $buildentry{USES} = [ @$pUses ] if $pUses;
-
 
709
    foreach ( @$pArgs )
-
 
710
    {
-
 
711
        if ( m~^--Alias=(.+)~ ) {
715
    $buildentry{ARGS} = [ @$pArgs ] if $pArgs;
712
            push @{$buildentry{USERALIAS}}, split(',',$1);
-
 
713
        }
-
 
714
        else{
-
 
715
            push @{$buildentry{ARGS}}, $_;
-
 
716
        }
-
 
717
    }
716
 
718
 
717
    #
719
    #
718
    #   Allow per-platform processing to be alter the basic information
720
    #   Allow per-platform processing to be alter the basic information
719
    #   Special processing may be perform to extend the information
721
    #   Special processing may be perform to extend the information
720
    #   Allows special processing to be enabled on a per-target basis
722
    #   Allows special processing to be enabled on a per-target basis
Line 929... Line 931...
929
    {
931
    {
930
        HashJoin( \%BUILDALIAS_DELAY, ' ', $_, $platform )
932
        HashJoin( \%BUILDALIAS_DELAY, ' ', $_, $platform )
931
            foreach ( ArrayList($pInfo->{ALIAS}) );
933
            foreach ( ArrayList($pInfo->{ALIAS}) );
932
    }
934
    }
933
 
935
 
-
 
936
    if ( $pInfo->{USERALIAS} )
-
 
937
    {
-
 
938
        HashJoin( \%BUILDALIAS_DELAY, ' ', $_, $platform )
-
 
939
            foreach ( ArrayList($pInfo->{USERALIAS}) );
-
 
940
    }
-
 
941
    
934
    #
942
    #
935
    #   Create a HARDWARE type alias if requested
943
    #   Create a HARDWARE type alias if requested
936
    #   ie: SOLARIS_SPARC or SOLARIS_X86
944
    #   ie: SOLARIS_SPARC or SOLARIS_X86
937
    #
945
    #
938
    if ( $pInfo->{HARDWARE} )
946
    if ( $pInfo->{HARDWARE} )
Line 1439... Line 1447...
1439
sub IncludePkg
1447
sub IncludePkg
1440
{
1448
{
1441
    my ($name, $pkg) = @_;
1449
    my ($name, $pkg) = @_;
1442
    my $file = "$pkg/incpkg";
1450
    my $file = "$pkg/incpkg";
1443
 
1451
 
1444
    Debug ("IncludePkg: $pkg" );
1452
    Debug ("IncludePkg: $name, $pkg" );
1445
 
1453
 
1446
    #
1454
    #
1447
    #   Using a require will ensure that the package is only processed once
1455
    #   Using a require will ensure that the package is only processed once
1448
    #   even though the function user may be called multiple times.
1456
    #   even though the function user may be called multiple times.
1449
    #   Also prevents recursion within included packages.
1457
    #   Also prevents recursion within included packages.
Line 1483... Line 1491...
1483
    {
1491
    {
1484
        Log( "WARNING .... Sandbox $path not available" );
1492
        Log( "WARNING .... Sandbox $path not available" );
1485
    }
1493
    }
1486
    else
1494
    else
1487
    {
1495
    {
1488
        $path = Realpath( $path );
1496
        my @platforms;
1489
 
-
 
1490
        if ( !defined($platform) || $platform eq "*" ) 
1497
        if ( !defined($platform) || $platform eq "*" ) {
1491
        {
-
 
1492
            foreach my $platform ( @BUILD_ACTIVEPLATFORMS )
1498
            @platforms = @BUILD_ACTIVEPLATFORMS;
1493
            {
1499
        } else {
1494
                LinkEntry( $platform, $path, $name, "!sandbox", 1, 1 );
1500
            @platforms = ExpandPlatforms( split( ',', $platform ) );
1495
            }
-
 
1496
        }
1501
        }
1497
        else
-
 
1498
        {
-
 
1499
            my(@platforms) = split( ',', $platform );
-
 
1500
            @platforms = ExpandPlatforms( @platforms );
-
 
1501
 
1502
 
-
 
1503
        $path = Realpath( $path );
-
 
1504
        IncludePkg ( $name, $path );
1502
            foreach my $platform ( @platforms )
1505
        foreach my $platform ( @platforms )
1503
            {
1506
        {
1504
                LinkEntry( $platform, $path, $name, "!sandbox", 1, 1 );
1507
            LinkEntry( $platform, $path, $name, "!sandbox", 1, 1 );
1505
            }
-
 
1506
        }
1508
        }
1507
    }
1509
    }
1508
}
1510
}
1509
 
1511
 
1510
 
1512
 
Line 1556... Line 1558...
1556
    if ( $pkg )
1558
    if ( $pkg )
1557
    {
1559
    {
1558
        #
1560
        #
1559
        #   Generate package rules for each active platform
1561
        #   Generate package rules for each active platform
1560
        #
1562
        #
-
 
1563
        IncludePkg ( $name, $pkg );
1561
        foreach my $platform ( @BUILD_ACTIVEPLATFORMS )
1564
        foreach my $platform ( @BUILD_ACTIVEPLATFORMS, '--' )
1562
        {
1565
        {
1563
            LinkEntry( $platform, $pkg, $name, $version, 0, $local );
1566
            LinkEntry( $platform, $pkg, $name, $version, 0, $local );
1564
        }
1567
        }
1565
    }
1568
    }
1566
}
1569
}
Line 1852... Line 1855...
1852
    #   independent of the toolset.
1855
    #   independent of the toolset.
1853
    #
1856
    #
1854
    #..
1857
    #..
1855
    $entry->ExamineToolPath();
1858
    $entry->ExamineToolPath();
1856
    $entry->ExamineThxPath($platform);
1859
    $entry->ExamineThxPath($platform);
1857
    IncludePkg ( $name, $pkg );
-
 
1858
    $entry->Cleanup();                          # cleanup tables
1860
    $entry->Cleanup();                          # cleanup tables
1859
 
1861
 
1860
    #
1862
    #
1861
    #   Add the package entry to the array of such entries for
1863
    #   Add the package entry to the array of such entries for
1862
    #   the current platform. Maintain the discovery order
1864
    #   the current platform. Maintain the discovery order
Line 2763... Line 2765...
2763
        my $tstamp = -M "$Cwd/Makefile.gbe";
2765
        my $tstamp = -M "$Cwd/Makefile.gbe";
2764
 
2766
 
2765
        push @build_warn, "Missing: Makefile.gbe" unless ( defined $tstamp );
2767
        push @build_warn, "Missing: Makefile.gbe" unless ( defined $tstamp );
2766
        push @build_warn, "Modified build file ($ScmBuildSrc)" if ( $tstamp && $bstamp < $tstamp );
2768
        push @build_warn, "Modified build file ($ScmBuildSrc)" if ( $tstamp && $bstamp < $tstamp );
2767
 
2769
 
-
 
2770
        #
-
 
2771
        #   Ensure that the build filter has not changed
-
 
2772
        #   If the user has changed the buildfilter, then we need to
-
 
2773
        #   force a build.
-
 
2774
        #
-
 
2775
        #   The root Makefile.bge will have a $ScmBuildFilter entry
-
 
2776
        #
-
 
2777
        unless ( @build_warn )
-
 
2778
        {
-
 
2779
            use JatsMakeInfo;
-
 
2780
            ReadMakeInfo();
-
 
2781
                my $line = $::ScmBuildFilter || '';
-
 
2782
                $line =~ s~\s+~ ~g;
-
 
2783
 
-
 
2784
                my $filter = $::GBE_BUILDFILTER;
-
 
2785
                $filter =~ s~\s+~ ~g;
-
 
2786
                if ( $line ne $filter )
-
 
2787
                {
-
 
2788
                    push @build_warn, "Build filter has changed";
-
 
2789
                    Verbose2 ("Buildfilter Test: Was:$line, Is:$::GBE_BUILDFILTER");
-
 
2790
                }
-
 
2791
        }
-
 
2792
 
2768
        if ( @build_warn )
2793
        if ( @build_warn )
2769
        {
2794
        {
2770
            Verbose ("Forcing Build", @build_warn );
2795
            Verbose ("Forcing Build.", @build_warn );
2771
        }
2796
        }
2772
        else
2797
        else
2773
        {
2798
        {
2774
            Verbose ("No build performed. Build files up to date");
2799
            Verbose ("No build performed. Build files up to date");
2775
            Log ("Build files up to date") if $::GBE_SANDBOX;
2800
            Log ("Build files up to date") if $::GBE_SANDBOX;
Line 3529... Line 3554...
3529
 
3554
 
3530
#
3555
#
3531
#   Close out the file
3556
#   Close out the file
3532
#
3557
#
3533
    $fh->Close();
3558
    $fh->Close();
-
 
3559
 
3534
}
3560
}
3535
 
3561
 
3536
#-------------------------------------------------------------------------------
3562
#-------------------------------------------------------------------------------
3537
# Function        : WriteParsedBuildConfig
3563
# Function        : WriteParsedBuildConfig
3538
#
3564
#
Line 3945... Line 3971...
3945
    -package       - Ignore packages that are not available and continue
3971
    -package       - Ignore packages that are not available and continue
3946
    -forcebuildpkg - Treat LinkPkgArchive directives as BuildPkgArchive
3972
    -forcebuildpkg - Treat LinkPkgArchive directives as BuildPkgArchive
3947
                     Also suppress the use of symlinks so that the physical
3973
                     Also suppress the use of symlinks so that the physical
3948
                     file will be copied locally.
3974
                     file will be copied locally.
3949
    -[no]force     - Force build even if build.pl is not newer
3975
    -[no]force     - Force build even if build.pl is not newer
3950
                      Default: -force
3976
                     Default: -force
3951
 
3977
 
3952
 Sticky settings:
3978
 Sticky settings:
3953
    -all           - Build for all platforms ignoring GBE_BUILDFILTER
3979
    -all           - Build for all platforms ignoring GBE_BUILDFILTER
3954
    -expert[=n]    - Relaxing dependency checks on the user makefiles
3980
    -expert[=n]    - Relaxing dependency checks on the user makefiles
3955
 
3981
 
Line 4036... Line 4062...
4036
=back
4062
=back
4037
 
4063
 
4038
=item B<-[no]force>
4064
=item B<-[no]force>
4039
 
4065
 
4040
The '-noforce' option will only perform a build, if the build.pl file
4066
The '-noforce' option will only perform a build, if the build.pl file
4041
has build.pl file has been modified since the last build.
4067
has been modified, or the buildfilter has changed, since the last build.
4042
 
4068
 
4043
The default operation will alwars force a build.
4069
The default operation will always force a build.
4044
 
4070
 
4045
=item B<-all>
4071
=item B<-all>
4046
 
4072
 
4047
This option will cause the build process to generate makefiles for all
4073
This option will cause the build process to generate makefiles for all
4048
possible build targets ignoring the use of GBE_BUILDFILTER.
4074
possible build targets ignoring the use of GBE_BUILDFILTER.
Line 4063... Line 4089...
4063
force the rebuild with the command 'jats rebuild'.
4089
force the rebuild with the command 'jats rebuild'.
4064
 
4090
 
4065
This option should be used with care and with full knowledge of its impact.
4091
This option should be used with care and with full knowledge of its impact.
4066
 
4092
 
4067
This option is sticky. Once used in a build it will be retained when makefiles
4093
This option is sticky. Once used in a build it will be retained when makefiles
4068
are rebuilt. It will only be lost when the next 'jats build' is perfromed.
4094
are rebuilt. It will only be lost when the next 'jats build' is performed.
4069
 
4095
 
4070
The effect of the option can be changed when the makefiles are processed. This
4096
The effect of the option can be changed when the makefiles are processed. This
4071
option simply sets the default' mode of operation.
4097
option simply sets the default' mode of operation.
4072
 
4098
 
4073
=item B<changelog>
4099
=item B<changelog>