diff --git a/system/nvidia-driver/README b/system/nvidia-driver/README new file mode 100644 index 0000000000..416ed5aed6 --- /dev/null +++ b/system/nvidia-driver/README @@ -0,0 +1,27 @@ +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-kernel package at SlackBuilds.org. + +Since this nvidia-driver conflicts with some files of xorg, it's a bit +complex to install/uninstall the driver. However, installation of the +nvidia-driver package itself backs up the conflicting files and puts the +nvidia-specific files into place. + +Heinz Wiesinger, the author of the build script, has written a script called +nvidia-switch, which can be used to switch between the stock xorg driver and +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. + +Usage of nvidia-switch: + nvidia-switch --xorg <--> switch to the stock xorg files + nvidia-switch --nvidia <--> switch to the proprietary nvidia files + +Before uninstalling this package, it is important that you execute +'nvidia-switch --xorg', which will switch back to the stock xorg files. +If you forget to do this, you'll have to do the switch manually, or xorg +won't work on next startup. Here are the affected files: + /usr/lib/libGL.so.1.2 + /usr/include/GL/{gl.h glx.h glxext.h glext.h} + /usr/lib/xorg/modules/extensions/{libGLcore.so libGLcore.la libglx.so libglx.la} + +This also requires the nvidia-kernel package from SlackBuilds.org. diff --git a/system/nvidia-driver/doinst.sh b/system/nvidia-driver/doinst.sh new file mode 100644 index 0000000000..11586152dd --- /dev/null +++ b/system/nvidia-driver/doinst.sh @@ -0,0 +1,28 @@ + +if [ -x usr/bin/update-desktop-database ]; then + ./usr/bin/update-desktop-database ./usr/share/applications >/dev/null 2>&1 +fi + +if ! [ -e usr/lib/xorg/modules/libwfb.so ]; then + ( cd usr/lib/xorg/modules ; ln -s libnvidia-wfb.so.1 libwfb.so ) +fi + +( cd usr/lib/tls ; rm -rf libnvidia-tls.so.1 ) +( cd usr/lib/tls ; ln -sf tls/libnvidia-tls.so.PKGVERSION libnvidia-tls.so.1 ) +( cd usr/lib/xorg/modules ; rm -rf libnvidia-wfb.so.1 ) +( cd usr/lib/xorg/modules ; ln -sf libnvidia-wfb.so.PKGVERSION libnvidia-wfb.so.1 ) +( cd usr/lib ; rm -rf libnvidia-cfg.so.1 ) +( cd usr/lib ; ln -sf libnvidia-cfg.so.PKGVERSION libnvidia-cfg.so.1 ) +( cd usr/lib ; rm -rf libnvidia-tls.so.1 ) +( cd usr/lib ; ln -sf libnvidia-tls.so.PKGVERSION libnvidia-tls.so.1 ) +( cd usr/lib ; rm -rf libXvMCNVIDIA_dynamic.so.1 ) +( cd usr/lib ; ln -sf libXvMCNVIDIA.so.PKGVERSION libXvMCNVIDIA_dynamic.so.1 ) +( cd usr/lib ; rm -rf libnvidia-cfg.so ) +( cd usr/lib ; ln -sf libnvidia-cfg.so.1 libnvidia-cfg.so ) +( cd usr/lib ; rm -rf libcuda.so.1 ) +( cd usr/lib ; ln -sf libcuda.so.PKGVERSION libcuda.so.1 ) +( cd usr/lib ; rm -rf libcuda.so ) +( cd usr/lib ; ln -sf libcuda.so.1 libcuda.so ) + +/usr/sbin/nvidia-switch --nvidia + diff --git a/system/nvidia-driver/nvidia-driver.SlackBuild b/system/nvidia-driver/nvidia-driver.SlackBuild new file mode 100644 index 0000000000..99292a23c5 --- /dev/null +++ b/system/nvidia-driver/nvidia-driver.SlackBuild @@ -0,0 +1,127 @@ +#!/bin/sh + +# Slackware build script for nvidia-driver + +# Copyright 2007-2008 Heinz Wiesinger +# 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. + +# Thanks to Robby Workman for suggestions to improve this script. + +PRGNAM=nvidia-driver +VERSION=169.09 +ARCH=${ARCH:-i586} +BUILD=${BUILD:-1} +TAG=${TAG:-_SBo} + +CWD=$(pwd) +TMP=${TMP:-/tmp/SBo} +PKG=$TMP/package-$PRGNAM +OUTPUT=${OUTPUT:-/tmp} + +SRCNAM=NVIDIA-Linux-x86-$VERSION-pkg1 + +set -e + +rm -rf $PKG +mkdir -p $TMP $PKG $OUTPUT +cd $TMP +rm -rf $SRCNAM +sh $CWD/$SRCNAM.run --extract-only +cd $SRCNAM +chown -R root:root . +chmod -R u+w,go+r-w,a-s . + +mkdir -p $PKG/usr/{bin,share,lib,sbin} $PKG/usr/include/{cuda,GL} \ + $PKG/usr/lib/xorg/modules/{drivers,extensions} + +# Start with the libraries +cd usr/lib + cp -a * $PKG/usr/lib + #Rename those files which would overwrite xorg's original files + for i in libGL.so.$VERSION libGLcore.so.$VERSION; do + mv $PKG/usr/lib/$i $PKG/usr/lib/$i-nvidia ; + done +cd - + +# This is the driver itself +cd usr/X11R6/lib + cp -a * $PKG/usr/lib/xorg/ + for i in libXvMCNVIDIA.a libXvMCNVIDIA.so.$VERSION; do + mv $PKG/usr/lib/xorg/$i $PKG/usr/lib/ ; + done + + # Rename those files which would overwrite xorg's original files + mv $PKG/usr/lib/xorg/modules/extensions/libglx.so.$VERSION \ + $PKG/usr/lib/xorg/modules/extensions/libglx.so.$VERSION-nvidia +cd - + +# These are the includes +cd usr/include/GL + for i in glext.h gl.h glxext.h glx.h; do + cp -a $i $PKG/usr/include/GL/$i-nvidia + done +cd - + +cd usr/include/cuda + cp -a * $PKG/usr/include/cuda/ +cd - + +# Next come the apps +cp -a nvidia-installer $PKG/usr/bin/ +cd usr/bin + for i in nvidia*; do + cp -a $i $PKG/usr/bin/ + done +cd - + +# XDG stuff +cd usr/share + for i in applications pixmaps; do + cp -a $i $PKG/usr/share/ + done + cp -a man* $PKG/usr/ +cd - + +# Self written bash script which I use to switch between nvidia and nv. +# It is not necessary, but is very useful in general and for repairing +# things or when removing the package. Feel free to remove this :) +install -m 0755 $CWD/nvidia-switch $PKG/usr/sbin/ +sed -i s/PKGVERSION/$VERSION/g $PKG/usr/sbin/nvidia-switch + +# These correct wrong paths +sed -i 's|__LIBGL_PATH__|/usr/lib/|' $PKG/usr/lib/libGL.la +sed -i 's|/usr/X11R6/lib|/usr/lib/|' $PKG/usr/lib/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 + +cd $TMP/$SRCNAM +mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION +cp -a LICENSE pkg-history.txt ./usr/share/doc* $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 + +mkdir -p $PKG/install +sed s/PKGVERSION/$VERSION/g $CWD/slack-desc > $PKG/install/slack-desc +sed s/PKGVERSION/$VERSION/g $CWD/doinst.sh > $PKG/install/doinst.sh + +cd $PKG +/sbin/makepkg -l n -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.tgz diff --git a/system/nvidia-driver/nvidia-driver.info b/system/nvidia-driver/nvidia-driver.info new file mode 100644 index 0000000000..18f8d40975 --- /dev/null +++ b/system/nvidia-driver/nvidia-driver.info @@ -0,0 +1,8 @@ +PRGNAM="nvidia-driver" +VERSION="169.09" +HOMEPAGE="http://www.nvidia.com" +DOWNLOAD="http://us.download.nvidia.com/XFree86/Linux-x86/169.09/NVIDIA-Linux-x86-169.09-pkg1.run" +MD5SUM="26a7f94908bbe07a1110fd78cfa81320" +MAINTAINER="ppr:kut" +EMAIL="HMWiesinger@gmx.at" +APPROVED="rworkman" diff --git a/system/nvidia-driver/nvidia-switch b/system/nvidia-driver/nvidia-switch new file mode 100644 index 0000000000..55493a6f26 --- /dev/null +++ b/system/nvidia-driver/nvidia-switch @@ -0,0 +1,224 @@ +#!/bin/sh + +# *************************************************************************** +# * Copyright (C) 2007-2008 by Heinz Wiesinger * +# * HMWiesinger@gmx.at * +# * http://hw.3kisses.net * +# * * +# * This program is free software; you can redistribute it and/or modify * +# * it under the terms of the GNU General Public License as published by * +# * the Free Software Foundation; either version 3 of the License, or * +# * (at your option) any later version. * +# * * +# * This program is distributed in the hope that it will be useful, * +# * but WITHOUT ANY WARRANTY; without even the implied warranty of * +# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * +# * GNU General Public License for more details. * +# * * +# * You should have received a copy of the GNU General Public License * +# * along with this program; if not, write to the * +# * Free Software Foundation, Inc., * +# * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * +# ***************************************************************************/ +# nvidia-switch utility 0.5 +# +# A tool to switch between nvidia-binary-driver and stock xorg-driver +# if both are installed in parallel. + +set -e + +INC="/usr/include/GL" +LIB="/usr/lib" +XMOD="/usr/lib/xorg/modules" +XLIB="$XMOD/extensions" +NV_VERSION='PKGVERSION' # This will be replaced in the build script +GL_VERSION="1.2" + +if [ "$1" = '--nvidia' ]; then + echo $'Switching to nvidia-driver files!\n' + + echo "You have to ENABLE the nvidia driver in /etc/X11/xorg.conf." + echo "Otherwise, this may lead to improperly working drivers." + + #Change to includes path + cd $INC + #if gl*.h exists and is a link, then remove the old link and create the new one + #else, if it exists and is not a link, move it to gl*.h-xorg and create a link. + #else, it it does not exist, create a link to gl*.h-nvidia + for i in glxext.h glext.h glx.h gl.h; do + + if [ -L $i ]; then + rm -f $i + ln -s $i-nvidia $i + elif [ -e $i ]; then + mv $i $i-xorg + ln -s $i-nvidia $i + else + ln -s $i-nvidia $i + fi + + done + + for i in $LIB/libGL.so $XLIB/libglx.so; do + + #If libGL.so.$NV_VERSION-nvidia does exists, then remove the -nvidia and make it usable that way + if [ -e "$i.$NV_VERSION-nvidia" ]; then + rm -f $i.$NV_VERSION + ln -s $i.$NV_VERSION-nvidia $i.$NV_VERSION + fi + + done + + #if libGL.so.$GL_VERSION does exist, move it to libGL.so.$GL_VERSION-xorg, as it conflicts if nvidia's libGL.so + # then remove the libGL.so.1 symlink and create a new one pointing to nvidia's libGL.so + if [ -e "$LIB/libGL.so.$GL_VERSION" ]; then + cd $LIB + mv libGL.so.$GL_VERSION libGL.so.$GL_VERSION-xorg + rm -f libGL.so.1 + ln -s $LIB/libGL.so.$NV_VERSION libGL.so.1 + fi + + #If libGLcore.so.$NV_VERSION-nvidia does exists, then remove the -nvidia and make it usable that way + if [ -e "$LIB/libGLcore.so.$NV_VERSION-nvidia" ]; then + rm -f $LIB/libGLcore.so.$NV_VERSION $LIB/libGLcore.so.1 + ln -s $LIB/libGLcore.so.$NV_VERSION-nvidia $LIB/libGLcore.so.$NV_VERSION + ln -s $LIB/libGLcore.so.$NV_VERSION $LIB/libGLcore.so.1 + fi + + + for i in libGLcore.so libGLcore.la libglx.la; do + + #If this library exists, move it to *-xorg + if [ -e "$XLIB/$i" ]; then + mv $XLIB/$i $XLIB/$i-xorg + fi + + done + + # if libglx.so is not a link, back it up to *-xorg, and create a symlink to nvidia's one + # if it's a link, then remove it and create a new one. + if ! [ -L "$XLIB/libglx.so" ]; then + cd $XLIB + mv libglx.so libglx.so-xorg + ln -s $XLIB/libglx.so.$NV_VERSION libglx.so + else + cd $XLIB + rm -f libglx.so + ln -s $XLIB/libglx.so.$NV_VERSION libglx.so + fi + + #Recreate the link removed by --xorg + if ! [ -e "$XMOD/libwfb.so" ]; then + ln -s $XMOD/libnvidia-wfb.so.1 $XMOD/libwfb.so + fi + + /sbin/ldconfig + + #Generate correct symink for that lib + /sbin/ldconfig -l /usr/lib/libGL.so.169.09-nvidia + +elif [ "$1" = '--xorg' ]; then + echo $'Switching to stock xorg files.\n' + + echo "You have to DISABLE the nvidia driver in /etc/X11/xorg.conf." + echo "Otherwise, this may lead to improperly working drivers." + + #Change to includes path + cd $INC + #if gl*.h exists and is a link, then remove the old link and create the new one + #else, if it exists and is not a link, move it to gl*.h-xorg and create a link. + #else, it it does not exist, create a link to gl*.h-xorg + for i in glxext.h glext.h glx.h gl.h; do + + if [ -L $i ]; then + rm -f $i + ln -s $i-xorg $i + elif [ -e $i ]; then + mv $i $i-xorg + ln -s $i-xorg $i + else + ln -s $i-xorg $i + fi + + done + + for i in libGL.so libGLcore.so; do + + #if this link exists, remove it, if it's a file, move it to *.nvidia + if [ -L "$LIB/$i.$NV_VERSION" ]; then + rm -f $LIB/$i.$NV_VERSION + elif [ -e "$LIB/$i.$NV_VERSION" ]; then + mv $LIB/$i.$NV_VERSION $LIB/$i.$NV_VERSION-nvidia + fi + + if [ -L "$LIB/$i.1" ]; then + rm -f $LIB/$i.1 + fi + + done + + #if libGL.so.$GL_VERSION does not exist and libGL.so.$GL_VERSION-xorg does, move it to libGL.so.$GL_VERSION + # then remove the libGL.so.1 symlink and create a new one pointing to nvidia's libGL.so + if ! [ -e "$LIB/libGL.so.$GL_VERSION" ]; then + if [ -e "$LIB/libGL.so.$GL_VERSION-xorg" ]; then + cd $LIB + mv $LIB/libGL.so.$GL_VERSION-xorg $LIB/libGL.so.$GL_VERSION + ln -s $LIB/libGL.so.$GL_VERSION libGL.so.1 + fi + fi + + for i in libGLcore.so libGLcore.la libglx.la; do + + #If libGLcore.so does not exist, and *-xorg does, then remove the -xorg + if ! [ -e "$XLIB/$i" ]; then + if [ -e "$XLIB/$i-xorg" ]; then + mv $XLIB/$i-xorg $XLIB/$i + fi + fi + + done + + #if this library exists, move it to *-nvidia + if [ -L "$XLIB/libglx.so.$NV_VERSION" ]; then + rm $XLIB/libglx.so.$NV_VERSION + elif [ -e "$XLIB/libglx.so.$NV_VERSION" ]; then + mv $XLIB/libglx.so.$NV_VERSION $XLIB/libglx.so.$NV_VERSION-nvidia + fi + + # if libglx.so exists and is a link, remove it and create a new one + # If it does exists and is not a link, remove the old one, and create the new one. + # if it does not exist, create a symlink + if [ -L "$XLIB/libglx.so" ]; then + cd $XLIB + rm libglx.so + ln -s libglx.so-xorg libglx.so + elif [ -e "$XLIB/libglx.so" ]; then + cd $XLIB + mv libglx.so libglx.so-xorg + ln -s libglx.so-xorg libglx.so + else + cd $XLIB + ln -s libglx.so-xorg libglx.so + fi + + # Not handled by removepkg/upgradepkg automatically. + if [ -L "$XMOD/libwfb.so" ]; then + rm -f $XMOD/libwfb.so + fi + + /sbin/ldconfig + + #Generate correct symink for that lib + /sbin/ldconfig -l /usr/lib/libGL.so.1.2 + + #Remove so-link, recreated by ldconfig + if [ -L $LIB/libGLcore.so.1 ]; then + rm -f $LIB/libGLcore.so.1 + fi + +else + echo "Usage:" + echo " --nvidia Switch to nvidia driver files" + echo " --xorg Switch to stock xorg files" +fi + diff --git a/system/nvidia-driver/slack-desc b/system/nvidia-driver/slack-desc new file mode 100644 index 0000000000..07b134301e --- /dev/null +++ b/system/nvidia-driver/slack-desc @@ -0,0 +1,12 @@ + |-----handy-ruler----------------------------------------------| +nvidia-driver: nvidia-driver (Proprietary Binary Nvidia Video Driver) +nvidia-driver: +nvidia-driver: This is the proprietary binary video driver from nvidia for +nvidia-driver: the x.org X server. This package does not include the kernel +nvidia-driver: module - it is included in the nvidia-kernel package. +nvidia-driver: +nvidia-driver: See /usr/doc/nvidia-driver-PKGVERSION/README.Slackware +nvidia-driver: for more information. +nvidia-driver: +nvidia-driver: +nvidia-driver: