Name:		openal
Summary:	Open Audio Library
Summary(ja):	オープンオーディオライブラリ
Version:	0.0.8
Release:	3%{?_dist_release}
Epoch:		1
Source:		openal-%{version}.tar.gz
Patch0:		openal-0.0.8-mmx_off.patch

Group:		System Environment/Libraries
License:	LGPL
URL:		http://www.openal.org

BuildRoot:	%{_tmppath}/%{name}-%{version}-root
BuildRequires: alsa-lib-devel
BuildRequires: arts-devel
BuildRequires: esound-devel
BuildRequires: libvorbis-devel
BuildRequires: SDL-devel
#BuildRequires: automake, autoconf
Obsoletes: libopenal0, libopenal0-devel

%description
OpenAL is a free 3D-audio library, with a programming interface similar
to that of OpenGL.

%package devel
Summary: Headers for developing programs that will use OpenAL
Group: Development/Libraries
Requires: %{name} = %{epoch}:%{version}

%description devel
This package contains the headers that programmers will need to develop
applications which will use OpenAL, a free 3D audio library.

%prep
%setup -q

## adhoc patch for disable MMX with gcc4
%ifarch x86_64
%patch0 -b1 -b .mmx_off
%endif

%build
%configure --disable-static
%__make %{?_smp_mflags}


%install
rm -rf $RPM_BUILD_ROOT
make DESTDIR=$RPM_BUILD_ROOT install
mkdir -p $RPM_BUILD_ROOT%{_infodir}

install -m 755 -d $RPM_BUILD_ROOT%{_sysconfdir}
cat > $RPM_BUILD_ROOT%{_sysconfdir}/openalrc <<EOF
(define devices '(alsa native))

;; uncomment this to output via the 2nd soundcard
;;(define alsa-device "plughw:2,0")
EOF

sed -i 's/^Requires:.*//g' $RPM_BUILD_ROOT%{_libdir}/pkgconfig/openal.pc

# remove uninstalled files
rm -f $RPM_BUILD_ROOT%{_libdir}/*.la

%clean
rm -rf $RPM_BUILD_ROOT

%post -p /sbin/ldconfig

%postun -p /sbin/ldconfig

%files
%defattr(-,root,root,0755)
%{_sysconfdir}/openalrc
%{_libdir}/*.so.*

%files devel
%defattr(-,root,root,0755)
%{_bindir}/openal-config
%{_includedir}/AL/*.h
%{_libdir}/*.so
#{_libdir}/*.a
%{_libdir}/pkgconfig/openal.pc

%changelog
* Tue Sep 28 2010 Shu KONNO <owa@bg.wakwak.com> 1:0.0.8-3
- added openal-0.0.8-mmx_off.patch (on x86_64)
  (see http://lists.debian.org/debian-devel-games/2007/10/msg00031.html)

* Sun Sep 26 2010 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 1:0.0.8-2
- rebuilt with rpm-4.8.1 for pkg-config 
- removed static libraries from devel package

* Mon Sep 29 2008 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 1:0.0.8-1vl5
- applied new versioning policy
- spec in UTF-8

* Sat Jul 07 2007 Daisuke SUZUKI <daisuke@linux.or.jp> 1:0.0.8-0vl1
- new upstream release
- add epoch to use upstream version numbering

* Sat Oct 22 2005 Daisuke SUZUKI <daisuke@linux.or.jp> 1.1.20051022-0vl1
- initial build for Vine Linux