Compare commits

...

57 Commits

Author SHA1 Message Date
8f0f320a07 v3.0.2 2022-03-14 00:36:17 -04:00
12f6936084 Update CHANGELOG for v3.0.2 2022-03-14 00:36:05 -04:00
866b40d872 Configure parameters should not be stored as unscoped construction variables - close #160 2022-03-14 00:34:52 -04:00
f06d37c8b9 Compiler check configure methods should respect :use flag - close #159 2022-03-14 00:27:02 -04:00
21f8e2435e v3.0.1 2022-03-13 22:27:16 -04:00
97c4f7c757 Update CHANGELOG for v3.0.1 2022-03-13 22:27:16 -04:00
b3df37e9ea Do not configure for clean tasks when not yet configured - close #158 2022-03-13 22:27:16 -04:00
1bf1c30242 Load configure task arguments before early configure operations - close #157 2022-03-13 20:16:01 -04:00
b932380b3b Avoid running configure operation twice - close #156 2022-03-11 21:17:07 -05:00
e3ea429253 Fix running dspec task with argument 2022-03-11 21:13:52 -05:00
dca4c49770 Avoid trailing spaces in distributable script 2022-03-07 21:08:17 -05:00
b068fe7574 Test that custom clean task action blocks are execution 2022-02-28 11:59:52 -05:00
ecd91e1171 v3.0.0 2022-02-27 20:55:16 -05:00
f36b71af3f Fix ARCMD spec for Linux and MacOS 2022-02-27 19:16:59 -05:00
90c3867cae Tweak specs to all pass cleanly on MacOS 2022-02-27 19:10:18 -05:00
20b5020284 bundle update 2022-02-27 18:06:39 -05:00
cb540741a4 Clarify task parameter construction variable names 2022-02-27 17:44:01 -05:00
bc17a9b38f Test that clean task does not process environments 2022-02-27 17:34:48 -05:00
cec1331054 Rename build specs from operation to task 2022-02-27 17:34:38 -05:00
bb4657e465 Process environments created during task execution phase 2022-02-27 16:55:59 -05:00
29ca9b3f13 Fix YARD warnings 2022-02-27 16:40:09 -05:00
5ab982b84c Add GCC Cross Compiler example build script 2022-02-27 16:28:09 -05:00
e6e860e3c1 Document download build script method 2022-02-27 16:27:24 -05:00
3cfffed7ec Document spawn options to sh method 2022-02-27 16:07:35 -05:00
b2d47cd439 Document ^^/ prefix 2022-02-27 16:05:28 -05:00
6a10d68fac Expand CLI usage printout 2022-02-27 16:02:00 -05:00
88a8f2395d Update user guide for v3.0.0
Document variants
2022-02-27 15:51:20 -05:00
b82d6f2e62 Include user guide Overview section in README.md 2022-02-27 12:56:23 -05:00
150943f23f Update CHANGELOG.md for v3.0.0 2022-02-27 12:52:59 -05:00
59f1a89f4f Add -A CLI flag to show all tasks 2022-02-27 12:41:47 -05:00
ea66501311 Show variants in -T output 2022-02-22 15:46:19 -05:00
e9e3c6711f Add build_dir script method - close #155 2022-02-20 18:13:59 -05:00
8269a98d01 Add variants - close #137 2022-02-20 08:54:33 -05:00
19dee2b2a5 Add variants - #137
Add build script methods: variant, variant_group, with_variants
2022-02-16 12:23:30 -05:00
5b6353395d Store configure task parameters in configuration cache data - close #151 2022-02-14 21:52:35 -05:00
7e5c6e6b12 Store task parameter values in a Hash 2022-02-13 12:46:26 -05:00
44f61da571 Only configure if necessary - close #131 2022-02-12 23:18:00 -05:00
5c28e557bd Sort task output with -T 2022-02-12 22:14:10 -05:00
ef7e9259cb Add shortcut method for creating environments - close #149
Add env() method to create environments.
Process all environments created at build script top level before
executing any autoconf-enabled tasks, or if no tasks are specified by
the user.
2022-02-12 21:59:52 -05:00
6d5f44d4e5 Allow passing spawn options to sh - close #153 2022-02-06 14:02:26 -05:00
8b2387f7a3 Add download script method - close #152 2022-02-05 16:51:52 -05:00
7b746db64e Tweak user guide styling; remove gradient border 2022-01-30 22:04:04 -05:00
3aca248e9d Minor CHANGELOG fix 2022-01-30 22:03:43 -05:00
3914dd896c Remove references to build operation in the user guide 2022-01-30 21:56:42 -05:00
df120af953 Add env.expand() shortcut method to expand paths and construction variables - close #150 2022-01-30 15:00:59 -05:00
b745ae1153 Add license/copyright to distributable script - close #148 2022-01-30 13:49:22 -05:00
693f8cec64 Update LICENSE copyright 2022-01-30 13:46:42 -05:00
e12acccd33 Fix large project generated script 2022-01-30 13:46:23 -05:00
bd9cf55b85 Add tasks - close #139 2022-01-30 13:45:06 -05:00
f5ab51c477 Add ^^/ shortcut to top-level build directory - close #146 2022-01-21 20:45:05 -05:00
b0f2bbb7d5 Support environment variable to set rscons build directory - close #145 2022-01-17 18:02:58 -05:00
c1dcfa297f Add FileUtils class methods to script DSL - close #144 2022-01-17 16:41:36 -05:00
034dbcd9a6 Update ruby-doc.org URL 2022-01-17 16:03:08 -05:00
b5d5fe7a7b Add 'sh' script DSL method - close #142 2022-01-17 15:57:34 -05:00
610b8f1266 Add Size builder - close #143 2022-01-17 12:50:38 -05:00
a316c4f922 Support naming environments - close #140 2022-01-13 12:56:23 -05:00
97dbaeb82d Move rsconscache into build directory - close #136 2022-01-09 23:08:28 -05:00
190 changed files with 4080 additions and 1873 deletions

