Commit 6137690c authored by AlmAck's avatar AlmAck

revert old PKGBUILD, new method needs more testing, does not properly work with libglvnd

parent f436f653
# Contributor: Aaron Plattner <aplattner@nvidia.com>
# source: https://github.com/fafryd1125/arch-nvidia-utils
#
# Chakra Packages for Chakra, part of chakraos.org
pkgbase=nvidia-utils
pkgname=('nvidia-utils' 'nvidia-libgl' 'opencl-nvidia')
pkgname=('nvidia-utils' 'nvidia-libgl' 'opencl-nvidia' 'libcl')
# Edit chakra-hardware-detection/hooks/hwdetect_7_graphics on version jump from 3xx.xx
# Update nvidia-settings too
pkgver=361.42
pkgrel=2
pkgrel=5
arch=('x86_64')
url="http://www.nvidia.com/"
license=('custom')
options=('!strip')
source=("http://us.download.nvidia.com/XFree86/Linux-x86_64/${pkgver}/NVIDIA-Linux-x86_64-${pkgver}-no-compat32.run"
'10-nvidia-drm-outputclass.conf')
md5sums=('e70ece47407c53ebb527fa684ca759e7'
'eb04209ec40d2fd1c76813ba665bf444')
_pkg="NVIDIA-Linux-x86_64-${pkgver}-no-compat32"
source=("ftp://download.nvidia.com/XFree86/Linux-x86_64/${pkgver}/NVIDIA-Linux-x86_64-${pkgver}-no-compat32.run"
'10-nvidia-drm-outputclass.conf')
sha1sums=('98d68431af11e4ed1b7cf4b383dd567ec61afef5'
'4ca2fbb2389d0bcb7a2c6f614860522d9ddf58ab')
create_links() {
# create soname links
for _lib in $(find "${pkgdir}" -name '*.so*' | grep -v 'xorg/'); do
_soname=$(dirname "${_lib}")/$(readelf -d "${_lib}" | grep -Po 'SONAME.*: \[\K[^]]*' || true)
_base=$(echo ${_soname} | sed -r 's/(.*).so.*/\1.so/')
[[ -e "${_soname}" ]] || ln -s $(basename "${_lib}") "${_soname}"
[[ -e "${_base}" ]] || ln -s $(basename "${_soname}") "${_base}"
done
}
prepare() {
sh "${_pkg}.run" --extract-only
cd "${_pkg}"
bsdtar -xf nvidia-persistenced-init.tar.bz2
}
process_manifest () {
declare -A type_handlers=(
# opencl-nvidia
["CUDA_ICD"]="opencl-nvidia install_opencl_vendor"
["OPENCL_LIB"]="opencl-nvidia install_lib"
["OPENCL_LIB_SYMLINK"]="opencl-nvidia symlink_lib_with_path"
# nvidia-libgl
["APPLICATION_PROFILE"]="nvidia-libgl install_app_profile"
#["GLVND_LIB"]="nvidia-libgl install_lib"
#["GLVND_SYMLINK"]="nvidia-libgl symlink_lib"
#["GLX_CLIENT_LIB"]="nvidia-libgl install_glvnd"
#["GLX_CLIENT_SYMLINK"]="nvidia-libgl symlink_glvnd"
["GLX_MODULE_SHARED_LIB"]="nvidia-libgl install_glx_module"
["GLX_MODULE_SYMLINK"]="nvidia-libgl symlink_glx_module"
["NVIDIA_MODPROBE_MANPAGE"]="nvidia-libgl install_man"
["NVIDIA_MODPROBE"]="nvidia-libgl install_bin"
["OPENGL_LIB"]="nvidia-libgl install_lib"
["OPENGL_SYMLINK"]="nvidia-libgl symlink_lib"
["TLS_LIB"]="nvidia-libgl install_tls"
["VDPAU_LIB"]="nvidia-libgl install_lib"
["VDPAU_SYMLINK"]="nvidia-libgl symlink_lib_with_path"
#["VULKAN_ICD_JSON"]="nvidia-libgl install_vulkan_icd" # enable with >364.12
["XMODULE_SHARED_LIB"]="nvidia-libgl install_x_driver"
["XORG_OUTPUTCLASS_CONFIG"]="nvidia-libgl install_x_config"
# nvidia-utils
["CUDA_LIB"]="nvidia-utils install_lib"
["CUDA_SYMLINK"]="nvidia-utils symlink_lib_with_path"
["DOCUMENTATION"]="nvidia-utils install_doc"
["DOT_DESKTOP"]="nvidia-utils install_dot_desktop"
["ENCODEAPI_LIB"]="nvidia-utils install_lib"
["ENCODEAPI_LIB_SYMLINK"]="nvidia-utils symlink_lib"
["MANPAGE"]="nvidia-utils install_man"
["NVCUVID_LIB"]="nvidia-utils install_lib"
["NVCUVID_LIB_SYMLINK"]="nvidia-utils symlink_lib"
["NVIFR_LIB"]="nvidia-utils install_lib"
["NVIFR_LIB_SYMLINK"]="nvidia-utils symlink_lib"
["UTILITY_BINARY"]="nvidia-utils install_bin"
["UTILITY_LIB"]="nvidia-utils install_lib"
["UTILITY_LIB_SYMLINK"]="nvidia-utils symlink_lib"
# Ignored entries
["GLVND_LIB"]="ignored" # provided by libglvnd
["GLVND_SYMLINK"]="ignored" # provided by libglvnd
["GLX_CLIENT_LIB"]="ignored" # provided by libglvnd
["GLX_CLIENT_SYMLINK"]="ignored" # provided by libglvnd
["INSTALLER_BINARY"]="ignored" # provided by pacman
["KERNEL_MODULE_SRC"]="ignored" # kernel modules are handled by the nvidia PKGBUILD
["DKMS_CONF"]="ignored" # dkms is not used
["LIBGL_LA"]="ignored" # .la files are not needed
["OPENCL_WRAPPER_LIB"]="ignored" # provided by libcl
["OPENCL_WRAPPER_SYMLINK"]="ignored" # provided by libcl
["OPENGL_HEADER"]="ignored" # provided by mesa
["UTILITY_BIN_SYMLINK"]="ignored" # provided by pacman
["XMODULE_NEWSYM"]="ignored" # not needed for modern X servers
["XMODULE_SYMLINK"]="ignored" # not needed for modern X servers
)
tail -n +9 .manifest | {
while read name perm type extra1 extra2 extra3; do
if [ ${type_handlers[${type}]+isset} ]; then
local data=( ${type_handlers[${type}]} )
local pkg=${data[0]}
local handler=${data[1]}
# Check if this file type is handled by the current package.
# Otherwise, ignore it.
if [ ${pkg} = ${pkgname} ]; then
eval ${handler} $name $perm $type $extra1 $extra2 $extra3
fi
else
echo "Unrecognized manifest type ${type}"
exit 1
fi
done
}
mkdir -p "${pkgdir}/usr/share/licenses"
ln -s nvidia "${pkgdir}/usr/share/licenses/${pkgname}"
}
install_app_profile() { install -D -m$2 "$1" "${pkgdir}/usr/share/nvidia/$1"; }
install_bin() { install -D -m$2 "$1" "${pkgdir}/usr/bin/$1"; }
install_glx_module() { install -D -m$2 "$1" "${pkgdir}/usr/lib/xorg/modules/extensions/$1"; }
install_lib() { install -D -m$2 "$1" "${pkgdir}/usr/lib/$5$1"; }
install_man() { install -D -m$2 "$1" "${pkgdir}/usr/share/man/man1/$1"; }
install_opencl_vendor() { install -D -m$2 "$1" "${pkgdir}/etc/OpenCL/vendors/$1"; }
install_vulkan_icd() { install -D -m$2 "$1" "${pkgdir}/etc/vulkan/icd.d/$1"; }
install_x_config() { install -D -m$2 "$1" "${pkgdir}/usr/share/X11/xorg.conf.d/$1"; }
install_glvnd() {
case "$5" in
NON_GLVND)
# legacy non-GLVND GLX libraries
;;
GLVND)
install -D -m$2 "$1" "${pkgdir}/usr/lib/$1";
;;
esac
}
install_x_driver() {
case "$1" in
libnvidia-wfb*)
# not needed for modern X servers
;;
*)
install -D -m$2 "$1" "${pkgdir}/usr/lib/xorg/modules/$4$1";
;;
esac
}
install_dot_desktop() {
install -D -m$2 "$1" "${pkgdir}/usr/share/applications/$1"
# Set the appropriate paths in the .desktop file
sed -i -e s:__UTILS_PATH__:/usr/bin: \
-e s:__PIXMAP_PATH__:/usr/share/doc/nvidia: \
"${pkgdir}/usr/share/applications/$1"
}
package_libcl() {
pkgdesc="OpenCL library and ICD loader from NVIDIA"
install_tls() {
# Only "new" TLS is needed on modern systems.
case $5 in
CLASSIC)
return
;;
NEW)
install -D -m$2 "$1" "${pkgdir}/usr/lib/$1"
;;
*)
echo "Unrecognized TLS library type $5"
exit 1
;;
esac
}
cd "${srcdir}/${_pkg}"
install_doc() {
# Strip the historical NVIDIA_GLX-1.0 prefix off of the target path and
# "html" off the source path.
local src=$(basename $1)
local target=${4#NVIDIA_GLX-1.0/}
install -D -m$2 "$1" "${pkgdir}/usr/share/doc/nvidia/${target}/${src}"
}
symlink_glx_module() { ln -s "$5" "${pkgdir}/usr/lib/xorg/modules/extensions/$1"; }
symlink_lib() { ln -s "$5" "${pkgdir}/usr/lib/$1"; }
symlink_lib_with_path() { ln -s "$6" "${pkgdir}/usr/lib/$5$1"; }
symlink_glvnd() {
case "$6" in
NON_GLVND)
# legacy non-GLVND GLX symlinks
;;
GLVND)
ln -s "$5" "${pkgdir}/usr/lib/$1";
;;
esac
install -D -m755 libOpenCL.so.1.0.0 "${pkgdir}/usr/lib/libOpenCL.so.1.0.0"
ln -s /usr/lib/libOpenCL.so.1.0.0 "${pkgdir}/usr/lib/libOpenCL.so.1"
ln -s /usr/lib/libOpenCL.so.1 "${pkgdir}/usr/lib/libOpenCL.so"
}
package_opencl-nvidia() {
pkgdesc="OpenCL implemention for NVIDIA"
depends=('libcl' 'zlib')
optdepends=('opencl-headers: headers necessary for OpenCL development')
replaces=('libcl')
provides=('libcl')
cd "${_pkg}"
process_manifest
# OpenCL
install -D -m644 nvidia.icd "${pkgdir}/etc/OpenCL/vendors/nvidia.icd"
install -D -m755 "libnvidia-compiler.so.${pkgver}" "${pkgdir}/usr/lib/libnvidia-compiler.so.${pkgver}"
install -D -m755 "libnvidia-opencl.so.${pkgver}" "${pkgdir}/usr/lib/libnvidia-opencl.so.${pkgver}"
create_links
mkdir -p "${pkgdir}/usr/share/licenses"
ln -s nvidia "${pkgdir}/usr/share/licenses/opencl-nvidia"
}
package_nvidia-libgl() {
pkgdesc="NVIDIA drivers libraries"
optdepends=('libvdpau: VDPAU wrapper library')
depends=('libglvnd')
provides=('libgl')
pkgdesc="NVIDIA drivers libraries symlinks"
depends=('nvidia-utils')
conflicts=('libgl')
provides=('libgl')
cd "${_pkg}"
process_manifest
mkdir -p "${pkgdir}/usr/lib/xorg/modules/extensions"
ln -s "/usr/lib/nvidia/xorg/modules/extensions/libglx.so.${pkgver}" "${pkgdir}/usr/lib/xorg/modules/extensions/libglx.so.${pkgver}"
ln -s "libglx.so.${pkgver}" "${pkgdir}/usr/lib/xorg/modules/extensions/libglx.so.1"
ln -s "libglx.so.${pkgver}" "${pkgdir}/usr/lib/xorg/modules/extensions/libglx.so"
# distro specific files must be installed in /usr/share/X11/xorg.conf.d
install -D -m644 "${srcdir}/10-nvidia-drm-outputclass.conf" "${pkgdir}/usr/share/X11/xorg.conf.d/10-nvidia-drm-outputclass.conf"
ln -s "/usr/lib/nvidia/libGL.so.1" "${pkgdir}/usr/lib/libGL.so.1"
ln -s "libGL.so.1" "${pkgdir}/usr/lib/libGL.so"
ln -s "/usr/lib/nvidia/libEGL.so.1" "${pkgdir}/usr/lib/libEGL.so.1"
ln -s "libEGL.so.1" "${pkgdir}/usr/lib/libEGL.so"
ln -s "/usr/lib/nvidia/libGLESv1_CM.so.1" "${pkgdir}/usr/lib/libGLESv1_CM.so.1"
ln -s "libGLESv1_CM.so.1" "${pkgdir}/usr/lib/libGLESv1_CM.so"
ln -s "/usr/lib/nvidia/libGLESv2.so.2" "${pkgdir}/usr/lib/libGLESv2.so.2"
ln -s "libGLESv2.so.2" "${pkgdir}/usr/lib/libGLESv2.so"
mkdir -p "${pkgdir}/usr/share/licenses"
ln -s nvidia "${pkgdir}/usr/share/licenses/nvidia-libgl"
}
package_nvidia-utils() {
pkgdesc="NVIDIA drivers utilities"
depends=('xorg-server')
optdepends=('xorg-server-devel: nvidia-xconfig'
depends=('xorg-server' 'libglvnd')
optdepends=('gtk2: nvidia-settings'
'xorg-server-devel: nvidia-xconfig'
'opencl-nvidia: OpenCL support'
'nvidia-settings: Gtk GUI')
provides=('nvidia-settings')
install="${pkgname}.install"
conficts=('nvidia-utils-bumblebee')
replaces=('nvidia-utils-bumblebee')
provides=('nvidia-utils-bumblebee')
cd "${_pkg}"
process_manifest
# X driver
install -D -m755 nvidia_drv.so "${pkgdir}/usr/lib/xorg/modules/drivers/nvidia_drv.so"
# GLX extension module for X
install -D -m755 "libglx.so.${pkgver}" "${pkgdir}/usr/lib/nvidia/xorg/modules/extensions/libglx.so.${pkgver}"
ln -s "libglx.so.${pkgver}" "${pkgdir}/usr/lib/nvidia/xorg/modules/extensions/libglx.so" # X doesn't find glx otherwise
install -D -m755 "libGLX_nvidia.so.${pkgver}" "${pkgdir}/usr/lib/libGLX_nvidia.so.${pkgver}"
ln -s "libGLX_nvidia.so.${pkgver}" "${pkgdir}/usr/lib/libGLX_indirect.so.0"
# OpenGL libraries
install -D -m755 "libEGL.so.1" "${pkgdir}/usr/lib/nvidia/libEGL.so.1"
install -D -m755 "libEGL_nvidia.so.$pkgver" "${pkgdir}/usr/lib/libEGL_nvidia.so.0"
install -D -m755 "libGLESv1_CM_nvidia.so.${pkgver}" "${pkgdir}/usr/lib/libGLESv1_CM_nvidia.so.${pkgver}"
install -D -m755 "libGLESv2_nvidia.so.${pkgver}" "${pkgdir}/usr/lib/libGLESv2_nvidia.so.${pkgver}"
# OpenGL core library
install -D -m755 "libnvidia-glcore.so.${pkgver}" "${pkgdir}/usr/lib/libnvidia-glcore.so.${pkgver}"
install -D -m755 "libnvidia-eglcore.so.${pkgver}" "${pkgdir}/usr/lib/libnvidia-eglcore.so.${pkgver}"
install -D -m755 "libnvidia-glsi.so.${pkgver}" "${pkgdir}/usr/lib/libnvidia-glsi.so.${pkgver}"
# misc
install -D -m755 "libnvidia-ifr.so.${pkgver}" "${pkgdir}/usr/lib/libnvidia-ifr.so.${pkgver}"
install -D -m755 "libnvidia-fbc.so.${pkgver}" "${pkgdir}/usr/lib/libnvidia-fbc.so.${pkgver}"
install -D -m755 "libnvidia-encode.so.${pkgver}" "${pkgdir}/usr/lib/libnvidia-encode.so.${pkgver}"
install -D -m755 "libnvidia-cfg.so.${pkgver}" "${pkgdir}/usr/lib/libnvidia-cfg.so.${pkgver}"
install -D -m755 "libnvidia-ml.so.${pkgver}" "${pkgdir}/usr/lib/libnvidia-ml.so.${pkgver}"
# VDPAU
install -D -m755 "libvdpau_nvidia.so.${pkgver}" "${pkgdir}/usr/lib/vdpau/libvdpau_nvidia.so.${pkgver}"
# nvidia-tls library
install -D -m755 "libnvidia-tls.so.${pkgver}" "${pkgdir}/usr/lib/libnvidia-tls.so.${pkgver}"
install -D -m755 "tls/libnvidia-tls.so.${pkgver}" "${pkgdir}/usr/lib/libnvidia-tls.so.${pkgver}"
# CUDA
install -D -m755 "libcuda.so.${pkgver}" "${pkgdir}/usr/lib/libcuda.so.${pkgver}"
install -D -m755 "libnvcuvid.so.${pkgver}" "${pkgdir}/usr/lib/libnvcuvid.so.${pkgver}"
# PTX JIT Compiler (Parallel Thread Execution (PTX) is a pseudo-assembly language for CUDA)
install -D -m755 "libnvidia-ptxjitcompiler.so.${pkgver}" "${pkgdir}/usr/lib/libnvidia-ptxjitcompiler.so.${pkgver}"
# Fat (multiarchitecture) binary loader
install -D -m755 "libnvidia-fatbinaryloader.so.${pkgver}" "${pkgdir}/usr/lib/libnvidia-fatbinaryloader.so.${pkgver}"
# DEBUG
install -D -m755 nvidia-debugdump "${pkgdir}/usr/bin/nvidia-debugdump"
# nvidia-xconfig
install -D -m755 nvidia-xconfig "${pkgdir}/usr/bin/nvidia-xconfig"
install -D -m644 nvidia-xconfig.1.gz "${pkgdir}/usr/share/man/man1/nvidia-xconfig.1.gz"
# nvidia-bug-report
install -D -m755 nvidia-bug-report.sh "${pkgdir}/usr/bin/nvidia-bug-report.sh"
# nvidia-smi
install -D -m755 nvidia-smi "${pkgdir}/usr/bin/nvidia-smi"
install -D -m644 nvidia-smi.1.gz "${pkgdir}/usr/share/man/man1/nvidia-smi.1.gz"
# nvidia-cuda-mps
install -D -m755 nvidia-cuda-mps-server "${pkgdir}/usr/bin/nvidia-cuda-mps-server"
install -D -m755 nvidia-cuda-mps-control "${pkgdir}/usr/bin/nvidia-cuda-mps-control"
install -D -m644 nvidia-cuda-mps-control.1.gz "${pkgdir}/usr/share/man/man1/nvidia-cuda-mps-control.1.gz"
# nvidia-modprobe
# This should be removed if nvidia fixed their uvm module!
install -D -m4755 nvidia-modprobe "${pkgdir}/usr/bin/nvidia-modprobe"
install -D -m644 nvidia-modprobe.1.gz "${pkgdir}/usr/share/man/man1/nvidia-modprobe.1.gz"
# nvidia-persistenced
install -D -m755 nvidia-persistenced "${pkgdir}/usr/bin/nvidia-persistenced"
install -D -m644 nvidia-persistenced.1.gz "${pkgdir}/usr/share/man/man1/nvidia-persistenced.1.gz"
install -D -m644 nvidia-persistenced-init/systemd/nvidia-persistenced.service.template "${pkgdir}/usr/lib/systemd/system/nvidia-persistenced.service"
sed -i 's/__USER__/nvidia-persistenced/' "${pkgdir}/usr/lib/systemd/system/nvidia-persistenced.service"
# application profiles
install -D -m644 nvidia-application-profiles-${pkgver}-rc "${pkgdir}/usr/share/nvidia/nvidia-application-profiles-${pkgver}-rc"
install -D -m644 nvidia-application-profiles-${pkgver}-key-documentation "${pkgdir}/usr/share/nvidia/nvidia-application-profiles-${pkgver}-key-documentation"
install -D -m644 LICENSE "${pkgdir}/usr/share/licenses/nvidia/LICENSE"
ln -s nvidia "${pkgdir}/usr/share/licenses/nvidia-utils"
install -D -m644 README.txt "${pkgdir}/usr/share/doc/nvidia/README"
install -D -m644 NVIDIA_Changelog "${pkgdir}/usr/share/doc/nvidia/NVIDIA_Changelog"
cp -r html "${pkgdir}/usr/share/doc/nvidia/"
ln -s nvidia "${pkgdir}/usr/share/doc/nvidia-utils"
# distro specific files must be installed in /usr/share/X11/xorg.conf.d
install -D -m644 "${srcdir}/10-nvidia-drm-outputclass.conf" "${pkgdir}/usr/share/X11/xorg.conf.d/10-nvidia-drm-outputclass.conf"
create_links
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment