cd97cdf642
Changes to all build scripts: * all remaining occurences of 'make -j N' replaced by 'make -j $(nproc)' * obsolete 'atom' machine architecture replaced with 'bonnell', but both new and old MARCH strings are kept for compatibility * optimize TMP variable setting * add OUTDIR variable (default to $TMP) that defines output directory for package; the goal is to simplify building in containers Signed-off-by: Michal Cieslakiewicz <michal.cieslakiewicz@wp.pl>
141 lines
5.7 KiB
Bash
Executable File
141 lines
5.7 KiB
Bash
Executable File
#!/bin/sh
|
|
# Set initial variables:
|
|
CWD=$(pwd)
|
|
|
|
APP=nvidia-driver
|
|
BINDIST=NVIDIA-Linux-x86_64
|
|
VERSION=${VERSION:-$(echo ${BINDIST}-*.run | rev | cut -f 2- -d . | cut -f 1 -d - | rev)}
|
|
ARCH=${ARCH:-x86_64}
|
|
BUILD=${BUILD:-1}
|
|
TAG=${TAG:-micu}
|
|
TMP=${TMP:-/tmp}
|
|
OUTDIR=${OUTDIR:-$TMP}
|
|
|
|
LIBSUFFIX=""
|
|
|
|
if [ "$ARCH" = "x86_64" ]; then
|
|
LIBSUFFIX=${LIBSUFFIX:-64}
|
|
else
|
|
LIBSUFFIX=""
|
|
fi
|
|
|
|
PKG=$TMP/package-$APP
|
|
rm -rf $PKG
|
|
mkdir -p $PKG
|
|
cd $TMP
|
|
rm -rf $BINDIST-$VERSION
|
|
$CWD/${BINDIST}-${VERSION}.run -x || exit 1
|
|
cd $BINDIST-$VERSION || exit 1
|
|
chown -R root.root .
|
|
find . -perm 444 -exec chmod 644 {} \;
|
|
find . -perm 777 -exec chmod 755 {} \;
|
|
find . -perm 666 -exec chmod 644 {} \;
|
|
|
|
# Installation is performed manually, nvidia-installer is not launched:
|
|
mkdir -p $PKG/etc/modprobe.d $PKG/etc/OpenCL/vendors $PKG/etc/X11/xorg.conf.d \
|
|
$PKG/etc/vulkan/icd.d $PKG/usr/bin $PKG/usr/doc/$APP-$VERSION \
|
|
$PKG/usr/lib${LIBSUFFIX}/{tls,vdpau} \
|
|
$PKG/usr/lib${LIBSUFFIX}/xorg/modules/{drivers,extensions} \
|
|
$PKG/usr/man/man1 $PKG/usr/share/X11/xorg.conf.d \
|
|
$PKG/usr/share/applications $PKG/usr/share/egl/egl_external_platform.d \
|
|
$PKG/usr/share/glvnd/egl_vendor.d $PKG/usr/share/nvidia $PKG/usr/share/pixmaps
|
|
|
|
cp -av $CWD/modprobe_nvidia.conf $PKG/etc/modprobe.d/nvidia.conf
|
|
cp -av nvidia.icd $PKG/etc/OpenCL/vendors
|
|
cp -av $CWD/10-nvidia.conf $PKG/etc/X11/xorg.conf.d
|
|
sed -e 's:__NV_VK_ICD__:libGLX_nvidia.so.0:' nvidia_icd.json.template > $PKG/etc/vulkan/icd.d/nvidia_icd.json
|
|
cp -av nvidia-bug-report.sh nvidia-debugdump nvidia-installer nvidia-modprobe \
|
|
nvidia-settings nvidia-smi nvidia-xconfig $PKG/usr/bin
|
|
cp -av LICENSE NVIDIA_Changelog README.txt html $PKG/usr/doc/$APP-$VERSION
|
|
cp -av libEGL_nvidia.so.$VERSION libGLESv1_CM_nvidia.so.$VERSION \
|
|
libGLESv2_nvidia.so.$VERSION libGLX_nvidia.so.$VERSION libcuda.so.$VERSION \
|
|
libnvcuvid.so.$VERSION libnvidia-cfg.so.$VERSION \
|
|
libnvidia-compiler.so.$VERSION libnvidia-eglcore.so.$VERSION \
|
|
libnvidia-encode.so.$VERSION libnvidia-fatbinaryloader.so.$VERSION \
|
|
libnvidia-fbc.so.$VERSION libnvidia-glcore.so.$VERSION \
|
|
libnvidia-glsi.so.$VERSION libnvidia-gtk2.so.$VERSION \
|
|
libnvidia-gtk3.so.$VERSION libnvidia-ifr.so.$VERSION \
|
|
libnvidia-ml.so.$VERSION libnvidia-opencl.so.$VERSION \
|
|
libnvidia-ptxjitcompiler.so.$VERSION libnvidia-tls.so.$VERSION \
|
|
$PKG/usr/lib$LIBSUFFIX
|
|
cp -av tls/libnvidia-tls.so.$VERSION $PKG/usr/lib${LIBSUFFIX}/tls
|
|
cp -av libvdpau_nvidia.so.$VERSION $PKG/usr/lib${LIBSUFFIX}/vdpau
|
|
cp -av libOpenCL.so.1.0.0 libnvidia-egl-wayland.so.1.0.2 \
|
|
$PKG/usr/lib$LIBSUFFIX
|
|
cp -av nvidia_drv.so $PKG/usr/lib${LIBSUFFIX}/xorg/modules/drivers
|
|
cp -av libglx.so.$VERSION $PKG/usr/lib${LIBSUFFIX}/xorg/modules/extensions
|
|
cp -av libnvidia-wfb.so.$VERSION $PKG/usr/lib${LIBSUFFIX}/xorg/modules
|
|
cp -av nvidia-installer.1.gz nvidia-modprobe.1.gz nvidia-settings.1.gz \
|
|
nvidia-smi.1.gz nvidia-xconfig.1.gz $PKG/usr/man/man1
|
|
cp -av nvidia-drm-outputclass.conf \
|
|
$PKG/usr/share/X11/xorg.conf.d/20-nvidia-drm-outputclass.conf
|
|
sed -e 's:__UTILS_PATH__:/usr/bin:' -e 's:__PIXMAP_PATH__:/usr/share/pixmaps:' \
|
|
nvidia-settings.desktop > $PKG/usr/share/applications/nvidia-settings.desktop
|
|
cp -av 10_nvidia_wayland.json $PKG/usr/share/egl/egl_external_platform.d
|
|
cp -av 10_nvidia.json $PKG/usr/share/glvnd/egl_vendor.d
|
|
cp -av nvidia-application-profiles-${VERSION}-key-documentation \
|
|
nvidia-application-profiles-${VERSION}-rc $PKG/usr/share/nvidia
|
|
cp -av nvidia-settings.png $PKG/usr/share/pixmaps
|
|
|
|
( cd $PKG/usr/lib$LIBSUFFIX
|
|
ln -s libEGL_nvidia.so.$VERSION libEGL_nvidia.so.0
|
|
ln -s libGLESv1_CM_nvidia.so.$VERSION libGLESv1_CM_nvidia.so.1
|
|
ln -s libGLESv2_nvidia.so.$VERSION libGLESv2_nvidia.so.2
|
|
ln -s libGLX_nvidia.so.$VERSION libGLX_nvidia.so.0
|
|
ln -s libGLX_nvidia.so.$VERSION libGLX_indirect.so.0
|
|
ln -s libcuda.so.$VERSION libcuda.so.1
|
|
ln -s libcuda.so.1 libcuda.so
|
|
ln -s libnvcuvid.so.$VERSION libnvcuvid.so.1
|
|
ln -s libnvcuvid.so.1 libnvcuvid.so
|
|
ln -s libnvidia-cfg.so.$VERSION libnvidia-cfg.so.1
|
|
ln -s libnvidia-cfg.so.1 libnvidia-cfg.so
|
|
ln -s libnvidia-encode.so.$VERSION libnvidia-encode.so.1
|
|
ln -s libnvidia-encode.so.1 libnvidia-encode.so
|
|
ln -s libnvidia-fbc.so.$VERSION libnvidia-fbc.so.1
|
|
ln -s libnvidia-fbc.so.1 libnvidia-fbc.so
|
|
ln -s libnvidia-ifr.so.$VERSION libnvidia-ifr.so.1
|
|
ln -s libnvidia-ifr.so.1 libnvidia-ifr.so
|
|
ln -s libnvidia-ml.so.$VERSION libnvidia-ml.so.1
|
|
ln -s libnvidia-ml.so.1 libnvidia-ml.so
|
|
ln -s libnvidia-opencl.so.$VERSION libnvidia-opencl.so.1
|
|
ln -s libnvidia-ptxjitcompiler.so.$VERSION libnvidia-ptxjitcompiler.so.1
|
|
ln -s libnvidia-ptxjitcompiler.so.1 libnvidia-ptxjitcompiler.so
|
|
ln -s vdpau/libvdpau_nvidia.so.$VERSION libvdpau_nvidia.so
|
|
ln -s libOpenCL.so.1.0.0 libOpenCL.so.1.0
|
|
ln -s libOpenCL.so.1.0 libOpenCL.so.1
|
|
ln -s libOpenCL.so.1 libOpenCL.so
|
|
ln -s libnvidia-egl-wayland.so.1.0.2 libnvidia-egl-wayland.so.1
|
|
)
|
|
( cd $PKG/usr/lib${LIBSUFFIX}/vdpau
|
|
ln -s libvdpau_nvidia.so.$VERSION libvdpau_nvidia.so.1
|
|
ln -s libvdpau_nvidia.so.1 libvdpau_nvidia.so
|
|
)
|
|
( cd $PKG/usr/lib${LIBSUFFIX}/xorg/modules
|
|
ln -s libnvidia-wfb.so.$VERSION libnvidia-wfb.so.1
|
|
)
|
|
|
|
chown -R root.bin $PKG/usr/bin
|
|
|
|
mkdir -p $PKG/install
|
|
echo "VERSION=$VERSION" > $PKG/install/doinst.sh
|
|
[ -f $CWD/doinst.sh ] && cat $CWD/doinst.sh >> $PKG/install/doinst.sh
|
|
[ -f $CWD/douninst.sh ] && cat $CWD/douninst.sh > $PKG/install/douninst.sh
|
|
cat $CWD/slack-desc > $PKG/install/slack-desc
|
|
|
|
# Allow to run as non-root until now:
|
|
if [ $(id -u) -ne 0 ]; then
|
|
echo "*** Running as non-root, skipping makepkg."
|
|
echo "*** Package contents is in $PKG directory."
|
|
exit 0
|
|
fi
|
|
|
|
cd $PKG
|
|
makepkg -l y -c n $OUTDIR/$APP-$VERSION-$ARCH-${BUILD}${TAG}.txz
|
|
|
|
# Clean up the extra stuff:
|
|
if [ "$1" = "--cleanup" ]; then
|
|
rm -rf $TMP/$BINDIST-$VERSION
|
|
rm -rf $PKG
|
|
fi
|
|
|