summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorSamuel Williams <samuel.williams@oriontransfer.co.nz>2021-12-18 20:39:57 +1300
committerSamuel Williams <samuel.williams@oriontransfer.co.nz>2021-12-18 23:10:42 +1300
commit1560cc16889e1afede66f675c89f9e3962a1e35e (patch)
tree3e5b12ebf6210c2105b0f8b4b1681ae2851c01c1 /doc
parent75b5a4808fce6e6a11ef43a12c399e4e2eb63e86 (diff)
Introduce setup instructions for better parallelism.
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/5295
Diffstat (limited to 'doc')
-rw-r--r--doc/hacking.md30
1 files changed, 24 insertions, 6 deletions
diff --git a/doc/hacking.md b/doc/hacking.md
index fe77232bd0..088e7c2aca 100644
--- a/doc/hacking.md
+++ b/doc/hacking.md
@@ -2,6 +2,24 @@
This document gives some helpful instructions which should make your experience as a Ruby core developer easier.
+## Setup
+
+### Make
+
+It's common to want to compile things as quickly as possible. Ensuring `make` has the right `--jobs` flag will ensure all processors are utilized when building software projects. To do this effectively, you can set `MAKEFLAGS` in your shell configuration/profile:
+
+ # On macOS with Fish shell:
+ export MAKEFLAGS="--jobs "(sysctl -n hw.ncpu)
+
+ # On macOS with Bash/ZSH shell:
+ export MAKEFLAGS="--jobs $(sysctl -n hw.ncpu)"
+
+ # On Linux with Fish shell:
+ export MAKEFLAGS="--jobs "(nproc)
+
+ # On Linux with Bash/ZSH shell:
+ export MAKEFLAGS="--jobs $(nproc)"
+
## Configure Ruby
It's generally advisable to use a build directory.
@@ -10,7 +28,7 @@ It's generally advisable to use a build directory.
mkdir build
cd build
../configure --prefix $HOME/.rubies/ruby-head
- make -j16 install
+ make install
### Without Documentation
@@ -24,7 +42,7 @@ If you are frequently building Ruby, this will reduce the time it takes to `make
You can create a file in the Ruby source root called `test.rb`. You can build `miniruby` and execute this script:
- make -j16 run
+ make run
If you want more of the standard library, you can use `runruby` instead of `run`.
@@ -32,20 +50,20 @@ If you want more of the standard library, you can use `runruby` instead of `run`
There are a set of tests in `bootstraptest/` which cover most basic features of the core Ruby language.
- make -j16 test
+ make test
### Run Extensive Tests
There are extensive tests in `test/` which cover a wide range of features of the Ruby core language.
- make -j16 test-all
+ make test-all
You can run specific tests by specifying their path:
- make -j16 test-all TESTS=../test/fiber/test_io.rb
+ make test-all TESTS=../test/fiber/test_io.rb
### Run RubySpec Tests
RubySpec is a project to write a complete, executable specification for the Ruby programming language.
- make -j16 test-all test-rubyspec
+ make test-all test-rubyspec