View File

@ -1,3 +1,40 @@
## v3.0.2
### Fixes
- #159 - Compiler check configure methods should respect :use flag
- #160 - Configure parameters should not be stored as unscoped construction variables
## v3.0.1
### Fixes
- #156 - Avoid running configure operation twice
- #157 - Load configure task arguments before early configure operations
- #158 - Do not configure for clean tasks when not yet configured
## v3.0.0
- #136 - Move rsconscache into build directory
- #140 - Support naming environments
- #143 - Add Size builder
- #142 - Add 'sh' script DSL method
- #144 - Add FileUtils class methods to script DSL
- #145 - Support environment variable to set rscons build directory
- #146 - Add ^^/ shortcut to top-level build directory
- #139 - Add tasks
- #147 - Add task options
- #148 - Add license/copyright to distributable script
- #150 - Add env.expand() shortcut method to expand paths and construction variables
- #152 - Add download script method
- #153 - Allow passing spawn options to sh
- #154 - Record build directory absolute path
- #149 - Add shortcut method for creating environments
- #131 - Only configure if necessary
- #151 - Store configure task parameters in configuration cache data
- #137 - Add variants
- #155 - Add build_dir script method
## v2.3.0
### New Features
@ -7,7 +44,7 @@
### Fixes
- #121 - env.depends() does not work with built-root-relative "^/" paths
- #121 - env.depends() does not work with build-root-relative "^/" paths
- #130 - Document -f command line option
- #133 - Clarify failed command error message indicating to run -F
- #134 - Document CMD_STDOUT variable for Command builder

View File

@ -1,32 +1,38 @@
GEM
remote: https://rubygems.org/
specs:
diff-lcs (1.4.4)
diff-lcs (1.5.0)
docile (1.1.5)
json (2.5.1)
json (2.6.1)
psych (4.0.3)
stringio
rake (13.0.6)
rdoc (6.3.2)
rdoc (6.4.0)
psych (>= 4.0.0)
redcarpet (3.5.1)
rspec (3.10.0)
rspec-core (~> 3.10.0)
rspec-expectations (~> 3.10.0)
rspec-mocks (~> 3.10.0)
rspec-core (3.10.1)
rspec-support (~> 3.10.0)
rspec-expectations (3.10.1)
rspec (3.11.0)
rspec-core (~> 3.11.0)
rspec-expectations (~> 3.11.0)
rspec-mocks (~> 3.11.0)
rspec-core (3.11.0)
rspec-support (~> 3.11.0)
rspec-expectations (3.11.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.10.0)
rspec-mocks (3.10.2)
rspec-support (~> 3.11.0)
rspec-mocks (3.11.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.10.0)
rspec-support (3.10.2)
rspec-support (~> 3.11.0)
rspec-support (3.11.0)
simplecov (0.15.1)
docile (~> 1.1.0)
json (>= 1.8, < 3)
simplecov-html (~> 0.10.0)
simplecov-html (0.10.2)
stringio (3.0.1)
syntax (1.2.2)
yard (0.9.26)
webrick (1.7.0)
yard (0.9.27)
webrick (~> 1.7.0)
PLATFORMS
ruby
@ -43,4 +49,4 @@ DEPENDENCIES
yard
BUNDLED WITH
2.1.4
2.2.31

View File

@ -1,4 +1,4 @@
Copyright (c) 2013-2019 Josh Holtrop
Copyright (c) 2013-2022 Josh Holtrop
MIT License

View File

@ -4,7 +4,39 @@
Rscons (https://github.com/holtrop/rscons) is an open-source build system
for developers.
It supports the following features:
Rscons is written in Ruby, and is inspired by [SCons](https://scons.org/) and [waf](https://waf.io/).
* multi-threaded job execution
* auto-configuration
* built-in builders for several common operations
* out-of-the-box support for C, C++, and D languages
* extensibility for other languages or custom builders
* compatible with Windows, Linux, OS X, and FreeBSD
* colorized output with build progress
* build hooks
* user-defined tasks with dependencies and custom parameters
* build variants
At its core, Rscons is mainly an engine to:
* determine the proper order to perform build steps,
* determine whether each build target is up to date or in need of rebuild, and
* schedule those build steps across multiple threads as efficiently as possible.
Along the way, Rscons provides a concise syntax for specifying common types of
build steps, but also provides an extensible framework for performing
custom build operations as well.
Rscons takes inspiration from:
* [SCons](https://scons.org/)
* [waf](https://waf.io/)
* [rake](https://github.com/ruby/rake)
* [CMake](https://cmake.org/)
* [Autoconf](https://www.gnu.org/software/autoconf/)
Rscons is written in Ruby.
The only requirement to run Rscons is that the system has a Ruby interpreter
installed.
See [https://holtrop.github.io/rscons/index.html](https://holtrop.github.io/rscons/index.html) for User Guide and Installation instructions.

View File

@ -35,7 +35,7 @@ task :dspec, [:example_string] => :build_dist do |task, args|
FileUtils.mkdir_p("test")
FileUtils.cp("dist/rscons", "test/rscons.rb")
ENV["dist_specs"] = "1"
Rake::Task["spec"].execute(args.example_string)
Rake::Task["spec"].execute(args)
ENV.delete("dist_specs")
FileUtils.rm_f(Dir.glob(".rscons-*"))
end
@ -76,7 +76,7 @@ task :gen_large_project, [:size] => :build_dist do |task, args|
end
File.open("large_project/Rsconscript", "w") do |fh|
fh.puts <<EOF
build do
default do
Environment.new do |env|
env.Program("project", glob("src/*.c"))
end

View File

@ -3,5 +3,5 @@
require "rscons/cli"
if __FILE__ == $0
Rscons::Cli.run(ARGV)
Rscons::Cli.new.run(ARGV)
end

View File

@ -1,6 +1,4 @@
build do
Environment.new do |env|
env do |env|
env.CFile("lexer.c", "lexer.l")
env.CFile("parser.c", "parser.y")
end
end

View File

@ -1,5 +1,3 @@
build do
Environment.new do |env|
env do |env|
env.CFile("file.c", "foo.bar")
end
end

View File

@ -1,5 +1,4 @@
build do
debug = Environment.new(echo: :command) do |env|
debug = env(echo: :command) do |env|
env['CFLAGS'] = '-O2'
env['CPPFLAGS'] = '-DSTRING="Debug Version"'
env.Program('program-debug.exe', Dir['src/*.c'])
@ -9,4 +8,3 @@ build do
env["CPPFLAGS"] = '-DSTRING="Release Version"'
env.Program('program-release.exe', Dir['src/*.c'])
end
end

View File

@ -1,5 +1,4 @@
build do
env1 = Environment.new(echo: :command) do |env|
env1 = env(echo: :command) do |env|
env['CFLAGS'] = '-O2'
env.add_build_hook do |builder|
builder.vars['CPPFLAGS'] = '-DSTRING="Hello"'
@ -13,4 +12,3 @@ build do
env2 = env1.clone do |env|
env.Program('program2.exe', Dir['src/*.c'])
end
end

View File

@ -1,3 +1,4 @@
configure do
check_c_compiler "nope.nope"
end
default

View File

@ -1 +1,3 @@
autoconf false
env do |env|
end

View File

@ -3,8 +3,6 @@ configure do
check_c_header "stdio.h"
end
build do
Environment.new do |env|
env do |env|
env.Program("simple.exe", "simple.c")
end
end

View File

@ -1,3 +1,4 @@
configure do
check_c_compiler
end
default

View File

@ -0,0 +1,6 @@
configure do
check_c_compiler "clang"
end
env do |env|
env.Program("simple.exe", "simple.c")
end

View File

@ -0,0 +1,12 @@
configure do
check_c_compiler "clang", use: "clang"
check_c_compiler
end
env "t1" do |env|
env.Program("test_gcc.exe", "simple.c")
end
env "t2", use: "clang" do |env|
env.Program("test_clang.exe", "simple.c")
end

View File

@ -3,8 +3,6 @@ configure do
check_c_header "frobulous.h", check_cpppath: ["./usr2"]
end
build do
Environment.new do |env|
env do |env|
env.Object("test.o", "test.c")
end
end

View File

@ -2,8 +2,6 @@ configure do
check_c_header "not___found.h", set_define: "HAVE_NOT___FOUND_H"
end
build do
Environment.new(echo: :command) do |env|
env(echo: :command) do |env|
env.Object("simple.o", "simple.c")
end
end

View File

@ -2,8 +2,6 @@ configure do
check_c_header "string.h", set_define: "HAVE_STRING_H"
end
build do
Environment.new(echo: :command) do |env|
env(echo: :command) do |env|
env.Object("simple.o", "simple.c")
end
end

View File

@ -2,8 +2,6 @@ configure do
check_cfg program: "my-config"
end
build do
Environment.new(echo: :command) do |env|
env(echo: :command) do |env|
env.Program("myconfigtest", "simple.c")
end
end

View File

@ -2,8 +2,6 @@ configure do
check_cfg package: "mypackage"
end
build do
Environment.new(echo: :command) do |env|
env(echo: :command) do |env|
env.Program("myconfigtest", "simple.c")
end
end

View File

@ -2,14 +2,12 @@ configure do
check_cfg package: "mypackage", use: "myp"
end
build do
Environment.new(echo: :command) do |env|
env(echo: :command) do |env|
env.Copy("myconfigtest1.c", "simple.c")
env.Program("myconfigtest1.exe", "myconfigtest1.c")
end
Environment.new(echo: :command, use: "myp") do |env|
env(echo: :command, use: "myp") do |env|
env.Copy("myconfigtest2.c", "simple.c")
env.Program("myconfigtest2.exe", "myconfigtest2.c")
end
end

View File

@ -0,0 +1,12 @@
configure do
check_cxx_compiler "clang++", use: "clang"
check_cxx_compiler
end
env "t1" do |env|
env.Program("test_gcc.exe", "simple.cc")
end
env "t2", use: "clang" do |env|
env.Program("test_clang.exe", "simple.cc")
end

View File

@ -3,8 +3,6 @@ configure do
check_cxx_header "frobulous.h", check_cpppath: ["./usr2"]
end
build do
Environment.new do |env|
env do |env|
env.Object("test.o", "test.cc")
end
end

View File

@ -0,0 +1,12 @@
configure do
check_d_compiler "ldc2", use: "ldc2"
check_d_compiler
end
env "t1" do |env|
env.Program("test_gcc.exe", "simple.d")
end
env "t2", use: "ldc2" do |env|
env.Program("test_ldc2.exe", "simple.d")
end

View File

@ -4,8 +4,6 @@ configure do
check_d_import "frobulous", check_d_import_path: ["./usr2"]
end
build do
Environment.new do |env|
env do |env|
env.Object("test.o", "test.d")
end
end

View File

@ -1,5 +1,3 @@
build do
Environment.new(echo: :command) do |env|
env(echo: :command) do |env|
env.Library("usr2/libfrobulous.a", "two.c")
end
end

View File

@ -3,8 +3,6 @@ configure do
check_lib "frobulous", check_libpath: ["./usr2"]
end
build do
Environment.new(echo: :command) do |env|
env(echo: :command) do |env|
env.Program("simple.exe", "simple.c")
end
end

View File

@ -2,8 +2,6 @@ configure do
check_lib "m"
end
build do
Environment.new(echo: :command) do |env|
env(echo: :command) do |env|
env.Program("simple.exe", "simple.c")
end
end

View File

@ -2,14 +2,12 @@ configure do
check_lib "m", use: :m
end
build do
Environment.new(echo: :command) do |env|
env(echo: :command) do |env|
env.Copy("test1.c", "simple.c")
env.Program("test2.exe", "test1.c")
end
Environment.new(echo: :command, use: %w[m]) do |env|
env(echo: :command, use: %w[m]) do |env|
env.Copy("test2.c", "simple.c")
env.Program("test2.exe", "test2.c")
end
end

View File

@ -2,9 +2,7 @@ configure do
check_lib "m", use: false
end
build do
Environment.new(echo: :command) do |env|
env(echo: :command) do |env|
env.Copy("test1.c", "simple.c")
env.Program("test2.exe", "test1.c")
end
end

View File

@ -0,0 +1,6 @@
configure do
check_c_compiler
end
env do |env|
puts "Prefix is #{Task["configure"]["prefix"]}"
end

View File

@ -23,8 +23,6 @@ configure do
end
end
build do
Environment.new do |env|
env do |env|
puts env["CPPDEFINES"]
end
end

View File

@ -1,3 +0,0 @@
Environment.new do |env|
env.Object("simple.o", "simple.cc")
end

View File

@ -3,8 +3,6 @@ configure do
check_c_header "stdio.h", set_define: "HAVE_STDIO_H"
end
build do
Environment.new(echo: :command) do |env|
env(echo: :command) do |env|
env.Object("simple.o", "simple.c")
end
end

View File

@ -0,0 +1,3 @@
default do
puts "default"
end

View File

@ -0,0 +1,6 @@
#include <iostream>
int main(int argc, char *argv[])
{
std::cout << "Hi" << std::endl;
}

View File

@ -0,0 +1,7 @@
import std.stdio;
int main()
{
writeln("Hello");
return 0;
}

View File

@ -9,10 +9,8 @@ EOF
end
end
build do
Environment.new do |env|
env do |env|
env.add_builder(MySource)
env.MySource('inc.h', [])
env.Program('program.exe', Dir['*.c'])
end
end

View File

@ -1,5 +1,4 @@
build do
Environment.new do |env|
env do |env|
env.Command("inc.c",
[],
"CMD" => %w[ruby gen.rb ${_TARGET}],
@ -10,4 +9,3 @@ build do
env.build_after("program.o", "${inc_c}")
env.Program("program.exe", ["program.o", "inc.c"])
end
end

View File

@ -9,12 +9,10 @@ EOF
end
end
build do
env = Environment.new do |env|
env = env do |env|
env["hdr"] = "inc.h"
env["src"] = "program.c"
env.add_builder(MySource)
env.MySource('${hdr}')
env.Program('program.exe', "${src}")
end
end

View File

@ -9,8 +9,7 @@ EOF
end
end
build do
e1 = Environment.new do |env|
e1 = env do |env|
env.add_builder(MySource)
env["one"] = "5"
env[:cfg] = {val: "9"}
@ -27,4 +26,3 @@ build do
env.MySource('inc.h', [])
env.Program('program.exe', Dir['*.c'])
end
end

View File

@ -1,8 +1,6 @@
build do
Environment.new do |env|
env do |env|
env.add_builder(:MyBuilder) do |options|
"hi"
end
env.MyBuilder("foo")
end
end

View File

@ -1,8 +1,6 @@
build do
Environment.new do |env|
env do |env|
env.add_builder(:MyBuilder) do |options|
wait_for(1)
end
env.MyBuilder("foo")
end
end

View File

@ -12,10 +12,8 @@ class CHGen < Rscons::Builder
end
end
build do
Environment.new do |env|
env do |env|
env.add_builder(CHGen)
env.CHGen("inc.c", ["program.c"])
env.Program("program.exe", %w[program.c inc.c])
end
end

View File

@ -1,5 +1,4 @@
build do
Environment.new do |env|
env do |env|
env["build_root"] = env.build_root
env["inc_h"] = "inc.h"
@ -14,4 +13,3 @@ build do
"CMD_DESC" => "Generating")
inc_c.produces("inc.h")
end
end

View File

@ -1,5 +1,4 @@
build do
Environment.new do |env|
env do |env|
env["build_root"] = env.build_root
env["inc_h"] = "inc.h"
@ -14,4 +13,3 @@ build do
"CMD_DESC" => "Generating")
env.produces("inc.c", "inc.h")
end
end

View File

@ -13,9 +13,7 @@ class MyBuilder < Rscons::Builder
end
end
build do
Environment.new do |env|
env do |env|
env.add_builder(MyBuilder)
env.MyBuilder("foo")
end
end

View File

@ -2,8 +2,6 @@ configure do
check_d_compiler "gdc"
end
build do
Environment.new(echo: :command) do |env|
env(echo: :command) do |env|
env.Program("hello-d.exe", glob("*.d"))
end
end

View File

@ -2,8 +2,6 @@ configure do
check_d_compiler "ldc2"
end
build do
Environment.new(echo: :command) do |env|
env(echo: :command) do |env|
env.Program("hello-d.exe", glob("*.d"))
end
end

View File

@ -1,7 +1,5 @@
build do
Environment.new(echo: :command) do |env|
env(echo: :command) do |env|
env.Object("main.o", "main.d")
env.Object("mod.o", "mod.d")
env.Program("hello-d.exe", ["main.o", "mod.o"])
end
end

View File

@ -1,5 +1,3 @@
build do
Environment.new do |env|
env do |env|
env.Program("test.exe", glob("*.c"), direct: true)
end
end

View File

@ -1,7 +1,5 @@
build do
Environment.new do |env|
env do |env|
lib = env.SharedLibrary("mylib", ["two.c", "three.c"], direct: true)
program = env.Program("test.exe", "main.c", "LIBS" => ["mylib"], "LIBPATH" => ["."])
env.depends(program, lib)
end
end

View File

@ -1,5 +1,3 @@
build do
Environment.new do |env|
env do |env|
env.Program('header.exe', Dir['*.c'])
end
end

View File

@ -1,5 +1,4 @@
build do
Environment.new do |env|
env do |env|
require 'json'
require 'yaml'
env.add_builder(:JsonToYaml) do |params|
@ -15,4 +14,3 @@ build do
end
env.JsonToYaml('foo.yml', 'foo.json')
end
end

View File

@ -1,6 +1,7 @@
build do
Environment.new(echo: :command) do |env|
env.Program('library.exe', ['lib.a', 'three.c'])
env.Library("lib.a", ['one.c', 'two.c'], 'CPPFLAGS' => ['-Dmake_lib'])
end
env(echo: :command) do |env|
env["LIBS"] << "mylib"
env["LIBPATH"] << "."
env.Program("library.exe", "one.c")
env.depends("library.exe", "libmylib.a")
env.Library("libmylib.a", ["two.c", "three.c"], "CPPFLAGS" => ["-Dmake_lib"])
end

View File

@ -1,7 +1,5 @@
build do
Environment.new do |env|
env do |env|
env.Program("library.exe", ["lib.a", "three.c"])
env.Object("two.o", "two.c")
env.Library("lib.a", ["one.c", "two.o"], 'CPPFLAGS' => ['-Dmake_lib'])
end
end

View File

@ -1,8 +1,11 @@
#include <stdio.h>
#ifdef make_lib
void two();
void three();
int main(int argc, char *argv[])
{
two();
printf("Library\n");
three();
}
#endif

View File

@ -1,6 +1,4 @@
build do
Environment.new(echo: :command) do |env|
env["ARCMD"] = %w[ar rcf ${_TARGET} ${_SOURCES}]
env(echo: :command) do |env|
env["ARCMD"] = %w[ar rc ${_TARGET} ${_SOURCES}]
env.Library("lib.a", glob("*.c"))
end
end

View File

@ -0,0 +1,3 @@
void three(void)
{
}

View File

@ -0,0 +1,3 @@
void two(void)
{
}

View File

@ -1,5 +1,3 @@
build do
Environment.new do |env|
env do |env|
env.Program("foo.exe", glob("*.cc", "*.c"))
end
end

View File

@ -1,5 +1,3 @@
build do
Environment.new do |env|
env do |env|
env.Preprocess("pp", "foo.h")
end
end

View File

@ -1,5 +1,4 @@
build do
Environment.new do |env|
env do |env|
env["CPPPATH"] << "src/lib"
libmine = env.SharedLibrary("mine", glob("src/lib/*.c"))
env.Program("test-shared.exe",
@ -10,4 +9,3 @@ build do
env.Program("test-static.exe",
glob("src/**/*.c"))
end
end

View File

@ -1,8 +1,6 @@
build do
Environment.new do |env|
env do |env|
File.open("foo.xyz", "wb") do |fh|
fh.puts("hi")
end
env.SharedObject("foo.o", "foo.xyz")
end
end

View File

@ -1,7 +1,5 @@
build do
Environment.new do |env|
env do |env|
env["CPPPATH"] << "src/lib"
env.Object("file.S", "src/lib/one.c", "CFLAGS" => env["CFLAGS"] + ["-S"])
libmine = env.SharedLibrary("mine", "file.S")
end
end

View File

@ -1,5 +1,4 @@
build do
Environment.new do |env|
env do |env|
env["CPPPATH"] << "src/lib"
libmine = env.SharedLibrary("mine", glob("src/lib/*.cc"))
env.Program("test-shared.exe",
@ -10,4 +9,3 @@ build do
env.Program("test-static.exe",
glob("src/**/*.cc"))
end
end

View File

@ -1,5 +1,4 @@
build do
Environment.new do |env|
env do |env|
env["CPPPATH"] << "src/lib"
libmine = env.SharedLibrary("mine", glob("src/lib/*.d"))
env.Program("test-shared.exe",
@ -8,4 +7,3 @@ build do
"LIBS" => %w[mine])
env.build_after("test-shared.exe", libmine)
end
end

View File

@ -1,7 +1,5 @@
build do
Environment.new do |env|
env do |env|
env["CPPPATH"] << "src/lib"
env.SharedObject("one.o", "src/lib/one.c")
libmine = env.SharedLibrary("mine", ["one.o", "src/lib/two.c"])
end
end

View File

@ -1,5 +1,4 @@
build do
Environment.new do |env|
env do |env|
env["CPPPATH"] << "src/lib"
env["SHLD"] = "gcc"
libmine = env.SharedLibrary("mine", glob("src/lib/*.c"))
@ -11,4 +10,3 @@ build do
env.Program("test-static.exe",
glob("src/**/*.c"))
end
end

View File

@ -1,5 +1,3 @@
build do
Environment.new do |env|
env do |env|
env.Program('simple.exe', Dir['*.c'])
end
end

View File

@ -1,5 +1,4 @@
build do
Environment.new(echo: :command) do |env|
env(echo: :command) do |env|
tempdir = ENV["TEMP"] || ENV["TMP"] || "/tmp"
source_file = File.join(tempdir, "abs.c")
File.open(source_file, "w") do |fh|
@ -12,4 +11,3 @@ build do
end
env.Program("abs.exe", source_file)
end
end

View File

@ -10,8 +10,7 @@ class ThreadedTestBuilder < Rscons::Builder
end
end
build do
Environment.new do |env|
env do |env|
env.add_builder(ThreadedTestBuilder)
env.ThreadedTestBuilder("T3", [], "delay" => 3)
env.ThreadedTestBuilder("T2", [], "delay" => 1.0)
@ -21,4 +20,3 @@ build do
env.ThreadedTestBuilder("T5", [], "delay" => 1.0)
env.ThreadedTestBuilder("T4", [], "delay" => 0.5)
end
end

View File

@ -1,6 +1,4 @@
build do
Environment.new do |env|
env do |env|
object = env.Object("simple.o", "simple.c")
env.Program("simple.exe", object)
end
end

View File

@ -3,9 +3,8 @@ class TestBuilder < Rscons::Builder
true
end
end
build do
Environment.new do |env|
env do |env|
env.add_builder(TestBuilder)
env.TestBuilder("file")
end
end

View File

@ -14,10 +14,8 @@ class MyObject < Rscons::Builder
end
end
build do
Environment.new do |env|
env do |env|
env.add_builder(MyObject)
env.MyObject("simple.o", "simple.c")
env.Program("simple.exe", "simple.o")
end
end

View File

@ -1,6 +1,4 @@
build do
Environment.new do |env|
env do |env|
env["LIBS"] += ["m"]
env.Program('simple.exe', Dir['*.c'])
end
end

View File

@ -4,17 +4,17 @@ class DebugBuilder < Rscons::Builder
finalize_command
else
@command = %W[gcc -c -o #{@target} #{@sources.first}]
if Rscons.vars["command_change"]
if ENV["test"] == "command_change"
@command += %w[-Wall]
end
if Rscons.vars["new_dep"]
if ENV["test"] == "new_dep"
@sources += ["extra"]
end
if Rscons.vars["strict_deps1"]
if ENV["test"] == "strict_deps1"
@sources += ["extra"]
strict_deps = true
end
if Rscons.vars["strict_deps2"]
if ENV["test"] == "strict_deps2"
@sources = ["extra"] + @sources
strict_deps = true
end
@ -27,12 +27,10 @@ class DebugBuilder < Rscons::Builder
end
end
build do
Environment.new do |env|
env do |env|
env.add_builder(DebugBuilder)
if Rscons.vars["new_user_dep"]
if ENV["test"] == "new_user_dep"
env.depends("foo.o", "new_dep")
end
env.DebugBuilder("foo.o", "simple.c")
end
end

View File

@ -1,5 +1,3 @@
build do
Environment.new do |env|
env do |env|
env.Copy("simple.copy", "simple.c")
end
end

View File

@ -1,8 +1,6 @@
build do
Environment.new do |env|
env do |env|
env.Object("simple.o", "simple.c")
env.process
env["LDCMD"] = %w[gcc -o ${_TARGET} simple.o]
env.Program('simple.exe', [])
end
end

View File

@ -1,7 +1,5 @@
build do
Environment.new do |env|
env do |env|
env.Object("simple.o", "simple.c")
env["LDCMD"] = %w[gcc -o ${_TARGET} simple.o]
env.Program('simple.exe', ["simple.o"])
end
end

View File

@ -1,6 +1,4 @@
build do
Environment.new do |env|
env do |env|
env.Object("simple.o", "simple.c")
env.Object("two.o", "two.c")
end
end

View File

@ -1,7 +1,5 @@
build do
Environment.new do |env|
env do |env|
target = env.Program("simple.exe", "simple.c")
user_deps = File.read("user_deps", mode: "rb").split(" ")
target.depends(*user_deps)
end
end

View File

@ -13,9 +13,7 @@ class TestBuilder < Rscons::Builder
end
end
build do
Environment.new do |env|
env do |env|
env.add_builder(TestBuilder)
env.TestBuilder("foo")
end
end

View File

@ -0,0 +1,7 @@
env do |env|
env.Program('simple.exe', Dir['*.c'])
end
clean do
puts "custom clean action"
end

View File

@ -1,6 +1,4 @@
build do
Environment.new do |env|
env do |env|
env.Program("simple.exe", "simple.c")
env.clear_targets
end
end

View File

@ -1,9 +1,7 @@
build do
base_env = Environment.new do |env|
base_env = env do |env|
env.n_threads = 165
end
my_env = base_env.clone
puts my_env.n_threads
my_env = base_env.clone do |env|
puts env.n_threads
end

View File

@ -1,6 +1,4 @@
build do
Environment.new(echo: :command) do |env|
env(echo: :command) do |env|
env["LD"] = "gcc"
env.Program('simple.exe', Dir['*.c'])
end
end

View File

@ -1,9 +1,7 @@
build do
Environment.new do |env|
env do |env|
command = %W[gcc -o ${_TARGET} ${_SOURCES}]
env.Command("simple.exe",
"simple.c",
"CMD" => command,
"CMD_DESC" => "BuildIt")
end
end

View File

@ -1,5 +1,4 @@
build do
Environment.new do |env|
env do |env|
env.Object("simple.o", "simple.c")
env.Command("simple.txt",
"simple.o",
@ -7,4 +6,3 @@ build do
"CMD_STDOUT" => "${_TARGET}",
"CMD_DESC" => "My Disassemble")
end
end

View File

@ -1,6 +1,4 @@
build do
Environment.new do |env|
env do |env|
env["sources"] = glob("*.c")
env.Program("simple.exe", "${sources}")
end
end

View File

@ -1,5 +1,3 @@
build do
Environment.new do |env|
env do |env|
env.Directory("teh_dir")
end
end

View File

@ -1,6 +1,4 @@
build do
Environment.new do |env|
env do |env|
env.Object("simple.o", "simple.c")
env.Disassemble("simple.txt", "simple.o")
end
end

View File

@ -1,5 +1,3 @@
build do
Environment.new do |env|
env do |env|
env.Object("simple.o", "simple.c")
end
end

View File

@ -1,5 +1,5 @@
build do
env = Environment.new do |env|
default do
env = env do |env|
env["CFLAGS"] += %w[-O2 -fomit-frame-pointer]
env[:foo] = :bar
end

View File

@ -0,0 +1,5 @@
default do
env do |env|
env.Program('simple.exe', Dir['*.c'])
end
end

View File

@ -1,7 +1,5 @@
build do
Environment.new do |env|
env do |env|
env.Command("foo", "bar")
env.Command("bar", "baz")
env.Command("baz", "foo")
end
end

View File

@ -1,5 +1,3 @@
build do
Environment.new do |env|
env do |env|
env.Command("foo", "foo")
end
end

View File

@ -1,5 +1,3 @@
build do
Environment.new do |env|
env do |env|
env.produces("foo", "bar")
end
end

View File

@ -1,8 +1,6 @@
build do
Environment.new do |env|
env do |env|
File.open("foo.xyz", "wb") do |fh|
fh.puts("hi")
end
env.Object("foo.o", "foo.xyz")
end
end

Some files were not shown because too many files have changed in this diff Show More