File kodi.binary-addons-noX-raspberry-pi2.spec of Package kodi.binary-addons

#
# spec file for package kodi.binary-addons
#
# Copyright (c) 2015-2025 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
#

%define _lto_cflags %{nil}
# Please edit kodi.spec and kodi.changes only. *-noX.* files are generated from
# kodi.* files with the pre_checkin.sh script
%define kodi_version Omega
%define _kodi_addons_dir %{_datadir}/kodi/addons
# set this parameter to enable building Kodi with ccache, debug information, etc.
%define dev_build 0
# kodi can be built without X support when openGL ES is used (mainly used on ARM boards used as media center)
%define noX_build 1
%if %{noX_build}
# no X build needs openGL ES
%bcond_with enable_opengl
%bcond_without enable_opengles
%else
%ifarch %arm armv6l armv6hl
%bcond_with enable_opengl
%bcond_without enable_opengles
%else
%bcond_without enable_opengl
%bcond_with enable_opengles
%endif
%endif

%define kodi_platform raspberry-pi2
%define kodi_player omxplayer

ExclusiveArch: %ix86 x86_64 aarch64

Name:           kodi.binary-addons-noX-raspberry-pi2
Version:        21.2
Release:        0
Summary:        Binary Addons for Kodi
License:        GPL-2.0+ and GPL-3.0+
Group:          Productivity/Multimedia/Video/Players
Url:            http://kodi.tv/
Source0:        https://github.com/xbmc/xbmc/archive/%{version}-%{kodi_version}.tar.gz
Source1:        kodi.binary-addons.spec.packages.inc
Source2:        kodi.binary-addons.spec.files.inc
Source3:        kodi.binary-addons.tar
Source4:        repo-binary-addons.%{kodi_version}.tar.bz2
Source5:        https://github.com/xbmc/kodi-platform/archive/refs/tags/kodiplatform-20250416.tar.gz
Source20:       http://mirrors.kodi.tv/build-deps/sources/rapidxml-1.13.zip
Source21:       rapidxml.cmake
Source22:       https://github.com/xbmc/Bento4/archive/refs/tags/1.6.0-639-8-%{kodi_version}.tar.gz
Patch1:         cmake-binary-addons.patch
Patch2:         addon-helpers_lib64.patch
# PATCH-PACKMAN kodi.binary-addons-audiodecoder.ncsf-gcc5.3.patch - fixes compiling of audiodecoder.ncsf with gcc > 4.8, suse_version >= 1320
#Patch3:         kodi.binary-addons-audiodecoder.ncsf-gcc5.3.patch
# PATCH-PACKMAN kodi.binary-addons-screensavers.rsxs-upstream-stdbool_h.patch - fixes compiling of screensavers.rsxs with gcc > 4.8, suse_version >= 1320
#Patch4:         kodi.binary-addons-screensavers.rsxs-upstream-stdbool_h.patch
#Patch5:         lib555-missing-xlocale.patch
#Patch6:         pvr.stalker-gcc7.patch
# PATCH-PACKMAN kodi.binary.addons-noreturnfromnonvoid.patch - davejplater@gmail.com - Suddenly an rpmlint no return from nonvoid has appeared after taglib was updated.
Patch7:         kodi.binary.addons-noreturnfromnonvoid.patch
#Patch8:         kodi.binary-addons-screensavers.rsxs-host-toolchain.patch
#Patch9:         kodi.binary-addons-vfs.sacd.no-int-conversion.patch
Patch10:        FindBento4.cmake.patch
Patch11:        add-default-return.patch

