%define build_compat32 %{?_with_compat32:1}%{!?_with_compat32:0}

Summary:	Library of simple functions optimized for various CPUs
Name:		liboil
Version:	0.3.14
Release:	3%{?_dist_release}
License:	LGPL
Group:		System Environment/Libraries
URL:		http://liboil.freedesktop.org/

Source:		http://liboil.freedesktop.org/download/liboil-%{version}.tar.gz
Patch10:        %{name}-0.3.8-altivec.patch

BuildRoot:	%{_tmppath}/%{name}-%{version}-root
BuildRequires:	glib2-devel

%description
Liboil is a library of simple functions that are optimized for various CPUs.
These functions are generally loops implementing simple algorithms, such as
converting an array of N integers to floating-point numbers or multiplying
and summing an array of N numbers. Such functions are candidates for
significant optimization using various techniques, especially by using
extended instructions provided by modern CPUs (Altivec, MMX, SSE, etc.).

%package devel
Summary:	Development files and static library for liboil
Group:		Development/Libraries
Requires:	%{name} = %{version}-%{release}

%description devel
Liboil is a library of simple functions that are optimized for various CPUs.
These functions are generally loops implementing simple algorithms, such as
converting an array of N integers to floating-point numbers or multiplying
and summing an array of N numbers. Such functions are candidates for
significant optimization using various techniques, especially by using
extended instructions provided by modern CPUs (Altivec, MMX, SSE, etc.).

This package contains vevelopment files and static library for liboil.

# compat32
%package -n compat32-%{name}
Summary:	Library of simple functions optimized for various CPUs
Group:		System Environment/Libraries

%description -n compat32-%{name}
Liboil is a library of simple functions that are optimized for various CPUs.
These functions are generally loops implementing simple algorithms, such as
converting an array of N integers to floating-point numbers or multiplying
and summing an array of N numbers. Such functions are candidates for
significant optimization using various techniques, especially by using
extended instructions provided by modern CPUs (Altivec, MMX, SSE, etc.).

%package -n compat32-%{name}-devel
Summary:	Development files and static library for liboil
Group:		Development/Libraries
Requires:	compat32-%{name} = %{version}-%{release}
Requires:	%{name}-devel = %{version}-%{release}

%description -n compat32-%{name}-devel
Liboil is a library of simple functions that are optimized for various CPUs.
These functions are generally loops implementing simple algorithms, such as
converting an array of N integers to floating-point numbers or multiplying
and summing an array of N numbers. Such functions are candidates for
significant optimization using various techniques, especially by using
extended instructions provided by modern CPUs (Altivec, MMX, SSE, etc.).

This package contains vevelopment files and static library for liboil.

%prep
%setup -q
%ifarch ppc
%patch10 -p1
%endif

%build
%configure
%__make

%install
%__rm -rf %{buildroot}
%makeinstall

# remove .a and .la
rm -f $RPM_BUILD_ROOT%{_libdir}/*.a
rm -f $RPM_BUILD_ROOT%{_libdir}/*.la

%clean
%__rm -rf %{buildroot}

%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 NEWS README
%{_libdir}/*.so.*

%files devel
%defattr(-,root,root)
%{_datadir}/gtk-doc/html/liboil
%{_includedir}/*
%{_libdir}/*.so
#{_libdir}/*.a
%{_libdir}/pkgconfig/*.pc

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

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

%changelog
* Sun Oct 03 2010 Shu KONNO <owa@bg.wakwak.com> 0.3.14-3
- rebuilt with rpm-4.8.1 for pkg-config

* Sun May 10 2009 NAKAMURA Kenta <kenta@vinelinux.org> 0.3.14-2vl5
- added compat32 package for x86_64 arch support
- removed static library from devel package

* Fri Mar 21 2008 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 0.3.14-1vl5
- new upstream release

* Wed Sep 12 2007 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 0.3.12-0vl1
- new upstream release

* Sat Mar 25 2006 MATSUBAYASHI Kohji <shaolin@vinelinux.org> 0.3.8-0vl2
- added Patch10 (ad-hoc) for ppc
  (this problem might be originally due to gcc-3.3.6's bug)

* Fri Mar 24 2006 Daisuke SUZUKI <daisuke@linux.or.jp> 0.3.8-0vl1
- new upstream release
- remove .la

* Fri Jan 20 2006 KAZUKI SHIMURA <kazuki@ma.ccnw.ne.jp> 0.3.6-0vl1
- initial build
