File libpjsip.spec of Package libpjsip

#
# spec file for package libpjsip
#
# Copyright (c) 2020 SUSE LLC
# Copyright (c) 2014 Szőts Ákos <szotsaki@gmail.com>
#
# 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/
#


Name:           libpjsip
Version:        2.10
Release:        0
Summary:        A communication library for SIP, RTP, STUN, ICE
License:        GPL-2.0-or-later AND ARR AND LGPL-2.1-or-later AND BSD-3-Clause
Group:          Productivity/Telephony/SIP/Utilities
URL:            https://www.pjsip.org
Source:         https://github.com/pjsip/pjproject/archive/%{version}/%{name}-%{version}.tar.gz
Patch0:         config_site_h.diff
BuildRequires:  alsa-devel
BuildRequires:  gcc-c++
BuildRequires:  ilbc-devel
BuildRequires:  libgsm-devel
BuildRequires:  libsrtp-devel
BuildRequires:  libtool
BuildRequires:  pkgconfig
BuildRequires:  pkgconfig(libv4l2)
BuildRequires:  pkgconfig(openssl)
BuildRequires:  pkgconfig(portaudio-2.0)
BuildRequires:  pkgconfig(sdl2)
BuildRequires:  pkgconfig(speex)
BuildRequires:  pkgconfig(speexdsp)
BuildRequires:  pkgconfig(zlib)

%description
PJSIP is a communication library implementing protocols such as SIP,
SDP, RTP, STUN, TURN, and ICE. It combines the Signaling Protocol
(SIP) with a multimedia framework and NAT traversal functionality.

%package -n libpj2
Summary:        A communication library for SIP, RTP, STUN, ICE
License:        GPL-2.0-or-later
Group:          System/Libraries

%description -n libpj2
PJSIP is a communication library implementing standard-based
protocols such as SIP, SDP, RTP, STUN, TURN, and ICE. It combines the
Signaling Protocol (SIP) with a multimedia framework and NAT
traversal functionality into a high level API.

%package -n libg7221codec2
Summary:        An implementation of the G.722 encoder and decoder
License:        ARR
Group:          System/Libraries

%description -n libg7221codec2
This subpackage contains a G.722 encoder and decoder used by the
PJSIP stack.

%package -n libilbccodec2
Summary:        ILBC codec integration into PJSIP
License:        ARR
Group:          System/Libraries

%description -n libilbccodec2
Integration with ILBC.

%package -n libresample2
Summary:        PJSIP fork of resample/libresample
License:        LGPL-2.1-or-later
Group:          System/Libraries

%description -n libresample2
This subpackage contains an audio data resampler used by the
PJSIP stack.

%package -n libwebrtc2
Summary:        PJSIP fork of Chromium WebRTC
License:        BSD-3-Clause
Group:          System/Libraries

%description -n libwebrtc2
This subpackage contains a WebRTC implementation used by the
PJSIP stack.

%package -n libyuv2
Summary:        YUV scaling and conversion library
License:        BSD-3-Clause
Group:          System/Libraries

%description -n libyuv2
libyuv includes YUV scaling and conversion functionality.

* Scale YUV to prepare content for compression, with point, bilinear
  or box filter.
* Convert to YUV from webcam formats.
* Convert from YUV to formats for rendering/effects.
* Rotate by 90/180/270 degrees to adjust for mobile devices in
  portrait mode.
* Optimized for SSE2/SSSE3/AVX2 on x86/x64, NEON on ARM, and DSP R2
  on MIPS.

%package devel
Summary:        Development header files for PJSIP
License:        GPL-2.0-or-later
Group:          Development/Libraries/C and C++
Requires:       libg7221codec2 = %{version}-%{release}
Requires:       libilbccodec2 = %{version}-%{release}
Requires:       libpj2 = %{version}-%{release}
Requires:       libresample2 = %{version}-%{release}
Requires:       libwebrtc2 = %{version}-%{release}
Requires:       libyuv2 = %{version}-%{release}

%description devel
PJSIP is a communication library written in the C language,
implementing standard-based protocols such as SIP, SDP, RTP, STUN,
TURN, and ICE. It combines the Signaling Protocol (SIP) with a
multimedia framework and NAT traversal functionality into a high
level API.

This subpackage contains libraries and header files for developing
applications that want to make use of libpjsip.

%if 0%{?suse_version} <= 1500 
# Tumbleweed has no python2
%package -n python-pjsua
Summary:        Python bindings for PJSIP
License:        GPL-2.0-or-later
Group:          Development/Libraries/Python
BuildRequires:  python-devel
Requires:       libg7221codec2 = %{version}-%{release}
Requires:       libilbccodec2 = %{version}-%{release}
Requires:       libpj2 = %{version}-%{release}
Requires:       libresample2 = %{version}-%{release}

%description -n python-pjsua
Python bindings for the PJSIP library.
%endif

%prep
%setup -q -n pjproject-%{version}
%patch0 -p1

%build
%configure --disable-ffmpeg --enable-shared --disable-static \
	--enable-memalign-hack \
	--with-external-gsm --with-external-speex \
	--with-external-pa --with-external-srtp
make depend %{?_smp_mflags}
make #-j here causes races

%if 0%{?suse_version} <= 1500 
# python bindings
cd pjsip-apps/src/python ; make
%endif

%install
%make_install
find %{buildroot} -type f -name "*.a" -delete -print

%if 0%{?suse_version} <= 1500 
# python bindings
cd pjsip-apps/src/python ; python setup.py install --prefix=%{buildroot}%{_prefix}
rm -f %{buildroot}%{python_sitearch}/pjsua.pyc # rpmlint complains about containing buildroot
%endif

%post   -n libpj2 -p /sbin/ldconfig
%postun -n libpj2 -p /sbin/ldconfig
%post   -n libg7221codec2 -p /sbin/ldconfig
%postun -n libg7221codec2 -p /sbin/ldconfig
%post   -n libilbccodec2 -p /sbin/ldconfig
%postun -n libilbccodec2 -p /sbin/ldconfig
%post   -n libresample2 -p /sbin/ldconfig
%postun -n libresample2 -p /sbin/ldconfig
%post   -n libwebrtc2 -p /sbin/ldconfig
%postun -n libwebrtc2 -p /sbin/ldconfig
%post   -n libyuv2 -p /sbin/ldconfig
%postun -n libyuv2 -p /sbin/ldconfig

%files -n libpj2
%license COPYING
%doc README.txt
%{_libdir}/libpj*.so.2*

%files -n libg7221codec2
%{_libdir}/libg7221codec.so.2*

%files -n libilbccodec2
%{_libdir}/libilbccodec.so.2*

%files -n libresample2
%license third_party/resample/COPYING
%{_libdir}/libresample.so.2*

%files -n libyuv2
%license third_party/yuv/LICENSE
%doc third_party/yuv/LICENSE_THIRD_PARTY third_party/yuv/PATENTS third_party/yuv/README.md
%{_libdir}/libyuv.so.2*

%files -n libwebrtc2
%license third_party/webrtc/LICENSE
%doc third_party/webrtc/LICENSE_THIRD_PARTY third_party/webrtc/PATENTS
%{_libdir}/libwebrtc.so.2*

%files devel
%{_includedir}/pj*
%{_libdir}/pkgconfig/libpjproject.pc
%{_libdir}/lib*.so

%if 0%{?suse_version} <= 1500 
%files -n python-pjsua
%{python_sitearch}/*pjsua*
%endif

%changelog
openSUSE Build Service is sponsored by