Cleanup and build the last packages for Fedora 37

This commit is contained in:
2022-11-25 11:36:16 +01:00
parent 9754e4d04a
commit cee9ca5ba4
44 changed files with 1284 additions and 1878 deletions

View File

@@ -0,0 +1,463 @@
# Use old cmake macro
%global __cmake_in_source_build 1
%global PRERELEASE RC1
%global DIRVERSION %{version}
#global GITCOMMIT db40b2a
# use the line below for pre-releases
#global DIRVERSION %{version}-%{GITCOMMIT}
%global DIRVERSION %{version}%{PRERELEASE}
%global _hardened_build 1
%ifarch %{arm}
# Disable LTO for arm, see http://koji.rpmfusion.org/koji/taskinfo?taskID=424139
%global _lto_cflags %{nil}
%global optflags %(echo %{optflags} | sed 's/-g /-g1 /')
%endif
# We support hte following options:
# --with,
# * dvdcss - Include DVD decryption support
#
# Default: Do not ship DVD decryption for legal reasons
%bcond_with dvdcss
# Optional deps (not in EPEL)
%if 0%{?fedora}
# (libbluray in EPEL 6 is too old.)
%global _with_libbluray 1
%if 0%{?fedora} < 31
%global _with_cwiid 1
%else
%global _with_cwiid 0
%endif
%global _with_libssh 1
%global _with_libcec 1
%global _with_external_ffmpeg 1
%global _with_wayland 1
%endif
%if 0%{?_with_wayland}
%global kodi_backends x11 wayland gbm
%else
%global kodi_backends x11 gbm
%endif
Name: kodi
Version: 19.0
Release: 20210123%{?dist}
Summary: Media center
License: GPLv2+ and GPLv3+ and LGPLv2+ and BSD and MIT
# Main binary and all supporting files are GPLv2+/GPLv3+
# Some supporting libraries use the LGPL / BSD / MIT license
Group: Applications/Multimedia
URL: http://www.kodi.tv/
Source0: %{name}-%{DIRVERSION}-patched.tar.xz
# kodi contains code that we cannot ship, as well as redundant private
# copies of upstream libraries that we already distribute. Therefore
# we use this script to remove the code before shipping it.
# Invoke this script while in the directory where the tarball is located:
# ./kodi-generate-tarball-xz.sh
Source1: kodi-generate-tarball-xz.sh
# kodi uses modified libdvd{css,nav,read} source and downloads at build time
# wget -O kodi-libdvdnav-6.0.0-Leia-Alpha-3.tar.gz https://github.com/xbmc/libdvdnav/archive/6.0.0-Leia-Alpha-3.tar.gz
Source2: kodi-libdvdnav-6.0.0-Leia-Alpha-3.tar.gz
# wget -O kodi-libdvdread-6.0.0-Leia-Alpha-3.tar.gz https://github.com/xbmc/libdvdread/archive/6.0.0-Leia-Alpha-3.tar.gz
Source3: kodi-libdvdread-6.0.0-Leia-Alpha-3.tar.gz
%if %{with dvdcss}
# wget -O kodi-libdvdcss-1.4.2-Leia-Beta-5.tar.gz https://github.com/xbmc/libdvdcss/archive/1.4.2-Leia-Beta-5.tar.gz
Source4: kodi-libdvdcss-1.4.2-Leia-Beta-5.tar.gz
%endif
%if ! 0%{?_with_external_ffmpeg}
# wget -O ffmpeg-4.3.1-Matrix-Beta1.tar.gz https://github.com/xbmc/FFmpeg/archive/4.3.1-Matrix-Beta1.tar.gz
Source5: ffmpeg-4.3.1-Matrix-Beta1.tar.gz
%endif
# Set program version parameters
Patch1: kodi-19-versioning.patch
# Prevent trousers from being linked, which breaks Samba
Patch2: kodi-18-trousers.patch
# Fix an annobin issue
Patch3: kodi-18-annobin-workaround.patch
# Workaround for brp-mangle-shebangs behavior (RHBZ#1787088)
Patch4: kodi-18-brp-mangle-shebangs.patch
%ifarch x86_64 i686
%global _with_crystalhd 1
%endif
# Upstream does not support ppc64
ExcludeArch: %{power64}
BuildRequires: a52dec-devel
BuildRequires: afpfs-ng-devel
BuildRequires: alsa-lib-devel
BuildRequires: avahi-devel
BuildRequires: bluez-libs-devel
BuildRequires: boost-devel
BuildRequires: bzip2-devel
BuildRequires: cmake3
BuildRequires: crossguid-devel
%if 0%{?_with_cwiid}
BuildRequires: cwiid-devel
%endif
BuildRequires: dbus-devel
BuildRequires: desktop-file-utils
BuildRequires: e2fsprogs-devel
BuildRequires: enca-devel
BuildRequires: expat-devel
BuildRequires: faad2-devel
BuildRequires: firewalld-filesystem
%if 0%{?_with_external_ffmpeg}
BuildRequires: ffmpeg-devel
%else
BuildRequires: trousers-devel
%endif
BuildRequires: flac-devel
BuildRequires: flatbuffers-devel
BuildRequires: flex
BuildRequires: fmt-devel
BuildRequires: fontconfig-devel
BuildRequires: fontpackages-devel
BuildRequires: freetype-devel
BuildRequires: fribidi-devel
BuildRequires: fstrcmp-devel
%if 0%{?el6}
BuildRequires: gettext-devel
%else
BuildRequires: gettext-autopoint
%endif
BuildRequires: gcc
BuildRequires: gcc-c++
BuildRequires: giflib-devel
BuildRequires: glew-devel
BuildRequires: glib2-devel
BuildRequires: gperf
BuildRequires: gtest-devel
BuildRequires: jasper-devel
BuildRequires: java-devel
BuildRequires: lame-devel
BuildRequires: lcms2-devel
BuildRequires: libXinerama-devel
BuildRequires: libXmu-devel
BuildRequires: libXrandr-devel
BuildRequires: libXtst-devel
BuildRequires: libass-devel >= 0.9.7
%if 0%{?_with_libbluray}
BuildRequires: libbluray-devel
%endif
BuildRequires: libcap-devel
BuildRequires: libcdio-devel
%if 0%{?_with_libcec}
%if 0%{?fedora} > 24
BuildRequires: libcec-devel >= 4.0.0
%else
BuildRequires: libcec-devel < 4.0.0
%endif
%endif
%if 0%{?_with_crystalhd}
BuildRequires: libcrystalhd-devel
%endif
BuildRequires: libcurl-devel
BuildRequires: libdav1d-devel
BuildRequires: libdca-devel
BuildRequires: libdrm-devel
BuildRequires: libidn2-devel
BuildRequires: libinput-devel
%if 0%{?el6}
BuildRequires: libjpeg-devel
%else
BuildRequires: libjpeg-turbo-devel
%endif
BuildRequires: libmad-devel
BuildRequires: libmicrohttpd-devel
BuildRequires: libmms-devel
BuildRequires: libmodplug-devel
BuildRequires: libmpcdec-devel
BuildRequires: libmpeg2-devel
BuildRequires: libnfs-devel
BuildRequires: libogg-devel
# for AirPlay support
BuildRequires: shairplay-devel
BuildRequires: libplist-devel
BuildRequires: libpng-devel
BuildRequires: librtmp-devel
BuildRequires: libsamplerate-devel
BuildRequires: libsmbclient-devel
%if 0%{?_with_libssh}
BuildRequires: libssh-devel
%endif
BuildRequires: libtiff-devel
BuildRequires: libtool
BuildRequires: libunistring-devel
BuildRequires: libuuid-devel
BuildRequires: libva-devel
BuildRequires: libvdpau-devel
BuildRequires: libvorbis-devel
%if 0%{?_with_wayland}
BuildRequires: libxkbcommon-devel
%endif
BuildRequires: libxml2-devel
BuildRequires: libxslt-devel
BuildRequires: lirc-devel
BuildRequires: lzo-devel
BuildRequires: mariadb-devel
BuildRequires: mesa-libEGL-devel
BuildRequires: mesa-libGLES-devel
BuildRequires: mesa-libgbm-devel
BuildRequires: nasm
BuildRequires: ninja-build
BuildRequires: pcre-devel
BuildRequires: pixman-devel
BuildRequires: pulseaudio-libs-devel
BuildRequires: python3-devel
BuildRequires: python3-pillow
BuildRequires: /usr/bin/pathfix.py
BuildRequires: rapidjson-devel
BuildRequires: spdlog-devel
BuildRequires: sqlite-devel
BuildRequires: swig
BuildRequires: systemd-devel
BuildRequires: taglib-devel >= 1.10
BuildRequires: tinyxml-devel
BuildRequires: tre-devel
BuildRequires: wavpack-devel
%if 0%{?_with_wayland}
BuildRequires: wayland-protocols-devel
BuildRequires: waylandpp-devel
%endif
BuildRequires: yajl-devel
BuildRequires: zlib-devel
Requires: (%{name}-firewalld = %{version}-%{release} if firewalld)
Requires: dejavu-sans-fonts
# need explicit requires for these packages
# as they are dynamically loaded via XBMC's arcane
# pseudo-DLL loading scheme (sigh)
%if 0%{?_with_libbluray}
Requires: libbluray%{?_isa}
%endif
%if 0%{?_with_libcec}
%if 0%{?fedora} > 24
Requires: libcec%{?_isa} >= 4.0.0
%else
Requires: libcec%{?_isa} < 4.0.0
%endif
%endif
%if 0%{?_with_crystalhd}
Requires: libcrystalhd%{?_isa}
%endif
Requires: libmad%{?_isa}
Requires: librtmp%{?_isa}
Requires: shairplay-libs%{?_isa}
# needed when doing a minimal install, see
# https://bugzilla.rpmfusion.org/show_bug.cgi?id=1844
Requires: glx-utils
Requires: xorg-x11-utils
# This is just symlinked to, but needed both at build-time
# and for installation
Requires: python3-pillow%{?_isa}
# https://github.com/xbmc/xbmc/pull/18534
Provides: kodi-common = %{version}-%{release}
Obsoletes: kodi-common < %{version}-%{release}
Provides: kodi-gbm = %{version}-%{release}
Obsoletes: kodi-gbm < %{version}-%{release}
Provides: kodi-wayland = %{version}-%{release}
Obsoletes: kodi-wayland < %{version}-%{release}
Provides: kodi-x11 = %{version}-%{release}
Obsoletes: kodi-x11 < %{version}-%{release}
%description
Kodi is a free cross-platform media-player jukebox and entertainment hub.
Kodi can play a spectrum of of multimedia formats, and featuring playlist,
audio visualizations, slideshow, and weather forecast functions, together
third-party plugins.
%package devel
Summary: Development files needed to compile C programs against kodi
Requires: %{name}%{?_isa} = %{version}-%{release}
Obsoletes: xbmc-devel < 14.0
Provides: xbmc-devel = %{version}
%description devel
Kodi is a free cross-platform media-player jukebox and entertainment hub.
If you want to develop programs which use Kodi's libraries, you need to
install this package.
%package eventclients
Summary: Media center event client remotes
Obsoletes: xbmc-eventclients < 14.0
Provides: xbmc-eventclients = %{version}
%description eventclients
This package contains support for using Kodi with the PS3 Remote, the Wii
Remote, a J2ME based remote and the command line xbmc-send utility.
%package eventclients-devel
Summary: Media center event client remotes development files
Requires: %{name}-eventclients%{?_isa} = %{version}-%{release}
Requires: %{name}-devel%{?_isa} = %{version}-%{release}
Obsoletes: xbmc-eventclients-devel < 14.0
Provides: xbmc-eventclients-devel = %{version}
%description eventclients-devel
This package contains the development header files for the eventclients
library.
%package firewalld
Summary: FirewallD metadata files for Kodi
Requires: firewalld-filesystem
Requires(post): firewalld-filesystem
%description firewalld
This package contains FirewallD files for Kodi.
%prep
%setup -q -n %{name}-%{DIRVERSION}
%patch1 -p1 -b.versioning
%patch2 -p1 -b.trousers
%patch3 -p1 -b.innobinfix
%patch4 -p1 -b.brp-mangle-shebangs
# Fix up Python shebangs
pathfix.py -pni "%{__python3} %{py3_shbang_opts}" \
tools/EventClients/lib/python/zeroconf.py \
tools/EventClients/Clients/PS3BDRemote/ps3_remote.py \
tools/EventClients/lib/python/ps3/sixaxis.py \
tools/EventClients/lib/python/ps3/sixpair.py \
tools/EventClients/lib/python/ps3/sixwatch.py \
tools/EventClients/Clients/KodiSend/kodi-send.py \
tools/EventClients/lib/python/xbmcclient.py
%if 0%{?fedora} < 32
# Fix python binary search
sed -i 's/ pkg_check_modules(PC_PYTHON python>=2.7 QUIET)/ pkg_check_modules(PC_PYTHON python=2.7 QUIET)/' cmake/modules/FindPython.cmake
%endif
%build
%cmake3 \
%if %{with dvdcss}
-DLIBDVDCSS_URL=%{SOURCE4} \
%else
-DENABLE_DVDCSS=OFF \
%endif
%if ! 0%{?_with_external_ffmpeg}
-DFFMPEG_URL=%{SOURCE5} \
%endif
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DCMAKE_C_FLAGS_RELWITHDEBINFO:STRING="-DNDEBUG" \
-DCMAKE_CXX_FLAGS_RELWITHDEBINFO:STRING="-DNDEBUG" \
-DCMAKE_ASM_FLAGS_RELWITHDEBINFO:STRING="-DNDEBUG" \
-DENABLE_DEBUGFISSION=OFF \
-GNinja \
-DENABLE_EVENTCLIENTS=ON \
-DENABLE_INTERNAL_CROSSGUID=OFF \
-DLIRC_DEVICE=/var/run/lirc/lircd \
-DLIBDVDNAV_URL=%{SOURCE2} \
-DLIBDVDREAD_URL=%{SOURCE3} \
-DPYTHON_EXECUTABLE=%{__python3} \
-DCORE_PLATFORM_NAME="%{kodi_backends}" \
-DAPP_RENDER_SYSTEM=gl \
.
%ninja_build
%install
%ninja_install
# remove the doc files from unversioned /usr/share/doc/xbmc, they should be in versioned docdir
rm -r $RPM_BUILD_ROOT/%{_datadir}/doc/
desktop-file-install \
--dir=${RPM_BUILD_ROOT}%{_datadir}/applications \
$RPM_BUILD_ROOT%{_datadir}/applications/kodi.desktop
# Stop shipping the duplicate xsession file
rm -f $RPM_BUILD_ROOT/%{_datadir}/xsessions/xbmc.desktop
# Normally we are expected to build these manually. But since we are using
# the system Python interpreter, we also want to use the system libraries
install -d $RPM_BUILD_ROOT%{_libdir}/kodi/addons/script.module.pil/lib
ln -s %{python3_sitearch}/PIL $RPM_BUILD_ROOT%{_libdir}/kodi/addons/script.module.pil/lib/PIL
#install -d $RPM_BUILD_ROOT%{_libdir}/xbmc/addons/script.module.pysqlite/lib
# Use external font files instead of bundled ones
ln -sf %{_fontbasedir}/dejavu/DejaVuSans-Bold.ttf ${RPM_BUILD_ROOT}%{_datadir}/kodi/addons/skin.estouchy/fonts/
# Move man-pages into system dir
mkdir -p ${RPM_BUILD_ROOT}%{_mandir}/
mv docs/manpages ${RPM_BUILD_ROOT}%{_mandir}/man1/
# Remove wiiremote man page if support was disabled
%if ! 0%{?_with_cwiid}
rm -f ${RPM_BUILD_ROOT}%{_mandir}/man1/kodi-wiiremote.1
%endif
%post firewalld
%firewalld_reload
%files
%license LICENSE.md LICENSES/
%doc README.md docs
%{_bindir}/kodi
%{_bindir}/kodi-standalone
%{_bindir}/JsonSchemaBuilder
%{_bindir}/TexturePacker
%{_libdir}/kodi/
%{_datadir}/kodi/
%{_datadir}/xsessions/kodi.desktop
%{_datadir}/applications/kodi.desktop
%{_datadir}/icons/hicolor/*/*/*.png
%{_mandir}/man1/kodi.1.gz
%{_mandir}/man1/kodi.bin.1.gz
%{_mandir}/man1/kodi-standalone.1.gz
%{_mandir}/man1/TexturePacker.1.gz
%files devel
%{_includedir}/kodi
%files eventclients
%license LICENSE.md LICENSES/
%{python3_sitelib}/kodi
%dir %{_datadir}/pixmaps/kodi
%{_datadir}/pixmaps/kodi/*.png
%{_bindir}/kodi-ps3remote
%{_bindir}/kodi-send
%if 0%{?_with_cwiid}
%{_bindir}/kodi-wiiremote
%endif
%{_mandir}/man1/kodi-ps3remote.1.gz
%{_mandir}/man1/kodi-send.1.gz
%if 0%{?_with_cwiid}
%{_mandir}/man1/kodi-wiiremote.1.gz
%endif
%files eventclients-devel
%{_includedir}/kodi/xbmcclient.h
%files firewalld
%license LICENSE.md LICENSES/
%{_prefix}/lib/firewalld/services/kodi-eventserver.xml
%{_prefix}/lib/firewalld/services/kodi-http.xml
%{_prefix}/lib/firewalld/services/kodi-jsonrpc.xml
%changelog