summaryrefslogtreecommitdiff
path: root/cuda-compat/Pkgfile
blob: 88fefc34b38dc8a46ad7fd09c2e8fec3c0b69a12 (plain)
    1 # Description: NVIDIA's GPU programming toolkit
    2 # URL: https://developer.nvidia.com/cuda-zone
    3 # Maintainer: Danny Rawlins, crux at romster dot me
    4 # Depends on: nvidia lsb-release
    5 
    6 name=cuda-compat
    7 version=11.4.2
    8 _driverver=470.57.02
    9 release=1
   10 source=(https://developer.download.nvidia.com/compute/cuda/${version}/local_installers/cuda_${version}_${_driverver}_linux.run
   11 	cuda.sh cuda.conf $name.revdep
   12 	cuda-findgllib_mk.diff
   13 	*.pc)
   14 
   15 build() {
   16 	sh cuda_${version}_${_driverver}_linux.run --target "${SRC}" --noexec
   17 
   18 	# Fix up samples that use findgllib_mk
   19 	for f in builds/cuda_samples/*/*/findgllib.mk; do
   20 		patch $f cuda-findgllib_mk.diff
   21 	done
   22 
   23 	cd builds
   24 
   25 	rm -r NVIDIA*.run bin
   26 	mkdir -p "${PKG}/opt/cuda/extras"
   27 	mv cuda_samples "${PKG}/opt/cuda/samples"
   28 	mv integration nsight_compute nsight_systems EULA.txt "${PKG}/opt/cuda"
   29 	mv cuda_sanitizer_api/compute-sanitizer "${PKG}/opt/cuda/extras/compute-sanitizer"
   30 	rmdir cuda_sanitizer_api
   31 	for lib in *; do
   32 		if [[ "$lib" =~ .*"version.json".* ]]; then
   33 			continue
   34 		fi
   35 		cp -r $lib/* "${PKG}/opt/cuda/"
   36 	done
   37 
   38 	# Define compilers for CUDA to use.
   39 	# This allows us to use older versions of GCC if we have to.
   40 	ln -s /usr/bin/gcc "${PKG}/opt/cuda/bin/gcc"
   41 	ln -s /usr/bin/g++ "${PKG}/opt/cuda/bin/g++"
   42 
   43 	# Install profile and ld.so.config files
   44 	install -Dm755 "${SRC}/cuda.sh" "${PKG}/etc/profile.d/cuda.sh"
   45 	install -Dm644 "${SRC}/cuda.conf" "${PKG}/etc/ld.so.conf.d/cuda.conf"
   46 
   47 	# Install pkgconfig files
   48 	mkdir -p "$PKG"/usr/lib/pkgconfig
   49 	cp "${SRC}"/*.pc "${PKG}"/usr/lib/pkgconfig
   50 
   51 	mkdir -p "${PKG}/usr/share/licenses/${name}"
   52 	ln -s /opt/cuda/doc/pdf/EULA.pdf "${PKG}/usr/share/licenses/${pkgname}/EULA.pdf"
   53 
   54 	# Allow newer compilers to work. This is not officially supported in the Arch package but
   55 	# if users want to try, let them try.
   56 	# See https://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html#system-requirements
   57 	# for official requirements
   58 	sed -i "/.*unsupported GNU version.*/d" "${PKG}"/opt/cuda/targets/x86_64-linux/include/crt/host_config.h
   59 	sed -i "/.*unsupported clang version.*/d" "${PKG}"/opt/cuda/targets/x86_64-linux/include/crt/host_config.h
   60 
   61 	# Fix Makefile paths to CUDA
   62 	for f in $(find "$PKG"/opt/cuda -name Makefile); do
   63 		sed -i "s|/usr/local/cuda|/opt/cuda|g" "$f"
   64 	done
   65 
   66 	# NVIDIA has trouble with counting and numbering 
   67 	# as well as the elusive concept of a SONAME so...
   68 	ln -s /opt/cuda/targets/x86_64-linux/lib/libcudart.so.11.1.74 "${PKG}/opt/cuda/targets/x86_64-linux/lib/libcudart.so.11.1"
   69 
   70 	install -d $PKG/etc/revdep.d
   71 	install -m644 $SRC/$name.revdep $PKG/etc/revdep.d/$name
   72 
   73 	find $PKG -iname 'README' -iname 'README.txt' -exec rm '{}' \+
   74 }

Generated by cgit