%define _kmodver %(echo `uname -r`)
%define _kernver %(echo `uname -r |sed 's/\.i.*//'`)
%define _kver %(echo `uname -r |awk -F '.' '{print $3}'`)
Name: ati-fglrx
Version: 8.881
Release: k%{_kver}.1%{dist}
Summary: ati-fglrx graphic driver
License: GPL
Source0: ati-driver-installer-11-8-x86.x86_64.run
Source1: blacklist-fglrx.conf
BuildRoot: %{_tmppath}/%{name}-%{version}-buildroot
BuildRequires: module-init-tools coreutils
BuildRequires: kernel = %{_kernver}
BuildRequires: kernel-devel = %{_kernver}
BuildRequires: kernel-headers = %{_kernver}
%description
package for ati graphics driver
%prep
rm -rf %{name}-%{version}
sh %{SOURCE0} --extract %{name}-%{version}
%build
export IGNORE_CC_MISMATCH=1
pushd %{name}-%{version}
cp arch/x86/lib/modules/fglrx/build_mod/libfglrx_ip.a common/lib/modules/fglrx/build_mod/
popd
pushd %{name}-%{version}/common/lib/modules/fglrx/build_mod/
sh make.sh
popd
%install
rm -rf %{buildroot}
pushd %{name}-%{version}
mkdir -p %{buildroot}/lib/modules/%{_kmodver}/kernel/drivers/video/
cp common/lib/modules/fglrx/build_mod/2.6.x/fglrx.ko %{buildroot}/lib/modules/%{_kmodver}/kernel/drivers/video/
mkdir -p %{buildroot}/etc/modprobe.d
cp %{SOURCE1} %{buildroot}/etc/modprobe.d/
mkdir -p %{buildroot}/etc/ati/
cp common/etc/ati/amdpcsdb.default %{buildroot}/etc/ati/
cp common/etc/ati/atiogl.xml %{buildroot}/etc/ati/
cp common/etc/ati/authatieventsd.sh %{buildroot}/etc/ati/
cp common/etc/ati/control %{buildroot}/etc/ati/
cp common/etc/ati/logo_mask.xbm.example %{buildroot}/etc/ati/
cp common/etc/ati/logo.xbm.example %{buildroot}/etc/ati/
cp common/etc/ati/signature %{buildroot}/etc/ati/
mkdir -p %{buildroot}/etc/security/console.apps/
cp common/etc/security/console.apps/amdcccle-su %{buildroot}/etc/security/console.apps/
mkdir -p %{buildroot}/usr/lib/
cp arch/x86/usr/X11R6/lib/libAMDXvBA.cap %{buildroot}/usr/lib/
cp arch/x86/usr/X11R6/lib/libAMDXvBA.so.1.0 %{buildroot}/usr/lib/
cp arch/x86/usr/X11R6/lib/libatiadlxx.so %{buildroot}/usr/lib/
cp arch/x86/usr/X11R6/lib/libfglrx_dm.a %{buildroot}/usr/lib/
cp arch/x86/usr/X11R6/lib/libfglrx_dm.so.1.0 %{buildroot}/usr/lib/
cp arch/x86/usr/X11R6/lib/libXvBAW.so.1.0 %{buildroot}/usr/lib/
cp arch/x86/usr/lib/libaticalcl.so %{buildroot}/usr/lib/
cp arch/x86/usr/lib/libaticaldd.so %{buildroot}/usr/lib/
cp arch/x86/usr/lib/libaticalrt.so %{buildroot}/usr/lib/
cp arch/x86/usr/lib/libatiuki.so.1.0 %{buildroot}/usr/lib/
# very important, if no this , Display's OpenGL will show unknow
mkdir -p %{buildroot}/usr/lib/dri/
cp arch/x86/usr/X11R6/lib/modules/dri/fglrx_dri.so %{buildroot}/usr/lib/dri/
mkdir -p %{buildroot}/usr/lib/GL/ati/
cp arch/x86/usr/X11R6/lib/fglrx/fglrx-libGL.so.1.2 %{buildroot}/usr/lib/GL/ati/libGL.so.1.2
mkdir -p %{buildroot}/usr/lib/xorg/modules/
cp xpic/usr/X11R6/lib/modules/amdxmm.so %{buildroot}/usr/lib/xorg/modules/
cp xpic/usr/X11R6/lib/modules/glesx.so %{buildroot}/usr/lib/xorg/modules/
mkdir -p %{buildroot}/usr/lib/xorg/modules/drivers/
cp xpic/usr/X11R6/lib/modules/drivers/fglrx_drv.so %{buildroot}/usr/lib/xorg/modules/drivers/
mkdir -p %{buildroot}/usr/lib/xorg/modules/extensions/
cp xpic/usr/X11R6/lib/modules/extensions/fglrx/fglrx-libglx.so %{buildroot}/usr/lib/xorg/modules/extensions/libglx.so.ati.%{version}
mkdir -p %{buildroot}/usr/lib/xorg/modules/linux/
cp xpic/usr/X11R6/lib/modules/linux/libfglrxdrm.so %{buildroot}/usr/lib/xorg/modules/linux/
mkdir -p %{buildroot}/usr/bin/
cp arch/x86/usr/X11R6/bin/amdcccle %{buildroot}/usr/bin/
cp arch/x86/usr/X11R6/bin/aticonfig %{buildroot}/usr/bin/
cp arch/x86/usr/X11R6/bin/atiodcli %{buildroot}/usr/bin/
cp arch/x86/usr/X11R6/bin/atiode %{buildroot}/usr/bin/
cp arch/x86/usr/X11R6/bin/fgl_glxgears %{buildroot}/usr/bin/
cp arch/x86/usr/X11R6/bin/fglrxinfo %{buildroot}/usr/bin/
cp common/usr/X11R6/bin/amdupdaterandrconfig %{buildroot}/usr/bin/
cp common/usr/X11R6/bin/amdxdg-su %{buildroot}/usr/bin/
mkdir -p %{buildroot}/usr/sbin/
cp arch/x86/usr/sbin/amdnotifyui %{buildroot}/usr/sbin/
cp arch/x86/usr/sbin/atieventsd %{buildroot}/usr/sbin/
cp common/usr/sbin/atigetsysteminfo.sh %{buildroot}/usr/sbin/
mkdir -p %{buildroot}/usr/share/ati/lib/
cp arch/x86/usr/share/ati/lib/libQtCore.so.4 %{buildroot}/usr/share/ati/lib/
cp arch/x86/usr/share/ati/lib/libQtGui.so.4 %{buildroot}/usr/share/ati/lib/
mkdir -p %{buildroot}/usr/share/ati/amdcccle/
cp common/usr/share/ati/amdcccle/* %{buildroot}/usr/share/ati/amdcccle/
mkdir -p %{buildroot}/usr/share/icons/
cp common/usr/share/icons/ccc_large.xpm %{buildroot}/usr/share/icons/
mkdir -p %{buildroot}/usr/share/man/man8/
cp common/usr/share/man/man8/atieventsd.8 %{buildroot}/usr/share/man/man8/atieventsd.8
mkdir -p %{buildroot}/usr/src/ati/
cp common/usr/src/ati/fglrx_sample_source.tgz %{buildroot}/usr/src/ati/
#mkdir -p %{buildroot}/usr/share/doc/amdcccle/
#cp common/usr/share/doc/amdcccle/ccc_copyrights.txt %{buildroot}/usr/share/doc/amdcccle/
#mkdir -p %{buildroot}/usr/share/doc/fglrx/
#cp -r common/usr/share/doc/fglrx/* %{buildroot}/usr/share/doc/fglrx/
#copy as *.desktop.bak then rename it in ks.cfg when need, if not it will show in gnome menu even there is no ati cards work
#mkdir -p %{buildroot}/usr/share/applications/
#cp common/usr/share/applications/amdcccle.desktop %{buildroot}/usr/share/applications/amdcccle.desktop.bak
#cp common/usr/share/applications/amdccclesu.desktop %{buildroot}/usr/share/applications/amdccclesu.desktop.bak
popd
%clean
rm -rf %{buildroot}
%post
ln -sf /usr/lib/GL/ati/libGL.so.1.2 /usr/lib/libGL.so.1.2
ln -sf /usr/lib/libGL.so.1.2 /usr/lib/libGL.so.1
ln -sf /usr/lib/xorg/modules/extensions/libglx.so.ati.%{version} /usr/lib/xorg/modules/extensions/libglx.so
ln -sf /usr/lib/libatiuki.so.1.0 /usr/lib/libatiuki.so.1
%postun
%files
%defattr(0777,root,root,-)
/lib/modules/%{_kmodver}/kernel/drivers/video/fglrx.ko
%_sysconfdir/ati/*
%_sysconfdir/security/console.apps/amdcccle-su
%_sysconfdir/modprobe.d/blacklist-fglrx.conf
%_bindir/*
%_libdir/lib*
%_libdir/GL/ati/libGL.so.1.2
%_libdir/dri/fglrx_dri.so
%_libdir/xorg/modules/amdxmm.so
%_libdir/xorg/modules/glesx.so
%_libdir/xorg/modules/drivers/fglrx_drv.so
%_libdir/xorg/modules/extensions/libglx.so.ati.%{version}
%_libdir/xorg/modules/linux/libfglrxdrm.so
%_sbindir/*
#%_datadir/applications/*
%_datadir/ati/*
#%_datadir/doc/*
%_datadir/icons/ccc_large.xpm
%_mandir/man8/atieventsd.8.gz
%_usrsrc/ati/fglrx_sample_source.tgz
%changelog
%define _kmodver %(echo `uname -r`)
%define _kernver %(echo `uname -r |sed 's/\.i.*//'`)
%define _kver %(echo `uname -r |awk -F '.' '{print $3}'`)
Summary: Xorg X11 nvidia video driver
Name: nvidia
Version: 280.13
Release: k%{_kver}.1%{dist}
URL:
License: NVIDIA, distributable
Group: User Interface/X Hardware Support
Packager: zhangwei
BuildRoot: %{_tmppath}/%{name}-%{version}-root-%(%{__id_u} -n)
BuildRequires: chkconfig coreutils grubby
BuildRequires: kernel = %{_kernver}
BuildRequires: kernel-devel = %{_kernver}
BuildRequires: kernel-headers = %{_kernver}
Conflicts: libvdpau libvdpau-devel
Source0: NVIDIA-Linux-x86-%{version}.run
Source1: blacklist-nouveau.conf
ExcludeArch: s390 s390x
%description
video Cards driver for nvidia Geforce series.
%prep
sh %{SOURCE0} -x
pushd %{_builddir}
mv NVIDIA-Linux-x86-%{version} %{name}-%{version}
popd
%build
export IGNORE_CC_MISMATCH=1
pushd %{name}-%{version}/kernel/
make KERNEL_MODLIB=/lib/modules/%{_kmodver}
make KERNEL_MODLIB=/lib/modules/%{_kmodver} module
popd
%install
rm -rf $RPM_BUILD_ROOT
cd %{name}-%{version}/
mkdir -p %{buildroot}/lib/modules/%{_kmodver}/kernel/drivers/video/
cp kernel/nvidia.ko %{buildroot}/lib/modules/%{_kmodver}/kernel/drivers/video/nvidia.ko
mkdir -p $RPM_BUILD_ROOT/usr
mkdir -p $RPM_BUILD_ROOT/usr/bin/
mkdir -p $RPM_BUILD_ROOT/usr/lib/tls/
mkdir -p $RPM_BUILD_ROOT/usr/lib/vdpau/
mkdir -p $RPM_BUILD_ROOT/usr/lib/xorg/modules/drivers/
mkdir -p $RPM_BUILD_ROOT/usr/lib/xorg/modules/extensions/
mkdir -p $RPM_BUILD_ROOT/usr/lib/GL/nvidia/
mkdir -p $RPM_BUILD_ROOT/usr/share/man/man1/
mkdir -p $RPM_BUILD_ROOT/etc/OpenCL/vendors/
cp nvidia-settings nvidia-smi nvidia-xconfig %{buildroot}/usr/bin
cp libGL.so.%{version} %{buildroot}/usr/lib/GL/nvidia/
cp libglx.so.%{version} %{buildroot}/usr/lib/xorg/modules/extensions/libglx.so.nvidia.%{version}
cp libcuda.so.%{version} %{buildroot}/usr/lib/
cp libGL.la %{buildroot}/usr/lib/
cp libnvcuvid.so.%{version} %{buildroot}/usr/lib/
cp libnvidia-cfg.so.%{version} %{buildroot}/usr/lib/
cp libnvidia-compiler.so.%{version} %{buildroot}/usr/lib/
cp libnvidia-glcore.so.%{version} %{buildroot}/usr/lib/
cp libnvidia-ml.so.%{version} %{buildroot}/usr/lib/
cp libnvidia-tls.so.%{version} %{buildroot}/usr/lib/
cp libnvidia-wfb.so.%{version} %{buildroot}/usr/lib/
cp libOpenCL.so.1.0.0 %{buildroot}/usr/lib/
cp libvdpau_nvidia.so.%{version} %{buildroot}/usr/lib/
cp libvdpau.so.%{version} %{buildroot}/usr/lib/
cp libvdpau_trace.so.%{version} %{buildroot}/usr/lib/
cp libXvMCNVIDIA.a %{buildroot}/usr/lib/
cp libXvMCNVIDIA.so.%{version} %{buildroot}/usr/lib/
cp libnvidia-wfb.so.%{version} %{buildroot}/usr/lib/xorg/modules/
cp tls/libnvidia-tls.so.%{version} %{buildroot}/usr/lib/tls/
cp libvdpau_nvidia.so.%{version} libvdpau_trace.so.%{version} %{buildroot}/usr/lib/vdpau/
cp nvidia_drv.so %{buildroot}/usr/lib/xorg/modules/drivers/
cp nvidia-smi.1.gz nvidia-xconfig.1.gz nvidia-settings.1.gz %{buildroot}/usr/share/man/man1/
cp nvidia.icd %{buildroot}/etc/OpenCL/vendors/
mkdir -p %{buildroot}/etc/modprobe.d/
cp %{SOURCE1} %{buildroot}/etc/modprobe.d/
%clean
rm -rf $RPM_BUILD_ROOT
%post
ln -sf %{_libdir}/GL/nvidia/libGL.so.%{version} %{_libdir}/libGL.so.1.2
ln -sf %{_libdir}/libGL.so.1.2 %{_libdir}/libGL.so.1
ln -sf %{_libdir}/xorg/modules/extensions/libglx.so.nvidia.%{version} %{_libdir}/xorg/modules/extensions/libglx.so
pushd /usr/lib/
ln -sf libXvMCNVIDIA.so.%{version} libXvMCNVIDIA_dynamic.so.1
ln -sf libnvidia-cfg.so.%{version} libnvidia-cfg.so.1
ln -sf libnvidia-ml.so.%{version} libnvidia-ml.so.1
ln -sf libcuda.so.%{version} libcuda.so.1
ln -sf libvdpau.so.%{version} libvdpau.so.1
ln -sf libvdpau_nvidia.so.%{version} libvdpau_nvidia.so.1
popd
%postun
%files
%defattr(0777,root,root,-)
%{_bindir}/*
%{_libdir}/*
%{_mandir}/*
/etc/modprobe.d/*
/etc/OpenCL/vendors/*
/lib/modules/%{_kmodver}/kernel/drivers/video/nvidia.ko
%changelog