contrib/cuda/Pkgfile

68 lines
2.3 KiB
Plaintext

# Description: NVIDIA's GPU programming toolkit (feature branch)
# URL: https://developer.nvidia.com/cuda-zone
# Maintainer: Danny Rawlins, crux at romster dot me
# Depends on: nvidia lsb-release
name=cuda
version=11.6.2
_driverver=510.47.03
release=1
source=(https://developer.download.nvidia.com/compute/cuda/${version}/local_installers/cuda_${version}_${_driverver}_linux.run
cuda.sh cuda.conf $name.revdep
*.pc)
build() {
sh cuda_${version}_${_driverver}_linux.run --target "${SRC}" --noexec
cd builds
rm -r NVIDIA*.run bin
mkdir -p "${PKG}/opt/cuda/extras"
mv cuda_samples "${PKG}/opt/cuda/samples"
mv integration nsight_compute nsight_systems EULA.txt "${PKG}/opt/cuda"
mv cuda_sanitizer_api/compute-sanitizer "${PKG}/opt/cuda/extras/compute-sanitizer"
rmdir cuda_sanitizer_api
for lib in *; do
if [[ "$lib" =~ .*"version.json".* ]]; then
continue
fi
cp -r $lib/* "${PKG}/opt/cuda/"
done
# Delete some unnecessary files
rm -r "${PKG}"/opt/cuda/{bin/cuda-uninstaller,samples/bin/cuda-uninstaller}
# remove foreign archs
rm -r "${PKG}"/opt/cuda/nsight_compute/target/linux-desktop-glibc_2_19_0-ppc64le
rm -r "${PKG}"/opt/cuda/nsight_compute/target/linux-desktop-t210-a64
# Define compilers for CUDA to use.
# This allows us to use older versions of GCC if we have to.
ln -s /usr/bin/gcc "${PKG}/opt/cuda/bin/gcc"
ln -s /usr/bin/g++ "${PKG}/opt/cuda/bin/g++"
# Install profile and ld.so.config files
install -Dm755 "${SRC}/cuda.sh" "${PKG}/etc/profile.d/cuda.sh"
install -Dm644 "${SRC}/cuda.conf" "${PKG}/etc/ld.so.conf.d/cuda.conf"
# Install pkgconfig files
mkdir -p "$PKG"/usr/lib/pkgconfig
cp "${SRC}"/*.pc "${PKG}"/usr/lib/pkgconfig
# Allow newer compilers to work.
# See https://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html#system-requirements
# for official requirements
sed -i "/.*unsupported GNU version.*/d" "${PKG}"/opt/cuda/targets/x86_64-linux/include/crt/host_config.h
sed -i "/.*unsupported clang version.*/d" "${PKG}"/opt/cuda/targets/x86_64-linux/include/crt/host_config.h
# Fix Makefile paths to CUDA
for f in $(find "$PKG"/opt/cuda -name Makefile); do
sed -i "s|/usr/local/cuda|/opt/cuda|g" "$f"
done
install -d $PKG/etc/revdep.d
install -m644 $SRC/$name.revdep $PKG/etc/revdep.d/$name
find $PKG -iname 'README' -iname 'README.txt' -exec rm '{}' \+
}