BuildRequires:  autoconf
BuildRequires:  automake
BuildRequires:  ccache
BuildRequires:  cmake
BuildRequires:  fdupes
%if 0%{?suse_version} >= 1550 && 0%{?sle_version} == 0
BuildRequires:  gcc14
BuildRequires:  gcc14-c++
%else
BuildRequires:  gcc10
BuildRequires:  gcc10-c++
%endif
%if %{noX_build}
BuildRequires:  kodi-noX-devel = %{version}
%else
BuildRequires:  kodi-devel = %{version}
%endif
BuildRequires:  pkgconfig(bzip2)
BuildRequires:  giflib-devel
BuildRequires:  gli-devel
BuildRequires:  cmake(glm) >= 0.9.9
BuildRequires:  jsoncpp-devel
BuildRequires:	nlohmann_json-devel
BuildRequires:  tinyxml-devel
BuildRequires:  libhdhomerun-devel
BuildRequires:  liblz4-devel
BuildRequires:  libmp3lame-devel
BuildRequires:  libnfs-devel
BuildRequires:  libraw-devel
BuildRequires:  pkgconfig(smbclient)
BuildRequires:  libSOIL-devel
BuildRequires:  libstdc++-devel
BuildRequires:  libtiff-devel
BuildRequires:  libtool
BuildRequires:  libxml2-devel
BuildRequires:  lzo-devel
BuildRequires:  nlohmann_json-devel
BuildRequires:  pkg-config
BuildRequires:  pkgconfig(expat)
BuildRequires:  pkgconfig(flac)
BuildRequires:  pkgconfig(fluidsynth)
BuildRequires:  pkgconfig(gtest)
BuildRequires:  pkgconfig(libarchive) >= 3.3.2
BuildRequires:	pkgconfig(libjpeg)
BuildRequires:  pkgconfig(libmodplug)
%if 0%{?suse_version} >= 1550
BuildRequires:  pkgconfig(libplist-2.0)
%else
BuildRequires:  pkgconfig(libplist)
%endif
BuildRequires:  pkgconfig(libpng)
BuildRequires:  pkgconfig(libprojectM)
BuildRequires:  pkgconfig(librtmp)
BuildRequires:  pkgconfig(libssh)
BuildRequires:  pkgconfig(libssl)
BuildRequires:  pkgconfig(p8-platform)
BuildRequires:  pkgconfig(pugixml)
BuildRequires:  pkgconfig(tinyxml2)
BuildRequires:  pkgconfig(vorbis)
BuildRequires:  pkgconfig(wavpack)
BuildRequires:  rapidjson-devel
BuildRequires:  (pkgconfig(libavcodec) >= 60 with pkgconfig(libavcodec) < 61)
BuildRequires:  (pkgconfig(libavfilter) >= 9 with pkgconfig(libavfilter) < 10)
BuildRequires:  (pkgconfig(libavformat) >= 60 with pkgconfig(libavformat) < 61)
BuildRequires:  (pkgconfig(libavutil) >= 58 with pkgconfig(libavutil) < 59)
BuildRequires:  (pkgconfig(libpostproc) >= 57 with pkgconfig(libpostproc) < 58)
BuildRequires:  (pkgconfig(libswresample) >= 4 with pkgconfig(libswresample) < 5)
BuildRequires:  (pkgconfig(libswscale) >= 7 with pkgconfig(libswscale) < 8)
BuildRequires:  pkgconfig(sqlite3)

# kodi needs the same libtag version which was used to build against
%if 0%{?suse_version} >= 1599
%requires_eq    libtag2
%else
%requires_eq    libtag1
%endif
%if !%{noX_build}
%if 0%{?suse_version} >= 1550 && 0%{?sle_version} == 0
BuildRequires:  pkgconfig(x11)
%else
BuildRequires:  xorg-x11-devel
%endif
%endif
%if %{with enable_opengl}
BuildRequires:  pkgconfig(gl)
BuildRequires:  pkgconfig(glew)
BuildRequires:  pkgconfig(glu)
BuildRequires:  pkgconfig(vdpau)
%endif

%if %{with enable_opengles}
%if "%{kodi_platform}" == "none"
BuildRequires:  Mesa-libEGL-devel
BuildRequires:  Mesa-libGLESv2-devel
%else
%if "%{kodi_platform}" == "raspberry-pi" || "%{kodi_platform}" == "raspberry-pi2"
BuildRequires:  raspberrypi-userland-devel
%endif
%endif
%endif

# glxinfo is needed to check hw accel
%if 0%{?suse_version} >= 1220
%if !%{noX_build}
Requires:       Mesa-demo-x
Requires:       xdpyinfo
%endif
%endif

BuildRoot:      %{_tmprath}/%{name}-%{version}-build
ExcludeArch:    ppc64
Requires:       kodi = %{version}
#Requires:       libjsoncpp1

%description
Binary Addons for Kodi Media Center

%include %{SOURCE1}

%prep
%setup -q -n xbmc-%{version}-%{kodi_version}
%patch -P 1 -p1
%patch -P 2 -p1

%build

%install

pushd cmake/addons
tar xvf %{SOURCE3}
mkdir -pv build/bootstrap/binary-addons/src
cp -v %{SOURCE4} build/bootstrap/binary-addons/src

# Remove deps that are already installed using BuildRequires
rm -rf depends/common/{p8-platform,tinyxml}
rm -f  depends/common/kodi-platform/deps.txt

mkdir -p depends/common/kodi-platform
cp -v %{SOURCE5} depends/common/kodi-platform
echo "kodi-platform file://../../../../../cmake/addons/depends/common/kodi-platform/kodiplatform-20250416.tar.gz" > depends/common/kodi-platform/kodi-platform.txt
echo "e559715b37b91e219ea2bb72cff0d0b29cf08386685fd12328520a294bb17b57" > depends/common/kodi-platform/kodi-platform.sha256

mkdir -pv depends/common/rapidxml
cp -v %{SOURCE20} depends/common/rapidxml
cp -v %{SOURCE21} depends/common/rapidxml/CMakeLists.txt
echo "rapidxml file://../../../../../cmake/addons/depends/common/rapidxml/rapidxml-1.13.zip" > depends/common/rapidxml/rapidxml.txt
echo "c3f0b886374981bb20fabcf323d755db4be6dba42064599481da64a85f5b3571" > depends/common/rapidxml/rapidxml.sha256
popd

