%define moduledir %(pkg-config xorg-server --variable=moduledir )
%define driverdir	%{moduledir}/drivers
%define gputoolsdate 20090908

Summary:   Xorg X11 Intel video driver
Summary(ja):   Xorg X11 Intel ビデオドライバ
Name:      xorg-x11-drv-intel
Epoch:     1
Version:   2.14.0
Release:   1%{?_dist_release}
URL:       http://www.x.org
License:   MIT
Group:     User Interface/X Hardware Support

Source0:   http://xorg.freedesktop.org/archive/individual/driver/xf86-video-intel-%{version}.tar.bz2 
Source2:   intel.xinf
Source3:   intel-gpu-tools-%{gputoolsdate}.tar.bz2

#Patch1: kill-svideo.patch

#Patch2: intel-2.11.0-copy-fb.patch

# patches from fedora - needs to be upstreamed

# backported

ExclusiveArch: %{ix86} x86_64 ia64
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
BuildRequires: autoconf, automake, libtool
BuildRequires: xorg-x11-server-sdk >= 1.7.99
BuildRequires: libXvMC-devel
BuildRequires: libGL-devel >= 7.10
BuildRequires: libdrm-devel >= 2.4.23
BuildRequires: kernel-headers >= 2.6.33
BuildRequires: libudev-devel
BuildRequires: libxcb-devel >= 1.5
BuildRequires: xcb-util-devel

Requires:  hwdata
Requires:  xorg-x11-server-Xorg
Requires:  xcb-util

Obsoletes: xorg-x11-drv-i810
Provides: xorg-x11-drv-i810

#Conflicts:  kudzu < 1.2.42-1

%description 
X.Org X11 Intel video driver.

%package devel
Summary:   Xorg X11 Intel video driver XvMC development package
Summary(ja):   Xorg X11 Intel ビデオドライバ XvMC 開発パッケージ
Group:     Development/System
Requires:  %{name} = %{epoch}:%{version}-%{release}
Provides:  xorg-x11-drv-intel-devel = %{version}-%{release}

%description devel
X.Org X11 Intel video driver XvMC development package.

%package -n intel-gpu-tools
Summary:    Debugging tools for Intel graphics chips
Group:      Development/Tools

%description -n intel-gpu-tools
Debugging tools for Intel graphics chips


%prep
%setup -q -n xf86-video-intel-%{version} -b3

#%patch1 -p1 -b .svideo
#patch2 -p1 -b .copy-fb

%build
autoreconf -vi

%configure \
  --disable-static --libdir=%{_libdir} --mandir=%{_mandir} \
  --enable-dri --enable-xvmc
make

pushd ../intel-gpu-tools-%{gputoolsdate}
autoreconf -v --install
%configure
make
popd


%install
rm -rf $RPM_BUILD_ROOT

make install DESTDIR=$RPM_BUILD_ROOT
mkdir -p $RPM_BUILD_ROOT%{_datadir}/hwdata/videoaliases
install -m 0644 %{SOURCE2} $RPM_BUILD_ROOT%{_datadir}/hwdata/videoaliases/

pushd ../intel-gpu-tools-%{gputoolsdate}
make install DESTDIR=$RPM_BUILD_ROOT
popd


find $RPM_BUILD_ROOT -regex ".*\.la$" | xargs rm -f --

%clean
rm -rf $RPM_BUILD_ROOT

%triggerpostun -- XOrg < 7.0
if (grep -q i810 /etc/X11/xorg.conf)
then
  cp /etc/X11/xorg.conf /etc/X11/xorg.conf.rpmsave
  sed -i -e 's/"i810"/"intel"/g' /etc/X11/xorg.conf
fi ||:

%files
%defattr(-,root,root,-)
%{driverdir}/intel_drv.so
%{_datadir}/hwdata/videoaliases/intel.xinf
%{_libdir}/libI810XvMC.so.*
%{_libdir}/libIntelXvMC.so.*
%{_mandir}/man4/i*

