Subversion Repositories DevTools

Rev

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

Rev 7310 Rev 7320
Line 1277... Line 1277...
1277
#       installed into the 'local header directory' area for public
1277
#       installed into the 'local header directory' area for public
1278
#       consumption.  This is generally API files for other modules
1278
#       consumption.  This is generally API files for other modules
1279
#       to use.
1279
#       to use.
1280
#
1280
#
1281
#       --Strip         Strip directory from source
1281
#       --Strip         Strip directory from source
-
 
1282
#       --Strip=n       Strip part of directory from source
1282
#       --Full          Install using full path
1283
#       --Full          Install using full path
1283
#       --Subdir=subdir Install within the specified sub-directory
1284
#       --Subdir=subdir Install within the specified sub-directory
1284
#       --Prefix=subdir   "       "     "      "      "     "
1285
#       --Prefix=subdir   "       "     "      "      "     "
1285
#
1286
#
1286
#   InstallLib( 'platform [, ... ]', 'file', ['subdir'] )
1287
#   InstallLib( 'platform [, ... ]', 'file', ['subdir'] )
Line 6051... Line 6052...
6051
 
6052
 
6052
        if (/^--Full/) {                        # using full (resolved) path
6053
        if (/^--Full/) {                        # using full (resolved) path
6053
            $full = 1;
6054
            $full = 1;
6054
 
6055
 
6055
        } elsif (/^--Strip$/) {                 # Strip path from source files
6056
        } elsif (/^--Strip$/) {                 # Strip path from source files
6056
            $strip = 1;
6057
            $strip = -1;
6057
 
6058
 
-
 
6059
        } elsif (/^--Strip=(\d+)$/) {           # Strip some f the path from source files
-
 
6060
            $strip = $1;
6058
                                                # Package
6061
                                                # Package
6059
        } elsif (/^--Package$/ || /^--Package=(.*)/) {
6062
        } elsif (/^--Package$/ || /^--Package=(.*)/) {
6060
            $package = 1;
6063
            $package = 1;
6061
 
6064
 
6062
        } elsif (/^--(.*)/) {
6065
        } elsif (/^--(.*)/) {
Line 6087... Line 6090...
6087
                $dir =~ s~/./~/~g;
6090
                $dir =~ s~/./~/~g;
6088
                $dir =~ s~/$~~g;
6091
                $dir =~ s~/$~~g;
6089
                $name = $basename;
6092
                $name = $basename;
6090
            }
6093
            }
6091
 
6094
 
6092
            $name = $basename
-
 
6093
                if ( $strip );
6095
            $name = StripPath($name, $strip) if ($strip);
6094
 
6096
 
6095
            Debug( "InstallHdr( $dir/$name, src: $srcfile, dest: $dir)" );
6097
            Debug( "InstallHdr( $dir/$name, src: $srcfile, dest: $dir)" );
6096
 
6098
 
6097
            $package_entry{'src'} = $srcfile;
6099
            $package_entry{'src'} = $srcfile;
6098
            $package_entry{'dir'} = StripFileExt( "$dir/$name" );
6100
            $package_entry{'dir'} = StripFileExt( "$dir/$name" );
Line 6133... Line 6135...
6133
 
6135
 
6134
        if (/^--Package$/ || /^--Package=(.*)/) {
6136
        if (/^--Package$/ || /^--Package=(.*)/) {
6135
            $package = 1;
6137
            $package = 1;
6136
 
6138
 
6137
        } elsif (/^--Strip$/) {                 # Strip path from source files
6139
        } elsif (/^--Strip$/) {                 # Strip path from source files
6138
            $strip = 1;
6140
            $strip = -1;
-
 
6141
 
-
 
6142
        } elsif (/^--Strip=(\d+)$/) {           # Strip some f the path from source files
-
 
6143
            $strip = $1;
6139
 
6144
 
6140
        } elsif (/^--(.*)/) {
6145
        } elsif (/^--(.*)/) {
6141
            Message( "InstallLib: unknown option $_ -- ignored\n" );
6146
            Message( "InstallLib: unknown option $_ -- ignored\n" );
6142
        }
6147
        }
