Build Instructions - novalexei/mod_servlet GitHub Wiki

####Build Instructions

The mod_servlet should be more or less portable, but I have only tried it on Linux with GCC 6.1.0. If you have the experience of building it on other platforms with other tools (especially if this experience is pleasant) let me know.

#####Dependencies

mod_servlet will not build without the following dependencies:

  1. C++ compiler. Pretty obvious, but mod_servlet requires C++17 features (like string_view, shared_mutex, optional, any, filesystems, etc.) which might complicate things. If you already have such a compiler installed it's good, if not, install or build one.

  2. Apache2 httpd server. This is obvious too - mod_servlet is an Apache2 module. If you don't have it already, check out Apache2 home page. Not, that if you're compiling it from the sources make dure you enable mod_ssl.

  3. Apache Portable Runtime (APR). This is Apache2 cross-platform API. Usually it is a separate installation. If you already have Apache2 running on your machine it means that you already have APR, but you will also need API include directory. If you don't have it already, go get one (make sure you have both Apache Portable Runtime and Apache Portable Runtime Utility

  4. Boost library. Yes, not many modern C++ projects nowadays do with some boost. mod_servlet uses some header-only utilities too (core::demangle and lockfree). If you do C++ the chances are you already have it, if not get it here.

  5. I just assume that you have build tools like cmake

When you have all of above let's get to..

#####Build and install

The steps are simple: get clone mod_servlet from github, configure with cmake, make, install.

When configuring with cmake you'll need to specify some variables:

  • CMAKE_CXX_COMPILER (optional) - if you are planning to use not a default compiler, specify one with this flag.
  • APACHE_ROOT - directory of Apache2 httpd server on which you want to deploy mod_servlet
  • BOOST_ROOT (optional) - directory where Boost library installed. This variable is optional in a sense that cmake will try to find it itself, but it's better to be sure that the build is using the library which you think it's using.
  • APR_INCLUDE (optional) - include directory where header files for Apache APR and Apache APR Utils located. If this variable is not specified, cmake will try to find thos in usual Linux place /usr/include/apr-1
git clone --recursive https://github.com/novalexei/mod_servlet
mkdir mod_servlet/build
cd mod_servlet/build
cmake -DCMAKE_CXX_COMPILER=/home/me/gcc/6.1.0/bin/g++ -DAPACHE_ROOT=/home/me/apache-httpd/2.4 -DBOOST_ROOT=/home/me/boost/1.62.0 -DCMAKE_BUILD_TYPE=Release ..
make
make install

And that'll do it.

#####Apache2 server configuration

This will be described in Apache2 server configuration section