File opusfile.spec of Package opusfile
%define realname opusfile
%define realver 0.12
%define srcext tar.gz
%define so_ver 0
# turn off the generation of debuginfo rpm (RH9) ??
%global debug_package %{nil}
# Common info
Name: %{realname}
Version: %{realver}
Release: wiz%{?extraver:0.}1%{?dist}
License: BSD-3-Clause
Group: System/Libraries
URL: http://opus-codec.org/
Summary: Seeking, decode, and playback of Opus streams in the Ogg container
# Build-time parameters
BuildRequires: pkg-config
BuildRequires: pkgconfig(openssl)
BuildRequires: pkgconfig(ogg) >= 1.3
BuildRequires: pkgconfig(opus) >= 1.0.1
# Documentation deps
BuildRequires: doxygen graphviz
BuildRoot: %{_tmppath}/%{name}-root
Source: https://downloads.xiph.org/releases/opus/%{realname}-%{realver}%{?extraver}.%{srcext}
%description
The opusfile library provides seeking, decode, and playback of Opus streams in
the Ogg container (.opus files) including over http(s) on posix
and windows systems.
# Library
%package -n lib%{realname}%{?so_ver}
Group: System/Libraries
Summary: High-level API for handling all Ogg Opus audio streams
Provides: libopusurl%{?so_ver} = %{version}-%{release}
Provides: lib%{realname} = %{version}-%{release}
Provides: %{realname} = %{version}-%{release}
%description -n lib%{realname}%{?so_ver}
The libopusfile package provides a convenient high-level API for decoding and
basic manipulation of all Ogg Opus audio streams. libopusfile is implemented as
a layer on top of Xiph.Org's reference libogg and libopus libraries.
libopusfile provides several sets of built-in routines for file/stream access,
and may also use custom stream I/O routines provided by the embedded
environment. There are built-in I/O routines provided for ANSI-compliant
stdio (FILE *), memory buffers, and URLs (including <file:> URLs, plus
optionally <http:> and <https:> URLs).
# Development stuff
%package -n lib%{realname}-devel
Group: Development/Languages/C and C++
Summary: Development files for %{name}
Requires: lib%{realname}%{?so_ver} = %{version}-%{release}
Provides: lib%{realname}%{?so_ver}-devel = %{version}-%{release}
Provides: libopusurl%{?so_ver}-devel = %{version}-%{release}
Provides: libopusurl-devel = %{version}-%{release}
Provides: %{name}-devel = %{version}-%{release}
Obsoletes: %{name}-devel < %{version}-%{release}
%description -n lib%{realname}-devel
Development files for %{name}
# Preparation step (unpackung and patching if necessary)
%prep
%setup -q -n %{realname}-%{realver}%{?extraver}
# Build step (compile/build binaries, documentation, etc)
%build
_CFLAGS='%{optflags} %{?gcc_lto}'
_LDFLAGS='-Wl,--as-needed -Wl,--strip-all -Wl,--no-undefined -Wl,-z,noexecstack -Wl,-z,now -Wl,-z,relro %{?gcc_lto}'
%configure \
--docdir=%{_defaultdocdir}/lib%{realname}-devel \
--disable-static \
--disable-examples \
CFLAGS="$_CFLAGS" \
CXXFLAGS="$_CFLAGS" \
LDFLAGS="$_LDFLAGS"
%{__make} %{?_smp_mflags}
# Install built stuff (into temporary root)
%install
%{__make} install DESTDIR=%{buildroot}
# Cleanup
%clean
[ "%{buildroot}" != "/" ] && rm -rf %{buildroot}
# Library
%files -n lib%{realname}%{?so_ver}
%defattr(-,root,root)
%license COPYING
%doc AUTHORS README.md
%{_libdir}/*.so.%{?so_ver}*
# Development stuff
%files -n lib%{realname}-devel
%defattr(-,root,root)
%docdir %{_defaultdocdir}/lib%{realname}-devel
%doc %{_defaultdocdir}/lib%{realname}-devel/*
%dir %{_includedir}/opus/
%{_includedir}/opus/opusfile.h
%{_libdir}/*.so
%{_libdir}/pkgconfig/*.pc
%exclude %{_libdir}/*.la
%post -n lib%{realname}%{?so_ver} -p /sbin/ldconfig
%postun -n lib%{realname}%{?so_ver} -p /sbin/ldconfig
%changelog