actions.py 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. # -*- coding: utf-8 -*-
  2. #
  3. # Licensed under the GNU General Public License, version 3.
  4. # See the file http://www.gnu.org/licenses/gpl.txt
  5. from pisi.actionsapi import get
  6. from pisi.actionsapi import autotools
  7. from pisi.actionsapi import pisitools
  8. from pisi.actionsapi import shelltools
  9. from pisi.actionsapi import kerneltools
  10. WorkDir = "."
  11. KDIR = kerneltools.getKernelVersion()
  12. NoStrip = ["/lib/modules"]
  13. version = get.srcVERSION()
  14. driver_dir_name = "nvidia340"
  15. datadir = "/usr/share/%s" % driver_dir_name
  16. libdir = "/usr/lib32" if get.buildTYPE() == 'emul32' else "/usr/lib"
  17. arch = "x86" if get.buildTYPE() == 'emul32' else get.ARCH().replace("i6", "x")
  18. nvlibdir = "%s/%s" % (libdir, driver_dir_name)
  19. xorglibdir= "%s/xorg" % libdir
  20. def setup():
  21. shelltools.system("sh NVIDIA-Linux-%s-%s.run -x --target tmp"
  22. % (arch, get.srcVERSION()))
  23. shelltools.move("tmp/*", ".")
  24. #5.5 patch
  25. shelltools.move("tmp/.manifest", ".")
  26. shelltools.system("patch -p1 < kernel-5.7.patch")
  27. shelltools.system("patch -p1 < kernel-5.8.patch")
  28. shelltools.system("patch -p1 < kernel-5.9.patch")
  29. shelltools.system("patch -p1 < kernel-5.10.patch")
  30. shelltools.system("patch -p1 < kernel-5.11.patch")
  31. shelltools.system("patch -p1 < kernel-5.14.patch")
  32. shelltools.system("patch -p1 < kernel-5.15.patch")
  33. shelltools.system("patch -p1 < kernel-5.16.patch")
  34. shelltools.system("patch -p1 < kernel-5.17.patch")
  35. shelltools.system("patch -p1 < kernel-5.18.patch")
  36. shelltools.system("patch -p1 < kernel-6.0.patch")
  37. shelltools.system("patch -p1 < kernel-6.2.patch")
  38. shelltools.system("patch -p1 < kernel-6.3.patch")
  39. shelltools.system("patch -p1 < kernel-6.5.patch")
  40. shelltools.system("patch -p1 < kernel-6.6.patch")
  41. shelltools.system("patch -p1 < kernel-6.8.patch")
  42. # Our libc is TLS enabled so use TLS library
  43. shelltools.unlink("*-tls.so*")
  44. shelltools.move("tls/*", ".")
  45. # xorg-server provides libwfb.so
  46. shelltools.unlink("libnvidia-wfb.so.*")
  47. shelltools.echo("ld.so.conf", nvlibdir)
  48. shelltools.echo("XvMCConfig", "%s/libXvMCNVIDIA.so" % nvlibdir)
  49. # dkms
  50. shelltools.copytree("kernel", "kernel-dkms")
  51. shelltools.unlink("kernel-dkms/dkms.conf")
  52. shelltools.move("dkms.conf", "kernel-dkms/")
  53. pisitools.dosed("kernel-dkms/dkms.conf", "%VERSION%", version)
  54. pisitools.dosed("kernel-dkms/Makefile", "(src\s\?=\s)\.", r"\1/usr/src/nvidia-%s" % version)
  55. pisitools.dosed("kernel-dkms/uvm/Makefile", "(src\s\?=\s)\.", r"\1/usr/src/nvidia-%s/uvm" % version)
  56. def build():
  57. # We don't need kernel module for emul32 build
  58. if get.buildTYPE() == 'emul32':
  59. return
  60. shelltools.export("SYSSRC", "/lib/modules/%s/build" % KDIR)
  61. shelltools.cd("kernel")
  62. autotools.make("module")
  63. shelltools.cd("uvm")
  64. autotools.make("module")
  65. def install():
  66. if not get.buildTYPE() == 'emul32':
  67. # Kernel driver
  68. pisitools.insinto("/lib/modules/%s/extra/nvidia" % KDIR,
  69. "kernel/nvidia.ko")
  70. pisitools.insinto("/lib/modules/%s/extra/nvidia" % KDIR,
  71. "kernel/uvm/nvidia-uvm.ko")
  72. # Command line tools and their man pages
  73. pisitools.dobin("nvidia-smi")
  74. pisitools.doman("nvidia-smi.1.gz")
  75. pisitools.dobin("nvidia-persistenced")
  76. # dkms
  77. pisitools.insinto("/usr/src/nvidia-%s" % version, "kernel-dkms/*")
  78. ### Libraries
  79. # OpenGl library
  80. pisitools.dolib("libGL.so.%s" % version, nvlibdir)
  81. # pisitools.dosym("libGL.so.%s" % version, "%s/libGL.so.1.2.0" % nvlibdir)
  82. # OpenCL
  83. #pisitools.dolib("libOpenCL.so.1.0.0", libdir)
  84. #pisitools.dosym("libOpenCL.so.1.0.0", "%s/libOpenCL.so.1.0" % libdir)
  85. #pisitools.dosym("libOpenCL.so.1.0", "%s/libOpenCL.so.1" % libdir)
  86. pisitools.dolib("libnvidia-opencl.so.%s" % version, libdir)
  87. pisitools.dosym("libnvidia-opencl.so.%s" % version, "%s/libnvidia-opencl.so.1" % libdir)
  88. pisitools.dosym("libnvidia-opencl.so.1", "%s/libnvidia-opencl.so" % libdir)
  89. # CUDA
  90. pisitools.dolib("libcuda.so.%s" % version, libdir)
  91. pisitools.dosym("libcuda.so.%s" % version, "%s/libcuda.so.1" % libdir)
  92. pisitools.dosym("libcuda.so.1", "%s/libcuda.so" % libdir)
  93. pisitools.dolib("libnvcuvid.so.%s" % version, libdir)
  94. pisitools.dosym("libnvcuvid.so.%s" % version, "%s/libnvcuvid.so.1" % libdir)
  95. pisitools.dosym("libnvcuvid.so.1", "%s/libnvcuvid.so" % libdir)
  96. # NVML
  97. # Provides programmatic access to static information and monitoring
  98. # data for NVIDIA GPUs, as well as limited managment capabilities
  99. pisitools.dolib("libnvidia-ml.so.%s" % version, libdir)
  100. pisitools.dosym("libnvidia-ml.so.%s" % version, "%s/libnvidia-ml.so.1" % libdir)
  101. pisitools.dolib("libnvidia-cfg.so.%s" % version, libdir)
  102. pisitools.dosym("libnvidia-cfg.so.%s" % version, "%s/libnvidia-cfg.so.1" % libdir)
  103. pisitools.dolib("libnvidia-compiler.so.%s" % version, libdir)
  104. pisitools.dosym("libnvidia-compiler.so.%s" % version, "%s/libnvidia-compiler.so.1" % libdir)
  105. # OpenGL core library and others
  106. for lib in ("glcore", "tls", "encode", "fbc", "glsi", "ifr", "eglcore"):
  107. pisitools.dolib("libnvidia-%s.so.%s" % (lib, version), libdir)
  108. pisitools.dosym("libnvidia-%s.so.%s" % (lib, version), "%s/libnvidia-%s.so.1" %(libdir, lib))
  109. # VDPAU driver
  110. pisitools.dolib("libvdpau_nvidia.so.%s" % version, "%s/vdpau" % nvlibdir)
  111. pisitools.dosym("../nvidia340/vdpau/libvdpau_nvidia.so.%s" % version, "%s/vdpau/libvdpau_nvidia.so.1" % nvlibdir.strip(driver_dir_name))
  112. # X modules
  113. pisitools.dolib("nvidia_drv.so", "%s/modules/drivers" % nvlibdir)
  114. pisitools.dosym("%s/modules/drivers/nvidia_drv.so" % nvlibdir, "%s/modules/drivers/nvidia_drv.so" % xorglibdir)
  115. pisitools.dolib("libglx.so.%s" % version, "%s/modules/extensions" % nvlibdir)
  116. pisitools.dosym("libglx.so.%s" % version, "%s/modules/extensions/libglx.so" % nvlibdir)
  117. # Exit time for emul32 build
  118. if get.buildTYPE() == 'emul32':
  119. pisitools.insinto(datadir, "ld.so.conf", "32bit-ld.so.conf")
  120. return
  121. pisitools.insinto("/etc/OpenCL/vendors", "nvidia.icd")
  122. pisitools.insinto(datadir, "ld.so.conf")
  123. pisitools.insinto(datadir, "XvMCConfig")
  124. # Documentation
  125. docdir = "xorg-video-%s" % driver_dir_name
  126. pisitools.dodoc("LICENSE", "NVIDIA_Changelog", "README.txt", destDir=docdir)
  127. pisitools.dohtml("html/*", destDir=docdir)
  128. ### Note
  129. # This package includes nvidia-setting and nvidia-xconfig binaries. However
  130. # we have seperate packages for each of them. Nvidia provides tarballs for
  131. # these binaries. Don't forget to update these package with each NVIDIA
  132. # driver update.
  133. # Nvidia-bug-report
  134. # Comes with our own nvidia-xcfonig package
  135. # pisitools.dobin("nvidia-bug-report.sh")