Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 17 Jun 2021 04:26:04 GMT
From:      Kevin Bowling <kbowling@FreeBSD.org>
To:        ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org
Subject:   git: b44acc9409bd - main - graphics/mesa-libs: enable libglvnd support
Message-ID:  <202106170426.15H4Q4kS068821@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by kbowling:

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

commit b44acc9409bd3bdd92e86e35c06d50e2134b02f2
Author:     Jan Beich <jbeich@FreeBSD.org>
AuthorDate: 2021-06-16 15:48:02 +0000
Commit:     Kevin Bowling <kbowling@FreeBSD.org>
CommitDate: 2021-06-17 04:25:27 +0000

    graphics/mesa-libs: enable libglvnd support
    
    PR:             246767
    Reviewed by:    kbowling
    Tested by:      kbowling
    Differential Revision:  https://reviews.freebsd.org/D25020
---
 Mk/Uses/gl.mk                      | 10 ++---
 Mk/bsd.default-versions.mk         |  4 +-
 graphics/glad/Makefile             |  2 +-
 graphics/libglvnd/Makefile         |  4 +-
 graphics/mesa-devel/Makefile       |  1 +
 graphics/mesa-libs/Makefile        |  9 ++++-
 graphics/mesa-libs/pkg-plist       | 76 +++++++++++++++++++-------------------
 misc/raspberrypi-userland/Makefile |  2 +-
 x11/nvidia-driver/Makefile         | 30 +++++++++------
 x11/nvidia-driver/pkg-plist        |  6 +--
 10 files changed, 81 insertions(+), 63 deletions(-)

diff --git a/Mk/Uses/gl.mk b/Mk/Uses/gl.mk
index eb8850774b29..7d71d9724d92 100644
--- a/Mk/Uses/gl.mk
+++ b/Mk/Uses/gl.mk
@@ -13,12 +13,12 @@
 .if !defined(_INCLUDE_USES_GL_MK)
 _INCLUDE_USES_GL_MK=yes
 
-_GL_egl_LIB_DEPENDS=		libEGL.so:graphics/mesa-libs
-_GL_gbm_LIB_DEPENDS=		libgbm.so:graphics/mesa-libs
-_GL_gl_LIB_DEPENDS=		libGL.so:graphics/mesa-libs
+_GL_egl_LIB_DEPENDS=		libEGL.so:graphics/${GL_DEFAULT:S/,/ /g:[1]}
+_GL_gbm_LIB_DEPENDS=		libgbm.so:graphics/${GL_DEFAULT:S/,/ /g:[-1]}
+_GL_gl_LIB_DEPENDS=		libGL.so:graphics/${GL_DEFAULT:S/,/ /g:[1]}
 _GL_gl_USE_XORG=		xorgproto
-_GL_glesv1_LIB_DEPENDS=		libGLESv1_CM.so:graphics/mesa-libs
-_GL_glesv2_LIB_DEPENDS=		libGLESv2.so:graphics/mesa-libs
+_GL_glesv1_LIB_DEPENDS=		libGLESv1_CM.so:graphics/${GL_DEFAULT:S/,/ /g:[1]}
+_GL_glesv2_LIB_DEPENDS=		libGLESv2.so:graphics/${GL_DEFAULT:S/,/ /g:[1]}
 _GL_glew_LIB_DEPENDS=		libGLEW.so:graphics/glew
 _GL_glu_LIB_DEPENDS=		libGLU.so:graphics/libGLU
 _GL_glu_USE_XORG=		xorgproto
diff --git a/Mk/bsd.default-versions.mk b/Mk/bsd.default-versions.mk
index f923ca84ff36..a3b836ea2fee 100644
--- a/Mk/bsd.default-versions.mk
+++ b/Mk/bsd.default-versions.mk
@@ -17,7 +17,7 @@ _INCLUDE_BSD_DEFAULT_VERSIONS_MK=	yes
 
 LOCALBASE?=	/usr/local
 
