enhance(ci): Add multiple package build
[ric-plt/lib/rmr.git] / BUILD
1 #
2 #==================================================================================
3 #       Copyright (c) 2019 Nokia
4 #       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
21 Building RMr
22
23 The RIC Message Router (RMr) is built with CMake, and requires
24 a modern gcc compiler and make to be installed on the build
25 system. Typically, installing the following list of packages
26 in a container (Ubuntu) is all that is needed to craft a
27 development environment (containerised builds are also the
28 recommended approach):
29
30  gcc git make vim cmake g++ ksh bash
31
32 Kshell and vi are needed only if you wish to use the container
33 interactively. Bash is assumed necessary for CMake.
34
35
36 Build process
37 To build RMr, the usual CMake steps are followed:
38         mkdir build
39         cd build
40         cmake .. [options]
41         make package
42
43
44 This will create a .deb (provided the system supports this) in
45 the build directory.  It's that simple.
46
47 Continuous Integration Build
48 Use the Dockerfile in the ci/ subdirectory. This installs all
49 the required tools, then builds RMr and executes the unit and
50 programm tests. If tests pass, then  an image is created in the
51 local registry with both run-time and development packages.
52
53 To support the distribution of package(s) created during the
54 build by the CI process,  a YAML file is left in the /tmp
55 directory (build_packages.yml) which contains a list of the
56 packages available from the image.  Currently, both .deb and
57 .rpm packages are generated.
58
59 The following is a sample YAML file generated during this process:
60
61    # package types which might be listed below
62    ---
63    pkg_types:
64      - deb
65      - rpm
66    packages:
67      - development:
68        deb: /tmp/rmr-dev_1.0.34_x86_64.deb
69        rpm: /tmp/rmr-dev-1.0.34-x86_64.rpm
70      - runtime:
71        deb: /tmp/rmr_1.0.34_x86_64.deb
72        rpm: /tmp/rmr-1.0.34-x86_64.rpm
73    ...
74
75
76
77 Alternatives
78 To build in a non-Linux environment, or to build with an
79 alternate install path (or both) read on.
80
81 Instead of using 'make package' as listed above, using
82 'make install'  will build and install on the local system.
83 By default, the target install is into /usr/local which may
84 not be desired.  To install into an alternate path add
85 these two options when the 'cmake ..' command is given:
86
87   -DCMAKE_INSTALL_PREFIX=/path/to/dir
88   -DMAN_PREFIX=/path/to/dir
89
90
91 The first will cause the make process to install into the named
92 directory, which can be in your home directory. The second
93 defines where manual pages are placed (if not defined
94 /usr/share/man is the target).   Manual pages are generally
95 NOT built as the required tool has yet to be incorporated into
96 the build process and generally is not available on most systems.
97
98
99 Compiling and Linking User Applications
100 Should the Rmr and NNG/Nano libraries be installed in a directory
101 outside of the normal system spots (e.g. not in /usr/local)
102 it might be necessary to define the specific directory for
103 libraries (.e.g -L) on the command line, or via environment
104 variables (e.g.. C_INCLUDE_PATH, LD_LIBRARY_PATH, LIBRARY_PATH).
105 It may also be necessary to have the library directory defined
106 in the environment at run time.  It is difficult to know what
107 each system needs, but the following linker ooptions  work when
108 libraries are installed in the system spots:
109
110         -lrmr_nng -lnng -lpthread
111
112 Adding -L is one way to compensate when libraries are installed
113 a different spot (e.g. in $HOME/usr):
114
115         -L $HOME/usr -lrmr_nng -lnng -lpthread
116
117
118 Libraries
119 RMr supports both NNG and Nanomsg as underlying transport. They
120 are separate beasts, and while an NNG based program can
121 communicate with a Nanomsg based programme, their APIs are NOT
122 compatible.  For this reason, and others, RMr generates two
123 libraries and requires that the underlying transport be selected
124 at link time rather than run time.  The RMr API for both underlying
125 mechanisms is the same, so generating a NNG and Nanomsg version
126 of a programme should require no extra work; other than adding
127 a second link statement and giving it a different name.
128
129 Nanomsg is on its way out with respect to community support. RMr
130 will continue to support Nanomsg for a short period of time, but
131 new programmes should NOT use Nanomsg.
132
133
134 Manual Pages
135 By default the deb created does not include the manual pages. To
136 enable their creation, and subsequent inclusion in the deb, add
137 the following option to the cmake command:
138
139         -DBUILD_DOC=1
140
141 This will cause the {X}fm text formatting package to be fetched
142 (github) and built at cmake time (must exist before building)
143 and will trigger the generation of the man pages in both postscript
144 and troff format.  The troff pages are placed into the deb and
145 the postscript pages are left in the build directory for the
146 developer to convert to PDF, or otherwise use.
147
148