teapot 0.7.3 → 0.7.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ZTYzMjgzYTc0NDJhNWYyMmVjMWM4ZTBkMWUxM2Y4MDgyNmU1OTI4OA==
4
+ MmNjNzk5MTgwZmJlNDE4NzEwY2I2MTdkY2U1M2M5MjRlNGUzYjM1Yw==
5
5
  data.tar.gz: !binary |-
6
- ZDExZGU3NmRmMWMxYjE3MmFlNjY1ZTJkZWUzMmVmZjdlNmRlNjlmYg==
6
+ NTQ4MTAyMTJjMzk4ZjgzYzEwMDhlYWE2ZjMwNjMxM2FlZjdiMDg2OA==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- NWRlNzAwY2Y4YjUwYjY5YmFjOTExNmIzN2RlNjFlOWRkNGQ2MzUxZmQ4OWMx
10
- MTFmYzcwODUxZTBlNTI2MDkzMDYzZjEwNWYwMjY0NDFjOWY4MDFjMjcyNjNh
11
- NjZlOGQ0NzdlYjBjMWIxZTU3MzM4MDdkYzVhNWU0NDZmNDY4ZTc=
9
+ NjFjZTI5YjJiY2JmMjk3NGQxMzkwMTg0YjUxMTQ0YjJhYzI2YTUxNDA3ZGI5
10
+ OWM1MzNmNDRiODNkODJiNzU4NTIyOWYyOWVhMmM3NzE5MDRhZDA4NTFhNzMw
11
+ ZjliYWE5MGZhZWIyMzAyYmQyOWE4MmI1NGE0ZWU3MjZlZTk2N2M=
12
12
  data.tar.gz: !binary |-
13
- NGQxYzFiZGVlNDk1NmZhYTI5NWVlNmFjMjczYjlkYTEyM2VmNGE3YjQ4ZjEx
14
- Y2UwM2QwYjMzZWExM2JiY2RiNDIzN2VmNTljZGQyMDUxY2Y3NmZiZDVhODlh
15
- YjY0MGM0Y2E0NmZkMzg4ODdhYmYxODlkZjMxNjFmNjk2NGUwNGY=
13
+ Yzk0YWZlNDU1ODQ1OGZjNWI2YzAzYmQ5MzgxZTc3YWE2YWM1N2RjNTg1YTI1
14
+ N2Q5MWNlZGY5NzFlODczZmVhZmM1YTNkMzRkOTZjYTlkMTJlMGE0OGJiZDM2
15
+ YjhmMDFkOWVkODIzYjJlOGViMTI3NjlmOWZhNjc2NDdiMzRlNDc=
data/README.md CHANGED
@@ -57,6 +57,12 @@ For Mac OS X (requires Xcode Command Line Tools):
57
57
 
58
58
  You need to make sure any basic tools, e.g. compilers, system libraries, are installed correctly before building. Consult the platform and library documentation for any dependencies.
59
59
 
60
+ ## Dependency Graph
61
+
62
+ Dependency analysis is an important part of efficiently building a source tree. A dependency graph constructed from a single output file depends on the set of input files and their associated implicit dependencies (e.g. `#include` directives), and additionally the environment and task that is being performed. Specifically, the environment can specify additional header files, libraries, or other dependent input files and needs to be considered explicitly.
63
+
64
+ Teapot assumes per-environment dependency graphs and in addition, parts of the dependency graph are generated dynamically. The process of extracting implicit dependencies can be found under `teapot/extractors` and is used extensively in the build graph `teapot/build`.
65
+
60
66
  ## Contributing
61
67
 
62
68
  1. Fork it
@@ -33,7 +33,7 @@ module Teapot
33
33
 
34
34
  graph = Build::dependency_graph(environment)
35
35
 
