Summary: A Compact Disc Digital Audio (CDDA) extraction tool (or ripper).
Name: cdparanoia
Version: 10.2
Release: 1%{?_dist_release}
License: GPLv2 and LGPLv2
Group: Applications/Multimedia
Source: http://www.xiph.org/paranoia/download/%{name}-III-%{version}.src.tgz 
Patch0: cdparanoia-fPIC.patch
# Patch from upstream to fix cdda_interface.h C++ incompatibility ("private")
# https://trac.xiph.org/changeset/15338
# https://bugzilla.redhat.com/show_bug.cgi?id=463009
Patch1: cdparanoia-10.2-#463009.patch
#Patch1: cdparanoia-gcc4-build.patch
URL: http://www.xiph.org/paranoia/index.html
BuildRoot: %{_tmppath}/%{name}-%{version}-root

%description
Cdparanoia (Paranoia III) reads digital audio directly from a CD, then
writes the data to a file or pipe in WAV, AIFC or raw 16 bit linear
PCM format.  Cdparanoia doesn't contain any extra features (like the ones
included in the cdda2wav sampling utility).  Instead, cdparanoia's strength
lies in its ability to handle a variety of hardware, including inexpensive
drives prone to misalignment, frame jitter and loss of streaming during
atomic reads.  Cdparanoia is also good at reading and repairing data from
damaged CDs.

%package devel
Summary: Development tools for libcdda_paranoia (Paranoia III).
Group: Development/Libraries
Requires: %{name} = %{version}
License: LGPLv2

%description devel
The cdparanoia-devel package contains the static libraries and header
files needed for developing applications to read CD Digital Audio disks.

%prep
%setup -q -n %{name}-III-%{version}
%patch1 -p3 -b .#463009
#patch0 -p1 -b .fPIC
#patch1 -p1

%build
export OPT="${CFLAGS:-%optflags} -O0 -Wno-pointer-sign -Wno-unused -Werror-implicit-function-declaration"
%configure --includedir=%{_includedir}/cdda
make OPT="$OPT"

%install
rm -rf $RPM_BUILD_ROOT

install -d $RPM_BUILD_ROOT%{_bindir}
install -d $RPM_BUILD_ROOT%{_includedir}/cdda
install -d $RPM_BUILD_ROOT%{_libdir}
install -d $RPM_BUILD_ROOT%{_mandir}/man1
install -m 0755 cdparanoia $RPM_BUILD_ROOT%{_bindir}
install -m 0644 cdparanoia.1 $RPM_BUILD_ROOT%{_mandir}/man1/ 
install -m 0644 utils.h paranoia/cdda_paranoia.h interface/cdda_interface.h \
	$RPM_BUILD_ROOT%{_includedir}/cdda
install -m 0755 paranoia/libcdda_paranoia.so.0.10.? \
	interface/libcdda_interface.so.0.10.? \
	$RPM_BUILD_ROOT%{_libdir}
install -m 0755 paranoia/libcdda_paranoia.a interface/libcdda_interface.a \
	$RPM_BUILD_ROOT%{_libdir}
install -d $RPM_BUILD_ROOT%{_mandir}/ja/man1
install -m 0644 cdparanoia.1.jp $RPM_BUILD_ROOT%{_mandir}/ja/man1/cdparanoia.1

/sbin/ldconfig -n $RPM_BUILD_ROOT/%{_libdir}

pushd $RPM_BUILD_ROOT%{_libdir}
ln -s libcdda_paranoia.so.0.10.? libcdda_paranoia.so
ln -s libcdda_interface.so.0.10.? libcdda_interface.so
popd

%post -p /sbin/ldconfig

%postun -p /sbin/ldconfig

%clean
[ "$RPM_BUILD_ROOT" != "/" -a -d "$RPM_BUILD_ROOT" ] && rm -rf "$RPM_BUILD_ROOT"

%files
%defattr(-,root,root)
%doc README COPYING-GPL COPYING-LGPL
%{_bindir}/*
%{_mandir}/man1/*
%{_mandir}/ja/man1/*
%{_libdir}/lib*.so*

%files devel
%defattr(-,root,root)
%{_includedir}/cdda
%{_libdir}/*.a

%changelog
* Sun Aug  9 2009 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 10.2-1
- new upstream release
- added Requires: cdparanoia to devel package

* Sat Aug 16 2008 Shu KONNO <owa@bg.wakwak.com> alpha9.8-9vl5
- applied new versioning policy

* Tue Jul  3 2007 AKIYAMA Kazuhito <akiyama@yb3.so-net.ne.jp> alpha9.8-8vl6
- add Patch1

* Tue Oct 17 2006 NAKAMURA Kenta <kenta@vinelinux.org> alpha9.8-8vl5
- added fPIC.patch fix a problem on x86_64 archtecture

* Fri Dec 26 2003 Ryoichi INAGAKI <ryo1@bc.wakwak.com> alpha9.8-8vl4
- rebuild with new toolchain

* Sun Mar 16 2003 IWAI Masaharu <iwai@alib.jp> alpha9.8-8vl3
- rebuild with new toolchain

* Tue Apr 24 2001 Masato Bito <masato@nets.ce.hiroshima-cu.ac.jp>
- alpha9.8-8vl2
- rebuild on VineSeed

* Tue Apr 24 2001 Masato Bito <masato@nets.ce.hiroshima-cu.ac.jp>
- alpha9.8-8vl1
- included japanese manual

* Tue Feb 27 2001 Karsten Hopp <karsten@redhat.de>
- fix spelling error in description

* Thu Dec  7 2000 Crutcher Dunnavant <crutcher@redhat.com>
- rebuild for new tree

* Fri Jul 21 2000 Trond Eivind Glomsrød <teg@redhat.com>
- use %%{_tmppath}

* Wed Jul 12 2000 Prospector <bugzilla@redhat.com>
- automatic rebuild

* Wed Jun 06 2000 Preston Brown <pbrown@redhat.com>
- revert name change
- use new rpm macro paths

* Wed Apr 19 2000 Trond Eivind Glomsrød <teg@redhat.com>
- Switched spec file from the one used in Red Hat Linux 6.2, which
  also changes the name
- gzip man page

* Thu Dec 23 1999 Peter Jones <pjones@redhat.com>
- update package to provide cdparanoia-alpha9.7-2.*.rpm and 
  cdparanoia-devel-alpha9.7-2.*.rpm.  Also, URLs point at xiph.org
  like they should.

* Wed Dec 22 1999 Peter Jones <pjones@redhat.com>
- updated package for alpha9.7, based on input from:
  Monty <xiphmont@xiph.org> 
  David Philippi <david@torangan.saar.de>

* Mon Apr 12 1999 Michael Maher <mike@redhat.com>
- updated pacakge

* Tue Oct 06 1998 Michael Maher <mike@redhat.com>
- updated package

* Mon Jun 29 1998 Michael Maher <mike@redhat.com>
- built package