summaryrefslogtreecommitdiffstats
path: root/system/nvidia-driver/nvidia-driver.SlackBuild
diff options
context:
space:
mode:
Diffstat (limited to 'system/nvidia-driver/nvidia-driver.SlackBuild')
-rw-r--r--system/nvidia-driver/nvidia-driver.SlackBuild190
1 files changed, 83 insertions, 107 deletions
diff --git a/system/nvidia-driver/nvidia-driver.SlackBuild b/system/nvidia-driver/nvidia-driver.SlackBuild
index c6baba6ce0..d2d4ba4ff6 100644
--- a/system/nvidia-driver/nvidia-driver.SlackBuild
+++ b/system/nvidia-driver/nvidia-driver.SlackBuild
@@ -1,9 +1,9 @@
-#!/bin/sh
+#!/bin/bash
# Slackware build script for nvidia-driver
# Copyright 2012-2019 Edward W. Koenig, Vancouver, WA, US
-# Copyright 2020 Lenard Spencer, Orlando, FL, USA
+# Copyright 2020-2023 Lenard Spencer, Orlando, FL, USA
#
# All rights reserved.
#
@@ -24,14 +24,13 @@
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-# see changelog.txt
+cd $(dirname $0) ; CWD=$(pwd)
PRGNAM=nvidia-driver
-VERSION=${VERSION:-440.82}
-BUILD=${BUILD:-2}
+VERSION=${VERSION:-550.67}
+BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}
-
-CURRENT=${CURRENT:-no}
+PKGTYPE=${PKGTYPE:-tgz}
set -e
@@ -43,7 +42,6 @@ if [ -z "$ARCH" ]; then
esac
fi
-CWD=$(pwd)
TMP=${TMP:-/tmp/SBo}
PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp}
@@ -59,12 +57,26 @@ else
exit 1
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 [ "${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.
+if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
+ echo "$PRGNAM-$VERSION$MULTI-$TARGET-$BUILD$TAG.$PKGTYPE"
+ exit 0
+fi
+
+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}
@@ -74,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/var/log/nvidia/{32,64}
+ $PKG/etc/X11/glvnd/egl_vendor.d $PKG/var/log
if [ "$COMPAT32" = "yes" ]; then
mkdir -p $PKG/usr/lib/tls
@@ -91,7 +102,7 @@ rm -rf nvidia-settings-$VERSION
tar xvf $CWD/nvidia-settings-$VERSION.tar.bz2
rm -rf nvidia-xconfig-$VERSION
tar xvf $CWD/nvidia-xconfig-$VERSION.tar.bz2
-rm -rf nvidia-modprobe-$VERSION.tar.bz2
+rm -rf nvidia-modprobe-$VERSION
tar xvf $CWD/nvidia-modprobe-$VERSION.tar.bz2
sh $CWD/$SRCNAM.run --extract-only
cd $SRCNAM
@@ -104,10 +115,16 @@ find -L . \
# Compiling the various open source apps instead of using the precompiled binaries
# Compiling nvidia-installer from source
+
cd $TMP/nvidia-installer-$VERSION
-# Let's try to remove the conflicting files and GPU detection
- patch -p0 < $CWD/skip_conflict-GPU_detect.patch
+# 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 . \
@@ -128,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
@@ -154,60 +173,41 @@ 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
- # Move ICDs to $PKG and cleanup (no switch option in installer?)
-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
-# In current, mesa now puts an entry into this directory, so we
-# leave it alone if it is not empty
-if [ -z "$(ls -A /etc/OpenCL/vendors)" ]; then
- rm -rf /etc/OpenCL
+# 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
-# just in case any other programs make an entry here
-if [ -z "$(ls -A /etc/vulkan)" ]; then
- rm -rf /etc/vulkan
+# 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*
+if [ "${COMPAT32}" = "yes" ]; then
+ rm -f $PKG/usr/lib/libOpenCL.so*
fi
-
-if [ "$CURRENT" = "yes" ]; then
-# Don't ship .la files. Also, libOpenCL.so is now included
-# in current (in ocl-icd), so we don't need this one.
- rm -f $PKG/usr/lib${LIBDIRSUFFIX}/*.la
- rm -f $PKG/usr/lib${LIBDIRSUFFIX}/libOpenCL.so.1.0.0
- if [ "${COMPAT32}" = "yes" ]; then
- rm -f $PKG/usr/lib/*.la
- rm -f $PKG/usr/lib/libOpenCL.so.1.0.0
- fi
-else
-# Correct wrong paths in /usr/lib{,64}/libGL.la
- sed -i "s|$PKG||" $PKG/usr/lib${LIBDIRSUFFIX}/libGL.la
- if [ "${COMPAT32}" = "yes" ]; then
-# This one points to /usr/ instead of /usr/lib/, so we need to fix it anyway
- sed -i "s|$PKG/usr|/usr/lib|" $PKG/usr/lib/libGL.la
- fi
-# save libGL.la for 14.2
- cd $PKG/usr/lib$LIBDIRSUFFIX
- mv libGL.la libGL.la-nvidia
- cd -
- if [ "${COMPAT32}" = "yes" ]; then
- cd $PKG/usr/lib
- mv libGL.la libGL.la-nvidia
- cd -
- fi
-# Bash script to cleanly install (in doinst.sh) and uninstall the nvidia
-# files so we don't stomp on the overlapping xorg files.
-# Note: switching can be problematic ;-)
- install -m 0755 $CWD/nvidia-switch $PKG/usr/sbin/
- sed -i s/PKGVERSION/$VERSION/g $PKG/usr/sbin/nvidia-switch
- sed -i s/LIBDIRSUFFIX/$LIBDIRSUFFIX/g $PKG/usr/sbin/nvidia-switch
- if [ ${COMPAT32} = "yes" ]; then
- sed -i s/LIB32FLAG/yes/g $PKG/usr/sbin/nvidia-switch
- else
- sed -i s/LIB32FLAG/no/g $PKG/usr/sbin/nvidia-switch
- 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)
+( cd $PKG/usr/lib${LIBDIRSUFFIX}/gbm
+rm -f nvidia-drm_gbm.so
+ ln -sf ../libnvidia-allocator.so.1 nvidia-drm_gbm.so
+)
# Compile utilites from source, replacing the precompiled versions
#
# Compiling nvidia-settings
@@ -275,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
@@ -292,19 +294,14 @@ cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
sed "s/PKGVERSION/$VERSION/g" $CWD/slack-desc > $PKG/install/slack-desc
if [ "$COMPAT32" = "yes" ]; then
- sed -i "s|@MULTILIB@| This package includes the 32-bit libraries.|" $PKG/install/slack-desc
+ sed -i "s|nvidia-driver: @MULTILIB@|nvidia-driver: This package includes the 32-bit libraries.|" $PKG/install/slack-desc
else
- sed -i "s|@MULTILIB@||" $PKG/install/slack-desc
+ sed -i "s|nvidia-driver: @MULTILIB@|nvidia-driver:|" $PKG/install/slack-desc
fi
cat $CWD/doinst.sh > $PKG/install/doinst.sh
-# 14.2 needs nvidia-switch, -current does not
-if [ "$CURRENT" = "no" ]; then
- echo -e "usr/sbin/nvidia-switch --install\n" >> $PKG/install/doinst.sh
-fi
-
-# Add rc.nvidia-persistenced:
+# Add nvidia-persistenced:
if [ "${PERSISTENCED:-no}" = "yes" ]; then
cd $TMP
rm -rf nvidia-persistenced-$VERSION.tar.bz2
@@ -321,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:-tgz}
+/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION$MULTI-$TARGET-$BUILD$TAG.$PKGTYPE