%define build_compat32 %{?_with_compat32:1}%{!?_with_compat32:0}
%define OCT_SITE_D %{_datadir}/octave/site/m

Summary: A library to handle various audio file formats.
Summary(ja): さまざまなフォーマットの音声ファイルを扱うライブラリ
Name: libsndfile
Version: 1.0.25
Release: 1%{?_dist_release}
Source: http://www.mega-nerd.com/libsndfile/%{name}-%{version}.tar.gz
License: LGPL
Group: System Environment/Libraries
URL: http://www.mega-nerd.com/libsndfile/

# security fix
# Patch100: libsndfile-1.0.16_CVE-2007-4974.patch
# Patch110: libsndfile-1.0.20_fix-dev-by-zero.patch
Patch100: libsndfile-1.0.21_CVE-2011-2696.patch

Requires: alsa-lib
BuildRequires: alsa-lib-devel
BuildRoot: %{_tmppath}/%{name}-%{version}-root

Vendor: Project Vine
Distribution: Vine Linux

%description
libsndfile is a C library for reading and writing sound files such as
AIFF, AU and WAV files through one standard interface. It can currently
read/write 8, 16, 24 and 32-bit PCM files as well as 32-bit floating
point WAV files and a number of compressed formats.

%description -l ja
libsndfile is a C library for reading and writing sound files such as
AIFF, AU and WAV files through one standard interface. It can currently
read/write 8, 16, 24 and 32-bit PCM files as well as 32-bit floating
point WAV files and a number of compressed formats.


%package devel
Summary: Libraries, includes, etc to develop libsndfile applications
Group: Development/Libraries
Requires: %{name} = %{version}-%{release}

%description devel
Libraries, include files, etc you can use to develop libsndfile applications.

%description devel -l ja
Libraries, include files, etc you can use to develop libsndfile applications.


# compat32
%package -n compat32-%{name}
Summary: A library to handle various audio file formats.
Summary(ja): さまざまなフォーマットの音声ファイルを扱うライブラリ
Group: System Environment/Libraries

%description -n compat32-%{name}
libsndfile is a C library for reading and writing sound files such as
AIFF, AU and WAV files through one standard interface. It can currently
read/write 8, 16, 24 and 32-bit PCM files as well as 32-bit floating
point WAV files and a number of compressed formats.

%description -n compat32-%{name} -l ja
libsndfile is a C library for reading and writing sound files such as
AIFF, AU and WAV files through one standard interface. It can currently
read/write 8, 16, 24 and 32-bit PCM files as well as 32-bit floating
point WAV files and a number of compressed formats.


%package -n compat32-%{name}-devel
Summary: Libraries, includes, etc to develop libsndfile applications
Group: Development/Libraries
Requires: compat32-%{name} = %{version}-%{release}
Requires: %{name}-devel = %{version}-%{release}

%description -n compat32-%{name}-devel
Libraries, include files, etc you can use to develop libsndfile applications.

%description -n compat32-%{name}-devel -l ja
Libraries, include files, etc you can use to develop libsndfile applications.


%prep
%setup -q 

# security fix
# %patch100 -p1 -b .CVE-2007-4974
# %patch110 -p0 -b .dev-by-zero
%patch100 -p1 -b .CVE-2011-2696

%build
%configure --disable-sqlite --disable-external-libs --disable-octave
%__make %{?_smp_mflags}

%install
rm -rf $RPM_BUILD_ROOT
# htmldir=$RPM_BUILD_ROOT\$\(htmldocdir\) libsndfile1-dev
%makeinstall \
  htmldir=$RPM_BUILD_ROOT%{_datadir}/doc/libsndfile1-dev 

rm -rf html
cp -pr $RPM_BUILD_ROOT%{_datadir}/doc/libsndfile1-dev html
rm -rf $RPM_BUILD_ROOT%{_datadir}/doc/libsndfile1-dev

rm -f $RPM_BUILD_ROOT%{_libdir}/lib*.{a,la}

%clean
rm -rf $RPM_BUILD_ROOT

%post -p /sbin/ldconfig

%postun -p /sbin/ldconfig

