# RPM spec for Ghost Downloader 3 # # 构建方式(与上游 Linux CI 一致): # 上游使用 Nuitka 将 Python 源码编译为「standalone」自包含二进制, # 再连同功能包(features)一起装入 /opt/Ghost-Downloader-3。 # 本 spec 在 %build 阶段用 uv 复现该流程,因此构建时需要联网 # (下载 Python 3.13、依赖 wheel 与 Nuitka 编译产物)。 # 推荐使用 mock 构建并放行网络,例如: # mock -r fedora-42-x86_64 --enable-network --spec ghost-downloader.spec \ # --sources Ghost-Downloader-3-4.4.5.tar.gz --buildsrpm # mock -r fedora-42-x86_64 --enable-network --rebuild ghost-downloader-*.src.rpm # # 说明: # * 二进制由 Nuitka 打包,已自带绝大多数量化库(Qt6、libtorrent 等), # 故关闭自动依赖探测(AutoReqProv:no),仅在 Requires 中声明运行期 # 真正依赖的系统库。如运行报缺库,可用 `ldd`/find-requires 进一步精简或补充。 # * 源码包解压目录为 Ghost-Downloader-3-(非 %{name}-), # 故 %setup 使用 -n 指定。 %global upstream_name Ghost-Downloader-3 %global appid io.github.xiaoyouchr.GhostDownloader # 自包含二进制,无意义的 debuginfo 包 %global debug_package %{nil} Name: ghost-downloader Version: 4.5.0 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: curl 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 # 任何一步失败立即中止,避免错误被静默吞掉(rpmbuild 默认无 set -e) set -e # 用官方独立安装器获取 uv 静态二进制,安装到 .venv 之外的 .uv/ 目录。 # 原因:若把 uv 装进项目 .venv,随后 `uv sync` 为切换 Python 3.13 会重建 # .venv,把刚装进去的 uv 可执行文件一并删除,导致后面 `uv` 找不到。 export UV_INSTALL_DIR="$PWD/.uv" curl -LsSf -o uv-install.sh https://astral.sh/uv/install.sh sh uv-install.sh export PATH="$UV_INSTALL_DIR:$HOME/.local/bin:$PATH" uv --version # 安装 Python 3.13 与运行期依赖(dev 组如 pytest/qt 非必需) uv python install 3.13 uv sync --no-dev # deploy.py 执行 Nuitka 编译,并把 features/ 功能包复制到 dist 目录 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