Skip to content

Build a Debian Package

The deb package that a release has, for a release of Debian or Ubuntu, built in a container of it.

The package is built from debian/ with dpkg-buildpackage, the way CI does it. It installs the build dependencies and some static libraries system wide, so build it in a container of the release you want it for (ubuntu:24.04, ubuntu:22.04, debian:trixie or debian:bookworm).

  1. Install Docker
  2. Clone the repository
    git clone --recursive https://github.com/libmonero/monero-python.git
    
  3. Build, replacing ubuntu:24.04 with the release you want

    docker run --rm -it -v <MONERO_PYTHON_DIR_FULL_PATH>:/monero-python -w /monero-python ubuntu:24.04 bash -c '
      apt-get update && apt-get install -y dpkg-dev &&
      apt-get build-dep -y ./ &&
      debian/set-version.sh &&
      dpkg-buildpackage --build=binary --no-sign &&
      mkdir -p debian/artifacts && mv ../python3-monero_* debian/artifacts/'
    

    • MONERO_PYTHON_DIR_FULL_PATH - full path to monero-python directory
    • debian/set-version.sh adds an entry for the version of pyproject.toml to debian/changelog, there is no need to commit it
    • add --jobs=4 to dpkg-buildpackage to build faster, each compiler needs 1 to 2 GB of memory
  4. The package is placed in monero-python/debian/artifacts