Skip to content

Install From Source

Matt Carlotta edited this page Nov 4, 2023 · 1 revision

Run the following command to clone the source code:

git clone git@github.com:mattcarlotta/nvi.git nvi

or if you plan on running the unit tests:

git clone git@github.com:mattcarlotta/nvi.git nvi --recursive

Change directory:

cd nvi

Run the install script to build and install the binary using the default cmake parameters:

./install.sh

OR you can manually build and install the binary (for more cmake options, check out the Custom CMake Compile Flags):

cmake .
sudo make install

⚠️ Be careful when running the install script or sudo make install if you've also compiled the tests using the custom cmake -DCOMPILE_TESTS flag. As noted below, the flag is OFF by default. If the flag is active, it will install gtest dependencies to your /usr directory.

Custom CMake Compile Flags

The following custom compile flags can be set for cmake:

  • -DCOMPILE_SRC=ON|OFF this compiles the source files within src to a nvi binary (default: ON)
  • -DCOMPILE_TESTS=ON|OFF this compiles the source files within tests to a tests binary (default: OFF)
  • -DINSTALL_BIN_DIR=/custom/directory/path this will override the binary installation directory when running sudo make install (default: /usr/local/bin)
  • -DINSTALL_MAN_DIR=/path/to/man/man1 this will automatically install the nvi man documentation to the specified directory when running sudo make install (default: OFF)‡
  • -DUSE_LOCALHOST_API=ON|OFF this specifies to use a localhost nvi API when retrieving remote ENVs (default: OFF)

‡ If you run into errors trying to install the man documentation please read Can't install the man documentation in a root level directory.

The following represents the default cmake settings:

cmake -DCOMPILE_SRC=ON -DCOMPILE_TESTS=OFF -DINSTALL_BIN_DIR=/usr/local/bin -DINSTALL_MAN_DIR=OFF -DUSE_LOCALHOST_API=OFF .