Skip to content

Commit

Permalink
Standardise and cleanup Fedora build
Browse files Browse the repository at this point in the history
* Remove additional dotnet-preview repo from Makefile
  * Repo doesn't seem maintained, and maintainers actively discourage
    the usage in production in its description
  * Considering this, we should build with stable .NET releases, which
    Fedora and RHEL 8+ repos already provide
* Use Fedora-version-specific runtime-identifier for `dotnet publish`
  * This has no actual effect right now judging by the [RID
    catalog](https://github.com/dotnet/docs/blob/3efd59151a7421172658a6fbcf88a0bd5fa7a92d/docs/core/rid-catalog.md),
    so this is just future proofing.
* Remove AutoReqProv
  * There's rarely a reason to use this feature, this is not one of them
  * In the [proposal of this
    feature](https://fedoraproject.org/wiki/AutoReqProv_(draft)#Usage)
    it is stated that this is not to be used on packages with binaries
    in /usr/bin and others, which is the case in this package.
  * also didn't seem to work since we were still having dependency
    issues with implicit dependencies (see jellyfin#7471 )
* Removed DOTNET_SKIP_FIRST_TIME_EXPERIENCE as it is unused in .NET SDK
  * see dotnet/sdk#9945
  * it's already merged for removal in future versions
* Move building process `dotnet publish` to %build section
  * Also removed `--output` from this due to an outstanding bug on SDK's
    side. This also separates building and installing as intended
* define LICENSE as %license, which automatically puts it in a
  standardised directory
  • Loading branch information
mihawk90 committed Jun 15, 2022
1 parent c243f58 commit 0504ed9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 16 deletions.
5 changes: 0 additions & 5 deletions fedora/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,12 @@ SRPM := jellyfin-$(subst -,~,$(VERSION))-$(RELEASE)$(shell rpm --eval %dist).
TARBALL :=$(NAME)-$(subst -,~,$(VERSION)).tar.gz

epel-7-x86_64_repos := https://packages.microsoft.com/rhel/7/prod/
epel-8-x86_64_repos := https://download.copr.fedorainfracloud.org/results/@dotnet-sig/dotnet-preview/$(TARGET)/

fed_ver := $(shell rpm -E %fedora)
# fallback when not running on Fedora
fed_ver ?= 36
TARGET ?= fedora-$(fed_ver)-x86_64

ifeq ($(findstring fedora,$(TARGET)),fedora)
$(TARGET)_repos := https://download.copr.fedorainfracloud.org/results/@dotnet-sig/dotnet-preview/$(TARGET)/
endif

outdir ?= $(PWD)/$(DIR)/

srpm: $(DIR)/$(SRPM)
Expand Down
22 changes: 11 additions & 11 deletions fedora/jellyfin.spec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
%global debug_package %{nil}
# Set the dotnet runtime
%if 0%{?fedora}
%global dotnet_runtime fedora-x64
%global dotnet_runtime fedora.%{fedora}-x64
%else
%global dotnet_runtime centos-x64
%endif
Expand All @@ -25,13 +25,10 @@ Source17: jellyfin-server-lowports.conf
%{?systemd_requires}
BuildRequires: systemd
BuildRequires: libcurl-devel, fontconfig-devel, freetype-devel, openssl-devel, glibc-devel, libicu-devel
# Requirements not packaged in main repos
# COPR @dotnet-sig/dotnet or
# Requirements not packaged in RHEL 7 main repos, added via Makefile
# https://packages.microsoft.com/rhel/7/prod/
BuildRequires: dotnet-runtime-6.0, dotnet-sdk-6.0
Requires: %{name}-server = %{version}-%{release}, %{name}-web = %{version}-%{release}
# Disable Automatic Dependency Processing
AutoReqProv: no

%description
Jellyfin is a free software media system that puts you in control of managing and streaming your media.
Expand Down Expand Up @@ -60,14 +57,17 @@ the Jellyfin server to bind to ports 80 and/or 443 for example.
%autosetup -n jellyfin-server-%{version} -b 0

%build

%install
export DOTNET_CLI_TELEMETRY_OPTOUT=1
export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
export PATH=$PATH:/usr/local/bin
dotnet publish --configuration Release --output='%{buildroot}%{_libdir}/jellyfin' --self-contained --runtime %{dotnet_runtime} \
# cannot use --output due to https://github.com/dotnet/sdk/issues/22220
dotnet publish --configuration Release --self-contained --runtime %{dotnet_runtime} \
"-p:DebugSymbols=false;DebugType=none" Jellyfin.Server
%{__install} -D -m 0644 LICENSE %{buildroot}%{_datadir}/licenses/jellyfin/LICENSE


%install
%{__mkdir} -p %{buildroot}%{_libdir}/%{name} %{buildroot}%{_bindir}
%{__cp} -r Jellyfin.Server/bin/Release/net6.0/%{dotnet_runtime}/publish/* %{buildroot}%{_libdir}/%{name}

%{__install} -D -m 0644 %{SOURCE15} %{buildroot}%{_sysconfdir}/systemd/system/jellyfin.service.d/override.conf
%{__install} -D -m 0644 %{SOURCE17} %{buildroot}%{_unitdir}/jellyfin.service.d/jellyfin-server-lowports.conf
%{__install} -D -m 0644 Jellyfin.Server/Resources/Configuration/logging.json %{buildroot}%{_sysconfdir}/jellyfin/logging.json
Expand Down Expand Up @@ -106,7 +106,7 @@ EOF
%attr(750,jellyfin,jellyfin) %dir %{_sharedstatedir}/jellyfin
%attr(-,jellyfin,jellyfin) %dir %{_var}/log/jellyfin
%attr(750,jellyfin,jellyfin) %dir %{_var}/cache/jellyfin
%{_datadir}/licenses/jellyfin/LICENSE
%license LICENSE

%files server-lowports
%{_unitdir}/jellyfin.service.d/jellyfin-server-lowports.conf
Expand Down

0 comments on commit 0504ed9

Please sign in to comment.