@@ -4,13 +4,15 @@ The purpose of this guide is to show how to build Node.js using [Ninja][], as
4
4
doing so can be significantly quicker than using ` make ` . Please see
5
5
[ Ninja's site] [ Ninja ] for installation instructions (Unix only).
6
6
7
- To build Node.js with ninja, there are 3 steps that must be taken:
7
+ [ Ninja] [ ] is supported in the Makefile. Run ` ./configure --ninja ` to configure
8
+ the project to run the regular ` make ` commands with Ninja.
8
9
9
- 1 . Configure the project's OS-based build rules via ` ./configure --ninja ` .
10
- 2 . Run ` ninja -C out/Release ` to produce a compiled release binary.
11
- 3 . Lastly, make symlink to ` ./node ` using ` ln -fs out/Release/node node ` .
10
+ For example, ` make ` will execute ` ninja -C out/Release ` internally
11
+ to produce a compiled release binary, It will also execute
12
+ ` ln -fs out/Release/node node ` , so that you can execute ` ./node ` at
13
+ the project's root.
12
14
13
- When running ` ninja -C out/Release ` you will see output similar to the following
15
+ When running ` make ` , you will see output similar to the following
14
16
if the build has succeeded:
15
17
16
18
``` txt
@@ -22,27 +24,20 @@ The bottom line will change while building, showing the progress as
22
24
` [finished/total] ` build steps. This is useful output that ` make ` does not
23
25
produce and is one of the benefits of using Ninja. Also, Ninja will likely
24
26
compile much faster than even ` make -j4 ` (or
25
- ` -j<number of processor threads on your machine> ` ).
27
+ ` -j<number of processor threads on your machine> ` ). You can still pass the
28
+ number of processes to run for [ Ninja] [ ] using the environment variable ` JOBS ` .
29
+ This will be the equivalent to the ` -j ` parameter in the regular ` make ` :
26
30
27
- ## Considerations
28
-
29
- Ninja builds vary slightly from ` make ` builds. If you wish to run ` make test `
30
- after, ` make ` will likely still need to rebuild some amount of Node.js.
31
-
32
- As such, if you wish to run the tests, it can be helpful to invoke the test
33
- runner directly, like so:
34
- ` tools/test.py --mode=release message parallel sequential -J `
35
-
36
- ## Alias
37
-
38
- `alias nnode='./configure --ninja && ninja -C out/Release && ln -fs
39
- out/Release/node node'`
31
+ ``` bash
32
+ $ JOBS=12 make
33
+ ```
40
34
41
35
## Producing a debug build
42
36
43
- The above alias can be modified slightly to produce a debug build, rather than a
44
- release build as shown below:
45
- `alias nnodedebug='./configure --ninja && ninja -C out/Debug && ln -fs
46
- out/Debug/node node_g'`
37
+ To create a debug build rather than a release build:
38
+
39
+ ``` bash
40
+ $ ./configure --ninja --debug && make
41
+ ```
47
42
48
43
[ Ninja ] : https://ninja-build.org/
0 commit comments