jerryscript/docs/01.GETTING-STARTED.md
Akos Kiss d5eb2f0be1 Let the build script use a default for toolchain
The `cmake` directory already contains several toolchain files for
various platforms (operating system + architecture). However,
`tools/build.py` does not define a toolchain file for cmake unless
explicitly specified. This patch changes the script to look into
the `cmake` directory for a file named
`toolchain_$(os)_$(arch).cmake` and, if found, pass that to cmake
by default.

OS and arch are determined by `os.uname()`. As Linux on Raspberry
Pi identifies itself as "armv7l", the legacy "armv7l-hf" arch name
is shortened to "armv7l". This way, building jerry on RPi
(natively, not cross) becomes possible by simply running
`tools/build.py` without any extra options.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2016-08-08 13:42:59 +02:00

149 lines
2.8 KiB
Markdown

### Setting Up Prerequisites
Currently, only Ubuntu 14.04+ is officially supported as primary development environment.
There are several dependencies, that should be installed manually. The following list is required for building:
- `gcc` or any C99-compliant compiler
- native
- arm-none-eabi
- `cmake` >= `2.8.12.2`
- `bash` >= `4.3.11`
- `cppcheck` >= `1.61`
- `vera++` >= `1.2.1`
- `python` >= `2.7.6`
```bash
sudo apt-get install gcc g++ gcc-arm-none-eabi cmake cppcheck vera++ python
```
To make our scripts run correctly, several shell utilities should be available on the system:
- `find`
- `awk`
### Building Jerryscript
##### To build debug version for Linux:
```bash
python tools/build.py --debug
```
##### To build debug version for Linux without LTO (Link Time Optimization):
```bash
python tools/build.py --debug --lto=off
```
##### Add custom arguments to CMake:
```bash
python tools/build.py --cmake-param=CMAKE_PARAM
```
##### Set a profile mode (full|minimal):
```bash
python tools/build.py --feature=full|minimal
```
##### Use (jerry|compiler-default|external libc) libc:
The default libc is jerry-libc, but you can use compiler-default libc or an external libc:
- compiler-default libc:
```bash
python tools/build.py --jerry-libc=off --compiler-default-libc=on
```
- external libc:
```bash
python tools/build.py --jerry-libc=off --compiler-default-libc=off --compile-flag="-I/path/to/libc/include"
```
##### Add toolchain file:
The ```cmake``` dir already contains some usable toolchain files, which you can use in the following format:
```bash
python tools/build.py --toolchain=TOOLCHAIN
```
For example the cross-compile to RaspberryPi 2 is something like this:
```bash
python tools/build.py --toolchain=cmake/toolchain_linux_armv7l.cmake
```
##### To get a list of all the available buildoptions for Linux:
```bash
python tools/build.py --help
```
### Checking patch
```bash
python tools/run-tests.py --precommit
```
#### Running only one type of test:
##### To run build option tests:
```bash
python tools/run-tests.py --buildoption-test
```
##### To run unittests:
```bash
python tools/run-tests.py --unittests
```
##### To run jerry-tests:
```bash
python tools/run-tests.py --jerry-tests
```
##### To run jerry-test-suite:
```bash
python tools/run-tests.py --jerry-test-suite
```
##### To run signed-off check:
```bash
python tools/run-tests.py --check-signed-off
```
##### To run cppcheck:
```bash
python tools/run-tests.py --check-cppcheck
```
##### To run vera check:
```bash
python tools/run-tests.py --check-vera
```
##### Use toolchain file:
The cmake dir already contains some usable toolchain files, which you can use in the following format:
python tools/run-tests.py --toolchain=TOOLCHAIN
##### To get a list of all the available test options:
```bash
python tools/run-tests.py --help
```