File nvidia-gfxG02.spec of Package nvidia-gfxG02
#
# spec file for package nvidia-gfxG02
#
# Copyright (c) 2011 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
Name: nvidia-gfxG02
Version: 290.10
Release: 0
License: PERMISSIVE-OSI-COMPLIANT
Summary: NVIDIA graphics driver kernel module for GeForce 6xxx and newer GPUs
Group: System/Kernel
Source0: http://download.nvidia.com/XFree86/Linux-x86/%{version}/NVIDIA-Linux-x86-%{version}.run
Source1: http://download.nvidia.com/XFree86/Linux-x86_64/%{version}/NVIDIA-Linux-x86_64-%{version}.run
Source3: preamble
Source4: pci_ids-%{version}
Source5: pci_ids-%{version}.new
Source6: fetch.sh
Source7: README
Source8: kmp-filelist
Source9: kmp-filelist-old
Source10: kmp-post.sh
Source11: kmp-post-old.sh
Source12: my-find-supplements
NoSource: 0
NoSource: 1
NoSource: 6
NoSource: 7
Patch1: nv-fix-xen.diff
Patch4: NVIDIA_kernel-1.0-9625-NOSMBUS.diff.txt
Patch5: NVIDIA_kernel-2.6.25.diff
Patch6: conftest.sh.diff
Patch7: no-xen-sanity-check.diff
Patch8: conftest.sh.diff.xen-11.1-i586
Patch9: conftest.sh.diff.xen-11.0
BuildRequires: kernel-source
BuildRequires: kernel-syms
BuildRequires: module-init-tools
BuildRoot: %{_tmppath}/%{name}-%{version}-build
ExclusiveArch: %ix86 x86_64
# patch the kmp template
%if 0%{?suse_version} > 1100
%define kmp_template -t
%define kmp_filelist kmp-filelist
%define kmp_post kmp-post.sh
%else
%define kmp_template -s
%define kmp_filelist kmp-filelist-old
%define kmp_post kmp-post-old.sh
%endif
%if 0%{?suse_version} > 1010
%define kmp_template_name /usr/lib/rpm/kernel-module-subpackage
%else
%define kmp_template_name /usr/lib/rpm/rpm-suse-kernel-module-subpackage
%endif
%(sed '/^%%post\>/ r %_sourcedir/%kmp_post' %kmp_template_name >%_builddir/nvidia-kmp-template)
%define kver %(rpm -q --qf '%%{VERSION}' kernel-source|perl -ne '/(\\d+)\\.(\\d+)\\.(\\d+)?/&&printf "%%d%%02d%%02d\\n",$1,$2,$3')
%if %kver >= 20627
%if %kver < 20631
%define x_flavors kdump um debug
%else
%define x_flavors kdump um debug xen
%endif
%else
%define x_flavors kdump um debug xen
%endif
%kernel_module_package %kmp_template %_builddir/nvidia-kmp-template -p %_sourcedir/preamble -f %_sourcedir/%kmp_filelist -x %x_flavors
# supplements no longer depend on the driver
%if 0%{?suse_version} > 1100
%define pci_id_file %_sourcedir/pci_ids-%version
%else
%define pci_id_file %_sourcedir/pci_ids-%version.new
%endif
# rpm 4.9+ using the internal dependency generators
%define __ksyms_supplements %_sourcedir/my-find-supplements %pci_id_file %name
# older rpm
%define __find_supplements %_sourcedir/my-find-supplements %pci_id_file %name
%description
NVIDIA graphics driver kernel module for GeForce 6xxx and newer GPUs
%package KMP
License: PERMISSIVE-OSI-COMPLIANT
Summary: NVIDIA graphics driver kernel module for GeForce 6xxx and newer GPUs
Group: System/Kernel
%description KMP
NVIDIA graphics driver kernel module for GeForce 6xxx and newer GPUs
%prep
echo "kver = %kver"
%setup -T -c %{name}-%{version}
%ifarch %ix86
sh %{SOURCE0} -x
%endif
%ifarch x86_64
sh %{SOURCE1} -x
%endif
#rm -rf NVIDIA-Linux-x86*-%{version}-*/usr/src/nv/precompiled
mkdir -p source/%{version}
cp NVIDIA-Linux-x86*-%{version}/kernel/* source/%{version} || :
pushd source/%{version}
# mark support as external
echo "nvidia.ko external" > Module.supported
ln -s Makefile.kbuild Makefile
patch -p3 -s < %{PATCH4}
### Bug 123456
#sed -i /0x1234/d %_sourcedir/pci_ids-%{version}
#sed -i /0x1234/d %_sourcedir/pci_ids-%{version}.new
#cat >> %_sourcedir/pci_ids-%{version} << EOF
#0x2345 0x2345
#EOF
#cat >> %_sourcedir/pci_ids-%{version}.new << EOF
#0x2345 0x2345
#EOF
chmod 755 %_sourcedir/my-find-supplements*
patch -p1 -s < %{PATCH1}
%patch5
%if 0%{?suse_version} < 1020
%patch6
%endif
%patch7
popd
mkdir obj
%build
export EXTRA_CFLAGS='-DVERSION=\"%{version}\"'
%if 0%{?suse_version} <= 1020
export SYSSRC=/usr/src/linux
%endif
for flavor in %flavors_to_build; do
rm -rf obj/$flavor
cp -r source obj/$flavor
%if 0%{?suse_version} > 1030
%if 0%{?suse_version} > 1100
%ifarch %ix86
if [ "$flavor" == "xen" ]; then
patch -d obj/xen/%{version} -p0 -s < %{PATCH8}
fi
%endif
%else
if [ "$flavor" == "xen" ]; then
patch -d obj/xen/%{version} -p0 -s < %{PATCH9}
fi
%endif
%endif
make -C /usr/src/linux-obj/%_target_cpu/$flavor modules M=$PWD/obj/$flavor/%{version} SYSSRC=/usr/src/linux SYSOUT=/usr/src/linux-obj/%_target_cpu/$flavor
pushd $PWD/obj/$flavor/%{version}
make -f Makefile.kbuild nv-linux.o SYSSRC=/usr/src/linux SYSOUT=/usr/src/linux-obj/%_target_cpu/$flavor
popd
done
%install
export INSTALL_MOD_PATH=%{buildroot}
export INSTALL_MOD_DIR=updates
export SYSSRC=/usr/src/linux
for flavor in %flavors_to_build; do
make -C /usr/src/linux-obj/%_target_cpu/$flavor modules_install M=$PWD/obj/$flavor/%{version}
install -m 644 $PWD/obj/$flavor/%{version}/{nv-linux.o,nv-kernel.o} \
%{buildroot}/lib/modules/*-$flavor/updates
done
mkdir -p %{buildroot}%{_sysconfdir}/modprobe.d
for flavor in %flavors_to_build; do
echo "blacklist nouveau" > %{buildroot}%{_sysconfdir}/modprobe.d/nvidia-$flavor.conf
done
%changelog