%post -n compat32-%{name} -p /sbin/ldconfig

%postun -n compat32-%{name} -p /sbin/ldconfig


%files
%defattr(-,root,root)
%doc AUTHORS COPYING ChangeLog INSTALL NEWS README html
%{_libdir}/libsndfile.so.*
%{_bindir}/*
%{_mandir}/man1/*
# %{_datadir}/octave/site/m/*

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

# compat32
%if %{build_compat32}
%files -n compat32-%{name}
%defattr(-,root,root)
%{_libdir}/libsndfile.so.*

%files -n compat32-%{name}-devel
%defattr(-,root,root)
%{_libdir}/libsndfile.so
%{_libdir}/pkgconfig/sndfile.pc
%endif


%changelog
* Mon Apr 29 2013 Toshiharu Kudoh <toshi.kd2@gmail.com> - 1.0.25-1
- new upstream release

* Sun Jul 31 2011 Satoshi IWAMOTO <satoshi.iwamoto@nifty.ne.jp> - 1.0.21-3
- change spec filename (-vl)

* Sat Jul 30 2011 Satoshi IWAMOTO <satoshi.iwamoto@nifty.ne.jp> - 1.0.21-2
- add patch100 for fix CVE-2011-2696 (IOF) from debian, thanks.

* Wed Sep 22 2010 MATSUBAYASHI Kohji <shaolin@vinelinux.org> - 1.0.21-1
- new upstream release
- built with rpm-4.8.1-1

* Mon Jun  1 2009 Satoshi IWAMOTO <satoshi.iwamoto@nifty.ne.jp> 1.0.20-1vl5
- new upstream release with security fix (CVE-2009-1788, 1791)
- add patch110 to fix devide by 0 issues
- drop patch100 (is included in new release)
- change configure option to fix new release
- revome "TODO" file from file list

* Sun May 10 2009 NAKAMURA Kenta <kenta@vinelinux.org> 1.0.17-3
- added compat32 package for x86_64 arch support

* Tue Mar 31 2009 Daisuke SUZUKI <daisuke@linux.or.jp> 1.0.17-2
- spec in utf-8
- remove static lib

* Sat Jul 12 2008 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 1.0.17-1vl5
- applied new versioning policy
- removed lib*.la file from devel package

* Mon Oct 22 2007 Satoshi IWAMOTO <satoshi.iwamoto@nifty.ne.jp> 1.0.17-0vl2
- rebuild for VineSeed

* Mon Oct 22 2007 Satoshi IWAMOTO <satoshi.iwamoto@nifty.ne.jp> 1.0.17-0vl1
- new upstream release

* Mon Oct 22 2007 Satoshi IWAMOTO <satoshi.iwamoto@nifty.ne.jp> 1.0.16-0vl3.1
- add patch100 for fix CVE-2007-4974 (PCM Data Handling Buffer Overflow)
- built for VinePlus 4.x

* Fri Nov 17 2006 KAZUKI SHIMURA <kazuki@ma.ccnw.ne.jp> 1.0.16-0vl3
- add BuildRequires: alsa-lib-devel
- add '--disable-sqlite --disable-flac' options to %%configure

* Mon May 01 2006 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 1.0.16-0vl2
- rebuilt for VineSeed Plus

* Mon May 01 2006 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 1.0.16-0vl1
- new upstream release
- fixed Japanese summary

* Wed Feb 08 2006 Atsushi SHICHI <ats7@a.email.ne.jp> 1.0.13-1vl1
- initial build for VinePlus/3.0
- modified spec file

* Sun May 15 2005 Erik de Castro Lopo <erikd@mega-nerd.com>
- Add html files to the files section.

* Tue Sep 16 2003 Erik de Castro Lopo <erikd@mega-nerd.com>
- Apply corrections from Andrew Schultz.

* Mon Oct 21 2002 Erik de Castro Lopo <erikd@mega-nerd.com>
- Force installation of sndfile.pc file.

* Thu Jul 6 2000 Josh Green <jgreen@users.sourceforge.net>
- Created libsndfile.spec.in


# end of file