[Buildroot] [git commit] package/nvidia-driver: fixup libraries according to README
Arnout Vandecappelle (Essensium/Mind)
arnout at mind.be
Sun Jul 25 15:42:18 UTC 2021
commit: https://git.buildroot.net/buildroot/commit/?id=9cda982855315d683d4880e6bb2a129133ea7213
branch: https://git.buildroot.net/buildroot/commit/?id=refs/heads/master
Create a symlink for libglx.so and drop libnvidia-wfb.so (aka libwfb.so)
since all selectable xserver versions in Buildroot provide their own.
VDPAU libraries should be installed into /usr/lib/vdpau/
https://download.nvidia.com/XFree86/Linux-x86_64/390.67/README/installedcomponents.html
Also, allow specifying target subdirectory per library and respect it in
the install loop.
Signed-off-by: Vincent Fazio <vfazio at xes-inc.com>
Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout at mind.be>
---
package/nvidia-driver/nvidia-driver.mk | 57 +++++++++++++++++++++-------------
1 file changed, 35 insertions(+), 22 deletions(-)
diff --git a/package/nvidia-driver/nvidia-driver.mk b/package/nvidia-driver/nvidia-driver.mk
index 44e34cb7b4..80221bc7da 100644
--- a/package/nvidia-driver/nvidia-driver.mk
+++ b/package/nvidia-driver/nvidia-driver.mk
@@ -62,7 +62,7 @@ NVIDIA_DRIVER_LIBS_MISC = \
libnvidia-glcore.so.$(NVIDIA_DRIVER_VERSION) \
libnvidia-glsi.so.$(NVIDIA_DRIVER_VERSION) \
tls/libnvidia-tls.so.$(NVIDIA_DRIVER_VERSION) \
- libvdpau_nvidia.so.$(NVIDIA_DRIVER_VERSION) \
+ libvdpau_nvidia.so.$(NVIDIA_DRIVER_VERSION):vdpau/ \
libnvidia-ml.so.$(NVIDIA_DRIVER_VERSION)
NVIDIA_DRIVER_LIBS += \
@@ -92,10 +92,9 @@ NVIDIA_DRIVER_LIBS += \
endif
# We refer to the destination path; the origin file has no directory component
-NVIDIA_DRIVER_X_MODS = \
- drivers/nvidia_drv.so \
- extensions/libglx.so.$(NVIDIA_DRIVER_VERSION) \
- libnvidia-wfb.so.$(NVIDIA_DRIVER_VERSION)
+NVIDIA_DRIVER_LIBS += \
+ nvidia_drv.so:xorg/modules/drivers/ \
+ libglx.so.$(NVIDIA_DRIVER_VERSION):xorg/modules/extensions/
endif # X drivers
@@ -154,24 +153,31 @@ define NVIDIA_DRIVER_EXTRACT_CMDS
endef
# Helper to install libraries
-# $1: destination directory (target or staging)
+# $1: library name
+# $2: target directory
#
# For all libraries, we install them and create a symlink using
# their SONAME, so we can link to them at runtime; we also create
# the no-version symlink, so we can link to them at build time.
+define NVIDIA_DRIVER_INSTALL_LIB
+ $(INSTALL) -D -m 0644 $(@D)/$(1) $(2)$(notdir $(1))
+ libsoname="$$( $(TARGET_READELF) -d "$(@D)/$(1)" \
+ |sed -r -e '/.*\(SONAME\).*\[(.*)\]$$/!d; s//\1/;' )"; \
+ if [ -n "$${libsoname}" -a "$${libsoname}" != "$(notdir $(1))" ]; then \
+ ln -sf $(notdir $(1)) $(2)$${libsoname}; \
+ fi
+ baseso=$(firstword $(subst .,$(space),$(notdir $(1)))).so; \
+ if [ -n "$${baseso}" -a "$${baseso}" != "$(notdir $(1))" ]; then \
+ ln -sf $(notdir $(1)) $(2)$${baseso}; \
+ fi
+endef
+
+# Helper to install libraries
+# $1: destination directory (target or staging)
define NVIDIA_DRIVER_INSTALL_LIBS
- $(foreach lib,$(NVIDIA_DRIVER_LIBS),\
- $(INSTALL) -D -m 0644 $(@D)/$(lib) $(1)/usr/lib/$(notdir $(lib))
- libsoname="$$( $(TARGET_READELF) -d "$(@D)/$(lib)" \
- |sed -r -e '/.*\(SONAME\).*\[(.*)\]$$/!d; s//\1/;' )"; \
- if [ -n "$${libsoname}" -a "$${libsoname}" != "$(notdir $(lib))" ]; then \
- ln -sf $(notdir $(lib)) \
- $(1)/usr/lib/$${libsoname}; \
- fi
- baseso=$(firstword $(subst .,$(space),$(notdir $(lib)))).so; \
- if [ -n "$${baseso}" -a "$${baseso}" != "$(notdir $(lib))" ]; then \
- ln -sf $(notdir $(lib)) $(1)/usr/lib/$${baseso}; \
- fi
+ $(foreach lib,$(NVIDIA_DRIVER_LIBS),
+ $(call NVIDIA_DRIVER_INSTALL_LIB,$(word 1,$(subst :, ,$(lib))), \
+ $(1)/usr/lib/$(word 2,$(subst :, ,$(lib))))
)
endef
@@ -181,18 +187,25 @@ define NVIDIA_DRIVER_INSTALL_STAGING_CMDS
$(NVIDIA_DRIVER_INSTALL_GL_DEV)
endef
+# libglx needs a symlink according to the driver README. It has no SONAME
+define NVIDIA_DRIVER_SYMLINK_LIBGLX
+ ln -sf libglx.so.$(NVIDIA_DRIVER_VERSION) \
+ $(TARGET_DIR)/usr/lib/xorg/modules/extensions/libglx.so
+endef
+
# For target, install libraries and X.org modules
define NVIDIA_DRIVER_INSTALL_TARGET_CMDS
$(call NVIDIA_DRIVER_INSTALL_LIBS,$(TARGET_DIR))
- $(foreach m,$(NVIDIA_DRIVER_X_MODS), \
- $(INSTALL) -D -m 0644 $(@D)/$(notdir $(m)) \
- $(TARGET_DIR)/usr/lib/xorg/modules/$(m)
- )
$(foreach p,$(NVIDIA_DRIVER_PROGS), \
$(INSTALL) -D -m 0755 $(@D)/$(p) \
$(TARGET_DIR)/usr/bin/$(p)
)
+ $(NVIDIA_DRIVER_SYMLINK_LIBGLX)
$(NVIDIA_DRIVER_INSTALL_KERNEL_MODULE)
endef
+# Due to a conflict with xserver_xorg-server, this needs to be performed when
+# finalizing the target filesystem to make sure this version is used.
+NVIDIA_DRIVER_TARGET_FINALIZE_HOOKS += NVIDIA_DRIVER_SYMLINK_LIBGLX
+
$(eval $(generic-package))
More information about the buildroot
mailing list