Subversion Repositories DevTools

Rev

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

Rev 5867 Rev 5877
Line 3990... Line 3990...
3990
#-------------------------------------------------------------------------------
3990
#-------------------------------------------------------------------------------
3991
# Function        : BuildSharedLibFiles_Unix
3991
# Function        : BuildSharedLibFiles_Unix
3992
#
3992
#
3993
# Description     : Implementation of BuildSharedLibFiles for Unix
3993
# Description     : Implementation of BuildSharedLibFiles for Unix
3994
#                   Extend the Shared Library search path via LD_LIBRARY_PATH
3994
#                   Extend the Shared Library search path via LD_LIBRARY_PATH
-
 
3995
#                   
-
 
3996
#                   Create sonames for all external shared libraries
3995
#
3997
#
3996
# Inputs          : None
3998
# Inputs          : None
3997
#
3999
#
3998
sub BuildSharedLibFiles_Unix
4000
sub BuildSharedLibFiles_Unix
3999
{
4001
{
Line 4001... Line 4003...
4001
    {
4003
    {
4002
        next unless ( exists $BUILDINFO{$platform}{EXT_SHARED} );
4004
        next unless ( exists $BUILDINFO{$platform}{EXT_SHARED} );
4003
        my @unix_paths = BuildSharedLibFiles_list( $platform, $BUILDINFO{$platform}{EXT_SHARED} );
4005
        my @unix_paths = BuildSharedLibFiles_list( $platform, $BUILDINFO{$platform}{EXT_SHARED} );
4004
 
4006
 
4005
        #
4007
        #
-
 
4008
        #   Create sonames for all shared libraries
-
 
4009
        #   Append to the begging of the search list - so that it will rendered last
-
 
4010
        #   
-
 
4011
        my $sodir = BuildSoNameLinks_Unix($platform, @unix_paths);
-
 
4012
        unshift( @unix_paths, $sodir ) if defined $sodir;
-
 
4013
 
-
 
4014
        #
4006
        #   Create a .sh file for Unix
4015
        #   Create a .sh file for Unix
4007
        #
4016
        #
4008
        my $file = "$BUILDINTERFACE/set_$platform.sh";
4017
        my $file = "$BUILDINTERFACE/set_$platform.sh";
4009
        my $fh = ::ConfigurationFile::New( $file , '--NoEof', '--Type=sh' );
4018
        my $fh = ::ConfigurationFile::New( $file , '--NoEof', '--Type=sh' );
4010
        $fh->Header( "Buildlib ($BuildVersion)","Shared Library Paths" );
4019
        $fh->Header( "Buildlib ($BuildVersion)","Shared Library Paths" );
Line 4021... Line 4030...
4021
        chmod 0755, $file;
4030
        chmod 0755, $file;
4022
    }
4031
    }
4023
}
4032
}
4024
 
4033
 
4025
#-------------------------------------------------------------------------------
4034
#-------------------------------------------------------------------------------
-
 
4035
# Function        : BuildSoNameLinks_Unix 
-
 
4036
#
-
 
4037
# Description     : Generate soname links for all shared libraries from external
-
 
4038
#                   packages.
-
 
4039
#                   
-
 
4040
#                   There is a bit of a cheat. We don't examine the library to determine
-
 
4041
#                   the soname. We simple create all possible sonames to the library
-
 
4042
#
-
 
4043
# Inputs          : $platform       - Target platform
-
 
4044
#                   @paths          - Array of paths to scan for libraries 
-
 
4045
#
-
 
4046
# Returns         : soLinkDir       - Absolute path to the directory of gernerated
-
 
4047
#                                     symlinks
-
 
4048
#
-
 
4049
sub BuildSoNameLinks_Unix
-
 
4050
{
-
 
4051
    my ($platform, @paths) = @_;
-
 
4052
    my $soLinkDir = catdir($BUILDINTERFACE, 'soLinks', $platform );
-
 
4053
 
-
 
4054
    Verbose("Create Unix SoName links - $soLinkDir");
-
 
4055
    RmDirTree( $soLinkDir );
-
 
4056
 
-
 
4057
    #
-
 
4058
    #   Search provided library paths for shared libaries
-
 
4059
    #       These are names of the form *.so.* ie : libz.so.1.2.5
-
 
4060
    #
-
 
4061
    foreach my $path (@paths)
-
 
4062
    {
-
 
4063
        foreach my $file (glob(catdir($path, '*.so.*')))
-
 
4064
        {
-
 
4065
            #
-
 
4066
            #   Skip the debug symbol files
-
 
4067
            #
-
 
4068
            next if $file =~ m~\.debug$~;
-
 
4069
            next if $file =~ m~\.dbg$~;
-
 
4070
 
-
 
4071
            #
-
 
4072
            #   Generate all possible sonames by removing .nnnn from the 
-
 
4073
            #   end of the file name
-
 
4074
            #   
-
 
4075
            my $sofile = $file;
-
 
4076
            while ($sofile =~ m~(.*)\.\d+$~)
-
 
4077
            {
-
 
4078
                $sofile = $1;
-
 
4079
                unless (-f $sofile) {
-
 
4080
                    Verbose2("Need Soname: $sofile");
-
 
4081
 
-
 
4082
                    #
-
 
4083
                    #   Create link from soname to full name
-
 
4084
                    #   
-
 
4085
                    mkpath ( $soLinkDir ) unless -d $soLinkDir;
-
 
4086
                    my $sofilename = $sofile;
-
 
4087
                    $sofilename =~ s~.*/~~;
-
 
4088
                    $sofilename = catdir($soLinkDir, $sofilename);
-
 
4089
                    unless (-f $sofilename) {
-
 
4090
                        symlink ($file, $sofilename) || Error ("Cannot create symlink to $sofilename. $!"); 
-
 
4091
                    }
-
 
4092
                }
-
 
4093
            }
-
 
4094
        }
-
 
4095
    }
-
 
4096
 
-
 
4097
    #
-
 
4098
    #   Return the path the generated soLink dir
-
 
4099
    #
-
 
4100
    return AbsPath($soLinkDir) if (-d $soLinkDir);
-
 
4101
    return undef;
-
 
4102
}
-
 
4103
 
-
 
4104
#-------------------------------------------------------------------------------
4026
# Function        : BuildSharedLibFiles_list
4105
# Function        : BuildSharedLibFiles_list
4027
#
4106
#
4028
# Description     : Determine a list of Shared Library paths that can be used
4107
# Description     : Determine a list of Shared Library paths that can be used
4029
#                   by the current target
4108
#                   by the current target
4030
#
4109
#