Skip to content
Snippets Groups Projects
Commit 8e0e1e08 authored by Amna Snene's avatar Amna Snene
Browse files

build: add build script

Change-Id: I0f9528aafd0483e6c8c55053071acafedae778e6
parent ff5ba458
Branches
No related tags found
No related merge requests found
BUILD.md 0 → 100644
# Building DHTNet
This document provides instructions on how to build DHTNet from source code. Ensure that you have met all the dependencies before proceeding with the build.
## Dependencies
DHTNet depends on the following libraries:
- **OpenDHT** 2.6, used to launch DHT nodes.
- **[pjproject](https://github.com/savoirfairelinux/pjproject)**, used for ICE negotiation.
- **msgpack-c** 1.2+, used for data serialization.
- **GnuTLS** 3.3+, used for cryptographic operations.
- **Nettle** 2.4+, a GnuTLS dependency for crypto.
- **{fmt}** 9.0+, for log formatting.
## Building Instructions
Follow these steps to build DHTNet:
### 1. Clone the DHTNet Repository
Clone the DHTNet repository to your local machine:
```bash
git clone https://github.com/savoirfairelinux/dhtnet.git
cd dhtnet
```
### 2. Update dependencies:
Ensure that you have the latest versions of the required Git submodules, pjproject, and OpenDHT. Run the following command:
```bash
git submodule update --init --recursive
```
This step ensures that your project has the most up-to-date dependencies for the build process.
### 3. Install dependencies:
Create a build directory and use CMake to configure the build:
```bash
cd dependencies && ./build.py && cd ..
mkdir build
cd build
cmake ..
```
Finally, initiate the build process:
```bash
make
```
## Contributing
If you encounter issues or wish to contribute to DHTNet's development, please visit the [GitHub repository](https://github.com/savoirfairelinux/dhtnet) for more details on how to get involved.
\ No newline at end of file
#!/usr/bin/env python3
# build.py --- Convenience script for building and running DHTNET dependencies
# Copyright (C) 2023 Savoir-faire Linux Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
import subprocess
import os
import logging
# Configure the logging system
logging.basicConfig(filename='install.log', level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')
# Define paths and directories
opendht_dir = "opendht"
pjproject_dir = "pjproject"
restinio_dir = "restinio"
install_dir = os.path.abspath("install")
def build_and_install_opendht():
logging.info("Building and installing OpenDHT...")
try:
# Configure OpenDHT with CMake
subprocess.run(["cmake", ".",
"-DCMAKE_INSTALL_PREFIX=" + install_dir,
"-DCMAKE_BUILD_TYPE=Release",
"-DBUILD_TESTING=OFF",
"-DOPENDHT_PYTHON=OFF",
"-DOPENDHT_TOOLS=OFF",
"-DOPENDHT_DOCUMENTATION=OFF",
"-DOPENDHT_HTTP=ON",
"-DOPENDHT_PROXY_CLIENT=ON",
], cwd=opendht_dir, check=True)
# Build and install OpenDHT
subprocess.run(["make", "install"], cwd=opendht_dir, check=True)
logging.info("OpenDHT installed successfully.")
except subprocess.CalledProcessError as e:
logging.error("Error building or installing OpenDHT: %s", e)
def build_and_install_pjproject():
# Build PJSIP libraries
try:
configure_command = [
"./configure",
f"--prefix={install_dir}",
"--disable-sound",
"--enable-video",
"--enable-ext-sound",
"--disable-speex-aec",
"--disable-g711-codec",
"--disable-l16-codec",
"--disable-gsm-codec",
"--disable-g722-codec",
"--disable-g7221-codec",
"--disable-speex-codec",
"--disable-ilbc-codec",
"--disable-opencore-amr",
"--disable-silk",
"--disable-sdl",
"--disable-ffmpeg",
"--disable-v4l2",
"--disable-openh264",
"--disable-resample",
"--disable-libwebrtc",
f"--with-gnutls={install_dir}"
]
subprocess.run(configure_command, cwd=pjproject_dir, check=True)
subprocess.run(["make"], cwd=pjproject_dir, check=True)
subprocess.run(["make", "install"], cwd=pjproject_dir, check=True)
logging.info("PJSIP libraries built successfully.")
except subprocess.CalledProcessError as e:
logging.error("Error building PJSIP libraries: %s", e)
def build_and_install_restinio():
try:
restino_build_dir = restinio_dir + "/dev/"
cmake_command = [
"cmake",
f"-DCMAKE_INSTALL_PREFIX={install_dir}",
"-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",
"."
]
subprocess.run(cmake_command, cwd=restino_build_dir, check=True)
subprocess.run(["make", "-j8"], cwd=restino_build_dir, check=True)
subprocess.run(["make", "install"], cwd=restino_build_dir, check=True)
# subprocess.run(["cd", "../.."], check=True)
# subprocess.run(["rm", "-rf", "restinio"], check=True)
logging.info("restinio built and installed successfully.")
except subprocess.CalledProcessError as e:
logging.error("Error building or installing restinio: %s", e)
def main():
# Create install directory if it doesn't exist
if not os.path.exists(install_dir):
os.makedirs(install_dir)
# Build and install restinio
build_and_install_restinio()
# Build and install OpenDHT
build_and_install_opendht()
# Build and install pjproject
build_and_install_pjproject()
if __name__ == "__main__":
main()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment