Merge pull request #9709 from ThomasWaldmann/build-nuitka-master

scripts/build-nuitka.sh: generate single-file binary using nuitka, fixes #3227
This commit is contained in:
TW 2026-06-02 22:44:41 +02:00 committed by GitHub
commit a135c8f302
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

36
scripts/build-nuitka.sh Executable file
View file

@ -0,0 +1,36 @@
#!/bin/bash
# Generate a single-file binary of borgbackup using Nuitka.
set -euo pipefail
OUTPUT_DIR="build"
OUTPUT_FILENAME="borg-nuitka.exe" # .exe does NOT mean windows here
SRC_DIR="src/borg"
echo "============================================"
echo "Found Nuitka $(python -m nuitka --version | head -n 1)."
echo "Building single-file binary of borgbackup..."
echo "============================================"
# Run Nuitka compilation
# We use --assume-yes-for-downloads to avoid interactive prompts in automated runs.
# We set PYTHONPATH=src to ensure the local version of borg is used.
# We include cffi and _cffi_backend to avoid runtime ModuleNotFoundError in argon2-cffi.
PYTHONPATH=src python -m nuitka \
--standalone \
--onefile \
--assume-yes-for-downloads \
--include-package=borg \
--include-package=borghash \
--include-package=borgstore \
--include-package=cffi \
--include-module=_cffi_backend \
--output-dir="$OUTPUT_DIR" \
--output-filename="$OUTPUT_FILENAME" \
"$SRC_DIR"
echo "============================================="
echo "Build completed successfully!"
echo "Single-file binary generated at:"
echo " $OUTPUT_DIR/$OUTPUT_FILENAME"
echo "============================================="