6143
    }
6148
    }
Line 6147... Line 6152...
6147
    foreach ( @elements )
6152
    foreach ( @elements )
6148
    {
6153
    {
6149
        my %package_entry;
6154
        my %package_entry;
6150
        if ( ! /^--(.*)/ )
6155
        if ( ! /^--(.*)/ )
6151
        {
6156
        {
6152
            $_ = basename ($_)
-
 
6153
                if ( $strip );
6157
            $_ = StripPath($_, $strip) if ($strip);
6154
            $org_lib = $_;                      # Original name
6158
            $org_lib = $_;                      # Original name
6155
 
6159
 
6156
            if ( $ScmTargetHost eq "Unix" ) {
6160
            if ( $ScmTargetHost eq "Unix" ) {
6157
                $lib = "lib$_";                 # Prefix "lib" ....
6161
                $lib = "lib$_";                 # Prefix "lib" ....
6158
                $lib =~ s/^liblib/lib/;         # @LIBS already has lib added
6162
                $lib =~ s/^liblib/lib/;         # @LIBS already has lib added
Line 6386... Line 6390...
6386
#
6390
#
6387
    PackageProg( @_ )                           # auto package
6391
    PackageProg( @_ )                           # auto package
6388
        if ( $package );
6392
        if ( $package );
6389
}
6393
}
6390
 
6394
 
-
 
6395
#-------------------------------------------------------------------------------
-
 
6396
# Function        : StripPath 
-
 
6397
#
-
 
6398
# Description     : Internal function to strip bits from a pathname
-
 
6399
#                   Will never strip the filename, even if asked to strip too much
-
 
6400
#
-
 
6401
# Inputs          : $name       - Name to process
-
 
6402
#                   $stripCount - Strip part
-
 
6403
#                                 <0 - strip all paths
-
 
6404
#                                 =0  - Do nothing
-
 
6405
#                                 >0 - Strip count
-
 
6406
#
-
 
6407
# Returns         : Processed name
-
 
6408
#
-
 
6409
sub StripPath
-
 
6410
{
-
 
6411
    my( $name, $stripCount) = @_;
-
 
6412
 
-
 
6413
    if ($stripCount)
-
 
6414
    {
-
 
6415
        $name =~ s~\\~/~g;
-
 
6416
        $name =~ s~//~~g;
-
 
6417
 
-
 
6418
        my @items = split('/', $name);
-
 
6419
        if ($stripCount > 0)
-
 
6420
        {
-
 
6421
            my $len = scalar @items;
-
 
6422
            my $remove = $stripCount; 
-
 
6423
            if ($stripCount >= $len ) {
-
 
6424
                $remove = $len - 1;
-
 
6425
            }
-
 
6426
            splice @items, 0, $remove;
-
 
6427
            $name = join('/', @items);
-
 
6428
        }
-
 
6429
        else
-
 
6430
        {
-
 
6431
            $name = pop @items;
-
 
6432
        }
-
 
6433
    }
-
 
6434
    return $name;
-
 
6435
}
-
 
6436
 
6391
 
6437
 
6392
###############################################################################
6438
###############################################################################
6393
#
6439
#
6394
#   Packaging
6440
#   Packaging
6395
#
6441
#
Line 6465... Line 6511...
6465
        } elsif (/^--Package$/) {               # Package .. call by InstallFile
6511
        } elsif (/^--Package$/) {               # Package .. call by InstallFile
6466
        } elsif (/^--Package=(.*)/) {
6512
        } elsif (/^--Package=(.*)/) {
6467
            $dist = "$1";
6513
            $dist = "$1";
6468
 
6514
 
6469
        } elsif (/^--Strip$/) {                 # Strip path from source files
6515
        } elsif (/^--Strip$/) {                 # Strip path from source files
6470
            $strip = 1;
6516
            $strip = -1;
-
 
6517
 
-
 
6518
        } elsif (/^--Strip=(\d+)$/) {                 # Strip path from source files
-
 
6519
            $strip = $1;
6471
 
6520
 
6472
        } elsif (/^--Executable$/) {            # Mark the file as executable
6521
        } elsif (/^--Executable$/) {            # Mark the file as executable
6473
            $exefile = "X";
6522
            $exefile = "X";
6474
 
6523
 
6475
        } elsif (/^--PreserveSymlink/i) {       # Preserve symlink to local file
6524
        } elsif (/^--PreserveSymlink/i) {       # Preserve symlink to local file
Line 6594... Line 6643...
6594
                $dir =~ s~/./~/~g;
6643
                $dir =~ s~/./~/~g;
6595
                $dir =~ s~/$~~g;
6644
                $dir =~ s~/$~~g;
6596
                $name = $basename;
6645
                $name = $basename;
6597
            }
6646
            }
6598
 
6647
 
6599
            $name = $basename
-
 
6600
                if ( $strip );
6648
            $name = StripPath($name, $strip) if ($strip);
6601
 
6649
 
6602
            if ( $strip_base )
6650
            if ( $strip_base )
6603
            {
6651
            {
6604
                $name = substr $name, $strip_base;
6652
                $name = substr $name, $strip_base;
6605
                $name =~ s~^/~~;
6653
                $name =~ s~^/~~;
Line 6674... Line 6722...
6674
        } elsif (/^--Package$/) {               # Package .. call by InstallHdr
6722
        } elsif (/^--Package$/) {               # Package .. call by InstallHdr
6675
        } elsif (/^--Package=(.*)/) {
6723
        } elsif (/^--Package=(.*)/) {
6676
            $dist = "$1";
6724
            $dist = "$1";
6677
 
6725
 
6678
        } elsif (/^--Strip$/) {                 # Strip path from source files
6726
        } elsif (/^--Strip$/) {                 # Strip path from source files
6679
            $strip = 1;
6727
            $strip = -1;
-
 
6728
 
-
 
6729
        } elsif (/^--Strip=(\d+)$/) {           # Strip some f the path from source files
-
 
6730
            $strip = $1;
6680
 
6731
 
6681
        } elsif (/^--(.*)/) {
6732
        } elsif (/^--(.*)/) {
6682
            Message( "PackageHdr: unknown option $_ -- ignored\n" );
6733
            Message( "PackageHdr: unknown option $_ -- ignored\n" );
6683
        }
6734
        }
6684
    }
6735
    }
Line 6706... Line 6757...
6706
                $dir =~ s~/./~/~g;
6757
                $dir =~ s~/./~/~g;
6707
                $dir =~ s~/$~~g;
6758
                $dir =~ s~/$~~g;
6708
                $name = $basename;
6759
                $name = $basename;
6709
            }
6760
            }
6710
 
6761
 
6711
            $name = $basename
-
 
6712
                if ( $strip );
6762
            $name = StripPath($name, $strip) if ($strip);
6713
 
6763
 
6714
            Debug( "PackageHdr( $dir/$name, " .
6764
            Debug( "PackageHdr( $dir/$name, " .
6715
                "src: $srcfile, dest: $dir, dist: $dist )" );
6765
                "src: $srcfile, dest: $dir, dist: $dist )" );
6716
 
6766
 
6717
            $package_entry{'src'} = $srcfile;
6767
            $package_entry{'src'} = $srcfile;
Line 6764... Line 6814...
6764
                $extras{$elem} = 1;
6814
                $extras{$elem} = 1;
6765
            }
6815
            }
6766
            %extras = () if ( $extras{'all'} );
6816
            %extras = () if ( $extras{'all'} );
6767
 
6817
 
6768
        } elsif (/^--Strip$/) {                 # Strip path from source files
6818
        } elsif (/^--Strip$/) {                 # Strip path from source files
6769
            $strip = 1;
6819
            $strip = -1;
-
 
6820
 
-
 
6821
        } elsif (/^--Strip=(\d+)$/) {           # Strip some f the path from source files
-
 
6822
            $strip = $1;
6770
 
6823
 
6771
        } elsif (/^--(.*)/) {
6824
        } elsif (/^--(.*)/) {
6772
            Message( "PackageLib: unknown option $_ -- ignored\n" );
6825
            Message( "PackageLib: unknown option $_ -- ignored\n" );
6773
        }
