File pjproject.spec of Package pjproject

#
# spec file for package pjproject
#
# 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 sover   2
Name:           pjproject
Version:        2.10
Release:        0
Summary:        Free and open source multimedia communication library
License:        GPL-2.0-only
URL:            https://www.pjsip.org
Source0:        https://github.com/pjsip/pjproject/archive/%{version}.tar.gz#/%{name}-%{version}.tar.gz
# all of these patches come from jani-daemon
Patch1:         0001-rfc6544.patch
Patch2:         0002-rfc2466.patch
Patch3:         0003-add-tcp-keep-alive.patch
Patch4:         0004-multiple_listeners.patch
Patch5:         0005-fix_ebusy_turn.patch
Patch6:         0006-ignore_ipv6_on_transport_check.patch
Patch7:         0007-pj_ice_sess.patch
Patch8:         0007-upnp-srflx-nat-assisted-cand.patch
Patch9:         0008-fix_ioqueue_ipv6_sendto.patch
Patch10:        0009-add-config-site.patch
Patch11:        0010-fix-pkgconfig.patch
Patch12:        0011-fix-tcp-death-detection.patch
Patch13:        0012-fix-turn-shutdown-crash.patch
Patch14:        0013-Assign-unique-local-preferences-for-candidates-with-.patch
Patch15:        0014-Add-new-compile-time-setting-PJ_ICE_ST_USE_TURN_PERM.patch
Patch16:        0015-update-local-preference-for-peer-reflexive-candidate.patch
Patch17:        0016-use-addrinfo-instead-CFHOST.patch
Patch18:        sip_td_timeout.patch
BuildRequires:  autoconf
BuildRequires:  gcc-c++
BuildRequires:  pkgconfig
BuildRequires:  pkgconfig(gnutls)
BuildRequires:  pkgconfig(libsrtp)
BuildRequires:  pkgconfig(libyuv)
BuildRequires:  pkgconfig(gnutls)

# see if it's possible to use external libresample and g7221 and to disable portaudio

%description
PJSIP is a free and open source multimedia communication library written
in C language implementing standard based protocols such as SIP, SDP, RTP,
STUN, TURN, and ICE.

%package devel
Summary:        Development package for pjproject
Requires:       %{name}-libs = %{version}
Requires:       pkgconfig(libsrtp)
Requires:       pkgconfig(libyuv)

%description devel
Development package for pjproject.

%package libs
Summary:        Free and open source multimedia communication library

%description libs
PJSIP is a free and open source multimedia communication library written
in C language implementing standard based protocols such as SIP, SDP, RTP,
STUN, TURN, and ICE.

%prep
%autosetup -p1

%build
autoconf -o configure aconfigure.ac
%configure \
    --enable-shared        \
    --enable-epoll         \
    --disable-sound        \
    --enable-video         \
    --enable-ext-sound     \
    --disable-speex-aec    \
    --disable-g711-codec   \
    --disable-l16-codec    \
    --disable-gsm-codec    \
    --disable-g722-codec   \
    --disable-g7221-codec  \
    --disable-speex-codec  \
    --disable-ilbc-codec   \
    --disable-opencore-amr \
    --disable-silk         \
    --disable-sdl          \
    --disable-ffmpeg       \
    --disable-v4l2         \
    --disable-openh264     \
    --disable-resample     \
    --disable-libwebrtc    \
    --with-external-srtp   \
    --with-external-yuv    \
    --with-gnutls=%{_prefix}


# disable parallel build due to race condition
make all

%install
make DESTDIR=%{buildroot} install

%if "%{?_lto_cflags}"
# remove *.a files because these should not be shipped if LTO is enabled;
# see https://en.opensuse.org/openSUSE:LTO
rm -f %{buildroot}%{_libdir}/*.a
%define ARCHIVE_NOT_INSTALLED 1
%endif

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


%files libs
%license COPYING
%doc README.txt
%{_libdir}/lib*.so.%{sover}

%files devel
%{_libdir}/lib*.so
%if "%{?_lto_cflags}"
%else
%{_libdir}/*.a
%endif
%{_includedir}/pj*
%{_libdir}/pkgconfig/libpjproject.pc

%changelog
openSUSE Build Service is sponsored by