##
## disable gsm for Vine Linux
%define nogsm 1
## disable libmad
%define nomad 1

Summary:     A general purpose sound file conversion tool.
Summary(ja): 汎用サウンドファイル変換ツール
Name: sox
Version: 14.3.2
Release: 1%{?_dist_release}
License: LGPL
Group: Applications/Multimedia
Source:  http://prdownloads.sourceforge.net/sox/sox-%{version}.tar.bz2
URL: http://sox.sourceforge.net/
BuildRoot: %{_tmppath}/%{name}-%{version}-root

BuildRequires: alsa-lib-devel
BuildRequires: pulseaudio-lib-devel
Build%{?nomad:Conflicts}%{!?nomad:Requires}: libmad-devel
Build%{?nogsm:Conflicts}%{!?nogsm:Requires}: gsm-devel


%description
SoX (Sound eXchange) is a sound file format converter for Linux, UNIX
and DOS PCs. The 'Swiss Army knife of sound tools,' SoX can convert
between many different digitized sound formats and perform simple
sound manipulation functions, including sound effects.

%description -l ja
SoX (Sound eXchange) は Linux, UNIX, DOS PC 用サウンドファイルフォーマット
変換ツールです．SoX は「サウンドツール界のスイスアーミーナイフ」で，
様々なデジタルサウンドフォーマットを相互に変換したり，
簡単なサウンドエフェクト等の処理も行うことが出来ます．


%package -n  sox-devel
Summary: The SoX sound file format converter libraries.
Summary(ja): SoX サウンドファイル変換ライブラリ
Group: Development/Libraries

%description -n sox-devel 
This package contains the library needed for compiling applications
which will use the SoX sound file format converter.

Install sox-devel if you want to develop applications which will use
SoX.

%description -n sox-devel -l ja
このパッケージには SoX サウンドファイルフォーマット変換ツールを
利用するアプリケーションをコンパイルするのに必要なライブラリが
収められています．

SoX を利用するプログラムを開発する場合は sox-devel パッケージを
インストールして下さい．


%prep
%setup -q 

%build
%configure \
	--disable-static \
	--includedir=%{_includedir}/sox \
%{!?nogsm: --with-gsm}
make 


%install
rm -rf $RPM_BUILD_ROOT

mkdir -p $RPM_BUILD_ROOT%{_bindir}
mkdir -p $RPM_BUILD_ROOT%{_libdir}
mkdir -p $RPM_BUILD_ROOT%{_mandir}/man1/
mkdir -p $RPM_BUILD_ROOT%{_mandir}/man3/

make install DESTDIR=$RPM_BUILD_ROOT

echo "#!/bin/sh" > $RPM_BUILD_ROOT%{_bindir}/soxplay
echo "" >> $RPM_BUILD_ROOT%{_bindir}/soxplay
echo '%{_bindir}/sox $1 -t .au - > /dev/audio' >> $RPM_BUILD_ROOT%{_bindir}/soxplay
chmod 755 $RPM_BUILD_ROOT%{_bindir}/soxplay

strip $RPM_BUILD_ROOT%{_bindir}/sox

ln -snf play $RPM_BUILD_ROOT%{_bindir}/rec
rm -f $RPM_BUILD_ROOT%{_mandir}/man1/rec.1
ln -snf play.1 $RPM_BUILD_ROOT%{_mandir}/man1/rec.1
ln -snf sox.1 $RPM_BUILD_ROOT%{_mandir}/man1/soxmix.1

