File: install.md

package info (click to toggle)
librandombytes 0~20240318-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 344 kB
  • sloc: ansic: 411; python: 340; sh: 137; makefile: 28
file content (82 lines) | stat: -rw-r--r-- 2,966 bytes parent folder | download | duplicates (2)
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
Prerequisites: `python3`; `gcc` and/or `clang`; OpenSSL. Currently
tested only under Linux, but porting to other systems shouldn't be
difficult.

### For sysadmins

To install in `/usr/local/{include,lib,bin}`:

    ./configure && make -j8 install

If you're running an old Linux system and see that the `randombytes-info`
output says `randombytes source kernel-devurandom` (this will happen on
Linux kernels before 3.17), add the lines

    dd count=1 bs=64 if=/dev/random of=/dev/urandom status=none \
    && findmnt -t tmpfs -T /var/run >/dev/null \
    && touch /var/run/urandom-ready &

to your boot scripts to improve librandombytes startup time. On new
Linux systems, `randombytes-info` should instead say `kernel-getrandom`
and startup time should be fine in any case, unaffected by these lines.

If you're running a Linux virtual machine (old or new) and see startup
delays, you probably need the host to provide `virtio-rng`.

### For developers with an unprivileged account

Typically you'll already have

    export LD_LIBRARY_PATH="$HOME/lib"
    export LIBRARY_PATH="$HOME/lib"
    export CPATH="$HOME/include"
    export PATH="$HOME/bin:$PATH"

in `$HOME/.profile`. To install in `$HOME/{include,lib,bin}`:

    ./configure --prefix=$HOME && make -j8 install

### For distributors creating a package

Run

    ./configure --prefix=/usr && make -j8

and then follow your usual packaging procedures for the
`build/0/package` files:

    build/0/package/man/man3/randombytes.3
    build/0/package/man/man1/randombytes-info.1
    build/0/package/include/randombytes.h
    build/0/package/lib/librandombytes*
    build/0/package/bin/randombytes-info

Note that `librandombytes-kernel` and `librandombytes-openssl` are
alternative implementations of the same librandombytes API. There are
default symlinks to `librandombytes-kernel`, but you should allow the
sysadmin to change these symlinks to `librandombytes-openssl` by simply
installing a `librandombytes-openssl` package. The OpenSSL dependency is
for `librandombytes-openssl`; the rest of librandombytes is independent
of OpenSSL.

### More options

You can run

    ./configure --host=amd64

to override `./configure`'s guess of the architecture that it should
compile for. However, cross-compilers aren't yet selected automatically.

Inside the `build` directory, `0` is symlinked to `amd64` for
`--host=amd64`. Running `make clean` removes `build/amd64`. Re-running
`./configure` automatically starts with `make clean`.

A subsequent `./configure --host=arm64` will create `build/arm64` and
symlink `0 -> arm64`, without touching an existing `build/amd64`.

Compilers tried are listed in `compilers/default`. Each compiler
includes `-fPIC` to create a shared library and `-fwrapv` to switch to a
slightly less dangerous version of C; also, `-fvisibility=hidden` is
added automatically to hide non-public symbols in the library. The first
compiler that seems to work is used to compile everything.