%files devel
%defattr(-,root,root,-)
%{_libdir}/libI810XvMC.so
%{_libdir}/libIntelXvMC.so

%files -n intel-gpu-tools
%defattr(-,root,root,-)
%{_bindir}/intel_*
%{_mandir}/man1/intel_*.1*


%changelog
* Fri Jan 28 2011 Daisuke SUZUKI <daisuke@linux.or.jp> 1:2.14.0-1
- new upstream release

* Wed Nov 24 2010 Daisuke SUZUKI <daisuke@linux.or.jp> 1:2.13.0-1
- new upstream release

* Sun Nov 07 2010 Yoji TOYODA <bsyamato@sea.plala.or.jp> 1:2.12.0-2
- rebuild with xserver-1.9.2

* Tue Aug 17 2010 Daisuke SUZUKI <daisuke@linux.or.jp> 1:2.12.0-1
- new upstream release
- add Patch40: fix uxa planemask (backported)
- add Patch61: add support for backlight on macbooks
- add Patch62: disable page flipping for stability

* Tue Mar 30 2010 Daisuke SUZUKI <daisuke@linux.or.jp> 1:2.11.0-1
- new upstream release
- drop patch70

* Thu Mar 25 2010 Daisuke SUZUKI <daisuke@linux.or.jp> 1:2.10.0-3
- rebuild again with xserver-1.8rc

* Thu Mar 11 2010 Daisuke SUZUKI <daisuke@linux.or.jp> 1:2.10.0-2
- add intel-gpu-tools as sub-package
- rebuild with libdrm-2.4.18

* Mon Mar 08 2010 Daisuke SUZUKI <daisuke@linux.or.jp> 1:2.10.0-1
- new upstream release
- import Patch1,2,60,70 from fedora
- add BR: kernel-headers >= 2.6.33 (new drm header required)
- add BR: xcb-util-devel, libxcb-devel and R: xcb-util fot XvMC client
- add BR; libudev-devel and autoreconf for Patch60

* Mon Jan 04 2010 Daisuke SUZUKI <daisuke@linux.or.jp> 1:2.9.1-2
- rebuild with libdrm-2.4.17

* Thu Nov 19 2009 Daisuke SUZUKI <daisuke@linux.or.jp> 1:2.9.1-1
- new upstream release

* Sat Oct 10 2009 MATSUBAYASHI Kohji <shaolin@vinelinux.org> 1:2.9.0-1
- new upstream release (hopefully fixes severe issues w/ efifb)
- drop all patches already upstreamed; import Patch20/21 from Fedora

* Fri Jul 24 2009 Daisuke SUZUKI <daisuke@linux.or.jp> 1:2.6.3-3
- import Patch121,122 from ubuntu
- build with libdrm-2.4.12 which fixes vt switch crash

* Fri Jul 17 2009 Daisuke SUZUKI <daisuke@linux.or.jp> 1:2.6.3-2
- apply patch114 to fix Xv with non-GEM kernel

* Mon May 11 2009 Daisuke SUZUKI <daisuke@linux.or.jp> 1:2.6.3-1
- update to 2.6.3
- add patch106,107,115,118,119,120 from ubuntu
  - add Patch106: remove triple buffering
  - add Patch107: remove page flipping
  - add Patch115: fix crash Xv overlay
  - add Patch118: drop legacy3d
  - add Patch119: fix crashes in drm bo
  - add Patch120: fix vt switch
- add patch130-134 from upstream git
  - add Patch130: fix another vt switch leak
  - add Patch131: Create known output configuration at EnterVT time
  - add Patch132: fix leak of some 965 render state on VT switch
  - add Patch133: fix crash with fake bufmgr and UXA
  - add Patch134: fix EnterVT/LeaveVT
  - add Patch135: add new chip supoprt


* Sat May 02 2009 Daisuke SUZUKI <daisuke@linux.or.jp> 1:2.6.1-2
- revert to 2.6.1, add Epoch
- add Patch103-121 from ubuntu

