diff options
Diffstat (limited to 'system/nvidia-driver/nvidia-driver.SlackBuild')
-rw-r--r-- | system/nvidia-driver/nvidia-driver.SlackBuild | 116 |
1 files changed, 60 insertions, 56 deletions
diff --git a/system/nvidia-driver/nvidia-driver.SlackBuild b/system/nvidia-driver/nvidia-driver.SlackBuild index f496e0b531..fd93bbc57a 100644 --- a/system/nvidia-driver/nvidia-driver.SlackBuild +++ b/system/nvidia-driver/nvidia-driver.SlackBuild @@ -3,7 +3,7 @@ # Slackware build script for nvidia-driver # Copyright 2012-2019 Edward W. Koenig, Vancouver, WA, US -# Copyright 2020, 2021, 2022 Lenard Spencer, Orlando, FL, USA +# Copyright 2020-2023 Lenard Spencer, Orlando, FL, USA # # All rights reserved. # @@ -27,7 +27,7 @@ cd $(dirname $0) ; CWD=$(pwd) PRGNAM=nvidia-driver -VERSION=${VERSION:-515.57} +VERSION=${VERSION:-550.78} BUILD=${BUILD:-1} TAG=${TAG:-_SBo} PKGTYPE=${PKGTYPE:-tgz} @@ -57,6 +57,12 @@ else exit 1 fi +if [ "${COMPAT32}" = "yes" ]; then + MULTI="_multilib" +else + MULTI="" +fi + # 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. @@ -65,12 +71,12 @@ if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then exit 0 fi -# There are a couple of unresolved issues with nvidia-installer, so we -# abort if an Nvidia driver is still installed: -if [ -x /usr/bin/nvidia-installer ]; then - echo -e "\n A previous Nvidia installation has been detected!" - echo -e " Please remove the installed driver and rerun this script.\n" - exit 1 +if [ "${PERSISTENCED:-no}" = "yes" ]; then + if [ "`getent group nvidia > /dev/null`" -o "`getent passwd nvidia > /dev/null`" ]; then + echo "User and/or group nvidia do not exist!" + echo "Please create user and group nvidia and rerun this script." + exit 1 + fi fi SRCNAM=NVIDIA-Linux-$TARGET-${VERSION} @@ -80,10 +86,9 @@ rm -rf $PKG rm -rf $TMP/$SRCNAM mkdir -p $TMP $PKG $OUTPUT $PKG/install mkdir -p $PKG/usr/lib$LIBDIRSUFFIX/xorg/modules/{drivers,extensions} \ - $PKG/etc/OpenCL/vendors/ $PKG/usr/{bin,doc,man/man1,sbin} \ + $PKG/etc/OpenCL/vendors/ $PKG/usr/{bin,doc,man/man1} \ $PKG/usr/share/{applications,nvidia,pixmaps,egl/egl_external_platform.d} \ - $PKG/usr/include/GL $PKG/etc/vulkan/{icd.d,implicit_layer.d} $PKG/etc/X11/xorg.conf.d \ - $PKG/etc/X11/glvnd/egl_vendor.d $PKG/lib/firmware/nvidia $PKG/var/log + $PKG/etc/X11/glvnd/egl_vendor.d $PKG/var/log if [ "$COMPAT32" = "yes" ]; then mkdir -p $PKG/usr/lib/tls @@ -113,6 +118,14 @@ find -L . \ cd $TMP/nvidia-installer-$VERSION +# Install various files in $PKG instead of the root filesystem: + sed -i "s|/etc/vulkan|$PKG/etc/vulkan|" files.c + sed -i "s|/lib/firmware/nvidia|$PKG/lib/firmware/nvidia|" files.c + sed -i "s|\"/etc\"|\"$PKG/etc\"|" nvidia-installer.h + sed -i "s|/var/lib/nvidia|$PKG/var/lib/nvidia|" backup.c + sed -i "s|/usr/lib/nvidia|$PKG/usr/lib/nvidia|" files.c + sed -i "s|/usr/lib/nvidia|$PKG/usr/lib/nvidia|" misc.c + chown -R root:root . find -L . \ \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \ @@ -132,12 +145,14 @@ cd - mv -f $PKG/usr/bin/nvidia-installer $TMP/$SRCNAM mv -f $PKG/usr/man/man1/nvidia-installer.1.gz $TMP/$SRCNAM -if [ "${COMPAT32}" = "yes" ]; then +if [ "$ARCH" = "x86_64" -a "${COMPAT32}" = "yes" ]; then COMP32="--install-compat32-libs --compat32-prefix=$PKG/usr" - MULTI="_multilib" else - COMP32="--no-install-compat32-libs" - MULTI="" + if [ ! "$ARCH" = "x86_64" ]; then + COMP32="" + else + COMP32="--no-install-compat32-libs" + fi fi # Install the binary libs using nvidia-installer compiled above @@ -158,29 +173,37 @@ cd $TMP/$SRCNAM --log-file-name=$PKG/var/log/nvidia-installer.log \ --egl-external-platform-config-path=$PKG/usr/share/egl/egl_external_platform.d \ --no-nvidia-modprobe \ + --no-install-libglvnd \ + --no-wine-files \ --no-systemd \ --no-peermem \ $COMP32 -# Starting with the 465 driver, the installer now places a version-specific -# binary blob in /lib/firmware/nvidia. For sanity's sake, we will move -# it into our package: -mv /lib/firmware/nvidia/$VERSION $PKG/lib/firmware/nvidia - -# Move ICDs to $PKG and cleanup (no switch option in installer?) -# (This is why there should not be a driver already installed) -mv /etc/OpenCL/vendors/nvidia.icd $PKG/etc/OpenCL/vendors/nvidia.icd -mv /etc/vulkan/icd.d/nvidia_icd.json $PKG/etc/vulkan/icd.d/nvidia_icd.json -mv /etc/vulkan/implicit_layer.d/nvidia_layers.json $PKG/etc/vulkan/implicit_layer.d/nvidia_layers.json - +# If we are using Wine, then: +if [ "${WINE:-yes}" != "no" ]; then + mkdir -p $PKG/usr/lib$LIBDIRSUFFIX/nvidia/wine + install -m 755 _nvngx.dll $PKG/usr/lib$LIBDIRSUFFIX/nvidia/wine + install -m 755 nvngx.dll $PKG/usr/lib$LIBDIRSUFFIX/nvidia/wine +fi # libOpenCL.so is now included in 15.0 (in ocl-icd), # so we don't need this one. -rm -f $PKG/usr/lib${LIBDIRSUFFIX}/libOpenCL.so.1.0.0 +rm -f $PKG/usr/lib${LIBDIRSUFFIX}/libOpenCL.so* if [ "${COMPAT32}" = "yes" ]; then - rm -f $PKG/usr/lib/libOpenCL.so.1.0.0 + rm -f $PKG/usr/lib/libOpenCL.so* +fi +# remove a pair of folders installed and used by nvidia-installer but +# no longer needed (caused the "failed to remove some directories" +# warning message): +rm -rf $PKG/usr/lib/nvidia || true +rm -rf $PKG/var/lib || true + +# if not multilib, remove the unneeded /usr/lib folder: +if [ "${COMPAT32}" != "yes" ]; then + rm -rf $PKG/usr/lib || true fi + # Mitigate a bug in nvidia-installer that misplaces a symlink -# (Thanks to marco70 on LQ for catching this: +# (Thanks to marco70 on LQ for catching this) ( cd $PKG/usr/lib${LIBDIRSUFFIX}/gbm rm -f nvidia-drm_gbm.so ln -sf ../libnvidia-allocator.so.1 nvidia-drm_gbm.so @@ -252,7 +275,9 @@ cd - # These update the paths in nvidia-settings.desktop sed -i "s|__UTILS_PATH__|/usr/bin|" $PKG/usr/share/applications/nvidia-settings.desktop sed -i "s|__PIXMAP_PATH__|/usr/share/pixmaps|" $PKG/usr/share/applications/nvidia-settings.desktop -sed -i "s|__NVIDIA_SETTINGS_DESKTOP_CATEGORIES__|Application;Settings;|" $PKG/usr/share/applications/nvidia-settings.desktop +sed -i "s|__NVIDIA_SETTINGS_DESKTOP_CATEGORIES__|Settings;|" $PKG/usr/share/applications/nvidia-settings.desktop +# Remove depcrecated entry in nvidia-settings.desktop +sed -i '/Encoding/d' $PKG/usr/share/applications/nvidia-settings.desktop # Remove xorg conf file since we handle that in nvidia-kernel rm -rf $PKG/etc/X11/xorg.conf.d @@ -276,7 +301,7 @@ fi cat $CWD/doinst.sh > $PKG/install/doinst.sh -# Add rc.nvidia-persistenced: +# Add nvidia-persistenced: if [ "${PERSISTENCED:-no}" = "yes" ]; then cd $TMP rm -rf nvidia-persistenced-$VERSION.tar.bz2 @@ -293,34 +318,13 @@ if [ "${PERSISTENCED:-no}" = "yes" ]; then CFLAGS="$SLKCFLAGS" make install -m 755 _out/Linux_$TARGET/nvidia-persistenced $PKG/usr/bin/ install -m 644 _out/Linux_$TARGET/nvidia-persistenced.1.gz $PKG/usr/man/man1/ - - if ! getent group nvidia > /dev/null 2>&1; then - echo "Creating the group nvidia:" - groupadd -g 365 nvidia || exit 1 - fi - if ! getent passwd nvidia > /dev/null 2>&1; then - echo "Creating the user nvidia:" - useradd -u 365 -g 365 -c "Nvidia" -d /dev/null -s /bin/false nvidia || exit 1 - fi - mkdir -p $PKG/var/run/nvidia-persistenced - chown nvidia:nvidia $PKG/var/run/nvidia-persistenced - mkdir -p $PKG/etc/rc.d +# install rc.nvidia-perstistenced: + mkdir -p $PKG/etc/rc.d $PKG/var/run/nvidia-persistenced install -m 755 $CWD/rc.nvidia-persistenced $PKG/etc/rc.d/rc.nvidia-persistenced sed -i "s|__USER__|nvidia|" $PKG/etc/rc.d/rc.nvidia-persistenced - cat <<EOF >> $PKG/install/doinst.sh -# Create group and user nvidia if they don't already exist -if ! getent group nvidia > /dev/null 2>&1; then - echo "Creating the group nvidia:" - groupadd -g 365 nvidia || exit 1 -fi -if ! getent passwd nvidia > /dev/null 2>&1; then - echo "Creating the user nvidia:" - useradd -u 365 -g 365 -c "Nvidia" -d /dev/null -s /bin/false nvidia || exit 1 -fi - -EOF + chown nvidia:nvidia $PKG/var/run/nvidia-persistenced fi -# Flag multlib as needed and build package. +# Flag multilib as needed and build package. cd $PKG /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION$MULTI-$TARGET-$BUILD$TAG.$PKGTYPE |