sed -i~ 's/@@@_libdir@@@/%{_lib}/' cmake/scripts/common/AddonHelpers.cmake
diff -u cmake/scripts/common/AddonHelpers.cmake~ cmake/scripts/common/AddonHelpers.cmake && exit 0

%if 0
# Tumbleweed and Factory have GCC 5.x ATM (20160309), source needs patching for this
#%if 0%{?suse_version} > 1320
  # patch audiodecoders.ncsf
  #patch -p0 < %%{PATCH3}
  # patch screensavers.rsxs
  #patch screensavers.rsxs/lib/rsxs-1.0/lib/stdbool.in.h %{PATCH4}
  #patch -up0 --verbose < %{PATCH5}
  #patch -up4 --verbose < %{PATCH6}
#%endif

# fake buildtime in audiodecoder.qsf
FAKE_BUILDDATE=$(LC_ALL=C date -u -r %{_sourcedir}/%{name}.changes '+%%b %%e %%Y')
FAKE_BUILDTIME=$(LC_ALL=C date -u -r %{_sourcedir}/%{name}.changes '+%%H:%%M:%%S')
#for file in audiodecoder.qsf/lib/Highly_Quixotic/Core/qsound.c \
#            audiodecoder.ssf/lib/Highly_Theoretical/Core/Starscream/star.c \
#            audiodecoder.ssf/lib/Highly_Theoretical/Core/sega.c \
#            audiodecoder.timidity/lib/timidity/timidity/speex_a.c; do
#  sed -i -e "s/__DATE__/\"$FAKE_BUILDDATE\"/" -e "s/__TIME__/\"$FAKE_BUILDTIME\"/" $file
#done
#patch -p 0 < %{PATCH7}
#make VERBOSE=1 %{?_smp_mflags}
%endif

test -x "$(type -P gcc)"   && CC="$_"
test -x "$(type -P g++)"   && CXX="$_"
test -x "$(type -P gcc-9)" && CC="$_"
test -x "$(type -P g++-9)" && CXX="$_"
test -x "$(type -P gcc-10)" && CC="$_"
test -x "$(type -P g++-10)" && CXX="$_"
test -x "$(type -P gcc-11)" && CC="$_"
test -x "$(type -P g++-11)" && CXX="$_"
test -x "$(type -P gcc-12)" && CC="$_"
test -x "$(type -P g++-12)" && CXX="$_"
test -x "$(type -P gcc-13)" && CC="$_"
test -x "$(type -P g++-13)" && CXX="$_"
test -x "$(type -P gcc-14)" && CC="$_"
test -x "$(type -P g++-14)" && CXX="$_"
CC="$(readlink -f ${CC})"
CXX="$(readlink -f ${CXX})"

pushd tools/depends/target/binary-addons
mkdir -p native
%cmake \
    ../../../../../cmake/addons \
%if %{dev_build}
    -DVERBOSE=ON \
%endif
    -DCMAKE_C_COMPILER=$CC \
    -DCMAKE_CXX_COMPILER=$CXX \
%ifarch %{ix86}
    -DCMAKE_C_FLAGS=-mavx \
%endif
    -DBUILD_DIR=build \
    -DNEED_SUDO=FALSE \
    -DAPP_LIB_DIR=%{buildroot}%{_libdir}/kodi \
    -DCMAKE_INSTALL_LIBDIR=%{buildroot}%{_libdir}/kodi \
    -DCMAKE_INSTALL_PREFIX=%{buildroot}%{_prefix} \
    -DADDONS_TO_BUILD="all" 

popd

# Patching addons after being unpacked
pushd cmake/addons/build
# patch -up2 --verbose -i %{PATCH7}
#patch -up0 --verbose -i %{PATCH8}
#patch -up2 --verbose -i %{PATCH9}
patch -up0 --verbose -i %{PATCH10}

cp -v %{SOURCE22} inputstream.adaptive/depends/common/bento4
echo "bento4 file://../../../../../../../../../../cmake/addons/build/inputstream.adaptive/depends/common/bento4/1.6.0-639-8-%{kodi_version}.tar.gz" > inputstream.adaptive/depends/common/bento4/bento4.txt

patch -up0 --verbose -i %{PATCH11}

popd

pushd tools/depends/target/binary-addons/build
# Workaround for cmake 3.18 issue with copy_if_different issue adding "" at the end of line
sed -i -e 's#""##' depends/CMakeFiles/rapidxml.dir/build.make
make -O %{?_smp_mflags} VERBOSE=1 CC=$CC CXX=$CXX 

%fdupes %{buildroot}

%files
%defattr(-,root,root)
%dir %{_libdir}/kodi
%dir %{_datadir}/kodi
%{_libdir}/kodi/PrepareEnv.cmake

%include %{SOURCE2}

%changelog