%global debug_package %{nil} %global _build_id_links none %define dotnet_version 10.0 %define dotnet_framework net%{dotnet_version} %define dotnet_runtime %( \ if [ "%{_arch}" = "x86_64" ]; then \ echo -n "linux-x64"; \ elif [ "%{_arch}" = "aarch64" ]; then \ echo -n "linux-arm64"; \ else \ echo "Unsupported architecture: %{_arch}"; \ exit 1; \ fi \ ) %global git_commit_sha fdda9abcbbce7de7e1c213dd7e524201fa53f319 Name: sonarr Version: 4.0.16.2947 Release: %autorelease Summary: Smart PVR for newsgroup and bittorrent users License: GPL-3.0-only URL: https://github.com/Sonarr/Sonarr Source0: %{url}/archive/%{git_commit_sha}.tar.gz Source1: %{name}.sysusers Source2: %{name}.service Source3: %{name}-service.preset Source4: %{name}-tmpfiles.conf ExclusiveArch: x86_64 aarch64 BuildRequires: dotnet-sdk-%{dotnet_version} BuildRequires: findutils BuildRequires: jq BuildRequires: sed BuildRequires: systemd-rpm-macros BuildRequires: yarnpkg %{?systemd_requires} %{?sysusers_requires_compat} Requires: dotnet-runtime-%{dotnet_version} Requires: aspnetcore-runtime-%{dotnet_version} Requires: sqlite %description %{summary}. %prep %autosetup -n Sonarr-%{git_commit_sha} %build export DOTNET_CLI_TELEMETRY_OPTOUT=1 export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1 export SENTRY_DSN='' yarn install yarn build --env production pushd / >/dev/null DOTNET_VERSION="$(dotnet --version)" popd >/dev/null jq --arg v "$DOTNET_VERSION" '.sdk.version = $v' global.json > global.json.new && mv --force global.json.new global.json sed --in-place --regex --expression='s|.+|%{version}|g' src/Directory.Build.props sed --in-place --regex --expression='s|.+|v5-develop|g' src/Directory.Build.props dotnet msbuild \ -restore src/Sonarr.sln \ -p:SelfContained=false \ -p:Configuration=Release \ -p:Platform=Posix \ -p:RuntimeIdentifiers=%{dotnet_runtime} \ -t:PublishAllRids %install install --directory "%{buildroot}%{_libexecdir}/%{name}" cp --recursive _output/%{dotnet_framework}/%{dotnet_runtime}/publish/* "%{buildroot}%{_libexecdir}/%{name}/" cp --recursive _output/UI "%{buildroot}%{_libexecdir}/%{name}/" pushd "%{buildroot}%{_libexecdir}/%{name}" rm ServiceUninstall.* rm ServiceInstall.* rm Sonarr.Windows.* find . -name "ffprobe" -exec chmod a+x {} \; find . -name "Sonarr" -exec chmod a+x {} \; popd install -D --mode=0644 "%{SOURCE2}" %{buildroot}%{_unitdir}/%{name}.service install -D --mode=0644 "%{SOURCE3}" %{buildroot}%{_prefix}/lib/systemd/system-preset/90-%{name}.preset install -D --mode=0644 "%{SOURCE4}" %{buildroot}%{_exec_prefix}/lib/tmpfiles.d/%{name}.conf %files %doc README.md %license LICENSE.md %{_libexecdir}/%{name} %{_unitdir}/%{name}.service %{_prefix}/lib/systemd/system-preset/90-%{name}.preset %{_exec_prefix}/lib/tmpfiles.d/%{name}.conf %pre %sysusers_create_compat %{SOURCE1} %post %systemd_post %{name}.service %preun %systemd_preun %{name}.service %postun %systemd_postun_with_restart %{name}.service %changelog %autochangelog