%global debug_package %{nil} %global rust_toolchain rust >= 1.98 # The app, its browser helper, the CLI launcher and the MCP server. %global crates -p mdm-app -p mdm-nmhost -p mdm-cli -p mdm-mcp # The browsers' native-messaging folders the packaged manifests go in # (crates/ipc/src/browsers.rs, LINUX_SYSTEM_HOST_DIRS). %global nmhost_manifest com.misterdownloadmanager.host.json Name: misterdownloadmanager Version: 0.5.2 Release: 1%{?dist} Summary: Download manager that speeds up downloads with several connections License: GPL-3.0-or-later URL: https://github.com/anefzaoui/misterdownloadmanager Source0: %{url}/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz BuildRequires: gcc BuildRequires: gcc-c++ BuildRequires: make BuildRequires: cmake # bindgen, for btls-sys (the engine's browser-like connection) BuildRequires: clang-devel # aws-lc-sys' build scripts BuildRequires: perl BuildRequires: perl-FindBin BuildRequires: perl-IPC-Cmd BuildRequires: perl-Getopt-Long BuildRequires: perl-Data-Dumper BuildRequires: pkgconfig(gtk+-3.0) BuildRequires: pkgconfig(xkbcommon) BuildRequires: pkgconfig(xkbcommon-x11) BuildRequires: pkgconfig(wayland-client) BuildRequires: pkgconfig(gl) BuildRequires: pkgconfig(egl) BuildRequires: %{rust_toolchain} BuildRequires: cargo # The 256x256 icon, from the 1254x1254 source (tools/installer/build-linux.sh) BuildRequires: python3-pillow # The Firefox add-on (.xpi) BuildRequires: zip BuildRequires: desktop-file-utils # The window dlopen()s these, so RPM's automatic dependency generator can't see them # (tools/installer/build-linux.sh: without libxkbcommon-x11 the window panics at start). Requires: gtk3 Requires: mesa-libGL Requires: mesa-libEGL Requires: libxkbcommon Requires: libxkbcommon-x11 Requires: ca-certificates %description Mister Download Manager (MDM) speeds up downloads by opening several connections at once, resumes interrupted ones, catches downloads from the browser through its extension, and handles videos and torrents. It is a desktop application (egui) with a tray icon, and it also ships a headless CLI launcher and an MCP server for AI assistants. %prep %autosetup -n %{name}-%{version} %build # The build machine's paths out of the programs (#25): panic locations and debug info. RUSTFLAGS="--remap-path-prefix=%{_builddir}/%{name}-%{version}=mdm --remap-path-prefix=$HOME/.cargo=cargo" \ cargo build --release --locked %{crates} %{?_smp_flags} %install install -d %{buildroot}%{_bindir} for p in misterdownloadmanager misterdownloadmanager-nmhost misterdownloadmanager-cli misterdownloadmanager-mcp; do install -m 0755 target/release/$p %{buildroot}%{_bindir}/$p done install -d %{buildroot}%{_datadir}/applications \ %{buildroot}%{_datadir}/icons/hicolor/256x256/apps \ %{buildroot}%{_datadir}/%{name} # The icon: upstream ships 1254x1254 and resizes it for the hicolor tree. python3 - "art/Mister Download Manager.png" \ "%{buildroot}%{_datadir}/icons/hicolor/256x256/apps/%{name}.png" <<'EOF' import sys from PIL import Image Image.open(sys.argv[1]).convert("RGBA").resize((256, 256), Image.LANCZOS).save(sys.argv[2]) EOF # The desktop entry is generated by upstream's build script, not shipped in the tree. cat > %{buildroot}%{_datadir}/applications/%{name}.desktop <<'EOF' [Desktop Entry] Type=Application Name=Mister Download Manager Comment=Download manager Exec=misterdownloadmanager %U Icon=misterdownloadmanager Terminal=false Categories=Network;FileTransfer; StartupWMClass=misterdownloadmanager MimeType=x-scheme-handler/magnet;application/x-bittorrent; Keywords=mdm;idm;download manager; EOF # The browser extension, for loading unpacked by hand. Upstream packs it with # tools/extension/pack.ps1 (pwsh); the same steps in plain shell here, so the build # needs no PowerShell. ext=build-extension mkdir -p "$ext/chromium" # The whole tree but the other browsers' manifests: the file list changes between releases # (popup-ui.js and popup-downloads.js are newer than 0.5.2), so no hardcoded list here. cp -r extension/. "$ext/chromium/" rm -f "$ext/chromium/manifest.firefox.json" "$ext/chromium/manifest.safari.json" python3 - "%{version}" extension/manifest.json "$ext/chromium/manifest.json" <<'EOF' import json, sys version, src, dst = sys.argv[1], sys.argv[2], sys.argv[3] with open(src) as f: m = json.load(f) m["version"] = version with open(dst, "w") as f: json.dump(m, f, indent=4) f.write("\n") EOF install -d %{buildroot}%{_datadir}/%{name}/extension-chromium cp -r "$ext/chromium/." %{buildroot}%{_datadir}/%{name}/extension-chromium/ mkdir -p "$ext/firefox" cp -r "$ext/chromium/." "$ext/firefox/" python3 - "%{version}" extension/manifest.firefox.json "$ext/firefox/manifest.json" <<'EOF' import json, sys version, src, dst = sys.argv[1], sys.argv[2], sys.argv[3] with open(src) as f: m = json.load(f) m["version"] = version with open(dst, "w") as f: json.dump(m, f, indent=4) f.write("\n") EOF # Chrome takes only "no"; Firefox looks for "nb" (Bokmål). if [ -d "$ext/firefox/_locales/no" ]; then cp -r "$ext/firefox/_locales/no" "$ext/firefox/_locales/nb" fi # `*` rather than a file list: the list changes between releases. (cd "$ext/firefox" && zip -qr - *) > %{buildroot}%{_datadir}/%{name}/mdm-firefox.xpi # The browsers' system-wide native-messaging manifests, written by the helper itself # (--package-manifests, crates/nmhost/src/main.rs) so they name the packaged program. %{buildroot}%{_bindir}/misterdownloadmanager-nmhost --package-manifests %{buildroot} %check desktop-file-validate %{buildroot}%{_datadir}/applications/%{name}.desktop %files %license LICENSE %doc ATTRIBUTION.md %{_bindir}/misterdownloadmanager %{_bindir}/misterdownloadmanager-nmhost %{_bindir}/misterdownloadmanager-cli %{_bindir}/misterdownloadmanager-mcp %{_datadir}/applications/%{name}.desktop %{_datadir}/icons/hicolor/256x256/apps/%{name}.png %{_datadir}/%{name} # As upstream's .rpm lists them: the folders (%dir, shared with the browsers that may own # them too) and the manifests as plain files, not conffiles, so uninstalling removes them # (tools/installer/build-linux.sh: "not conffiles: `apt remove` takes them too"). %dir /etc/opt/chrome %dir /etc/opt/chrome/native-messaging-hosts %dir /etc/chromium %dir /etc/chromium/native-messaging-hosts %dir /etc/opt/edge %dir /etc/opt/edge/native-messaging-hosts %dir /usr/lib/mozilla %dir /usr/lib/mozilla/native-messaging-hosts %dir /usr/lib64/mozilla %dir /usr/lib64/mozilla/native-messaging-hosts /etc/opt/chrome/native-messaging-hosts/%{nmhost_manifest} /etc/chromium/native-messaging-hosts/%{nmhost_manifest} /etc/opt/edge/native-messaging-hosts/%{nmhost_manifest} /usr/lib/mozilla/native-messaging-hosts/%{nmhost_manifest} /usr/lib64/mozilla/native-messaging-hosts/%{nmhost_manifest} %changelog * Sun Nov 22 2026 boobaa - 0.5.2-1 - Initial package for Fedora COPR