Skip to main content

Build libopus RPMs for CentOS 7

This procedure will build RPMs for both libopus and libopus-devel. This was initially written for version 1.1.1 but in fact by updating the version number has been tested until 1.1.3.

Use a opus.spec file like (note the version appears twice):

Name:          opus
Version: 1.1.1
Release: 2%{?dist}
Summary: An audio codec for use in low-delay speech and audio communication
Group: System Environment/Libraries
License: BSD
URL: http://www.opus-codec.org/
Source0: opus-1.1.1.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)

%description
The Opus codec is designed for interactive speech and audio transmission over
the Internet. It is designed by the IETF Codec Working Group and incorporates
technology from Skype's SILK codec and Xiph.Org's CELT codec.

%package devel
Summary: Development package for opus
Group: Development/Libraries
Requires: libogg-devel
Requires: opus = %{version}-%{release}

%description devel
Files for development with opus.

%prep

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


%build

%configure --enable-custom-modes --disable-static
make %{?_smp_mflags} V=1

%install
rm -rf %{buildroot}
make install DESTDIR=%{buildroot}

# Remove libtool archives and static libs
find %{buildroot} -type f -name "*.la" -delete
rm -rf %{buildroot}%{_datadir}/doc/opus/html

%check
make check

%clean
rm -rf %{buildroot}

%post -p /sbin/ldconfig


%postun -p /sbin/ldconfig

%files
%defattr(-,root,root,-)
%{_libdir}/libopus.so.*

%files devel
%defattr(-,root,root,-)
%{_includedir}/opus
%{_libdir}/libopus.so
%{_libdir}/pkgconfig/opus.pc
%{_datadir}/aclocal/opus.m4

%changelog

Then:

yum install -y rpmdevtools libogg-devel gcc make wget
rpmdev-setuptree
cd ~/rpmbuild/SOURCES
# Check the right version
wget http://downloads.xiph.org/releases/opus/opus-1.1.1.tar.gz
# Check the right version
cp opus.spec ~/rpmbuild/SPECS/opus.spec
cd ~/rpmbuild/SPECS
rpmbuild -v -bb opus.spec

RPMs will be in ~/rpmbuild/RPMS/x86_64/

Have libopus-devel installed where FreeSWITCH is built, and only libopus outside of a development environment.