You are not logged in.

#1 2006-02-19 23:36:03

Thikasabrik
Member
Registered: 2004-02-23
Posts: 92

NVidia packages - let's not use nvidia-installer [RFC]

Hi. After messing around with Xgl I (for some reason) decided that I hated the way the nvidia driver package doesn't account for all the files the nvidia-installer spits out/modifies. I wanted all the files involved to be properly managed by pacman. So I made some PKGBUILDs, looking at Fedora and Gentoo stuff for inspiration, and getting annoyed trying to work out what needs to be where based on NV's unmaintained install makefile..:shock:

The PKGBUILDs that follow separate the kernel module from the rest of the nvidia package, but this is by no means necessary - I just wanted to be able to reinstall one without the other (to do with installing gl parts without restarting X - see below for more).

(If there is to be a separation, it may be more logical to put the x.org driver module with the kernel module, with just the GL parts separate.)

pkgname=nvidia-kernel
pkgver=1.0.8178
_pkgbinary=NVIDIA-Linux-x86-1.0-8178
pkgrel=1
pkgdesc="NVidia driver kernel module"
url="http://www.nvidia.com"
depends=('bash' 'gcc' 'binutils' 'glibc' 'make' 'nvidia-glx')
source=(ftp://download.nvidia.com/XFree86/Linux-x86/1.0-8178/$_pkgbinary-pkg0.run nvidia.rc 
    nvidia.patch nv2.diff)
install="nvidia.install"
#provides=()
conflicts=('nvidia')

build() {  
  cd $startdir/src/
  chmod +x $_pkgbinary-pkg0.run
  ./$_pkgbinary-pkg0.run --extract-only
  cd $_pkgbinary-pkg0
  #strip stuff that's in nvidia-glx to make download lighter
  rm -rf usr/bin
  rm -rf usr/include
  rm -rf usr/lib
  rm -rf usr/share
  rm -rf usr/X11R6
  mkdir -p $startdir/pkg/usr/share/nvidia
  cp -p LICENSE $startdir/pkg/usr/share/nvidia
  # adding patches from nvidia forum and now provided by zander
  patch -Np0 -i $startdir/src/nvidia.patch || return 1
  patch -Np0 -i $startdir/src/nv2.diff || return 1
  
  #clean src
  install -D -m 755 $startdir/src/nvidia.rc $startdir/pkg/etc/rc.d/nvidia
  cd $startdir/src
  rm *
  mkdir -p $startdir/pkg/opt/nvidia
  mv * $startdir/pkg/opt/nvidia 
 }
md5sums=('6c8081bfde4a806a487efc2a9a1ff016' '08f4f614066c08bd0774c7e557953fbe'
         '3b5a2525633e88b9d78c4721190542e6')

(the file nv2.diff patches the kernel code for 2.6.16 kernels..)
Here's the .install

_driver=NVIDIA-Linux-x86-1.0-8178-pkg0/./nvidia-installer
post_install() {
cat << EOF
IMPORTANT
==> In order to use the software, you have to agree to NVIDIA's license located in 
==> /usr/share/nvidia/LICENSE 
==> If you don't, please remove this package (pacman -R nvidia-kernel)
Installation starts now ...
EOF

cd /opt/nvidia/NVIDIA-Linux-x86-1.0-8178-pkg0/usr/src/nv
make install > /dev/null 2>&1 || (echo "INSTALLATION FAILED!" ; echo "==> You have to shutdown Xserver to finish installation! You have to rerun 'pacman -S nvidia-kernel'" ; echo "==> If you're running a custom kernel, make sure the source tree is available." ; echo "==> Other common solutions can be found on the wiki: http://wiki.archlinux.org/index.php/How_to_install_NVIDIA_driver" )
modprobe nvidia
rm -r /opt/nvidia

cat << EOF
To use this driver you need the nvidia-glx package too.
If you need more information about setting up nvidia drivers have a look at:
"http://wiki.archlinux.org/index.php/How_to_install_NVIDIA_driver"
EOF
}

