summaryrefslogtreecommitdiffstats
path: root/docs/installation.adoc
blob: 991fa852919c0bf8c2edaf2bbd280074a952fe0e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
= Installing RNP

Binaries that will be installed:

* `rnp`
* `rnpkeys`


== On NixOS or Nix package manager

We provide a Nix package for easy installation on NixOS and any OS with Nix
installed (including Linux and macOS, even NixOS on WSL).

[source,console]
----
nix-env -iA nixpkgs.rnp
----

== With Nix Flakes

We provide a Nix flake.

[source,console]
----
nix profile install github:rnpgp/rnp
----

== On macOS using Homebrew

We provide a Homebrew tap for easy installation of RNP on macOS.

[source,console]
----
brew tap rnpgp/rnp
brew install rnp
----

== On RHEL and CentOS via YUM

We provide pre-built packages for RHEL and CentOS at our YUM repository hosted
at GitHub.

[source,console]
----
rpm --import https://github.com/riboseinc/yum/raw/master/ribose-packages.pub
rpm --import https://github.com/riboseinc/yum/raw/master/ribose-packages-next.pub
curl -L https://github.com/riboseinc/yum/raw/master/ribose.repo > /etc/yum.repos.d/ribose.repo
yum install -y rnp
----

== On Ubuntu

Prerequisites: please ensure `git` is installed on the system
[source,console]
----
# Clone the repository by version tag (or omit it to get the latest sources)
git clone https://github.com/rnpgp/rnp.git -b v0.17.0

Please ensure that you clone with submodules if you use a version higher then 0.16.2
git clone https://github.com/rnpgp/rnp.git --recurse-submodules --shallow-submodules

# Install required packages
sudo apt install g++-8 cmake libbz2-dev zlib1g-dev libjson-c-dev build-essential python-minimal

# Download, build and install Botan2
wget -qO- https://botan.randombit.net/releases/Botan-2.18.2.tar.xz | tar xvJ
cd Botan-2.18.2
./configure.py --prefix=/usr
make
sudo make install
cd ..

# CMake encourages building outside of the source directory.
mkdir rnp-build
cd rnp-build

# Run CMake
cmake -DCMAKE_INSTALL_PREFIX=/usr -DBUILD_SHARED_LIBS=on -DBUILD_TESTING=off ../rnp/

# Compile
make

# Install
sudo make install
----

== On Debian

Prerequisite: please ensure `git` is installed on the system.

[source,console]
----
# Clone the repository by version tag (or omit it to get the latest sources)
git clone https://github.com/rnpgp/rnp.git -b v0.17.0

Please ensure that you clone with submodules if you use a version higher then 0.16.2
git clone https://github.com/rnpgp/rnp.git --recurse-submodules --shallow-submodules

# Enable access to `testing` packages by editing /etc/apt/sources.list
# deb http://deb.debian.org/debian testing main

# Install required packages
sudo apt install g++-8 cmake libbz2-dev zlib1g-dev libjson-c-dev \
  libbotan-2-dev build-essential

# Cmake recommend out-of-source builds
mkdir rnp-build
cd rnp-build

# Cmake it
cmake -DCMAKE_INSTALL_PREFIX=/usr -DBUILD_SHARED_LIBS=on -DBUILD_TESTING=off ../rnp/

# Compile and install
sudo make install
----

== On Gentoo Linux

RNP ebuilds are available from an overlay repository named `rnp`.

=== Using eselect-repository (the current way)

Prerequisite: ensure `eselect-repository` is installed on your system.

[source,console]
----
eselect repository enable rnp
emaint sync -r rnp
emerge -av app-crypt/rnp
----

=== Using layman (the old way)

Prerequisite: ensure `layman` is installed on your system.

[source,console]
----
layman -a rnp
layman -s rnp
emerge -av app-crypt/rnp
----

== Compile from source

Clone this repo, or download a release and expand it.

Enter the source folder and run the following commands:

[source,console]
----
cmake -DCMAKE_INSTALL_PREFIX=/usr/local -DBUILD_SHARED_LIBS=on -DBUILD_TESTING=off  .