6826
        }
6774
    }
6827
    }
Line 6778... Line 6831...
6778
    foreach ( @elements )
6831
    foreach ( @elements )
6779
    {
6832
    {
6780
        my %package_entry;
6833
        my %package_entry;
6781
        if ( ! /^--(.*)/ )
6834
        if ( ! /^--(.*)/ )
6782
        {
6835
        {
6783
            $_ = StripDir( $_ )
6836
            $_ = StripPath($_, $strip) if ($strip);
6784
                if ( $strip );
-
 
6785
 
6837
 
6786
            $org_lib = $_;                      # Original name
6838
            $org_lib = $_;                      # Original name
6787
            if ( $ScmTargetHost eq "Unix" ) {
6839
            if ( $ScmTargetHost eq "Unix" ) {
6788
                $lib = "lib$_";                 # Prefix "lib" ....
6840
                $lib = "lib$_";                 # Prefix "lib" ....
6789
                $lib =~ s/^liblib/lib/;         # @LIBS already has lib added
6841
                $lib =~ s/^liblib/lib/;         # @LIBS already has lib added
Line 6955... Line 7007...
6955
                $extras{$elem} = 1;
7007
                $extras{$elem} = 1;
6956
            }
7008
            }
6957
            %extras = () if ( $extras{'all'} );
7009
            %extras = () if ( $extras{'all'} );
6958
 
7010
 
6959
        } elsif (/^--Strip$/) {                 # Strip path from source files
7011
        } elsif (/^--Strip$/) {                 # Strip path from source files
6960
            $strip = 1;
7012
            $strip = -1;
-
 
7013
 
-
 
7014
        } elsif (/^--Strip=(\d+)$/) {           # Strip some f the path from source files
-
 
7015
            $strip = $1;
6961
 
7016
 
6962
        } elsif (/^--(.*)/) {
7017
        } elsif (/^--(.*)/) {
6963
            Message( "PackageProg: unknown option $_ -- ignored\n" );
7018
            Message( "PackageProg: unknown option $_ -- ignored\n" );
6964
        }
7019
        }
6965
    }
7020
    }
Line 6971... Line 7026...
6971
        my %package_entry;
7026
        my %package_entry;
