# -*- coding: utf-8-unix -*-
Summary: MPEG audio decoder library.
Summary(ja): MPEG オーディオ復号化ライブラリ
Name: libmad
Version: 0.15.1b
Release: 7%{?_dist_release}
Group: System Environment/Libraries
#Source: ftp://ftp.mars.org/pub/mpeg/%{name}-%{version}.tar.gz
Source: http://prdownloads.sourceforge.net/mad/%{name}-%{version}.tar.gz
URL: http://www.underbit.com/products/mad/
License: GPL
Buildroot: %{_tmppath}/%{name}-%{version}-root
BuildRequires: gcc-c++
Provides: mad = %{version}-%{release}

%description
MAD (libmad) is a high-quality MPEG audio decoder. It currently supports
MPEG-1 and the MPEG-2 extension to Lower Sampling Frequencies, as well as
the so-called MPEG 2.5 format. All three audio layers (Layer I, Layer II,
and Layer III a.k.a. MP3) are fully implemented.
 
MAD does not yet support MPEG-2 multichannel audio (although it should be
backward compatible with such streams) nor does it currently support AAC.


%package devel
Summary: Header and library for developing programs that will use libmad.
Summary(ja): labmad を使うプログラムを開発するためのライブラリ
Group: Development/Libraries
Requires: %{name} = %{version}

%description devel
MAD (libmad) is a high-quality MPEG audio decoder. It currently supports
MPEG-1 and the MPEG-2 extension to Lower Sampling Frequencies, as well as
the so-called MPEG 2.5 format. All three audio layers (Layer I, Layer II,
and Layer III a.k.a. MP3) are fully implemented.

This package contains the header file as well as the static library needed
to develop programs that will use libmad for mpeg audio decoding.


%prep
%setup -q

%__sed -i -e /-fforce-mem/d configure* # -fforce-mem gone in gcc 4.2, noop earlier
touch -r aclocal.m4 configure.ac NEWS AUTHORS ChangeLog

%__cat << EOF > mad.pc
prefix=%{_prefix}
exec_prefix=%{_prefix}
libdir=%{_libdir}
includedir=%{_includedir}

Name: mad
Description: MPEG Audio Decoder
Requires:
Version: %{version}
Libs: -L%{_libdir} -lmad -lm
Cflags: -I%{_includedir}
EOF

%build
%configure \
    --enable-accuracy \
    --disable-debugging \
    --disable-static
%__make %{?_smp_mflags} CPPFLAGS="$RPM_OPT_FLAGS"

%install
%__rm -rf $RPM_BUILD_ROOT
%__make install DESTDIR=$RPM_BUILD_ROOT
%__rm -f $RPM_BUILD_ROOT%{_libdir}/*.la
%{__install} -D -p -m 0644 mad.pc %{buildroot}%{_libdir}/pkgconfig/mad.pc
touch -r mad.h.sed %{buildroot}/%{_includedir}/mad.h

%clean
%__rm -rf %{buildroot}

%post -p /sbin/ldconfig

%postun -p /sbin/ldconfig


%files 
%defattr(-, root, root)
%doc CHANGES COPYING COPYRIGHT CREDITS README TODO
%{_libdir}/*.so.*

%files devel
%defattr(-, root, root)
%{_libdir}/*.so
%{_libdir}/pkgconfig/*.pc
%{_includedir}/*


%changelog
* Sat Mar 20 2010 Munehiro Yamamoto <munepi@vinelinux.org> 0.15.1b-7
- change release to sync with self-build-libmad

* Thu Feb 18 2010 Munehiro Yamamoto <munepi@vinelinux.org> 0.15.1b-6
- rebuild with new toolchain

* Mon Sep 07 2009 Munehiro Yamamoto <munepi@vinelinux.org> 0.15.1b-5
- changed Source0: to http://prdownloads.sourceforge.net/mad

* Tue May 26 2009 Munehiro Yamamoto <munepi@cg8.so-net.ne.jp> 0.15.1b-4
- change release to sync with self-build-libmad

* Sun Feb 08 2009 Munehiro Yamamoto <munepi@cg8.so-net.ne.jp> 0.15.1b-3
- added %%configure options: --disable-static

* Mon Sep 29 2008 Shu KONNO <owa@bg.wakwak.com> 0.15.1b-2vl5
- applied new versioning policy, spec in utf-8

* Thu Jan 03 2007 Satoshi MACHINO <machino@vinelinux.org> 0.15.1b-1vl2
- rebuilt on new toolchain

* Thu Mar 11 2004 Ryoichi INAGAKI <ryo1@bc.wakwak.com> - 0.15.1b-1vl1
- Build for Vine Linux based on freshrpms
- add Japanese summary
- add %post and %postun script

* Thu Feb 19 2004 Matthias Saou <http://freshrpms.net/> - 0.15.1b-1.fr
- Update to 0.15.1b.

* Sun Nov  2 2003 Matthias Saou <http://freshrpms.net/> - 0.15.0b-3.fr
- Rebuild for Fedora Core 1.

* Thu Aug 28 2003 Matthias Saou <matthias.saou@est.une.marmotte.net>
- Added mad.pc required by gstreamer-plugins.

* Mon Mar 31 2003 Matthias Saou <matthias.saou@est.une.marmotte.net>
- Update to 0.15.0b.
- Split a devel package.

* Mon Mar 31 2003 Matthias Saou <matthias.saou@est.une.marmotte.net>
- Rebuilt for Red Hat Linux 9.
- Added mad provides.

* Fri Sep 27 2002 Matthias Saou <matthias.saou@est.une.marmotte.net>
- Rebuild for Red Hat Linux 8.0 (missing because of license issues).
- Spec file cleanup.

* Tue Mar 12 2002 Bill Nottingham <notting@redhat.com> 0.14.2b-3
- ship libid3tag too

* Thu Feb 21 2002 Bill Nottingham <notting@redhat.com>
- rebuild

* Mon Jan 28 2002 Bill Nottingham <notting@redhat.com>
- split libmad off into a separate package

