-
Notifications
You must be signed in to change notification settings - Fork 172
Build the library
Build tools requirements are:
- GCC 5.2+ or Clang/LLVM
- Autotools or CMake
Build is currently tested on various GNU/Linux (including Ubuntu) and macOS.
OpenDHT dependencies are:
- msgpack-c 1.3+, used for data serialization.
- GnuTLS 3.3+, used for cryptographic operations.
- Nettle 2.4+, a GnuTLS dependency for crypto.
- Argon2, a dependency for key stretching.
- Readline, an optional dependency for the DHT tools.
- Cython, an optional dependency for the Python bindings.
- restinio v.0.5.1.2, used for the REST API.
- jsoncpp 1.7.4-3+, used for the REST API.
Follow these instructions to install OpenDHT dependencies depending on your system:
Ubuntu 20.04+:
# Install OpenDHT dependencies
sudo apt install libncurses5-dev libreadline-dev nettle-dev libgnutls28-dev libargon2-0-dev libmsgpack-dev libssl-dev libfmt-dev libjsoncpp-dev libhttp-parser-dev libasio-dev
# Install python binding dependencies
sudo apt-get install cython3 python3-dev python3-setuptools
# Build & install restinio (for proxy server/client):
mkdir restinio && cd restinio \
&& wget https://github.com/aberaud/restinio/archive/2224ffedef52cb2b74645d63d871d61dbd0f165e.tar.gz \
&& ls -l && tar -xzf 2224ffedef52cb2b74645d63d871d61dbd0f165e.tar.gz \
&& cd restinio-2224ffedef52cb2b74645d63d871d61dbd0f165e/dev \
&& cmake -DCMAKE_INSTALL_PREFIX=/usr -DRESTINIO_TEST=OFF -DRESTINIO_SAMPLE=OFF \
-DRESTINIO_INSTALL_SAMPLES=OFF -DRESTINIO_BENCH=OFF -DRESTINIO_INSTALL_BENCHES=OFF \
-DRESTINIO_FIND_DEPS=ON -DRESTINIO_ALLOW_SOBJECTIZER=Off -DRESTINIO_USE_BOOST_ASIO=none . \
&& make -j8 && make install \
&& cd ../../ && rm -rf restinio
# Install GnuTLS, Readline and msgpack-c
sudo dnf install readline-devel gnutls-devel msgpack-devel asio-devel libargon2-devel fmt-devel
# Install python binding dependencies
sudo dnf install python3-Cython python3-devel redhat-rpm-config
brew install gnutls msgpack-cxx argon2 asio
# clone the repo
git clone https://github.com/savoirfairelinux/opendht.git
# build and install
cd opendht
mkdir build && cd build
cmake -DOPENDHT_PYTHON=ON -DCMAKE_INSTALL_PREFIX=/usr ..
make -j4
sudo make install
Python bindings can be disabled by running cmake
with -DOPENDHT_PYTHON=OFF
instead of -DOPENDHT_PYTHON=ON
.
DHT Tools can be disabled by running cmake
with -DOPENDHT_BUILD_TOOLS=OFF
.
The /usr
install prefix is optional, it helps to build projects with OpenDHT without having to add /usr/local/lib
in LD_LIBRARY_PATH
.
The proxy server can be activated with -DOPENDHT_PROXY_SERVER=ON
. The full API (with SIGN
and ENCRYPT
endpoints) can be activated with -DOPENDHT_PROXY_SERVER_IDENTITY=ON
. The proxy client can be activated with -DOPENDHT_PROXY_CLIENT=ON
and the push notifications support with -DOPENDHT_PUSH_NOTIFICATIONS=ON
.
# clone the repo
git clone https://github.com/savoirfairelinux/opendht.git
# build and install
cd opendht
./autogen.sh && ./configure --prefix=/usr
make
sudo make install
Python bindings can be disabled by running ./configure
with the --disable-python
argument.
DHT Tools can be disabled by running ./configure
with the --disable-tools
argument.
The proxy server can be activated by running ./configure
with the --enable-proxy-server
argument. The full API (with SIGN
and ENCRYPT
endpoints) can be activated with --enable-proxy-server-optionals
.
The proxy client can be activated by adding --enable-proxy-client
and push notifications supports with --enable-push-notifications
.
Using either build method shown above, you can safely install OpenDHT in a diffrent root directory in the standard way like so:
make DESTDIR=${SOME_DIR} install
Note that ${SOME_DIR}
must be an absolute path as stated in the GNU standards.