@@ -7,14 +7,17 @@ This document is intended for **mediasoup** developers.
...
@@ -7,14 +7,17 @@ This document is intended for **mediasoup** developers.
The `worker` folder contains a `Makefile` to build the mediasoup worker subproject.
The `worker` folder contains a `Makefile` to build the mediasoup worker subproject.
### `make`
### `make`
The default task runs the `Release` task unless the environment `MEDIASOUP_BUILDTYPE` is set to `Debug` (if so it runs the `Debug` task).
The default task runs the `Release` task unless the environment `MEDIASOUP_BUILDTYPE` is set to `Debug` (if so it runs the `Debug` task).
### `make Release`
### `make Release`
Builds the production ready mediasoup worker binary at `worker/out/Release/`. This is the binary used in production when installing the **mediasoup** NPM module with `npm install mediasoup`.
Builds the production ready mediasoup worker binary at `worker/out/Release/`. This is the binary used in production when installing the **mediasoup** NPM module with `npm install mediasoup`.
### `make Debug`
### `make Debug`
Builds a more verbose and non optimized mediasoup worker binary at `worker/out/Debug/` with some C flags enabled (such as `-O0`) and some macros defined (such as `DEBUG`, `MS_LOG_TRACE` and `MS_LOG_FILE_LINE`).
Builds a more verbose and non optimized mediasoup worker binary at `worker/out/Debug/` with some C flags enabled (such as `-O0`) and some macros defined (such as `DEBUG`, `MS_LOG_TRACE` and `MS_LOG_FILE_LINE`).
...
@@ -27,26 +30,58 @@ In order to instruct the **mediasoup** Node.js module to use the `Debug` mediaso
...
@@ -27,26 +30,58 @@ In order to instruct the **mediasoup** Node.js module to use the `Debug` mediaso
$ MEDIASOUP_BUILDTYPE=Debug node myapp.js
$ MEDIASOUP_BUILDTYPE=Debug node myapp.js
```
```
### `make test`
### `make test`
Runs the `test-Release` task unless the environment `MEDIASOUP_BUILDTYPE` is set to `Debug` (if so it runs the `test-Debug` task).
Runs the `test-Release` task unless the environment `MEDIASOUP_BUILDTYPE` is set to `Debug` (if so it runs the `test-Debug` task).
### `make test-Release`
### `make test-Release`
Builds the `mediasoup-worker-test` test unit binary at `worker/out/Release/`.
Builds the `mediasoup-worker-test` test unit binary at `worker/out/Release/`.
### `make test-Debug`
### `make test-Debug`
Builds the `mediasoup-worker-test` test unit binary in `Debug` mode at `worker/out/Debug/`.
Builds the `mediasoup-worker-test` test unit binary in `Debug` mode at `worker/out/Debug/`.
### `fuzzer`
Builds the `mediasoup-worker-fuzzer` target (which uses [libFuzzer](http://llvm.org/docs/LibFuzzer.html)) and generates the `worker/out/mediasoup-worker-fuzzer` binary.
**NOTE:** Linux is required with `fuzzer` capable `clang++`. `CC` environment variable must point to `clang` and `CXX` to `clang++`.
### `fuzzer-exec`
Executes the `worker/out/mediasoup-worker-fuzzer` binary.
Fuzzer command line options can be set via the `FUZZER_OPTIONS` environment variable. The `LSAN_OPTIONS` environment variable can also be used.
### `fuzzer-docker-build`
Builds a Linux image with `fuzzer` capable `clang++` that builds the `mediasoup-worker-fuzzer` target.
### `fuzzer-docker-run`
Runs a container of the Docker image created with `fuzzer-docker-build` and executes `worker/out/mediasoup-worker-fuzzer` binary.
Fuzzer command line options can be set via the `FUZZER_OPTIONS` environment variable. The `LSAN_OPTIONS` environment variable can also be used.
### `make xcode`
### `make xcode`
Builds a Xcode project for the mediasoup worker subproject.
Builds a Xcode project for the mediasoup worker subproject.
### `make clean`
### `make clean`
Cleans objects and binaries related to the mediasoup worker.
Cleans objects and binaries related to the mediasoup worker.
### `make clean-all`
### `make clean-all`
Cleans all the objects and binaries, including those generated for library dependencies (such as libuv, openssl and libsrtp).
Cleans all the objects and binaries, including those generated for library dependencies (such as libuv, openssl and libsrtp).
...
@@ -62,34 +97,43 @@ In order to tun these tasks, `gulp-cli` (version >= 1.2.2) must be globally inst
...
@@ -62,34 +97,43 @@ In order to tun these tasks, `gulp-cli` (version >= 1.2.2) must be globally inst
$ npm install-g gulp-cli
$ npm install-g gulp-cli
```
```
### `gulp`
### `gulp`
The default task runs the `gulp:lint` and `gulp:test` tasks.
The default task runs the `gulp:lint` and `gulp:test` tasks.
### `gulp lint`
### `gulp lint`
Runs both the `lint:node` and `lint:worker` gulp tasks.
Runs both the `lint:node` and `lint:worker` gulp tasks.
### `gulp lint:node`
### `gulp lint:node`
Validates the Node.js JavaScript code/syntax.
Validates the Node.js JavaScript code/syntax.
### `gulp lint:worker`
### `gulp lint:worker`
Validates the worker C++ code/syntax using [clang-format](https://clang.llvm.org/docs/ClangFormat.html) following `worker/.clang-format` rules.
Validates the worker C++ code/syntax using [clang-format](https://clang.llvm.org/docs/ClangFormat.html) following `worker/.clang-format` rules.
### `gulp format`
### `gulp format`
Runs the `format:worker` gulp task.
Runs the `format:worker` gulp task.
### `gulp format:worker`
### `gulp format:worker`
Rewrites worker source and include files using [clang-format](https://clang.llvm.org/docs/ClangFormat.html).
Rewrites worker source and include files using [clang-format](https://clang.llvm.org/docs/ClangFormat.html).
### `gulp tidy`
### `gulp tidy`
Runs the `tidy:worker` gulp task.
Runs the `tidy:worker` gulp task.
### `gulp tidy:worker`
### `gulp tidy:worker`
Performs C++ code check using [clang-tidy](http://clang.llvm.org/extra/clang-tidy/) following following `worker/.clang-tidy` rules.
Performs C++ code check using [clang-tidy](http://clang.llvm.org/extra/clang-tidy/) following following `worker/.clang-tidy` rules.
...
@@ -115,10 +159,12 @@ Edit the file and remove the entry related to Utils/IP.cpp compilation unit, whi
...
@@ -115,10 +159,12 @@ Edit the file and remove the entry related to Utils/IP.cpp compilation unit, whi
*NOTE:* It just works on Linux and OSX.
*NOTE:* It just works on Linux and OSX.
### `gulp test`
### `gulp test`
Runs both the `test:node` and `test:worker` gulp tasks.
Runs both the `test:node` and `test:worker` gulp tasks.
### `gulp test:node`
### `gulp test:node`
Runs the Node.js [test units](test/). Before it, it invokes the `make` command.
Runs the Node.js [test units](test/). Before it, it invokes the `make` command.
...
@@ -129,6 +175,7 @@ In order to run the JavaScript test units with the mediasoup worker in `Debug` m
...
@@ -129,6 +175,7 @@ In order to run the JavaScript test units with the mediasoup worker in `Debug` m
$ MEDIASOUP_BUILDTYPE=Debug gulp test:node
$ MEDIASOUP_BUILDTYPE=Debug gulp test:node
```
```
### `gulp test:worker`
### `gulp test:worker`
Runs the mediasoup worker [test units](worker/test/). Before it, it invokes the `make test` command.
Runs the mediasoup worker [test units](worker/test/). Before it, it invokes the `make test` command.