File p8-platform.spec of Package p8-platform

#
# spec file for package p8-platform
#
# Copyright (c) 2019 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 https://bugs.opensuse.org/
#


%define _SO_nr  2
Name:             p8-platform
Version:          2.1.0.x+git.20240129T103109~5a786dd
Release:          0
Summary:          Platform support library used by libCEC and binary add-ons for Kodi
License:          GPL-2.0-or-later
Group:            Hardware/TV
URL:              https://github.com/Pulse-Eight/platform
Source:           %{name}-%{version}.tar.xz
BuildRequires:    cmake >= 2.6
%if 0%{?suse_version} <= 1600  
BuildRequires:    gcc12
BuildRequires:    gcc12-c++
%else
BuildRequires:    gcc-c++
%endif
BuildRequires:    pkgconfig

%description
Platform support library used by libCEC and binary add-ons for Kodi.

%package -n lib%{name}%{_SO_nr}
Summary:        Platform support library used by libCEC and binary add-ons for Kodi
Group:          Hardware/TV

%description -n lib%{name}%{_SO_nr}
Platform support library used by libCEC and binary add-ons for Kodi.

%package devel
Summary:        Platform support library used by libCEC development files
Group:          Development/Languages/C and C++
Requires:       lib%{name}%{_SO_nr} = %{version}-%{release}

%description devel
Development files for platform support library used by libCEC and Kodi.

%prep
%setup -q -n %{name}-%{version}

%build
export CFLAGS="%optflags -flto=auto"
export CXXFLAGS="%optflags -flto=auto"
export LDFLAGS="$(CFLAGS) ${LDFLAGS}"
test -x "$(type -p gcc-12)" && export CC="$_"
test -x "$(type -p g++-12)" && export CXX="$_"
%cmake
%cmake_build

%install
%cmake_install

%post	-n lib%{name}%{_SO_nr} -p /sbin/ldconfig
%postun -n lib%{name}%{_SO_nr} -p /sbin/ldconfig

%files -n lib%{name}%{_SO_nr}
%license debian/copyright
%doc README.md
%{_libdir}/lib%{name}.so.%{_SO_nr}*

%files devel
%{_includedir}/%{name}
%{_libdir}/lib%{name}.so
%{_libdir}/pkgconfig/%{name}.pc
%dir %{_libdir}/%{name}
%{_libdir}/%{name}/p8-platform-config.cmake

%changelog
openSUSE Build Service is sponsored by