Git-Url: http://git.frugalware.org/gitweb/gitweb.cgi?p=frugalware-current.git;a=commitdiff;h=57a91a3b9aea9a2fb3f5f0ca39e68505facab7c0
commit 57a91a3b9aea9a2fb3f5f0ca39e68505facab7c0 Author: Michel Hermier <[EMAIL PROTECTED]> Date: Mon Oct 6 07:47:28 2008 +0200 nvidia.sh * Add nvidia.sh to help the build of the nvidia modules. Will be used in current and in the nvidia-beta repository. diff --git a/source/include/nvidia.install b/source/include/nvidia.install new file mode 100644 index 0000000..568aa79 --- /dev/null +++ b/source/include/nvidia.install @@ -0,0 +1,71 @@ +post_install() { + echo "*** In order to use this package you have to accept Nvidia's license which" + echo "*** can be found at /usr/share/doc/nvidia-*/LICENSE." + echo "*** If you don't accept it, please remove the package!" + + if [ -e /etc/X11/xorg.conf ]; then + sed -i 's/^.*Load "dri"/# Load "dri"/' /etc/X11/xorg.conf + sed -i 's/Driver.*"\(nv\|vesa\|vga\)"/Driver "nvidia"/' /etc/X11/xorg.conf + else + echo "WARNING: /etc/X11/xorg.conf does not exist!" + fi + + exist=`cat /etc/sysconfig/modules | grep nvidia | wc -l` + if [ "$exist" -eq 0 ]; then + echo nvidia >> /etc/sysconfig/modules + fi + /sbin/depmod -ea $_F_kernelmod_uname + ## if nvidia dependent kernel is the current kernel + if [ -e /lib/modules/`uname -r`/kernel/drivers/video/nvidia.ko ]; then + ## Try to load it + /sbin/modprobe nvidia + fi +} + +post_upgrade() { + echo -n "Runing depmod for nvidia kernel module for kernel $_F_kernelmod_uname ..." + /sbin/depmod -ea $_F_kernelmod_uname + echo " done." + ## if that exisit we bumped / upgraded the package only no new kernel + ## on a new kernel we do nothing because one has to reboot anyway + if [ -e /lib/modules/`uname -r`/kernel/drivers/video/nvidia.ko ]; then + ## see if is loaded , if yes kill it and modprobe again if not do nothing + if grep -q nvidia /proc/modules; then + echo -n "Reloading nvidia kernel module.." + modprobe --remove nvidia + sleep 1 + modprobe nvidia + echo " done." + fi + fi +} + +pre_remove() { + if test `lsmod | grep ^nvidia | wc -l` -gt 0; then + /sbin/modprobe --remove nvidia + fi + + if [ -e /etc/X11/xorg.conf ]; then + sed -i 's/^.*# Load "dri"/Load "dri"/' /etc/X11/xorg.conf + sed -i 's/\(^Driver *\)"nvidia"/\1"nv"/' /etc/X11/xorg.conf + fi + + exist=`cat /etc/sysconfig/modules | grep nvidia | wc -l` + if [ "$exist" -eq 1 ]; then + grep -v '^nvidia' /etc/sysconfig/modules > /etc/sysconfig/modules.tmp + mv /etc/sysconfig/modules.tmp /etc/sysconfig/modules + fi + if [ -e /usr/lib/xorg/temp/libglx.so ]; then + mv /usr/lib/xorg/temp/libglx.so /usr/lib/xorg/modules/extensions/ + fi +} + +post_remove() { + /sbin/depmod -a $_F_kernelmod_uname + echo "*** Nvidia driver is removed now. To have a working Xorg Server again run : ***" + echo "*** pacman-g2 -S libgl libglx ****" +} + +op=$1 +shift +$op $* diff --git a/source/include/nvidia.sh b/source/include/nvidia.sh new file mode 100644 index 0000000..88cdbc9 --- /dev/null +++ b/source/include/nvidia.sh @@ -0,0 +1,179 @@ +#!/bin/sh + +### +# = nvidia.sh(3) +# Michel Hermier <[EMAIL PROTECTED]> +# +# == NAME +# nvidia.sh - for Frugalware +# +# == SYNOPSIS +# Common schema for nVidia packages. +# +# == EXAMPLE +# -------------------------------------------------- +# pkgname=nvidia +# pkgver=173.14.12 +# pkgrel=3 +# archs=('i686' 'x86_64') +# Finclude nvidia +# case "$_F_nvidia_arch" in +#Â x86) sha1sums=('01d297c477b95593e9fbf5c73e501a4f5617b497');; +# x86_64) sha1sums=('78d3034314df7f9c95526707d7fcf4543f5993ed');; +# esac +# -------------------------------------------------- +# +# == OPTIONS +# * _F_nvidia_name (defaults to NVIDIA-Linux-$_F_nvidia_arch-$pkgver-pkg$F_nvidia_pkgnum): the nvidia package name +# * _F_nvidia_arch (defaults guessed using CARCH): the nvidia package arch +# * _F_nvidia_pkgnum (defaults guessed using _F_nvidia_arch): the nvidia package number +# * _F_nvidia_linkver (defaults to pkgver): the link number used by the nvidia shared libraries +# * _F_nvidia_install (defaults to nvidia.install): Install file +### +# General variables +if [ -z "$_F_nvidia_arch" ]; then + if echo "$CARCH" | grep -q 'i.86'; then + _F_nvidia_arch=x86 + elif [ "$CARCH" == "x86_64" ]; then + _F_nvidia_arch=x86_64 + else + Fmessage "Unkown nvidia arch for $CARCH" + Fdie + fi +fi +if [ -z "$_F_nvidia_pkgnum" ]; then + case "$_F_nvidia_arch" in + x86) _F_nvidia_pkgnum=1;; + x86_64) _F_nvidia_pkgnum=2;; + *) Fmessage "Unkown default nvidia pkgnum for $_F_nvidia_arch" + Fdie + esac +fi +if [ -z "$_F_nvidia_name" ]; then + _F_nvidia_name=NVIDIA-Linux-$_F_nvidia_arch-$pkgver-pkg$_F_nvidia_pkgnum +fi +if [ -z "$_F_nvidia_linkver" ]; then + _F_nvidia_linkver=$pkgver +fi +if [ -z "$_F_nvidia_install" ]; then + _F_nvidia_install="nvidia.install" +fi + +### +# == OVERWRITTEN VARIABLES +# * groups +# * pkgdesc +# * source +# * up2date +# * url +# * _F_cd_path +# * _F_kernelmod_scriptlet +### +groups=('x11-extra') +pkgdesc="3D accelerated display driver for Nvidia cards" +url="http://www.nvidia.com/object/linux_display_archive.html" +source=(ftp://download.nvidia.com/XFree86/Linux-$_F_nvidia_arch/$pkgver/$_F_nvidia_name.run) +up2date="lynx -dump http://www.nvidia.com/object/unix.html|grep -m1 'Latest Version:'|sed 's/.*]//;s/-/_/'" + +_F_cd_path=$_F_nvidia_name +_F_kernelmod_scriptlet=$_F_nvidia_install + +### +# == APPENDED VARIABLES +# * depends: add xorg-server and pkgconfig to depends +# * conflicts: add libgl and libglx to conflicts +# * provides: add ligl and libglx to provides +# * options: add nostrip to options +### +depends=([EMAIL PROTECTED] 'xorg-server>=1.1.0' 'pkgconfig') +conflicts=([EMAIL PROTECTED] 'libgl' 'libglx') +provides=([EMAIL PROTECTED] 'libgl' 'libglx') +options=([EMAIL PROTECTED] 'nostrip') + +if [ "$pkgname" != "nvidia" ]; then + conflicts=([EMAIL PROTECTED] 'nvidia') + provides=([EMAIL PROTECTED] 'nvidia') +fi + +### +# == INCLUDES DEPENDANCES +# * kernel-module +### + +Finclude kernel-module + +### +# == PROVIDED FUNCTIONS +# * Fbuild_nvidia: Builds the software +# * build(): just calls Fbuild_nvidia +### + +Fbuild_nvidia() { + cd $Fsrcdir + sh $_F_nvidia_name.run --extract-only + Fcd + Fpatchall + + # Install the binaries + Fexerel usr/bin/nvidia-* /usr/bin/ + + # Xorg modules + Fmkdir usr/lib/xorg/ + Fcp $_F_cd_path/usr/X11R6/lib/modules /usr/lib/xorg/modules + + # Libraries + Fexerel usr/lib/*.so* /usr/lib/ + Fexerel usr/lib/libGL.la /usr/lib/libGL.la + Fsed "__LIBGL_PATH__" "/usr/lib" $Fdestdir/usr/lib/libGL.la + + # Weird TLS stuff + Fmkdir usr/lib/tls + Fexerel usr/lib/tls/*.so* /usr/lib/tls/ + Fexerel usr/X11R6/lib/libXv* /usr/lib/ + + # Data + Fmkdir usr/share + Fcp $_F_cd_path/usr/share/pixmaps /usr/share/ + Fcp $_F_cd_path/usr/share/applications /usr/share/ + Fcp $_F_cd_path/usr/share/man /usr/ + Frm usr/man/man1/nvidia-installer.1.gz + Fsed "__UTILS_PATH__" "/usr/bin" $Fdestdir/usr/share/applications/nvidia-settings.desktop + Fsed "__PIXMAP_PATH__" "/usr/share/pixmaps" $Fdestdir/usr/share/applications/nvidia-settings.desktop + + # Library links + Fln "libGL.so.$_F_nvidia_linkver" "/usr/lib/libGL.so" + Fln "libGL.so.$_F_nvidia_linkver" "/usr/lib/libGL.so.1" + Fln "libGL.so.$_F_nvidia_linkver" "/usr/lib/libGL.so.1.2" + Fln "libGLcore.so.$_F_nvidia_linkver" "/usr/lib/libGLcore.so.1" + Fln "libnvidia-cfg.so.$_F_nvidia_linkver" "/usr/lib/libnvidia-cfg.so.1" + Fln "libnvidia-cfg.so.$_F_nvidia_linkver" "/usr/lib/libnvidia-cfg.so" + Fln "libnvidia-tls.so.$_F_nvidia_linkver" "/usr/lib/libnvidia-tls.so.1" + Fln "libnvidia-tls.so.$_F_nvidia_linkver" "/usr/lib/tls/libnvidia-tls.so.1" + Fln "libglx.so.$_F_nvidia_linkver" "/usr/lib/xorg/modules/extensions/libglx.so" + Fln "libXvMCNVIDIA.so.$_F_nvidia_linkver" "/usr/lib/libXvMCNVIDIA.so" + Fln "libXvMCNVIDIA.so.$_F_nvidia_linkver" "/usr/lib/libXvMCNVIDIA.so.1" + Fln "libXvMCNVIDIA.so.$_F_nvidia_linkver" "/usr/lib/libXvMCNVIDIA_dynamic.so.1" + Fln "libnvidia-wfb.so.$_F_nvidia_linkver" "/usr/lib/xorg/modules/libnvidia-wfb.so" + Fln "libnvidia-wfb.so.$_F_nvidia_linkver" "/usr/lib/xorg/modules/libnvidia-wfb.so.1" + Fln "libnvidia-wfb.so.$_F_nvidia_linkver" "/usr/lib/xorg/modules/libwfb.so" + + # Kernel module + cd usr/src/nv || Fdie + ln -s Makefile.kbuild Makefile || Fdie + make SYSSRC=$_F_kernelmod_dir/build module || Fdie + cd ../../.. || Fdie + Ffilerel usr/src/nv/nvidia.ko $_F_kernelmod_dir/kernel/drivers/video/nvidia.ko + + # Kernel module scriptlet + cp $Fincdir/nvidia.install ${Fsrcdir%/src} + Fbuild_kernelmod_scriptlet + + # Documentation + Fdoc $_F_cd_path/LICENSE + Fcp $_F_cd_path/usr/share/doc/* /usr/share/doc/$pkgname-$pkgver/ + Fln "$pkgname-$pkgver" "/usr/share/doc/$pkgname" +} + +build() { + Fbuild_nvidia +} _______________________________________________ Frugalware-git mailing list Frugalware-git@frugalware.org http://frugalware.org/mailman/listinfo/frugalware-git