-.for lang in APACHE BDB COROSYNC EMACS FIREBIRD FORTRAN FPC GCC GHOSTSCRIPT \
+.for lang in APACHE BDB COROSYNC EMACS FIREBIRD FORTRAN FPC GCC GHOSTSCRIPT GL \
 	IMAGEMAGICK JAVA LAZARUS LIBRSVG2 LINUX LLVM LUA MYSQL NINJA PERL5 \
 	PGSQL PHP PYTHON PYTHON2 PYTHON3 RUBY RUST SAMBA SSL TCLTK VARNISH
 .if defined(${lang}_DEFAULT)
@@ -51,6 +51,8 @@ GCC_DEFAULT?=		8
 .else
 GCC_DEFAULT?=		10
 .endif
+# Possible values (tuple): libglvnd, mesa-libs, mesa-devel
+GL_DEFAULT?=		libglvnd,mesa-libs
 # Possible values: 7, 8, 9, agpl
 GHOSTSCRIPT_DEFAULT?=	agpl
 # Possible values: 6, 6-nox11, 7, 7-nox11
diff --git a/graphics/glad/Makefile b/graphics/glad/Makefile
index df7f0cb77d73..e1508f82da6e 100644
--- a/graphics/glad/Makefile
+++ b/graphics/glad/Makefile
@@ -16,6 +16,6 @@ USE_LDCONFIG=	yes
 
 CMAKE_ON=	GLAD_INSTALL BUILD_SHARED_LIBS GLAD_REPRODUCIBLE
 
-CONFLICTS_INSTALL=	mesa-libs # include/KHR/khrplatform.h, see https://github.com/Dav1dde/glad/issues/260
+CONFLICTS_INSTALL=	libglvnd # include/KHR/khrplatform.h, see https://github.com/Dav1dde/glad/issues/260
 
 .include <bsd.port.mk>
diff --git a/graphics/libglvnd/Makefile b/graphics/libglvnd/Makefile
index f0f2e55f8c1d..c8babe24ac12 100644
--- a/graphics/libglvnd/Makefile
+++ b/graphics/libglvnd/Makefile
@@ -2,14 +2,12 @@ PORTNAME=	libglvnd
 DISTVERSION=	1.3.2
 CATEGORIES=	graphics
 
-MAINTAINER=	greg@unrelenting.technology
+MAINTAINER=	x11@FreeBSD.org
 COMMENT=	GL Vendor-Neutral Dispatch library
 
 LICENSE=	APACHE20 MIT
 LICENSE_COMB=	multi
 
-CONFLICTS_INSTALL=	mesa-libs # include/GL/gl.h
-
 USES=		localbase meson pkgconfig
 USE_LDCONFIG=	yes
 
diff --git a/graphics/mesa-devel/Makefile b/graphics/mesa-devel/Makefile
index 55792878a42d..07eec60ddd30 100644
--- a/graphics/mesa-devel/Makefile
+++ b/graphics/mesa-devel/Makefile
@@ -1,6 +1,7 @@
 PORTNAME=	mesa
 DISTVERSION=	21.1-branchpoint-3077
 DISTVERSIONSUFFIX=	-geb272f65715
+PORTREVISION=	1
 CATEGORIES=	graphics
 PKGNAMESUFFIX=	-devel
 
diff --git a/graphics/mesa-libs/Makefile b/graphics/mesa-libs/Makefile
index 02155a2ace99..5ebe41c1078e 100644
--- a/graphics/mesa-libs/Makefile
+++ b/graphics/mesa-libs/Makefile
@@ -2,11 +2,12 @@
 
 PORTNAME=	mesa-libs
 PORTVERSION=	${MESAVERSION}
+PORTREVISION=	1
 CATEGORIES=	graphics
 
 COMMENT=	OpenGL libraries that support GLX and EGL clients
 
-CONFLICTS_INSTALL=	libglvnd # include/GL/gl.h
+BUILD_DEPENDS=	libglvnd>0:graphics/libglvnd
 
 OPTIONS_GROUP=			PLATFORM
 OPTIONS_GROUP_PLATFORM=		PLATFORM_X11 PLATFORM_WAYLAND