mkdir -p $RPM_BUILD_ROOT%{_includedir}/sox
install -m 644 src/*.h $RPM_BUILD_ROOT%{_includedir}/sox

find $RPM_BUILD_ROOT -name '*.la' -exec rm -f {} \;


%clean
rm -rf $RPM_BUILD_ROOT

%post -p /sbin/ldconfig

%postun -p /sbin/ldconfig

%files
%defattr(-,root,root)
%doc Changelog README TODO INSTALL
%{_bindir}/*
%{_libdir}/libsox.so.*
%{_mandir}/man1/*

%files -n sox-devel
%defattr(-,root,root)
%{_includedir}/*
%{_libdir}/libsox.so
%{_libdir}/pkgconfig/sox.pc
%{_mandir}/man3/*
%{_mandir}/man7/*


%changelog
* Sat Nov 05 2011 Yoji TOYODA <owa@bg.wakwak.com> 14.3.2-1
- new upstream release
- add BuildRequires: pulseaudio-lib-devel

* Sun Apr 17 2011 Shu KONNO <owa@bg.wakwak.com> 12.18.1-2
- rebuilt with rpm-4.8.1-3

* Sat Aug 16 2008 Shu KONNO <owa@bg.wakwak.com> 12.18.1-1vl5
- applied new versioning policy, spec in utf-8

* Fri Apr 06 2007 MATSUBAYASHI Kohji <shaolin@vinelinux.org> 12.18.1-0vl3
- fix installing play.1 man page (<BTS:510>)
- add BuildRequires: alsa-lib-devel (alsa stuffs are now in main repo)

* Mon Sep 04 2006 Daisuke SUZUKI <daisuke@linux.or.jp> 12.18.1-0vl2
- add "%%define nomad 1" to disable libmad dependency

* Sun Aug 25 2006 NAKAMURA Kenta <kenta@vinelinux.org> 12.18.1-0vl1
- new upstream release
- dropped sox-vorberr.patch and sox-CAN-2004-0557.patch

* Wed Aug 25 2004 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 12.17.3-12vl2
- add patch for buffer overflow in wav code (CAN-2004-0557, #128158)
- fixed %files section

* Thu Jul  3 2003 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 12.17.3-12vl1
- based on 12.17.3-12 from Rawhide
- rebuild with new toolchains
- to use License tag instead of Copyright
- fix License (from distributable to LGPL)

* Fri Jan 12 2001 MATSUBAYASHI 'Shaolin' Kohji <shaolin@rhythmaning.org>
- 12.17.1-1vl1
- based on 12.17.1-1 from Rawhide
- use better macros (%%{_bindir}, %%{_libdir}, %%{_includedir})
- added Japanese summary and description
- disable gsm stuff for Vine Linux

* Tue Jan  2 2001 Bill Nottingham <notting@redhat.com>
- re-enable gsm stuff
- update to 12.17.1

* Fri Dec 01 2000 Bill Nottingham <notting@redhat.com>
- rebuild because of broken fileutils

* Mon Nov 13 2000 Bill Nottingham <notting@redhat.com>
- update to 12.17
- yank out gsm stuff

* Tue Aug  7 2000 Bill Nottingham <notting@redhat.com>
- fix playing of sounds on cards that don't support mono

* Sat Aug  5 2000 Bill Nottingham <notting@redhat.com>
- fix playing of sounds on cards that don't support 8-bit

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

* Thu Feb 03 2000 Bill Nottingham <notting@redhat.com>
- fix manpage link the Right Way(tm)

* Thu Feb 03 2000 Bernhard Rosenkraenzer <bero@redhat.com>
- Fix rec manpage link - now that man pages are compressed, it should point to
  play.1.gz, not play.1

* Wed Feb 02 2000 Cristian Gafton <gafton@redhat.com>
- fix description

* Tue Sep 28 1999 Bill Nottingham <notting@redhat.com>
- Grrr. Arrrrgh. Fix link.

* Fri Sep 24 1999 Bill Nottingham <notting@redhat.com>
- add some more files to devel

* Fri Sep 17 1999 Bill Nottingham <notting@redhat.com>
- fix link

* Fri Jul 30 1999 Bill Nottingham <notting@redhat.com>
- update to 12.16

* Sun Mar 21 1999 Cristian Gafton <gafton@redhat.com> 
- auto rebuild in the new build environment (release 4)

* Wed Jan 20 1999 Bill Nottingham <notting@redhat.com>
- allow spaces in filenames for play/rec

* Wed Dec  9 1998 Bill Nottingham <notting@redhat.com>
- fix docs

* Mon Nov 23 1998 Bill Nottingham <notting@redhat.com>
- update to 12.15

* Sat Oct 10 1998 Michael Maher <mike@redhat.com>
- fixed broken spec file

* Mon Jul 13 1998 Michael Maher <mike@redhat.com>
- updated source from Chris Bagwell.

* Wed Jun 23 1998 Michael Maher <mike@redhat.com>
- made patch to fix the '-e' option. BUG 580
- added buildroot

* Fri May 08 1998 Prospector System <bugs@redhat.com>
- translations modified for de, fr, tr

* Thu Nov 06 1997 Erik Troan <ewt@redhat.com>
- built against glibc
