module L::LD::Linker

An abstraction for a linker.

Public Class Methods

available?() click to toggle source

Is this linker available on this system?

@return [true,false] true if the linker is available.

# File lib/rub/l/ld.rb, line 107
def self.available?
        false
end
builtin_library_path() click to toggle source

Return the linker’s builtin library path.

@return [Array<Pathname>]

# File lib/rub/l/ld.rb, line 114
def self.builtin_library_path
        @builtin_library_path ||= [
                '/lib/',
                '/usr/lib/',
                '/usr/local/lib/',
                '~/.local/lib/',
        ].map do |l|
                C.path(l)
        end.uniq
end
find_lib(opt, name) click to toggle source

Locate a library.

Locates the library that would be used with when linking.

@param name [String] The basename of the library. @param options [Options] The options to use when linking. @return [Pathname] The path to the library.

# File lib/rub/l/ld.rb, line 191
def self.find_lib(opt, name)
        sp = library_path(opt)
        if name.to_s.include? '/'
                return C.path name
        end
        name = full_name name, (opt.static ? :static : :shared)
        
        sp.each do |d|
                l = d + name
                
                l.exist? and return l
        end
end
full_name(base, type) click to toggle source

Generate an appropriate name.

@param base [String] The basename. @param type [Symbol] The output format. @return [String] A suitable name for the output type on the

current machine.
# File lib/rub/l/ld.rb, line 180
def self.full_name(base, type)
        @@name_map[type] % base
end
library_path(opt) click to toggle source

Return the path which to search for libraries.

@return [Array<Pathname>]

# File lib/rub/l/ld.rb, line 128
def self.library_path(opt)
        opt.library_dirs + builtin_library_path
end
name() click to toggle source

The name of the linker. @return [Symbol]

# File lib/rub/l/ld.rb, line 100
def self.name
        :default
end