@@ -43,6 +44,7 @@ MESON_ARGS+=	-Dgallium-drivers="" \
 		-Degl=enabled \
 		-Dgbm=enabled \
 		-Dvulkan-drivers="" \
+		-Dglvnd=true \
 		-Dprefer-iris=true
 # Building EGL and GBM requires a dri driver so add swrast
 MESON_ARGS+=	-Ddri-drivers="swrast"
@@ -72,4 +74,9 @@ USE_GCC=	yes
 
 .include "${MASTERDIR}/Makefile.targets"
 
+post-install:
+# Fallback if GLX_EXT_libglvnd is missing or vendor library doesn't exist
+	@${ECHO_CMD} "libGLX_indirect.so.0 libGLX_mesa.so.0" \
+		>${STAGEDIR}${PREFIX}/etc/libmap.d/mesa.conf
+
 .include <bsd.port.post.mk>
diff --git a/graphics/mesa-libs/pkg-plist b/graphics/mesa-libs/pkg-plist
index 04dcaa4f87a5..4f4924cfd8b1 100644
--- a/graphics/mesa-libs/pkg-plist
+++ b/graphics/mesa-libs/pkg-plist
@@ -1,41 +1,42 @@
-include/EGL/egl.h
-include/EGL/eglext.h
+etc/libmap.d/mesa.conf
+@comment include/EGL/egl.h
+@comment include/EGL/eglext.h
 include/EGL/eglextchromium.h
 include/EGL/eglmesaext.h
-include/EGL/eglplatform.h
-include/GL/gl.h
-include/GL/glcorearb.h
-include/GL/glext.h
-%%GLX%%include/GL/glx.h
-%%GLX%%include/GL/glxext.h
+@comment include/EGL/eglplatform.h
+@comment include/GL/gl.h
+@comment include/GL/glcorearb.h
+@comment include/GL/glext.h
+%%GLX%%@comment include/GL/glx.h
+%%GLX%%@comment include/GL/glxext.h
 @comment include/GL/internal/dri_interface.h
-include/GLES/egl.h
-include/GLES/gl.h
-include/GLES/glext.h
-include/GLES/glplatform.h
-include/GLES2/gl2.h
-include/GLES2/gl2ext.h
-include/GLES2/gl2platform.h
-include/GLES3/gl3.h
-include/GLES3/gl31.h
-include/GLES3/gl32.h
-include/GLES3/gl3ext.h
-include/GLES3/gl3platform.h
-include/KHR/khrplatform.h
+@comment include/GLES/egl.h
+@comment include/GLES/gl.h
+@comment include/GLES/glext.h
+@comment include/GLES/glplatform.h
+@comment include/GLES2/gl2.h
+@comment include/GLES2/gl2ext.h
+@comment include/GLES2/gl2platform.h
+@comment include/GLES3/gl3.h
+@comment include/GLES3/gl31.h
+@comment include/GLES3/gl32.h
+@comment include/GLES3/gl3ext.h
+@comment include/GLES3/gl3platform.h
+@comment include/KHR/khrplatform.h
 include/gbm.h
 @comment lib/dri/swrast_dri.so
-lib/libEGL.so
-lib/libEGL.so.1
-lib/libEGL.so.1.0.0
-%%GLX%%lib/libGL.so
-%%GLX%%lib/libGL.so.1
-%%GLX%%lib/libGL.so.1.2.0
-lib/libGLESv1_CM.so
-lib/libGLESv1_CM.so.1
-lib/libGLESv1_CM.so.1.1.0
-lib/libGLESv2.so
-lib/libGLESv2.so.2
-lib/libGLESv2.so.2.0.0
+lib/libEGL_mesa.so
+lib/libEGL_mesa.so.0
+lib/libEGL_mesa.so.0.0.0
+@comment lib/libGLESv1_CM.so
+@comment lib/libGLESv1_CM.so.1
+@comment lib/libGLESv1_CM.so.1.1.0
+@comment lib/libGLESv2.so
+@comment lib/libGLESv2.so.2
+@comment lib/libGLESv2.so.2.0.0
+%%GLX%%lib/libGLX_mesa.so
+%%GLX%%lib/libGLX_mesa.so.0
+%%GLX%%lib/libGLX_mesa.so.0.0.0
 lib/libgbm.so
 lib/libgbm.so.1
 lib/libgbm.so.1.0.0
