xref: /freebsd/contrib/lutok/INSTALL.md (revision 132f818ddbf457ee67d502cd89b5a18e0a34713d)
1*132f818dSEnji Cooper# Introduction
2*132f818dSEnji Cooper
3*132f818dSEnji CooperLutok uses the GNU Automake, GNU Autoconf and GNU Libtool utilities as
4*132f818dSEnji Cooperits build system.  These are used only when compiling the library from
5*132f818dSEnji Cooperthe source code package.  If you want to install Lutok from a binary
6*132f818dSEnji Cooperpackage, you do not need to read this document.
7*132f818dSEnji Cooper
8*132f818dSEnji CooperFor the impatient:
9*132f818dSEnji Cooper
10*132f818dSEnji Cooper```shell
11*132f818dSEnji Cooper$ ./configure
12*132f818dSEnji Cooper$ make
13*132f818dSEnji Cooper$ make check
14*132f818dSEnji Cooper$ sudo make install # or `make install` with root privileges
15*132f818dSEnji Cooper$ make installcheck
16*132f818dSEnji Cooper```
17*132f818dSEnji Cooper
18*132f818dSEnji CooperOr alternatively, install as a regular user into your home directory:
19*132f818dSEnji Cooper
20*132f818dSEnji Cooper```shell
21*132f818dSEnji Cooper$ ./configure --prefix ~/local
22*132f818dSEnji Cooper$ make
23*132f818dSEnji Cooper$ make check
24*132f818dSEnji Cooper$ make install
25*132f818dSEnji Cooper$ make installcheck
26*132f818dSEnji Cooper```
27*132f818dSEnji Cooper
28*132f818dSEnji Cooper# Dependencies
29*132f818dSEnji Cooper
30*132f818dSEnji CooperTo build and use Lutok successfully you need:
31*132f818dSEnji Cooper
32*132f818dSEnji Cooper* A C++-11 standards-compliant compiler.
33*132f818dSEnji Cooper* Lua 5.1 or greater.
34*132f818dSEnji Cooper* pkg-config or an equivalent tool, e.g., pkgconf.
35*132f818dSEnji Cooper
36*132f818dSEnji CooperOptionally, if you want to build and run the tests (recommended), you
37*132f818dSEnji Cooperneed:
38*132f818dSEnji Cooper
39*132f818dSEnji Cooper* Kyua 0.5 or greater.
40*132f818dSEnji Cooper* ATF 0.15 or greater.
41*132f818dSEnji Cooper
42*132f818dSEnji CooperIf you are building Lutok from the code on the repository, you will also
43*132f818dSEnji Cooperneed the following tools:
44*132f818dSEnji Cooper
45*132f818dSEnji Cooper* GNU Autoconf 2.68 (or later).
46*132f818dSEnji Cooper* GNU Automake 1.9 (or later).
47*132f818dSEnji Cooper* GNU Libtool.
48*132f818dSEnji Cooper
49*132f818dSEnji Cooper
50*132f818dSEnji Cooper# Regenerating the build system
51*132f818dSEnji Cooper
52*132f818dSEnji CooperThis is not necessary if you are building from a formal release
53*132f818dSEnji Cooperdistribution file.
54*132f818dSEnji Cooper
55*132f818dSEnji CooperOn the other hand, if you are building Lutok from code extracted from
56*132f818dSEnji Cooperthe repository, you must first regenerate the files used by the build
57*132f818dSEnji Coopersystem.  You will also need to do this if you modify `configure.ac`,
58*132f818dSEnji Cooper`Makefile.am`, or any of the other build system files.  To do this, simply
59*132f818dSEnji Cooperrun:
60*132f818dSEnji Cooper
61*132f818dSEnji Cooper```shell
62*132f818dSEnji Cooper$ autoreconf -i -s
63*132f818dSEnji Cooper```
64*132f818dSEnji Cooper
65*132f818dSEnji CooperIf ATF is installed in a different prefix than `autoconf`, you will also
66*132f818dSEnji Cooperneed to tell `autoreconf` where the ATF m4 macros are located.  Otherwise,
67*132f818dSEnji Cooperthe `configure` script will be incomplete and will show confusing syntax
68*132f818dSEnji Coopererrors mentioning, for example, `ATF_CHECK_SH`.  To fix this, you have
69*132f818dSEnji Cooperto run `autoreconf` in the following manner, replacing `<atf-prefix>` with
70*132f818dSEnji Cooperthe appropriate path:
71*132f818dSEnji Cooper
72*132f818dSEnji Cooper```shell
73*132f818dSEnji Cooper$ autoreconf -i -s -I <atf-prefix>/share/aclocal
74*132f818dSEnji Cooper```
75*132f818dSEnji Cooper
76*132f818dSEnji Cooper# General build procedure
77*132f818dSEnji Cooper
78*132f818dSEnji CooperTo build and install the source package, you must follow these steps:
79*132f818dSEnji Cooper
80*132f818dSEnji Cooper#. Configure the sources to adapt to your operating system.  This is
81*132f818dSEnji Cooper   done using the `configure` script located on the sources' top
82*132f818dSEnji Cooper   directory, and it is usually invoked without arguments unless you
83*132f818dSEnji Cooper   want to change the installation prefix.  More details on this
84*132f818dSEnji Cooper   procedure are given on a later section.
85*132f818dSEnji Cooper
86*132f818dSEnji Cooper#. Build the sources to generate the binaries and scripts.  Simply run
87*132f818dSEnji Cooper   `make` on the sources' top directory after configuring them.  No
88*132f818dSEnji Cooper   problems should arise.
89*132f818dSEnji Cooper
90*132f818dSEnji Cooper#. Install the library by running `make install`.  You may need to
91*132f818dSEnji Cooper   become root to issue this step.
92*132f818dSEnji Cooper
93*132f818dSEnji Cooper#. Issue any manual installation steps that may be required.  These are
94*132f818dSEnji Cooper   described later in their own section.
95*132f818dSEnji Cooper
96*132f818dSEnji Cooper#. Check that the installed library works by running `make installcheck`.
97*132f818dSEnji Cooper   You do not need to be root to do this.
98*132f818dSEnji Cooper
99*132f818dSEnji Cooper
100*132f818dSEnji Cooper# Configuration flags
101*132f818dSEnji Cooper
102*132f818dSEnji CooperThe most common, standard flags given to `configure` are:
103*132f818dSEnji Cooper
104*132f818dSEnji Cooper- `--prefix=directory`
105*132f818dSEnji Cooper    - **Possible values**: any path
106*132f818dSEnji Cooper    - **Default**: "/usr/local"
107*132f818dSEnji Cooper
108*132f818dSEnji Cooper      Specifies where the library (binaries and all associated files) will
109*132f818dSEnji Cooper      be installed.
110*132f818dSEnji Cooper
111*132f818dSEnji Cooper- `--help`
112*132f818dSEnji Cooper      Shows information about all available flags and exits immediately,
113*132f818dSEnji Cooper      without running any configuration tasks.
114*132f818dSEnji Cooper
115*132f818dSEnji CooperThe following flags are specific to Lutok's `configure` script:
116*132f818dSEnji Cooper
117*132f818dSEnji Cooper- `--enable-developer`
118*132f818dSEnji Cooper    - **Possible values**: "yes", "no"
119*132f818dSEnji Cooper    - **Default**: "yes" in Git HEAD builds; "no" in formal releases.
120*132f818dSEnji Cooper
121*132f818dSEnji Cooper      Enables several features useful for development, such as the inclusion
122*132f818dSEnji Cooper      of debugging symbols in all objects or the enforcement of compilation
123*132f818dSEnji Cooper      warnings.
124*132f818dSEnji Cooper
125*132f818dSEnji Cooper      The compiler will be executed with an exhaustive collection of warning
126*132f818dSEnji Cooper      detection features regardless of the value of this flag.  However, such
127*132f818dSEnji Cooper      warnings are only fatal when `--enable-developer` is set to "yes".
128*132f818dSEnji Cooper
129*132f818dSEnji Cooper- `--enable-atf`
130*132f818dSEnji Cooper    - **Possible values**: "yes", "no", "auto".
131*132f818dSEnji Cooper    - **Default**: "auto"
132*132f818dSEnji Cooper
133*132f818dSEnji Cooper      Enables usage of ATF to build (and later install) the tests.
134*132f818dSEnji Cooper
135*132f818dSEnji Cooper      Setting this to "yes" causes the `configure` script to look for ATF
136*132f818dSEnji Cooper      unconditionally and abort if not found.  Setting this to "auto" lets
137*132f818dSEnji Cooper      `configure` perform the best decision based on availability of ATF.
138*132f818dSEnji Cooper      Setting this to "no" explicitly disables ATF usage.
139*132f818dSEnji Cooper
140*132f818dSEnji Cooper      When support for tests is enabled, the build process will generate the
141*132f818dSEnji Cooper      test programs and will later install them into the tests tree.
142*132f818dSEnji Cooper      Running `make check` or `make installcheck` from within the source
143*132f818dSEnji Cooper      directory will cause these tests to be run with Kyua (assuming it is
144*132f818dSEnji Cooper      also installed).
145*132f818dSEnji Cooper
146*132f818dSEnji Cooper- `--with-doxygen`
147*132f818dSEnji Cooper    - **Possible values**: "yes", "no", "auto", or a path.
148*132f818dSEnji Cooper    - **Default**: "auto".
149*132f818dSEnji Cooper
150*132f818dSEnji Cooper      Enables usage of Doxygen to generate documentation for internal APIs.
151*132f818dSEnji Cooper
152*132f818dSEnji Cooper      Setting this to "yes" causes the `configure` script to look for Doxygen
153*132f818dSEnji Cooper      unconditionally and abort if not found.  Setting this to "auto" lets
154*132f818dSEnji Cooper      `configure` perform the best decision based on availability of Doxygen.
155*132f818dSEnji Cooper      Setting this to "no" explicitly disables Doxygen usage.  And, lastly,
156*132f818dSEnji Cooper      setting this to a path forces `configure` to use a specific Doxygen
157*132f818dSEnji Cooper      binary, which must exist.
158*132f818dSEnji Cooper
159*132f818dSEnji Cooper      When support for Doxygen is enabled, the build process will generate
160*132f818dSEnji Cooper      HTML documentation for the Lutok API.  This documentation will later
161*132f818dSEnji Cooper      be installed in the HTML directory specified by the `configure` script.
162*132f818dSEnji Cooper      You can change the location of the HTML documents by providing your
163*132f818dSEnji Cooper      desired override with the `--htmldir` flag to the `configure` script.
164*132f818dSEnji Cooper
165*132f818dSEnji Cooper
166*132f818dSEnji CooperRun the tests!
167*132f818dSEnji Cooper==============
168*132f818dSEnji Cooper
169*132f818dSEnji CooperLastly, after a successful installation (and assuming you built the
170*132f818dSEnji Coopersources with support for ATF), you should periodically run the tests
171*132f818dSEnji Cooperfrom the final location to ensure things remain stable.  Do so as
172*132f818dSEnji Cooperfollows:
173*132f818dSEnji Cooper
174*132f818dSEnji Cooper```shell
175*132f818dSEnji Cooper$ kyua test -k /usr/local/tests/lutok/Kyuafile
176*132f818dSEnji Cooper```
177*132f818dSEnji Cooper
178*132f818dSEnji CooperAnd if you see any tests fail, do not hesitate to report them in:
179*132f818dSEnji Cooper
180*132f818dSEnji Cooper    https://github.com/freebsd/lutok/issues/
181*132f818dSEnji Cooper
182*132f818dSEnji CooperThank you!
183