36
- if graph.regenerate?(executable_file, objects)
36
+ if graph.regenerate?(executable_file, objects + dependent_libraries(environment))
37
37
  Commands.run(
38
38
  environment[:cxx],
39
39
  environment[:cxxflags],
@@ -24,6 +24,7 @@ require 'teapot/build/targets/files'
24
24
  require 'teapot/build/targets/compiler'
25
25
 
26
26
  require 'teapot/build/graph'
27
+ require 'teapot/extractors/linker_extractor'
27
28
 
28
29
  require 'fileutils'
29
30
 
@@ -47,12 +48,16 @@ module Teapot
47
48
  options[:subdirectory] || "lib"
48
49
  end
49
50
 
51
+ def dependent_libraries(environment)
52
+ Extractors::LinkerExtractor.libraries(environment[:ldflags])
53
+ end
54
+
50
55
  def link(environment, objects)
51
56
  library_file = link_prefix!(environment) + "lib#{@name}.a"
52
57
 
53
58
  graph = Build::dependency_graph(environment)
54
59
 
55
- if graph.regenerate?(library_file, objects)
60
+ if graph.regenerate?(library_file, objects + dependent_libraries(environment))
56
61
  Linker.link_static(environment, library_file, objects)
57
62
  end
58
63
 
@@ -55,7 +55,6 @@ module Teapot
55
55
  defined = load(root_package)
56
56
 
57
57
  # Find the default configuration, if it exists:
58
-
59
58
  @default_configuration = defined.default_configuration
60
59
 
61
60
  if options[:configuration]
@@ -118,7 +117,8 @@ module Teapot
118
117
 
119
118
  @generators[definition.name] = definition
120
119
  when Configuration
121
- if definition.public?
120
+ # We define configurations in two cases, if they are public, or if they are part of the root package of this context.
121
+ if definition.public? or definition.package == @root_package
122
122
  # The root package implicitly defines the default configuration.
123
123
  if definition.name == DEFAULT_CONFIGURATION_NAME
124
124
  raise AlreadyDefinedError.new(definition, root_package)
@@ -0,0 +1,57 @@
1
+ # Copyright, 2012, by Samuel G. D. Williams. <http://www.codeotaku.com>
2
+ #
3
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ # of this software and associated documentation files (the "Software"), to deal
5
+ # in the Software without restriction, including without limitation the rights
6
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ # copies of the Software, and to permit persons to whom the Software is
8
+ # furnished to do so, subject to the following conditions:
9
+ #
10
+ # The above copyright notice and this permission notice shall be included in
11
+ # all copies or substantial portions of the Software.
12
+ #
13
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ # THE SOFTWARE.
20
+
21
+ require 'teapot/graph'
22
+
23
+ module Teapot
24
+ module Extractors
25
+ module LinkerExtractor
26
+ # Give back a list of library paths for a specific set of ldflags.
27
+ def self.libraries(flags)
28
+ roots = []
29
+ libraries = []
30
+ paths = []
31
+
32
+ # Extract include directories:
33
+ flags.each do |option|
34
+ if option.to_s =~ /^-L(.+)/
35
+ roots << Pathname($1)
36
+ elsif option.to_s =~ /^-l(.+)/
37
+ libraries << Pathname($1)
38
+ end
39
+ end
40
+
41
+ libraries.each do |name|
42
+ archive_name = "lib#{name}.a"
43
+
44
+ roots.each do |root|
45
+ archive_path = root + archive_name
46
+
47
+ paths << archive_path
48
+
49
+ break
50
+ end
51
+ end
52
+
53
+ return paths
54
+ end
55
+ end
56
+ end
57
+ end
@@ -19,5 +19,5 @@
19
19
  # THE SOFTWARE.
20
20
 
21
21
  module Teapot
22
- VERSION = "0.7.3"
22
+ VERSION = "0.7.5"
23
23
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: teapot
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.3
4
+ version: 0.7.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-04-03 00:00:00.000000000 Z
11
+ date: 2013-05-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rainbow
@@ -114,6 +114,7 @@ files:
114
114
  - lib/teapot/environment/evaluator.rb
115
115
  - lib/teapot/environment/flatten.rb
116
116
  - lib/teapot/environment/system.rb
117
+ - lib/teapot/extractors/linker_extractor.rb
117
118
  - lib/teapot/extractors/preprocessor_extractor.rb
118
119
  - lib/teapot/generator.rb
119
120
  - lib/teapot/graph.rb