Compare commits

...

177 Commits

Author SHA1 Message Date
44dd279f93 wip 2022-02-05 15:17:13 -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
a2f72c6b87 v2.3.0 2021-12-04 09:43:03 -05:00
7055cad73c Add v2.3.0 release notes 2021-12-04 09:27:24 -05:00
4548f4e3c9 Document phony targets - close #141 2021-12-01 23:00:12 -05:00
19dbab3426 Run subsidiary rscons binary from rscons() method if found - close #129 2021-11-28 22:36:24 -05:00
69f5bea2b2 Fix specs for dependency file moving - #135 2021-11-28 15:10:25 -05:00
2ee9dda49d Write dependency file to build directory when user invokes Object builder directly - close #135 2021-11-18 20:18:19 -05:00
f011b23499 Add PATH manipulation methods - close #126 2021-11-17 21:39:58 -05:00
80d52f25b8 Document CMD_STDOUT variable for Command builder - close #134 2021-11-15 21:52:11 -05:00
0face546e3 Clarify failed command error message indicating to run -F - close #133 2021-11-15 21:45:18 -05:00
ca747232cd Support passing a directory to rscons() method - close #128 2021-11-13 11:36:25 -05:00
a7b46093e9 Document -f command line option - close #130 2021-11-13 11:07:15 -05:00
09892eed63 Add DEVELOPING.md 2021-11-07 21:09:42 -05:00
117df43f64 Document rscons() build script method for subsidiary build scripts 2021-10-27 23:02:04 -04:00
acc12822b6 Add description for user_guide task 2021-10-27 22:42:31 -04:00
8c7b43f60c Show a message when entering/leaving a subsidiary script directory 2021-10-22 16:48:44 -04:00
7c8becc3f9 env.depends() does not work with build-root-relative "^/" paths - close #121 2021-10-22 16:03:10 -04:00
d1a35501ef Support subsidiary Rsconscript files - close #125 2021-10-22 13:58:38 -04:00
28a245f0ab build_dist: Remove lines marked just for specs 2021-10-22 13:58:38 -04:00
87a6d9f04f Do not run simplecov on dspec specs 2021-10-22 13:58:38 -04:00
556c821cc6 Commonize error handling across all operations 2021-10-21 18:35:58 -04:00
441fc9bc65 bundle update 2021-09-02 15:37:33 -04:00
1861874f5c bundle update 2021-01-11 15:15:42 -05:00
dependabot[bot]
6d51c5cbde
Bump redcarpet from 3.5.0 to 3.5.1
Bumps [redcarpet](https://github.com/vmg/redcarpet) from 3.5.0 to 3.5.1.
- [Release notes](https://github.com/vmg/redcarpet/releases)
- [Changelog](https://github.com/vmg/redcarpet/blob/master/CHANGELOG.md)
- [Commits](https://github.com/vmg/redcarpet/compare/v3.5.0...v3.5.1)

Signed-off-by: dependabot[bot] <support@github.com>
2021-01-11 19:21:14 +00:00
73af83803a add v2.2.0 release notes 2020-10-13 19:04:29 -04:00
353f4f45bc v2.2.0 2020-10-13 18:59:18 -04:00
5bac91f92f add failure messages for failed configuration checks - close #119 2020-10-12 21:01:04 -04:00
bbe9563ceb compiler checks should support cross-compilers and freestanding compilers - close #118 2020-10-08 19:23:17 -04:00
5ec74604c6 improve support for MSYS2 - close #120 2020-10-08 19:04:50 -04:00
8e06efe61e v2.1.0 2020-04-16 16:52:58 -04:00
0756874ddb update CHANGELOG for v2.1.0 2020-04-16 16:51:16 -04:00
dded5e2648 ruby 2.7 compatibility - #117 2020-04-16 15:48:45 -04:00
fbe60f6ba2 stick with simplecov 0.15.x for now 2020-04-16 15:02:01 -04:00
8dd9799666 Revert "update simplecov"
This reverts commit 01ca86de8b02ef7db222eb5db2598762ba9a516b.
2020-04-16 15:02:01 -04:00
f2c755c8bb update bundle 2020-04-16 13:07:20 -04:00
01ca86de8b update simplecov 2020-02-29 14:27:21 -05:00
943fabd0d1 update some gems 2020-02-29 10:47:46 -05:00
d08e2f6b5c v2.0.2 2019-12-16 21:36:38 -05:00
90365dd197 update CHANGELOG for v2.0.2 2019-12-16 21:36:22 -05:00
8d05516c40 distinguish object files built from multiple sources with the same base name but different extensions - close #113 2019-12-14 00:10:42 -05:00
db49d86866 show a configuration failed message on stderr on configuration failure 2019-10-14 22:57:49 -04:00
e667455c32 user guide: fix configure script example 2019-10-14 22:49:34 -04:00
e62332aba6 avoid backtrace when configuring fails during autoconf 2019-10-14 22:23:18 -04:00
397639849d call print_run_message() in json_to_yaml build test 2019-10-12 17:59:08 -04:00
96d5caf2e5 user guide: fix print_run_message() examples 2019-10-12 17:57:58 -04:00
f4b10a30af update CHANGELOG for v2.0.1 2019-10-02 21:10:29 -04:00
cf52c3fc6f v2.0.1 2019-10-02 20:59:58 -04:00
5378afb6f8 Install builder cannot replace a currently executing binary on Linux - close #112 2019-09-28 23:18:31 -04:00
48d9273cc6 v2.0.0 2019-09-11 23:32:27 -04:00
efea4f1181 user guide: Installation: mention marking rscons executable 2019-09-11 23:29:25 -04:00
b4fa6d965c CHANGELOG - add logo 2019-09-11 23:25:19 -04:00
ac56ad34f6 add rscons logo to README 2019-09-11 23:24:20 -04:00
2fd533a32a clobber large_project directory 2019-09-11 23:20:22 -04:00
c938ed71d1 add "all" rake task 2019-09-11 23:19:46 -04:00
ec60201a62 user guide: add rscons logo 2019-09-11 23:18:38 -04:00
0cafb8c5b3 user guide: stylize as "Rscons" 2019-09-11 23:15:16 -04:00
004810386b clobber should remove "gen" directory 2019-09-11 23:15:02 -04:00
a15ee9daaf add logo images 2019-09-11 23:02:17 -04:00
cd33405697 user guide: add FreeBSD compatibility 2019-09-01 21:52:32 -04:00
efa77066bf allow ConfigureOp#log_and_test_command to be passed standard input data - close #111 2019-09-01 21:50:57 -04:00
a1bb9d81fd check_program: do not fail on Windows for non-existent PATH entries 2019-08-27 19:47:21 -04:00
0344f02cb1 build tests: use -m instead of -lc for mingw 2019-08-27 19:32:36 -04:00
d52bdaf046 build tests: do ldc2 tests even if omit_gdc_tests set 2019-08-27 18:51:56 -04:00
ad7ccb771d update build test for gdc fix 2019-08-27 18:50:01 -04:00
044ee343ca Use OBJSUFFIX of .obj for ldc2 on Windows. 2019-08-26 19:10:19 -04:00
eb54a2b64a fix specs create_exe() on Windows 2019-08-26 18:51:03 -04:00
2dd1ce9f1d Use base64 encoding for compressed script to avoid encoding issues. 2019-08-26 18:33:42 -04:00
1e157c79ec fix dependency parsing with ldc2 - close #110 2019-08-19 22:56:54 -04:00
2385874f4a v2.0.0beta2 2019-08-17 17:07:59 -04:00
c5c42e6f4a user guide: document a couple missing configure flags and link to YARD some places 2019-08-17 17:00:36 -04:00
9a627b2150 add YARD comments to get to 100% YARD coverage 2019-08-17 16:42:14 -04:00
937c964c3e document :use better 2019-08-17 16:35:06 -04:00
a2a1d08014 user guide: document Custom Configuration Checks 2019-08-17 16:35:06 -04:00
0ccf43cc96 custom config checks - close #108 2019-08-17 16:06:37 -04:00
d202e15a57 user guide: document direct mode for Program/SharedLibrary builders 2019-07-29 21:57:38 -04:00
94f808b1fc user guide: add Barriers section 2019-07-29 21:32:04 -04:00
51a9dd365f add :check_libpath option to check_lib configuration method - #107 2019-07-29 21:00:52 -04:00
6e590b62a6 add :check_cpppath option to check_c_header and check_cxx_header
configuration methods
add :check_d_import_path option to check_d_import configuration method - #107
2019-07-09 23:53:17 -04:00
3aac190ad6 configure checks: compile instead of link when looking for C/C++ header files and D imports 2019-07-09 23:41:51 -04:00
d6b9487e65 user guide: document -F command-line flag 2019-07-09 23:06:45 -04:00
66d2700faa clarify -F command-line option usage more 2019-07-09 23:06:45 -04:00
ba98af1424 default configure checks :fail option to false if :set_define is specified 2019-07-09 22:00:50 -04:00
cf4f80c9ae user guide: document first compiler found is used 2019-07-09 21:47:45 -04:00
d74785d579 Add v2.0.0 changes to CHANGELOG.md 2019-07-07 22:15:44 -04:00
4fd822fb95 user guide: add warning when viewing markdown source file directly 2019-07-07 21:38:17 -04:00
b39fd80d8c user guide: add ./configure && make Appendix section 2019-07-07 21:29:30 -04:00
ef00c9f377 add link to github.io site from README.md 2019-07-02 22:39:33 -04:00
1ddc03b285 v2.0.0beta1 2019-07-02 22:31:27 -04:00
f686f9e787 user guide: rename Reference -> Appendix
add YARD API Documentation link
2019-07-02 22:27:11 -04:00
b6c19b7f00 generate YARD docs to gen/yard 2019-07-02 22:04:06 -04:00
4fc18e5d91 remove README.md content that was moved to user guide 2019-07-02 22:00:03 -04:00
cda5584448 user guide: import some content from README.md 2019-07-02 21:59:22 -04:00
30d82392b5 user guide: fill in Default Construction Variables section 2019-07-02 21:25:16 -04:00
63d875da7f bundle update 2019-07-02 19:44:12 -04:00
8593c5e219 user guide: fill in a lot of Adding Custom Builders section 2019-06-23 19:07:20 -04:00
9bf0abbece user guide: fix inter-page links 2019-06-23 17:29:50 -04:00
02ef6e0846 user guide updates 2019-06-23 17:27:16 -04:00
f97ee94e44 user guide: fix single-page TOC links 2019-06-14 21:53:57 -04:00
55a2ea6d6b user guide: fill in Adding New Languages section 2019-06-14 21:48:27 -04:00
59ab8e46c4 user guide: change page navigation to a table 2019-06-14 17:24:31 -04:00
baebe744b3 user guide: fixed page width 2019-06-14 16:51:14 -04:00
0ad3f815c5 user guide: include section numbers in page navigation links 2019-06-14 16:47:54 -04:00
ca6336c715 user guide: add page navigation links 2019-06-14 16:45:59 -04:00
a11c27f415 user guide: break more sections into separate pages 2019-06-14 16:23:09 -04:00
5c77cac354 user guide: turn on multi-page generation 2019-06-14 16:16:02 -04:00
46294b2a88 user guide: add Page class to prepare for multi-page output 2019-06-14 16:09:44 -04:00
5f71781806 user guide: preparing for multi-page generation 2019-06-14 16:04:14 -04:00
22b007df3a user guide: create render_toc() and render_section() methods 2019-06-14 15:55:55 -04:00
4339d358f8 user guide: Builders comment about starting path with "^/" 2019-06-14 15:44:06 -04:00
e4b96b759f user guide: implement section links 2019-06-14 15:42:21 -04:00
fcb686ac5f user guide: keep track of page for sections 2019-06-14 15:34:01 -04:00
e5c690a4fc user guide: expand Builders section 2019-06-14 15:16:22 -04:00
5b67ad88d3 user guide: document an Environment a bit more 2019-06-14 15:16:12 -04:00
dbd8b47bf9 add Getting Started section 2019-06-14 14:52:56 -04:00
8222958ae3 promote CHANGELOG.md section levels 2019-06-14 14:47:59 -04:00
56f104b5e7 user guide: improve changelog handling 2019-06-14 14:44:00 -04:00
947a65a75e user guide: fix section anchors 2019-06-09 22:45:26 -04:00
66fac4f982 remove link underlines 2019-06-09 22:43:44 -04:00
254584435f user guide: indent table of contents 2019-06-09 22:40:07 -04:00
f74d8202d3 user guide: add table of contents 2019-06-09 22:31:47 -04:00
bbf2319da6 user guide: generate section numbers 2019-06-09 22:17:00 -04:00
812b1cbe9c user guide: put borders on body content 2019-06-09 15:34:41 -04:00
0d2fe02b9c user guide updates for code sections 2019-06-09 13:22:01 -04:00
c7fb88db82 rename rake task gen_user_guide -> user_guide 2019-06-09 13:04:12 -04:00
49f4367125 update LICENSE.txt 2019-06-09 13:01:30 -04:00
c4d062752d quote some CHANGELOG entries to avoid Markdown processing 2019-06-09 12:58:35 -04:00
5b3e10ff72 add Ruby syntax highlighting to user guide generator 2019-06-08 22:56:26 -04:00
5f1ad78e8c continue on user guide generator 2019-06-08 22:27:19 -04:00
9f00063d57 add gen_user_guide task 2019-06-08 21:46:04 -04:00
6328ceee2a start on user guide html generator 2019-06-05 00:13:27 -04:00
26a9307533 User Guide: add a couple ${include}'s 2019-06-05 00:06:34 -04:00
90886ed9ad User Guide: add glob() and Builders documentation 2019-06-04 22:59:04 -04:00
8df73e9d11 User Guide: add Build Operations section 2019-06-02 12:20:23 -04:00
f239b27c3a add user guide section: Writing the Build Script / configure Block 2019-05-26 19:47:44 -04:00
5e6b83411b User Guide: clarify Build Correctness section 2019-05-22 23:42:49 -04:00
54e77f235f finish documentation for command-line operations 2019-05-22 23:31:37 -04:00
4e08de9043 pull in redcarpet and syntax gems 2019-05-21 23:50:26 -04:00
0d8aec0eb1 fill in a couple links 2019-05-21 23:36:58 -04:00
573a542f84 add doc/user_guide.md 2019-05-21 23:20:45 -04:00
ef2a9084db allow --help CLI option with no Rsconscript present - close #106 2019-05-19 12:13:03 -04:00
bfcd0c0b05 generate yard docs to /yard instead of /doc 2019-05-14 21:35:56 -04:00
215f5e4b51 move Environment#shell to BasicEnvironment; clean up a few yard warnings 2019-05-09 22:41:28 -04:00
6229cef015 remove @since tags for 2.0.0 2019-05-09 22:33:26 -04:00
6be0d322a7 store expanded .rscons script next to rscons script - close #105 2019-05-09 22:30:20 -04:00
89e43fea1c use 10000 sources for large project instead of 1000 2019-05-09 22:22:14 -04:00
458eeaf93d Add VarSet#get_var and Environment#get_var - #92 2019-05-09 21:52:07 -04:00
dd3d468a28 minor clarification to Environment#process_step behavior 2019-05-09 21:36:31 -04:00
a4dec210ae slightly reorder VarSet#deep_dup to optimize - #92 2019-05-08 23:16:22 -04:00
fa14102ba5 Reorder VarSet#expand_varref class checks so the more common ones match earlier - #92 2019-05-08 22:50:34 -04:00
87a15b3868 Do not calculate checksums for side-effect files - #92 2019-05-08 22:39:50 -04:00
f23fbcd6d1 clear file checksum cache less frequently - #92 2019-05-08 22:30:41 -04:00
b02a7573b9 speed up handling of registered side-effect files - #92 2019-05-08 22:15:44 -04:00
d0cd0a14a4 remove Cache#validate_json_object - #92 2019-04-30 22:30:24 -04:00
5cb895f465 add gen_large_project rake task for testing rscons performance on a large project 2019-04-30 22:25:45 -04:00
cd1c54bf0d update output coloring with highlighting for target and source filenames - close #104 2019-04-30 21:05:44 -04:00
a4fead7dc6 show build progress - close #98 2019-04-28 22:40:50 -04:00
59a3cb4e10 verbose mode should list operations and their execution times - close #103 2019-04-27 22:29:18 -04:00
785e8e18fd a clean operation should preserve install target cache info - close #101 2019-04-27 21:39:52 -04:00
49e1bca1f7 uninstall operation should list removed entities in verbose mode - close #102 2019-04-27 21:28:56 -04:00
fd054a07c4 implement install and uninstall operations - close #82
add "prefix" construction variable - close #99
add InstallDirectory builder - close #100
2019-04-23 22:01:09 -04:00
328babe1f4 imbue Cache with knowledge of whether a target or directory is for a build or install operation 2019-04-22 22:19:39 -04:00
196 changed files with 5892 additions and 2166 deletions

4
.gitignore vendored
View File

@ -4,6 +4,8 @@
/build_test_run/
/coverage/
/dist/
/doc/
/gen/
/large_project/
/pkg/
/test/
/yard/

View File

@ -1,80 +1,156 @@
## ChangeLog
## v2.3.0
### v1.17.0
### New Features
#### New Features
- #125 - Support subsidiary Rsconscript files
- #126 - Add PATH manipulation methods
### Fixes
- #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
- #135 - Write dependency file to build directory when user invokes Object builder directly
- #141 - Document phony targets
## v2.2.0
### New Features
- #120 - improve support for MSYS2
- #119 - add failure messages for failed configuration checks
- #118 - compiler checks should support cross-compilers and freestanding compilers
## v2.1.0
### New Features
- #117 - ruby 2.7 compatibility
## v2.0.2
### Fixes
- #113 - distinguish object files built from multiple sources with the same base name but different extensions
## v2.0.1
### Fixes
- #112 - Install builder cannot replace a currently executing binary on Linux
## v2.0.0
- convert rscons from a Ruby gem to a standalone script
- compress rscons distributable script
- add configure operation to detect compilers, check for headers/libraries, etc... (invoked automatically if needed)
- Environments store builder classes instead of instances of builder classes
- use a separate Builder instance for each build operation
- load Rsconscript from Rsconscript/Rsconscript.rb instead of Rsconsfile
- drop support for builder run methods using the old 5 parameter signature
- remove Environment#build_dir
- set Environment build root in configure step
- remove Builder#finalize (now #run called repeatedly until builder completes)
- remove Builder#setup
- remove Builder#features and Builder#produces?
- add functionality to allow builders to wait on Ruby threads or other builders
- add install/uninstall/distclean command-line operations
- preserve makefile dependency files under build directory
- remove a few deprecated methods
- pass a Builder instance to build hooks instead of a build operation Hash
- support a basic markup syntax in builder run messages to colorize target/source files
- hide (but store) failed compilation command by default so the user doesn't have to scroll back as much to see compiler output
- refactor to remove some redundancy among built-in builders
- track object file source language (correctly determine linker when only passed object files previously built by particular toolchains)
- add barriers
- add InstallDirectory builder
- change Install builder to copy files on 'install' operation
- add "prefix" construction variable based on configured installation prefix
- allow passing builder objects as sources to build targets
- differentiate 'build' targets from 'install' targets in cache contents
- add verbose mode
- show build progress as a percentage in builder output messages
- various performance improvements
- wrote a new user guide
- added new website ([https://holtrop.github.io/rscons/](https://holtrop.github.io/rscons/))
- added new logo
## v1.17.0
### New Features
- allow construction variable expansion on `true` and `false` values.
- remove makefile target name check when parsing dependencies
### v1.16.0
## v1.16.0
#### New Features
### New Features
- Add `Rscons.glob`
- Support command-line variables
- improve debuggability of cache.up_to_date?
- improve debuggability of `cache.up_to_date?`
- allow passing a VarSet into cache methods
#### Fixes
### Fixes
- generate dependencies for D builds
### v1.15.0
## v1.15.0
- allow json 1.x or 2.x
### v1.14.0
## v1.14.0
#### New Features
### New Features
- #45 - Add Rscons::VarSet#values_at
- #45 - Add `Rscons::VarSet#values_at`
#### Fixes
### Fixes
- #44 - Environment#print_builder_run_message should support string commands
- #44 - `Environment#print_builder_run_message` should support string commands
### v1.13.0
## v1.13.0
#### New Features
### New Features
- #43 - Add ability to record side-effect file production
### v1.12.0
## v1.12.0
#### New Features
### New Features
- #40 - env.depends should imply env.build_after
- #40 - env.depends should imply `env.build_after`
- #41 - be more colorful
#### Fixes
### Fixes
- #39 - wait for in-progress subcommands to complete on build failure
- #42 - cloned Environments should inherit n_threads
- #42 - cloned Environments should inherit `n_threads`
### v1.11.1
## v1.11.1
#### Fixes
### Fixes
- fix the circular build dependency detection logic
### v1.11.0
## v1.11.0
#### New Features
### New Features
- Change default Environment :clone option to :all to clone all attributes
- #38 - raise error when circular dependencies are found
- #34 - Allow overriding n_threads on a per-Environment level
- #34 - Allow overriding `n_threads` on a per-Environment level
#### Fixes
### Fixes
- #35 - env.build_after should expand paths
- #36 - SHCFLAGS and SHCXXFLAGS should inherit non-SH flags by default
- #37 - Fix non-blocking thread-wait if Rscons.n_threads is set to 0
- #35 - `env.build_after` should expand paths
- #36 - `SHCFLAGS` and `SHCXXFLAGS` should inherit non-SH flags by default
- #37 - Fix non-blocking thread-wait if `Rscons.n_threads` is set to 0
### v1.10.0
## v1.10.0
#### New Features
### New Features
- #23 - add parallelization - builds are now parallelized by default
- #31 - add LEXSUFFIX, YACCSUFFIX construction variables
@ -84,100 +160,100 @@
- Add builder features
- #8 - add SharedObject and SharedLibrary builders
#### Fixes
### Fixes
- expand target and source paths before calling Builder#create_build_target
- #29 - fix PROGSUFFIX handling
- expand target and source paths before calling `Builder#create_build_target`
- #29 - fix `PROGSUFFIX` handling
- #32 - Pre-build hooks do not respect modified key values
### v1.9.3
## v1.9.3
- Environment#parse_flags should put -std=XXX flags in CCFLAGS, not CFLAGS
- `Environment#parse_flags` should put -std=XXX flags in CCFLAGS, not CFLAGS
### v1.9.2
## v1.9.2
- allow phony targets in conjunction with build roots
### v1.9.1
## v1.9.1
- change *SUFFIX defaults to arrays
- add various C++ file suffixes
- use ${INCPREFIX} instead of hard-coded "-I" in Preprocess builder
### v1.9.0
## v1.9.0
#### New Features
### New Features
- #6 - add Install and Copy builders
- #22 - allow overriding Command builder short description with CMD_DESC variable
- #22 - allow overriding Command builder short description with `CMD_DESC` variable
- #24 - add "rscons" executable
- #25 - add support for phony targets given as Symbols instead of Strings
- #26 - support registering multiple build targets with the same target name
- #27 - add Directory builder
#### Fixes
### Fixes
- #20 - fix variable references that expand to arrays in build target sources
- #21 - rework Preprocess builder to consider deep dependencies
- fix Rscons.set_suffix to append the given suffix if the filename has none
- remove ${CFLAGS} from default CPP_CMD
- fix `Rscons.set_suffix` to append the given suffix if the filename has none
- remove ${CFLAGS} from default `CPP_CMD`
### v1.8.1
## v1.8.1
- fix Environment#dump when construction variables are symbols
### v1.8.0
## v1.8.0
- new Command builder to execute arbitrary user commands
- new SimpleBuilder class
- create new builders quickly by passing a block to Environment#add_builder
- create new builders quickly by passing a block to `Environment#add_builder`
- improved YARD documentation
- add Environment#dump to debug Environment construction variables
### v1.7.0
## v1.7.0
- allow build hooks to register new build targets
- add post-build hooks (register with Environment#add_post_build_hook)
- add post-build hooks (register with `Environment#add_post_build_hook`)
- clear all build targets after processing an Environment
- allow trailing slashes in arguments to Environment#build_dir
- allow trailing slashes in arguments to `Environment#build_dir`
### v1.6.1
## v1.6.1
- add DEPFILESUFFIX construction variable to override dependency file suffix
- fix Environment#depends to expand its arguments for construction variables
### v1.6.0
## v1.6.0
- support lambdas as construction variable values
### v1.5.0
## v1.5.0
- add "json" as a runtime dependency
- update construction variables to match SCons more closely
- add CPPDEFPREFIX, INCPREFIX, CPPDEFINES, CCFLAGS, LIBDIRPREFIX, and LIBLINKPREFIX
- add Environment#shell
- add Environment#parse_flags, #parse_flags!, #merge_flags
- unbuffer $stdout by default
- add PROGSUFFIX construction variable (defaults to .exe on MinGW/Cygwin)
- add Rscons::BuildTarget and Builder#create_build_target
- add `CPPDEFPREFIX`, `INCPREFIX`, `CPPDEFINES`, `CCFLAGS`, `LIBDIRPREFIX`, and `LIBLINKPREFIX`
- add `Environment#shell`
- add `Environment#parse_flags`, `#parse_flags!`, `#merge_flags`
- unbuffer `$stdout` by default
- add `PROGSUFFIX` construction variable (defaults to `.exe` on MinGW/Cygwin)
- add `Rscons::BuildTarget` and `Builder#create_build_target`
- update specs to RSpec 3.x and fix to run on MinGW/Cygwin/Linux
- add YARD documentation to get to 100% coverage
### v1.4.3
## v1.4.3
- fix builders properly using construction variable overrides
- expand nil construction variables to empty strings
### v1.4.2
## v1.4.2
- add Environment#expand_path
- add `Environment#expand_path`
- expand construction variable references in builder targets and sources before invoking builder
### v1.4.1
## v1.4.1
- fix invoking a builder with no sources while a build root defined
### v1.4.0
## v1.4.0
- add CFile builder
- add Disassemble builder
@ -190,21 +266,21 @@
- implement copy-on-write semantics for construction variables when cloning Environments
- only load the cache once instead of on each Environment#process
- only write the cache when something has changed
- fix Cache#mkdir_p to handle relative paths (Issue #5)
- fix `Cache#mkdir_p` to handle relative paths (Issue #5)
- flush the cache to disk if a builder raises an exception (Issue #4)
### v1.3.0
## v1.3.0
- change Environment#execute() options parameter to accept the following options keys:
- :env to pass an environment Hash to Kernel#system
- :options to pass an options Hash to Kernel#system
### v1.2.0
## v1.2.0
- add :clone option to Environment#clone to control exactly which Environment attributes are cloned
- allow nil to be passed in to Environment#build_root=
- allow nil to be passed in to `Environment#build_root=`
### v1.1.0
## v1.1.0
- Change Cache#up_to_date?() and #register_build() to accept a single target
- Change `Cache#up_to_date?` and `#register_build` to accept a single target
file or an array of target file names

14
DEVELOPING.md Normal file
View File

@ -0,0 +1,14 @@
# Developing
# Specs
To run the rscons specs, the following commands must be available:
* gcc
* clang
* g++
* clang++
* gdc
* ldc
* flex
* bison

14
Gemfile
View File

@ -1,8 +1,14 @@
source 'https://rubygems.org'
gem "json"
gem "rspec"
gem "rake"
gem "simplecov"
gem "yard"
gem "rdoc"
gem "simplecov", "~> 0.15.0"
if RbConfig::CONFIG["host"]["msys"]
gem "json", "2.1.0"
else
gem "json"
gem "yard"
gem "rdoc"
gem "redcarpet"
gem "syntax"
end

View File

@ -1,30 +1,32 @@
GEM
remote: https://rubygems.org/
specs:
diff-lcs (1.3)
diff-lcs (1.4.4)
docile (1.1.5)
json (2.1.0)
rake (12.3.1)
rdoc (5.1.0)
rspec (3.6.0)
rspec-core (~> 3.6.0)
rspec-expectations (~> 3.6.0)
rspec-mocks (~> 3.6.0)
rspec-core (3.6.0)
rspec-support (~> 3.6.0)
rspec-expectations (3.6.0)
json (2.5.1)
rake (13.0.6)
rdoc (6.3.2)
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)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.6.0)
rspec-mocks (3.6.0)
rspec-support (~> 3.10.0)
rspec-mocks (3.10.2)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.6.0)
rspec-support (3.6.0)
simplecov (0.15.0)
rspec-support (~> 3.10.0)
rspec-support (3.10.2)
simplecov (0.15.1)
docile (~> 1.1.0)
json (>= 1.8, < 3)
simplecov-html (~> 0.10.0)
simplecov-html (0.10.2)
yard (0.9.12)
syntax (1.2.2)
yard (0.9.26)
PLATFORMS
ruby
@ -34,9 +36,11 @@ DEPENDENCIES
json
rake
rdoc
redcarpet
rspec
simplecov
simplecov (~> 0.15.0)
syntax
yard
BUNDLED WITH
1.16.2
2.1.4

View File

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

591
README.md
View File

@ -1,591 +1,10 @@
# Rscons
Rscons (https://github.com/holtrop/rscons) is a software construction framework
inspired by SCons and waf but implemented in Ruby.
![rscons logo](img/rscons_logo_1000.png)
## Installation
Rscons (https://github.com/holtrop/rscons) is an open-source build system
for developers.
Rscons is distributed as a standalone Ruby script named ``rscons``. This file
(containing the complete rscons build system) can be checked into your project
and versioned along with your project.
Rscons is written in Ruby, and is inspired by [SCons](https://scons.org/) and [waf](https://waf.io/).
## Usage
### Standalone
Rscons provides a standalone executable ("rscons") with a command-line
interface. The rscons executable will read a build script (by default named
Rsconsfile or Rsconsfile.rb) and execute its contents.
### With Rake
Rscons can be used with rake as well. The same content that would be written
in Rsconsfile can be placed in a Rakefile. It could be placed within a rake
task block or split among multiple tasks.
## Example Build Scripts
### Example: Building a C Program
```ruby
Rscons::Environment.new do |env|
env["CFLAGS"] << "-Wall"
env.Program("program", Rscons.glob("src/**/*.c"))
end
```
### Example: Building a D Program
```ruby
Rscons::Environment.new do |env|
env["DFLAGS"] << "-Wall"
env.Program("program", Rscons.glob("src/**/*.d"))
end
```
### Example: Cloning an Environment
```ruby
main_env = Rscons::Environment.new do |env|
# Store object files from sources under "src" in "build/main"
env.build_dir("src", "build/main")
env["CFLAGS"] = ["-DSOME_DEFINE", "-O3"]
env["LIBS"] = ["SDL"]
env.Program("program", Rscons.glob("src/**/*.cc"))
end
debug_env = main_env.clone do |env|
# Store object files from sources under "src" in "build/debug"
env.build_dir("src", "build/debug")
env["CFLAGS"] -= ["-O3"]
env["CFLAGS"] += ["-g", "-O0"]
env.Program("program-debug", Rscons.glob("src/**/*.cc"))
end
```
### Example: Custom Builder
Custom builders are implemented as classes which extend from `Rscons::Builder`.
The builder must have a `run` method which is called to invoke the builder.
The `run` method should return the name of the target built on success, and
`false` on failure.
```ruby
class GenerateFoo < Rscons::Builder
def run(target, sources, cache, env, vars)
cache.mkdir_p(File.dirname(target))
File.open(target, "w") do |fh|
fh.puts <<EOF
#define GENERATED 42
EOF
end
target
end
end
Rscons::Environment.new do |env|
env.add_builder(GenerateFoo.new)
env.GenerateFoo("foo.h", [])
env.Program("a.out", Rscons.glob("*.c"))
end
```
### Example: Custom Builder That Only Regenerates When Necessary
```ruby
class CmdBuilder < Rscons::Builder
def run(target, sources, cache, env, vars)
cmd = ["cmd", "-i", sources.first, "-o", target]
unless cache.up_to_date?(target, cmd, sources, env)
cache.mkdir_p(File.dirname(target))
system(cmd)
cache.register_build(target, cmd, sources, env)
end
target
end
end
Rscons::Environment.new do |env|
env.add_builder(CmdBuilder.new)
env.CmdBuilder("foo.gen", "foo_gen.cfg")
end
```
The `Cache#up_to_date?` method accepts an optional 5th parameter which is an
options Hash. The `:debug` option can be specified in this Hash with a value
of `true` to aid in debugging builders while developing them. For example:
```ruby
unless cache.up_to_date?(target, cmd, sources, env, debug: true)
end
```
### Example: Custom Builder That Generates Multiple Output Files
```ruby
class CModuleGenerator < Rscons::Builder
def run(target, sources, cache, env, vars)
c_fname = target
h_fname = target.sub(/\.c$/, ".h")
cmd = ["generate_c_and_h", sources.first, c_fname, h_fname]
unless cache.up_to_date?([c_fname, h_fname], cmd, sources, env)
cache.mkdir_p(File.dirname(target))
system(cmd)
cache.register_build([c_fname, h_fname], cmd, sources, env)
end
target
end
end
Rscons::Environment.new do |env|
env.add_builder(CModuleGenerator.new)
env.CModuleGenerator("build/foo.c", "foo_gen.cfg")
end
```
### Example: Custom Builder Using Builder#standard_build()
The `standard_build` method from the `Rscons::Builder` base class can be used
when the builder needs to execute a system command to produce the target file.
The `standard_build` method will return the correct value so its return value
can be used as the return value from the `run` method.
```ruby
class CmdBuilder < Rscons::Builder
def run(target, sources, cache, env, vars)
cmd = ["cmd", "-i", sources.first, "-o", target]
standard_build("CmdBld #{target}", target, cmd, sources, env, cache)
end
end
Rscons::Environment.new do |env|
env.add_builder(CmdBuilder.new)
env.CmdBuilder("foo.gen", "foo_gen.cfg")
end
```
### Example: Custom Builder Using Environment#add_builder()
The `add_builder` method of the `Rscons::Environment` class optionally allows
you to define and register a builder by providing a name and action block. This
can be useful if the builder you are trying to define is easily expressed as a
short ruby procedure. When `add_builder` is called in this manner a new builder
will be registered with the environment with the given name. When this builder
is used it will call the provided block in order to build the target.
```ruby
Rscons::Environment.new do |env|
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
```
### Example: Using different compilation flags for some sources
```ruby
Rscons::Environment.new do |env|
env["CFLAGS"] = ["-O3", "-Wall", "-DDEFINE"]
env.add_build_hook do |build_op|
if build_op[:target] =~ %r{build/third-party}
build_op[:vars]["CFLAGS"] -= ["-Wall"]
end
end
env.build_dir("src", "build")
env.Program("program", Rscons.glob("**/*.cc"))
end
```
### Example: Creating a static library
```ruby
Rscons::Environment.new do |env|
env.Library("mylib.a", Rscons.glob("src/**/*.c"))
end
```
### Example: Creating a C++ parser source from a Yacc/Bison input file
```ruby
Rscons::Environment.new do |env|
env.CFile("#{env.build_root}/parser.tab.cc", "parser.yy")
end
```
## Details
### Environments
The Environment is the main top-level object that Rscons operates with. An
Environment must be created by the user in order to build anything. All build
targets are registered within an Environment. In many cases only a single
Environment will be needed, but more than one can be created (either from
scratch or by cloning another existing Environment) if needed.
An Environment consists of:
* a collection of builders
* a collection of construction variables used by those builders
* a mapping of build directories from source directories
* a default build root to apply if no specific build directories are matched
* a collection of user-defined build targets
* a collection of user-defined build hooks
When cloning an environment, by default the construction variables, builders,
build hooks, build directories, and build root are cloned, but the new
environment does not inherit any of the registered build targets.
The set of environment attributes that are cloned is controllable via the
`:clone` option to the `#clone` method.
For example, `env.clone(clone: [:variables, :builders])` will include
construction variables, and builders but not build hooks, build directories, or
the build root.
The set of pending targets is never cloned.
Cloned environments contain "deep copies" of construction variables.
For example, in:
```ruby
base_env = Rscons::Environment.new
base_env["CPPPATH"] = ["one", "two"]
cloned_env = base_env.clone
cloned_env["CPPPATH"] << "three"
```
`base_env["CPPPATH"]` will not include "three".
### Builders
Builders are the workhorses that Rscons uses to execute build operations.
Each builder is specialized to perform a particular operation.
Rscons ships with a number of builders:
* Command, which executes a user-defined command to produce the target.
* Copy, which is identical to Install.
* CFile, which builds a C or C++ source file from a lex or yacc input file.
* Disassemble, which disassembles an object file to a disassembly listing.
* Install, which installs files or directories to a specified destination.
* Library, which collects object files into a static library archive file.
* Object, which compiles source files to produce an object file.
* Preprocess, which invokes the C/C++ preprocessor on a source file.
* Program, which links object files to produce an executable.
* SharedLibrary, which links object files to produce a dynamically loadable
library.
* SharedObject, which compiles source files to produce an object file, in a way
that is able to be used to create a shared library.
If you want to create an Environment that does not contain any builders,
you can use the `:exclude_builders` key to the Environment constructor.
#### Command
```ruby
env.Command(target, sources, "CMD" => command)
# Example
env.Command("docs.html", "docs.md",
"CMD" => ["pandoc", "-fmarkdown", "-thtml", "-o${_TARGET}", "${_SOURCES}"],
"CMD_DESC" => "PANDOC")
```
The command builder executes a user-defined command in order to produce the
desired target file based on the provided source files.
#### CFile
```ruby
env.CFile(target, source)
# Example
env.CFile("parser.c", "parser.y")
```
The CFile builder will generate a C or C++ source file from a lex (.l, .ll)
or yacc (.y, .yy) input file.
#### Disassemble
```ruby
env.Disassemble(target, source)
# Example
env.Disassemble("module.dis", "module.o")
```
The Disassemble builder generates a disassembly listing using objdump from
and object file.
#### Install
```ruby
env.Install(destination, sources)
# Example
env.Install("dist/bin", "app.exe")
env.Install("dist/share", "share")
```
#### Library
```ruby
env.Library(target, sources)
# Example
env.Library("lib.a", Rscons.glob("src/**/*.c"))
```
The Library builder creates a static library archive from the given source
files.
#### Object
```ruby
env.Object(target, sources)
# Example
env.Object("module.o", "module.c")
```
The Object builder compiles the given sources to an object file. Although it
can be called explicitly, it is more commonly implicitly called by the Program
builder.
#### Preprocess
```ruby
env.Preprocess(target, source)
# Example
env.Preprocess("module-preprocessed.cc", "module.cc")
```
The Preprocess builder invokes either `${CC}` or `${CXX}` (depending on if the
source contains an extension in `${CXXSUFFIX}` or not) and writes the
preprocessed output to the target file.
#### Program
```ruby
env.Program(target, sources)
# Example
env.Program("myprog", Rscons.glob("src/**/*.cc"))
```
The Program builder compiles and links the given sources to an executable file.
Object files or source files can be given as `sources`. A platform-dependent
program suffix will be appended to the target name if one is not specified.
This can be controlled with the `PROGSUFFIX` construction variable.
#### SharedLibrary
```ruby
env.SharedLibrary(target, sources)
# Example
env.SharedLibrary("mydll", Rscons.glob("src/**/*.cc"))
```
The SharedLibrary builder compiles and links the given sources to a dynamically
loadable library. Object files or source files can be given as `sources`.
A platform-dependent prefix and suffix will be appended to the target name if
they are not specified by the user. These values can be controlled by
overriding the `SHLIBPREFIX` and `SHLIBSUFFIX` construction variables.
#### SharedObject
```ruby
env.SharedObject(target, sources)
# Example
env.SharedObject("lib_module.o", "lib_module.c")
```
The SharedObject builder compiles the given sources to an object file. Any
compilation flags necessary to build the object file in a manner that allows it
to be used to create a shared library are added. Although it can be called
explicitly, it is more commonly implicitly called by the SharedLibrary builder.
### Construction Variables
Construction variables are used to define the toolset and any build options
that Rscons will use to build a project. The default construction variable
values are configured to build applications using gcc. However, all
construction variables can be overridden by the user.
| Name | Type | Description | Default |
| --- | --- | --- | --- |
| AR | String | Static library archiver executable | "ar" |
| ARCMD | Array | Static library archiver command line | ["${AR}", "${ARFLAGS}", "${_TARGET}", "${_SOURCES}"] |
| ARFLAGS | Array | Static library archiver flags | ["rcs"] |
| AS | String | Assembler executable | "${CC}" |
| ASCMD | Array | Assembler command line | ["${AS}", "-c", "-o", "${_TARGET}", "${ASDEPGEN}", "${INCPREFIX}${ASPPPATH}", "${ASPPFLAGS}", "${ASFLAGS}", "${_SOURCES}"] |
| ASDEPGEN | Array | Assembly dependency generation flags | ["-MMD", "-MF", "${_DEPFILE}", "-MT", "TARGET"] |
| ASFLAGS | Array | Assembler flags | [] |
| ASPPFLAGS | Array | Assembler preprocessor flags | ["${CPPFLAGS}"] |
| ASPPPATH | Array | Assembler preprocessor path | ["${CPPPATH}"] |
| ASSUFFIX | Array | Assembly file suffixes | [".S"] |
| CC | String | C compiler executable | "gcc" |
| CCCMD | Array | C compiler command line | ["${CC}", "-c", "-o", "${_TARGET}", "${CCDEPGEN}", "${INCPREFIX}${CPPPATH}", "${CPPFLAGS}", "${CFLAGS}", "${CCFLAGS}", "${_SOURCES}"] |
| CCDEPGEN | Array | C compiler dependency generation flags | ["-MMD", "-MF", "${_DEPFILE}", "-MT", "TARGET"] |
| CCFLAGS | Array | Common flags for both C and C++ compiler | [] |
| CFLAGS | Array | C compiler flags | [] |
| CPP_CMD | Array | Preprocess command line | ["${_PREPROCESS_CC}", "-E", "${_PREPROCESS_DEPGEN}", "-o", "${_TARGET}", "${INCPREFIX}${CPPPATH}", "${CPPFLAGS}", "${_SOURCES}"] |
| CPP_TARGET_SUFFIX | String | Suffix used for crt:preprocess target filename. | ".c" |
| CPPDEFINES | Array | C preprocessor defines | [] |
| CPPDEFPREFIX | String | Prefix used for C preprocessor to introduce a define | "-D" |
| CPPFLAGS | Array | C preprocessor flags | ["${CPPDEFPREFIX}${CPPDEFINES}"] |
| CPPPATH | Array | C preprocessor path | [] |
| CSUFFIX | Array | C source file suffixes | [".c"] |
| CXX | String | C++ compiler executable | "g++" |
| CXXCMD | Array | C++ compiler command line | ["${CXX}", "-c", "-o", "${_TARGET}", "${CXXDEPGEN}", "${INCPREFIX}${CPPPATH}", "${CPPFLAGS}", "${CXXFLAGS}", "${CCFLAGS}", "${_SOURCES}"] |
| CXXDEPGEN | Array | C++ compiler dependency generation flags | ["-MMD", "-MF", "${_DEPFILE}", "-MT", "TARGET"] |
| CXXFLAGS | Array | C++ compiler flags | [] |
| CXXSUFFIX | Array | C++ source file suffixes | [".cc", ".cpp", ".cxx", ".C"] |
| D_IMPORT_PATH | Array | D compiler import path | [] |
| DC | String | D compiler executable | "gdc" |
| DCCMD | Array | D compiler command line | ["${DC}", "-c", "-o", "${_TARGET}", "${DDEPGEN}", "${INCPREFIX}${D_IMPORT_PATH}", "${DFLAGS}", "${_SOURCES}"] |
| DDEPGEN | Array | D compiler dependency generation flags | ["-MMD", "-MF", "${_DEPFILE}", "-MT", "TARGET"] |
| DEPFILESUFFIX | String | Dependency file suffix for Makefile-style dependency rules emitted by the compiler (used internally for temporary dependency files used to determine a source file's dependencies) | ".mf" |
| DFLAGS | Array | D compiler flags | [] |
| DISASM_CMD | Array | Disassemble command line | ["${OBJDUMP}", "${DISASM_FLAGS}", "${_SOURCES}"] |
| DISASM_FLAGS | Array | Disassemble flags | ["--disassemble", "--source"] |
| DSUFFIX | String/Array | Default D source file suffix | ".d" |
| INCPREFIX | String | Prefix used for C preprocessor to add an include path | "-I" |
| LD | String | nil | Linker executable (automatically determined when nil) | nil (if nil, ${CC}, ${CXX}, or ${DC} is used depending on the sources being linked) |
| LDCMD | Array | Link command line | ["${LD}", "-o", "${_TARGET}", "${LDFLAGS}", "${_SOURCES}", "${LIBDIRPREFIX}${LIBPATH}", "${LIBLINKPREFIX}${LIBS}"] |
| LDFLAGS | Array | Linker flags | [] |
| LEX | String | Lex executable | "flex" |
| LEX_CMD | Array | Lex command line | ["${LEX}", "${LEX_FLAGS}", "-o", "${_TARGET}", "${_SOURCES}"] |
| LEX_FLAGS | Array | Lex flags | [] |
| LEXSUFFIX | Array | Lex input file suffixes | [".l", ".ll"] |
| LIBDIRPREFIX | String | Prefix given to linker to add a library search path | "-L" |
| LIBLINKPREFIX | String | Prefix given to linker to add a library to link with | "-l" |
| LIBPATH | Array | Library load path | [] |
| LIBS | Array | Libraries to link with | [] |
| LIBSUFFIX | String/Array | Default static library file suffix | ".a" |
| OBJDUMP | String | Objdump executable | "objdump" |
| OBJSUFFIX | String/Array | Default object file suffix | ".o" |
| PROGSUFFIX | String | Default program suffix. | Windows: ".exe", POSIX: "" |
| SHCC | String | Shared object C compiler | "${CC}" |
| SHCCCMD | Array | Shared object C compiler command line | ["${SHCC}", "-c", "-o", "${_TARGET}", "${CCDEPGEN}", "${INCPREFIX}${CPPPATH}", "${CPPFLAGS}", "${SHCFLAGS}", "${SHCCFLAGS}", "${_SOURCES}"] |
| SHCCFLAGS | Array | Shared object C and C++ compiler flags | Windows: ["${CCFLAGS}"], POSIX: ["${CCFLAGS}", -fPIC"] |
| SHCFLAGS | Array | Shared object C compiler flags | ["${CFLAGS}"] |
| SHCXX | String | Shared object C++ compiler | "${CXX}" |
| SHCXXCMD | Array | Shared object C++ compiler command line | ["${SHCXX}", "-c", "-o", "${_TARGET}", "${CXXDEPGEN}", "${INCPREFIX}${CPPPATH}", "${CPPFLAGS}", "${SHCXXFLAGS}", "${SHCCFLAGS}", "${_SOURCES}"] |
| SHCXXFLAGS | Array | Shared object C++ compiler flags | ["${CXXFLAGS}"] |
| SHDC | String | Shared object D compiler | "gdc" |
| SHDCCMD | Array | Shared object D compiler command line | ["${SHDC}", "-c", "-o", "${_TARGET}", "${INCPREFIX}${D_IMPORT_PATH}", "${SHDFLAGS}", "${_SOURCES}"] |
| SHDFLAGS | Array | Shared object D compiler flags | Windows: ["${DFLAGS}"], POSIX: ["${DFLAGS}", "-fPIC"] |
| SHLD | String | Shared library linker | nil (if nil, ${SHCC}, ${SHCXX}, or ${SHDC} is used depending on the sources being linked) |
| SHLDCMD | Array | Shared library linker command line | ["${SHLD}", "-o", "${_TARGET}", "${SHLDFLAGS}", "${_SOURCES}", "${SHLIBDIRPREFIX}${LIBPATH}", "${SHLIBLINKPREFIX}${LIBS}"] |
| SHLDFLAGS | Array | Shared library linker flags | ["${LDFLAGS}", "-shared"] |
| SHLIBDIRPREFIX | String | Prefix given to shared library linker to add a library search path | "-L" |
| SHLIBLINKPREFIX | String | Prefix given to shared library linker to add a library to link with | "-l" |
| SHLIBPREFIX | String | Shared library file name prefix | Windows: "", POSIX: "lib" |
| SHLIBSUFFIX | String | Shared library file name suffix | Windows: ".dll", POSIX: ".so" |
| SIZE | String | Size executable. | "size" |
| YACC | String | Yacc executable | "bison" |
| YACC_CMD | Array | Yacc command line | ["${YACC}", "${YACC_FLAGS}", "-o", "${_TARGET}", "${_SOURCES}"] |
| YACC_FLAGS | Array | Yacc flags | ["-d"] |
| YACCSUFFIX | Array | Yacc input file suffixes | [".y", ".yy"] |
### Build Hooks
Environments can have build hooks which are added with `env.add_build_hook()`.
Build hooks are invoked immediately before a builder executes.
Build hooks can modify the construction variables in use for the build
operation.
They can also register new build targets.
Environments can also have post-build hooks added with `env.add_post_build_hook()`.
Post-build hooks are only invoked if the build operation was a success.
Post-build hooks can invoke commands using the newly-built files, or register
new build targets.
Each build hook block will be invoked for every build operation, so the block
should test the target or sources if its action should only apply to some
subset of build targets or source files.
Example build hook:
```ruby
Rscons::Environment.new do |env|
# Build third party sources without -Wall
env.add_build_hook do |build_op|
if build_op[:builder].name == "Object" and
build_op[:sources].first =~ %r{src/third-party}
build_op[:vars]["CFLAGS"] -= ["-Wall"]
end
end
end
```
The `build_op` parameter to the build hook block is a Hash describing the
build operation with the following keys:
* `:builder` - `Builder` instance in use
* `:env` - `Environment` calling the build hook; note that this may be
different from the Environment that the build hook was added to in the case
that the original Environment was cloned with build hooks!
* `:target` - `String` name of the target file
* `:sources` - `Array` of the source files
* `:vars` - `Rscons::VarSet` containing the construction variables to use.
The build hook can overwrite entries in `build_op[:vars]` to alter the
construction variables in use for this specific build operation.
### Phony Targets
A build target name given as a Symbol instead of a String is interpreted as a
"phony" target.
Phony targets operate similarly to normal build targets, except that a file is
not expected to be produced by the builder.
Phony targets will still be "rebuilt" if any source or the command is out of
date.
### Explicit Dependencies
A target can be marked as depending on another file that Rscons would not
otherwise know about via the `Environment#depends` function. For example,
to force the linker to re-link a Program output when a linker script changes:
```ruby
Rscons::Environment.new do |env|
env.Program("a.out", "foo.c", "LDFLAGS" => %w[-T linker_script.ld])
env.depends("a.out", "linker_script.ld")
end
```
You can pass multiple dependency files to `Environment#depends`:
```ruby
env.depends("my_app", "config/link.ld", "README.txt", *Rscons.glob("assets/**/*"))
```
### Command-Line Variables
Variables can be specified on the rscons command line. For example:
```
rscons VAR=val
```
These variables are accessible in a global VarSet called `Rscons.vars`.
### Construction Variable Naming
* uppercase strings - the default construction variables that Rscons uses
* strings beginning with "_" - set and used internally by builders
* symbols, lowercase strings - reserved as user-defined construction variables
### API documentation
Documentation for the complete Rscons API can be found at
http://www.rubydoc.info/github/holtrop/rscons/master.
## Contributing
1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request
See [https://holtrop.github.io/rscons/index.html](https://holtrop.github.io/rscons/index.html) for User Guide and Installation instructions.

View File

@ -6,24 +6,27 @@ rescue Bundler::BundlerError => e
end
require "rspec/core/rake_task"
require "yard"
require "rake/clean"
require "fileutils"
CLEAN.include %w[build_test_run .yardoc doc coverage test]
CLOBBER.include %w[dist pkg]
CLEAN.include %w[build_test_run .yardoc yard coverage test]
CLOBBER.include %w[dist gen large_project pkg]
task :build_dist do
sh "ruby rb/build_dist.rb"
end
RSpec::Core::RakeTask.new(:spec, :example_string) do |task, args|
ENV["specs"] = "1"
if args.example_string
ENV["partial_specs"] = "1"
task.rspec_opts = %W[-e "#{args.example_string}" -f documentation]
end
end
task :spec => :build_dist
task :spec do
ENV.delete("specs")
end
# dspec task is useful to test the distributable release script, but is not
# useful for coverage information.
@ -32,13 +35,76 @@ 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)
Rake::Task["spec"].execute(args.example_string)
ENV.delete("dist_specs")
FileUtils.rm_f(Dir.glob(".rscons-*"))
end
YARD::Rake::YardocTask.new do |yard|
task :gen_large_project, [:size] => :build_dist do |task, args|
size = (args.size || 10000).to_i
FileUtils.rm_rf("large_project")
FileUtils.mkdir_p("large_project/src")
size.times do |i|
File.open("large_project/src/fn#{i}.c", "w") do |fh|
fh.puts(<<-EOF)
int fn#{i}(void)
{
return #{i};
}
EOF
end
File.open("large_project/src/fn#{i}.h", "w") do |fh|
fh.puts %[int fn#{i}(void);]
end
end
File.open("large_project/src/main.c", "w") do |fh|
size.times do |i|
fh.puts %[#include "fn#{i}.h"]
end
fh.puts <<-EOF
int main(int argc, char * argv[])
{
int result = 0;
EOF
size.times do |i|
fh.puts %[result += fn#{i}();]
end
fh.puts <<-EOF
return result;
}
EOF
end
File.open("large_project/Rsconscript", "w") do |fh|
fh.puts <<EOF
default do
Environment.new do |env|
env.Program("project", glob("src/*.c"))
end
end
EOF
end
FileUtils.cp("dist/rscons", "large_project")
end
unless RbConfig::CONFIG["host"]["msys"]
require "yard"
YARD::Rake::YardocTask.new do |yard|
yard.files = ['lib/**/*.rb']
yard.options = ["-ogen/yard"]
end
desc "Build user guide"
task :user_guide do
system("ruby", "-Ilib", "rb/gen_user_guide.rb")
end
end
task :default => :spec
task :all => [
:build_dist,
:spec,
:dspec,
:yard,
:user_guide,
]

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,4 +1,4 @@
build do
default do
Environment.new do |env|
env.CFile("lexer.c", "lexer.l")
env.CFile("parser.c", "parser.y")

View File

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

View File

@ -1,4 +1,4 @@
build do
default do
debug = Environment.new(echo: :command) do |env|
env['CFLAGS'] = '-O2'
env['CPPFLAGS'] = '-DSTRING="Debug Version"'

View File

@ -1,4 +1,4 @@
build do
default do
env1 = Environment.new(echo: :command) do |env|
env['CFLAGS'] = '-O2'
env.add_build_hook do |builder|

View File

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

View File

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

View File

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

View File

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

View File

@ -0,0 +1,10 @@
configure do
check_c_header "string.h", check_cpppath: ["./usr1"]
check_c_header "frobulous.h", check_cpppath: ["./usr2"]
end
default do
Environment.new do |env|
env.Object("test.o", "test.c")
end
end

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -0,0 +1,10 @@
configure do
check_cxx_header "string.h", check_cpppath: ["./usr1"]
check_cxx_header "frobulous.h", check_cpppath: ["./usr2"]
end
default do
Environment.new do |env|
env.Object("test.o", "test.cc")
end
end

View File

@ -0,0 +1,11 @@
configure do
check_d_compiler
check_d_import "std.stdio", check_d_import_path: ["./usr1"]
check_d_import "frobulous", check_d_import_path: ["./usr2"]
end
default do
Environment.new do |env|
env.Object("test.o", "test.d")
end
end

View File

@ -1,3 +1,4 @@
configure do
check_d_compiler
check_d_import "std.stdio"
end

View File

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

View File

@ -0,0 +1,10 @@
configure do
check_lib "m", check_libpath: ["./usr1"]
check_lib "frobulous", check_libpath: ["./usr2"]
end
default do
Environment.new(echo: :command) do |env|
env.Program("simple.exe", "simple.c")
end
end

View File

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

View File

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

View File

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

View File

@ -0,0 +1,30 @@
configure do
custom_check("Checking 'grep' version") do |op|
stdout, stderr, status = op.log_and_test_command(%w[grep --version])
should_fail = true
if status != 0
fail_message = "error executing grep"
elsif stdout =~ /^grep \(GNU grep\) 1\./
fail_message = "too old!"
status = 1
elsif stdout =~ /^grep \(GNU grep\) 2\./
fail_message = "we'll work with it but you should upgrade"
status = 1
should_fail = false
op.store_merge("CPPDEFINES" => "GREP_WORKAROUND")
else
op.store_append("CPPDEFINES" => "GREP_FULL")
end
op.complete(status, success_message: "good!", fail_message: fail_message, fail: should_fail)
end
custom_check("Checking sed -E flag") do |op|
stdout, stderr, status = op.log_and_test_command(%w[sed -E -e s/ab+/rep/], stdin: "abbbc")
op.complete(stdout =~ /repc/ ? 0 : 1, success_message: "good", fail_message: "fail")
end
end
default do
Environment.new 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,7 +3,7 @@ configure do
check_c_header "stdio.h", set_define: "HAVE_STDIO_H"
end
build do
default do
Environment.new(echo: :command) do |env|
env.Object("simple.o", "simple.c")
end

View File

@ -0,0 +1,5 @@
configure do
check_c_compiler "foo123c", fail: false, on_fail: "Install the foo123 package"
check_d_compiler "foo123d", fail: false
check_cxx_compiler "foo123cxx", on_fail: lambda {puts "Install the foo123cxx package"}
end

View File

@ -0,0 +1,4 @@
int two(void)
{
return 42;
}

View File

@ -9,7 +9,7 @@ EOF
end
end
build do
default do
Environment.new do |env|
env.add_builder(MySource)
env.MySource('inc.h', [])

View File

@ -1,4 +1,4 @@
build do
default do
Environment.new do |env|
env.Command("inc.c",
[],
@ -6,7 +6,8 @@ build do
"CMD_DESC" => "Generating")
env["build_root"] = env.build_root
env["inc_c"] = "inc.c"
env.build_after("${build_root}/program.o", "${inc_c}")
env.Program("program.exe", ["program.c", "inc.c"])
env.Object("program.o", "program.c")
env.build_after("program.o", "${inc_c}")
env.Program("program.exe", ["program.o", "inc.c"])
end
end

View File

@ -9,7 +9,7 @@ EOF
end
end
build do
default do
env = Environment.new do |env|
env["hdr"] = "inc.h"
env["src"] = "program.c"

View File

@ -9,7 +9,7 @@ EOF
end
end
build do
default do
e1 = Environment.new do |env|
env.add_builder(MySource)
env["one"] = "5"

View File

@ -1,4 +1,4 @@
build do
default do
Environment.new do |env|
env.add_builder(:MyBuilder) do |options|
"hi"

View File

@ -1,4 +1,4 @@
build do
default do
Environment.new do |env|
env.add_builder(:MyBuilder) do |options|
wait_for(1)

View File

@ -12,7 +12,7 @@ class CHGen < Rscons::Builder
end
end
build do
default do
Environment.new do |env|
env.add_builder(CHGen)
env.CHGen("inc.c", ["program.c"])

View File

@ -1,16 +1,17 @@
build do
default do
Environment.new do |env|
env["build_root"] = env.build_root
env["inc_h"] = "inc.h"
env.Copy("copy_inc.h", "${inc_h}")
env.depends("${build_root}/program.o", "${inc_h}")
env.Program("program.exe", ["program.c", "inc.c"])
env.depends("program.o", "${inc_h}")
env.Object("program.o", "program.c")
env.Program("program.exe", ["program.o", "inc.c"])
env.Command("inc.c",
inc_c = env.Command("inc.c",
[],
"CMD" => %w[ruby gen.rb ${_TARGET}],
"CMD_DESC" => "Generating")
env.produces("inc.c", "inc.h")
inc_c.produces("inc.h")
end
end

View File

@ -0,0 +1,17 @@
default do
Environment.new do |env|
env["build_root"] = env.build_root
env["inc_h"] = "inc.h"
env.Copy("copy_inc.h", "${inc_h}")
env.depends("program.o", "${inc_h}")
env.Object("program.o", "program.c")
env.Program("program.exe", ["program.o", "inc.c"])
env.Command("inc.c",
[],
"CMD" => %w[ruby gen.rb ${_TARGET}],
"CMD_DESC" => "Generating")
env.produces("inc.c", "inc.h")
end
end

View File

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

View File

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

View File

@ -0,0 +1,9 @@
configure do
check_d_compiler "ldc2"
end
default do
Environment.new(echo: :command) do |env|
env.Program("hello-d.exe", glob("*.d"))
end
end

View File

@ -1,4 +1,4 @@
build do
default do
Environment.new(echo: :command) do |env|
env.Object("main.o", "main.d")
env.Object("mod.o", "mod.d")

View File

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

View File

@ -1,4 +1,4 @@
build do
default 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" => ["."])

View File

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

View File

@ -1,9 +1,10 @@
build do
default do
Environment.new do |env|
require 'json'
require 'yaml'
env.add_builder(:JsonToYaml) do |params|
unless @cache.up_to_date?(@target, :JsonToYaml, @sources, @env)
print_run_message("JsonToYaml #{@target}", nil)
@cache.mkdir_p(File.dirname(@target))
File.open(@target, 'w') do |f|
f.write(YAML.dump(JSON.load(IO.read(@sources.first))))

View File

@ -1,4 +1,4 @@
build do
default 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'])

View File

@ -1,4 +1,4 @@
build do
default do
Environment.new do |env|
env.Program("library.exe", ["lib.a", "three.c"])
env.Object("two.o", "two.c")

View File

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

View File

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

View File

@ -0,0 +1,6 @@
#include <stdio.h>
void foo(void)
{
printf("foo\n");
}

View File

@ -0,0 +1,12 @@
#include <iostream>
extern "C" {
void foo(void);
}
int main(int argc, char * argv[])
{
foo();
std::cout << "main" << std::endl;
return 0;
}

View File

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

4
build_tests/sh/sh.rb Normal file
View File

@ -0,0 +1,4 @@
default do
sh "echo", "hi there"
sh(["echo 1 2"])
end

View File

@ -0,0 +1,4 @@
default do
sh "foobar42"
sh "echo", "continued"
end

View File

@ -0,0 +1,4 @@
default do
sh "foobar42", continue: true
sh "echo", "continued"
end

View File

@ -1,4 +1,4 @@
build do
default do
Environment.new do |env|
env["CPPPATH"] << "src/lib"
libmine = env.SharedLibrary("mine", glob("src/lib/*.c"))

View File

@ -1,4 +1,4 @@
build do
default do
Environment.new do |env|
File.open("foo.xyz", "wb") do |fh|
fh.puts("hi")

View File

@ -1,4 +1,4 @@
build do
default do
Environment.new do |env|
env["CPPPATH"] << "src/lib"
env.Object("file.S", "src/lib/one.c", "CFLAGS" => env["CFLAGS"] + ["-S"])

View File

@ -1,4 +1,4 @@
build do
default do
Environment.new do |env|
env["CPPPATH"] << "src/lib"
libmine = env.SharedLibrary("mine", glob("src/lib/*.cc"))

View File

@ -1,4 +1,4 @@
build do
default do
Environment.new do |env|
env["CPPPATH"] << "src/lib"
libmine = env.SharedLibrary("mine", glob("src/lib/*.d"))

View File

@ -1,4 +1,4 @@
build do
default do
Environment.new do |env|
env["CPPPATH"] << "src/lib"
env.SharedObject("one.o", "src/lib/one.c")

View File

@ -1,4 +1,4 @@
build do
default do
Environment.new do |env|
env["CPPPATH"] << "src/lib"
env["SHLD"] = "gcc"

View File

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

View File

@ -1,4 +1,4 @@
build do
default do
Environment.new(echo: :command) do |env|
tempdir = ENV["TEMP"] || ENV["TMP"] || "/tmp"
source_file = File.join(tempdir, "abs.c")

View File

@ -10,7 +10,7 @@ class ThreadedTestBuilder < Rscons::Builder
end
end
build do
default do
Environment.new do |env|
env.add_builder(ThreadedTestBuilder)
env.ThreadedTestBuilder("T3", [], "delay" => 3)

View File

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

View File

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

View File

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

View File

@ -1,6 +1,6 @@
build do
default do
Environment.new do |env|
env["LIBS"] += ["c"]
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,10 +27,10 @@ class DebugBuilder < Rscons::Builder
end
end
build do
default do
Environment.new 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")

View File

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

View File

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

View File

@ -1,4 +1,4 @@
build do
default do
Environment.new do |env|
env.Object("simple.o", "simple.c")
env["LDCMD"] = %w[gcc -o ${_TARGET} simple.o]

View File

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

View File

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

View File

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

View File

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

View File

@ -1,4 +1,4 @@
build do
default do
base_env = Environment.new do |env|
env.n_threads = 165
end

View File

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

View File

@ -1,4 +1,4 @@
build do
default do
Environment.new do |env|
command = %W[gcc -o ${_TARGET} ${_SOURCES}]
env.Command("simple.exe",

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,4 +1,4 @@
build do
default do
Environment.new do |env|
env.Command("foo", "bar")
env.Command("bar", "baz")

View File

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

View File

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

View File

@ -1,4 +1,4 @@
build do
default do
Environment.new do |env|
File.open("foo.xyz", "wb") do |fh|
fh.puts("hi")

View File

@ -1,4 +1,4 @@
build do
default do
Environment.new(echo: :command) do |env|
env["LD"] = "gcc"
env["LIBPATH"] += ["libdir"]

View File

@ -1,4 +1,4 @@
build do
default do
Environment.new(echo: :command) do |env|
env.Object("simple.o", "simple.c",
"CCCMD" => %w[${CC} -c -o ${_TARGET} -Dfoobar ${_SOURCES}])

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