@@ -43,9 +44,10 @@ lib/libglapi.so
 lib/libglapi.so.0
 lib/libglapi.so.0.0.0
 @comment libdata/pkgconfig/dri.pc
-libdata/pkgconfig/egl.pc
+@comment libdata/pkgconfig/egl.pc
 libdata/pkgconfig/gbm.pc
-%%GLX%%libdata/pkgconfig/gl.pc
-libdata/pkgconfig/glesv1_cm.pc
-libdata/pkgconfig/glesv2.pc
+%%GLX%%@comment libdata/pkgconfig/gl.pc
+@comment libdata/pkgconfig/glesv1_cm.pc
+@comment libdata/pkgconfig/glesv2.pc
 @comment share/drirc.d/00-mesa-defaults.conf
+share/glvnd/egl_vendor.d/50_mesa.json
diff --git a/misc/raspberrypi-userland/Makefile b/misc/raspberrypi-userland/Makefile
index 5dfa743da18c..42fad99b9736 100644
--- a/misc/raspberrypi-userland/Makefile
+++ b/misc/raspberrypi-userland/Makefile
@@ -11,7 +11,7 @@ LICENSE=	BSD3CLAUSE
 
 ONLY_FOR_ARCHS=	armv6 armv7
 
-CONFLICTS_INSTALL=	mesa-libs
+CONFLICTS_INSTALL=	libglvnd
 
 USES=		cmake pkgconfig shebangfix
 
diff --git a/x11/nvidia-driver/Makefile b/x11/nvidia-driver/Makefile
index daa727149404..23efd76bbbda 100644
--- a/x11/nvidia-driver/Makefile
+++ b/x11/nvidia-driver/Makefile
@@ -16,7 +16,7 @@
 PORTNAME?=	nvidia-driver
 DISTVERSION?=	460.80
 # Always try to set PORTREVISION as it can be overridden by the slave ports
-PORTREVISION?=	0
+PORTREVISION?=	1
 CATEGORIES=	x11
 MASTER_SITES=	NVIDIA/XFree86/FreeBSD-${ARCH_SUFX}/${DISTVERSION}
 DISTNAME=	NVIDIA-FreeBSD-${ARCH_SUFX}-${DISTVERSION}
@@ -32,6 +32,7 @@ LICENSE_FILE=	${WRKSRC}/doc/license.txt
 # obj/libEGL_nvidia.so.0 (see below)
 .if ${NVVERSION} >= 410.057
 PATCH_DEPENDS=	gsed:textproc/gsed
+BUILD_DEPENDS=	pkg-config:devel/pkgconf libglvnd>0:graphics/libglvnd
 .endif
 
 USES=		kmod uidfix xorg
@@ -281,6 +282,7 @@ post-install: .SILENT
 .elif ${NVVERSION} < 465.01901
 	${REINPLACE_CMD} -e '/lib32\/libnvidia-glvkspirv\.so/d' ${TMPPLIST}
 .endif
+.if ${NVVERSION} < 410.057
 # Rename some libraries and install a libmap file to resolve conflict with
 # Mesa libraries.
 	${LN} -sf libGL-NVIDIA.so.1 \
@@ -288,7 +290,7 @@ post-install: .SILENT
 	${MV} -f ${STAGEDIR}${PREFIX}/lib/libGL.so.1 \
 		${STAGEDIR}${PREFIX}/lib/libGL-NVIDIA.so.1
 	${RM} ${STAGEDIR}${PREFIX}/lib/libGL.so
-.if ${NVVERSION} >= 331.013
+.  if ${NVVERSION} >= 331.013
 	${LN} -sf libEGL-NVIDIA.so.1 \
 		${STAGEDIR}${PREFIX}/lib/libEGL-NVIDIA.so
 	${MV} -f ${STAGEDIR}${PREFIX}/lib/libEGL.so.1 \
