Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Mar 27th, 2011  |  syntax: Bash  |  size: 5.48 KB  |  views: 97  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. # Contributor: Dan Vratil <vratil@progdansoft.com>
  2. # Contributor: Ng Oon-Ee <n g o o n e e AT g mail dot com>
  3. # Contributor: Amaury Couste <amaury.couste@gmail.com>
  4. # Contributor: James Rayner <iphitus@gmail.com>
  5. # Contributor: Thomas Baechler <thomas@archlinux.org>
  6. # Contributor: Nuno Aniceto aka quarkup <nuno.aja@gmail.com>
  7. # Contributor: Det <nimetonmaili AT gmail dot com>      ## This list soon should be a separate file
  8.  
  9. pkgname='nvidia-all'
  10. true && pkgname=('nvidia-all' 'nvidia-utils')
  11. pkgver='260.19.44'
  12. pkgrel=1
  13. _arch='x86_64' && _pkg="NVIDIA-Linux-${_arch}-${pkgver}-no-compat32" && md5sums=('3dfce350616ad70d626b531a15c8604f')
  14. [ "$CARCH" = "i686" ] && _arch='x86' && _pkg="NVIDIA-Linux-${_arch}-${pkgver}" && md5sums=('c99b0710a43db3aafb4f27408194e910')
  15. url='http://www.nvidia.com/'
  16. arch=('i686' 'x86_64')
  17. license=('custom')
  18. source=("http://us.download.nvidia.com/XFree86/Linux-${_arch}/${pkgver}/${_pkg}.run"
  19.         '20-nvidia.conf')
  20. md5sums+=('541cb36684b6764ccba73d7afe268bf5')
  21.  
  22. _KERNELS=`ls /usr/src | sed 's|linux-||'`
  23.  
  24. build() {
  25.         rm -rf ${_pkg}
  26.         # Extract the nvidia drivers
  27.         sh "${_pkg}.run" --extract-only
  28.  
  29.         # Loop through all detected kernels and build modules
  30.         #for _kernver in `file /boot/* | grep 'Linux kernel.*boot executable' | grep 'vmlinuz' | sed 's|.*version \([^ ]\+\).*|\1|'`;
  31.         for _kernver in $_KERNELS; do
  32.                 cd "${srcdir}/${_pkg}"
  33.                 cp -a kernel kernel-${_kernver}
  34.                 cd kernel-${_kernver}
  35.                 msg "Found kernel: $_kernver"
  36.                 msg2 "Building module..."
  37.                 make SYSSRC=/usr/src/linux-${_kernver} module &> /dev/null
  38.         done
  39. }
  40.  
  41. package_nvidia-utils() {
  42.         pkgdesc='NVIDIA drivers utilities and libraries'
  43.         depends=('xorg-server' 'libxvmc')
  44.         optdepends=('gtk2: nvidia-settings')
  45.         conflicts=('libgl')
  46.         provides=('libgl' 'libcl')
  47.         install='nvidia-utils.install'
  48.         backup=('etc/X11/xorg.conf.d/20-nvidia.conf')
  49.  
  50.         cd ${_pkg}
  51.         # X driver
  52.         install -D -m755 nvidia_drv.so $pkgdir/usr/lib/xorg/modules/drivers/nvidia_drv.so
  53.         # GLX extension module for X
  54.         install -D -m755 libglx.so.$pkgver $pkgdir/usr/lib/xorg/modules/extensions/libglx.so.$pkgver
  55.         ln -s libglx.so.$pkgver $pkgdir/usr/lib/xorg/modules/extensions/libglx.so       # X doesn't find glx otherwise
  56.         # OpenGL library
  57.         install -D -m755 libGL.so.$pkgver $pkgdir/usr/lib/libGL.so.$pkgver
  58.         # OpenGL core library
  59.         install -D -m755 libnvidia-glcore.so.$pkgver $pkgdir/usr/lib/libnvidia-glcore.so.$pkgver
  60.         # XvMC
  61.         install -D -m644 libXvMCNVIDIA.a $pkgdir/usr/lib/libXvMCNVIDIA.a
  62.         install -D -m755 libXvMCNVIDIA.so.$pkgver $pkgdir/usr/lib/libXvMCNVIDIA.so.$pkgver
  63.         # VDPAU
  64.         install -D -m755 libvdpau_nvidia.so.$pkgver $pkgdir/usr/lib/vdpau/libvdpau_nvidia.so.$pkgver
  65.         # CUDA
  66.         install -D -m755 libcuda.so.$pkgver $pkgdir/usr/lib/libcuda.so.$pkgver
  67.         install -D -m755 libnvcuvid.so.$pkgver $pkgdir/usr/lib/libnvcuvid.so.$pkgver
  68.         # nvidia-tls library
  69.         install -D -m755 tls/libnvidia-tls.so.$pkgver $pkgdir/usr/lib/libnvidia-tls.so.$pkgver
  70.         # OpenCL
  71.         install -D -m755 libnvidia-compiler.so.$pkgver $pkgdir/usr/lib/libnvidia-compiler.so.$pkgver
  72.         install -D -m755 libOpenCL.so.1.0.0 $pkgdir/usr/lib/libOpenCL.so.1.0.0
  73.         install -D -m644 nvidia.icd $pkgdir/etc/OpenCL/vendors/nvidia.icd
  74.  
  75.         install -D -m755 libnvidia-cfg.so.$pkgver $pkgdir/usr/lib/libnvidia-cfg.so.$pkgver
  76.  
  77.         # create soname links
  78.         for _lib in $(find $pkgdir -name '*.so*'); do
  79.                 _soname="$(dirname ${_lib})/$(readelf -d "$_lib" | sed -nr 's/.*Library soname: \[(.*)\].*/\1/p')"
  80.                 if [ ! -e "${_soname}" ]; then
  81.                         ln -s "$(basename ${_lib})" "${_soname}"
  82.                         ln -s "$(basename ${_soname})" "${_soname/.[0-9]*/}"
  83.                 fi
  84.         done
  85.  
  86.         # nvidia-xconfig
  87.         install -D -m755 nvidia-xconfig $pkgdir/usr/bin/nvidia-xconfig
  88.         install -D -m644 nvidia-xconfig.1.gz $pkgdir/usr/share/man/man1/nvidia-xconfig.1.gz
  89.         # nvidia-settings
  90.         install -D -m755 nvidia-settings $pkgdir/usr/bin/nvidia-settings
  91.         install -D -m644 nvidia-settings.1.gz $pkgdir/usr/share/man/man1/nvidia-settings.1.gz
  92.         install -D -m644 nvidia-settings.desktop $pkgdir/usr/share/applications/nvidia-settings.desktop
  93.         install -D -m644 nvidia-settings.png $pkgdir/usr/share/pixmaps/nvidia-settings.png
  94.         sed -e 's:__UTILS_PATH__:/usr/bin:' -e 's:__PIXMAP_PATH__:/usr/share/pixmaps:' -i $pkgdir/usr/share/applications/nvidia-settings.desktop
  95.         # nvidia-bug-report
  96.         install -D -m755 nvidia-bug-report.sh $pkgdir/usr/bin/nvidia-bug-report.sh
  97.         # nvidia-smi
  98.         install -D -m755 nvidia-smi $pkgdir/usr/bin/nvidia-smi
  99.         install -D -m644 nvidia-smi.1.gz $pkgdir/usr/share/man/man1/nvidia-smi.1.gz
  100.  
  101.         install -D -m644 LICENSE $pkgdir/usr/share/licenses/nvidia/LICENSE
  102.         ln -s nvidia $pkgdir/usr/share/licenses/nvidia-utils
  103.         install -D -m644 README.txt $pkgdir/usr/share/doc/nvidia/README
  104.         install -D -m644 NVIDIA_Changelog $pkgdir/usr/share/doc/nvidia/NVIDIA_Changelog
  105.         ln -s nvidia $pkgdir/usr/share/doc/nvidia-utils
  106.  
  107.         # Install xorg.conf.d file for nvidia autodetection in xorg.conf-less configurations
  108.         install -D -m644 $srcdir/20-nvidia.conf $pkgdir/etc/X11/xorg.conf.d/20-nvidia.conf
  109. }
  110.  
  111. package_nvidia-all(){
  112.         pkgdesc='NVIDIA drivers for all kernels on the system'
  113.         conflicts=('nvidia-71xx' 'nvidia-96xx' 'nvidia-173xx' 'nvidia-legacy' 'nvidia')
  114.         depends=("nvidia-utils=${pkgver}")
  115.         makedepends=('kernel26-headers')
  116.         install='nvidia-all.install'
  117.  
  118.         for _kernver in $_KERNELS; do
  119.                 msg2 "Installing module..."
  120.                 install -D -m644 ${_pkg}/kernel-${_kernver}/nvidia.ko "${pkgdir}/lib/modules/${_kernver}/kernel/drivers/video/nvidia.ko"
  121.         done
  122.  
  123.         # Blacklist the Nouveau driver (avoiding possible conflicts by appending the -all suffix)
  124.         install -d -m755 "${pkgdir}/etc/modprobe.d"
  125.         echo "blacklist nouveau" > "${pkgdir}/etc/modprobe.d/nouveau_blacklist-all.conf"
  126. }