File linphone.spec of Package linphone
#
# spec file for package linphone
#
# Copyright (c) 2022 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 numberOfProcessorsOnMachine %(nproc)
%define wantedJobs %(echo "1.25*%{numberOfProcessorsOnMachine}" | bc -l)
%define jobsIget %(echo %{wantedJobs} | awk '{print int(\$1+0.5)}')
%define ldaplibdir %{buildroot}%{_libexecdir}/%{name}
#use_system_ldap set to 0 because liblinphone 5.x fails to build with system ldap
%define use_system_ldap 0
%define static_ldap 1
%if !0%{?static_ldap}
%define __provides_exclude ^(libldap\\.so.*|liblber\\.so.*)$
%define __requires_exclude ^(libldap\\.so.*|liblber\\.so.*)$
%endif
%define sover 10
%if 0%{?suse_version} >= 1600
%bcond_with slp
%else
%bcond_without slp
%endif
#
# Linphone core version is shown in About-box.
# Automatic adjustment is done on line 260 (or around that line):
# %%define LinphoneCoreVersion 5.2.97
#
Name: linphone
Version: 5.3.1
# Fedora release look standard from OpenSUSE build service:
# Release: <CI_CNT>.<B_CNT>
# Release: %%{?release_prefix}.<CI_CNT>.<B_CNT>
# where rpm macro %%{release_prefix} is defined in spec file
# Normally it looks like:
# Release: 63.fc38 for Fedora packages which is scripted as:
# Release: 0%%{?dist}
# OpenSUSE build service allows for this variant:
# Release: 63.1.fc38
# Release: <CI_CNT>.<B_CNT>%%{?dist}
#
# Add this to Project Config to tag Fedora packages with fcXX:
# ------------------------------
# # reset release name
# onepercentage%%if 0onepercentage%%{?fedora_version}
# Release: <CI_CNT>.<B_CNT> spec:<CI_CNT>.<B_CNT>twopercentage%%{?dist}
# onepercentage%%endif
# ------------------------------
Release: 0
Summary: Web Phone
License: GPL-3.0-or-later
Group: Productivity/Telephony/SIP/Clients
URL: https://linphone.org/technical-corner/liblinphone/
Source: https://gitlab.linphone.org/BC/public/liblinphone/-/archive/%{version}/liblinphone-%{version}.tar.bz2
Source1: %{name}-manual.tar.bz2
Source3: https://gitlab.linphone.org/BC/public/external/openldap/-/archive/bc/openldap-bc.tar.bz2
# PATCH-FIX-OPENSUSE linphone-fix-pkgconfig.patch sor.alexei@meowr.ru -- Install linphone.pc.
Patch0: linphone-00-fix-pkgconfig.patch
# PATCH-FEATURE-OPENSUSE linphone-build-readline.patch sor.alexei@meowr.ru -- Add the ability to compile with readline to the build system.
#Patch1: linphone-01-build-readline.patch
# PATCH-FIX-UPSTREAM
Patch2: linphone-02-reproducible.patch
# PATCH-FIX-OPENSUSE linphone-link-soci-sqlite3.patch -- force linking to libsoci_sqlite3 so that RPM finds the requirement boo#1140595 -- code@bnavigator.de
#Patch3: linphone-03-link-soci-sqlite3.patch
#
# PATCH-FIX-OPENSUSE linphone-build-jsoncpp.patch -- use pkgconfig to find jsoncpp and link against jsoncpp, not jsoncpp_object
#
# Jun 2023: Could be obsolete
# Patch4: linphone-04-build-jsoncpp.patch
# Patch5: linphone-05-fix-jsoncpp_static.patch
#
#Patch6: linphone-06-fix-LinphoneCore_version.patch
BuildRequires: cmake
BuildRequires: doxygen
BuildRequires: fdupes
BuildRequires: gcc-c++
BuildRequires: graphviz
BuildRequires: jsoncpp-devel
%if 0%{?suse_version} || 0%{?fedora_version} < 39
BuildRequires: libeXosip2-devel
%endif
BuildRequires: bc
BuildRequires: zxing-cpp-devel
%if 0%{?suse_version}
BuildRequires: libgsm-devel
BuildRequires: procps
BuildRequires: libjpeg8-devel
BuildRequires: libturbojpeg0
%else
BuildRequires: procps-ng
BuildRequires: gsm-devel
BuildRequires: boost-devel
BuildRequires: boost-json
BuildRequires: turbojpeg-devel
%endif
BuildRequires: lime-devel >= 5.3.5
BuildRequires: pkgconfig
BuildRequires: python3
BuildRequires: python3-pystache
BuildRequires: python3-six
%if 0%{?suse_version}
BuildRequires: python3-xml
%endif
BuildRequires: readline-devel
%if 0%{?suse_version}
BuildRequires: sgmltool
%else
BuildRequires: linuxdoc-tools
%endif
BuildRequires: soci-devel
BuildRequires: soci-sqlite3-devel
BuildRequires: xsd
BuildRequires: pkgconfig(alsa)
BuildRequires: bctoolbox-devel >= 5.3.5
BuildRequires: pkgconfig(bctoolbox) >= 5.3.0
BuildRequires: belcard-devel >= 5.3.5
BuildRequires: pkgconfig(belcard) >= 5.3.0
BuildRequires: belle-sip-devel >= 5.3.5
BuildRequires: pkgconfig(belle-sip) >= 5.3.0
BuildRequires: pkgconfig(libavcodec) >= 51.0.0
BuildRequires: bzrtp-devel >= 5.3.5
BuildRequires: pkgconfig(libbzrtp) >= 5.3.0
%if 0%{?suse_version} || 0%{?fedora_version} < 39
BuildRequires: pkgconfig(libosip2)
%endif
BuildRequires: pkgconfig(libsasl2)
BuildRequires: pkgconfig(libswscale) >= 0.7.0
BuildRequires: pkgconfig(libudev)
BuildRequires: pkgconfig(libupnp)
BuildRequires: pkgconfig(libv4l2) >= 0.8.4
BuildRequires: pkgconfig(libxml-2.0)
BuildRequires: mediastreamer2-plugins >= 5.3.1
BuildRequires: mediastreamer2-devel >= 5.3.1
BuildRequires: pkgconfig(mediastreamer) >= 5.3.0
BuildRequires: pkgconfig(opus)
BuildRequires: ortp-devel >= 5.3.5
BuildRequires: pkgconfig(ortp) >= 5.3.0
BuildRequires: pkgconfig(speex) >= 1.1.6
BuildRequires: pkgconfig(sqlite3)
BuildRequires: pkgconfig(xerces-c)
%if 0%{?use_system_ldap}
%if 0%{?suse_version}
BuildRequires: openldap2-devel
%else
BuildRequires: openldap-devel
%endif
%else
%if 0%{?suse_version}
BuildRequires: db-devel
%else
BuildRequires: libdb-devel
%endif
BuildRequires: openslp-devel
%endif
%if 0%{?fedora}
BuildRequires: pkgconfig(openssl)
#BuildRequires: cyrus-sasl-devel >= 2.1.28
%endif
BuildRequires: chrpath
%if 0%{?fedora_version} > 37
BuildRequires: xpdf
%endif
%description
Linphone is a Web phone with a Qt interface. It lets you make
two-party calls over IP networks such as the Internet. It uses the IETF
protocols SIP (Session Initiation Protocol) and RTP (Realtime TransporT
Protocol) to make calls, so it should be able to communicate with other
SIP-based Web phones. With several codecs available, it can be used
with high speed connections as well as 28k modems.
%package cli
Summary: Web Phone Command Line Interface
Group: Productivity/Telephony/SIP/Clients
Requires: lib%{name}-data = %{version}
%description cli
Linphone is a Web phone with a Qt interface. It lets you make
two-party calls over IP networks such as the Internet. It uses the IETF
protocols SIP (Session Initiation Protocol) and RTP (Realtime TransporT
Protocol) to make calls, so it should be able to communicate with other
SIP-based Web phones. With several codecs available, it can be used
with high speed connections as well as 28k modems.
This package contains the command line interface.
%package -n lib%{name}%{sover}
Summary: Web Phone library
Group: Productivity/Telephony/SIP/Clients
%if 0%{?suse_version}
Recommends: lib%{name}-lang
%endif
Provides: lib%{name} = %{version}
%description -n lib%{name}%{sover}
Linphone is a Web phone with a Qt interface. It lets you make
two-party calls over IP networks such as the Internet. It uses the IETF
protocols SIP (Session Initiation Protocol) and RTP (Realtime TransporT
Protocol) to make calls, so it should be able to communicate with other
SIP-based Web phones. With several codecs available, it can be used
with high speed connections as well as 28k modems.
This package contains a library.
%if 0%{?suse_version}
%lang_package -n lib%{name}
%endif
%package -n lib%{name}++%{sover}
Summary: Web Phone C++ library
Group: Productivity/Telephony/SIP/Clients
%description -n lib%{name}++%{sover}
Linphone is a Web phone with a Qt interface. It lets you make
two-party calls over IP networks such as the Internet. It uses the IETF
protocols SIP (Session Initiation Protocol) and RTP (Realtime TransporT
Protocol) to make calls, so it should be able to communicate with other
SIP-based Web phones. With several codecs available, it can be used
with high speed connections as well as 28k modems.
This package contains a C++ library.
%package -n lib%{name}-data
Summary: Web Phone data files
Group: Productivity/Telephony/SIP/Clients
BuildArch: noarch
%description -n lib%{name}-data
Linphone is a Web phone with a Qt interface. It lets you make
two-party calls over IP networks such as the Internet. It uses the IETF
protocols SIP (Session Initiation Protocol) and RTP (Realtime TransporT
Protocol) to make calls, so it should be able to communicate with other
SIP-based Web phones. With several codecs available, it can be used
with high speed connections as well as 28k modems.
This package contains data files such as sounds.
%package -n lib%{name}-devel
Summary: Web Phone Development files
Group: Development/Languages/C and C++
Requires: glibc-devel
Requires: lib%{name}%{sover} = %{version}
Requires: lib%{name}++%{sover} = %{version}
Requires: lib%{name}-data = %{version}
%if 0%{?suse_version} || 0%{?fedora_version} < 39
Requires: libeXosip2-devel
Requires: libosip2-devel
%endif
Requires: soci-devel
Requires: soci-sqlite3-devel
Requires: pkgconfig(alsa)
Requires: pkgconfig(glib-2.0)
Requires: pkgconfig(libavcodec) >= 51.0.0
Requires: pkgconfig(libswscale) >= 0.7.0
Requires: pkgconfig(speex)
# linphone-devel was last used in openSUSE Leap 42.3.
Provides: %{name}-devel = %{version}
Obsoletes: %{name}-devel < %{version}
%description -n lib%{name}-devel
Linphone is a Web phone with a Qt interface. It lets you make
two-party calls over IP networks such as the Internet. It uses the IETF
protocols SIP (Session Initiation Protocol) and RTP (Realtime TransporT
Protocol) to make calls, so it should be able to communicate with other
SIP-based Web phones. With several codecs available, it can be used
with high speed connections as well as 28k modems.
%prep
%autosetup -n liblinphone-%{version} -p1
%setup -q -n liblinphone-%{version} -D -T -a 1
%if 0%{?fedora}
# patch deprecated python open mode
sed -i "s|mode='rU'|mode='r'|" wrappers/cpp/genwrapper.py
# patch ssl sasl - extends linphone-build-jsoncpp.patch
sed -i "s|jsoncpp)|jsoncpp ssl sasl2)|g" src/CMakeLists.txt
sed -i "s|jsoncpp)|jsoncpp ssl sasl2)|g" tester/CMakeLists.txt
%endif
# patch LinphoneCore %%version
sed -i "s|project(linphone VERSION 5.2.[0-9]* LANGUAGES C CXX)|project(linphone VERSION %{version} LANGUAGES C CXX)|g" CMakeLists.txt
# patch LinphoneCore with %%LinphoneCoreVersion
# sed -i "s|project(linphone VERSION 5.2.[0-9]* LANGUAGES C CXX)|project(linphone VERSION %%{LinphoneCoreVersion} LANGUAGES C CXX)|g" CMakeLists.txt
%build
echo numberOfProcessorsOnMachine=%{numberOfProcessorsOnMachine}
echo wantedJobs=%{wantedJobs}
echo jobsIget=%{jobsIget}
%if !0%{?use_system_ldap}
#START build belledonne's libldap
mkdir aux
tar fx %{SOURCE3} -C aux
cd aux/openldap-bc
LDFLAGS="-Wl,-rpath,%ldaplibdir" ./configure \
%if 0%{?static_ldap}
--enable-static=yes \
--enable-shared=no \
--with-pic \
%else
--enable-static=no \
%endif
--enable-slapd=no \
--enable-wrappers=no \
--enable-spasswd \
--with-tls=openssl \
--with-cyrus-sasl \
--enable-crypt \
--enable-ipv6=yes \
--enable-rewrite \
--enable-slp \
--enable-lmpasswd \
--with-yielding-select \
--prefix=$PWD/.. \
--libdir=%{ldaplibdir}
make depend
make %{?_smp_mflags} -j %{jobsIget}
# do a preliminary install, because libldap is needed to build liblinphone
make install
cd ../..
#END build belledonne's libldap
#find and use belledonne's libldap
sed -i "/OPENLDAP_INCLUDE_DIRS/,/LDAP_LIB/s@\${CMAKE_INSTALL_PREFIX}@$PWD/aux@;s@\${CMAKE_INSTALL_PREFIX}@%{ldaplibdir}@;s@include/openldap@include@" cmake/FindOpenLDAP.cmake
%endif
#
# Issue in version 5.2.75
# Compilation fails with:
# ld: cannot find -ljsoncpp_lib: No such file or directory
#
# Tried this remedy without success:
#
# We get message that we need to add Findjsoncpp.cmake
# We can copy Findjsoncpp.cmake:
# cp /home/abuild/rpmbuild/SOURCES/Findjsoncpp.cmake /home/abuild/rpmbuild/BUILD/%%name-%%version/cmake/.
# or add
# /home/abuild/rpmbuild/SOURCES
# to variable CMAKE_MODULE_PATH
#
# -DCMAKE_MODULE_PATH="$CMAKE_MODULE_PATH;/home/abuild/rpmbuild/SOURCES" \
#
# -DENABLE_LDAP=OFF \
%cmake \
-DCMAKE_PREFIX_PATH="$CMAKE_PREFIX_PATH;/usr/include/jsoncpp" \
-DJSONCPP_INCLUDE_DIRS=/usr/include/jsoncpp \
-DCMAKE_BUILD_PARALLEL_LEVEL=%{jobsIget} \
-DPYTHON_EXECUTABLE="%{_bindir}/python3" \
-DENABLE_CXX_WRAPPER=ON \
%if !0%{?use_system_ldap}
%if 0%{?suse_version}
-DOPENLDAP_INCLUDE_DIRS=$PWD/../aux/include \
%else
-DOPENLDAP_INCLUDE_DIRS=$PWD/aux/include \
-DCMAKE_INSTALL_LIBDIR=lib64 \
%endif
%if 0%{?static_ldap}
-DLDAP_LIB=%{ldaplibdir}/libldap.a \
%else
-DLDAP_LIB=%{ldaplibdir}/libldap.so \
%endif
-DCMAKE_SHARED_LINKER_FLAGS="-Wl,-rpath,%{ldaplibdir},-lssl,-lcrypto,-lsasl2" \
%endif
-DENABLE_DOC=ON \
-DCMAKE_BUILD_TYPE=Release \
-DENABLE_ROOTCA_DOWNLOAD=OFF \
-DENABLE_ZRTP=ON \
-DENABLE_TOOLS=OFF \
-DENABLE_UNIT_TESTS=OFF \
-DENABLE_STRICT=OFF \
-DENABLE_STATIC=OFF \
-DENABLE_DOC=OFF \
%if 0%{?suse_version}
-DENABLE_QRCODE=OFF
%else
-DENABLE_QRCODE=ON
%endif
# -DENABLE_FLEXIAPI=OFF # This is needed by linphoneqt
# -DCMAKE_LINK_WHAT_YOU_USE=ON # Gives error
%cmake_build -j %{jobsIget}
%install
%if !0%{?use_system_ldap}
#START reinstall belledonne's libldap
cd aux/openldap-bc
make install
cd ../..
cp aux/openldap-bc/LICENSE LICENSE.openldap
#END reinstall belledonne's libldap
%endif
%cmake_install
%if !0%{?use_system_ldap}
%if !0%{?static_ldap}
#remove unnecessary files
rm %{ldaplibdir}/*.{la,so}
#fix rpath in openldap libs and make them executable
find %{ldaplibdir} -type f -exec chrpath -r %{_libexecdir}/%{name} {} \; -exec chmod a+x {} \;
#fix rpath in liblinphone
find %{buildroot}%{_libdir} -type f -name "liblinphone*" -exec chrpath -r %{_libexecdir}/%{name} {} \;
# Remove openldap pkgconfig files.
rm -r %{ldaplibdir}/pkgconfig
%else
rm -r %{ldaplibdir}
%endif
%endif
chrpath -d %{buildroot}%{_libdir}/lib%{name}.so.%{sover}* %{buildroot}%{_libdir}/lib%{name}++.so.%{sover}*
#chrpath -d %{buildroot}%{_bindir}/{linphone-daemon-pipetest,linphone-daemon,groupchat_benchmark,linphonec,linphonecsh,liblinphone_tester}
# With disabled UNIT_TESTS:
#chrpath -d %%{buildroot}%{_bindir}/{linphone-daemon-pipetest,linphone-daemon,linphonec,linphonecsh}
chrpath -d %{buildroot}%{_bindir}/{linphone-daemon-pipetest,linphone-daemon}
%if !0%{?use_system_ldap} && 0%{?fedora}
# ldaplibdir will remain in lib, disable check-buildroot for Fedora
export QA_SKIP_BUILD_ROOT=0
%endif
# Install the manual.
%if 0%{?suse_version}
mkdir -p %{buildroot}%{_datadir}/gnome/help/
cp -a %{name} %{buildroot}%{_datadir}/gnome/help/%{name}/
%find_lang %{name}
%endif
%fdupes %{buildroot}%{_datadir}/
%post -n lib%{name}%{sover} -p /sbin/ldconfig
%postun -n lib%{name}%{sover} -p /sbin/ldconfig
%post -n lib%{name}++%{sover} -p /sbin/ldconfig
%postun -n lib%{name}++%{sover} -p /sbin/ldconfig
%files cli
#%%{_bindir}/%%{name}c*
%{_bindir}/%{name}-daemon*
%files -n lib%{name}%{sover}
%{_libdir}/lib%{name}.so.%{sover}*
%if !0%{?use_system_ldap}
%if !0%{?static_ldap}
%dir %{_libexecdir}/%{name}
%{_libexecdir}/%{name}/
%endif
%endif
%if 0%{?suse_version}
%files -n lib%{name}-lang -f %{name}.lang
%dir %{_datadir}/gnome/
%dir %{_datadir}/gnome/help/
%endif
%files -n lib%{name}++%{sover}
%{_libdir}/lib%{name}++.so.%{sover}*
%files -n lib%{name}-data
%license LICENSE.txt
%if !0%{?use_system_ldap}
%license LICENSE.openldap
%endif
%doc CHANGELOG.md README.md
%{_datadir}/%{name}/
%{_datadir}/sounds/%{name}/
%{_datadir}/belr/grammars/*_grammar
%files -n lib%{name}-devel
%{_includedir}/%{name}*/
#%%{_bindir}/lib%%{name}_tester
#%%{_bindir}/groupchat_benchmark
%{_libdir}/lib%{name}.so
%{_libdir}/lib%{name}++.so
#%%{_datadir}/liblinphone_tester/
%{_libdir}/pkgconfig/%{name}.pc
#%%{_datadir}/Linphone/
%{_datadir}/LibLinphone/
%{_datadir}/LinphoneCxx/
# if -DENABLE_DOC=ON
# %%{_datadir}/doc/lib%%{name}-5.2.0/
# or
# %%{_datadir}/doc/lib%%{name}-%%{LinphoneCoreVersion}/
%changelog