#
# Spec file for NVIDIA X server module and OpenGL libraries.
#
# /usr/X11R6 is relocatable.
#
# $Header: //sw/OEM/nvr40_linux_4490/drivers/NVIDIA_GLX.spec#1 $
#
%define RELEASE 4496
%define rel	%{?CUSTOM_RELEASE} %{!?CUSTOM_RELEASE:%RELEASE}
%define ver     1.0

Summary: NVIDIA module for XFree86 4.0 X server and OpenGL libraries
Name: 		NVIDIA_GLX
Version: 	%ver
Release: 	%rel
Copyright: 	NVIDIA Corp. 2000
Group: 		User Interface/X Hardware Support
Source: 	ftp://ftp1.detonator.nvidia.com/pub/drivers/english/XFree86_40/NVIDIA_GLX-%{ver}-%{RELEASE}.tar.gz
URL: 		http://www.nvidia.com
Vendor: 	NVIDIA Corp.
Packager: 	Buildmeister
Prefix:		/usr/X11R6
Requires: 	XFree86 >= 4.0.1
Requires:	NVIDIA_kernel
Requires:	kernel > 2.2.0
BuildRoot:	%{_tmppath}/%{name}-%{PACKAGE_VERSION}

# disable build root strip policy
# XFree86 drivers may NOT be stripped...
%define __spec_install_post /usr/lib/rpm/brp-compress
%define debug_package %{nil}

%description
NVIDIA Architecture support for Common X and OpenGL for all Linux systems.
NVIDIA XFree86 4.0 server module and OpenGL 1.2 libraries for RIVA TNT/TNT2
and GeForce/Quadro based video cards.  Older RIVA 128 based video cards are
supported by the server module shipping with XFree86 4.0, nv_drv.o. You
should install this package if you have one of the newer cards.

You must also install the NVIDIA_kernel module if you want to utilize these
drivers.

%prep
%setup -q -n ${RPM_PACKAGE_NAME}-${RPM_PACKAGE_VERSION}-${RPM_PACKAGE_RELEASE}

%build

%install
DSOMAJOR=1
DSOMINOR=0
DSOPATCH=4496
DSOREV=$DSOMAJOR.$DSOMINOR.$DSOPATCH

[ -n "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != / ] && rm -rf $RPM_BUILD_ROOT
mkdir -p $RPM_BUILD_ROOT/usr/X11R6/lib/modules/drivers
mkdir -p $RPM_BUILD_ROOT/usr/X11R6/lib/modules/extensions
mkdir -p $RPM_BUILD_ROOT/usr/lib

install usr/X11R6/lib/modules/drivers/nvidia_drv.o      $RPM_BUILD_ROOT/usr/X11R6/lib/modules/drivers/nvidia_drv.o
install usr/X11R6/lib/modules/extensions/libglx.so.$DSOREV $RPM_BUILD_ROOT/usr/X11R6/lib/modules/extensions/libglx.so.$DSOREV
install usr/X11R6/lib/libXvMCNVIDIA.a $RPM_BUILD_ROOT/usr/X11R6/lib/libXvMCNVIDIA.a
install usr/X11R6/lib/libXvMCNVIDIA.so.$DSOREV $RPM_BUILD_ROOT/usr/X11R6/lib/libXvMCNVIDIA.so.$DSOREV
install usr/lib/libGLcore.so.$DSOREV $RPM_BUILD_ROOT/usr/lib/libGLcore.so.$DSOREV
install usr/lib/libGL.so.$DSOREV  $RPM_BUILD_ROOT/usr/lib/libGL.so.$DSOREV
ln -sf libGL.so.$DSOREV $RPM_BUILD_ROOT/usr/lib/libGL.so.$DSOMAJOR

%post
DSOMAJOR=1
DSOMINOR=0
DSOPATCH=4496
DSOREV=$DSOMAJOR.$DSOMINOR.$DSOPATCH

/sbin/ldconfig
/sbin/ldconfig -n /usr/X11R6/lib/modules/extensions
/sbin/ldconfig -n /usr/X11R6/lib

%postun

/sbin/ldconfig

%clean
[ -n "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != / ] && rm -rf $RPM_BUILD_ROOT

%files
%defattr (-, root, root)
%doc usr/share/doc/README
%doc usr/share/doc/README.DE
%doc usr/share/doc/license.txt
%doc usr/share/doc/NVIDIA_Changelog 
%doc usr/share/doc/XF86Config.sample
# Install these headers in the doc dir so as not to destroy the installed 
# headers but still give the user the option to use them
%doc usr/include
/usr/X11R6/lib/modules/drivers/nvidia_drv.o
/usr/X11R6/lib/modules/extensions/libglx.so.1.0.4496
%attr (0644, root, root) /usr/X11R6/lib/libXvMCNVIDIA.a
/usr/X11R6/lib/libXvMCNVIDIA.so.1.0.4496
/usr/lib/libGLcore.so.1.0.4496
/usr/lib/libGL.so.1.0.4496
/usr/lib/libGL.so.1

%changelog
* Sat Oct 25 2003 Sjoerd Mullender <sjoerd@acm.org>
- Simplified and updated to work with Fedora Core 1.

* Mon May 13 2002 George Kyriazis <kyriazis@nvidia.com>
- Install libXvMCNVIDIA.so, too.

* Mon Mar 4 2002 Joseph Kain <jkain@nvidia.com>
- Install README.DE

* Tue Feb 26 2002 Joseph Kain <jkain@nvidia.com>
- libXvMCNVIDIA.so is now libXvMCNVIDIA.a

* Thu Feb 21 2002 George Kyriazis <kyriazis@nvidia.com>
- Added libXvMCNVIDIA.so 

* Sat Feb 16 2002 Joseph Kain <jkain@nvidia.com>
- Protect against missing directories, specifically 
  /usr/X11R6/lib/modules/extensions

* Mon Nov 26 2001 Joseph Kain <jkain@nvidia.com>
- Install license file

* Mon Nov 26 2001 Joseph Kain <jkain@nvidia.com>
- Use %{_tmppath} instead of hardcoding /var/tmp

* Wed Mar 28 2001 Joseph Kain <jkain@nvidia.com>
- Stop renaming our own old libraries with xxx.*.rpmsave
- Detect uninstall case to restore saved Mesa libs and remove extra symlinks
- added gl.h and glx.h

* Mon May  1 2000 George Kyriazis <kyriazis@nvidia.com>
- Fixed installation of revisions of shared libraries.

* Thu Apr 27 2000 Gregory McLean <gregm@comstar.net>
- Added BuildRoot definition.
- Added some logic to deal with the two most common problems.
- Added the FAQ.
- Added logic for epoc builds if needed.

