Re: git: 4754e9fd33c4 - main - graphics/nvidia-drm-[510,515]-kmod: Add the port.

From: Sergio Carlavilla <carlavilla_at_freebsd.org>
Date: Sun, 20 Aug 2023 17:57:16 UTC
On Sun, 20 Aug 2023 at 19:54, Gleb Popov <arrowd@freebsd.org> wrote:

> The branch main has been updated by arrowd:
>
> URL:
> https://cgit.FreeBSD.org/ports/commit/?id=4754e9fd33c4fae0359a272d72d9aa7fe75c7a82
>
> commit 4754e9fd33c4fae0359a272d72d9aa7fe75c7a82
> Author:     Austin Shafer <ashafer@badland.io>
> AuthorDate: 2023-08-18 14:31:22 +0000
> Commit:     Gleb Popov <arrowd@FreeBSD.org>
> CommitDate: 2023-08-20 17:54:07 +0000
>
>     graphics/nvidia-drm-[510,515]-kmod: Add the port.
>
>     This port provides the nvidia-drm.ko kernel module, as ported here:
>     https://github.com/amshafer/nvidia-driver
>
>     This module implements the DRM API, which is commonly used for PRIME
> and
>     Wayland setups.
>
>     Differential Revision: https://reviews.freebsd.org/D41497
>
>     Reviewed by:    arrowd
> ---
>  graphics/Makefile                                  |  3 ++
>  graphics/nvidia-drm-510-kmod/Makefile              | 10 +++++++
>  graphics/nvidia-drm-510-kmod/distinfo              |  5 ++++
>  .../files/20-nvidia-drm-outputclass.conf.in        |  8 ++++++
>  graphics/nvidia-drm-510-kmod/pkg-descr             |  3 ++
>  graphics/nvidia-drm-515-kmod/Makefile              | 10 +++++++
>  graphics/nvidia-drm-515-kmod/distinfo              |  5 ++++
>  .../files/20-nvidia-drm-outputclass.conf.in        |  8 ++++++
>  graphics/nvidia-drm-515-kmod/pkg-descr             |  3 ++
>  graphics/nvidia-drm-kmod/Makefile                  | 25 +++++++++++++++++
>  graphics/nvidia-drm-kmod/Makefile.common           | 32
> ++++++++++++++++++++++
>  graphics/nvidia-drm-kmod/pkg-descr                 |  1 +
>  12 files changed, 113 insertions(+)
>
> diff --git a/graphics/Makefile b/graphics/Makefile
> index 8a01b3895276..c1910b63b806 100644
> --- a/graphics/Makefile
> +++ b/graphics/Makefile
> @@ -593,6 +593,9 @@
>      SUBDIR += npretty
>      SUBDIR += nsxiv
>      SUBDIR += nurbs++
> +    SUBDIR += nvidia-drm-510-kmod
> +    SUBDIR += nvidia-drm-515-kmod
> +    SUBDIR += nvidia-drm-kmod
>      SUBDIR += nvidia-texture-tools
>      SUBDIR += ocaml-cairo
>      SUBDIR += ocaml-images
> diff --git a/graphics/nvidia-drm-510-kmod/Makefile
> b/graphics/nvidia-drm-510-kmod/Makefile
> new file mode 100644
> index 000000000000..13b2c26c6c3f
> --- /dev/null
> +++ b/graphics/nvidia-drm-510-kmod/Makefile
> @@ -0,0 +1,10 @@
> +PORTNAME=      nvidia-drm-510-kmod
> +PORTVERSION=   ${NVIDIA_DISTVERSION}
> +CATEGORIES=    graphics
> +
> +RUN_DEPENDS+=  ${KMODDIR}/drm.ko:graphics/drm-510-kmod
> +
> +.include "${.CURDIR}/../drm-510-kmod/Makefile.version"
> +.include "${.CURDIR}/../nvidia-drm-kmod/Makefile.common"
> +
> +.include <bsd.port.mk>
> diff --git a/graphics/nvidia-drm-510-kmod/distinfo
> b/graphics/nvidia-drm-510-kmod/distinfo
> new file mode 100644
> index 000000000000..3b60248b1ff9
> --- /dev/null
> +++ b/graphics/nvidia-drm-510-kmod/distinfo
> @@ -0,0 +1,5 @@
> +TIMESTAMP = 1692304583
> +SHA256
> (amshafer-nvidia-driver-535.98-nvidia-drm-510-kmod-535.98_GH0.tar.gz) =
> c11fb17f9f8cddc11ec699c63bbc288bd1124537dd7ae698538ebd8bb399e225
> +SIZE
> (amshafer-nvidia-driver-535.98-nvidia-drm-510-kmod-535.98_GH0.tar.gz) =
> 185499361
> +SHA256 (freebsd-drm-kmod-drm_v5.10.163_6_GH0.tar.gz) =
> 342eb5073f318d18667c605e639bd85e48de3be25861d8a730d0ca3dd7ba7726
> +SIZE (freebsd-drm-kmod-drm_v5.10.163_6_GH0.tar.gz) = 20096515
> diff --git a/graphics/nvidia-drm-510-kmod/files/
> 20-nvidia-drm-outputclass.conf.in b/graphics/nvidia-drm-510-kmod/files/
> 20-nvidia-drm-outputclass.conf.in
> new file mode 100644
> index 000000000000..15496138f63a
> --- /dev/null
> +++ b/graphics/nvidia-drm-510-kmod/files/20-nvidia-drm-outputclass.conf.in
> @@ -0,0 +1,8 @@
> +Section "OutputClass"
> +    Identifier "nvidia"
> +    MatchDriver "nvidia-drm"
> +    Driver "nvidia"
> +    Option "PrimaryGPU" "yes"
> +    ModulePath "%%LOCALBASE%%/lib/nvidia/xorg"
> +    ModulePath "%%LOCALBASE%%/lib/xorg/modules"
> +EndSection
> diff --git a/graphics/nvidia-drm-510-kmod/pkg-descr
> b/graphics/nvidia-drm-510-kmod/pkg-descr
> new file mode 100644
> index 000000000000..64ec67472ed7
> --- /dev/null
> +++ b/graphics/nvidia-drm-510-kmod/pkg-descr
> @@ -0,0 +1,3 @@
> +FreeBSD port of Linux's nvidia-drm.ko Kernel module.
> +
> +This version is compatible with drm.ko 5.10.
> diff --git a/graphics/nvidia-drm-515-kmod/Makefile
> b/graphics/nvidia-drm-515-kmod/Makefile
> new file mode 100644
> index 000000000000..c20e7d25f126
> --- /dev/null
> +++ b/graphics/nvidia-drm-515-kmod/Makefile
> @@ -0,0 +1,10 @@
> +PORTNAME=      nvidia-drm-515-kmod
> +PORTVERSION=   ${NVIDIA_DISTVERSION}
> +CATEGORIES=    graphics
> +
> +RUN_DEPENDS+=  ${KMODDIR}/drm.ko:graphics/drm-515-kmod
> +
> +.include "${.CURDIR}/../drm-515-kmod/Makefile.version"
> +.include "${.CURDIR}/../nvidia-drm-kmod/Makefile.common"
> +
> +.include <bsd.port.mk>
> diff --git a/graphics/nvidia-drm-515-kmod/distinfo
> b/graphics/nvidia-drm-515-kmod/distinfo
> new file mode 100644
> index 000000000000..ea026477bc17
> --- /dev/null
> +++ b/graphics/nvidia-drm-515-kmod/distinfo
> @@ -0,0 +1,5 @@
> +TIMESTAMP = 1692308433
> +SHA256
> (amshafer-nvidia-driver-535.98-nvidia-drm-515-kmod-535.98_GH0.tar.gz) =
> 973bb7d81e894767f1e9e5cbe394be15289084098d782fb4adb3758a8face51c
> +SIZE
> (amshafer-nvidia-driver-535.98-nvidia-drm-515-kmod-535.98_GH0.tar.gz) =
> 185499765
> +SHA256 (freebsd-drm-kmod-drm_v5.15.25_5_GH0.tar.gz) =
> bd5eb5a39cd46f532d0310958bfc2870da1c1a003e92874f18f7f88c8baac6a5
> +SIZE (freebsd-drm-kmod-drm_v5.15.25_5_GH0.tar.gz) = 26084713
> diff --git a/graphics/nvidia-drm-515-kmod/files/
> 20-nvidia-drm-outputclass.conf.in b/graphics/nvidia-drm-515-kmod/files/
> 20-nvidia-drm-outputclass.conf.in
> new file mode 100644
> index 000000000000..15496138f63a
> --- /dev/null
> +++ b/graphics/nvidia-drm-515-kmod/files/20-nvidia-drm-outputclass.conf.in
> @@ -0,0 +1,8 @@
> +Section "OutputClass"
> +    Identifier "nvidia"
> +    MatchDriver "nvidia-drm"
> +    Driver "nvidia"
> +    Option "PrimaryGPU" "yes"
> +    ModulePath "%%LOCALBASE%%/lib/nvidia/xorg"
> +    ModulePath "%%LOCALBASE%%/lib/xorg/modules"
> +EndSection
> diff --git a/graphics/nvidia-drm-515-kmod/pkg-descr
> b/graphics/nvidia-drm-515-kmod/pkg-descr
> new file mode 100644
> index 000000000000..598cb9411e54
> --- /dev/null
> +++ b/graphics/nvidia-drm-515-kmod/pkg-descr
> @@ -0,0 +1,3 @@
> +FreeBSD port of Linux's nvidia-drm.ko Kernel module.
> +
> +This version is compatible with drm.ko 5.15.
> diff --git a/graphics/nvidia-drm-kmod/Makefile
> b/graphics/nvidia-drm-kmod/Makefile
> new file mode 100644
> index 000000000000..cc226f22dbf2
> --- /dev/null
> +++ b/graphics/nvidia-drm-kmod/Makefile
> @@ -0,0 +1,25 @@
> +PORTNAME=      nvidia-drm-kmod
> +PORTVERSION=   ${NVIDIA_DISTVERSION}
> +CATEGORIES=    graphics kld
> +
> +MAINTAINER=    ashafer@badland.io
> +COMMENT=       NVIDIA DRM Kernel Module
> +WWW=           https://github.com/amshafer/nvidia-driver
> +
> +USES=          metaport
> +
> +.include "${.CURDIR}/../../x11/nvidia-driver/Makefile.version"
> +.include <bsd.port.pre.mk>
> +
> +# Only supported on FreeBSD 13.1+
> +.if ${OPSYS} != FreeBSD
> +IGNORE=                not supported on anything but FreeBSD (missing
> linuxkpi functionality)
> +.else
> +.  if ${OSVERSION} >= 1301000
> +RUN_DEPENDS+=  ${KMODDIR}/nvidia-drm.ko:graphics/nvidia-drm-510-kmod
> +.  else
> +IGNORE=                not supported for this FreeBSD version
> +.  endif
> +.endif
> +
> +.include <bsd.port.post.mk>
> diff --git a/graphics/nvidia-drm-kmod/Makefile.common
> b/graphics/nvidia-drm-kmod/Makefile.common
> new file mode 100644
> index 000000000000..f97266bc03e1
> --- /dev/null
> +++ b/graphics/nvidia-drm-kmod/Makefile.common
> @@ -0,0 +1,32 @@
> +# Common rules for nvidia-drm-*-kmod ports
> +
> +MAINTAINER=    ashafer@badland.io
> +COMMENT=       NVIDIA DRM Kernel Module
> +WWW=           https://github.com/amshafer/nvidia-driver
> +
> +ONLY_FOR_ARCHS=        amd64
> +USES=          kmod uidfix
> +
> +SUB_FILES=     20-nvidia-drm-outputclass.conf
> +
> +RUN_DEPENDS+=  ${KMODDIR}/nvidia.ko:x11/nvidia-driver
> +
> +.include "${.CURDIR}/../../x11/nvidia-driver/Makefile.version"
> +
> +LICENSE_FILE=  ${WRKSRC}/nvidia/doc/license.txt
> +
> +NVIDIA_GH_TAGNAME=     ${PORTNAME}-${PORTVERSION}
> +USE_GITHUB=    yes
> +GH_ACCOUNT=    amshafer freebsd:drm
> +GH_PROJECT=    nvidia-driver drm-kmod:drm
> +GH_TAGNAME:=   ${NVIDIA_GH_TAGNAME} ${DRM_KMOD_GH_TAGNAME}:drm
> +
> +PLIST_FILES=   ${KMODDIR}/nvidia-drm.ko \
> +               share/X11/xorg.conf.d/20-nvidia-drm-outputclass.conf
> +
> +MAKE_ENV+=     DRMKMODDIR=${WRKDIR}/drm-kmod-${DRM_KMOD_GH_TAGNAME}/
> +WRKSRC_SUBDIR= nvidia/src/nvidia-drm/
> +
> +post-install:
> +       ${MKDIR} ${STAGEDIR}${PREFIX}/share/X11/xorg.conf.d/
> +       ${INSTALL_DATA} ${WRKDIR}/20-nvidia-drm-outputclass.conf
> ${STAGEDIR}${PREFIX}/share/X11/xorg.conf.d/
> diff --git a/graphics/nvidia-drm-kmod/pkg-descr
> b/graphics/nvidia-drm-kmod/pkg-descr
> new file mode 100644
> index 000000000000..9fea5fd244d8
> --- /dev/null
> +++ b/graphics/nvidia-drm-kmod/pkg-descr
> @@ -0,0 +1 @@
> +FreeBSD port of Linux's nvidia-drm.ko Kernel module.


> Nice to have this port!

I’ll document it in the handbook :)