* Fri May 01 2009 Daisuke SUZUKI <daisuke@linux.or.jp> 2.7.0-1
- new upstream release

* Sun Mar 22 2009 Daisuke SUZUKI <daisuke@linux.or.jp> 2.6.1-1
- new upstream release

* Sun Nov 23 2008 Daisuke SUZUKI <daisuke@linux.or.jp> 2.5.1-1
- new upstream release

* Wed Oct 22 2008 Daisuke SUZUKI <daisuke@linux.or.jp> 2.5.0-2
- add Patch5 - Dont die on irq handler failure

* Tue Oct 21 2008 Daisuke SUZUKI <daisuke@linux.or.jp> 2.5.0-1
- new upstream release
- add BR: libdrm-devel >= 2.4.0-3

* Sat Sep 06 2008 Daisuke SUZUKI <daisuke@linux.or.jp> 2.4.2-2
- import Patch10,11,12 from ubuntu

* Wed Sep 03 2008 Daisuke SUZUKI <daisuke@linux.or.jp> 2.4.2-1
- new upstream release
- add triggerpostun script to replace i810 driver to intel driver

* Fri Aug 15 2008 Daisuke SUZUKI <daisuke@linux.or.jp> 2.4.1-1
- new upstream release

* Wed Jul 23 2008 Daisuke SUZUKI <daisuke@linux.or.jp> 2.4.0-1
- new upstream release
- rename i810.xinf to intel.xinf
- update intel.xinf (add Intel 4 series)

* Sun Jul 06 2008 Daisuke SUZUKI <daisuke@linux.or.jp> 2.3.2-2
- rebuild with new xserver

* Sat Jun 21 2008 Daisuke SUZUKI <daisuke@linux.or.jp> 2.3.2-1
- new upstream release

* Wed May 14 2008 Daisuke SUZUKI <daisuke@linux.or.jp> 2.3.1-1
- new upstream release

* Mon May 12 2008 Daisuke SUZUKI <daisuke@linux.or.jp> 2.2.1-1
- new upstream release

* Wed Jan 23 2008 Daisuke SUZUKI <daisuke@linux.or.jp> 2.2.0-0vl1
- initial build for Vine Linux

* Wed Jan 09 2008 Adam Jackson <ajax@redhat.com> 2.2.0-3
- Rebuild for new server ABI.
- intel-2.2.0-alloca.patch: Fix use of {DE,}ALLOCATE_LOCAL.

