Skip to content

Building from Source

If you wish to modify the code yourself or build Ghost Downloader for an unsupported platform, you can follow these steps to build from the source code.

Environment Setup

  1. Install Python: Ensure you have Python installed (version 3.10 or higher recommended). You can download it from the official Python website.
  2. Install Git: Used to clone the project repository. You can download it from the official Git website.
  3. Install C/C++ Compiler: Nuitka requires a C/C++ compiler to compile the Python code.
    • Windows:
    • macOS: Install Xcode Command Line Tools (xcode-select --install).
    • Linux: Install build-essential (Debian/Ubuntu), base-devel (Arch Linux), or similar package groups, ensuring GCC/Clang is included.

Get the Source Code

bash
git clone https://github.com/XiaoYouChR/Ghost-Downloader-3.git
cd Ghost-Downloader-3

Install Dependencies

The project uses a requirements.txt file to manage dependencies.

bash
pip install -r requirements.txt

This will install necessary libraries such as PySide6, PyQt-Fluent-Widgets, Nuitka, httpx, loguru, etc.

Run (Without Compiling)

You can run the main program directly using the Python interpreter for testing or development:

bash
python Ghost-Downloader-3.py

Compile into an Executable

The project provides a deploy.py script to simplify the Nuitka compilation process.

bash
python deploy.py

This script automatically detects the current operating system and executes the corresponding Nuitka command to package the application into a standalone executable. The compiled files will be output to the dist/ directory.

Compilation Options Explanation:

  • --standalone: Packages all dependencies into the executable.
  • --plugin-enable=pyside6: Enables Nuitka's PySide6 plugin.
  • --windows-console-mode=disable: (Windows) Creates a GUI application without a console window.
  • --macos-create-app-bundle: (macOS) Creates a standard .app bundle.
  • --mingw64 / --msvc=latest: (Windows) Selects the C++ compiler to use.
  • Other options are used to set metadata such as icon, version information, company name, etc.

You can modify the Nuitka parameters in the deploy.py file as needed.