Module: Teapot::Extractors::LinkerExtractor

Defined in:
lib/teapot/extractors/linker_extractor.rb

Class Method Summary collapse

Class Method Details

.libraries(flags) ⇒ Object

Give back a list of library paths for a specific set of ldflags.



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/teapot/extractors/linker_extractor.rb', line 27

def self.libraries(flags)
	roots = []
	libraries = []
	paths = []

	# Extract include directories:
	flags.each do |option|
		if option.to_s =~ /^-L(.+)/
			roots << Pathname($1)
		elsif option.to_s =~ /^-l(.+)/
			libraries << Pathname($1)
		end
	end

	libraries.each do |name|
		archive_name = "lib#{name}.a"
		
		roots.each do |root|
			archive_path = root + archive_name
			
			paths << archive_path
			
			break
		end
	end
	
	return paths
end