Changeset View
Changeset View
Standalone View
Standalone View
head/x11/nvidia-driver/Makefile
# Created by: Stijn Hoop <stijn@win.tue.nl> | # Created by: Stijn Hoop <stijn@win.tue.nl> | ||||
# $FreeBSD$ | # $FreeBSD$ | ||||
# | # | ||||
# For those wondering why this port is not under `x11-drivers' category, | # For those wondering why this port is not under `x11-drivers' category, | ||||
# have a look at https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=121930. | # have a look at https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=121930. | ||||
# | # | ||||
# Starting with version 1.0-7667, NVidia has dropped support for numerous | # Starting with version 1.0-7667, NVidia has dropped support for numerous | ||||
# "legacy" GPUs. Consult NVidia README (the Appendix) to find out whether | # "legacy" GPUs. Consult NVidia README (the Appendix) to find out whether | ||||
# you need to use legacy driver version and install one of corresponding | # you need to use legacy driver version and install one of corresponding | ||||
# slave ports instead (`x11/nvidia-driver-340' or `x11/nvidia-driver-304'). | # slave ports instead (`x11/nvidia-driver-340' or `x11/nvidia-driver-304'). | ||||
PORTNAME= nvidia-driver | PORTNAME= nvidia-driver | ||||
DISTVERSION?= 375.26 | DISTVERSION?= 375.26 | ||||
# Always try to set PORTREVISION as it can be overridden by the slave ports | # Always try to set PORTREVISION as it can be overridden by the slave ports | ||||
PORTREVISION?= 0 | PORTREVISION?= 1 | ||||
CATEGORIES= x11 | CATEGORIES= x11 | ||||
MASTER_SITES= NVIDIA/XFree86/FreeBSD-${ARCH_SUFX}/${DISTVERSION} | MASTER_SITES= NVIDIA/XFree86/FreeBSD-${ARCH_SUFX}/${DISTVERSION} | ||||
DISTNAME= NVIDIA-FreeBSD-${ARCH_SUFX}-${DISTVERSION} | DISTNAME= NVIDIA-FreeBSD-${ARCH_SUFX}-${DISTVERSION} | ||||
MAINTAINER= danfe@FreeBSD.org | MAINTAINER= danfe@FreeBSD.org | ||||
COMMENT= NVidia graphics card binary drivers for hardware OpenGL rendering | COMMENT= NVidia graphics card binary drivers for hardware OpenGL rendering | ||||
LICENSE= NVIDIA | LICENSE= NVIDIA | ||||
Show All 11 Lines | |||||
# NVIDIA_ROOT is not set in src/Makefile, which results in bogus -I/src | # NVIDIA_ROOT is not set in src/Makefile, which results in bogus -I/src | ||||
# passed to compiler and broken build on HEAD since r221320 when option | # passed to compiler and broken build on HEAD since r221320 when option | ||||
# -Wmissing-include-dirs was added for kernel sources. Until properly | # -Wmissing-include-dirs was added for kernel sources. Until properly | ||||
# fixed upstream (across all versions, including legacy ones), use this | # fixed upstream (across all versions, including legacy ones), use this | ||||
# hack below to universally set NVIDIA_ROOT. Also provide X11BASE value | # hack below to universally set NVIDIA_ROOT. Also provide X11BASE value | ||||
# since it is still used by legacy drivers. | # since it is still used by legacy drivers. | ||||
MAKE_ENV= NVIDIA_ROOT=${WRKSRC} X11BASE=${LOCALBASE} | MAKE_ENV= NVIDIA_ROOT=${WRKSRC} X11BASE=${LOCALBASE} | ||||
SUB_FILES= pkg-deinstall pkg-install pkg-message | SUB_FILES= pkg-deinstall pkg-install pkg-message nvidia.conf | ||||
DOCSDIR= ${PREFIX}/share/doc/NVIDIA_GLX-1.0 | DOCSDIR= ${PREFIX}/share/doc/NVIDIA_GLX-1.0 | ||||
MODULESDIR= lib/xorg/modules | MODULESDIR= lib/xorg/modules | ||||
PORTDOCS= * | PORTDOCS= * | ||||
# NVVERSION is float since r372065 (integer values become less readable | # NVVERSION is float since r372065 (integer values become less readable | ||||
# after minor version could occupy three digits) | # after minor version could occupy three digits) | ||||
.if ${DISTVERSION:C/[0-9]+//g} == ".." # major.minor.update | .if ${DISTVERSION:C/[0-9]+//g} == ".." # major.minor.update | ||||
NVVERSION= ${DISTVERSION:S/./.0/:R}${DISTVERSION:E} | NVVERSION= ${DISTVERSION:S/./.0/:R}${DISTVERSION:E} | ||||
.else # major.minor | .else # major.minor | ||||
. if ${DISTVERSION:E} < 100 | . if ${DISTVERSION:E} < 100 | ||||
NVVERSION= ${DISTVERSION:S/./.0/} # allow minor > 99 | NVVERSION= ${DISTVERSION:S/./.0/} # allow minor > 99 | ||||
. else | . else | ||||
NVVERSION= ${DISTVERSION} | NVVERSION= ${DISTVERSION} | ||||
. endif | . endif | ||||
.endif | .endif | ||||
.if ${NVVERSION} >= 331.013 | |||||
SUB_LIST= NVGL="" | |||||
.else | |||||
SUB_LIST= NVGL="# " | |||||
.endif | |||||
.if ${NVVERSION} < 355.006 | .if ${NVVERSION} < 355.006 | ||||
EXTRA_PATCHES= ${FILESDIR}/extra-patch-src-Makefile \ | EXTRA_PATCHES= ${FILESDIR}/extra-patch-src-Makefile \ | ||||
${FILESDIR}/extra-patch-src-nv-freebsd.h \ | ${FILESDIR}/extra-patch-src-nv-freebsd.h \ | ||||
${FILESDIR}/extra-patch-src-nv-misc.h | ${FILESDIR}/extra-patch-src-nv-misc.h | ||||
NVSRC= . | NVSRC= . | ||||
.else | .else | ||||
EXTRA_PATCHES= ${FILESDIR}/extra-patch-src_nvidia_Makefile \ | EXTRA_PATCHES= ${FILESDIR}/extra-patch-src_nvidia_Makefile \ | ||||
${FILESDIR}/extra-patch-src_nvidia_nv-freebsd.h \ | ${FILESDIR}/extra-patch-src_nvidia_nv-freebsd.h \ | ||||
▲ Show 20 Lines • Show All 93 Lines • ▼ Show 20 Lines | |||||
# Do not build any binaries (native nvidia-settings and nvidia-xconfig are | # Do not build any binaries (native nvidia-settings and nvidia-xconfig are | ||||
# provided by corresponding ports) and manual pages | # provided by corresponding ports) and manual pages | ||||
${REINPLACE_CMD} -E 's/(extension).*/\1/' ${WRKSRC}/x11/Makefile | ${REINPLACE_CMD} -E 's/(extension).*/\1/' ${WRKSRC}/x11/Makefile | ||||
${REINPLACE_CMD} -e '/bin/d ; /man/d' ${WRKSRC}/x11/Makefile | ${REINPLACE_CMD} -e '/bin/d ; /man/d' ${WRKSRC}/x11/Makefile | ||||
# Also do not install libnvidia-gtk* libraries which are for nvidia-settings | # Also do not install libnvidia-gtk* libraries which are for nvidia-settings | ||||
.if ${NVVERSION} >= 346.016 | .if ${NVVERSION} >= 346.016 | ||||
${REINPLACE_CMD} -e '/libnvidia-gtk/d' ${WRKSRC}/lib/Makefile | ${REINPLACE_CMD} -e '/libnvidia-gtk/d' ${WRKSRC}/lib/Makefile | ||||
.endif | .endif | ||||
# Adjust installation paths of some conflicting files (shared also between | # Adjust installation path of a conflicting file (shared between | ||||
# libGL, libEGL, libGLESv2, and xorg-server) to ease package manager work | # nvidia-driver and xorg-server) to ease package manager work | ||||
${REINPLACE_CMD} -e '/LIBDIR/s:xorg/modules/extensions:&/.nvidia:' \ | ${REINPLACE_CMD} -e '/LIBDIR/s:xorg/modules/extensions:&/.nvidia:' \ | ||||
${WRKSRC}/x11/extension/Makefile | ${WRKSRC}/x11/extension/Makefile | ||||
${REINPLACE_CMD} -e '/LIBDIR/s:lib:&/.nvidia:' \ | |||||
${WRKSRC}/lib/libGL/Makefile | |||||
.if ${NVVERSION} >= 331.013 | |||||
${REINPLACE_CMD} -e '/LIBDIR/s:lib:&/.nvidia:' \ | |||||
${WRKSRC}/lib/libEGL/Makefile \ | |||||
${WRKSRC}/lib/libGLESv2/Makefile | |||||
.endif | |||||
# Do not execute afterinstall target (prevent automatic module registration | # Do not execute afterinstall target (prevent automatic module registration | ||||
# and "smart" installation of conflicting files heuristics) | # and "smart" installation of conflicting files heuristics) | ||||
${REINPLACE_CMD} -e 's/afterinstall/&_dontexecute/' ${WRKSRC}/Makefile | ${REINPLACE_CMD} -e 's/afterinstall/&_dontexecute/' ${WRKSRC}/Makefile | ||||
${REINPLACE_CMD} -e 's/beforeinstall/&_dontexecute/' \ | ${REINPLACE_CMD} -e 's/beforeinstall/&_dontexecute/' \ | ||||
${WRKSRC}/lib/Makefile ${WRKSRC}/src/${NVSRC}/Makefile | ${WRKSRC}/lib/Makefile ${WRKSRC}/src/${NVSRC}/Makefile | ||||
# /usr/share/nvidia path is hardcoded in libGL and nvidia-settings, but we | # /usr/share/nvidia path is hardcoded in libGL and nvidia-settings, but we | ||||
# won't adhere to this stupidity and install nvidia-application-profiles-* | # won't adhere to this stupidity and install nvidia-application-profiles-* | ||||
# files as part of documentation | # files as part of documentation | ||||
▲ Show 20 Lines • Show All 71 Lines • ▼ Show 20 Lines | |||||
.endif | .endif | ||||
.if ${NVVERSION} >= 361.028 | .if ${NVVERSION} >= 361.028 | ||||
${REINPLACE_CMD} -E '/(EGL_nvidia\.so|GLESv[12](_CM)?(\.so\.[0-9]+\.[0-9]+))$$/d' \ | ${REINPLACE_CMD} -E '/(EGL_nvidia\.so|GLESv[12](_CM)?(\.so\.[0-9]+\.[0-9]+))$$/d' \ | ||||
${TMPPLIST} | ${TMPPLIST} | ||||
.else | .else | ||||
${REINPLACE_CMD} -E '/\/lib\/libGLESv[12](_CM)?(\.so)?(_nvidia.so(\.[0-9]|\.[0-9]+\.[0-9]+)?)?$$/d ; \ | ${REINPLACE_CMD} -E '/\/lib\/libGLESv[12](_CM)?(\.so)?(_nvidia.so(\.[0-9]|\.[0-9]+\.[0-9]+)?)?$$/d ; \ | ||||
/libEGL_nvidia\.so\.${PORTVERSION}/d' ${TMPPLIST} | /libEGL_nvidia\.so\.${PORTVERSION}/d' ${TMPPLIST} | ||||
.endif | .endif | ||||
# rename libGL.so, libEGL.so and libGLESv2.so | |||||
${MV} -f ${STAGEDIR}${PREFIX}/lib/libGL.so \ | |||||
${STAGEDIR}${PREFIX}/lib/libGL-NVIDIA.so | |||||
${MV} -f ${STAGEDIR}${PREFIX}/lib/libGL.so.1 \ | |||||
${STAGEDIR}${PREFIX}/lib/libGL-NVIDIA.so.1 | |||||
.if ${NVVERSION} >= 331.013 | |||||
${MV} -f ${STAGEDIR}${PREFIX}/lib/libEGL.so \ | |||||
${STAGEDIR}${PREFIX}/lib/libEGL-NVIDIA.so | |||||
${MV} -f ${STAGEDIR}${PREFIX}/lib/libEGL.so.1 \ | |||||
${STAGEDIR}${PREFIX}/lib/libEGL-NVIDIA.so.1 | |||||
${MV} -f ${STAGEDIR}${PREFIX}/lib/libGLESv2.so \ | |||||
${STAGEDIR}${PREFIX}/lib/libGLESv2-NVIDIA.so | |||||
${MV} -f ${STAGEDIR}${PREFIX}/lib/libGLESv2.so.2 \ | |||||
${STAGEDIR}${PREFIX}/lib/libGLESv2-NVIDIA.so.2 | |||||
.endif | |||||
@${MKDIR} ${STAGEDIR}${PREFIX}/etc/libmap.d/ | |||||
${INSTALL_DATA} ${WRKDIR}/nvidia.conf \ | |||||
${STAGEDIR}${PREFIX}/etc/libmap.d/ | |||||
# Target below can be used instead of standard `makesum' to correctly | # Target below can be used instead of standard `makesum' to correctly | ||||
# update distinfo (i.e., keeping other driver version entries intact) | # update distinfo (i.e., keeping other driver version entries intact) | ||||
.if ${.TARGETS:Mupdate-distinfo} | .if ${.TARGETS:Mupdate-distinfo} | ||||
DISTINFO_FILE= ${MASTERDIR}/distinfo.new | DISTINFO_FILE= ${MASTERDIR}/distinfo.new | ||||
.endif | .endif | ||||
update-distinfo: makesum .SILENT | update-distinfo: makesum .SILENT | ||||
${REINPLACE_CMD} -e '/${ARCH_SUFX}-${NVVERSION:R}/s/^/~/' \ | ${REINPLACE_CMD} -e '/${ARCH_SUFX}-${NVVERSION:R}/s/^/~/' \ | ||||
${MASTERDIR}/distinfo | ${MASTERDIR}/distinfo | ||||
${REINPLACE_CMD} -e '/^~SHA256/r ${DISTINFO_FILE}' -e '/^~/d' \ | ${REINPLACE_CMD} -e '/^~SHA256/r ${DISTINFO_FILE}' -e '/^~/d' \ | ||||
${MASTERDIR}/distinfo | ${MASTERDIR}/distinfo | ||||
${RM} ${DISTINFO_FILE} ${MASTERDIR}/distinfo.bak | ${RM} ${DISTINFO_FILE} ${MASTERDIR}/distinfo.bak | ||||
.include <bsd.port.mk> | .include <bsd.port.mk> |