make install
----

== On Windows

=== Using MSYS/MinGW

From a clean MSYS2 install, please first update `pacman` and install required
packages via the `msys` console.

[source,console]
----
pacman -Syu --noconfirm --needed

# Most likely you'll need to close msys console and run it again:
pacman -Syu --noconfirm --needed

# Install packages
pacman --noconfirm -S --needed tar zlib-devel libbz2-devel git automake autoconf libtool automake-wrapper make pkg-config mingw64/mingw-w64-x86_64-cmake mingw64/mingw-w64-x86_64-gcc mingw64/mingw-w64-x86_64-json-c mingw64/mingw-w64-x86_64-libbotan mingw64/mingw-w64-x86_64-python3
----

Then clone the RNP repository and build it.

Please ensure that you clone with submodules if you use a version higher then 0.16.2
git clone https://github.com/rnpgp/rnp.git --recurse-submodules --shallow-submodules

[source,console]
----
# CMake encourages building outside of the source directory.
mkdir rnp-build
cd rnp-build

# Add paths to PATH so dependency dll/lib files can be found
export PATH="/c/msys64/mingw64/lib:/c/msys64/mingw64/bin:$PWD/bin:$PATH"

# Run CMake
cmake -DBUILD_SHARED_LIBS=yes -G "MSYS Makefiles" -DBUILD_TESTING=off ../rnp

# Compile and install
make && make install
----

=== Using Microsoft Visual Studio 2019 and vcpkg

Install `vcpkg` according to
https://docs.microsoft.com/en-us/cpp/build/install-vcpkg?view=msvc-160&tabs=windows[these instructions]:

Set the `VCPKG_ROOT` environment variable to the `vcpkg` root folder.

For botan backend:
[source,console]
----
vcpkg install --triplet x64-windows bzip2 zlib botan json-c getopt dirent python3[core,enable-shared]
----

For openssl backend:
[source,console]
----
vcpkg install --triplet x64-windows bzip2 zlib botan json-c getopt dirent python3[core,enable-shared]
----

If you need to target 32-bit platform you'll need to to replace `x64-windows` with `x86-windows`.

* The following steps will perform a console build for CMake using Visual Studio 2019 CMake generator: +
+
--
[source,console]
----
cmake -B build -G "Visual Studio 16 2019" -A x64 -DCMAKE_TOOLCHAIN_FILE=%VCPKG_ROOT%\scripts\buildsystems\vcpkg.cmake \
      -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=off -DCRYPTO_BACKEND="botan" .
cmake --build . --config Release
cmake --install .
----
--
Replace CRYPTO_BACKEND parameter to "openssl" if you target this backend.

Ensure that the following dependencies are available on path:

* `librnp.dll`
* `botan.dll` or `libcrypto.dll` depending on target backend and architecture
* `bz2.dll`
* `getopt.dll`
* `json-c.dll`
* `zlib1.dll`

=== Using Microsoft Visual Studio 2019 and pre-installed libraries

Install dependencies and make them available either on PATH or using CMAKE_TARGET_PREFIX parameter:

* Botan(2.14+) or Crypto (OpenSSL 1.1.1+) depending on target backend
* BZip2
* GetOpt
* JSON-C (0.12.1+)
* ZLIB

If openssl backend is used note that your environment may have another ("default") openssl installation.
In such case use OPENSSL_ROOT_DIR.

* The following steps will perform a console build for CMake using Visual Studio 2019 CMake generator: +
+
--
[source,console]
----
cmake -B build -G "Visual Studio 16 2019" -A x64 -DOPENSSL_ROOT_DIR=<openssl root> -DCMAKE_TARGET_PREFIX=<target prefix> \
      -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=off -DCRYPTO_BACKEND="botan" .
cmake --build . --config Release
cmake --install .
----
--
Replace CRYPTO_BACKEND parameter to "openssl" if you target this backend, use OPENSSL_ROOT_DIR and CMAKE_TARGET_PREFIX optionally as explained above