/cjet

An ANSI C conformant JET implementation

Primary LanguageCMIT LicenseMIT

cjet - An ANSI C conformant JET implementation

License

Copyright (c) 2014 Stephan Gatzka. See the LICENSE file for license rights and limitations (MIT).

Build Status

Travis CI Appveyor CI Coverity Coverage Status

Open Hub

Howto Build

CMake

Create a build directory somewhere on you build machine and execute:

  • cmake <path/to/cjet-sources>
  • make
  • Optionally run make test to execute the unit tests.

There are some options available to configure cjet at compile time. You will find all these options in the file defaults.cmake. If you want to override these default values, you need to pass these options to cmake, e.g. cmake -DCONFIG_MAX_WRITE_BUFFER_SIZE=51200 -D... <path/to/cjet-sources>.

Per default, cjet is always built with hardening compile switches like -fpie, -fstack-protector or -D_FORTIFY_SOURCE=2. This imposes a little runtime overhead. You can disable all hardening by calling cmake with -DCONFIG_NO_HARDENING=1.

QBS

There is a second build method available, qbs. Just create a build directory, change to it and run:

qbs -f <path/to/cjet-sources>/src/cjet.qbs

qbs has the ability to make parallel builds for multiple profiles. So if you want to build with clang, gcc, arm-gcc, ppc-gcc (these are the names of your qbs profiles), just run:

qbs -f <path/to/cjet-sources>/src/cjet.qbs debug-clang profile:clang qbs.buildVariant:debug release-clang profile:clang qbs.buildVariant:release debug-gcc profile:gcc qbs.buildVariant:debug release-gcc profile:gcc qbs.buildVariant:release

You can also configure cjet at compile time via qbs. You will find the cjet specific configurations in generateCjetConfig.qbs and the Linux specific configurations in generateOsConfig.qbs.

You can override these defaults easily when calling qbs, for instance:

qbs -f <path/to/cjet-sources>/src/cjet.qbs profile:gcc generateCjetConfig.serverPort:4321 generateOsConfig.maxEpollEvents:11

Per default, cjet is always built with hardening compile switches like -fpie, -fstack-protector or -D_FORTIFY_SOURCE=2. This imposes a little runtime overhead. You can disable all hardening by calling qbs like:

qbs -f <path/to/cjet-sources>/src/cjet.qbs release hardening.enableHardening:false

In addition, there is also a qbs project for building cjet and running all unit tests:

qbs -f <path/to/cjet-sources>/all.qbs release profile:gcc [products.unittestRunner.showCoverageData:true]...

You can specify as many additional parallel builds by adding more profiles. If products.unittestRunner.showCoverageData:true is given, the coverage data is directly displayed in a web browser.

If you don't like waiting for the http-parse-tests to complete you can disable them;

qbs -f <path/to/cjet-sources>/all.qbs release profile:gcc [projects.cjetUnitTests.buildHttpParserTest:false]...

If you have clang and clang-analyzer installed, you can run the static code analyzer with

qbs -f <path/to/cjet-sources>/all.qbs release profile:clang cjet.runAnalyzer:true

You can generate call- and caller-graphs for the documentation with Doxygen. This requires Graphviz to be installed on your system. It can be switched on with:

qbs -f <path/to/cjet-sources>/all.qbs generateDoxygen.createGraphs:true

Howto run

Just execute cjet.bin to run cjet in daemon mode. There are some command line options available:

  • -f to run cjet in foreground.
  • -u <username> to run cjet with the privileges of a certain user
  • -p <password file> specifies the credential file to use for authentication
  • -r <request target> to specify the request target for the websocket jet access
  • -l let cjet only listen on the loopback device