aboutsummaryrefslogtreecommitdiffstats
path: root/test/mkmf/base.rb
diff options
context:
space:
mode:
authorJun Aruga <junaruga@users.noreply.github.com>2023-05-29 10:09:32 +0200
committerGitHub <noreply@github.com>2023-05-29 10:09:32 +0200
commit57459b83a9a52ab921094a1562fe3056df9a437a (patch)
treecfaa3343aa917a79430b2135280d7e929b5299f6 /test/mkmf/base.rb
parentd5ef373b1194bac64784ae316d125d7a2cf1988a (diff)
downloadruby-57459b83a9a52ab921094a1562fe3056df9a437a.tar.gz
mkmf: Add the extra option `--with-verbose` to enable verbose mode. (#7863)
This commit is to add an extra option to enable verbose mode (V=1) in the generated `Makefile` at runtime of the Ruby to print compiler command lines by the commands below when building native extensions. It's possible to enable the verbose mode by setting the environment variable `MAKEFLAGS="V=1"`[1] implemented in GNU make. However, I wanted to make a consistent user-interface not depending on the specific make's implementation. ``` $ ruby /path/to/extconf.rb -- --with-verbose ``` You can also add the extra option via rake-compiler gem. ``` $ rake compiler -- --with-verbose ``` If the extra option is not given, the value of the `RbConfig::CONFIG["MKMF_VERBOSE"]` enabled by the configure option below is used. ``` $ ./configure --enable-mkmf-verbose ``` For the unit tests, updated the following files. * The `test/mkmf/test_configuration.rb` was created to test the cases with the `configuration` method and this implementation. * Updated the `TestMkmf#assert_separately` to set the extra arguments in `test/mkmf/base.rb`. Updated tests using the `assert_separately`. * Added tests for `MakeMakefile#with_config` in the `test/mkmf/test_config.rb`. [1] https://www.gnu.org/software/make/manual/html_node/Variables_002fRecursion.html Fixes [Bug #19695] Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org>
Diffstat (limited to 'test/mkmf/base.rb')
-rw-r--r--test/mkmf/base.rb7
1 files changed, 5 insertions, 2 deletions
diff --git a/test/mkmf/base.rb b/test/mkmf/base.rb
index ec42bca100..7df07c16a6 100644
--- a/test/mkmf/base.rb
+++ b/test/mkmf/base.rb
@@ -147,7 +147,10 @@ class TestMkmf < Test::Unit::TestCase
include Base
- def assert_separately(args, src, *rest, **options)
- super(args + ["-r#{__FILE__}"], "extend TestMkmf::Base; setup\nEND{teardown}\n#{src}", *rest, **options)
+ def assert_separately(args, extra_args, src, *rest, **options)
+ super(args + ["-r#{__FILE__}"] + %w[- --] + extra_args,
+ "extend TestMkmf::Base; setup\nEND{teardown}\n#{src}",
+ *rest,
+ **options)
end
end