git: 786efa1020bf - 2025Q3 - x11/nvidia-driver: Fix build after kva_layout

From: Kevin Bowling <kbowling_at_FreeBSD.org>
Date: Thu, 17 Jul 2025 02:28:51 UTC
The branch 2025Q3 has been updated by kbowling:

URL: https://cgit.FreeBSD.org/ports/commit/?id=786efa1020bf0f0044da006c7312795aa397a474

commit 786efa1020bf0f0044da006c7312795aa397a474
Author:     Tomoaki AOKI <junchoon@dec.sakura.ne.jp>
AuthorDate: 2025-07-17 02:21:13 +0000
Commit:     Kevin Bowling <kbowling@FreeBSD.org>
CommitDate: 2025-07-17 02:28:32 +0000

    x11/nvidia-driver: Fix build after kva_layout
    
    Commit 4dd828c808286 on main branch of src removed 2 macros,
    DMAP_MIN_ADDRESS and DMAP_MAX_ADDRESS and require to use variables
    (members of struct) kva_layout.dmap_low and kva_layout.dmap_high
    respectively.
    
    This broke builds of x11/nvidia-driver[-304|-340|-390|-470|-devel].
    And the change is not planned for MFC (POLA violation).
    
    Fix build by using new variables conditionally.
    
    As there are around 10 days between usable latest bump at base
    65ed1a035ceb8 and base 4dd828c808286, there are broken time window.
    
    PR:             288236
    Reviewed by:    ashafer, kib
    
    (cherry picked from commit 9302fb05a0c6599bbe8963ff5201fd3b99994535)
---
 x11/nvidia-driver/Makefile | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/x11/nvidia-driver/Makefile b/x11/nvidia-driver/Makefile
index dcc5da991172..317e494ecbdf 100644
--- a/x11/nvidia-driver/Makefile
+++ b/x11/nvidia-driver/Makefile
@@ -321,6 +321,15 @@ post-patch: .SILENT
 .if ! ${PORT_OPTIONS:MDOCS}
 	${REINPLACE_CMD} -E 's/(x11).*/\1/ ; /doc/d' ${WRKSRC}/Makefile
 .endif
+# DMAP_MIN_ADDRESS and DMAP_MAX_ADDRESS is deleted from src at commit
+# 4dd828c80828637452a8a4e07a64e294c82e5d8b on main branch.
+# Note that there are about 10 days of broken window, as the commit
+# does not have corresponding version bump.
+.if ${OSVERSION} >= 1500051
+	${REINPLACE_CMD} -e 's/DMAP_MIN_ADDRESS/kva_layout.dmap_low/' \
+		-e 's/DMAP_MAX_ADDRESS/kva_layout.dmap_high/' \
+		${WRKSRC}/src/nvidia/nvidia_subr.c
+.endif
 
 pre-install:
 	@${MKDIR} ${STAGEDIR}${PREFIX}/${MODULESDIR}/drivers \