* Mon Dec 10 2007 Dave Airlie <airlied@redhat.com> 2.2.0-2
- hook up ch7017 (bz#408471)

* Tue Nov 27 2007 Adam Jackson <ajax@redhat.com> 2.2.0-1
- xf86-video-intel 2.2.0

* Tue Nov 13 2007 Adam Jackson <ajax@redhat.com> 2.1.99-1
- xf86-video-intel 2.1.99.
- Drop the i810 driver.  Time to move on.
- Require xserver 1.4.99.1

* Wed Oct 17 2007 Dave Airlie <airlied@redhat.com> 2.1.1-7
- intel-2.1.1-fix-xv-compiz.patch - update to not crash is we can't get RAM

* Wed Oct 17 2007 Dave Airlie <airlied@redhat.com> 2.1.1-6
- intel-2.1.1-fix-xv-compiz.patch - Real dirty hack to allocate 4MB of RAM
  for textured Xv to use as an offscreen pixmap so xv actually works under
  compiz - granted it may be unusably slow but at least stuff shows up.

* Mon Oct 15 2007 Dave Airlie <airlied@redhat.com> 2.1.1-5
- intel-2.1.1-fix-vt-switch.patch - Only restore paletter regs on enabled pipes
- intel-2.1.1-fix-xv-reset.patch - Reset XV after mode switch

* Fri Oct 05 2007 Dave Airlie <airlied@redhat.com> 2.1.1-4
- intel-2.1.1-quirk-update.patch - update quirks from master

* Mon Aug 20 2007 Adam Jackson <ajax@redhat.com> 2.1.1-3
- i810.xinf: Flip everything over to -intel by default now.  Still install
  i810 driver just in case.

* Wed Aug 15 2007 Dave Airlie <airlied@redhat.com> 2.1.1-2
- intel-2.1.1-fix-texoffset-start.patch - shouldn't set texoffsetstart when not using EXA

* Tue Aug 14 2007 Dave Airlie <airlied@redhat.com> 2.1.1-1
- xf86-video-intel 2.1.1.

* Tue Jul 03 2007 Adam Jackson <ajax@redhat.com> 2.1.0-1
- xf86-video-intel 2.1.0.

* Mon Jun 18 2007 Adam Jackson <ajax@redhat.com> 2.0.0-5
- Update Requires and BuildRequires.

* Wed Jun 06 2007 Adam Jackson <ajax@redhat.com> 2.0.0-4
- Update to git master.  Many Xv and DVO fixes.  Adds support for 945GME,
  965GME, G33, Q33, and Q35 chips.

* Mon May 14 2007 Adam Jackson <ajax@redhat.com> 2.0.0-3
- intel-2.0-vblank-power-savings.patch: Disable vblank interrupts when no
  DRI clients are active, for better battery life.

* Tue May 01 2007 Adam Jackson <ajax@redhat.com> 2.0.0-2
- Rebuild for final RANDR 1.2 ABI.  Fixes segfault at startup. (#238575)

* Mon Apr 23 2007 Adam Jackson <ajax@redhat.com> 2.0.0-1
- xf86-video-intel 2.0.0.  Change the version number to match, why not.
- Add a Virtual provides for xorg-x11-drv-intel, since we should probably
  rename this at some point.

* Tue Apr 10 2007 Adam Jackson <ajax@redhat.com> 1.6.5-19
- i810.xinf: Move all 965 and 945 chips onto the new driver, as well as
  915GM.

* Thu Apr 05 2007 Adam Jackson <ajax@redhat.com> 1.6.5-18
- i810.xinf: More intel whitelisting (#214011, #234877)

* Wed Apr 04 2007 Adam Jackson <ajax@redhat.com> 1.6.5-17
- xf86-video-intel-1.9.94 (RC4).  Adds support for 965GM.
- i810.xinf: Point 965GM support at the intel driver since it's not present
  in old i810.

* Fri Mar 30 2007 Adam Jackson <ajax@redhat.com> 1.6.5-16
- xf86-video-intel-1.9.93 (RC3).

* Tue Mar 27 2007 Jeremy Katz <katzj@redhat.com> - 1.6.5-15
- fix typo with 945GM pci id from my laptop

* Thu Mar 22 2007 Adam Jackson <ajax@redhat.com> 1.6.5-14
- xf86-video-intel 1.9.92 (RC2).

* Mon Mar 05 2007 Adam Jackson <ajax@redhat.com> 1.6.5-13
- Updated modesetting driver to one that will actually work with a 1.3 server.

* Tue Feb 27 2007 Adam Jackson <ajax@redhat.com> 1.6.5-12
- Nuke %%with_dri, since the arch list exactly matched the ExclusiveArch list
- Remove ivch and ch7017 from the install since they aren't hooked up to the
  code anywhere
- Disown the module

* Tue Jan 30 2007 Jeremy Katz <katzj@redhat.com> - 1.6.5-11
- update modesetting driver to git snapshot from today

* Tue Nov 7 2006 Adam Jackson <ajackson@redhat.com> 1.6.5-10
- i965-xv-hang-fix.patch: Backport Xv hang fix for G965.

* Sun Oct 01 2006 Jesse Keating <jkeating@redhat.com> - 1.6.5-9
- rebuilt for unwind info generation, broken in gcc-4.1.1-21

* Fri Sep 22 2006 Adam Jackson <ajackson@redhat.com> 1.6.5-8.fc6
- Change 'Requires: kudzu >= foo' to 'Conflicts: kudzu < foo' since we don't
  actually require kudzu to run.

* Fri Sep 15 2006 Adam Jackson <ajackson@redhat.com> 1.6.5-7.fc6
- i810.xinf: Whitelist Apple 945GM machines and Aopen Mini PC onto intel(4)

* Tue Sep 12 2006 Adam Jackson <ajackson@redhat.com> 1.6.5-6.fc6
- i810-1.6.5-to-git-20060911.patch: Backport post-1.6.5 fixes from git.
- i810-match-server-sync-ranges.patch: Make a terrible heuristic in the
  driver match the corresponding terrible heuristic in the server.

* Mon Aug 28 2006 Adam Jackson <ajackson@redhat.com> 1.6.5-5.fc6
- intel-945gm-lfp-blacklist.patch: Tweak the Apple blacklist to (hopefully)
  correctly distinguish between Mac Mini and Macbook Pro.

* Mon Aug 21 2006 Adam Jackson <ajackson@redhat.com> 1.6.5-4.fc6
- i810.xinf: PCI IDs for i965.

* Thu Aug 17 2006 Adam Jackson <ajackson@redhat.com> 1.6.5-3.fc6
- i810.xinf: Uppercase PCI IDs.

* Fri Aug 10 2006 Adam Jackson <ajackson@redhat.com> 1.6.5-2.fc6
- Update i810 to 1.6.5, should fix DRI.
- Add kuzdu requires.
- i810.xinf: Start whitelisting devices over to intel.

* Wed Aug  9 2006 Adam Jackson <ajackson@redhat.com> 1.6.4-3.fc6
- intel-driver-rename.patch: Fix the driver name in more places so it'll,
  you know, load.

* Wed Aug  9 2006 Adam Jackson <ajackson@redhat.com> 1.6.4-2.fc6
- intel-945gm-lfp-blacklist.patch: At anholt's suggestion, remove the other
  LFP special casing in favor of the blacklist.

* Wed Aug  9 2006 Adam Jackson <ajackson@redhat.com> 1.6.4-1.fc6
- Admit defeat, kinda.  Package both i810 stable and modesetting drivers.
  The modesetting driver is installed as intel_drv.so instead of i810_drv.so,
  and is selected with Driver "intel" in xorg.conf.  Individual devices will
  whitelist over to "intel" until that branch gets merged into head.
- Update the stable branch driver to 1.6.4 from upstream, adds i965 support.
- intel-945gm-lfp-blacklist.patch: Blacklist LFP detection on machines where
  the BIOS is known to lie.

* Tue Aug  8 2006 Adam Jackson <ajackson@redhat.com> 1.6.0-14.20060808modeset.fc6
- Today's snapshot: I2C bus creation fix.

* Wed Aug  2 2006 Adam Jackson <ajackson@redhat.com> 1.6.0-13.20060717modeset.fc6
- intel-prune-by-edid-pixclock.patch: Honor the EDID-reported maximum pixel
  clock when computing the modes list.
- intel-virtual-sizing-bogon.patch: Don't interpret the size of the display
  in centimeters as the size of the display in pixels.

* Mon Jul 24 2006 Adam Jackson <ajackson@redhat.com> 1.6.0-12.20060717modeset.fc6
- Disable spread-spectrum LVDS, various crash and hang fixes, saner output
  probing.

* Thu Jul 13 2006 Adam Jackson <ajackson@redhat.com> 1.6.0-11.20060713modeset.fc6
- Update again for a mode comparison bugfix.

* Thu Jul 13 2006 Adam Jackson <ajackson@redhat.com> 1.6.0-10.20060713modeset.fc6
- Update to today's git; crash fixes, better pre-915 support, slightly better
  autoconfigurability.

* Wed Jul 12 2006 Jesse Keating <jkeating@redhat.com> 1.6.0-9.20060707modeset.1.fc6
- rebuild

* Tue Jul 11 2006 Adam Jackson <ajackson@redhat.com> 1.6.0-9.20060707modeset
- Fix Revision number to match naming policy.

* Tue Jul 11 2006 Kristian H淡gsberg <krh@redhat.com> 1.6.0-8.modeset20060707
- Add back modesetting changes.

* Mon Jul 10 2006 Kristian H淡gsberg <krh@redhat.com> 1.6.0-7
- Roll back modesetting changes and build for fc5 aiglx repo.

* Fri Jul  7 2006 Adam Jackson <ajackson@redhat.com> 1.6.0-6.modeset20060707
- Snapshot of the git modesetting branch.

* Fri Jul  7 2006 Adam Jackson <ajackson@redhat.com> 1.6.0-6
- Update i810.xinf to include entries for E7221 and 945GM.

* Fri Jun 23 2006 Mike A. Harris <mharris@redhat.com> 1.6.0-5
- Add with_dri macro to spec file, and conditionalize build time DRI support

* Fri May 26 2006 Mike A. Harris <mharris@redhat.com> 1.6.0-4
- Added "BuildRequires: libdrm >= 2.0-1" for (#192334), and updated sdk dep
  to pick up proto-devel as well.

* Tue May 23 2006 Adam Jackson <ajackson@redhat.com> 1.6.0-3
- Rebuild for 7.1 ABI fix.

* Tue Apr 11 2006 Kristian H淡gsberg <krh@redhat.com> 1.6.0-2
- Bump for fc5-bling build.

* Sun Apr 09 2006 Adam Jackson <ajackson@redhat.com> 1.6.0-1
- Update to 1.6.0 from 7.1RC1.

* Tue Apr 04 2006 Kristian H淡gsberg <krh@redhat.com> 1.4.1.3-4.cvs20060322.1
- Add patch to add missing #include's, specifically assert.h.

* Wed Mar 22 2006 Kristian H淡gsberg <krh@redhat.com> 1.4.1.3-4.cvs20060322
- Update to CVS snapshot of 20060322.

* Tue Feb 07 2006 Jesse Keating <jkeating@redhat.com> 1.4.1.3-3.1
- rebuilt for new gcc4.1 snapshot and glibc changes

* Sat Feb 04 2006 Mike A. Harris <mharris@redhat.com> 1.4.1.3-3
- Added 8086:2772 mapping to i810.xinf for bug (#178451)

* Fri Feb 03 2006 Mike A. Harris <mharris@redhat.com> 1.4.1.3-2
- Added 8086:2592 mapping to i810.xinf for bug (#172884)

* Wed Jan 18 2006 Mike A. Harris <mharris@redhat.com> 1.4.1.3-1
- Updated xorg-x11-drv-i810 to version 1.4.1.3 from X11R7.0

* Tue Dec 20 2005 Mike A. Harris <mharris@redhat.com> 1.4.1.2-1
- Updated xorg-x11-drv-i810 to version 1.4.1.2 from X11R7 RC4
- Removed 'x' suffix from manpage dirs to match RC4 upstream.

* Wed Nov 16 2005 Mike A. Harris <mharris@redhat.com> 1.4.1-1
- Updated xorg-x11-drv-i810 to version 1.4.1 from X11R7 RC2

* Fri Nov 04 2005 Mike A. Harris <mharris@redhat.com> 1.4.0.1-1
- Updated xorg-x11-drv-i810 to version 1.4.0.1 from X11R7 RC1
- Fix *.la file removal.
- Added 'devel' subpackage for XvMC .so
- Added 'BuildRequires: libXvMC-devel' for XvMC drivers.

* Mon Oct 03 2005 Mike A. Harris <mharris@redhat.com> 1.4.0-1
- Update BuildRoot to use Fedora Packaging Guidelines.
- Deglob file manifest.
- Limit "ExclusiveArch" to x86, x86_64, ia64

* Fri Sep 02 2005 Mike A. Harris <mharris@redhat.com> 1.4.0-0
- Initial spec file for i810 video driver generated automatically
  by my xorg-driverspecgen script.
