%define demodir %{_libdir}/mesa

Summary: Mesa demos
Summary(ja): Mesa demos
Name: mesa-demos
Version: 8.2.0
Release: 1%{?_dist_release}
License: MIT
Group: System Environment/Libraries
URL: http://www.mesa3d.org

Source0: %{name}-%{version}.tar.bz2

Patch0: mesa-demos-8.0.1-legal.patch
Patch1: mesa-demos-as-needed.patch

BuildRequires: pkgconfig autoconf automake libtool
BuildRequires: freeglut-devel
BuildRequires: libGL-devel
BuildRequires: libGLU-devel
BuildRequires: glew-devel

Group: Development/Libraries

%description
This package provides some demo applications for testing Mesa.

%package -n glx-utils
Summary: GLX utilities
Summary(ja): GLX ユーティリティ
Group: Development/Libraries

%description -n glx-utils
The glx-utils package provides the glxinfo and glxgears utilities.

%prep
%setup -q
%patch0 -p1 -b .legal
%patch1 -p1 -b .asneeded

# These two files are distributable, but non-free (lack of permission to modify).
rm -rf src/demos/pointblast.c
rm -rf src/demos/spriteblast.c

%build
autoreconf -i
%configure --bindir=%{demodir}  --with-system-data-files
make %{?_smp_mflags}

%install
rm -rf $RPM_BUILD_ROOT
make install DESTDIR=$RPM_BUILD_ROOT

mkdir -p $RPM_BUILD_ROOT%{_bindir}
install -m 0755 src/xdemos/glxgears $RPM_BUILD_ROOT%{_bindir}
install -m 0755 src/xdemos/glxinfo $RPM_BUILD_ROOT%{_bindir}

%clean
rm -rf $RPM_BUILD_ROOT

%check

%files
%defattr(-,root,root,-)
%{demodir}
%{_datadir}/%{name}

%files -n glx-utils
%defattr(-,root,root,-)
%{_bindir}/glxinfo
%{_bindir}/glxgears

%changelog
* Thu Oct 15 2015 Yoji TOYODA <bsyamato@sea.plala.or.jp> 8.2.0-1
- update to 8.2.0
- add Patch0,1 from fedora

* Tue Jan 10 2012 Yoji TOYODA <bsyamato@sea.plala.or.jp> 8.0.1-2
- rebuild with glew-1.7.0

* Fri Jan 28 2011 Daisuke SUZUKI <daisuke@linux.or.jp> 8.0.1-1
- initial build for Vine Linux

* Mon Nov 01 2010 Adam Jackson <ajax@redhat.com> 7.10-3.20101028
- Install rgba images too (#640688)

* Sat Oct 30 2010 Dave Airlie <airlied@redhat.com> 7.10-2.20101028
- fix install of gears/info (#647947)

* Thu Oct 28 2010 Adam Jackson <ajax@redhat.com> 7.10-1.20101028
- Today's git snapshot
- Arbitrary EVR bump to be newer than when the mesa source package dropped
  the demos subpackage.

* Tue Jun 15 2010 Jerome Glisse <jglisse@redhat.com> 7.7
- Initial build.