%define realname libdca
%define realver  0.0.5
%define srcext   tar.bz2

%define so_ver   0

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

# Common info
Name:          %{realname}%{?so_ver}
Version:       %{realver}
Release:       1.14%{?dist}
License:       GPL-2.0
Group:         System/Libraries
URL:           http://www.videolan.org/developers/libdca.html
Summary:       Free DTS Coherent Acoustics decoder

# Install-time parameters
Provides:      %{realname}

# Build-time parameters
BuildRequires: pkgconfig
%if 0%{?suse_version}
BuildRequires: fdupes
%endif
BuildRoot:     %{_tmppath}/%{name}-root
Source:        http://download.videolan.org/pub/videolan/%{realname}/%{realver}/%{realname}-%{realver}%{?extraver}.%{srcext}

%description
libdca is a free library for decoding DTS Coherent Acoustics streams. It is
released under the terms of the GPL license. The DTS Coherent Acoustics
standard is used in a variety of applications, including DVD, DTS audio CD and
radio broadcasting.

%package -n %{realname}-devel
Group:         Development/Languages/C and C++
Summary:       Development files for %{name}
Requires:      %{name} = %{version}
Provides:      %{name}-devel

%description -n %{realname}-devel
Development files for %{name}

# Preparation step (unpackung and patching if necessary)
%prep
%setup -q -n %{realname}-%{realver}%{?extraver}

%build
%configure \
 CFLAGS="%{optflags}" \
 CXXFLAGS="%{optflags}" \
 LDFLAGS="-Wl,--as-needed -Wl,--strip-all"
%{__make} %{?_smp_mflags}

%install
%{__make} install DESTDIR=%{buildroot}
%if 0%{?suse_version}
%fdupes %{buildroot}%{_bindir}
%endif

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

%files
%defattr(-,root,root)
%doc AUTHORS COPYING NEWS README
%{_bindir}/*
%{_libdir}/%{realname}.so.%{?so_ver}*
%doc %{_mandir}/man1/*

# Development stuff
%files -n %{realname}-devel
%defattr(-,root,root)
%doc doc/libdca.txt
%{_libdir}/pkgconfig/libdca.pc
%{_libdir}/pkgconfig/libdts.pc
%{_includedir}/dca.h
%{_includedir}/dts.h
%{_libdir}/%{realname}.so
%exclude %{_libdir}/*.a
%exclude %{_libdir}/*.la

%post   -p /sbin/ldconfig
%postun -p /sbin/ldconfig

%changelog
* Tue Aug 19 2014 aevseev@gmail.com
- New upstream version - 0.0.5