File navidrome.spec of Package navidrome

Name:           navidrome
Version:        0.59.0
Release:        0%{?dist}
Summary:        Modern music server and streamer compatible with Subsonic
License:        GPL-3.0
URL:            https://www.navidrome.org/
Source0:        %{name}-%{version}.tar.xz
Source1:        node_modules.tar.xz
Source2:        vendor.tar.xz
Patch0:         navidrome-Makefile.patch
# Build dependencies
BuildRequires:  golang(API) >= 1.25
BuildRequires:  npm
BuildRequires:  nodejs
BuildRequires:  make
BuildRequires:  nodejs-vite
BuildRequires:  libtag-devel
BuildRequires:  gcc-c++

# Systemd
BuildRequires:  systemd-rpm-macros
%{?systemd_requires}

ExclusiveArch:  x86_64 aarch64

%description
Navidrome is a self-hosted music server and streamer compatible with Subsonic/Airsonic clients.

%prep
%autosetup -n %{name}-%{version}
# remove vendored modules or dev-specific things if any
tar xf %{SOURCE2}
cd ui
tar xf %{SOURCE1}

%build
# Set up environment variables
# export GO111MODULE=on
# export CGO_ENABLED=0
export GIT_SHA="echo source_archive"
export GIT_TAG="echo v%{version}-SNAPSHOT"

# Build frontend
pushd ui
vite build
popd

make build

%install
mkdir -p %{buildroot}/%{_bindir}
install -m 0755 navidrome %{buildroot}/%{_bindir}/navidrome

# Install systemd service (if provided in source)
mkdir -p %{buildroot}%{_unitdir}
install -m 0644 contrib/navidrome.service %{buildroot}%{_unitdir}/navidrome.service

%post
%systemd_post navidrome.service

%preun
%systemd_preun navidrome.service

%postun
%systemd_postun_with_restart navidrome.service

%files
%license LICENSE
%doc README.md
%{_bindir}/navidrome
%{_unitdir}/navidrome.service

%changelog
* Fri Jun 13 2025 Your Name <mail@pratyushdesai.com> - 0.50.0-1
- Initial openSUSE RPM build based on upstream Makefile
openSUSE Build Service is sponsored by