summaryrefslogtreecommitdiffstats
path: root/development/cudatoolkit/cudatoolkit.SlackBuild
diff options
context:
space:
mode:
Diffstat (limited to 'development/cudatoolkit/cudatoolkit.SlackBuild')
-rw-r--r--development/cudatoolkit/cudatoolkit.SlackBuild150
1 files changed, 103 insertions, 47 deletions
diff --git a/development/cudatoolkit/cudatoolkit.SlackBuild b/development/cudatoolkit/cudatoolkit.SlackBuild
index d70047400b..61efdddb03 100644
--- a/development/cudatoolkit/cudatoolkit.SlackBuild
+++ b/development/cudatoolkit/cudatoolkit.SlackBuild
@@ -1,8 +1,8 @@
-#!/bin/sh
+#!/bin/bash
# Slackware build script for CUDA Toolkit
-# Copyright 2017 Giorgio Peron <giorgio.peron@gmail.com>, Belluno, Italy
+# Copyright 2020 Giorgio Peron <giorgio.peron@gmail.com>, Belluno, Italy
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
@@ -22,87 +22,143 @@
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+# 2023-05-16 DW
+# Removed LIBDIRSUFFIX and made 'lib64' hard-coded as we're 64bit only
+# Simplified/moved ARCH parts
+# Moved broken symlinks out of doinst.sh to slackbuild
+# NOTE download page shows newer version available, but all file and
+# subdirectory locations have changed
+
+cd $(dirname $0) ; CWD=$(pwd)
+
PRGNAM=cudatoolkit
FILENAME=cuda
-VERSION=${VERSION:-8.0.61}
+VERSION=${VERSION:-10.2.89}
+DRIVER=${DRIVER:-440.33.01}
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}
+PKGTYPE=${PKGTYPE:-tgz}
+
+if [ -z "$ARCH" ]; then
+ ARCH=$( uname -m )
+fi
+if [ "$ARCH" != "x86_64" ]; then
+ echo "$ARCH architecture is unsupported." >/dev/stderr
+ exit 1
+fi
-case "$( uname -m )" in
- i?86) ARCH=i386 ;;
- arm*) ARCH=arm ;;
- *) ARCH=$( uname -m ) ;;
-esac
+# If the variable PRINT_PACKAGE_NAME is set, then this script will report what
+# the name of the created package would be, and then exit. This information
+# could be useful to other scripts.
+if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
+ echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
+ exit 0
+fi
-CWD=$(pwd)
TMP=${TMP:-/tmp/SBo}
PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp}
set -e
-if [ "$ARCH" = "x86_64" ]; then
- LIBDIRSUFFIX="64"
-else
- printf "\n\n$ARCH is not supported... \n"
- exit 1
-fi
-
rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
rm -rf $PRGNAM-$VERSION
mkdir -p $PRGNAM-$VERSION
-chmod +x $CWD/$FILENAME\_$VERSION\_375.26\_linux-run
-$CWD/$FILENAME\_$VERSION\_375.26\_linux-run -extract=$TMP
-$TMP/$FILENAME-linux64*-$VERSION-*.run -noprompt -nosymlink -prefix=$TMP/$PRGNAM-$VERSION
+# 20220127 bkw: it wasn't necessary to chmod +x the .run file. Plus,
+# SlackBuilds should *never* write to $CWD.
+sh $CWD/$FILENAME\_$VERSION\_$DRIVER\_linux.run --target $PRGNAM-$VERSION --noexec
-cd $PRGNAM-$VERSION
-chown -R root:root .
-
-# Move the docs to our standard location first
-mkdir -p $PKG/usr/man
-mv doc/man $PKG/usr/
-mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
-mv doc/* $PKG/usr/doc/$PRGNAM-$VERSION
-rm -rf doc
+mkdir -p $PKG/usr/share
+cd $PRGNAM-$VERSION/builds
+cp -r cuda-toolkit "$PKG/usr/share/cuda"
+cp -r cublas/include/* "$PKG/usr/share/cuda/include/"
+mkdir -p $PKG/usr/lib64
+cp -r cublas/lib64/* "$PKG/usr/lib64/"
+cp -r cuda-samples "$PKG/usr/share/cuda/samples"
+# Put man in the standard place
+mv $PKG/usr/share/cuda/doc/man $PKG/usr/
find $PKG/usr/man -type f -exec gzip -9 {} \;
for i in $( find $PKG/usr/man -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done
-# Now move everything else
-mkdir -p $PKG/usr/share/cuda
-mv * $PKG/usr/share/cuda/
+# Put doc in the standard place
+mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
+mv $PKG/usr/share/cuda/doc/* $PKG/usr/doc/$PRGNAM-$VERSION/
+rm -rf $PKG/usr/share/cuda/doc
+cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
+
+# Create soname links.
+find cuda-toolkit/targets -type f -name '*.so*' ! -path '*stubs/*' -print0 | while read -rd $'\0' _lib; do
+ _base=${_lib%.so.*}
+ _current_soname=$(basename ${_lib%.*})
+ while [[ $_current_soname != $(basename $_base) ]]; do
+ ln -sf ${_lib##*/} ${PKG}/usr/share/cuda/lib64/$_current_soname
+ _current_soname=${_current_soname%.*}
+ done
+done
+
+# Install profiles
+install -D -m 755 "${CWD}/files/cuda.sh" "${PKG}/etc/profile.d/cuda.sh"
+install -D -m 755 "${CWD}/files/cuda.csh" "${PKG}/etc/profile.d/cuda.csh"
+
+# Install pkgconfig files
+mkdir -p "$PKG"/usr/lib64/pkgconfig
+cp "${CWD}"/files/*.pc "${PKG}"/usr/lib64/pkgconfig
+
+# Remove included copy of java and link to system java 8
+rm -fr "${PKG}/usr/share/cuda/jre"
+sed 's|../jre/bin/java|/usr/bin/java|g' \
+ -i "${PKG}/usr/share/cuda/libnsight/nsight.ini" \
+ -i "${PKG}/usr/share/cuda/libnvvp/nvvp.ini"
+
+# 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}"/usr/share/cuda/targets/x86_64-linux/include/crt/host_config.h
+sed -i "/.*unsupported clang version.*/d" "${PKG}"/usr/share/cuda/targets/x86_64-linux/include/crt/host_config.h
+
+# Fix Makefile paths to CUDA
+for f in $(find "$PKG"/usr/share/cuda -name Makefile); do
+ sed -i "s|/usr/local/cuda|/usr/share/cuda|g" "$f"
+done
# Put libraries in the standard place
-mkdir -p $PKG/usr/lib${LIBDIRSUFFIX}
-mv $PKG/usr/share/cuda/lib${LIBDIRSUFFIX} $PKG/usr
+mkdir -p $PKG/usr/lib64
+mv -fn $PKG/usr/share/cuda/targets/x86_64-linux/lib/* $PKG/usr/lib64/
+rm -rf $PKG/usr/share/cuda/targets/x86_64-linux/lib
cd $PKG/usr/share/cuda
-ln -sf ../../lib${LIBDIRSUFFIX} lib${LIBDIRSUFFIX}
+ln -sf ../../lib64 lib64
-mkdir -p $PKG/etc/profile.d
-cp $CWD/files/${FILENAME}* $PKG/etc/profile.d
-chmod +x $PKG/etc/profile.d/*
+# Register application NVVP and NSIGHT
mkdir -p $PKG/usr/share/applications
cp $CWD/files/*.desktop $PKG/usr/share/applications
# Put include in the standard place
-mkdir -p $PKG/usr/include/cuda
-mv $PKG/usr/share/cuda/include/* $PKG/usr/include/cuda
-rm -rf $PKG/usr/share/cuda/include
-cd $PKG/usr/share/cuda/
-ln -sf ../../include/cuda include
+mkdir -p $PKG/usr/include
+mv -fn $PKG/usr/share/cuda/targets/x86_64-linux/include/* $PKG/usr/include/
+rm -rf $PKG/usr/share/cuda/targets/x86_64-linux/include
+( cd $PKG/usr/share/cuda/ ; ln -sf ../../include include )
+find $PKG/usr/include -type f | xargs chmod -c 0644
-# These are already in the nvidia-driver package
-rm -f $PKG/usr/lib${LIBDIRSUFFIX}/libOpenCL.s*
+# DW: moved here from doinst.sh. Link to 15.0 gcc
+(
+ cd $PKG/usr/share/cuda/bin/
+ ln -sf /usr/bin/gcc-11.2.0 gcc
+ ln -sf /usr/bin/g++-gcc-11.2.0 g++
+)
-# install samples
-$TMP/$FILENAME-samples*-$VERSION-*.run -noprompt -prefix=$PKG/usr/doc/$PRGNAM-$VERSION/NVIDIA_CUDA-8.0_Samples -cudaprefix=/usr/share/cuda
+rm -rf $PKG/usr/share/cuda/targets
+
+# These are already in the nvidia-driver package
+rm -f $PKG/usr/lib64/libOpenCL.s*
mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc
+cat $CWD/doinst.sh > $PKG/install/doinst.sh
cd $PKG
-/sbin/makepkg -c n -l y $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}
+/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE