lib/teapot/build.rb in teapot-0.3.1 vs lib/teapot/build.rb in teapot-0.3.2
- old
+ new
@@ -65,21 +65,22 @@
return instance
end
def execute(command, environment, *arguments)
if @configure
- environment = Environment.combine(
- environment,
- Environment.new(&@configure),
- )
+ environment = environment.merge &@configure
end
- environment = environment.flatten.to_string_hash
+ # Flatten the environment to a hash:
+ values = environment.flatten
+
+ puts "Executing command #{command} for #{root}...".color(:cyan)
+
+ # Show the environment to the user:
+ Environment::System::dump(values)
- puts YAML::dump(environment).color(:magenta)
-
- self.send(command, environment, *arguments)
+ self.send(command, values, *arguments)
end
end
class CompilerTarget < Target
def initialize(parent, name, options = {})
@@ -109,18 +110,18 @@
object_file = (build_prefix!(environment) + source_file.basename).sub_ext('.o')
case source_file.extname
when ".cpp"
Commands.run(
- Commands.split(environment[:cxx]),
- Commands.split(environment[:cxxflags]),
+ environment[:cxx],
+ environment[:cxxflags],
"-c", source_file, "-o", object_file
)
when ".c"
Commands.run(
- Commands.split(environment[:cc]),
- Commands.split(environment[:ccflags]),
+ environment[:cc],
+ environment[:cflags],
"-c", source_file, "-o", object_file
)
end
return Array object_file
@@ -189,13 +190,13 @@
def link(environment, objects)
executable_file = build_prefix!(environment) + "#{@name}"
Commands.run(
- Commands.split(environment[:cxx]),
- Commands.split(environment[:cxxflags]),
+ environment[:cxx],
+ environment[:cxxflags],
"-o", executable_file, objects,
- Commands.split(environment[:ldflags])
+ environment[:ldflags]
)
return executable_file
end
end