File tg-owt.spec of Package tg-owt

#
# spec file for package tg-owt
#
# Copyright (c) 2021 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 __builder ninja
%define _lto_cflags %{nil}
# We need current gcc to build
%if 0%{?suse_version} < 01550 && 0%{?is_opensuse}
%bcond_without  fixed_gcc
%else
%bcond_with     fixed_gcc
%endif
Name:           tg-owt
Version:        0.0.1~git.d85b53d
Release:        0
Summary:        WebRTC library for the Telegram messenger
License:        BSD-3-Clause AND Apache-2.0
URL:            https://github.com/desktop-app/tg_owt
Source0:        %{name}-%{version}.tar.gz
Patch1:         fix-gcc13.patch
BuildRequires:  cmake
BuildRequires:  fdupes
%if %{with fixed_gcc}
BuildRequires:  gcc10-c++
%else
BuildRequires:  gcc-c++
%endif
BuildRequires:  ninja
BuildRequires:  pkgconfig
BuildRequires:  yasm-devel
BuildRequires:  pkgconfig(alsa)
BuildRequires:  pkgconfig(libavcodec) >= 60
BuildRequires:  pkgconfig(libavformat) >= 60
BuildRequires:  pkgconfig(libavutil) >= 58
BuildRequires:  pkgconfig(libjpeg)
BuildRequires:  pkgconfig(libpipewire-0.3)
BuildRequires:  pkgconfig(libpulse)
BuildRequires:  pkgconfig(libswresample) >= 4.10
BuildRequires:  pkgconfig(libswscale) >= 7
BuildRequires:  pkgconfig(openssl)
BuildRequires:  pkgconfig(opus)
BuildRequires:  pkgconfig(x11)
BuildRequires:  pkgconfig(xcomposite)
BuildRequires:  pkgconfig(xdamage)
BuildRequires:  pkgconfig(xext)
BuildRequires:  pkgconfig(xfixes)
BuildRequires:  pkgconfig(xrandr)
BuildRequires:  pkgconfig(xrender)
BuildRequires:  pkgconfig(xtst)
BuildRequires:  pkgconfig(protobuf)
BuildRequires:  pkgconfig(vpx)
BuildRequires:  pkgconfig(libsrtp)
BuildRequires:  pkgconfig(gl)
BuildRequires:  pkgconfig(gbm)
BuildRequires:  pkgconfig(libdrm)
BuildRequires:  pkgconfig(epoxy)
BuildRequires:  cmake(absl)
Provides:       bundled(abseil-cpp) = 0~gitfba8a31
Provides:       bundled(base64) = 0~git
Provides:       bundled(fft) = 0~git
Provides:       bundled(g711) = 0~git
Provides:       bundled(g722) = 0~git
Provides:       bundled(libevent) = 1.4.15
Provides:       bundled(libsrtp) = 2.2.0~git94ac00d
Provides:       bundled(libvpx) = 1.8.2~git5b63f0f
Provides:       bundled(libwebm) = 0~git
Provides:       bundled(libyuv) = 0~gitad89006
Provides:       bundled(ooura) = 0~git
Provides:       bundled(openh264) = 1.10.0~git6f26bce
Provides:       bundled(pffft) = 0~git483453d
Provides:       bundled(portaudio) = 0~git
Provides:       bundled(rnnoise) = 0~git91ef40
Provides:       bundled(sigslot) = 0~git
Provides:       bundled(spl_sqrt_floor) = 0~git
Provides:       bundled(usrsctp) = 1.0.0~gitbee946a

%description
%{summary}.

%package devel
Summary:        Development files for %{name}
Provides:       %{name}-static = %{version}
Provides:       bundled(abseil-cpp) = 0~git39f46fa
Provides:       bundled(crc32c) = 1.1.0~git21fc8ef
Provides:       bundled(base64) = 0~git
Provides:       bundled(fft) = 0~git
Provides:       bundled(g711) = 1.1~git
Provides:       bundled(g722) = 1.14~git
Provides:       bundled(libsrtp) = 2.2.0~git94ac00d
Provides:       bundled(libyuv) = 1767~git21fc8ef
Provides:       bundled(ooura) = 0~git
Provides:       bundled(openh264) = 1.10.0~git6f26bce
Provides:       bundled(pffft) = 0~git483453d
Provides:       bundled(portaudio) = 0~git
Provides:       bundled(rnnoise) = 0~git91ef40
Provides:       bundled(sigslot) = 0~git
Provides:       bundled(spl_sqrt_floor) = 0~git
Requires:       pkgconfig(alsa)
Requires:       pkgconfig(epoxy)
Requires:       pkgconfig(gbm)
Requires:       pkgconfig(libavcodec)
Requires:       pkgconfig(libavformat)
Requires:       pkgconfig(libavutil)
Requires:       pkgconfig(libdrm)
Requires:       pkgconfig(libjpeg)
Requires:       pkgconfig(libpipewire-0.3)
Requires:       pkgconfig(libpulse)
Requires:       pkgconfig(libswresample)
Requires:       pkgconfig(libswscale)
Requires:       pkgconfig(openssl)
Requires:       pkgconfig(opus)
Requires:       pkgconfig(vpx)
Requires:       pkgconfig(x11)
Requires:       pkgconfig(xcomposite)
Requires:       pkgconfig(xdamage)
Requires:       pkgconfig(xext)
Requires:       pkgconfig(xfixes)
Requires:       pkgconfig(xrandr)
Requires:       pkgconfig(xrender)
Requires:       pkgconfig(xtst)

%description devel
%{summary}.

%prep
%autosetup -p1

%build
%if %{with fixed_gcc}
export LDFLAGS="%{optflags} -std=gnu++17"
export CC="/usr/bin/gcc-10"
export CXX="/usr/bin/g++-10"
%endif
%cmake \
 -DCMAKE_BUILD_TYPE=Release \
 -DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=ON \
 -DBUILD_SHARED_LIBS:BOOL=OFF \
 -DTG_OWT_USE_PROTOBUF:BOOL=OFF \
%if %{with fixed_gcc}
 -DCMAKE_CXX_STANDARD=17 \
%endif
 -DTG_OWT_PACKAGED_BUILD:BOOL=ON
%cmake_build

%install
%cmake_install
%fdupes %{buildroot}/%{_prefix}

%files devel
%license LICENSE
%{_includedir}/tg_owt
%{_libdir}/libtg_owt.a
%{_libdir}/cmake/tg_owt

%changelog
openSUSE Build Service is sponsored by