File libopencore-amr.spec of Package libopencore-amr

%define realname opencore-amr
%define srcext   tar.gz

%define so_ver   0

# turn off the generation of debuginfo rpm  (RH9) ??
%global debug_package %{nil}

# Common info
Name:          lib%{realname}
Version:       0.1.6
Release:       wiz%{?extraver:0.}1%{?dist}
License:       Apache-2.0
Group:         Productivity/Multimedia/Sound/Editors and Convertors
URL:           http://sourceforge.net/projects/opencore-amr/
Summary:       Audio codecs extracted from Android Open Source Project

# Build-time parameters
#BuildRequires: autoconf automake libtool
BuildRequires: gcc-c++ pkgconfig
BuildRoot:     %{_tmppath}/%{name}-root
Source:        https://sourceforge.net/projects/opencore-amr/files/opencore-amr/%{realname}-%{version}%{?extraver}.%{srcext}

%description
Library of OpenCORE Framework implementation of Adaptive Multi Rate Narrowband
and Wideband (AMR-NB and AMR-WB) speech codec. Library of VisualOn implementation
of Adaptive Multi Rate Wideband (AMR-WB) encoder and Advanced Audio Coding (AAC)
encoder. Modified library of Fraunhofer AAC decoder and encoder.

%package -n %{name}nb%{?so_ver}
Group:         Productivity/Multimedia/Sound/Editors and Convertors
Summary:       Adaptive Multi Rate (AMR) Narrowband speech codec
Provides:      %{name}nb %{realname}-nb

%description -n %{name}nb%{?so_ver}
Implementation of the 3GPP TS 26.073 specification for
the Adaptive Multi Rate (AMR) speech codec

%package -n %{name}wb%{?so_ver}
Group:         Productivity/Multimedia/Sound/Editors and Convertors
Summary:       Adaptive Multi Rate (AMR) Wideband speech codec
Provides:      %{name}wb %{realname}-wb

%description -n %{name}wb%{?so_ver}
Implementation of the 3GPP TS 26.173 specification for
the Adaptive Multi-Rate - Wideband (AMR-WB) speech codec

%package devel
Group:         Development/Languages/C and C++
Summary:       Development files for %{name}
Requires:      %{name}nb%{?so_ver} %{name}wb%{?so_ver}
Provides:      %{name}nb%{?so_ver}-devel %{name}wb%{?so_ver}-devel
Provides:      %{realname}-nb-devel %{realname}-wb-devel

%description devel
Development files for %{name}

# Preparation step (unpackung and patching if necessary)
%prep
%setup -q -n %{realname}-%{version}%{?extraver}
test -x configure || autoreconf --force --install

%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 \
 --disable-static \
 CFLAGS="$_CFLAGS" \
 CXXFLAGS="$_CFLAGS" \
 LDFLAGS="$_LDFLAGS"
%{__make} %{?_smp_mflags}

%install
%{__make} install DESTDIR=%{buildroot}
%{__install} -m644 opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/*.h        %{buildroot}%{_includedir}/opencore-amrnb/
%{__install} -m644 opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/*.h        %{buildroot}%{_includedir}/opencore-amrnb/
%{__install} -m644 opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/*.h %{buildroot}%{_includedir}/opencore-amrnb/
%{__install} -m644 oscl/*.h                                                   %{buildroot}%{_includedir}/opencore-amrnb/
%{__ln_s} opencore-amrnb %{buildroot}%{_includedir}/amrnb
%{__ln_s} opencore-amrwb %{buildroot}%{_includedir}/amrwb
%{__ln_s} %{name}nb.so %{buildroot}%{_libdir}/libamrnb.so
%{__ln_s} %{name}wb.so %{buildroot}%{_libdir}/libamrwb.so

%clean
[ "%{buildroot}" != "/" ] && %{__rm} -rf %{buildroot}

%files -n %{name}nb%{?so_ver}
%defattr(-,root,root)
%license LICENSE
%doc README
%{_libdir}/%{name}nb.so.%{?so_ver}*

%files -n %{name}wb%{?so_ver}
%defattr(-,root,root)
%license LICENSE
%doc README
%{_libdir}/%{name}wb.so.%{?so_ver}*

# Development stuff
%files devel
%defattr(-,root,root)
%{_libdir}/pkgconfig/*.pc
%dir %{_includedir}/opencore-amrnb
%dir %{_includedir}/opencore-amrwb
%{_includedir}/amrnb
%{_includedir}/amrwb
%{_includedir}/opencore-amrnb/*.h
%{_includedir}/opencore-amrwb/*.h
%{_libdir}/*.so
%exclude %{_libdir}/*.la
%if 0%{?suse_version} && ! 0%{?sles_version}
%exclude %{_libdir}/*.a
%endif

%post   -n %{name}nb%{?so_ver} -p /sbin/ldconfig
%post   -n %{name}wb%{?so_ver} -p /sbin/ldconfig
%postun -n %{name}nb%{?so_ver} -p /sbin/ldconfig
%postun -n %{name}wb%{?so_ver} -p /sbin/ldconfig

%changelog
openSUSE Build Service is sponsored by