aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--system/nvidia-legacy390-driver/README59
-rw-r--r--system/nvidia-legacy390-driver/changelog.txt40
-rw-r--r--system/nvidia-legacy390-driver/doinst.sh6
-rw-r--r--system/nvidia-legacy390-driver/nvidia-legacy390-driver.SlackBuild357
-rw-r--r--system/nvidia-legacy390-driver/nvidia-legacy390-driver.info30
-rw-r--r--system/nvidia-legacy390-driver/nvidia-switch266
-rw-r--r--system/nvidia-legacy390-driver/skip_conflict-GPU_detect.patch29
-rw-r--r--system/nvidia-legacy390-driver/slack-desc19
8 files changed, 806 insertions, 0 deletions
diff --git a/system/nvidia-legacy390-driver/README b/system/nvidia-legacy390-driver/README
new file mode 100644
index 0000000000000..e608bf4c9693d
--- /dev/null
+++ b/system/nvidia-legacy390-driver/README
@@ -0,0 +1,59 @@
+This is the proprietary binary video driver from NVidia for the X.Org
+X-server. This package does not include the kernel module - it is a part
+of the nvidia-legacy390-kernel package at SlackBuilds.org.
+
+Installing the 32-bit compatibility libraries is available: if desired, do:
+ COMPAT32="yes" ./nvidia-legacy390-driver.SlackBuild
+
+GLVND GLX client libraries are now the default. If these cause any
+compatibility issues with older GLX sofware, either upgrade your software
+or try:
+ GLVND="no" ./nvidia-legacy390-driver.SlackBuild
+
+Several useful utilities are included: nvidia-xsettings, nvidia-smi, and
+nvidia-settings. Please refer to the Nvidia documentation and man pages
+for details and usage.
+
+For CUDA/OpenCL to work after reboot, and for utilites such as nvidia-smi,
+you might need to include the following line in your /etc/rc.d/rc.local:
+-------------8<---------------
+# Create missing nvidia device nodes after reboot
+/usr/bin/nvidia-modprobe -c 0 -u
+------------->8---------------
+
+Since this nvidia-legacy390-driver conflicts with some files of xorg, it's
+a bit complex to install/uninstall the driver. However, installation of the
+nvidia-legacy390-driver package itself backs up the conflicting files and puts
+the nvidia-specific files into place.
+
+Included is a script called nvidia-switch, which is used to switch from
+the xorg driver to the nvidia driver, but it will not edit xorg.conf
+for you; you have to do that manually. The nvidia-switch script is
+installed to /usr/sbin. NOTE: Although nvidia-switch is aware of a
+COMPAT32 environment, its use therein is not supported.
+
+Usage of nvidia-switch:
+ nvidia-switch --install <--> install the nvidia files and save the
+ stock xorg files.
+ nvidia-switch --remove <--> remove the nvidia files and symlinks and
+ restore the stock xorg files.
+
+You do NOT have to run nvidia-switch after installing the package.
+
+Before uninstalling or upgrading this package, it is important that
+you execute 'nvidia-switch --remove', which will switch back to the
+stock xorg files and remove all links created by nvidia-switch during
+installation. If you forget to do this, you might have to do the switch
+manually, since 'nvidia-switch --install' may fail, resulting in xorg
+not working. Here are the affected files:
+
+ /usr/lib[64]/libGL.so.1.2
+ /usr/lib[64]/libGL.la
+ /usr/lib[64]/libGLESv1_CM.so.1.0.0
+ /usr/lib[64]/libGLESv2.so.2.0.0
+ /usr/lib[64]/libEGL.so.1.0.0
+ /usr/lib[64]/xorg/modules/libwfb.so
+ /usr/lib[64]/xorg/modules/extensions/libglx.so
+
+Simply remove the dead nvidia symlinks and and reinstall the mesa and
+xorg-server packages. See 'nvidia-switch --help'.
diff --git a/system/nvidia-legacy390-driver/changelog.txt b/system/nvidia-legacy390-driver/changelog.txt
new file mode 100644
index 0000000000000..54bb2043a76f2
--- /dev/null
+++ b/system/nvidia-legacy390-driver/changelog.txt
@@ -0,0 +1,40 @@
+1.0 20-MAR-2011 New Maintainer: Edward W. Koenig <kingbeowulf@gmail.com>
+1.1 10-APR-2011 updated to new version, testing 13.37rc4.6692
+1.2 27-MAY-2011 new version, allow multilib option, minor edits
+1.2.1 20-JUN-2011 minor edits, thanks to Robby and Roberto
+1.5 01-JUL-2011 new version, single driver download, add switch to select pure x86_64 or x86_64 with 32-bit compatibility.
+1.6 27-AUG-2011 version bump, minor edits
+1.7 21-OCT-2011 version bump
+1.8 24-MAR-2012 version bump, fix to nvidia-switch thanks to Phill W.
+1.9 02-AUG-2012 version bmp, fixes, updates, nvidia-switch for install/uninstall only
+2.0 21-AUG-2012 new version (important security fix), missing vdpau-nvidia, dropped *.h
+2.1 25-AUG-2012 new version -Long Lived Branch, fixed symlinks (per Das email)
+2.2 22-NOV-2012 new version -Long Lived Branch. Updates: libs, apps
+2.3 15-FEB-2013 new version -Long Lived Branch.
+2.4 19-MAY-2013 new version -Long Lived Branch.
+2.6 20-OCT-2013 new version -Long Lived Branch, add new lib, fix nvidia-switch --remove
+3.0 13-NOV-2013 new version (LLB), update libs
+3.1 12-APR-2014 new version (LLB), update libs
+3.2a 12-JUL-2014 new version (LLB), update libs and bug fixes, fix /dev/nvidia-uvm
+3.3 20-NOV-2014 new version (LLB), update libs, fix nvidia-switch
+3.4 11-JAN-2015 new version (LLB), monitor detection bug fix, add libEGL/GLES
+4.0 07-FEB-2015 new long lived branch, version update, bug fixes
+4.1 27-APR-2015 version update LLB, fix $VERSION usage
+4.2 28-JUL-2015 version update LLB, bug fixes, clean-ups.
+4.3 05-SEP-2015 version update LLB
+4.4 13-DEC-2015 version update, X.Org 1.18 support
+4.5 12-MAR-2016 version update LLB, symlink fixes, drop nvidia-installer, get ready for 14.2
+4.5a 26-MAR-2016 fixed broken symlinks
+4.6 24-APR-2016 version update LLB, fix symlinks, added to version if multilib
+4.7 31-APR-2016 version update LLB, added nvidia-installer, updated libs/symlinks
+5.0 20-FEB-2017 version update LLB, security fixes, updated libs/symlinks, nvidia-switch
+5.1 01-APR-2017 fix nvidia-switch lib names to prevent bad ldconfig symlinks on reboot
+5.2 02-JUN-2017 version update LLB, refactor/debug scripts, use nvidia-installer
+5.3 13-OCT-2017 version update LLB, bug fixes, update copyright
+5.4 18-FEB-2018 version update LLB, updates, bug fix (thanks Leo)
+5.5 25-MAR-2018 version update LLB
+5.6 23-APR-2018 version update LLB, update symlinks, fix changelog formatting
+5.7 28-MAY-2018 version update LLB
+5.8 30-JUL-2018 version update LLB
+5.9 06-SEP-2018 version update LLB
+6.0 09-NOV-2019 renamed to nvidia-legacy390; last version to support 32-bit CPU.
diff --git a/system/nvidia-legacy390-driver/doinst.sh b/system/nvidia-legacy390-driver/doinst.sh
new file mode 100644
index 0000000000000..8ee62f049edb4
--- /dev/null
+++ b/system/nvidia-legacy390-driver/doinst.sh
@@ -0,0 +1,6 @@
+if [ -x /usr/bin/update-desktop-database ]; then
+ /usr/bin/update-desktop-database -q usr/share/applications
+fi
+
+./usr/sbin/nvidia-switch --install
+
diff --git a/system/nvidia-legacy390-driver/nvidia-legacy390-driver.SlackBuild b/system/nvidia-legacy390-driver/nvidia-legacy390-driver.SlackBuild
new file mode 100644
index 0000000000000..a43fb0ca7d239
--- /dev/null
+++ b/system/nvidia-legacy390-driver/nvidia-legacy390-driver.SlackBuild
@@ -0,0 +1,357 @@
+#!/bin/sh
+
+# Slackware build script for nvidia-legacy390-driver
+
+# Copyright 2012-2017 Edward W. Koenig, Vancouver, WA, USA
+# All rights reserved.
+#
+# Redistribution and use of this script, with or without modification, is
+# permitted provided that the following conditions are met:
+#
+# 1. Redistributions of this script must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ''AS IS'' AND ANY EXPRESS OR IMPLIED
+# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
+# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+# see changelog.txt
+
+PRGNAM=nvidia-legacy390-driver
+VERSION=${VERSION:-390.87}
+BUILD=${BUILD:-1}
+TAG=${TAG:-_SBo}
+
+GLVND=${GLVND:-yes}
+# libglnvd may land in mesa and is Nvidia recommended
+
+set -e
+
+if [ -z "$ARCH" ]; then
+ case "$( uname -m )" in
+ i?86) ARCH=i586 ;;
+ arm*) ARCH=arm ;;
+ *) ARCH=$( uname -m ) ;;
+ esac
+fi
+
+CWD=$(pwd)
+TMP=${TMP:-/tmp/SBo}
+PKG=$TMP/package-$PRGNAM
+OUTPUT=${OUTPUT:-/tmp}
+
+if [ "$ARCH" = "i586" ]; then
+ SLKCFLAGS="-O2 -march=i586 -mtune=i686"
+ TARGET="x86"
+ LIBDIRSUFFIX=""
+ COMPAT32=no
+elif [ "$ARCH" = "i686" ]; then
+ SLKCFLAGS="-O2 -march=i686 -mtune=i686"
+ TARGET="x86"
+ LIBDIRSUFFIX=""
+ COMPAT32=no
+elif [ "$ARCH" = "x86_64" ]; then
+ SLKCFLAGS="-O2 -fPIC"
+ TARGET="x86_64"
+ LIBDIRSUFFIX="64"
+# Set 32-bit compatibility flag default
+ COMPAT32=${COMPAT32:-no}
+else
+ SLKCFLAGS="-O2"
+ LIBDIRSUFFIX=""
+ COMPAT32=no
+fi
+
+SRCNAM=NVIDIA-Linux-$TARGET-${VERSION}
+
+# make a clean package directory tree
+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/usr/share/{applications,nvidia,pixmaps,egl/egl_external_platform.d} \
+ $PKG/usr/include/GL $PKG/etc/vulkan/icd.d $PKG/etc/X11/xorg.conf.d \
+ $PKG/etc/X11/glvnd/egl_vendor.d $PKG/var/log/nvidia/{32,64} \
+
+if [ "$COMPAT32" = "yes" ]; then
+ mkdir -p $PKG/usr/lib/tls
+fi
+
+# Extract all the sources
+cd $TMP
+rm -rf nvidia-installer-$VERSION
+tar xvf $CWD/nvidia-installer-$VERSION.tar.bz2
+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
+tar xvf $CWD/nvidia-modprobe-$VERSION.tar.bz2
+rm -rf nvidia-persistenced-$VERSION.tar.bz2
+tar xvf $CWD/nvidia-persistenced-$VERSION.tar.bz2
+sh $CWD/$SRCNAM.run --extract-only
+cd $SRCNAM
+chown -R root:root .
+find -L . \
+ \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
+ -o -perm 511 \) -exec chmod 755 {} \; -o \
+ \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
+ -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
+
+# 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
+
+ chown -R root:root .
+ find -L . \
+ \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
+ -o -perm 511 \) -exec chmod 755 {} \; -o \
+ \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
+ -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
+
+ CFLAGS="$SLKCFLAGS" LDFLAGS="-lz" make
+
+ install -m 755 _out/Linux_$TARGET/nvidia-installer $PKG/usr/bin/
+ install -m 644 _out/Linux_$TARGET/nvidia-installer.1.gz $PKG/usr/man/man1/
+
+cd -
+
+# Now we need to copy the newly patched and compiled nvidia-installer
+# to the driver source tree for use
+mv -f $PKG/usr/bin/nvidia-installer $TMP/$SRCNAM
+mv -f $PKG/usr/man/man1/nvidia-installer.1.gz $TMP/$SRCNAM
+
+# Configure options
+if [ "$GLVND" = "yes" ]; then
+ GLVNDOPT="--install-libglvnd --glvnd-glx-client --glvnd-egl-client"
+else
+ GLVNDOPT="--no-install-libglvnd --no-glvnd-glx-client --no-glvnd-egl-client"
+fi
+if [ "$ARCH" = "x86_64" -a "${COMPAT32}" = "yes" ]; then
+ COMP32="--install-compat32-libs --compat32-prefix=$PKG/usr"
+ MULTI="_multi"
+else
+ if [ ! "$ARCH" = "x86_64" ]; then
+ COMP32=""
+ else
+ COMP32="--no-install-compat32-libs"
+ MULTI=""
+ fi
+fi
+
+# Install the binary libs using nvidia-installer compiled above
+cd $TMP/$SRCNAM
+./nvidia-installer -s --no-kernel-module --no-drm --no-unified-memory \
+ -z -n -b --no-rpms --no-distro-scripts \
+ --no-kernel-module-source --no-x-check --force-libglx-indirect \
+ --x-prefix=$PKG/usr \
+ --x-module-path=$PKG/usr/lib${LIBDIRSUFFIX}/xorg/modules \
+ --x-library-path=$PKG/usr/lib${LIBDIRSUFFIX} \
+ --x-sysconfig-path=$PKG/etc/X11/xorg.conf.d \
+ --opengl-prefix=$PKG/usr \
+ --utility-prefix=$PKG/usr \
+ --utility-libdir=lib${LIBDIRSUFFIX} \
+ --documentation-prefix=$PKG/usr \
+ --application-profile-path=$PKG/usr/share/nvidia \
+ --glvnd-egl-config-path=$PKG/etc/X11/glvnd/egl_vendor.d \
+ --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 \
+ $GLVNDOPT \
+ $COMP32
+
+# Clean-up: we really do not need this:
+rm -rf /var/lib/nvidia
+# which 32-bit tls? why? why?
+if [ "$ARCH" = "x86_64" -a "${COMPAT32}" = "yes" ]; then
+ install -m 755 32/tls/libnvidia-tls.so.$VERSION $PKG/usr/lib/tls/libnvidia-tls.so.$VERSION
+ cd $PKG/usr/lib
+ ln -sf tls/libnvidia-tls.so.$VERSION libnvidia-tls.so.$VERSION
+ cd -
+fi
+
+# Compile utilites from source, replacing the precompiled versions
+#
+# Compiling nvidia-settings
+cd $TMP/nvidia-settings-$VERSION
+ chown -R root:root .
+ find -L . \
+ \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
+ -o -perm 511 \) -exec chmod 755 {} \; -o \
+ \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
+ -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
+
+ cd src/libXNVCtrl
+ make clean
+ CFLAGS="$SLKCFLAGS" \
+ make
+ cd ../../
+
+ CFLAGS="$SLKCFLAGS" \
+ make
+
+ install -m 755 src/_out/Linux_$TARGET/nvidia-settings $PKG/usr/bin/
+ install -m 644 doc/_out/Linux_$TARGET/nvidia-settings.1.gz $PKG/usr/man/man1/
+ install -m 644 doc/nvidia-settings.desktop $PKG/usr/share/applications/
+ install -m 644 doc/nvidia-settings.png $PKG/usr/share/pixmaps/
+# For nvidia-settings GUI support
+ install -m 755 src/_out/Linux_$TARGET/libnvidia-gtk2.so $PKG/usr/lib$LIBDIRSUFFIX/libnvidia-gtk2.so.$VERSION
+ install -m 755 src/_out/Linux_$TARGET/libnvidia-gtk3.so $PKG/usr/lib$LIBDIRSUFFIX/libnvidia-gtk3.so.$VERSION
+cd -
+
+# Compiling nvidia-xconfig
+cd $TMP/nvidia-xconfig-$VERSION
+ chown -R root:root .
+ find -L . \
+ \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
+ -o -perm 511 \) -exec chmod 755 {} \; -o \
+ \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
+ -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
+
+ CFLAGS="$SLKCFLAGS" \
+ make
+
+ install -m 755 _out/Linux_$TARGET/nvidia-xconfig $PKG/usr/bin/
+ install -m 644 _out/Linux_$TARGET/nvidia-xconfig.1.gz $PKG/usr/man/man1/
+cd -
+
+# Some optional utilities, such as laptop for possible GPU switching and
+# nvidia-modprobe needed to create device nodes, see README!
+# FIXME: Needs cleanup at a later date.
+
+# Compiling nvidia-modprobe
+ cd $TMP/nvidia-modprobe-$VERSION
+ chown -R root:root .
+ find -L . \
+ \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
+ -o -perm 511 \) -exec chmod 755 {} \; -o \
+ \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
+ -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
+
+ CFLAGS="$SLKCFLAGS" make
+
+ install -m 755 _out/Linux_$TARGET/nvidia-modprobe $PKG/usr/bin/
+ install -m 644 _out/Linux_$TARGET/nvidia-modprobe.1.gz $PKG/usr/man/man1/
+ cd -
+
+# Compiling nvidia-persistenced
+ cd $TMP/nvidia-persistenced-$VERSION
+ chown -R root:root .
+ find -L . \
+ \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
+ -o -perm 511 \) -exec chmod 755 {} \; -o \
+ \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
+ -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
+
+ CFLAGS="$SLKCFLAGS" make
+#FIXME: need rc.nvidia-persistenced script; see doc
+ 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/
+ cd -
+
+# 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 [ "$GLVND" = "yes" ]; then
+ sed -i s/GLVNDFLAG/yes/g $PKG/usr/sbin/nvidia-switch
+else
+ sed -i s/GLVNDFLAG/no/g $PKG/usr/sbin/nvidia-switch
+fi
+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
+
+# These add or correct wrong paths
+sed -i "s|$TMP/package-$PRGNAM/usr|/usr|" $PKG/usr/lib$LIBDIRSUFFIX/libGL.la
+sed -i "s|/usr/X11R6/lib|/usr/lib$LIBDIRSUFFIX|" $PKG/usr/lib$LIBDIRSUFFIX/libGL.la
+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
+
+if [ "$ARCH" = "x86_64" -a "${COMPAT32}" = "yes" ]; then
+ sed -i "s|$TMP/package-$PRGNAM/usr|/usr|" $PKG/usr/lib/libGL.la
+ sed -i "s|/usr/X11R6/lib|/usr/lib|" $PKG/usr/lib/libGL.la
+ sed -i "s|'/usr/'|'/usr/lib'|" $PKG/usr/lib/libGL.la
+fi
+
+# rename wrong/conficting files as needed; remove conflicting symlinks created by installer
+cd $PKG/usr/lib$LIBDIRSUFFIX
+ if [ "$GLVND" = "yes" ]; then
+ mv libEGL.so.1.1.0 libEGL.so.1.1.0-nvidia
+ fi
+ mv libGL.la libGL.la-nvidia
+ mv libGLESv1_CM.so.1.2.0 libGLESv1_CM.so.1.2.0-nvidia
+ mv libGLESv2.so.2.1.0 libGLESv2.so.2.1.0-nvidia
+ rm -f libEGL.so
+ rm -f libGL.so
+ rm -f libGL.so.1
+ rm -f libGLESv1_CM.so
+ rm -f libGLESv2.so
+ rm -f xorg/modules/libwfb.so
+ rm -f xorg/modules/extensions/libglx.so
+cd -
+
+if [ "$ARCH" = "x86_64" -a "${COMPAT32}" = "yes" ]; then
+ cd $PKG/usr/lib
+ if [ "$GLVND" = "yes" ]; then
+ mv libEGL.so.1.1.0 libEGL.so.1.1.0-nvidia
+ fi
+ mv libGL.la libGL.la-nvidia
+ mv libGLESv1_CM.so.1.2.0 libGLESv1_CM.so.1.2.0-nvidia
+ mv libGLESv2.so.2.1.0 libGLESv2.so.2.1.0-nvidia
+ rm -f libEGL.so
+ rm -f libGL.so
+ rm -f libGL.so.1
+ rm -f libGLESv1_CM.so
+ rm -f libGLESv2.so
+ cd -
+# FIXME With COMPAT32=yes on pure x86_64, a weird /usr/lib/libGL.so.1 symlink to $PKG/usr/lib64/libGL.so.1
+# appears? Who would do this, so ignoring for now.
+fi
+
+# 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
+rm -rf /etc/OpenCL
+rm -rf /etc/vulkan
+
+# Remove xorg conf file since we take care of that in nvidia-legacy390-driver
+rm -rf $PKG/etc/X11/xorg.conf.d
+
+cat <<EOF > $PKG/var/log/nvidia/README.txt
+Do NOT delete this directory!
+nvidia-switch will backup the original X.org libraries here.
+EOF
+
+cd $TMP/$SRCNAM
+# put docs in the right place
+mv $PKG/usr/share/man/man1/nvidia-* $PKG/usr/man/man1
+rm -rf $PKG/usr/share/man
+mv $PKG/usr/share/doc/NVIDIA_GLX-1.0 $PKG/usr/doc/$PRGNAM-$VERSION
+rm -rf $PKG/usr/share/doc
+cp -a LICENSE NVIDIA_Changelog README.txt $PKG/usr/doc/$PRGNAM-$VERSION
+cat $CWD/README > $PKG/usr/doc/$PRGNAM-$VERSION/README.Slackware
+cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
+
+sed "s/PKGVERSION/$VERSION/g" $CWD/slack-desc > $PKG/install/slack-desc
+cat $CWD/doinst.sh > $PKG/install/doinst.sh
+
+# Flag install as multlib as needed and build package.
+cd $PKG
+/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION$MULTI-$TARGET-$BUILD$TAG.${PKGTYPE:-tgz}
diff --git a/system/nvidia-legacy390-driver/nvidia-legacy390-driver.info b/system/nvidia-legacy390-driver/nvidia-legacy390-driver.info
new file mode 100644
index 0000000000000..52f803c311ed8
--- /dev/null
+++ b/system/nvidia-legacy390-driver/nvidia-legacy390-driver.info
@@ -0,0 +1,30 @@
+PRGNAM="nvidia-legacy390-driver"
+VERSION="390.87"
+HOMEPAGE="http://www.nvidia.com"
+DOWNLOAD="https://download.nvidia.com/XFree86/Linux-x86/390.87/NVIDIA-Linux-x86-390.87.run \
+ https://download.nvidia.com/XFree86/nvidia-installer/nvidia-installer-390.87.tar.bz2 \
+ https://download.nvidia.com/XFree86/nvidia-modprobe/nvidia-modprobe-390.87.tar.bz2 \
+ https://download.nvidia.com/XFree86/nvidia-persistenced/nvidia-persistenced-390.87.tar.bz2 \
+ https://download.nvidia.com/XFree86/nvidia-settings/nvidia-settings-390.87.tar.bz2 \
+ https://download.nvidia.com/XFree86/nvidia-xconfig/nvidia-xconfig-390.87.tar.bz2"
+MD5SUM="c21fd1e9048d3cf12552a9e9035df3cf \
+ c9c0601e5a8ef8242b39033b69f914a6 \
+ 36c72558fa7d344445851f760a86b5ba \
+ 4143b80f8e0443348514b4b529c518d8 \
+ f75356a74ce19adfd4ca50d8f7811e07 \
+ 8e7c994a931cd6ce5a384bda6bded72c"
+DOWNLOAD_x86_64="https://download.nvidia.com/XFree86/Linux-x86_64/390.87/NVIDIA-Linux-x86_64-390.87.run \
+ https://download.nvidia.com/XFree86/nvidia-installer/nvidia-installer-390.87.tar.bz2 \
+ https://download.nvidia.com/XFree86/nvidia-modprobe/nvidia-modprobe-390.87.tar.bz2 \
+ https://download.nvidia.com/XFree86/nvidia-persistenced/nvidia-persistenced-390.87.tar.bz2 \
+ https://download.nvidia.com/XFree86/nvidia-settings/nvidia-settings-390.87.tar.bz2 \
+ https://download.nvidia.com/XFree86/nvidia-xconfig/nvidia-xconfig-390.87.tar.bz2"
+MD5SUM_x86_64="35c36552e252a18297d6e1b976ef247c \
+ c9c0601e5a8ef8242b39033b69f914a6 \
+ 36c72558fa7d344445851f760a86b5ba \
+ 4143b80f8e0443348514b4b529c518d8 \
+ f75356a74ce19adfd4ca50d8f7811e07 \
+ 8e7c994a931cd6ce5a384bda6bded72c"
+REQUIRES="nvidia-legacy390-kernel"
+MAINTAINER="Edward W. Koenig"
+EMAIL="kingbeowulf@gmail.com"
diff --git a/system/nvidia-legacy390-driver/nvidia-switch b/system/nvidia-legacy390-driver/nvidia-switch
new file mode 100644
index 0000000000000..7d97f3304b6fe
--- /dev/null
+++ b/system/nvidia-legacy390-driver/nvidia-switch
@@ -0,0 +1,266 @@
+#!/bin/sh
+
+# Copyright 2012-2017 Edward W. Koenig, Vancouver, WA, USA
+# All rights reserved.
+#
+# Redistribution and use of this script, with or without modification, is
+# permitted provided that the following conditions are met:
+#
+# 1. Redistributions of this script must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ''AS IS'' AND ANY EXPRESS OR IMPLIED
+# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
+# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# nvidia-switch utility 4.0
+#
+# A tool to install and cleanly remove the nvidia driver without stomping on the xorg files.
+# Note: this tool "should" allow switching on the fly, but why? Pick a driver! You will still
+# need to edit a bunch of other config files.
+
+# TO-DO: needs more cleanup, simplify linking using system tools
+
+ROOT="${ROOT:-/}"
+CWD=$(pwd)
+COMPAT32="LIB32FLAG" # This will be replaced in the build script (yes | no)
+LIBSUFFIX="LIBDIRSUFFIX" # This will be replaced in the build script
+INC="${ROOT}usr/include/GL"
+LIB="${ROOT}usr/lib${LIBSUFFIX}"
+LIB32="${ROOT}usr/lib"
+XMOD="${LIB}/xorg/modules"
+XLIB="$XMOD/extensions"
+NV_VERSION="PKGVERSION" # This will be replaced in the build script
+GL_VERSION="1.2.0"
+GLVND="GLVNDFLAG" # This will be replaced in the build script (yes | no)
+NV_CONF="${ROOT}usr/share/X11/xorg.conf.d/10-nvidia.conf"
+SAVELIBS="${ROOT}var/log/nvidia"
+
+save_GL(){
+# backup original mesa and xorg conflicts to /var/log/nvidia
+ cd $2
+ # Need to make sure save path is reset incase of multilib
+ SAVELIBS="${ROOT}var/log/nvidia"
+ if [ "$2" = "$LIB32" ]; then
+ SAVELIBS="${SAVELIBS}/32"
+ elif [ "$2" = "$LIB" ]; then
+ SAVELIBS="${SAVELIBS}/64"
+ fi
+
+ case "$1" in
+ "nvidia")
+
+ mv libGL.so.$GL_VERSION $SAVELIBS/libGL.so.$GL_VERSION
+ mv libGL.la $SAVELIBS/libGL.la
+ mv libEGL.so.1.0.0 $SAVELIBS/libEGL.so.1.0.0
+ mv libGLESv1_CM.so.1.1.0 $SAVELIBS/libGLESv1_CM.so.1.1.0
+ mv libGLESv2.so.2.0.0 $SAVELIBS/libGLESv2.so.2.0.0
+ mv libGL.la-nvidia libGL.la
+
+ if [ "$GLVND" = "yes" ]; then
+ ln -sf libGL.so.1.7.0 libGL.so.1
+ ln -sf libGL.so.1.7.0 libGL.so
+ ln -sf libEGL.so.1.1.0-nvidia libEGL.so.1.1.0
+ ln -sf libEGL.so.1.1.0-nvidia libEGL.so
+ else
+ ln -sf libGL.so.$NV_VERSION libGL.so.1
+ ln -sf libGL.so.$NV_VERSION libGL.so
+ ln -sf libEGL.so.$NV_VERSION libEGL.so.1
+ ln -sf libEGL.so.$NV_VERSION libEGL.so
+ fi
+
+ ln -sf libGLESv1_CM.so.1.2.0-nvidia libGLESv1_CM.so.1.2.0
+ ln -sf libGLESv1_CM.so.1.2.0-nvidia libGLESv1_CM.so.1
+ ln -sf libGLESv1_CM.so.1.2.0-nvidia libGLESv1_CM.so
+
+ ln -sf libGLESv2.so.2.1.0-nvidia libGLESv2.so.2.1.0
+ ln -sf libGLESv2.so.2.1.0-nvidia libGLESv2.so.2
+ ln -sf libGLESv2.so.2.1.0-nvidia libGLESv2.so
+ ;;
+
+ "xorg")
+ mv libGL.la libGL.la-nvidia
+ mv $SAVELIBS/libGL.so.$GL_VERSION libGL.so.$GL_VERSION
+ mv $SAVELIBS/libGL.la libGL.la
+ mv $SAVELIBS/libEGL.so.1.0.0 libEGL.so.1.0.0
+ mv $SAVELIBS/libGLESv1_CM.so.1.1.0 libGLESv1_CM.so.1.1.0
+ mv $SAVELIBS/libGLESv2.so.2.0.0 libGLESv2.so.2.0.0
+
+ ln -sf libGL.so.$GL_VERSION libGL.so.1
+ ln -sf libGL.so.$GL_VERSION libGL.so
+ ln -sf libEGL.so.1.0.0 libEGL.so.1
+ ln -sf libEGL.so.1.0.0 libEGL.so
+ rm -f libEGL.so.1.1.0
+
+ ln -sf libGLESv1_CM.so.1.1.0 libGLESv1_CM.so.1
+ ln -sf libGLESv1_CM.so.1.1.0 libGLESv1_CM.so
+ ln -sf libGLESv2.so.2.0.0 libGLESv2.so.2
+ ln -sf libGLESv2.so.2.0.0 libGLESv2.so
+ rm -f libGLESv1_CM.so.1.2.0
+ rm -f libGLESv2.so.2.1.0
+ ;;
+
+ *)
+ echo "nothing to do for save_gl?"
+ exit 1
+ ;;
+ esac
+ cd "$CWD"
+}
+
+save_glx(){
+ cd "$XLIB"
+ case "$1" in
+ "nvidia")
+ if [ -e libglx.so ]; then
+ mv libglx.so xorg-libglx.so
+ fi
+ ln -sf libglx.so.$NV_VERSION libglx.so
+ ;;
+ "xorg")
+ if [ -e xorg-libglx.so ]; then
+ rm -f libglx.so
+ mv xorg-libglx.so libglx.so
+ else
+ rm -f libglx.so
+ fi
+ ;;
+ *)
+ echo "nothing to do for save_glx?"
+ exit 1
+ ;;
+ esac
+ cd "$CWD"
+}
+
+save_wfb(){
+ cd "$XMOD"
+ if [ -e libwfb.so ]; then
+ echo "Using existing Xorg libwfb..."
+ else
+ if [ "$1" = "nvidia" ]; then
+ ln -sf libwfb.so.$NV_VERSION libwfb.so.1
+ ln -sf libwfb.so.1 libwfb.so
+ fi
+ if [ "$1" = "xorg" ]; then
+ rm -f libwfb.so
+ rm -f libwfb.so.1
+ fi
+ fi
+ cd "$CWD"
+}
+
+nvidia_install(){
+ if [ ! -d $SAVELIBS ]; then
+ echo "Creating missing $SAVELIB ..."
+ mkdir -p $SAVELIBS
+ fi
+ echo $'Installing to nvidia-legacy390-driver files!\n'
+ echo "Make sure the nvidia driver is ENABLED in /etc/X11/xorg.conf"
+ echo "and in /etc/X11/xorg.conf.d."
+ echo "Otherwise, this may lead to improperly working drivers."
+
+ save_glx "nvidia"
+ save_GL "nvidia" $LIB
+ save_wfb "nvidia"
+# Check for multilib configuration
+ if [ "$COMPAT32" = "yes" ]; then
+ save_GL "nvidia" $LIB32
+ fi
+}
+
+nvidia_remove(){
+ echo $'Returning to stock xorg files!\n'
+ echo "Make sure the nvidia driver is DISABLED in /usr/share/X11/xorg.conf.d"
+ echo "/etc/X11/xorg.conf and in /etc/X11/xorg.conf.d."
+ echo "Otherwise, this may lead to improperly working drivers."
+
+ save_glx "xorg"
+ save_GL "xorg" $LIB
+ save_wfb "xorg"
+
+# Check for multilib configuration
+ if [ "$COMPAT32" = "yes" ]; then
+ save_GL "xorg" $LIB32
+ fi
+
+ if [ -e $NV_CONF ]; then
+ echo "removing $NV_CONF: you will need to provide your own"
+ echo "or reinstall nvidia-legacy390-driver."
+ rm -f $NV_CONF
+ fi
+}
+
+restore(){
+# Attempt to reinstall damaged stock packages if something went wrong.
+# Obviously, you will need to run this after '--remove' and before
+# 'removepkg nvidia-legacy390-driver'.
+# User must:
+# 1. remove any dangling symlinks and xorg-*, *-nvidia files in /usr/lib*/,
+# and any other housekeeping tasks.
+# 2. copy stock Slackware packages to /root/Slackware or provide an alternate location
+# 3. be running Slackware-14.2, not current
+# 4. realize that COMPAT32 is not stable ;-)
+
+if [ "$LIBSUFFIX" = "64" ]; then
+ ARCH="x86_64"
+else
+ ARCH="x86"
+fi
+
+PKGPATH=${PKGPATH:-/root/Slackware}
+MESA="mesa-11.2.2-$ARCH-1.txz"
+MESA32="mesa-compat32-11.2.2-$ARCH-1compat32.txz"
+XORG="xorg-server-1.18.3-$ARCH-2.txz"
+# Note: The above is for stock 14.2; modify as needed for /patches or
+# multilib updates
+if [ -d $PKGPATH ]; then
+ if [ `find $PKGPATH -prune -empty -type d` ]; then
+ echo "Your $PKGPATH is empty!"
+ else
+ upgradepkg --reinstall --install-new $MESA $XORG
+ if [ "COMPAT32" = "yes" ]; then
+ upgradepkg --reinstall --install-new $MESA32
+ fi
+ fi
+else
+ echo "Please create $PKGPATH containing the appropriate packages"
+fi
+}
+
+usage(){
+ echo "Usage:"
+ echo " --install Set up nvidia driver files"
+ echo " --remove Return to stock xorg files and restore all symlinks"
+ echo " --restore Reinstall stock Mesa and xorg-server [EXPERIMENTAL]"
+ echo " mesa-11.2.2, org-server-1.18.3, and optionally"
+ echo " mesa-compat32-11.2.2 are expected in /root/Slackware"
+ echo " Use 'PKGPATH=\"<location>\" nvidia-switch --restore'"
+ echo " to override."
+ echo " --help Show this help message"
+}
+
+case "$1" in
+ "--install")
+ nvidia_install
+ ;;
+ "--remove")
+ nvidia_remove
+ ;;
+ "--restore")
+ restore
+ ;;
+ "--help")
+ usage
+ ;;
+ *)
+ usage
+ ;;
+esac
diff --git a/system/nvidia-legacy390-driver/skip_conflict-GPU_detect.patch b/system/nvidia-legacy390-driver/skip_conflict-GPU_detect.patch
new file mode 100644
index 0000000000000..2b979cbf463c4
--- /dev/null
+++ b/system/nvidia-legacy390-driver/skip_conflict-GPU_detect.patch
@@ -0,0 +1,29 @@
+diff -uaN command-list.c command-list.c.new
+--- command-list.c 2018-01-24 20:59:24.000000000 -0800
++++ command-list.c.new 2018-02-18 00:51:13.218202297 -0800
+@@ -903,6 +903,8 @@
+ // Allocate enough space for the whole file list, plus two extra files and
+ // a NULL at the end.
+ cfList = nvalloc((p->num_entries + 3) * sizeof(ConflictingFileInfo));
++/* let's just return an empty list! */
++ return cfList;
+
+ for (i = 0; i < p->num_entries; i++) {
+ PackageEntry *entry = &p->entries[i];
+
+diff -uaN misc.c misc.c.new
+--- misc.c 2018-02-18 00:52:42.822203145 -0800
++++ misc.c.new 2018-02-18 00:53:28.926203581 -0800
+@@ -2289,7 +2289,10 @@
+ "For further details, please see the appendix SUPPORTED "
+ "NVIDIA GRAPHICS CHIPS in the README available on the Linux "
+ "driver download page at www.nvidia.com.", p->version);
+- return FALSE;
++/* return FALSE;
++ * We're just going to keep the message but skip the result
++ * so we can run this in a VM.
++ */
+ }
+
+ if (!found_vga_device)
+
diff --git a/system/nvidia-legacy390-driver/slack-desc b/system/nvidia-legacy390-driver/slack-desc
new file mode 100644
index 0000000000000..af1addf5105a9
--- /dev/null
+++ b/system/nvidia-legacy390-driver/slack-desc
@@ -0,0 +1,19 @@
+# HOW TO EDIT THIS FILE:
+# The "handy ruler" below makes it easier to edit a package description.
+# Line up the first '|' above the ':' following the base package name, and
+# the '|' on the right side marks the last column you can put a character in.
+# You must make exactly 11 lines for the formatting to be correct. It's also
+# customary to leave one space after the ':' except on otherwise blank lines.
+
+ |-----handy-ruler------------------------------------------------------|
+nvidia-legacy390-driver: nvidia-legacy390-driver (Proprietary Binary Nvidia Video Driver)
+nvidia-legacy390-driver:
+nvidia-legacy390-driver: This is the proprietary binary video driver from nvidia for
+nvidia-legacy390-driver: the x.org X server. This package does not include the kernel
+nvidia-legacy390-driver: module - it is included in the nvidia-legacy390-kernel package.
+nvidia-legacy390-driver:
+nvidia-legacy390-driver: See /usr/doc/nvidia-legacy390-driver-PKGVERSION/README.Slackware
+nvidia-legacy390-driver: for more information.
+nvidia-legacy390-driver:
+nvidia-legacy390-driver:
+nvidia-legacy390-driver: