%global upstream_name Ghost-Downloader-3 %global appid io.github.xiaoyouchr.GhostDownloader # 自包含二进制,无意义的 debuginfo 包 %global debug_package %{nil} Name: ghost-downloader Version: 4.4.5 Release: 1%{?dist} Summary: A modern, multi-protocol download manager built on PySide6 License: GPL-3.0-only URL: https://github.com/XiaoYouChR/Ghost-Downloader-3 Source0: https://github.com/XiaoYouChR/Ghost-Downloader-3/archive/refs/tags/v%{version}.tar.gz # 安装前缀(沿用上游 .deb 约定,使用字面 /opt 以保证跨环境一致) %define install_dir /opt/%{upstream_name} # Nuitka standalone 产物目录 %define dist_dir dist/%{upstream_name}.dist # ---------- 构建期依赖 ---------- # 二进制由 Nuitka 在构建虚环境内编译,需 C 编译器与 patchelf; # Python 依赖(pyside6/libtorrent/nuitka/...)由 uv 在 %build 内联网安装, # 无需系统 RPM 形式的 Python 包。 BuildRequires: python3 BuildRequires: gcc BuildRequires: gcc-c++ BuildRequires: patchelf BuildRequires: libzstd BuildRequires: desktop-file-utils # 关闭自动依赖/提供探测(二进制自带大量量化库) AutoReqProv: no # ---------- 运行期依赖(系统库,可据实际 ldd 结果增删) ---------- Requires: glibc Requires: libstdc++ Requires: libgcc Requires: zlib Requires: libzstd Requires: libX11 Requires: libxcb Requires: libXext Requires: libXcursor Requires: libXfixes Requires: libXi Requires: libXrandr Requires: libXrender Requires: fontconfig Requires: freetype Requires: expat Requires: glib2 Requires: dbus-libs Requires: libpng Requires: libjpeg-turbo Requires: libglvnd-egl Requires: libglvnd-glx Requires: mesa-dri-drivers Requires: hicolor-icon-theme Requires(post): desktop-file-utils Requires(postun): desktop-file-utils %description Ghost Downloader 3 is a modern, multi-threaded download manager built on PySide6. It supports HTTP(S), FTP(S), magnet/ED2K/BT, M3U8/HLS, DASH and many other protocols, with a fluent-style user interface and a browser extension for one-click grabbing. This package bundles a Nuitka-compiled standalone binary under %{install_dir}; user data is stored under ~/.local/share/GhostDownloader. %prep %setup -q -n %{upstream_name}-%{version} %build # 在隔离虚环境内复现上游构建:安装 uv -> uv sync -> nuitka standalone python3 -m venv .venv .venv/bin/pip install --quiet --upgrade pip uv .venv/bin/uv python install 3.13 # 仅安装运行期依赖(开发组如 pytest/qt 非必需) .venv/bin/uv sync --no-dev # deploy.py 执行 Nuitka 编译,并把 features/ 功能包复制到 dist 目录 .venv/bin/uv run scripts/deploy.py chmod +x %{dist_dir}/%{upstream_name}.bin %install mkdir -p %{buildroot}%{install_dir} # 复制自包含运行时(二进制 + 量化库 + features + resources.rcc ...) cp -a %{dist_dir}/. %{buildroot}%{install_dir}/ # 若 Nuitka 未自带 libzstd,则补入系统版本(与上游 .deb 一致) if [ ! -e "%{buildroot}%{install_dir}/libzstd.so.1" ]; then cp -L /usr/lib64/libzstd.so.1 "%{buildroot}%{install_dir}/" 2>/dev/null || \ cp -L /usr/lib/x86_64-linux-gnu/libzstd.so.1 "%{buildroot}%{install_dir}/" 2>/dev/null || : fi # 启动器:/usr/bin/ghost-downloader -> 自包含二进制 mkdir -p %{buildroot}%{_bindir} ln -s %{install_dir}/%{upstream_name}.bin %{buildroot}%{_bindir}/ghost-downloader # 桌面入口 mkdir -p %{buildroot}%{_datadir}/applications cat > %{buildroot}%{_datadir}/applications/%{appid}.desktop <<'EOF' [Desktop Entry] Type=Application Name=Ghost Downloader Comment=A modern, multi-threaded download manager built on PySide6 Exec=ghost-downloader Icon=ghost-downloader Terminal=false Categories=Network;Utility;FileTransfer; StartupNotify=false MimeType=application/x-bittorrent;x-scheme-handler/magnet;x-scheme-handler/ed2k;x-scheme-handler/ftp;x-scheme-handler/ftps;x-scheme-handler/ghostdownloader; EOF # 图标(256x256,沿用上游 logo.png) mkdir -p %{buildroot}%{_datadir}/icons/hicolor/256x256/apps install -m 0644 app/assets/logo.png \ %{buildroot}%{_datadir}/icons/hicolor/256x256/apps/ghost-downloader.png %post /usr/bin/update-desktop-database %{_datadir}/applications &> /dev/null || : /usr/bin/gtk-update-icon-cache %{_datadir}/icons/hicolor &> /dev/null || : %postun /usr/bin/update-desktop-database %{_datadir}/applications &> /dev/null || : /usr/bin/gtk-update-icon-cache %{_datadir}/icons/hicolor &> /dev/null || : %files %license LICENSE %doc README.md README_zh.md %{install_dir}/ %{_bindir}/ghost-downloader %{_datadir}/applications/%{appid}.desktop %{_datadir}/icons/hicolor/256x256/apps/ghost-downloader.png %changelog * Sun Oct 26 2025 Packager - 4.4.5-1 - Initial RPM package for Ghost Downloader 3 v4.4.5 - Build via Nuitka standalone into /opt/Ghost-Downloader-3