1## Setting up prerequisites
2
3Currently, only Ubuntu 18.04+ is officially supported as primary development environment.
4
5There are several dependencies, that should be installed manually. The following list is the absolute minimum for building:
6
7- `gcc` or any C99-compliant compiler (native or cross, e.g., arm-none-eabi)
8- `cmake` >= `2.8.12.2`
9
10Several scripts and tools help the building and development process, thus it is recommended to have the following installed as well:
11
12- `bash` >= `4.3.11`
13- `cppcheck` >= `1.61`
14- `vera++` >= `1.2.1`
15- `python` >= `2.7.6`
16
17```bash
18sudo apt-get install gcc gcc-arm-none-eabi cmake cppcheck vera++ python
19```
20
21To make our scripts run correctly, several shell utilities should be available on the system:
22
23- `awk`
24- `bc`
25- `find`
26- `sed`
27
28## Building JerryScript
29
30**To build debug version for Linux**
31
32```bash
33python tools/build.py --debug
34```
35
36**To build debug version for Linux without LTO (Link Time Optimization)**
37
38```bash
39python tools/build.py --debug --lto=off
40```
41
42**To enable more verbose outputs for debugging**
43
44```bash
45tools/build.py --debug --logging=on --error-messages=on --line-info=on
46```
47
48**Add custom arguments to CMake**
49
50```bash
51python tools/build.py --cmake-param=CMAKE_PARAM
52```
53
54**Set a profile mode (ES5.1, subset of ES2015, minimal)**
55
56```bash
57python tools/build.py --profile=es5.1|es2015-subset|minimal
58```
59
60See also the related [README.md](https://github.com/jerryscript-project/jerryscript/blob/master/jerry-core/profiles/README.md).
61
62**Use (compiler-default, external) libc**
63
64The default libc is the compiler-default libc but you can use an external libc as well:
65
66- compiler-default libc:
67
68```bash
69python tools/build.py
70```
71
72- external libc:
73
74```bash
75python tools/build.py --compile-flag="-nostdlib -I/path/to/ext-libc/include" --link-lib="ext-c"
76```
77
78**Add toolchain file**
79
80The ```cmake``` dir already contains some usable toolchain files, which you can use in the following format:
81
82```bash
83python tools/build.py --toolchain=TOOLCHAIN
84```
85
86For example the cross-compile to RaspberryPi 2 is something like this:
87
88```bash
89python tools/build.py --toolchain=cmake/toolchain_linux_armv7l.cmake
90```
91
92**Use system memory allocator**
93
94```bash
95python tools/build.py --system-allocator=on
96```
97
98*Note*: System allocator is only supported on 32 bit systems.
99
100**Enable 32bit compressed pointers**
101
102```bash
103python tools/build.py --cpointer-32bit=on
104```
105
106*Note*: There is no compression/decompression on 32 bit systems, if enabled.
107
108**Change default heap size (512K)**
109
110```bash
111python tools/build.py --mem-heap=256
112```
113
114If you would like to use more than 512K, then you must enable the 32 bit compressed pointers.
115
116```bash
117python tools/build.py --cpointer-32bit=on --mem-heap=1024
118```
119
120*Note*: The heap size will be allocated statically at compile time, when JerryScript memory
121allocator is used.
122
123**To build with libfuzzer support**
124
125```bash
126CC=clang python tools/build.py --libfuzzer=on --compile-flag=-fsanitize=address --lto=off
127```
128
129Check the documentation of libfuzzer to get the runtime settings of the created fuzzer
130binary: https://llvm.org/docs/LibFuzzer.html.
131
132**To get a list of all the available buildoptions for Linux**
133
134```bash
135python tools/build.py --help
136```
137
138## Checking patch
139
140```bash
141python tools/run-tests.py --precommit
142```
143
144### Running only one type of test
145
146**To run build option tests**
147
148```bash
149python tools/run-tests.py --buildoption-test
150```
151
152**To run unittests**
153
154```bash
155python tools/run-tests.py --unittests
156```
157
158**To run jerry-tests**
159
160```bash
161python tools/run-tests.py --jerry-tests
162```
163
164**To run jerry-test-suite**
165
166```bash
167python tools/run-tests.py --jerry-test-suite
168```
169
170**To run signed-off check**
171
172```bash
173python tools/run-tests.py --check-signed-off
174```
175
176**To run cppcheck**
177
178```bash
179python tools/run-tests.py --check-cppcheck
180```
181
182**To run vera check**
183
184```bash
185python tools/run-tests.py --check-vera
186```
187
188**To get a list of all the available test options**
189
190```bash
191python tools/run-tests.py --help
192```
193