Bug 177459 - [PATCH] x11/nvidia-driver: fix slave port builds on -CURRENT
[PATCH] x11/nvidia-driver: fix slave port builds on -CURRENT
Status: Closed FIXED
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s)
Any Any
: Normal Affects Only Me
Assigned To: Alexey Dokuchaev
Depends on:
  Show dependency treegraph
Reported: 2013-03-29 01:20 UTC by Brendan Fabeny
Modified: 2013-04-07 16:30 UTC (History)
0 users

See Also:

file.diff (7.45 KB, patch)
2013-03-29 01:20 UTC, Brendan Fabeny
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Brendan Fabeny freebsd_committer 2013-03-29 01:20:00 UTC
In adding patches for recent changes in the linux headers and VM system, we overlooked the fact that patches in x11/nvidia-driver/files are often applied against the slave ports as well as the master port. As a result, some of the slave ports are now broken, either because the patches don't apply to their slightly different source files, or because the slave ports have additional occurrences of obsolete VM constructs that are not fixed by the patches devised for the master port.  Fix this by replacing the patches by sed(1) invocations that work for all the ports, with correct OSVERSION checks.  While here, append to rather than make a late assignment to LIB_DEPENDS, and adjust some of the other VM locking that wasn't needed and is now broken after FreeBSD src r242941.

Fix: Patch attached with submission follows:
Comment 1 Edwin Groothuis freebsd_committer 2013-03-29 01:20:08 UTC
Responsible Changed
From-To: freebsd-ports-bugs->danfe

Over to maintainer (via the GNATS Auto Assign Tool)
Comment 2 dfilter freebsd_committer 2013-04-07 16:22:04 UTC
Author: danfe
Date: Sun Apr  7 15:21:50 2013
New Revision: 315754
URL: http://svnweb.freebsd.org/changeset/ports/315754

  - Convert recent patches against -CURRENT to sed(1) invocations that work for
    all driver ports, including legacy ones, with correct OSVERSION checks
  - Retouch some comments while here
  PR:		ports/177459
  Submitted by:	bf
  Approved by:	portmgr (miwi)


Modified: head/x11/nvidia-driver/Makefile
--- head/x11/nvidia-driver/Makefile	Sun Apr  7 12:01:13 2013	(r315753)
+++ head/x11/nvidia-driver/Makefile	Sun Apr  7 15:21:50 2013	(r315754)
@@ -12,11 +12,11 @@
 PORTNAME=	nvidia-driver
-# Always try to set PORTREVISION as can be overridden by the slave ports
+# Always try to set PORTREVISION as it can be overridden by the slave ports
 CATEGORIES=	x11 kld
-# MASTER_SITE_SUBDIR has to be set later because it depends on NVVERSION
+# MASTER_SITE_SUBDIR it set later because it depends on NVVERSION
 MAINTAINER=	danfe@FreeBSD.org
@@ -86,18 +86,11 @@ WBINVD_DESC=		Flush CPU caches directly 
-. if ${OSVERSION} > 1000028
-EXTRA_PATCHES+=	${FILESDIR}/r248084-patch-src-nv-freebsd.h
-EXTRA_PATCHES+=	${FILESDIR}/r248084-patch-src-nvidia_subr.c
-. endif
 CONFLICTS=	linux[-_]dri-[0-9]* linux-f10-dri-[0-9]*
-. if ${OSVERSION} > 1000026
-EXTRA_PATCHES+=	${FILESDIR}/r246085-patch-src-nvidia_linux.c
-. endif
 PLIST_SUB+=	LINUX="@comment "
 # Propagate WITHOUT_LINUX variable down to inner Makefiles
@@ -109,24 +102,48 @@ IGNORE=		requires fairly recent FreeBSD-
 .if ${NVVERSION} < 1952200
+# ABI version is hardcoded inside the binary, so better be explicit here
 LIB_DEPENDS=	m.3:${PORTSDIR}/misc/compat5x
 post-patch: .SILENT
 # We should support -CURRENT: kill the check
 	${REINPLACE_CMD} -e '24,26d' ${WRKSRC}/src/nv-freebsd.h
-# Adjust legacy drivers for updated d_mmap() since early 9.X
+# Adjust legacy drivers for updated d_mmap() since FreeBSD src SVN r201223
 .if ${OSVERSION} > 900005 && ${NVVERSION} < 1952200
 	${REINPLACE_CMD} -e 's/vm_offset_t offset/vm_ooffset_t offset/ ; \
 		s/vm_offset_t \*address/vm_paddr_t *address/ ; \
 		s/int nprot/&, vm_memattr_t *memattr/' \
+# In the legacy drivers: remove paqe queue locking and add page locking
+# around vm_page_(un)wire() after FreeBSD src SVN r207410, r207617, and
+# r207644; also remove paqe queue locking around vm_page_wakeup() after
+# FreeBSD src SVN r163622
+.if ${OSVERSION} > 900011 && ${NVVERSION} < 3046400
+	${REINPLACE_CMD} -E '/vm_page_(un)?lock_queues\(\);/d ; \
+		s/(vm_page_(un)?wire\()([^,]+)(, 0)?(\);)/vm_page_lock(\3); & vm_page_unlock(\3);/' \
+			${WRKSRC}/src/nvidia_subr.c
 # Catch up legacy drivers with FreeBSD src SVN r225617
 .if ${OSVERSION} > 900043 && ${NVVERSION} < 1952200
 	${REINPLACE_CMD} -e '/return/s/ioctl/sys_&/' \
+# Adjust Linux headers #include's after FreeBSD src SVN r246085
+.if ${OSVERSION} > 1000027 && ${NVVERSION} >= 964323
+	${REINPLACE_CMD} -E '/#include "machine\/\.\.\/linux(32)?\/linux.h"/ \
+		{ x ; s/.*/#include "machine\/..\/..\/compat\/linux\/linux_ioctl.h"/ ; H ; x ; }' \
+			${WRKSRC}/src/nvidia_linux.c
+# Adjust vm_object locking after FreeBSD src SVN r248084
+.if ${OSVERSION} > 1000029
+	${REINPLACE_CMD} -e '/#include <vm\/vm_object.h>/ \
+		{ x ; s/.*/#include <sys\/rwlock.h>/ ; G ; }' \
+			${WRKSRC}/src/nv-freebsd.h
+	${REINPLACE_CMD} -E 's/(VM_OBJECT_)(UN)?(LOCK)/\1W\2\3/' \
+		${WRKSRC}/src/nvidia_subr.c
 # Process OPTIONS
 	${REINPLACE_CMD} -E 's/undef (NV_SUPPORT_OS_AGP)/define \1/' \
svn-ports-all@freebsd.org mailing list
To unsubscribe, send any mail to "svn-ports-all-unsubscribe@freebsd.org"
Comment 3 Alexey Dokuchaev freebsd_committer 2013-04-07 16:23:33 UTC
State Changed
From-To: open->closed

Committed with minor modifications, thanks a lot for a good submission!