template 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. # Template file for 'cuda'
  2. pkgname=cuda
  3. version=12.2.0
  4. revision=1
  5. _driverver=535.54.03
  6. archs="x86_64"
  7. create_wrksrc=yes
  8. hostmakedepends="tar"
  9. depends="nvidia-opencl nvidia-libs glu gdb"
  10. short_desc="NVIDIA's GPU programming toolkit"
  11. maintainer="MarcoAPC <marcoaureliopc@gmail.com>"
  12. license="custom:NVIDIA Proprietary"
  13. homepage="https://developer.nvidia.com/cuda-zone"
  14. distfiles="https://developer.download.nvidia.com/compute/cuda/${version}/local_installers/cuda_${version}_${_driverver}_linux.run"
  15. checksum=ecf3d2afadcbac029f0f4505785810d52d006e4b87ba79ff3f984336a2bbf518
  16. repository="nonfree"
  17. nopie=yes
  18. subpackages="cuda-tools"
  19. do_extract() {
  20. sh ${XBPS_SRCDISTDIR}/${pkgname}-${version}/cuda_${version}_${_driverver}_linux.run --target ${wrksrc} --noexec
  21. cd ${wrksrc}
  22. }
  23. do_install() {
  24. local _prepdir="${DESTDIR}"
  25. cd "${wrksrc}/builds"
  26. rm -r NVIDIA*.run bin
  27. mkdir -p "${_prepdir}/opt/cuda/extras"
  28. mv integration nsight_compute nsight_systems EULA.txt "${_prepdir}/opt/cuda"
  29. mv cuda_demo_suite/extras/demo_suite "${_prepdir}/opt/cuda/extras/demo_suite"
  30. mv cuda_sanitizer_api/compute-sanitizer "${_prepdir}/opt/cuda/extras/compute-sanitizer"
  31. rmdir cuda_sanitizer_api
  32. for lib in *; do
  33. if [[ "$lib" =~ .*"version.json".* ]]; then
  34. continue
  35. fi
  36. cp -r $lib/* "${_prepdir}/opt/cuda/"
  37. done
  38. # Delete some unnecessary files
  39. rm -r "${_prepdir}"/opt/cuda/bin/cuda-uninstaller
  40. # Define compilers for CUDA to use.
  41. # This allows us to use older versions of GCC if we have to.
  42. ln -s /usr/bin/gcc "${_prepdir}/opt/cuda/bin/gcc"
  43. ln -s /usr/bin/g++ "${_prepdir}/opt/cuda/bin/g++"
  44. # Install profile and ld.so.config files
  45. vinstall "${FILESDIR}/cuda.sh" 755 "etc/profile.d/cuda.sh"
  46. vinstall "${FILESDIR}/cuda.conf" 644 "etc/ld.so.conf.d/cuda.conf"
  47. # Install pkgconfig files
  48. mkdir -p "$_prepdir"/usr/lib/pkgconfig
  49. cp "${FILESDIR}"/*.pc "${_prepdir}"/usr/lib/pkgconfig
  50. mkdir -p "${_prepdir}/usr/share/licenses/${pkgname}"
  51. ln -s /opt/cuda/EULA.txt "${_prepdir}/usr/share/licenses/${pkgname}/EULA.txt"
  52. ln -s /opt/cuda/README "${_prepdir}/usr/share/licenses/${pkgname}/README"
  53. # Allow newer compilers to work.
  54. # See https://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html#system-requirements
  55. # for official requirements
  56. sed -i "/.*unsupported GNU version.*/d" "${_prepdir}"/opt/cuda/targets/x86_64-linux/include/crt/host_config.h
  57. sed -i "/.*unsupported clang version.*/d" "${_prepdir}"/opt/cuda/targets/x86_64-linux/include/crt/host_config.h
  58. # Fix Makefile paths to CUDA
  59. for f in $(find "$_prepdir"/opt/cuda -name Makefile); do
  60. sed -i "s|/usr/local/cuda|/opt/cuda|g" "$f"
  61. done
  62. }
  63. cuda-tools_package() {
  64. short_desc="${_desc} - (extra tools: nvvp, nsight)"
  65. depends="cuda openjdk8-jre nss perl ucx"
  66. python_version=3
  67. nostrip_files="TreeLauncherTargetLdPreloadHelper TreeLauncherSubreaper ncu libcuda-injection.so libInterceptorInjectionTarget.so libnvperf_host.so libnvperf_target.so libTreeLauncherPlaceholder.so libTreeLauncherTargetInjection.so libTreeLauncherTargetUpdatePreloadInjection.so"
  68. pkg_install() {
  69. vmove opt/cuda/nsight*
  70. vmove opt/cuda/bin/nvvp
  71. vmove opt/cuda/bin/computeprof
  72. vmove opt/cuda/libnvvp
  73. }
  74. }