blob: 3bc677ec10e7fa52b403cc2f9559395c68face6a [file] [log] [blame]
Ashwin Sridharanfd9cc7a2019-04-03 16:47:02 -04001#
2#==================================================================================
E. Scott Daniels29d87162019-06-12 13:48:25 -04003# Copyright (c) 2019 Nokia
Ashwin Sridharanfd9cc7a2019-04-03 16:47:02 -04004# Copyright (c) 2018-2019 AT&T Intellectual Property.
5#
6# Licensed under the Apache License, Version 2.0 (the "License");
7# you may not use this file except in compliance with the License.
8# You may obtain a copy of the License at
9#
10# http://www.apache.org/licenses/LICENSE-2.0
11#
12# Unless required by applicable law or agreed to in writing, software
13# distributed under the License is distributed on an "AS IS" BASIS,
14# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15# See the License for the specific language governing permissions and
16# limitations under the License.
17#==================================================================================
18#
19
20
21Building RMr
22
23The RIC Message Router (RMr) is built with CMake, and requires
Lott, Christopher (cl778h)f89eec52019-06-10 16:53:39 -040024a modern gcc compiler and make to be installed on the build
Ashwin Sridharanfd9cc7a2019-04-03 16:47:02 -040025system. Typically, installing the following list of packages
26in a container (Ubuntu) is all that is needed to craft a
27development environment (containerised builds are also the
28recommended approach):
29
30 gcc git make vim cmake g++ ksh bash
31
32Kshell and vi are needed only if you wish to use the container
33interactively. Bash is assumed necessary for CMake.
34
35
36Build process
37To build RMr, the usual CMake steps are followed:
38 mkdir build
39 cd build
40 cmake .. [options]
41 make package
42
43This will create a .deb (provided the system supports this) in
44the build directory. It's that simple.
45
E. Scott Daniels29d87162019-06-12 13:48:25 -040046Continuous integration build
Lott, Christopher (cl778h)f89eec52019-06-10 16:53:39 -040047Use the Dockerfile in the ci/ subdirectory. This installs all
48the required tools and creates an image in the local registry.
49
E. Scott Daniels29d87162019-06-12 13:48:25 -040050To support the distribution of package(s) created during the
51build by the CI process, the fully qualified path of each generated
52package will be placed into a well known YAML file:
53/tmp/build_output.yml. This file is created during CMake
54configuration and lists the package name(s) for packages which
55can be generated given the current environment. Currently
56Debian (.deb), and RPM packages are supported (the Ubuntu
57alien package must be installed in order to generate RPMs).
58
Ashwin Sridharanfd9cc7a2019-04-03 16:47:02 -040059
60Alternatives
61To build in a non-Linux environment, or to build with an
62alternate install path (or both) read on.
63
Lott, Christopher (cl778h)f89eec52019-06-10 16:53:39 -040064Instead of using 'make package' as listed above, using
Ashwin Sridharanfd9cc7a2019-04-03 16:47:02 -040065'make install' will build and install on the local system.
Lott, Christopher (cl778h)f89eec52019-06-10 16:53:39 -040066By default, the target install is into /usr/local which may
Ashwin Sridharanfd9cc7a2019-04-03 16:47:02 -040067not be desired. To install into an alternate path add
68these two options when the 'cmake ..' command is given:
69
70 -DCMAKE_INSTALL_PREFIX=/path/to/dir
71 -DMAN_PREFIX=/path/to/dir
72
73
74The first will cause the make process to install into the named
Lott, Christopher (cl778h)f89eec52019-06-10 16:53:39 -040075directory, which can be in your home directory. The second
76defines where manual pages are placed (if not defined
Ashwin Sridharanfd9cc7a2019-04-03 16:47:02 -040077/usr/share/man is the target). Manual pages are generally
78NOT built as the required tool has yet to be incorporated into
79the build process and generally is not available on most systems.
80
81
E. Scott Daniels29d87162019-06-12 13:48:25 -040082Compiling and Linking User Applications
Ashwin Sridharanfd9cc7a2019-04-03 16:47:02 -040083Should the Rmr and NNG/Nano libraries be installed in a directory
Lott, Christopher (cl778h)f89eec52019-06-10 16:53:39 -040084outside of the normal system spots (e.g. not in /usr/local)
85it might be necessary to define the specific directory for
Ashwin Sridharanfd9cc7a2019-04-03 16:47:02 -040086libraries (.e.g -L) on the command line, or via environment
87variables (e.g.. C_INCLUDE_PATH, LD_LIBRARY_PATH, LIBRARY_PATH).
88It may also be necessary to have the library directory defined
89in the environment at run time. It is difficult to know what
Lott, Christopher (cl778h)f89eec52019-06-10 16:53:39 -040090each system needs, but the following linker ooptions work when
Ashwin Sridharanfd9cc7a2019-04-03 16:47:02 -040091libraries are installed in the system spots:
92
93 -lrmr_nng -lnng -lpthread
94
Lott, Christopher (cl778h)f89eec52019-06-10 16:53:39 -040095Adding -L is one way to compensate when libraries are installed
Ashwin Sridharanfd9cc7a2019-04-03 16:47:02 -040096a different spot (e.g. in $HOME/usr):
97
98 -L $HOME/usr -lrmr_nng -lnng -lpthread
99
100
101Libraries
Lott, Christopher (cl778h)f89eec52019-06-10 16:53:39 -0400102RMr supports both NNG and Nanomsg as underlying transport. They
103are separate beasts, and while an NNG based programme can
104communicate with a Nanomsg based programme, their APIs are NOT
Ashwin Sridharanfd9cc7a2019-04-03 16:47:02 -0400105compatible. For this reason, and others, RMr generates two
106libraries and requires that the underlying transport be selected
107at link time rather than run time. The RMr API for both underlying
108mechanisms is the same, so generating a NNG and Nanomsg version
109of a programme should require no extra work; other than adding
110a second link statement and giving it a different name.
111
112Nanomsg is on its way out with respect to community support. RMr
113will continue to support Nanomsg for a short period of time, but
114new programmes should NOT use Nanomsg.
115
116
E. Scott Daniels15390d72019-05-06 20:19:59 +0000117Manual Pages
118By default the deb created does not include the manual pages. To
119enable their creation, and subsequent inclusion in the deb, add
120the following option to the cmake command:
121
122 -DBUILD_DOC=1
123
124This will cause the {X}fm text formatting package to be fetched
125(github) and built at cmake time (must exist before building)
126and will trigger the generation of the man pages in both postscript
Lott, Christopher (cl778h)f89eec52019-06-10 16:53:39 -0400127and troff format. The troff pages are placed into the deb and
128the postscript pages are left in the build directory for the
E. Scott Daniels15390d72019-05-06 20:19:59 +0000129developer to convert to PDF, or otherwise use.
E. Scott Daniels29d87162019-06-12 13:48:25 -0400130
131