contrib/cuda-fb/Pkgfile
2021-11-28 20:34:07 +11:00

71 lines
2.4 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-fb
version=11.5.1
_driverver=495.29.05
release=1
source=(http://developer.download.nvidia.com/compute/cuda/${version}/local_installers/cuda_${version}_${_driverver}_linux.run
cuda.sh cuda.conf $name.revdep
cuda-findgllib_mk.diff
*.pc)
build() {
sh cuda_${version}_${_driverver}_linux.run --target "${SRC}" --noexec
# Fix up samples that use findgllib_mk
for f in builds/cuda_samples/*/*/findgllib.mk; do
patch $f cuda-findgllib_mk.diff
done
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}
# 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. This is not officially supported in the Arch package but
# if users want to try, let them try.
# 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 '{}' \+
}