@@ -301,14 +303,14 @@ post-install: .SILENT
 	${MV} -f ${STAGEDIR}${PREFIX}/lib/libGLESv2.so.2 \
 		${STAGEDIR}${PREFIX}/lib/libGLESv2-NVIDIA.so.2
 	${RM} ${STAGEDIR}${PREFIX}/lib/libGLESv2.so
-.endif
-# Configuration of Nvidia as secondary GPU requires preserving Mesa libraries
-# as default implementation; a libmap must not override in this case.
-.if !defined(LIBGLDIR)
+.  endif
+# Configuration of Nvidia as secondary GPU requires preserving libglvnd or mesa
+# libraries as default implementation; a libmap must not override in this case.
+.  if !defined(LIBGLDIR)
 	@${MKDIR} ${STAGEDIR}${PREFIX}/etc/libmap.d/
 	${INSTALL_DATA} ${WRKDIR}/nvidia.conf \
 		${STAGEDIR}${PREFIX}/etc/libmap.d/
-.else
+.  else
 # libgl proxies require a library path containing unrenamed lib*GL*.so
 	${MKDIR} ${STAGEDIR}${PREFIX}/${LIBGLDIR}
 	${RLN} ${STAGEDIR}${PREFIX}/lib/libGL-NVIDIA.so.1 \
@@ -317,17 +319,23 @@ post-install: .SILENT
 		${STAGEDIR}${PREFIX}/${LIBGLDIR}/libEGL.so.1
 	${RLN} ${STAGEDIR}${PREFIX}/lib/libGLESv2-NVIDIA.so.2 \
 		${STAGEDIR}${PREFIX}/${LIBGLDIR}/libGLESv2.so.2
-.endif
+.  endif
 # Configuration of Nvidia as secondary GPU requires preserving xorg-server's
 # libglx.so and moving Nvidia's glx to where it can be found by a secondary
 # Xorg instance.
 # Not needed since 410.057: Nvidia driver finds libglxserver_nvidia.so instead.
-.if ${NVVERSION} < 410.057
-.if ${EXTENSIONSDIR} != ${MODULESDIR}/extensions/.nvidia
+.  if ${EXTENSIONSDIR} != ${MODULESDIR}/extensions/.nvidia
 	${MKDIR} ${STAGEDIR}${PREFIX}/${EXTENSIONSDIR}
 	${MV} ${STAGEDIR}${PREFIX}/${MODULESDIR}/extensions/.nvidia/* \
 		${STAGEDIR}${PREFIX}/${EXTENSIONSDIR}/
-.endif
+.  endif
+.else
+	${REINPLACE_CMD} -E '/-NVIDIA/d ; \
+		/lib(Open)?E?GLX?(ESv[12](_CM)?|dispatch)?\.so/d' \
+		${TMPPLIST}
+# Override mesa.conf if GLX_EXT_libglvnd is missing
+	@${ECHO_CMD} "libGLX_indirect.so.0 libGLX_nvidia.so.0" \
+		>${STAGEDIR}${PREFIX}/etc/libmap.d/nvidia.conf
 .endif
 
 .include <bsd.port.post.mk>
diff --git a/x11/nvidia-driver/pkg-plist b/x11/nvidia-driver/pkg-plist
index 85156cdb6eff..caa1dc84ae52 100644
--- a/x11/nvidia-driver/pkg-plist
+++ b/x11/nvidia-driver/pkg-plist
@@ -17,9 +17,9 @@ lib/libGLESv2-NVIDIA.so
 lib/libGLESv2-NVIDIA.so.2
 lib/libGLESv2_nvidia.so
 lib/libGLESv2_nvidia.so.2
-lib/libGLX.so
-lib/libGLX.so.0
-lib/libGLX_indirect.so.0
+%%LIBGLDIR%%/libGLX.so
+%%LIBGLDIR%%/libGLX.so.0
+@comment lib/libGLX_indirect.so.0
 lib/libGLX_nvidia.so
 lib/libGLX_nvidia.so.0
 lib/libGLdispatch.so



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202106170426.15H4Q4kS068821>