driver distribution instead of the ones bundled with the FreeBSD driver
which are incomplete and 32 bit only. This makes amd64 Linux OpenGL
programs work on FreeBSD 12.0 and recent 11-STABLE. This does not enable
CUDA.
- Initialise DISTFILES so a file can be added by the LINUX option.
- Set EXTRACT_ONLY because the file added by the LINUX option is a
self-extracting archive handled in post-extract.
- The patches for <355.06 and >=355.06 are identical except for the path.
Keep only one set (listed in SUB_PATCHES) because more patches have been
added. Modify their path in pre-patch. The patches have been renamed
from extra-patch-* to extra-patch-*.in.
- Set OPTIONS_SUB and use option helpers for the LINUX option.
- Define LINUX_ARCH_SUFX like ARCH_SUFX because LINUX_ARCH can be i386 on
amd64.
- Set LINUX_LIBDIR to the main lib directory: (/compat/linux)/usr/lib on
i386 and (/compat/linux)/usr/lib64 on amd64. (The compat32 directory is
(/compat/linux)/usr/lib.)
- Define LINUX_LIBS, LINUX_LINKS, LINUX32_LIBS, LINUX32_LINKS, LINUX_PROGS,
LINUX_MANS, and LINUX_DATA for all driver versions from 304.137 to 390.87.
LINUX_LIBS and LINUX32_LIBS contain main libraries (i386/amd64) and
compat32 libraries respectively. These are installed with INSTALL_LIB in
post-install. LINUX_LINKS and LINUX32_LINKS contain symbolic link sources
and their target. LINUX_PROGS are binaries installed with
INSTALL_PROGRAM. LINUX_MANS are manuals installed with INSTALL_MAN.
LINUX_DATA are data files and their destination, installed with
INSTALL_DATA. The .if blocks for the different versions are sorted
alphabetically on the first file.
- Define PLIST_RE for all versions. These are sed commands applied to
TMPPLIST in post-install.
- Include bsd.port.pre.mk instead of bsd.port.options.mk to obtain
LINUX_ARCH.
- Adjust post-patch to disable installation of Linux libraries bundled with
the FreeBSD driver.
- Add post-patch-LINUX-on to setup nvidia_icd.json like nvidia-installer
does on Linux.
- Adjust existing post-install TMPPLIST edits to apply only to non-Linux
files.
- Add post-install-LINUX-on to install the Linux files.
- Add files/extra-patch-src-nvidia_ctl.c.in and
extra-patch-src-nvidia_dev.c.in. These patches make Linux stat(2) return
the right major and minor number for /dev/nvidiactl and /dev/nvidia[0-9]+.
Recent versions of the Linux libraries verify these. [1] Define the
struct passed to linux_device_register_handler on the stack in
nvidia_*_attach instead of as a global variable in case multiple graphics
cards are attached in parallel.
- Add files/extra-patch-src-nvidia_linux.c.in. It rewrites the Linux ioctl
handler. The current implementation does not copyin arguments leading to
kernel panics on FreeBSD 12 on machines that support Supervisor Mode
Access Prevention (SMAP).
- Add files/extra-patch-src-nvidia_pci.c.in. It adds a dependency on the
linux_common kernel module for linux_device_register_handler.
- Modify files/extra-patch-src_nvidia-modeset_nvidia-modeset-freebsd.c to
add major/minor numbers (global struct here, because it is constant),
rewrite ioctl, and add a dependency on linux_common for
/dev/nvidia-modeset.
PR: 217901
Analysed by: Alex S <iwtcex@gmail.com> [1]
Tested by: Hannes Hauswedell <h2+fbsdports@fsfe.org> (390.87)
Tested by: tijl (304.137)
Approved by: maintainer timeout (15 days)