graphics/mesa-libs: enable libglvnd support

PR:		246767
Reviewed by:	kbowling
Tested by:	kbowling
Differential Revision:	https://reviews.freebsd.org/D25020
This commit is contained in:
Jan Beich 2021-06-16 08:48:02 -07:00 committed by Kevin Bowling
parent 68e805c64e
commit b44acc9409
10 changed files with 81 additions and 63 deletions

View File

@ -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

View File

@ -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

View File

@ -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>

View File

@ -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

View File

@ -1,6 +1,7 @@
PORTNAME= mesa
DISTVERSION= 21.1-branchpoint-3077
DISTVERSIONSUFFIX= -geb272f65715
PORTREVISION= 1
CATEGORIES= graphics
PKGNAMESUFFIX= -devel

View File

@ -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>

View File

@ -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

View File

@ -11,7 +11,7 @@ LICENSE= BSD3CLAUSE
ONLY_FOR_ARCHS= armv6 armv7
CONFLICTS_INSTALL= mesa-libs
CONFLICTS_INSTALL= libglvnd
USES= cmake pkgconfig shebangfix

View File

@ -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>

View File

@ -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