6972
        if ( m~descpkg~ ) {
7027
        if ( m~descpkg~ ) {
6973
            PackageFile($platforms, @elements);
7028
            PackageFile($platforms, @elements);
6974
 
7029
 
6975
        } elsif ( ! /^--(.*)/ ) {
7030
        } elsif ( ! /^--(.*)/ ) {
6976
            $_ = StripDir( $_ )
7031
            $_ = StripPath($_, $strip) if ($strip);
6977
                if ( $strip );
-
 
6978
 
7032
 
6979
            my $ext = "";
7033
            my $ext = "";
6980
            $prog = $_;
7034
            $prog = $_;
6981
 
7035
 
6982
            #
7036
            #
Line 8050... Line 8104...
8050
    {
8104
    {
8051
        Warning( "Unable to resolve '$source' path" ) unless -f $source;
8105
        Warning( "Unable to resolve '$source' path" ) unless -f $source;
8052
        return $source;
8106
        return $source;
8053
    }
8107
    }
8054
 
8108
 
-
 
8109
    my @found;
-
 
8110
    # Search the local path first
-
 
8111
    push (@found, $source ) if -f ($source);
8055
 
8112
 
8056
#.. search local path first
-
 
8057
#
-
 
8058
    $count = 0;
-
 
8059
    $first = "";
-
 
8060
    $first = "$source"                              # was ./$source
-
 
8061
        if (-r "$source");
-
 
8062
 
-
 
8063
#.. search directory paths
-
 
8064
#
-
 
8065
    foreach my $dir (@$dirs)
8113
    foreach my $dir (@$dirs)
8066
    {
8114
    {
8067
        next if ( $dir eq '.' );
8115
        next if ( $dir eq '.' );
8068
        my $temp = "$dir/$source";                  # was ./$dir/$source
8116
        my $temp = $dir . '/' . $source;
8069
        Debug2( "MakeResolve: Looking in: $temp" );
8117
        Debug2( "MakeResolve: Looking in: $temp" );
8070
        if (-r "$temp")
-
 
8071
        {
-
 
8072
            if ($first eq "") {
-
 
8073
                $first = $temp;
8118
        push (@found, $temp) if (-f $temp);
8074
            } else {
-
 
8075
                Warning( "Duplicate '$source' image - '$temp'" );
-
 
8076
                $count++;
-
 
8077
            }
-
 
8078
        }
-
 
8079
        Debug3( "MakeResolve: $count, $temp" );
-
 
8080
    }
8119
    }
8081
 
8120
 
8082
    if ($first eq "") {
8121
    Warning( "Unable to resolve path to '$source'" ) unless $found[0];
8083
        $first = $source;
8122
    if (scalar @found > 1)
8084
        Warning( "Unable to resolve '$source' path" );
-
 
8085
    } else {
8123
    {
8086
        Warning( "          using '$first'" )
8124
        Warning("Duplicates for '$source'. Using the first", @found);
8087
            if ($count);
-
 
8088
    }
8125
    }
-
 
8126
 
8089
    return $first;
8127
    return $found[0] || "";
8090
}
8128
}
8091
 
8129
 
8092
#-------------------------------------------------------------------------------
8130
#-------------------------------------------------------------------------------
8093
# Function        : MakeSrcResolve
8131
# Function        : MakeSrcResolve
8094
#
8132
#
Line 8479... Line 8517...
8479
    #       Process additive rules before removal rules
8517
    #       Process additive rules before removal rules
8480
    #       If there are no additive rules, then assume all protaforms
8518
    #       If there are no additive rules, then assume all protaforms
8481
    #
8519
    #
8482
    my %calcList;
8520
    my %calcList;
8483
    @add = @::BUILDPLATFORMS unless @add;
8521
    @add = @::BUILDPLATFORMS unless @add;
8484
    $calcList{$_} = 1 foreach (@add);
8522
    $calcList{uc $_} = 1 foreach (@add);
8485
    delete $calcList{$_} foreach (@remove);
8523
    delete $calcList{uc $_} foreach (@remove);
8486
#DebugDumpData("Add", \@add);
8524
#DebugDumpData("Add", \@add);
8487
#DebugDumpData("Remove", \@remove);
8525
#DebugDumpData("Remove", \@remove);
8488
#DebugDumpData("calcList", \%calcList);
8526
#DebugDumpData("calcList", \%calcList);
8489
 
8527
 
8490
    #
8528
    #
Line 8946... Line 8984...
8946
                "Extend the PERL5LIB seen by invocations of perl");
8984
                "Extend the PERL5LIB seen by invocations of perl");
8947
 
8985
 
8948
    my $perl_module_found;
8986
    my $perl_module_found;
8949
    for my $path ( ToolExtensionPaths() )
8987
    for my $path ( ToolExtensionPaths() )
8950
    {
8988
    {
8951
        if (glob( "$path/*.pm"))
8989
        if (my @results =  glob( "$path/*.pm"))
8952
        {
8990
        {
8953
        MakePrint( "PERL5LIB := $path$::ScmPathSep\$(PERL5LIB)\n" );
8991
            MakePrint( "PERL5LIB := $path$::ScmPathSep\$(PERL5LIB)\n" );
8954
            $perl_module_found = 1;
8992
            $perl_module_found = 1;
8955
        }
8993
        }
8956
    }
8994
    }
8957
    if ( $perl_module_found  )
8995
    if ( $perl_module_found  )
8958
    {
8996
    {