# Rendered by build-srpm.sh; both variants use the same locked source archive.
%global applet 1
%global appid io.github.cosmic-applet-mare
# Release binaries are stripped by Cargo, as in the GitHub release packages.
%global debug_package %{nil}
%if %{applet}
Name: cosmic-applet-mare
%else
Name: mare-player
%endif
Version: 0.3.6
Release: 1%{?dist}
Summary: TIDAL music streaming for the COSMIC desktop
License: GPL-3.0-only
URL: https://github.com/glima/mare-player
# Includes registry and Git dependencies from Cargo.lock, plus Cargo's source
# replacement configuration. No network is needed during the RPM build.
Source0: mare-player-%{version}-vendored.tar.xz
ExclusiveArch: x86_64 aarch64
BuildRequires: cargo
BuildRequires: rust
BuildRequires: gcc
BuildRequires: gcc-c++
BuildRequires: cmake
BuildRequires: clang-devel
BuildRequires: pkgconf-pkg-config
BuildRequires: desktop-file-utils
BuildRequires: pkgconfig(dbus-1)
BuildRequires: pkgconfig(libsecret-1)
BuildRequires: pkgconfig(xkbcommon)
BuildRequires: pkgconfig(wayland-client)
BuildRequires: pkgconfig(libinput)
BuildRequires: pkgconfig(libudev)
BuildRequires: pkgconfig(libseat)
BuildRequires: pkgconfig(expat)
BuildRequires: pkgconfig(gstreamer-1.0)
BuildRequires: pkgconfig(gstreamer-app-1.0)
BuildRequires: pkgconfig(gstreamer-video-1.0)
# ELF dependencies are generated by RPM. GStreamer loads plugins dynamically,
# so these cannot be discovered by inspecting the binaries.
Requires: gstreamer1-plugins-base%{?_isa}
Requires: gstreamer1-plugins-good%{?_isa}
Requires: gstreamer1-plugins-bad-free%{?_isa}
Requires: hicolor-icon-theme
# Copy Link uses wl-copy on Wayland (with X11 fallbacks when available).
Requires: wl-clipboard
# Full AAC/H.264 support additionally needs codecs from RPM Fusion. Do not
# require a non-Fedora repository just to install this package.
%if %{applet}
Requires: cosmic-panel
Conflicts: mare-player
%else
Conflicts: cosmic-applet-mare
%endif
%description
Maré Player streams TIDAL music and videos with library browsing, lyrics,
Hi-Res audio, and MPRIS media controls. A TIDAL account is required.
%if %{applet}
This package installs the COSMIC panel applet and its video-window companion.
%else
This package installs the standalone window application.
%endif
%prep
%autosetup -n mare-player-%{version}
# Older tags omitted the main category required by the Audio subcategory.
desktop-file-edit --add-category=AudioVideo resources/app.desktop
%if !%{applet}
# Preserve the shared application ID (including the tidal:// URI handler),
# but make the standalone launcher visible and point it at the correct binary.
sed -i -e 's|^Exec=cosmic-applet-mare|Exec=mare-player|' \
-e 's|^Comment=.*|Comment=Maré Player — TIDAL streaming for COSMIC|' \
-e 's|^NoDisplay=true|NoDisplay=false|' \
-e '/^X-CosmicApplet=/d' -e '/^X-CosmicHoverPopup=/d' \
resources/app.desktop
sed -i -e 's|.*|TIDAL streaming for the COSMIC desktop|' \
-e 's|Stream TIDAL from your COSMIC panel\.|Stream TIDAL with|' \
-e 's|all without leaving|all from a standalone|' \
-e 's|your desktop\.|COSMIC application.|' \
-e 's|cosmic-applet-mare|mare-player|' \
-e '/applet<\/keyword>/d' \
resources/app.metainfo.xml
%endif
%build
# Use only the source replacements shipped in Source0, not a builder's cache.
export CARGO_HOME="$PWD/.cargo-home"
export CARGO_TARGET_DIR="$PWD/target"
export CARGO_BUILD_JOBS=%{_smp_build_ncpus}
export CARGO_INCREMENTAL=0
%if %{applet}
cargo build --release --frozen -p cosmic-applet-mare
cargo build --release --frozen -p mare-video-window
%else
cargo build --release --frozen -p cosmic-applet-mare --no-default-features --features wgpu
%endif
%install
install -Dpm0755 target/release/cosmic-applet-mare %{buildroot}%{_bindir}/%{name}
%if %{applet}
install -Dpm0755 target/release/mare-video-window %{buildroot}%{_bindir}/mare-video-window
%endif
install -Dpm0644 resources/app.desktop %{buildroot}%{_datadir}/applications/%{appid}.desktop
install -Dpm0644 resources/app.metainfo.xml %{buildroot}%{_datadir}/metainfo/%{appid}.metainfo.xml
install -Dpm0644 resources/icon.svg %{buildroot}%{_datadir}/icons/hicolor/scalable/apps/%{appid}.svg
install -Dpm0644 resources/icon.svg %{buildroot}%{_datadir}/icons/hicolor/scalable/apps/%{appid}-symbolic.svg
install -Dpm0644 resources/icon.svg %{buildroot}%{_datadir}/icons/hicolor/symbolic/apps/%{appid}-symbolic.svg
# Desktop/icon caches are handled by Fedora's file triggers. Never change
# per-user xdg-mime defaults from a package build or root installation script.
# Cargo links Rust dependencies into the executable. Ship their distributed
# license/NOTICE texts too, preserving crate names and nested license paths.
mkdir -p bundled-licenses
find vendor -type f \( -iname '*licen[cs]e*' -o -iname 'copying*' \
-o -iname 'notice*' -o -iname 'copyright*' -o -ipath '*/licenses/*' \
-o -name Cargo.toml \) -exec cp --parents -t bundled-licenses '{}' +
%check
desktop-file-validate %{buildroot}%{_datadir}/applications/%{appid}.desktop
%files
%license LICENSE bundled-licenses
%doc README.md
%{_bindir}/%{name}
%if %{applet}
%{_bindir}/mare-video-window
%endif
%{_datadir}/applications/%{appid}.desktop
%{_datadir}/metainfo/%{appid}.metainfo.xml
%{_datadir}/icons/hicolor/scalable/apps/%{appid}.svg
%{_datadir}/icons/hicolor/scalable/apps/%{appid}-symbolic.svg
%{_datadir}/icons/hicolor/symbolic/apps/%{appid}-symbolic.svg
%changelog
* Wed Sep 30 2026 Maré Player maintainers - 0.3.6-1
- Build both variants from locked, vendored sources for COPR