python-pathvalidate: bump version to 0.14.1
[buildroot-gz.git] / package / nvidia-driver / nvidia-driver.mk
blobcb9b7faeca1f2b5c86d6c3828c2199dad424f60e
1 ################################################################################
3 # nvidia-driver
5 ################################################################################
7 NVIDIA_DRIVER_VERSION = 375.20
8 NVIDIA_DRIVER_SUFFIX = $(if $(BR2_x86_64),_64)
9 NVIDIA_DRIVER_SITE = ftp://download.nvidia.com/XFree86/Linux-x86$(NVIDIA_DRIVER_SUFFIX)/$(NVIDIA_DRIVER_VERSION)
10 NVIDIA_DRIVER_SOURCE = NVIDIA-Linux-x86$(NVIDIA_DRIVER_SUFFIX)-$(NVIDIA_DRIVER_VERSION).run
11 NVIDIA_DRIVER_LICENSE = NVIDIA Software License
12 NVIDIA_DRIVER_LICENSE_FILES = LICENSE
13 NVIDIA_DRIVER_REDISTRIBUTE = NO
14 NVIDIA_DRIVER_INSTALL_STAGING = YES
16 ifeq ($(BR2_PACKAGE_NVIDIA_DRIVER_XORG),y)
18 # Since nvidia-driver are binary blobs, the below dependencies are not
19 # strictly speaking build dependencies of nvidia-driver. However, they
20 # are build dependencies of packages that depend on nvidia-driver, so
21 # they should be built prior to those packages, and the only simple
22 # way to do so is to make nvidia-driver depend on them.
23 NVIDIA_DRIVER_DEPENDENCIES = mesa3d-headers
24 NVIDIA_DRIVER_PROVIDES = libgl libegl libgles
26 # libGL.so.$(NVIDIA_DRIVER_VERSION) is the legacy libGL.so library; it
27 # has been replaced with libGL.so.1.0.0. Installing both is technically
28 # possible, but great care must be taken to ensure they do not conflict,
29 # so that EGL still works. The legacy library exposes an NVidia-specific
30 # API, so it should not be needed, except for legacy, binary-only
31 # applications (in other words: we don't care).
33 # libGL.so.1.0.0 is the new vendor-neutral library, aimed at replacing
34 # the old libGL.so.$(NVIDIA_DRIVER_VERSION) library. The latter contains
35 # NVidia extensions (which is deemed bad now), while the former follows
36 # the newly-introduced vendor-neutral "dispatching" API/ABI:
37 # https://github.com/aritger/linux-opengl-abi-proposal/blob/master/linux-opengl-abi-proposal.txt
38 # However, this is not very usefull to us, as we don't support multiple
39 # GL providers at the same time on the system, which this proposal is
40 # aimed at supporting.
42 # So we only install the legacy library for now.
43 NVIDIA_DRIVER_LIBS_GL = \
44 libGLX.so.0 \
45 libGL.so.$(NVIDIA_DRIVER_VERSION) \
46 libGLX_nvidia.so.$(NVIDIA_DRIVER_VERSION) \
48 NVIDIA_DRIVER_LIBS_EGL = \
49 libEGL.so.1 \
50 libGLdispatch.so.0 \
51 libEGL_nvidia.so.$(NVIDIA_DRIVER_VERSION) \
53 NVIDIA_DRIVER_LIBS_GLES = \
54 libGLESv1_CM.so.1 \
55 libGLESv2.so.2 \
56 libGLESv1_CM_nvidia.so.$(NVIDIA_DRIVER_VERSION) \
57 libGLESv2_nvidia.so.$(NVIDIA_DRIVER_VERSION) \
59 NVIDIA_DRIVER_LIBS_MISC = \
60 libnvidia-eglcore.so.$(NVIDIA_DRIVER_VERSION) \
61 libnvidia-egl-wayland.so.$(NVIDIA_DRIVER_VERSION) \
62 libnvidia-glcore.so.$(NVIDIA_DRIVER_VERSION) \
63 libnvidia-glsi.so.$(NVIDIA_DRIVER_VERSION) \
64 tls/libnvidia-tls.so.$(NVIDIA_DRIVER_VERSION) \
65 libvdpau_nvidia.so.$(NVIDIA_DRIVER_VERSION) \
66 libnvidia-ml.so.$(NVIDIA_DRIVER_VERSION) \
68 NVIDIA_DRIVER_LIBS = \
69 $(NVIDIA_DRIVER_LIBS_GL) \
70 $(NVIDIA_DRIVER_LIBS_EGL) \
71 $(NVIDIA_DRIVER_LIBS_GLES) \
72 $(NVIDIA_DRIVER_LIBS_MISC) \
74 # Install the gl.pc file
75 define NVIDIA_DRIVER_INSTALL_GL_DEV
76 $(INSTALL) -D -m 0644 $(@D)/libGL.la $(STAGING_DIR)/usr/lib/libGL.la
77 $(SED) 's:__GENERATED_BY__:Buildroot:' $(STAGING_DIR)/usr/lib/libGL.la
78 $(SED) 's:__LIBGL_PATH__:/usr/lib:' $(STAGING_DIR)/usr/lib/libGL.la
79 $(SED) 's:-L[^[:space:]]\+::' $(STAGING_DIR)/usr/lib/libGL.la
80 $(INSTALL) -D -m 0644 package/nvidia-driver/gl.pc $(STAGING_DIR)/usr/lib/pkgconfig/gl.pc
81 endef
83 # Those libraries are 'private' libraries requiring an agreement with
84 # NVidia to develop code for those libs. There seems to be no restriction
85 # on using those libraries (e.g. if the user has such an agreement, or
86 # wants to run a third-party program developped under such an agreement).
87 ifeq ($(BR2_PACKAGE_NVIDIA_DRIVER_PRIVATE_LIBS),y)
88 NVIDIA_DRIVER_LIBS += \
89 libnvidia-ifr.so.$(NVIDIA_DRIVER_VERSION) \
90 libnvidia-fbc.so.$(NVIDIA_DRIVER_VERSION)
91 endif
93 # We refer to the destination path; the origin file has no directory component
94 NVIDIA_DRIVER_X_MODS = \
95 drivers/nvidia_drv.so \
96 extensions/libglx.so.$(NVIDIA_DRIVER_VERSION) \
97 libnvidia-wfb.so.$(NVIDIA_DRIVER_VERSION)
99 endif # X drivers
101 ifeq ($(BR2_PACKAGE_NVIDIA_DRIVER_CUDA),y)
102 NVIDIA_DRIVER_LIBS += \
103 libcuda.so.$(NVIDIA_DRIVER_VERSION) \
104 libnvidia-compiler.so.$(NVIDIA_DRIVER_VERSION) \
105 libnvcuvid.so.$(NVIDIA_DRIVER_VERSION) \
106 libnvidia-fatbinaryloader.so.$(NVIDIA_DRIVER_VERSION) \
107 libnvidia-ptxjitcompiler.so.$(NVIDIA_DRIVER_VERSION) \
108 libnvidia-encode.so.$(NVIDIA_DRIVER_VERSION)
109 ifeq ($(BR2_PACKAGE_NVIDIA_DRIVER_CUDA_PROGS),y)
110 NVIDIA_DRIVER_PROGS = nvidia-cuda-mps-control nvidia-cuda-mps-server
111 endif
112 endif
114 ifeq ($(BR2_PACKAGE_NVIDIA_DRIVER_OPENCL),y)
115 NVIDIA_DRIVER_LIBS += \
116 libOpenCL.so.1.0.0 \
117 libnvidia-opencl.so.$(NVIDIA_DRIVER_VERSION)
118 endif
120 # Build and install the kernel modules if needed
121 ifeq ($(BR2_PACKAGE_NVIDIA_DRIVER_MODULE),y)
123 NVIDIA_DRIVER_MODULES = nvidia nvidia-modeset nvidia-drm
124 ifeq ($(BR2_x86_64),y)
125 NVIDIA_DRIVER_MODULES += nvidia-uvm
126 endif
128 # They can't do everything like everyone. They need those variables,
129 # because they don't recognise the usual variables set by the kernel
130 # build system. We also need to tell them what modules to build.
131 NVIDIA_DRIVER_MODULE_MAKE_OPTS = \
132 NV_KERNEL_SOURCES="$(LINUX_DIR)" \
133 NV_KERNEL_OUTPUT="$(LINUX_DIR)" \
134 NV_KERNEL_MODULES="$(NVIDIA_DRIVER_MODULES)"
136 NVIDIA_DRIVER_MODULE_SUBDIRS = kernel
138 $(eval $(kernel-module))
140 endif # BR2_PACKAGE_NVIDIA_DRIVER_MODULE == y
142 # The downloaded archive is in fact an auto-extract script. So, it can run
143 # virtually everywhere, and it is fine enough to provide useful options.
144 # Except it can't extract into an existing (even empty) directory.
145 define NVIDIA_DRIVER_EXTRACT_CMDS
146 $(SHELL) $(DL_DIR)/$(NVIDIA_DRIVER_SOURCE) --extract-only --target \
147 $(@D)/tmp-extract
148 chmod u+w -R $(@D)
149 mv $(@D)/tmp-extract/* $(@D)/tmp-extract/.manifest $(@D)
150 rm -rf $(@D)/tmp-extract
151 endef
153 # Helper to install libraries
154 # $1: destination directory (target or staging)
156 # For all libraries, we install them and create a symlink using
157 # their SONAME, so we can link to them at runtime; we also create
158 # the no-version symlink, so we can link to them at build time.
159 define NVIDIA_DRIVER_INSTALL_LIBS
160 $(foreach lib,$(NVIDIA_DRIVER_LIBS),\
161 $(INSTALL) -D -m 0644 $(@D)/$(lib) $(1)/usr/lib/$(notdir $(lib))
162 libsoname="$$( $(TARGET_READELF) -d "$(@D)/$(lib)" \
163 |sed -r -e '/.*\(SONAME\).*\[(.*)\]$$/!d; s//\1/;' )"; \
164 if [ -n "$${libsoname}" -a "$${libsoname}" != "$(notdir $(lib))" ]; then \
165 ln -sf $(notdir $(lib)) \
166 $(1)/usr/lib/$${libsoname}; \
168 baseso=$(firstword $(subst .,$(space),$(notdir $(lib)))).so; \
169 if [ -n "$${baseso}" -a "$${baseso}" != "$(notdir $(lib))" ]; then \
170 ln -sf $(notdir $(lib)) $(1)/usr/lib/$${baseso}; \
173 endef
175 # For staging, install libraries and development files
176 define NVIDIA_DRIVER_INSTALL_STAGING_CMDS
177 $(call NVIDIA_DRIVER_INSTALL_LIBS,$(STAGING_DIR))
178 $(NVIDIA_DRIVER_INSTALL_GL_DEV)
179 endef
181 # For target, install libraries and X.org modules
182 define NVIDIA_DRIVER_INSTALL_TARGET_CMDS
183 $(call NVIDIA_DRIVER_INSTALL_LIBS,$(TARGET_DIR))
184 $(foreach m,$(NVIDIA_DRIVER_X_MODS), \
185 $(INSTALL) -D -m 0644 $(@D)/$(notdir $(m)) \
186 $(TARGET_DIR)/usr/lib/xorg/modules/$(m)
188 $(foreach p,$(NVIDIA_DRIVER_PROGS), \
189 $(INSTALL) -D -m 0755 $(@D)/$(p) \
190 $(TARGET_DIR)/usr/bin/$(p)
192 $(NVIDIA_DRIVER_INSTALL_KERNEL_MODULE)
193 endef
195 $(eval $(generic-package))