Lines 71-80
Link Here
|
71 |
EXTRA_PATCHES= ${FILESDIR}/extra-patch-mk-nvidia.lib.mk |
71 |
EXTRA_PATCHES= ${FILESDIR}/extra-patch-mk-nvidia.lib.mk |
72 |
.endif |
72 |
.endif |
73 |
|
73 |
|
74 |
.if ${NVVERSION} >= 304.088 |
74 |
.if ${NVVERSION} >= 304.088 && ${NVVERSION} < 355.006 |
|
|
75 |
NVSRC="" |
75 |
EXTRA_PATCHES+= ${FILESDIR}/extra-patch-src-Makefile \ |
76 |
EXTRA_PATCHES+= ${FILESDIR}/extra-patch-src-Makefile \ |
76 |
${FILESDIR}/extra-patch-src-nv-freebsd.h \ |
77 |
${FILESDIR}/extra-patch-src-nv-freebsd.h \ |
77 |
${FILESDIR}/extra-patch-src-nv-misc.h |
78 |
${FILESDIR}/extra-patch-src-nv-misc.h |
|
|
79 |
.else |
80 |
NVSRC=nvidia |
81 |
EXTRA_PATCHES+= ${FILESDIR}/extra-patch-src-nvidia-Makefile \ |
82 |
${FILESDIR}/extra-patch-src-nvidia-nv-freebsd.h \ |
83 |
${FILESDIR}/extra-patch-src-nvidia-nv-misc.h |
78 |
.endif |
84 |
.endif |
79 |
|
85 |
|
80 |
.if ${NVVERSION} >= 304.125 # 331.020 |
86 |
.if ${NVVERSION} >= 304.125 # 331.020 |
Lines 134-146
Link Here
|
134 |
|
140 |
|
135 |
post-patch: .SILENT |
141 |
post-patch: .SILENT |
136 |
# We should support -CURRENT: kill the check |
142 |
# We should support -CURRENT: kill the check |
137 |
${REINPLACE_CMD} -e '24,26d' ${WRKSRC}/src/nv-freebsd.h |
143 |
${REINPLACE_CMD} -e '24,26d' ${WRKSRC}/src/${NVSRC}/nv-freebsd.h |
138 |
# Adjust legacy drivers for updated d_mmap() since FreeBSD src SVN r201223 |
144 |
# Adjust legacy drivers for updated d_mmap() since FreeBSD src SVN r201223 |
139 |
.if ${NVVERSION} < 195.022 |
145 |
.if ${NVVERSION} < 195.022 |
140 |
${REINPLACE_CMD} -e 's/vm_offset_t offset/vm_ooffset_t offset/ ; \ |
146 |
${REINPLACE_CMD} -e 's/vm_offset_t offset/vm_ooffset_t offset/ ; \ |
141 |
s/vm_offset_t \*address/vm_paddr_t *address/ ; \ |
147 |
s/vm_offset_t \*address/vm_paddr_t *address/ ; \ |
142 |
s/int nprot/&, vm_memattr_t *memattr/' \ |
148 |
s/int nprot/&, vm_memattr_t *memattr/' \ |
143 |
${WRKSRC}/src/nvidia_dev.c |
149 |
${WRKSRC}/src/${NVSRC}/nvidia_dev.c |
144 |
.endif |
150 |
.endif |
145 |
# In the legacy drivers: remove page queue locking and add page locking |
151 |
# In the legacy drivers: remove page queue locking and add page locking |
146 |
# around vm_page_(un)wire() after FreeBSD src SVN r207410, r207617, and |
152 |
# around vm_page_(un)wire() after FreeBSD src SVN r207410, r207617, and |
Lines 149-223
Link Here
|
149 |
.if ${NVVERSION} < 304.064 |
155 |
.if ${NVVERSION} < 304.064 |
150 |
${REINPLACE_CMD} -E '/vm_page_(un)?lock_queues\(\);/d ; \ |
156 |
${REINPLACE_CMD} -E '/vm_page_(un)?lock_queues\(\);/d ; \ |
151 |
s/(vm_page_(un)?wire\()([^,]+)(, 0)?(\);)/vm_page_lock(\3); & vm_page_unlock(\3);/' \ |
157 |
s/(vm_page_(un)?wire\()([^,]+)(, 0)?(\);)/vm_page_lock(\3); & vm_page_unlock(\3);/' \ |
152 |
${WRKSRC}/src/nvidia_subr.c |
158 |
${WRKSRC}/src/${NVSRC}/nvidia_subr.c |
153 |
.endif |
159 |
.endif |
154 |
# Catch up legacy drivers with FreeBSD src SVN r225617 |
160 |
# Catch up legacy drivers with FreeBSD src SVN r225617 |
155 |
.if ${NVVERSION} < 195.022 |
161 |
.if ${NVVERSION} < 195.022 |
156 |
${REINPLACE_CMD} -e '/return/s/ioctl/sys_&/' \ |
162 |
${REINPLACE_CMD} -e '/return/s/ioctl/sys_&/' \ |
157 |
${WRKSRC}/src/nvidia_linux.c |
163 |
${WRKSRC}/src/${NVSRC}/nvidia_linux.c |
158 |
.endif |
164 |
.endif |
159 |
# Adjust Linux headers #include's after FreeBSD src SVN r246085 |
165 |
# Adjust Linux headers #include's after FreeBSD src SVN r246085 |
160 |
.if ${OSVERSION} > 1000027 && ${NVVERSION} >= 96.04323 |
166 |
.if ${OSVERSION} > 1000027 && ${NVVERSION} >= 96.04323 |
161 |
${REINPLACE_CMD} -E '/#include "machine\/\.\.\/linux(32)?\/linux.h"/ \ |
167 |
${REINPLACE_CMD} -E '/#include "machine\/\.\.\/linux(32)?\/linux.h"/ \ |
162 |
{ x ; s/.*/#include "machine\/..\/..\/compat\/linux\/linux_ioctl.h"/ ; H ; x ; }' \ |
168 |
{ x ; s/.*/#include "machine\/..\/..\/compat\/linux\/linux_ioctl.h"/ ; H ; x ; }' \ |
163 |
${WRKSRC}/src/nvidia_linux.c |
169 |
${WRKSRC}/src/${NVSRC}/nvidia_linux.c |
164 |
.endif |
170 |
.endif |
165 |
# Adjust vm_object locking after FreeBSD src SVN r248084 |
171 |
# Adjust vm_object locking after FreeBSD src SVN r248084 |
166 |
.if ${OSVERSION} > 1000029 |
172 |
.if ${OSVERSION} > 1000029 |
167 |
${REINPLACE_CMD} -e '/#include <vm\/vm_object.h>/ \ |
173 |
${REINPLACE_CMD} -e '/#include <vm\/vm_object.h>/ \ |
168 |
{ x ; s/.*/#include <sys\/rwlock.h>/ ; G ; }' \ |
174 |
{ x ; s/.*/#include <sys\/rwlock.h>/ ; G ; }' \ |
169 |
${WRKSRC}/src/nv-freebsd.h |
175 |
${WRKSRC}/src/${NVSRC}/nv-freebsd.h |
170 |
${REINPLACE_CMD} -E 's/(VM_OBJECT_)(UN)?(LOCK)/\1W\2\3/' \ |
176 |
${REINPLACE_CMD} -E 's/(VM_OBJECT_)(UN)?(LOCK)/\1W\2\3/' \ |
171 |
${WRKSRC}/src/nvidia_subr.c |
177 |
${WRKSRC}/src/${NVSRC}/nvidia_subr.c |
172 |
.endif |
178 |
.endif |
173 |
# Adjust kmem(9) calls after FreeBSD src SVN r254025 |
179 |
# Adjust kmem(9) calls after FreeBSD src SVN r254025 |
174 |
.if ${OSVERSION} > 1000040 && ${NVVERSION} < 331.067 |
180 |
.if ${OSVERSION} > 1000040 && ${NVVERSION} < 331.067 |
175 |
${REINPLACE_CMD} -e '/kmem_/s/kernel_map/kernel_arena/' \ |
181 |
${REINPLACE_CMD} -e '/kmem_/s/kernel_map/kernel_arena/' \ |
176 |
${WRKSRC}/src/nvidia_subr.c |
182 |
${WRKSRC}/src/${NVSRC}/nvidia_subr.c |
177 |
.endif |
183 |
.endif |
178 |
# Argument count of vm_map_find() changed in FreeBSD src SVN r255426 |
184 |
# Argument count of vm_map_find() changed in FreeBSD src SVN r255426 |
179 |
.if ${OSVERSION} > 1000054 && ${NVVERSION} < 304.123 # < 331.067 |
185 |
.if ${OSVERSION} > 1000054 && ${NVVERSION} < 304.123 # < 331.067 |
180 |
${REINPLACE_CMD} -e 's/virtual_address, size,/& 0,/' \ |
186 |
${REINPLACE_CMD} -e 's/virtual_address, size,/& 0,/' \ |
181 |
${WRKSRC}/src/nvidia_subr.c |
187 |
${WRKSRC}/src/${NVSRC}/nvidia_subr.c |
182 |
.endif |
188 |
.endif |
183 |
# Fix CTLFLAG_* values for SYSCTL_ADD_PROC() after FreeBSD src SVN r273377 |
189 |
# Fix CTLFLAG_* values for SYSCTL_ADD_PROC() after FreeBSD src SVN r273377 |
184 |
.if ${OSVERSION} > 1100039 || ${OSVERSION} > 1001501 && ${OSVERSION} < 1100000 |
190 |
.if ${OSVERSION} > 1100039 || ${OSVERSION} > 1001501 && ${OSVERSION} < 1100000 |
185 |
${REINPLACE_CMD} -e '/SYSCTL_ADD_PROC/,/;/ \ |
191 |
${REINPLACE_CMD} -e '/SYSCTL_ADD_PROC/,/;/ \ |
186 |
s/^[[:blank:]]*CTLFLAG_RD/CTLTYPE_STRING |&/' \ |
192 |
s/^[[:blank:]]*CTLFLAG_RD/CTLTYPE_STRING |&/' \ |
187 |
${WRKSRC}/src/nvidia_sysctl.c |
193 |
${WRKSRC}/src/${NVSRC}/nvidia_sysctl.c |
188 |
.endif |
194 |
.endif |
189 |
# Replace d_thread_t (compat shim to support FreeBSD 4) with `struct thread' |
195 |
# Replace d_thread_t (compat shim to support FreeBSD 4) with `struct thread' |
190 |
${REINPLACE_CMD} -e 's/d_thread_t/struct thread/' \ |
196 |
${REINPLACE_CMD} -e 's/d_thread_t/struct thread/' \ |
191 |
${WRKSRC}/src/nvidia_ctl.c ${WRKSRC}/src/nvidia_dev.c \ |
197 |
${WRKSRC}/src/${NVSRC}/nvidia_ctl.c ${WRKSRC}/src/${NVSRC}/nvidia_dev.c \ |
192 |
${WRKSRC}/src/nvidia_linux.c |
198 |
${WRKSRC}/src/${NVSRC}/nvidia_linux.c |
193 |
# Fix stack buffer overflow in nvidia_sysctl_bus_type() |
199 |
# Fix stack buffer overflow in nvidia_sysctl_bus_type() |
194 |
${REINPLACE_CMD} -e 's/8 bus_type\[4\]/8 bus_type[8]/' \ |
200 |
${REINPLACE_CMD} -e 's/8 bus_type\[4\]/8 bus_type[8]/' \ |
195 |
${WRKSRC}/src/nvidia_sysctl.c |
201 |
${WRKSRC}/src/${NVSRC}/nvidia_sysctl.c |
196 |
# Unbreak the build of 173.14.xx legacy series on recent -CURRENT |
202 |
# Unbreak the build of 173.14.xx legacy series on recent -CURRENT |
197 |
.if ${NVVERSION} < 195.022 && ${NVVERSION} >= 169.004 |
203 |
.if ${NVVERSION} < 195.022 && ${NVVERSION} >= 169.004 |
198 |
${REINPLACE_CMD} -E 's/os_(alloc|free)_contig_pages/NV_API_CALL &/' \ |
204 |
${REINPLACE_CMD} -E 's/os_(alloc|free)_contig_pages/NV_API_CALL &/' \ |
199 |
${WRKSRC}/src/nv-freebsd.h |
205 |
${WRKSRC}/src/${NVSRC}/nv-freebsd.h |
200 |
.endif |
206 |
.endif |
201 |
# Process OPTIONS |
207 |
# Process OPTIONS |
202 |
.if ${PORT_OPTIONS:MFREEBSD_AGP} |
208 |
.if ${PORT_OPTIONS:MFREEBSD_AGP} |
203 |
${REINPLACE_CMD} -E 's/undef (NV_SUPPORT_OS_AGP)/define \1/' \ |
209 |
${REINPLACE_CMD} -E 's/undef (NV_SUPPORT_OS_AGP)/define \1/' \ |
204 |
${WRKSRC}/src/nv-freebsd.h |
210 |
${WRKSRC}/src/${NVSRC}/nv-freebsd.h |
205 |
.endif |
211 |
.endif |
206 |
.if ${PORT_OPTIONS:MACPI_PM} |
212 |
.if ${PORT_OPTIONS:MACPI_PM} |
207 |
${REINPLACE_CMD} -E 's/undef (NV_SUPPORT_ACPI_PM)/define \1/' \ |
213 |
${REINPLACE_CMD} -E 's/undef (NV_SUPPORT_ACPI_PM)/define \1/' \ |
208 |
${WRKSRC}/src/nv-freebsd.h |
214 |
${WRKSRC}/src/${NVSRC}/nv-freebsd.h |
209 |
.endif |
215 |
.endif |
210 |
.if ! ${PORT_OPTIONS:MLINUX} |
216 |
.if ! ${PORT_OPTIONS:MLINUX} |
211 |
${REINPLACE_CMD} -E 's/define (NV_SUPPORT_LINUX_COMPAT)/undef \1/' \ |
217 |
${REINPLACE_CMD} -E 's/define (NV_SUPPORT_LINUX_COMPAT)/undef \1/' \ |
212 |
${WRKSRC}/src/nv-freebsd.h |
218 |
${WRKSRC}/src/${NVSRC}/nv-freebsd.h |
213 |
.endif |
219 |
.endif |
214 |
.if ${PORT_OPTIONS:MPAE} |
220 |
.if ${PORT_OPTIONS:MPAE} |
215 |
${REINPLACE_CMD} -E 's/undef (NV_SUPPORT_PAE)/define \1/' \ |
221 |
${REINPLACE_CMD} -E 's/undef (NV_SUPPORT_PAE)/define \1/' \ |
216 |
${WRKSRC}/src/nv-freebsd.h |
222 |
${WRKSRC}/src/${NVSRC}/nv-freebsd.h |
217 |
.endif |
223 |
.endif |
218 |
.if ${PORT_OPTIONS:MWBINVD} |
224 |
.if ${PORT_OPTIONS:MWBINVD} |
219 |
${REINPLACE_CMD} -E 's/undef (NV_USE_WBINVD)/define \1/' \ |
225 |
${REINPLACE_CMD} -E 's/undef (NV_USE_WBINVD)/define \1/' \ |
220 |
${WRKSRC}/src/nv-freebsd.h |
226 |
${WRKSRC}/src/${NVSRC}/nv-freebsd.h |
221 |
.endif |
227 |
.endif |
222 |
${REINPLACE_CMD} -e 's/exists(\/.*/& \&\& !defined(WITHOUT_LINUX)/' \ |
228 |
${REINPLACE_CMD} -e 's/exists(\/.*/& \&\& !defined(WITHOUT_LINUX)/' \ |
223 |
${WRKSRC}/lib/Makefile |
229 |
${WRKSRC}/lib/Makefile |
Lines 268-273
Link Here
|
268 |
${WRKSRC}/lib/libGL/Makefile ${WRKSRC}/doc/Makefile |
274 |
${WRKSRC}/lib/libGL/Makefile ${WRKSRC}/doc/Makefile |
269 |
.endif |
275 |
.endif |
270 |
|
276 |
|
|
|
277 |
.if ${NVVERSION} >= 358.009 |
278 |
${REINPLACE_CMD} -e 's/d_thread_t/struct thread/g' \ |
279 |
${WRKSRC}/src/nvidia-modeset/nvidia-modeset-freebsd.c |
280 |
.endif |
281 |
|
271 |
pre-install: |
282 |
pre-install: |
272 |
@${MKDIR} ${STAGEDIR}${PREFIX}/${MODULESDIR}/drivers \ |
283 |
@${MKDIR} ${STAGEDIR}${PREFIX}/${MODULESDIR}/drivers \ |
273 |
${STAGEDIR}${PREFIX}/${MODULESDIR}/extensions |
284 |
${STAGEDIR}${PREFIX}/${MODULESDIR}/extensions |