post_upgrade() {
 rmmod nvidia > /dev/null 2>&1
 post_install $1
}

pre_remove() {
cat << EOF
==> Deinstallation starts now!
EOF

rmmod nvidia
_KERNELNAME=$(uname -r)
rm /lib/modules/$_KERNELNAME/kernel/drivers/video/nvidia.ko > /dev/null 2>&1

cat << EOF
==> Don't forget to update your /etc/X11/XF86Config or /etc/X11/xorg.conf!
You may want to remove nvidia-glx as well.
EOF
}

op=$1
shift

$op $*

Now for the other bit..

pkgname=nvidia-glx
pkgver=1.0.8178
_pkgbinary=NVIDIA-Linux-x86-1.0-8178
pkgrel=1
pkgdesc="The NVidia X.org driver and utilities (without the kernel module)"
url="http://www.nvidia.com"
depends=('bash' 'gcc' 'binutils' 'glibc' 'make' 'nvidia-kernel')
source=(ftp://download.nvidia.com/XFree86/Linux-x86/1.0-8178/$_pkgbinary-pkg0.run)
install="nvidia-glx.install"
provides=('libgl')
conflicts=('libgl' 'nvidia')
md5sums=('6c8081bfde4a806a487efc2a9a1ff016')

build() {  
  cd $startdir/src/
  chmod +x $_pkgbinary-pkg0.run
  ./$_pkgbinary-pkg0.run --extract-only
  cd $_pkgbinary-pkg0
  
  mkdir -p $startdir/pkg/usr/share/applications
  mkdir -p $startdir/pkg/usr/bin
  mkdir -p $startdir/pkg/usr/man/man1
  mkdir -p $startdir/pkg/usr/lib/xorg/modules/{extensions,drivers}
  mkdir -p $startdir/pkg/usr/share/nvidia

#Point .desktop to correct location
  chmod +w ./usr/share/applications/nvidia-settings.desktop
  sed 's:__UTILS_PATH__:/usr/bin:' ./usr/share/applications/nvidia-settings.desktop > ./nv.desktop
  sed 's:__DOCS_PATH__:/usr/share/nvidia:' ./nv.desktop > ./usr/share/applications/nvidia-settings.desktop
  chmod -w ./usr/share/applications/nvidia-settings.desktop
  
#Grab what we need and put it where we want
    install -m 755 usr/bin/nvidia-bug-report.sh ${startdir}/pkg/usr/bin
    install -m 755 usr/bin/nvidia-settings ${startdir}/pkg/usr/bin
    install -m 755 usr/bin/nvidia-xconfig ${startdir}/pkg/usr/bin
    
    install usr/lib/libGL.so.${pkgver} ${startdir}/pkg/usr/lib
    install usr/lib/libGLcore.so.${pkgver} ${startdir}/pkg/usr/lib
    install usr/lib/libnvidia-tls.so.${pkgver} ${startdir}/pkg/usr/lib
    install usr/lib/libnvidia-cfg.so.${pkgver} ${startdir}/pkg/usr/lib
    install usr/X11R6/lib/libXvMCNVIDIA.a ${startdir}/pkg/usr/lib
    install usr/X11R6/lib/libXvMCNVIDIA.so.${pkgver} ${startdir}/pkg/usr/lib
    
    install usr/X11R6/lib/modules/drivers/nvidia_drv.o ${startdir}/pkg/usr/lib/xorg/modules/drivers
    install usr/X11R6/lib/modules/drivers/nvidia_drv.so ${startdir}/pkg/usr/lib/xorg/modules/drivers
    install usr/X11R6/lib/modules/extensions/libglx.so.${pkgver} ${startdir}/pkg/usr/lib/xorg/modules/extensions
    
    cp -pr usr/include ${startdir}/pkg/usr/share/nvidia
    cp -pr usr/share/doc/* ${startdir}/pkg/usr/share/nvidia
    cp -pr usr/share/applications/* ${startdir}/pkg/usr/share/applications
    cp -pr usr/share/man/man1 ${startdir}/pkg/usr/man

    cd ${startdir}/pkg/usr/lib/
    ln -fs libGL.so.${pkgver} libGL.so
    ln -fs libGL.so.${pkgver} libGL.so.1
    ln -fs libGLcore.so.${pkgver} libGLcore.so.1
    ln -fs libnvidia-cfg.so.${pkgver} libnvidia-cfg.so.1
    ln -fs libnvidia-cfg.so.${pkgver} libnvidia-cfg.so
    ln -fs libnvidia-tls.so.${pkgver} libnvidia-tls.so.1
    ln -fs libXvMCNVIDIA.so.${pkgver} libXvMCNVIDIA-dynamic.so.1
    cd ${startdir}/pkg/usr/lib/xorg/modules/extensions
    ln -fs libglx.so.${pkgver} libglx.so
 }

..and here's the .install

_driver=NVIDIA-Linux-x86-1.0-8178-pkg0/./nvidia-installer
post_install() {
#switch in nvidia GL headers
ln -sf /usr/share/nvidia/include/GL/gl.h /usr/include/GL/gl.h
ln -sf /usr/share/nvidia/include/GL/glext.h /usr/include/GL/glext.h
ln -sf /usr/share/nvidia/include/GL/glx.h /usr/include/GL/glx.h
ln -sf /usr/share/nvidia/include/GL/glxext.h /usr/include/GL/glxext.h

cat << EOF
IMPORTANT
==> In order to use the software, you have to agree to NVIDIA's license located in 
==> /usr/share/nvidia/LICENSE (installed with nvidia-kernel - required)
==> If you don't, please remove this package (pacman -R nvidia-glx)

To use this driver you need the nvidia-kernel package too.
If you need more information about setting up nvidia drivers have a look at:
"http://wiki.archlinux.org/index.php/How_to_install_NVIDIA_driver"

Note: OpenGL headers have been replaced (if applicable) by symlinks to the NVidia headers. 
To switch to the mesa headers, reinstall mesa.
(You may want to do this if compiling a GL app for another system.)
EOF
}

post_upgrade() {
 post_install $1
}

pre_remove() {

cat << EOF
==> Don't forget to update your /etc/X11/XF86Config or /etc/X11/xorg.conf!
You may want to remove nvidia-kernel as well.
EOF
}

op=$1
shift

$op $*

..As you can see, the nvidia-glx .install instates the NVidia gl headers to aid compiling against them. If mesa is installed it's versions of these files will be overwritten. Making sure to install the package for the desired headers last seemed like the simplest way to select them. Gentoo has some script to select the gl libs.

PS: This is designed alongside the current mesa-6.4.2-1 package in testing.


So. Any comments? Any good? Or shall I just keep them to myself?

Offline

#2 2006-02-22 13:07:57

Thikasabrik
Member
Registered: 2004-02-23
Posts: 92

Re: NVidia packages - let's not use nvidia-installer [RFC]

Well.. I thought it was an improvement...  roll

Offline

#3 2006-02-22 13:20:57

Cerebral
Forum Fellow
From: Waterloo, ON, CA
Registered: 2005-04-08
Posts: 3,108
Website

Re: NVidia packages - let's not use nvidia-installer [RFC]

There has been talk about this on the mailing lists already recently.. I don't know what came of it though... someone else had made similar packages and the devs were interested in them.

Offline

#4 2006-02-22 14:07:15

Moo-Crumpus
Member
From: Hessen / Germany
Registered: 2003-12-01
Posts: 1,487

Re: NVidia packages - let's not use nvidia-installer [RFC]

It is an improvement. I'ld like to have nvidia installed your way. Well done.


Frumpus addict
[mu'.krum.pus], [frum.pus]

Offline

#5 2006-02-22 14:52:59

tpowa
Developer
From: Lauingen , Germany
Registered: 2004-04-05
Posts: 2,322

Re: NVidia packages - let's not use nvidia-installer [RFC]

well, problem is not that it's not possible, problem is if it is allowed.
i'm not a license expert but as far as i can remember no big distro provides the packages other then nvidia-installer.
gentoo is a special case.

Offline

#6 2006-02-22 17:33:39

Thikasabrik
Member
Registered: 2004-02-23
Posts: 92

Re: NVidia packages - let's not use nvidia-installer [RFC]

tpowa wrote:

well, problem is not that it's not possible, problem is if it is allowed.
i'm not a license expert but as far as i can remember no big distro provides the packages other then nvidia-installer.
gentoo is a special case.

Yeah, I thought that might be a problem. The LICENSE seems to have a clause to do with splitting up the package...

No Separation of Components.  The SOFTWARE is licensed as a
single product.  Its component parts may not be separated for use
on more than one computer, nor otherwise used separately from the
other parts.

But this refers to *use* of the seperate parts, which I suppose is a bit vague. Anyhoo, as I say, this modified install method can still work with a combined package. It could even not bother with the kernel module compile if it's already present.
The only other part that seems relevant is...

2.1.2  Linux/FreeBSD Exception.  Notwithstanding the foregoing terms
of Section 2.1.1, SOFTWARE designed exclusively for use on the Linux or
FreeBSD operating systems, or other operating systems derived from the
source code to these operating systems, may be copied and redistributed,
provided that the binary files thereof are not modified in any way
(except for unzipping of compressed files).

But since no binary files are modified this doesn't seem to apply. Of course, IANAL..

Offline

#7 2006-02-23 09:05:36

iphitus
Forum Fellow
From: Melbourne, Australia
Registered: 2004-10-09
Posts: 4,927

Re: NVidia packages - let's not use nvidia-installer [RFC]

You're using post-install magic, it's unlikely that this will be adopted to the repos, considering that there are PKGBUILDs that build it all within the build {} constraints.

All the same, I think we need to enquire with nvidia regarding their license.

iphitus

Offline

#8 2006-02-23 09:06:36

iphitus
Forum Fellow
From: Melbourne, Australia
Registered: 2004-10-09
Posts: 4,927

Re: NVidia packages - let's not use nvidia-installer [RFC]

You're using post-install magic, it's unlikely that this will be adopted to the repos, considering that there are PKGBUILDs that build it all within the build {} constraints.

All the same, I think we need to enquire with nvidia regarding their license.

iphitus

Offline

#9 2006-02-23 12:36:29

Thikasabrik
Member
Registered: 2004-02-23
Posts: 92

Re: NVidia packages - let's not use nvidia-installer [RFC]

Hmm, well the current PKGBUILD uses plenty of magic in order to allow the use of the nvidia installer. The post-install 'magic' could be eliminated completely if it is acceptable to package a kernel module for the arch/archck kernel as is done for the ati drivers. The module could easily be compiled at makepkg time. The question is whether or not this is legal..

PS: The part which has to do with GL headers could be removed and replaced by a script that is installed to /usr/bin/ or something that does the same thing.

Offline

#10 2006-02-23 21:58:36

iphitus
Forum Fellow
From: Melbourne, Australia
Registered: 2004-10-09
Posts: 4,927

Re: NVidia packages - let's not use nvidia-installer [RFC]

like I said, i've got a package which does it all within the build {}, I just need to update it for xorg7.

But whats more important, is whether we even can. The license needs to be checked.

iphitus

Offline

#11 2006-02-23 22:23:36

test1000
Member
Registered: 2005-04-03
Posts: 834

Re: NVidia packages - let's not use nvidia-installer [RFC]

but it's not like anyones gonna get sued.. so.. what's the problem big_smile


KISS = "It can scarcely be denied that the supreme goal of all theory is to make the irreducible basic elements as simple and as few as possible without having to surrender the adequate representation of a single datum of experience." - Albert Einstein

Offline

#12 2006-02-24 06:46:30

Moo-Crumpus
Member
From: Hessen / Germany
Registered: 2003-12-01
Posts: 1,487

Re: NVidia packages - let's not use nvidia-installer [RFC]

debian and ubuntu do it that way.


Frumpus addict
[mu'.krum.pus], [frum.pus]

Offline

Board footer

Powered by FluxBB