Compare commits
15
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
eff9a10d0c | ||
|
|
6ad3fb0785 | ||
|
|
32e8a55b4e | ||
|
|
3733cb6114 | ||
|
|
5beddd63ac | ||
|
|
4967f89a76 | ||
|
|
7cc68b2ce1 | ||
|
|
be058dd18b | ||
|
|
ad703a5c84 | ||
|
|
fb5d107581 | ||
|
|
d5c1a4b41a | ||
|
|
3f63bf5d13 | ||
|
|
ce47bd3599 | ||
|
|
68cab5e24d | ||
|
|
f92dd62ebd |
No files matched your search
@@ -3,7 +3,5 @@
|
|||||||
/_yardoc/
|
/_yardoc/
|
||||||
/build_test_run/
|
/build_test_run/
|
||||||
/coverage/
|
/coverage/
|
||||||
/dist/
|
|
||||||
/doc/
|
/doc/
|
||||||
/pkg/
|
/pkg/
|
||||||
/test/
|
|
||||||
@@ -1,5 +1,18 @@
|
|||||||
## ChangeLog
|
## ChangeLog
|
||||||
|
|
||||||
|
### v1.18.0
|
||||||
|
|
||||||
|
#### Performance Improvements
|
||||||
|
|
||||||
|
- Backport 2.x VarSet performance improvements to 1.x branch.
|
||||||
|
- Remove Cache dirty-tracking
|
||||||
|
- Reduce recursion of VarSet#expand_varref by expanding vars earlier.
|
||||||
|
|
||||||
|
#### Fixes
|
||||||
|
|
||||||
|
- #73 - fix inconsistent type handling in VarSet#expand_varref
|
||||||
|
- #75 - avoid mkdir() race conditions
|
||||||
|
|
||||||
### v1.17.0
|
### v1.17.0
|
||||||
|
|
||||||
#### New Features
|
#### New Features
|
||||||
|
|||||||
@@ -1,8 +1,4 @@
|
|||||||
source 'https://rubygems.org'
|
source 'https://rubygems.org'
|
||||||
|
|
||||||
gem "json"
|
# Specify your gem's dependencies in rscons.gemspec
|
||||||
gem "rspec"
|
gemspec
|
||||||
gem "rake"
|
|
||||||
gem "simplecov"
|
|
||||||
gem "yard"
|
|
||||||
gem "rdoc"
|
|
||||||
+26
-20
@@ -1,42 +1,48 @@
|
|||||||
|
PATH
|
||||||
|
remote: .
|
||||||
|
specs:
|
||||||
|
rscons (1.18.0)
|
||||||
|
json (>= 1.8, < 3.0)
|
||||||
|
|
||||||
GEM
|
GEM
|
||||||
remote: https://rubygems.org/
|
remote: https://rubygems.org/
|
||||||
specs:
|
specs:
|
||||||
diff-lcs (1.3)
|
diff-lcs (1.3)
|
||||||
docile (1.1.5)
|
docile (1.3.2)
|
||||||
json (2.1.0)
|
json (2.2.0)
|
||||||
rake (12.3.1)
|
rake (13.0.0)
|
||||||
rdoc (5.1.0)
|
rdoc (6.2.0)
|
||||||
rspec (3.6.0)
|
rspec (3.9.0)
|
||||||
rspec-core (~> 3.6.0)
|
rspec-core (~> 3.9.0)
|
||||||
rspec-expectations (~> 3.6.0)
|
rspec-expectations (~> 3.9.0)
|
||||||
rspec-mocks (~> 3.6.0)
|
rspec-mocks (~> 3.9.0)
|
||||||
rspec-core (3.6.0)
|
rspec-core (3.9.0)
|
||||||
rspec-support (~> 3.6.0)
|
rspec-support (~> 3.9.0)
|
||||||
rspec-expectations (3.6.0)
|
rspec-expectations (3.9.0)
|
||||||
diff-lcs (>= 1.2.0, < 2.0)
|
diff-lcs (>= 1.2.0, < 2.0)
|
||||||
rspec-support (~> 3.6.0)
|
rspec-support (~> 3.9.0)
|
||||||
rspec-mocks (3.6.0)
|
rspec-mocks (3.9.0)
|
||||||
diff-lcs (>= 1.2.0, < 2.0)
|
diff-lcs (>= 1.2.0, < 2.0)
|
||||||
rspec-support (~> 3.6.0)
|
rspec-support (~> 3.9.0)
|
||||||
rspec-support (3.6.0)
|
rspec-support (3.9.0)
|
||||||
simplecov (0.15.0)
|
simplecov (0.17.1)
|
||||||
docile (~> 1.1.0)
|
docile (~> 1.1)
|
||||||
json (>= 1.8, < 3)
|
json (>= 1.8, < 3)
|
||||||
simplecov-html (~> 0.10.0)
|
simplecov-html (~> 0.10.0)
|
||||||
simplecov-html (0.10.2)
|
simplecov-html (0.10.2)
|
||||||
yard (0.9.12)
|
yard (0.9.20)
|
||||||
|
|
||||||
PLATFORMS
|
PLATFORMS
|
||||||
ruby
|
ruby
|
||||||
x86-mingw32
|
x86-mingw32
|
||||||
|
|
||||||
DEPENDENCIES
|
DEPENDENCIES
|
||||||
json
|
|
||||||
rake
|
rake
|
||||||
rdoc
|
rdoc
|
||||||
|
rscons!
|
||||||
rspec
|
rspec
|
||||||
simplecov
|
simplecov
|
||||||
yard
|
yard
|
||||||
|
|
||||||
BUNDLED WITH
|
BUNDLED WITH
|
||||||
1.16.2
|
1.17.3
|
||||||
@@ -1,13 +1,13 @@
|
|||||||
# Rscons
|
# Rscons
|
||||||
|
|
||||||
Rscons (https://github.com/holtrop/rscons) is a software construction framework
|
Rscons (https://github.com/holtrop/rscons) is a software construction framework
|
||||||
inspired by SCons and waf but implemented in Ruby.
|
inspired by SCons and implemented in Ruby.
|
||||||
|
|
||||||
|
[](http://badge.fury.io/rb/rscons)
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
Rscons is distributed as a standalone Ruby script named ``rscons``. This file
|
$ gem install rscons
|
||||||
(containing the complete rscons build system) can be checked into your project
|
|
||||||
and versioned along with your project.
|
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
|
|||||||
+3
-20
@@ -5,17 +5,13 @@ rescue Bundler::BundlerError => e
|
|||||||
raise LoadError.new("Unable to setup Bundler; you might need to `bundle install`: #{e.message}")
|
raise LoadError.new("Unable to setup Bundler; you might need to `bundle install`: #{e.message}")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
require "bundler/gem_tasks"
|
||||||
require "rspec/core/rake_task"
|
require "rspec/core/rake_task"
|
||||||
require "yard"
|
require "yard"
|
||||||
require "rake/clean"
|
require "rake/clean"
|
||||||
require "fileutils"
|
|
||||||
|
|
||||||
CLEAN.include %w[build_test_run .yardoc doc coverage test]
|
CLEAN.include %w[build_test_run .yardoc doc coverage]
|
||||||
CLOBBER.include %w[dist pkg]
|
CLOBBER.include %w[pkg]
|
||||||
|
|
||||||
task :build_dist do
|
|
||||||
sh "ruby rb/build_dist.rb"
|
|
||||||
end
|
|
||||||
|
|
||||||
RSpec::Core::RakeTask.new(:spec, :example_string) do |task, args|
|
RSpec::Core::RakeTask.new(:spec, :example_string) do |task, args|
|
||||||
if args.example_string
|
if args.example_string
|
||||||
@@ -23,19 +19,6 @@ RSpec::Core::RakeTask.new(:spec, :example_string) do |task, args|
|
|||||||
task.rspec_opts = %W[-e "#{args.example_string}" -f documentation]
|
task.rspec_opts = %W[-e "#{args.example_string}" -f documentation]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
task :spec => :build_dist
|
|
||||||
|
|
||||||
# dspec task is useful to test the distributable release script, but is not
|
|
||||||
# useful for coverage information.
|
|
||||||
desc "Dist Specs"
|
|
||||||
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"].invoke(args.example_string)
|
|
||||||
ENV.delete("dist_specs")
|
|
||||||
FileUtils.rm_f(Dir.glob(".rscons-*"))
|
|
||||||
end
|
|
||||||
|
|
||||||
YARD::Rake::YardocTask.new do |yard|
|
YARD::Rake::YardocTask.new do |yard|
|
||||||
yard.files = ['lib/**/*.rb']
|
yard.files = ['lib/**/*.rb']
|
||||||
|
|||||||
@@ -2,6 +2,4 @@
|
|||||||
|
|
||||||
require "rscons/cli"
|
require "rscons/cli"
|
||||||
|
|
||||||
if __FILE__ == $0
|
|
||||||
Rscons::Cli.run(ARGV)
|
Rscons::Cli.run(ARGV)
|
||||||
end
|
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
Rscons::Environment.new do |env|
|
||||||
|
env.append('CPPPATH' => Rscons.glob('src/**'))
|
||||||
|
env.build_dir(%r{^src/([^/]+)/}, 'build_\\1/')
|
||||||
|
env.Program('build_dir.exe', Rscons.glob('src/**/*.c'))
|
||||||
|
end
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
class MyObject < Rscons::Builder
|
||||||
|
def run(target, sources, cache, env, vars)
|
||||||
|
env.run_builder(env.builders["Object"], target, sources, cache, vars)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
Rscons::Environment.new(echo: :command) do |env|
|
||||||
|
env.add_builder(MyObject.new)
|
||||||
|
env.append('CPPPATH' => Rscons.glob('src/**'))
|
||||||
|
env.add_build_hook do |build_op|
|
||||||
|
if build_op[:builder].name == "MyObject" && build_op[:sources].first =~ %r{one\.c}
|
||||||
|
build_op[:vars]["CFLAGS"] << "-O1"
|
||||||
|
build_op[:sources] = ['src/two/two.c']
|
||||||
|
elsif build_op[:builder].name == "MyObject" && build_op[:target] =~ %r{two\.o}
|
||||||
|
new_vars = build_op[:vars].clone
|
||||||
|
new_vars["CFLAGS"] << "-O2"
|
||||||
|
build_op[:vars] = new_vars
|
||||||
|
end
|
||||||
|
end
|
||||||
|
env.MyObject('one.o', 'src/one/one.c')
|
||||||
|
env.MyObject('two.o', 'src/two/two.c')
|
||||||
|
end
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
env = Rscons::Environment.new do |env|
|
||||||
|
env.append('CPPPATH' => Rscons.glob('src/**/*/'))
|
||||||
|
env.build_dir("src", "build")
|
||||||
|
env.build_root = "build_root"
|
||||||
|
env.Program('build_dir.exe', Rscons.glob('src/**/*.c'))
|
||||||
|
end
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
Rscons::Environment.new(echo: :command) do |env|
|
||||||
|
env.append('CPPPATH' => Rscons.glob('src/**/*/'))
|
||||||
|
env.build_dir(%r{^src/([^/]+)/}, 'build_\\1/')
|
||||||
|
env.add_build_hook do |build_op|
|
||||||
|
if build_op[:target] =~ %r{build_one/.*\.o}
|
||||||
|
build_op[:vars]["CFLAGS"] << "-O1"
|
||||||
|
elsif build_op[:target] =~ %r{build_two/.*\.o}
|
||||||
|
build_op[:vars]["CFLAGS"] << "-O2"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
env.Program('build_hook.exe', Rscons.glob('src/**/*.c'))
|
||||||
|
end
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
Rscons::Environment.new(echo: :command) do |env|
|
||||||
|
env.append('CPPPATH' => Rscons.glob('src/**').sort)
|
||||||
|
env.build_root = "build_root"
|
||||||
|
FileUtils.mkdir_p(env.build_root)
|
||||||
|
FileUtils.mv("src/one/one.c", "build_root")
|
||||||
|
env.Object("^/one.o", "^/one.c")
|
||||||
|
env.Program("build_dir.exe", Rscons.glob('src/**/*.c') + ["^/one.o"])
|
||||||
|
end
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
Rscons::Environment.new do |env|
|
||||||
|
env.Copy("inst.exe", "copy.rb")
|
||||||
|
end
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
Rscons::Environment.new do |env|
|
||||||
|
env["CSUFFIX"] = %w[.yargh .c]
|
||||||
|
env["CFLAGS"] += %w[-x c]
|
||||||
|
env["CPPPATH"] += Rscons.glob("src/**")
|
||||||
|
env.Program("build_dir.exe", Rscons.glob("src/**/*.{c,yargh}"))
|
||||||
|
end
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
Rscons::Environment.new do |env|
|
||||||
|
env.echo = :command
|
||||||
|
env.Install("inst.exe", "install.rb")
|
||||||
|
end
|
||||||
|
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
class MyBuilder < Rscons::Builder
|
||||||
|
def run(options)
|
||||||
|
env, target = options.values_at(:env, :target)
|
||||||
|
env.print_builder_run_message("MyBuilder #{target}", "MyBuilder #{target} command")
|
||||||
|
target
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
Rscons::Environment.new do |env|
|
||||||
|
env.echo = :command
|
||||||
|
env.add_builder(MyBuilder.new)
|
||||||
|
env.MyBuilder("foo")
|
||||||
|
end
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
Rscons::Environment.new do |env|
|
||||||
|
env.Install("inst.exe", "install.rb")
|
||||||
|
end
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
Rscons::Environment.new do |env|
|
||||||
|
env.Directory("inst")
|
||||||
|
env.Install("inst", "install_directory.rb")
|
||||||
|
|
||||||
|
env.Install("noexist/src", "src")
|
||||||
|
|
||||||
|
env.Directory("exist/src")
|
||||||
|
env.Install("exist/src", "src")
|
||||||
|
end
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
Rscons::Environment.new do |env|
|
||||||
|
env["CPPPATH"] << "src/two"
|
||||||
|
env.Object("one.o", "src/one/one.c")
|
||||||
|
env.Object("one.o", "src/two/two.c")
|
||||||
|
end
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
Rscons::Environment.new do |env|
|
||||||
|
env.append('CPPPATH' => Rscons.glob('src/**'))
|
||||||
|
env.build_dir("src2", "build")
|
||||||
|
env.build_root = "build_root"
|
||||||
|
env.Program('build_dir.exe', Rscons.glob('src/**/*.c'))
|
||||||
|
end
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
Rscons::Environment.new do |env|
|
||||||
|
env["CPPPATH"] << "src/two"
|
||||||
|
env.Object("one.o", "src/one/one.c")
|
||||||
|
env.add_post_build_hook do |build_op|
|
||||||
|
if build_op[:target] == "one.o"
|
||||||
|
env["MODULE"] = "two"
|
||||||
|
env.Object("${MODULE}.o", "src/${MODULE}/${MODULE}.c")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
Rscons::Environment.new do |env|
|
||||||
|
env.append("CPPPATH" => Rscons.glob("src/**"))
|
||||||
|
env.build_dir("src/one/", "build_one/")
|
||||||
|
env.build_dir("src/two", "build_two")
|
||||||
|
env.Program("build_dir.exe", Rscons.glob("src/**/*.c"))
|
||||||
|
end
|
||||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -1,6 +0,0 @@
|
|||||||
build do
|
|
||||||
Environment.new do |env|
|
|
||||||
env.CFile("lexer.c", "lexer.l")
|
|
||||||
env.CFile("parser.c", "parser.y")
|
|
||||||
end
|
|
||||||
end
|
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
Rscons::Environment.new do |env|
|
||||||
|
env.CFile("lexer.c", "lexer.l")
|
||||||
|
env.CFile("parser.c", "parser.y")
|
||||||
|
end
|
||||||
@@ -1,5 +1,3 @@
|
|||||||
build do
|
Rscons::Environment.new do |env|
|
||||||
Environment.new do |env|
|
|
||||||
env.CFile("file.c", "foo.bar")
|
env.CFile("file.c", "foo.bar")
|
||||||
end
|
end
|
||||||
end
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
build do
|
|
||||||
debug = Environment.new(echo: :command) do |env|
|
|
||||||
env['CFLAGS'] = '-O2'
|
|
||||||
env['CPPFLAGS'] = '-DSTRING="Debug Version"'
|
|
||||||
env.Program('program-debug.exe', Dir['src/*.c'])
|
|
||||||
end
|
|
||||||
|
|
||||||
release = debug.clone do |env|
|
|
||||||
env["CPPFLAGS"] = '-DSTRING="Release Version"'
|
|
||||||
env.Program('program-release.exe', Dir['src/*.c'])
|
|
||||||
end
|
|
||||||
end
|
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
debug = Rscons::Environment.new(echo: :command) do |env|
|
||||||
|
env.build_dir('src', 'debug')
|
||||||
|
env['CFLAGS'] = '-O2'
|
||||||
|
env['CPPFLAGS'] = '-DSTRING="Debug Version"'
|
||||||
|
env.Program('program-debug.exe', Dir['src/*.c'])
|
||||||
|
end
|
||||||
|
|
||||||
|
release = debug.clone do |env|
|
||||||
|
env["CPPFLAGS"] = '-DSTRING="Release Version"'
|
||||||
|
env.build_dir('src', 'release')
|
||||||
|
env.Program('program-release.exe', Dir['src/*.c'])
|
||||||
|
end
|
||||||
@@ -1,11 +1,11 @@
|
|||||||
build do
|
env1 = Rscons::Environment.new(echo: :command) do |env|
|
||||||
env1 = Environment.new(echo: :command) do |env|
|
env.build_dir('src', 'build')
|
||||||
env['CFLAGS'] = '-O2'
|
env['CFLAGS'] = '-O2'
|
||||||
env.add_build_hook do |builder|
|
env.add_build_hook do |build_op|
|
||||||
builder.vars['CPPFLAGS'] = '-DSTRING="Hello"'
|
build_op[:vars]['CPPFLAGS'] = '-DSTRING="Hello"'
|
||||||
end
|
end
|
||||||
env.add_post_build_hook do |builder|
|
env.add_post_build_hook do |build_op|
|
||||||
$stdout.puts "post #{builder.target}"
|
$stdout.puts "post #{build_op[:target]}"
|
||||||
end
|
end
|
||||||
env.Program('program.exe', Dir['src/*.c'])
|
env.Program('program.exe', Dir['src/*.c'])
|
||||||
end
|
end
|
||||||
@@ -13,4 +13,3 @@ build do
|
|||||||
env2 = env1.clone do |env|
|
env2 = env1.clone do |env|
|
||||||
env.Program('program2.exe', Dir['src/*.c'])
|
env.Program('program2.exe', Dir['src/*.c'])
|
||||||
end
|
end
|
||||||
end
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
configure do
|
|
||||||
check_c_compiler "nope.nope"
|
|
||||||
end
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
autoconf false
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
configure do
|
|
||||||
check_c_compiler
|
|
||||||
check_c_header "stdio.h"
|
|
||||||
end
|
|
||||||
|
|
||||||
build do
|
|
||||||
Environment.new do |env|
|
|
||||||
env.Program("simple.exe", "simple.c")
|
|
||||||
end
|
|
||||||
end
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
configure do
|
|
||||||
check_c_compiler
|
|
||||||
end
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
configure do
|
|
||||||
check_c_compiler "mycompiler"
|
|
||||||
end
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
configure do
|
|
||||||
check_c_compiler "gcc", "clang"
|
|
||||||
end
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
configure do
|
|
||||||
check_c_header "not___found.h"
|
|
||||||
end
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
configure do
|
|
||||||
check_c_header "not___found.h", fail: false
|
|
||||||
end
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
configure do
|
|
||||||
check_c_header "not___found.h", fail: false, set_define: "HAVE_NOT___FOUND_H"
|
|
||||||
end
|
|
||||||
|
|
||||||
build do
|
|
||||||
Environment.new(echo: :command) do |env|
|
|
||||||
env.Object("simple.o", "simple.c")
|
|
||||||
end
|
|
||||||
end
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
configure do
|
|
||||||
check_c_header "string.h"
|
|
||||||
end
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
configure do
|
|
||||||
check_c_header "string.h", set_define: "HAVE_STRING_H"
|
|
||||||
end
|
|
||||||
|
|
||||||
build do
|
|
||||||
Environment.new(echo: :command) do |env|
|
|
||||||
env.Object("simple.o", "simple.c")
|
|
||||||
end
|
|
||||||
end
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
configure do
|
|
||||||
check_cfg program: "my-config"
|
|
||||||
end
|
|
||||||
|
|
||||||
build do
|
|
||||||
Environment.new(echo: :command) do |env|
|
|
||||||
env.Program("myconfigtest", "simple.c")
|
|
||||||
end
|
|
||||||
end
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
configure do
|
|
||||||
check_cfg package: "mypackage"
|
|
||||||
end
|
|
||||||
|
|
||||||
build do
|
|
||||||
Environment.new(echo: :command) do |env|
|
|
||||||
env.Program("myconfigtest", "simple.c")
|
|
||||||
end
|
|
||||||
end
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
configure do
|
|
||||||
check_cfg package: "mypackage", use: "myp"
|
|
||||||
end
|
|
||||||
|
|
||||||
build do
|
|
||||||
Environment.new(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.Copy("myconfigtest2.c", "simple.c")
|
|
||||||
env.Program("myconfigtest2.exe", "myconfigtest2.c")
|
|
||||||
end
|
|
||||||
end
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
configure do
|
|
||||||
check_cxx_compiler
|
|
||||||
end
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
configure do
|
|
||||||
check_cxx_compiler "mycompiler"
|
|
||||||
end
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
configure do
|
|
||||||
check_cxx_compiler "g++", "clang++"
|
|
||||||
end
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
configure do
|
|
||||||
check_cxx_header "not___found.h"
|
|
||||||
end
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
configure do
|
|
||||||
check_cxx_header "not___found.h", fail: false
|
|
||||||
end
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
configure do
|
|
||||||
check_cxx_header "string.h"
|
|
||||||
end
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
configure do
|
|
||||||
check_d_compiler
|
|
||||||
end
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
configure do
|
|
||||||
check_d_compiler "mycompiler"
|
|
||||||
end
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
configure do
|
|
||||||
check_d_compiler "gdc", "ldc2"
|
|
||||||
end
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
configure do
|
|
||||||
check_d_import "not.found"
|
|
||||||
end
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
configure do
|
|
||||||
check_d_import "not.found", fail: false
|
|
||||||
end
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
configure do
|
|
||||||
check_d_import "std.stdio"
|
|
||||||
end
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
configure do
|
|
||||||
check_lib "mfoofoo"
|
|
||||||
end
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
configure do
|
|
||||||
check_lib "mfoofoo", fail: false
|
|
||||||
end
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
configure do
|
|
||||||
check_lib "m"
|
|
||||||
end
|
|
||||||
|
|
||||||
build do
|
|
||||||
Environment.new(echo: :command) do |env|
|
|
||||||
env.Program("simple.exe", "simple.c")
|
|
||||||
end
|
|
||||||
end
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
configure do
|
|
||||||
check_lib "m", use: :m
|
|
||||||
end
|
|
||||||
|
|
||||||
build do
|
|
||||||
Environment.new(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.Copy("test2.c", "simple.c")
|
|
||||||
env.Program("test2.exe", "test2.c")
|
|
||||||
end
|
|
||||||
end
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
configure do
|
|
||||||
check_lib "m", use: false
|
|
||||||
end
|
|
||||||
|
|
||||||
build do
|
|
||||||
Environment.new(echo: :command) do |env|
|
|
||||||
env.Copy("test1.c", "simple.c")
|
|
||||||
env.Program("test2.exe", "test1.c")
|
|
||||||
end
|
|
||||||
end
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
configure do
|
|
||||||
check_program "program-that-is-not-found"
|
|
||||||
end
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
configure do
|
|
||||||
check_program "program-that-is-not-found", fail: false
|
|
||||||
end
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
configure do
|
|
||||||
check_program "find"
|
|
||||||
end
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
Environment.new do |env|
|
|
||||||
env.Object("simple.o", "simple.cc")
|
|
||||||
end
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
project_name "configure test"
|
|
||||||
autoconf false
|
|
||||||
configure do
|
|
||||||
check_c_compiler
|
|
||||||
check_cxx_compiler
|
|
||||||
check_d_compiler
|
|
||||||
check_cfg package: "mypackage"
|
|
||||||
check_c_header "stdio.h"
|
|
||||||
check_cxx_header "iostream"
|
|
||||||
check_d_import "std.stdio"
|
|
||||||
check_lib "m"
|
|
||||||
check_program "ls"
|
|
||||||
end
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
configure do
|
|
||||||
check_c_header "math.h", set_define: "HAVE_MATH_H"
|
|
||||||
check_c_header "stdio.h", set_define: "HAVE_STDIO_H"
|
|
||||||
end
|
|
||||||
|
|
||||||
build do
|
|
||||||
Environment.new(echo: :command) do |env|
|
|
||||||
env.Object("simple.o", "simple.c")
|
|
||||||
end
|
|
||||||
end
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
check_c_compiler "gcc"
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
|
||||||
{
|
|
||||||
printf("This is a simple C program\n");
|
|
||||||
}
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
class MySource < Rscons::Builder
|
|
||||||
def run(options)
|
|
||||||
File.open(@target, 'w') do |fh|
|
|
||||||
fh.puts <<EOF
|
|
||||||
#define THE_VALUE 5678
|
|
||||||
EOF
|
|
||||||
end
|
|
||||||
true
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
build do
|
|
||||||
Environment.new do |env|
|
|
||||||
env.add_builder(MySource)
|
|
||||||
env.MySource('inc.h', [])
|
|
||||||
env.Program('program.exe', Dir['*.c'])
|
|
||||||
end
|
|
||||||
end
|
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
class MySource < Rscons::Builder
|
||||||
|
def run(target, sources, cache, env, vars)
|
||||||
|
File.open(target, 'w') do |fh|
|
||||||
|
fh.puts <<EOF
|
||||||
|
#define THE_VALUE 5678
|
||||||
|
EOF
|
||||||
|
end
|
||||||
|
target
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
Rscons::Environment.new do |env|
|
||||||
|
env.add_builder(MySource.new)
|
||||||
|
env.MySource('inc.h', [])
|
||||||
|
env.Program('program.exe', Dir['*.c'])
|
||||||
|
end
|
||||||
@@ -1,5 +1,4 @@
|
|||||||
build do
|
Rscons::Environment.new do |env|
|
||||||
Environment.new do |env|
|
|
||||||
env.Command("inc.c",
|
env.Command("inc.c",
|
||||||
[],
|
[],
|
||||||
"CMD" => %w[ruby gen.rb ${_TARGET}],
|
"CMD" => %w[ruby gen.rb ${_TARGET}],
|
||||||
@@ -9,4 +8,3 @@ build do
|
|||||||
env.build_after("${build_root}/program.o", "${inc_c}")
|
env.build_after("${build_root}/program.o", "${inc_c}")
|
||||||
env.Program("program.exe", ["program.c", "inc.c"])
|
env.Program("program.exe", ["program.c", "inc.c"])
|
||||||
end
|
end
|
||||||
end
|
|
||||||
@@ -1,20 +1,18 @@
|
|||||||
class MySource < Rscons::Builder
|
class MySource < Rscons::Builder
|
||||||
def run(options)
|
def run(target, sources, cache, env, vars)
|
||||||
File.open(@target, 'w') do |fh|
|
File.open(target, 'w') do |fh|
|
||||||
fh.puts <<EOF
|
fh.puts <<EOF
|
||||||
#define THE_VALUE 678
|
#define THE_VALUE 678
|
||||||
EOF
|
EOF
|
||||||
end
|
end
|
||||||
true
|
target
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
build do
|
env = Rscons::Environment.new do |env|
|
||||||
env = Environment.new do |env|
|
|
||||||
env["hdr"] = "inc.h"
|
env["hdr"] = "inc.h"
|
||||||
env["src"] = "program.c"
|
env["src"] = "program.c"
|
||||||
env.add_builder(MySource)
|
env.add_builder(MySource.new)
|
||||||
env.MySource('${hdr}')
|
env.MySource('${hdr}')
|
||||||
env.Program('program.exe', "${src}")
|
env.Program('program.exe', "${src}")
|
||||||
end
|
end
|
||||||
end
|
|
||||||
@@ -1,17 +1,16 @@
|
|||||||
class MySource < Rscons::Builder
|
class MySource < Rscons::Builder
|
||||||
def run(options)
|
def run(target, sources, cache, env, vars)
|
||||||
File.open(@target, 'w') do |fh|
|
File.open(target, 'w') do |fh|
|
||||||
fh.puts <<EOF
|
fh.puts <<EOF
|
||||||
#define THE_VALUE #{@env.expand_varref("${the_value}")}
|
#define THE_VALUE #{env.expand_varref("${the_value}")}
|
||||||
EOF
|
EOF
|
||||||
end
|
end
|
||||||
true
|
target
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
build do
|
e1 = Rscons::Environment.new do |env|
|
||||||
e1 = Environment.new do |env|
|
env.add_builder(MySource.new)
|
||||||
env.add_builder(MySource)
|
|
||||||
env["one"] = "5"
|
env["one"] = "5"
|
||||||
env[:cfg] = {val: "9"}
|
env[:cfg] = {val: "9"}
|
||||||
env["two"] = lambda do |args|
|
env["two"] = lambda do |args|
|
||||||
@@ -27,4 +26,3 @@ build do
|
|||||||
env.MySource('inc.h', [])
|
env.MySource('inc.h', [])
|
||||||
env.Program('program.exe', Dir['*.c'])
|
env.Program('program.exe', Dir['*.c'])
|
||||||
end
|
end
|
||||||
end
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
build do
|
|
||||||
Environment.new do |env|
|
|
||||||
env.add_builder(:MyBuilder) do |options|
|
|
||||||
"hi"
|
|
||||||
end
|
|
||||||
env.MyBuilder("foo")
|
|
||||||
end
|
|
||||||
end
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
build do
|
|
||||||
Environment.new do |env|
|
|
||||||
env.add_builder(:MyBuilder) do |options|
|
|
||||||
wait_for(1)
|
|
||||||
end
|
|
||||||
env.MyBuilder("foo")
|
|
||||||
end
|
|
||||||
end
|
|
||||||
@@ -1,21 +1,19 @@
|
|||||||
class CHGen < Rscons::Builder
|
class CHGen < Rscons::Builder
|
||||||
def run(options)
|
def run(target, sources, cache, env, vars)
|
||||||
c_fname = @target
|
c_fname = target
|
||||||
h_fname = @target.sub(/\.c$/, ".h")
|
h_fname = target.sub(/\.c$/, ".h")
|
||||||
unless @cache.up_to_date?([c_fname, h_fname], "", @sources, @env)
|
unless cache.up_to_date?([c_fname, h_fname], "", sources, env)
|
||||||
puts "CHGen #{c_fname}"
|
puts "CHGen #{c_fname}"
|
||||||
File.open(c_fname, "w") {|fh| fh.puts "int THE_VALUE = 42;"}
|
File.open(c_fname, "w") {|fh| fh.puts "int THE_VALUE = 42;"}
|
||||||
File.open(h_fname, "w") {|fh| fh.puts "extern int THE_VALUE;"}
|
File.open(h_fname, "w") {|fh| fh.puts "extern int THE_VALUE;"}
|
||||||
@cache.register_build([c_fname, h_fname], "", @sources, @env)
|
cache.register_build([c_fname, h_fname], "", sources, env)
|
||||||
end
|
end
|
||||||
true
|
target
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
build do
|
Rscons::Environment.new do |env|
|
||||||
Environment.new do |env|
|
env.add_builder(CHGen.new)
|
||||||
env.add_builder(CHGen)
|
|
||||||
env.CHGen("inc.c", ["program.c"])
|
env.CHGen("inc.c", ["program.c"])
|
||||||
env.Program("program.exe", %w[program.c inc.c])
|
env.Program("program.exe", %w[program.c inc.c])
|
||||||
end
|
end
|
||||||
end
|
|
||||||
@@ -1,5 +1,4 @@
|
|||||||
build do
|
Rscons::Environment.new do |env|
|
||||||
Environment.new do |env|
|
|
||||||
env["build_root"] = env.build_root
|
env["build_root"] = env.build_root
|
||||||
env["inc_h"] = "inc.h"
|
env["inc_h"] = "inc.h"
|
||||||
|
|
||||||
@@ -13,4 +12,3 @@ build do
|
|||||||
"CMD_DESC" => "Generating")
|
"CMD_DESC" => "Generating")
|
||||||
env.produces("inc.c", "inc.h")
|
env.produces("inc.c", "inc.h")
|
||||||
end
|
end
|
||||||
end
|
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
class MyBuilder < Rscons::Builder
|
|
||||||
def run(options)
|
|
||||||
if @thread
|
|
||||||
true
|
|
||||||
else
|
|
||||||
print_run_message("#{name} #{target}", nil)
|
|
||||||
@thread = Thread.new do
|
|
||||||
sleep 2
|
|
||||||
FileUtils.touch(@target)
|
|
||||||
end
|
|
||||||
wait_for(@thread)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
build do
|
|
||||||
Environment.new do |env|
|
|
||||||
env.add_builder(MyBuilder)
|
|
||||||
env.MyBuilder("foo")
|
|
||||||
end
|
|
||||||
end
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
build do
|
|
||||||
Environment.new(echo: :command) do |env|
|
|
||||||
env.Program("hello-d.exe", glob("*.d"))
|
|
||||||
end
|
|
||||||
end
|
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
Rscons::Environment.new(echo: :command) do |env|
|
||||||
|
env.Program("hello-d.exe", Rscons.glob("*.d"))
|
||||||
|
end
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
build do
|
|
||||||
Environment.new(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
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
build do
|
|
||||||
Environment.new do |env|
|
|
||||||
env.Program("test.exe", glob("*.c"), direct: true)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
build do
|
|
||||||
Environment.new 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
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
#include "two.h"
|
|
||||||
|
|
||||||
int main(int argc, char * argv[])
|
|
||||||
{
|
|
||||||
two();
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
#include "three.h"
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
void three(void)
|
|
||||||
{
|
|
||||||
printf("three\n");
|
|
||||||
}
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
void three(void);
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
#include "two.h"
|
|
||||||
#include "three.h"
|
|
||||||
|
|
||||||
void two(void)
|
|
||||||
{
|
|
||||||
three();
|
|
||||||
}
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
void two(void);
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
build do
|
|
||||||
Environment.new do |env|
|
|
||||||
env.Program('header.exe', Dir['*.c'])
|
|
||||||
end
|
|
||||||
end
|
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
Rscons::Environment.new do |env|
|
||||||
|
env.Program('header.exe', Dir['*.c'])
|
||||||
|
end
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
build do
|
|
||||||
Environment.new do |env|
|
|
||||||
require 'json'
|
|
||||||
require 'yaml'
|
|
||||||
env.add_builder(:JsonToYaml) do |params|
|
|
||||||
unless @cache.up_to_date?(@target, :JsonToYaml, @sources, @env)
|
|
||||||
@cache.mkdir_p(File.dirname(@target))
|
|
||||||
File.open(@target, 'w') do |f|
|
|
||||||
f.write(YAML.dump(JSON.load(IO.read(@sources.first))))
|
|
||||||
end
|
|
||||||
@cache.register_build(@target, :JsonToYaml, @sources, @env)
|
|
||||||
end
|
|
||||||
true
|
|
||||||
end
|
|
||||||
env.JsonToYaml('foo.yml', 'foo.json')
|
|
||||||
end
|
|
||||||
end
|
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
Rscons::Environment.new do |env|
|
||||||
|
require 'json'
|
||||||
|
require 'yaml'
|
||||||
|
env.add_builder(:JsonToYaml) do |target, sources, cache, env, vars|
|
||||||
|
unless cache.up_to_date?(target, :JsonToYaml, sources, env)
|
||||||
|
cache.mkdir_p(File.dirname(target))
|
||||||
|
File.open(target, 'w') do |f|
|
||||||
|
f.write(YAML.dump(JSON.load(IO.read(sources.first))))
|
||||||
|
end
|
||||||
|
cache.register_build(target, :JsonToYaml, sources, env)
|
||||||
|
end
|
||||||
|
target
|
||||||
|
end
|
||||||
|
env.JsonToYaml('foo.yml', 'foo.json')
|
||||||
|
end
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
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
|
|
||||||
end
|
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
Rscons::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
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
build do
|
|
||||||
Environment.new 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
|
|
||||||
@@ -1,6 +1,4 @@
|
|||||||
build do
|
Rscons::Environment.new(echo: :command) do |env|
|
||||||
Environment.new(echo: :command) do |env|
|
|
||||||
env["ARCMD"] = %w[ar rcf ${_TARGET} ${_SOURCES}]
|
env["ARCMD"] = %w[ar rcf ${_TARGET} ${_SOURCES}]
|
||||||
env.Library("lib.a", glob("*.c"))
|
env.Library("lib.a", Rscons.glob("*.c"))
|
||||||
end
|
|
||||||
end
|
end
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
build do
|
|
||||||
Environment.new do |env|
|
|
||||||
env.Preprocess("pp", "foo.h")
|
|
||||||
end
|
|
||||||
end
|
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
Rscons::Environment.new do |env|
|
||||||
|
env.Preprocess("pp", "foo.h")
|
||||||
|
end
|
||||||
Loaded 100 of 230 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user