pkgsrc-Changes archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
CVS commit: pkgsrc/graphics
Module Name: pkgsrc
Committed By: nia
Date: Wed Aug 21 13:35:29 UTC 2019
Modified Files:
pkgsrc/graphics: Makefile
pkgsrc/graphics/MesaLib: Makefile PLIST buildlink3.mk builtin.mk
distinfo dri.mk options.mk
pkgsrc/graphics/MesaLib/patches:
patch-src_egl_drivers_dri2_platform__drm.c
patch-src_egl_drivers_dri2_platform__x11.c
patch-src_egl_main_eglglobals.c
patch-src_gallium_auxiliary_util_u__format__tests.c
patch-src_gallium_drivers_nouveau_nouveau__vp3__video.c
patch-src_gallium_drivers_nouveau_nv50_nv84__video.c
patch-src_glx_apple_apple__glapi.c patch-src_glx_glxclient.h
patch-src_glx_glxcurrent.c patch-src_mapi_entry__x86-64__tls.h
patch-src_mapi_entry__x86__tls.h
patch-src_mapi_glapi_gen_gl__gentable.py
patch-src_mapi_u__current.c patch-src_mapi_u__current.h
patch-src_mesa_drivers_dri_i915_intel__screen.c
patch-src_mesa_drivers_dri_i965_intel__screen.c
patch-src_mesa_drivers_dri_swrast_swrast.c
patch-src_mesa_main_context.c patch-src_mesa_main_extensions.c
patch-src_mesa_main_macros.h patch-src_mesa_main_shader__query.cpp
patch-src_mesa_x86_common__x86.c patch-src_util_strndup.h
patch-src_util_u__atomic.h
Added Files:
pkgsrc/graphics/MesaLib/patches: patch-configure.ac
patch-include_GL_internal_dri__interface.h
patch-src_amd_common_ac__debug.c
patch-src_amd_vulkan_winsys_amdgpu_radv__amdgpu__cs.c
patch-src_compiler_builtin__type__macros.h
patch-src_compiler_glsl_glsl__parser__extras.cpp
patch-src_gallium_auxiliary_drivers_trace_tr__dump.c
patch-src_gallium_auxiliary_pipe-loader_pipe__loader__drm.c
patch-src_gallium_auxiliary_util_u__helpers.c
patch-src_gallium_drivers_radeonsi_si__state__shaders.c
patch-src_gallium_drivers_vc4_vc4__bufmgr.c
patch-src_gallium_include_pipe_p__config.h
patch-src_gallium_state__trackers_clover_llvm_invocation.cpp
patch-src_gallium_state__trackers_clover_llvm_metadata.hpp
patch-src_gallium_state__trackers_clover_util_range.hpp
patch-src_gbm_Makefile.am patch-src_glx_Makefile.am
patch-src_glx_dri__common.h patch-src_glx_dri__glx.c
patch-src_glx_glxext.c patch-src_intel_Makefile.tools.am
patch-src_intel_compiler_brw__fs__bank__conflicts.cpp
patch-src_intel_tools_aub__mem.c
patch-src_intel_tools_aubinator__error__decode.c
patch-src_intel_vulkan_anv__allocator.c
patch-src_intel_vulkan_anv__device.c
patch-src_intel_vulkan_anv__gem.c
patch-src_intel_vulkan_anv__gem__stubs.c
patch-src_intel_vulkan_anv__queue.c
patch-src_mesa_drivers_dri_i965_brw__oa__metrics.c
patch-src_mesa_drivers_dri_i965_brw__performance__query.c
patch-src_mesa_drivers_dri_i965_intel__tiled__memcpy.c
patch-src_mesa_drivers_x11_Makefile.am patch-src_util_Makefile.am
patch-src_util_build__id.c patch-src_util_disk__cache.c
patch-src_util_futex.h patch-src_util_ralloc.c
patch-src_util_u__queue.c patch-src_util_u__thread.h
patch-src_util_xmlconfig.c
pkgsrc/graphics/MesaLib11: DESCR Makefile PLIST buildlink3.mk
builtin.mk distinfo dri.mk options.mk
pkgsrc/graphics/MesaLib11/files: patch-manual_fdo90311
pkgsrc/graphics/MesaLib11/patches: patch-configure
patch-include_GL_glxext.h
patch-src_compiler_glsl_builtin__functions.cpp
patch-src_egl_drivers_dri2_platform__drm.c
patch-src_egl_drivers_dri2_platform__x11.c
patch-src_egl_main_eglglobals.c
patch-src_gallium_auxiliary_draw_draw__llvm.c
patch-src_gallium_auxiliary_gallivm_lp__bld__intr.c
patch-src_gallium_auxiliary_gallivm_lp__bld__intr.h
patch-src_gallium_auxiliary_gallivm_lp__bld__sample__soa.c
patch-src_gallium_auxiliary_util_u__format__tests.c
patch-src_gallium_auxiliary_util_u__math.h
patch-src_gallium_auxiliary_util_u__network.c
patch-src_gallium_auxiliary_util_u__network.h
patch-src_gallium_drivers_llvmpipe_lp__state__fs.c
patch-src_gallium_drivers_llvmpipe_lp__state__setup.c
patch-src_gallium_drivers_nouveau_codegen_nv50__ir__peephole.cpp
patch-src_gallium_drivers_nouveau_nouveau__debug.h
patch-src_gallium_drivers_nouveau_nouveau__vp3__video.c
patch-src_gallium_drivers_nouveau_nv50_nv84__video.c
patch-src_gallium_drivers_r600_r600__llvm.c
patch-src_gallium_drivers_radeon_radeon__llvm__util.c
patch-src_gallium_drivers_radeon_radeon__setup__tgsi__llvm.c
patch-src_gallium_drivers_radeonsi_si__shader.c
patch-src_gallium_targets_dri_Makefile.in
patch-src_gallium_winsys_radeon_drm_radeon__drm__winsys.c
patch-src_gallium_winsys_svga_drm_vmw__screen.c
patch-src_gallium_winsys_svga_drm_vmw__screen__ioctl.c
patch-src_gbm_main_gbm.c patch-src_glsl_ralloc.c
patch-src_glx_apple_apple__glapi.c patch-src_glx_glxclient.h
patch-src_glx_glxcurrent.c patch-src_loader_Makefile.in
patch-src_loader_loader.c patch-src_mapi_entry__x86-64__tls.h
patch-src_mapi_entry__x86__tls.h patch-src_mapi_entry__x86__tsd.h
patch-src_mapi_glapi_gen_gl__gentable.py
patch-src_mapi_u__current.c patch-src_mapi_u__current.h
patch-src_mesa_drivers_dri_Makefile.in
patch-src_mesa_drivers_dri_common_Makefile.in
patch-src_mesa_drivers_dri_common_xmlconfig.c
patch-src_mesa_drivers_dri_i915_intel__screen.c
patch-src_mesa_drivers_dri_i965_intel__screen.c
patch-src_mesa_drivers_dri_swrast_swrast.c
patch-src_mesa_main_context.c patch-src_mesa_main_extensions.c
patch-src_mesa_main_macros.h patch-src_mesa_main_shader__query.cpp
patch-src_mesa_tnl_t__pipeline.c patch-src_mesa_x86_common__x86.c
patch-src_util_strndup.c patch-src_util_strndup.h
patch-src_util_u__atomic.h
Removed Files:
pkgsrc/graphics/MesaLib/files: patch-manual_fdo90311
pkgsrc/graphics/MesaLib/patches: patch-configure
patch-include_GL_glxext.h
patch-src_compiler_glsl_builtin__functions.cpp
patch-src_gallium_auxiliary_draw_draw__llvm.c
patch-src_gallium_auxiliary_gallivm_lp__bld__intr.c
patch-src_gallium_auxiliary_gallivm_lp__bld__intr.h
patch-src_gallium_auxiliary_gallivm_lp__bld__sample__soa.c
patch-src_gallium_auxiliary_util_u__math.h
patch-src_gallium_auxiliary_util_u__network.c
patch-src_gallium_auxiliary_util_u__network.h
patch-src_gallium_drivers_llvmpipe_lp__state__fs.c
patch-src_gallium_drivers_llvmpipe_lp__state__setup.c
patch-src_gallium_drivers_nouveau_codegen_nv50__ir__peephole.cpp
patch-src_gallium_drivers_nouveau_nouveau__debug.h
patch-src_gallium_drivers_r600_r600__llvm.c
patch-src_gallium_drivers_radeon_radeon__llvm__util.c
patch-src_gallium_drivers_radeon_radeon__setup__tgsi__llvm.c
patch-src_gallium_drivers_radeonsi_si__shader.c
patch-src_gallium_targets_dri_Makefile.in
patch-src_gallium_winsys_radeon_drm_radeon__drm__winsys.c
patch-src_gallium_winsys_svga_drm_vmw__screen.c
patch-src_gallium_winsys_svga_drm_vmw__screen__ioctl.c
patch-src_gbm_main_gbm.c patch-src_glsl_ralloc.c
patch-src_loader_Makefile.in patch-src_loader_loader.c
patch-src_mapi_entry__x86__tsd.h
patch-src_mesa_drivers_dri_Makefile.in
patch-src_mesa_drivers_dri_common_Makefile.in
patch-src_mesa_drivers_dri_common_xmlconfig.c
patch-src_mesa_tnl_t__pipeline.c patch-src_util_strndup.c
pkgsrc/graphics/MesaLib18: DESCR Makefile PLIST buildlink3.mk
builtin.mk distinfo dri.mk options.mk
pkgsrc/graphics/MesaLib18/patches: patch-configure.ac
patch-include_GL_internal_dri__interface.h
patch-src_amd_common_ac__debug.c
patch-src_amd_vulkan_winsys_amdgpu_radv__amdgpu__cs.c
patch-src_compiler_builtin__type__macros.h
patch-src_compiler_glsl_glsl__parser__extras.cpp
patch-src_egl_drivers_dri2_platform__drm.c
patch-src_egl_drivers_dri2_platform__x11.c
patch-src_egl_main_eglglobals.c
patch-src_gallium_auxiliary_drivers_trace_tr__dump.c
patch-src_gallium_auxiliary_pipe-loader_pipe__loader__drm.c
patch-src_gallium_auxiliary_util_u__format__tests.c
patch-src_gallium_auxiliary_util_u__helpers.c
patch-src_gallium_drivers_nouveau_nouveau__vp3__video.c
patch-src_gallium_drivers_nouveau_nv50_nv84__video.c
patch-src_gallium_drivers_radeonsi_si__state__shaders.c
patch-src_gallium_drivers_vc4_vc4__bufmgr.c
patch-src_gallium_include_pipe_p__config.h
patch-src_gallium_state__trackers_clover_llvm_invocation.cpp
patch-src_gallium_state__trackers_clover_llvm_metadata.hpp
patch-src_gallium_state__trackers_clover_util_range.hpp
patch-src_gbm_Makefile.am patch-src_glx_Makefile.am
patch-src_glx_apple_apple__glapi.c patch-src_glx_dri__common.h
patch-src_glx_dri__glx.c patch-src_glx_glxclient.h
patch-src_glx_glxcurrent.c patch-src_glx_glxext.c
patch-src_intel_Makefile.tools.am
patch-src_intel_compiler_brw__fs__bank__conflicts.cpp
patch-src_intel_tools_aub__mem.c
patch-src_intel_tools_aubinator__error__decode.c
patch-src_intel_vulkan_anv__allocator.c
patch-src_intel_vulkan_anv__device.c
patch-src_intel_vulkan_anv__gem.c
patch-src_intel_vulkan_anv__gem__stubs.c
patch-src_intel_vulkan_anv__queue.c
patch-src_mapi_entry__x86-64__tls.h
patch-src_mapi_entry__x86__tls.h
patch-src_mapi_glapi_gen_gl__gentable.py
patch-src_mapi_u__current.c patch-src_mapi_u__current.h
patch-src_mesa_drivers_dri_i915_intel__screen.c
patch-src_mesa_drivers_dri_i965_brw__oa__metrics.c
patch-src_mesa_drivers_dri_i965_brw__performance__query.c
patch-src_mesa_drivers_dri_i965_intel__screen.c
patch-src_mesa_drivers_dri_i965_intel__tiled__memcpy.c
patch-src_mesa_drivers_dri_swrast_swrast.c
patch-src_mesa_drivers_x11_Makefile.am
patch-src_mesa_main_context.c patch-src_mesa_main_extensions.c
patch-src_mesa_main_macros.h patch-src_mesa_main_shader__query.cpp
patch-src_mesa_x86_common__x86.c patch-src_util_Makefile.am
patch-src_util_build__id.c patch-src_util_disk__cache.c
patch-src_util_futex.h patch-src_util_ralloc.c
patch-src_util_strndup.h patch-src_util_u__atomic.h
patch-src_util_u__queue.c patch-src_util_u__thread.h
patch-src_util_xmlconfig.c
Log Message:
Move graphics/MesaLib18 to graphics/MesaLib.
Move graphics/MesaLib to graphics/MesaLib11.
To generate a diff of this commit:
cvs rdiff -u -r1.839 -r1.840 pkgsrc/graphics/Makefile
cvs rdiff -u -r1.148 -r1.149 pkgsrc/graphics/MesaLib/Makefile
cvs rdiff -u -r1.38 -r1.39 pkgsrc/graphics/MesaLib/PLIST
cvs rdiff -u -r1.57 -r1.58 pkgsrc/graphics/MesaLib/buildlink3.mk
cvs rdiff -u -r1.21 -r1.22 pkgsrc/graphics/MesaLib/builtin.mk
cvs rdiff -u -r1.123 -r1.124 pkgsrc/graphics/MesaLib/distinfo
cvs rdiff -u -r1.17 -r1.18 pkgsrc/graphics/MesaLib/dri.mk
cvs rdiff -u -r1.64 -r1.65 pkgsrc/graphics/MesaLib/options.mk
cvs rdiff -u -r1.2 -r0 pkgsrc/graphics/MesaLib/files/patch-manual_fdo90311
cvs rdiff -u -r1.5 -r0 pkgsrc/graphics/MesaLib/patches/patch-configure
cvs rdiff -u -r0 -r1.3 pkgsrc/graphics/MesaLib/patches/patch-configure.ac \
pkgsrc/graphics/MesaLib/patches/patch-src_compiler_glsl_glsl__parser__extras.cpp
cvs rdiff -u -r1.1 -r0 \
pkgsrc/graphics/MesaLib/patches/patch-include_GL_glxext.h \
pkgsrc/graphics/MesaLib/patches/patch-src_gallium_auxiliary_draw_draw__llvm.c \
pkgsrc/graphics/MesaLib/patches/patch-src_gallium_auxiliary_gallivm_lp__bld__intr.c \
pkgsrc/graphics/MesaLib/patches/patch-src_gallium_auxiliary_gallivm_lp__bld__intr.h \
pkgsrc/graphics/MesaLib/patches/patch-src_gallium_auxiliary_gallivm_lp__bld__sample__soa.c \
pkgsrc/graphics/MesaLib/patches/patch-src_gallium_auxiliary_util_u__network.c \
pkgsrc/graphics/MesaLib/patches/patch-src_gallium_auxiliary_util_u__network.h \
pkgsrc/graphics/MesaLib/patches/patch-src_gallium_drivers_llvmpipe_lp__state__fs.c \
pkgsrc/graphics/MesaLib/patches/patch-src_gallium_drivers_llvmpipe_lp__state__setup.c \
pkgsrc/graphics/MesaLib/patches/patch-src_gallium_drivers_nouveau_codegen_nv50__ir__peephole.cpp \
pkgsrc/graphics/MesaLib/patches/patch-src_gallium_drivers_nouveau_nouveau__debug.h \
pkgsrc/graphics/MesaLib/patches/patch-src_gallium_drivers_r600_r600__llvm.c \
pkgsrc/graphics/MesaLib/patches/patch-src_gallium_drivers_radeon_radeon__llvm__util.c \
pkgsrc/graphics/MesaLib/patches/patch-src_gallium_drivers_radeon_radeon__setup__tgsi__llvm.c \
pkgsrc/graphics/MesaLib/patches/patch-src_gallium_drivers_radeonsi_si__shader.c \
pkgsrc/graphics/MesaLib/patches/patch-src_gallium_targets_dri_Makefile.in \
pkgsrc/graphics/MesaLib/patches/patch-src_gallium_winsys_radeon_drm_radeon__drm__winsys.c \
pkgsrc/graphics/MesaLib/patches/patch-src_mapi_entry__x86__tsd.h \
pkgsrc/graphics/MesaLib/patches/patch-src_mesa_drivers_dri_common_Makefile.in \
pkgsrc/graphics/MesaLib/patches/patch-src_mesa_tnl_t__pipeline.c \
pkgsrc/graphics/MesaLib/patches/patch-src_util_strndup.c
cvs rdiff -u -r0 -r1.1 \
pkgsrc/graphics/MesaLib/patches/patch-include_GL_internal_dri__interface.h \
pkgsrc/graphics/MesaLib/patches/patch-src_amd_common_ac__debug.c \
pkgsrc/graphics/MesaLib/patches/patch-src_amd_vulkan_winsys_amdgpu_radv__amdgpu__cs.c \
pkgsrc/graphics/MesaLib/patches/patch-src_compiler_builtin__type__macros.h \
pkgsrc/graphics/MesaLib/patches/patch-src_gallium_auxiliary_drivers_trace_tr__dump.c \
pkgsrc/graphics/MesaLib/patches/patch-src_gallium_auxiliary_pipe-loader_pipe__loader__drm.c \
pkgsrc/graphics/MesaLib/patches/patch-src_gallium_auxiliary_util_u__helpers.c \
pkgsrc/graphics/MesaLib/patches/patch-src_gallium_drivers_radeonsi_si__state__shaders.c \
pkgsrc/graphics/MesaLib/patches/patch-src_gallium_drivers_vc4_vc4__bufmgr.c \
pkgsrc/graphics/MesaLib/patches/patch-src_gallium_state__trackers_clover_llvm_invocation.cpp \
pkgsrc/graphics/MesaLib/patches/patch-src_gallium_state__trackers_clover_llvm_metadata.hpp \
pkgsrc/graphics/MesaLib/patches/patch-src_gallium_state__trackers_clover_util_range.hpp \
pkgsrc/graphics/MesaLib/patches/patch-src_gbm_Makefile.am \
pkgsrc/graphics/MesaLib/patches/patch-src_glx_Makefile.am \
pkgsrc/graphics/MesaLib/patches/patch-src_glx_dri__common.h \
pkgsrc/graphics/MesaLib/patches/patch-src_glx_dri__glx.c \
pkgsrc/graphics/MesaLib/patches/patch-src_glx_glxext.c \
pkgsrc/graphics/MesaLib/patches/patch-src_intel_Makefile.tools.am \
pkgsrc/graphics/MesaLib/patches/patch-src_intel_compiler_brw__fs__bank__conflicts.cpp \
pkgsrc/graphics/MesaLib/patches/patch-src_intel_tools_aub__mem.c \
pkgsrc/graphics/MesaLib/patches/patch-src_intel_tools_aubinator__error__decode.c \
pkgsrc/graphics/MesaLib/patches/patch-src_intel_vulkan_anv__allocator.c \
pkgsrc/graphics/MesaLib/patches/patch-src_intel_vulkan_anv__device.c \
pkgsrc/graphics/MesaLib/patches/patch-src_intel_vulkan_anv__gem.c \
pkgsrc/graphics/MesaLib/patches/patch-src_intel_vulkan_anv__gem__stubs.c \
pkgsrc/graphics/MesaLib/patches/patch-src_intel_vulkan_anv__queue.c \
pkgsrc/graphics/MesaLib/patches/patch-src_mesa_drivers_dri_i965_brw__oa__metrics.c \
pkgsrc/graphics/MesaLib/patches/patch-src_mesa_drivers_dri_i965_brw__performance__query.c \
pkgsrc/graphics/MesaLib/patches/patch-src_mesa_drivers_dri_i965_intel__tiled__memcpy.c \
pkgsrc/graphics/MesaLib/patches/patch-src_mesa_drivers_x11_Makefile.am \
pkgsrc/graphics/MesaLib/patches/patch-src_util_Makefile.am \
pkgsrc/graphics/MesaLib/patches/patch-src_util_build__id.c \
pkgsrc/graphics/MesaLib/patches/patch-src_util_disk__cache.c \
pkgsrc/graphics/MesaLib/patches/patch-src_util_futex.h \
pkgsrc/graphics/MesaLib/patches/patch-src_util_ralloc.c \
pkgsrc/graphics/MesaLib/patches/patch-src_util_u__queue.c \
pkgsrc/graphics/MesaLib/patches/patch-src_util_u__thread.h \
pkgsrc/graphics/MesaLib/patches/patch-src_util_xmlconfig.c
cvs rdiff -u -r1.2 -r0 \
pkgsrc/graphics/MesaLib/patches/patch-src_compiler_glsl_builtin__functions.cpp \
pkgsrc/graphics/MesaLib/patches/patch-src_gallium_winsys_svga_drm_vmw__screen.c \
pkgsrc/graphics/MesaLib/patches/patch-src_gbm_main_gbm.c \
pkgsrc/graphics/MesaLib/patches/patch-src_mesa_drivers_dri_Makefile.in
cvs rdiff -u -r1.2 -r1.3 \
pkgsrc/graphics/MesaLib/patches/patch-src_egl_drivers_dri2_platform__drm.c \
pkgsrc/graphics/MesaLib/patches/patch-src_egl_drivers_dri2_platform__x11.c \
pkgsrc/graphics/MesaLib/patches/patch-src_glx_glxcurrent.c \
pkgsrc/graphics/MesaLib/patches/patch-src_mapi_entry__x86-64__tls.h \
pkgsrc/graphics/MesaLib/patches/patch-src_mapi_entry__x86__tls.h \
pkgsrc/graphics/MesaLib/patches/patch-src_mesa_drivers_dri_i915_intel__screen.c \
pkgsrc/graphics/MesaLib/patches/patch-src_mesa_drivers_dri_i965_intel__screen.c \
pkgsrc/graphics/MesaLib/patches/patch-src_mesa_drivers_dri_swrast_swrast.c \
pkgsrc/graphics/MesaLib/patches/patch-src_mesa_x86_common__x86.c
cvs rdiff -u -r1.1 -r1.2 \
pkgsrc/graphics/MesaLib/patches/patch-src_egl_main_eglglobals.c \
pkgsrc/graphics/MesaLib/patches/patch-src_gallium_auxiliary_util_u__format__tests.c \
pkgsrc/graphics/MesaLib/patches/patch-src_gallium_drivers_nouveau_nouveau__vp3__video.c \
pkgsrc/graphics/MesaLib/patches/patch-src_gallium_drivers_nouveau_nv50_nv84__video.c \
pkgsrc/graphics/MesaLib/patches/patch-src_glx_apple_apple__glapi.c \
pkgsrc/graphics/MesaLib/patches/patch-src_glx_glxclient.h \
pkgsrc/graphics/MesaLib/patches/patch-src_mapi_glapi_gen_gl__gentable.py \
pkgsrc/graphics/MesaLib/patches/patch-src_mapi_u__current.c \
pkgsrc/graphics/MesaLib/patches/patch-src_mapi_u__current.h \
pkgsrc/graphics/MesaLib/patches/patch-src_mesa_main_extensions.c \
pkgsrc/graphics/MesaLib/patches/patch-src_mesa_main_macros.h \
pkgsrc/graphics/MesaLib/patches/patch-src_mesa_main_shader__query.cpp \
pkgsrc/graphics/MesaLib/patches/patch-src_util_strndup.h \
pkgsrc/graphics/MesaLib/patches/patch-src_util_u__atomic.h
cvs rdiff -u -r1.4 -r0 \
pkgsrc/graphics/MesaLib/patches/patch-src_gallium_auxiliary_util_u__math.h \
pkgsrc/graphics/MesaLib/patches/patch-src_glsl_ralloc.c \
pkgsrc/graphics/MesaLib/patches/patch-src_loader_Makefile.in
cvs rdiff -u -r0 -r1.7 \
pkgsrc/graphics/MesaLib/patches/patch-src_gallium_include_pipe_p__config.h
cvs rdiff -u -r1.3 -r0 \
pkgsrc/graphics/MesaLib/patches/patch-src_gallium_winsys_svga_drm_vmw__screen__ioctl.c \
pkgsrc/graphics/MesaLib/patches/patch-src_loader_loader.c \
pkgsrc/graphics/MesaLib/patches/patch-src_mesa_drivers_dri_common_xmlconfig.c
cvs rdiff -u -r1.3 -r1.4 \
pkgsrc/graphics/MesaLib/patches/patch-src_mesa_main_context.c
cvs rdiff -u -r0 -r1.1 pkgsrc/graphics/MesaLib11/DESCR \
pkgsrc/graphics/MesaLib11/Makefile pkgsrc/graphics/MesaLib11/PLIST \
pkgsrc/graphics/MesaLib11/buildlink3.mk \
pkgsrc/graphics/MesaLib11/builtin.mk pkgsrc/graphics/MesaLib11/distinfo \
pkgsrc/graphics/MesaLib11/dri.mk pkgsrc/graphics/MesaLib11/options.mk
cvs rdiff -u -r0 -r1.1 pkgsrc/graphics/MesaLib11/files/patch-manual_fdo90311
cvs rdiff -u -r0 -r1.1 pkgsrc/graphics/MesaLib11/patches/patch-configure \
pkgsrc/graphics/MesaLib11/patches/patch-include_GL_glxext.h \
pkgsrc/graphics/MesaLib11/patches/patch-src_compiler_glsl_builtin__functions.cpp \
pkgsrc/graphics/MesaLib11/patches/patch-src_egl_drivers_dri2_platform__drm.c \
pkgsrc/graphics/MesaLib11/patches/patch-src_egl_drivers_dri2_platform__x11.c \
pkgsrc/graphics/MesaLib11/patches/patch-src_egl_main_eglglobals.c \
pkgsrc/graphics/MesaLib11/patches/patch-src_gallium_auxiliary_draw_draw__llvm.c \
pkgsrc/graphics/MesaLib11/patches/patch-src_gallium_auxiliary_gallivm_lp__bld__intr.c \
pkgsrc/graphics/MesaLib11/patches/patch-src_gallium_auxiliary_gallivm_lp__bld__intr.h \
pkgsrc/graphics/MesaLib11/patches/patch-src_gallium_auxiliary_gallivm_lp__bld__sample__soa.c \
pkgsrc/graphics/MesaLib11/patches/patch-src_gallium_auxiliary_util_u__format__tests.c \
pkgsrc/graphics/MesaLib11/patches/patch-src_gallium_auxiliary_util_u__math.h \
pkgsrc/graphics/MesaLib11/patches/patch-src_gallium_auxiliary_util_u__network.c \
pkgsrc/graphics/MesaLib11/patches/patch-src_gallium_auxiliary_util_u__network.h \
pkgsrc/graphics/MesaLib11/patches/patch-src_gallium_drivers_llvmpipe_lp__state__fs.c \
pkgsrc/graphics/MesaLib11/patches/patch-src_gallium_drivers_llvmpipe_lp__state__setup.c \
pkgsrc/graphics/MesaLib11/patches/patch-src_gallium_drivers_nouveau_codegen_nv50__ir__peephole.cpp \
pkgsrc/graphics/MesaLib11/patches/patch-src_gallium_drivers_nouveau_nouveau__debug.h \
pkgsrc/graphics/MesaLib11/patches/patch-src_gallium_drivers_nouveau_nouveau__vp3__video.c \
pkgsrc/graphics/MesaLib11/patches/patch-src_gallium_drivers_nouveau_nv50_nv84__video.c \
pkgsrc/graphics/MesaLib11/patches/patch-src_gallium_drivers_r600_r600__llvm.c \
pkgsrc/graphics/MesaLib11/patches/patch-src_gallium_drivers_radeon_radeon__llvm__util.c \
pkgsrc/graphics/MesaLib11/patches/patch-src_gallium_drivers_radeon_radeon__setup__tgsi__llvm.c \
pkgsrc/graphics/MesaLib11/patches/patch-src_gallium_drivers_radeonsi_si__shader.c \
pkgsrc/graphics/MesaLib11/patches/patch-src_gallium_targets_dri_Makefile.in \
pkgsrc/graphics/MesaLib11/patches/patch-src_gallium_winsys_radeon_drm_radeon__drm__winsys.c \
pkgsrc/graphics/MesaLib11/patches/patch-src_gallium_winsys_svga_drm_vmw__screen.c \
pkgsrc/graphics/MesaLib11/patches/patch-src_gallium_winsys_svga_drm_vmw__screen__ioctl.c \
pkgsrc/graphics/MesaLib11/patches/patch-src_gbm_main_gbm.c \
pkgsrc/graphics/MesaLib11/patches/patch-src_glsl_ralloc.c \
pkgsrc/graphics/MesaLib11/patches/patch-src_glx_apple_apple__glapi.c \
pkgsrc/graphics/MesaLib11/patches/patch-src_glx_glxclient.h \
pkgsrc/graphics/MesaLib11/patches/patch-src_glx_glxcurrent.c \
pkgsrc/graphics/MesaLib11/patches/patch-src_loader_Makefile.in \
pkgsrc/graphics/MesaLib11/patches/patch-src_loader_loader.c \
pkgsrc/graphics/MesaLib11/patches/patch-src_mapi_entry__x86-64__tls.h \
pkgsrc/graphics/MesaLib11/patches/patch-src_mapi_entry__x86__tls.h \
pkgsrc/graphics/MesaLib11/patches/patch-src_mapi_entry__x86__tsd.h \
pkgsrc/graphics/MesaLib11/patches/patch-src_mapi_glapi_gen_gl__gentable.py \
pkgsrc/graphics/MesaLib11/patches/patch-src_mapi_u__current.c \
pkgsrc/graphics/MesaLib11/patches/patch-src_mapi_u__current.h \
pkgsrc/graphics/MesaLib11/patches/patch-src_mesa_drivers_dri_Makefile.in \
pkgsrc/graphics/MesaLib11/patches/patch-src_mesa_drivers_dri_common_Makefile.in \
pkgsrc/graphics/MesaLib11/patches/patch-src_mesa_drivers_dri_common_xmlconfig.c \
pkgsrc/graphics/MesaLib11/patches/patch-src_mesa_drivers_dri_i915_intel__screen.c \
pkgsrc/graphics/MesaLib11/patches/patch-src_mesa_drivers_dri_i965_intel__screen.c \
pkgsrc/graphics/MesaLib11/patches/patch-src_mesa_drivers_dri_swrast_swrast.c \
pkgsrc/graphics/MesaLib11/patches/patch-src_mesa_main_context.c \
pkgsrc/graphics/MesaLib11/patches/patch-src_mesa_main_extensions.c \
pkgsrc/graphics/MesaLib11/patches/patch-src_mesa_main_macros.h \
pkgsrc/graphics/MesaLib11/patches/patch-src_mesa_main_shader__query.cpp \
pkgsrc/graphics/MesaLib11/patches/patch-src_mesa_tnl_t__pipeline.c \
pkgsrc/graphics/MesaLib11/patches/patch-src_mesa_x86_common__x86.c \
pkgsrc/graphics/MesaLib11/patches/patch-src_util_strndup.c \
pkgsrc/graphics/MesaLib11/patches/patch-src_util_strndup.h \
pkgsrc/graphics/MesaLib11/patches/patch-src_util_u__atomic.h
cvs rdiff -u -r1.1 -r0 pkgsrc/graphics/MesaLib18/DESCR
cvs rdiff -u -r1.21 -r0 pkgsrc/graphics/MesaLib18/Makefile
cvs rdiff -u -r1.6 -r0 pkgsrc/graphics/MesaLib18/PLIST
cvs rdiff -u -r1.3 -r0 pkgsrc/graphics/MesaLib18/buildlink3.mk \
pkgsrc/graphics/MesaLib18/dri.mk
cvs rdiff -u -r1.2 -r0 pkgsrc/graphics/MesaLib18/builtin.mk
cvs rdiff -u -r1.17 -r0 pkgsrc/graphics/MesaLib18/distinfo
cvs rdiff -u -r1.13 -r0 pkgsrc/graphics/MesaLib18/options.mk
cvs rdiff -u -r1.5 -r0 pkgsrc/graphics/MesaLib18/patches/patch-configure.ac
cvs rdiff -u -r1.1 -r0 \
pkgsrc/graphics/MesaLib18/patches/patch-include_GL_internal_dri__interface.h \
pkgsrc/graphics/MesaLib18/patches/patch-src_amd_vulkan_winsys_amdgpu_radv__amdgpu__cs.c \
pkgsrc/graphics/MesaLib18/patches/patch-src_compiler_builtin__type__macros.h \
pkgsrc/graphics/MesaLib18/patches/patch-src_compiler_glsl_glsl__parser__extras.cpp \
pkgsrc/graphics/MesaLib18/patches/patch-src_egl_drivers_dri2_platform__x11.c \
pkgsrc/graphics/MesaLib18/patches/patch-src_egl_main_eglglobals.c \
pkgsrc/graphics/MesaLib18/patches/patch-src_gallium_auxiliary_drivers_trace_tr__dump.c \
pkgsrc/graphics/MesaLib18/patches/patch-src_gallium_auxiliary_util_u__format__tests.c \
pkgsrc/graphics/MesaLib18/patches/patch-src_gallium_drivers_nouveau_nouveau__vp3__video.c \
pkgsrc/graphics/MesaLib18/patches/patch-src_gallium_drivers_nouveau_nv50_nv84__video.c \
pkgsrc/graphics/MesaLib18/patches/patch-src_gallium_drivers_vc4_vc4__bufmgr.c \
pkgsrc/graphics/MesaLib18/patches/patch-src_gallium_include_pipe_p__config.h \
pkgsrc/graphics/MesaLib18/patches/patch-src_gallium_state__trackers_clover_llvm_invocation.cpp \
pkgsrc/graphics/MesaLib18/patches/patch-src_gallium_state__trackers_clover_llvm_metadata.hpp \
pkgsrc/graphics/MesaLib18/patches/patch-src_gallium_state__trackers_clover_util_range.hpp \
pkgsrc/graphics/MesaLib18/patches/patch-src_gbm_Makefile.am \
pkgsrc/graphics/MesaLib18/patches/patch-src_glx_apple_apple__glapi.c \
pkgsrc/graphics/MesaLib18/patches/patch-src_glx_dri__common.h \
pkgsrc/graphics/MesaLib18/patches/patch-src_glx_dri__glx.c \
pkgsrc/graphics/MesaLib18/patches/patch-src_glx_glxclient.h \
pkgsrc/graphics/MesaLib18/patches/patch-src_glx_glxcurrent.c \
pkgsrc/graphics/MesaLib18/patches/patch-src_glx_glxext.c \
pkgsrc/graphics/MesaLib18/patches/patch-src_intel_Makefile.tools.am \
pkgsrc/graphics/MesaLib18/patches/patch-src_intel_compiler_brw__fs__bank__conflicts.cpp \
pkgsrc/graphics/MesaLib18/patches/patch-src_intel_tools_aubinator__error__decode.c \
pkgsrc/graphics/MesaLib18/patches/patch-src_intel_vulkan_anv__device.c \
pkgsrc/graphics/MesaLib18/patches/patch-src_intel_vulkan_anv__gem.c \
pkgsrc/graphics/MesaLib18/patches/patch-src_intel_vulkan_anv__queue.c \
pkgsrc/graphics/MesaLib18/patches/patch-src_mapi_entry__x86-64__tls.h \
pkgsrc/graphics/MesaLib18/patches/patch-src_mapi_entry__x86__tls.h \
pkgsrc/graphics/MesaLib18/patches/patch-src_mapi_glapi_gen_gl__gentable.py \
pkgsrc/graphics/MesaLib18/patches/patch-src_mapi_u__current.c \
pkgsrc/graphics/MesaLib18/patches/patch-src_mapi_u__current.h \
pkgsrc/graphics/MesaLib18/patches/patch-src_mesa_drivers_dri_i915_intel__screen.c \
pkgsrc/graphics/MesaLib18/patches/patch-src_mesa_drivers_dri_i965_brw__oa__metrics.c \
pkgsrc/graphics/MesaLib18/patches/patch-src_mesa_drivers_dri_i965_intel__screen.c \
pkgsrc/graphics/MesaLib18/patches/patch-src_mesa_drivers_dri_i965_intel__tiled__memcpy.c \
pkgsrc/graphics/MesaLib18/patches/patch-src_mesa_drivers_dri_swrast_swrast.c \
pkgsrc/graphics/MesaLib18/patches/patch-src_mesa_drivers_x11_Makefile.am \
pkgsrc/graphics/MesaLib18/patches/patch-src_mesa_main_context.c \
pkgsrc/graphics/MesaLib18/patches/patch-src_mesa_main_extensions.c \
pkgsrc/graphics/MesaLib18/patches/patch-src_mesa_main_macros.h \
pkgsrc/graphics/MesaLib18/patches/patch-src_mesa_main_shader__query.cpp \
pkgsrc/graphics/MesaLib18/patches/patch-src_mesa_x86_common__x86.c \
pkgsrc/graphics/MesaLib18/patches/patch-src_util_Makefile.am \
pkgsrc/graphics/MesaLib18/patches/patch-src_util_build__id.c \
pkgsrc/graphics/MesaLib18/patches/patch-src_util_disk__cache.c \
pkgsrc/graphics/MesaLib18/patches/patch-src_util_futex.h \
pkgsrc/graphics/MesaLib18/patches/patch-src_util_ralloc.c \
pkgsrc/graphics/MesaLib18/patches/patch-src_util_strndup.h \
pkgsrc/graphics/MesaLib18/patches/patch-src_util_xmlconfig.c
cvs rdiff -u -r1.2 -r0 \
pkgsrc/graphics/MesaLib18/patches/patch-src_amd_common_ac__debug.c \
pkgsrc/graphics/MesaLib18/patches/patch-src_egl_drivers_dri2_platform__drm.c \
pkgsrc/graphics/MesaLib18/patches/patch-src_gallium_auxiliary_pipe-loader_pipe__loader__drm.c \
pkgsrc/graphics/MesaLib18/patches/patch-src_gallium_auxiliary_util_u__helpers.c \
pkgsrc/graphics/MesaLib18/patches/patch-src_intel_tools_aub__mem.c \
pkgsrc/graphics/MesaLib18/patches/patch-src_intel_vulkan_anv__allocator.c \
pkgsrc/graphics/MesaLib18/patches/patch-src_intel_vulkan_anv__gem__stubs.c \
pkgsrc/graphics/MesaLib18/patches/patch-src_mesa_drivers_dri_i965_brw__performance__query.c \
pkgsrc/graphics/MesaLib18/patches/patch-src_util_u__atomic.h \
pkgsrc/graphics/MesaLib18/patches/patch-src_util_u__queue.c \
pkgsrc/graphics/MesaLib18/patches/patch-src_util_u__thread.h
cvs rdiff -u -r1.3 -r0 \
pkgsrc/graphics/MesaLib18/patches/patch-src_gallium_drivers_radeonsi_si__state__shaders.c \
pkgsrc/graphics/MesaLib18/patches/patch-src_glx_Makefile.am
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: pkgsrc/graphics/Makefile
diff -u pkgsrc/graphics/Makefile:1.839 pkgsrc/graphics/Makefile:1.840
--- pkgsrc/graphics/Makefile:1.839 Mon Aug 19 09:56:53 2019
+++ pkgsrc/graphics/Makefile Wed Aug 21 13:35:27 2019
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.839 2019/08/19 09:56:53 nia Exp $
+# $NetBSD: Makefile,v 1.840 2019/08/21 13:35:27 nia Exp $
#
COMMENT= Graphics tools and libraries
@@ -16,7 +16,7 @@ SUBDIR+= ImageViewer
SUBDIR+= Mesa
SUBDIR+= MesaDemos
SUBDIR+= MesaLib
-SUBDIR+= MesaLib18
+SUBDIR+= MesaLib11
SUBDIR+= MesaLib7
SUBDIR+= Ngraph
SUBDIR+= OpenRM
Index: pkgsrc/graphics/MesaLib/Makefile
diff -u pkgsrc/graphics/MesaLib/Makefile:1.148 pkgsrc/graphics/MesaLib/Makefile:1.149
--- pkgsrc/graphics/MesaLib/Makefile:1.148 Fri Apr 26 13:13:59 2019
+++ pkgsrc/graphics/MesaLib/Makefile Wed Aug 21 13:35:28 2019
@@ -1,10 +1,11 @@
-# $NetBSD: Makefile,v 1.148 2019/04/26 13:13:59 maya Exp $
+# $NetBSD: Makefile,v 1.149 2019/08/21 13:35:28 nia Exp $
-DISTNAME= mesa-11.2.2
+DISTNAME= mesa-18.3.4
PKGNAME= ${DISTNAME:S/mesa/MesaLib/}
-PKGREVISION= 11
+PKGREVISION= 1
CATEGORIES= graphics x11
-MASTER_SITES= ftp://ftp.freedesktop.org/pub/mesa/${PKGVERSION_NOREV}/
+MASTER_SITES= ftp://ftp.freedesktop.org/pub/mesa/
+# MASTER_SITES= ftp://ftp.freedesktop.org/pub/mesa/${PKGVERSION_NOREV}/
EXTRACT_SUFX= .tar.xz
MAINTAINER= pkgsrc-users%NetBSD.org@localhost
@@ -13,21 +14,16 @@ COMMENT= The Mesa 3D Graphics Library
LICENSE= mit
GNU_CONFIGURE= yes
-USE_TOOLS+= bison pkg-config gmake flex
+USE_TOOLS+= autoconf automake autoreconf bison pkg-config gmake flex
USE_LANGUAGES= c99 c++
USE_LIBTOOL= yes
-#CFLAGS+= -g -O0
-#CXXFLAGS+= -g -O0
-
-GCC_REQD+= 4.2
-
PKGCONFIG_OVERRIDE+= src/egl/main/egl.pc.in
-PKGCONFIG_OVERRIDE+= src/egl/wayland/wayland-egl/wayland-egl.pc.in
PKGCONFIG_OVERRIDE+= src/gallium/targets/d3dadapter9/d3d.pc.in
PKGCONFIG_OVERRIDE+= src/gallium/targets/osmesa/osmesa.pc.in
PKGCONFIG_OVERRIDE+= src/gallium/targets/xa/xatracker.pc.in
PKGCONFIG_OVERRIDE+= src/gbm/main/gbm.pc.in
+PKGCONFIG_OVERRIDE+= src/glx/windows/windowsdriproto.pc.in
PKGCONFIG_OVERRIDE+= src/mapi/es1api/glesv1_cm.pc.in
PKGCONFIG_OVERRIDE+= src/mapi/es2api/glesv2.pc.in
PKGCONFIG_OVERRIDE+= src/mesa/drivers/dri/dri.pc.in
@@ -41,24 +37,30 @@ CONFIGURE_ARGS+= --enable-shared-glapi
# archives named libglapi.la but in different directories, bad things happen.
SUBST_CLASSES+= wrapper-bug
SUBST_STAGE.wrapper-bug= pre-configure
-SUBST_MESSAGE.wrapper-bug= Renaming glapi-shared/libglapi in Makefiles
-SUBST_FILES.wrapper-bug= src/gbm/Makefile.in
-SUBST_FILES.wrapper-bug+= src/glx/Makefile.in
-SUBST_FILES.wrapper-bug+= src/mapi/Makefile.in
-SUBST_FILES.wrapper-bug+= src/mesa/drivers/x11/Makefile.in
-SUBST_SED.wrapper-bug= -e 's,shared-glapi/libglapi.la,shared-glapi/libglapi_tmp_rename.la,g'
-SUBST_SED.wrapper-bug+= -e 's,libglapi.la,libglapi_impl.la,g'
-SUBST_SED.wrapper-bug+= -e 's,libglapi_tmp_rename.la,libglapi.la,g'
-
-# Replace /etc/drirc with ${PREFIX}/etc/drirc
-SUBST_CLASSES+= drirc
-SUBST_STAGE.drirc= pre-configure
-SUBST_MESSAGE.drirc= Fixing hardcoded /etc/drirc references
-SUBST_FILES.drirc+= src/mesa/drivers/dri/common/xmlconfig.c
-SUBST_SED.drirc+= -e 's|/etc/|${PREFIX}/etc/|g'
-
-# Required due to clang defaulting to strict C standard by default (no strdup).
-CFLAGS.SunOS+= -D__EXTENSIONS__
+SUBST_MESSAGE.wrapper-bug= Renaming non-shared libglapi.la in Makefiles
+SUBST_FILES.wrapper-bug= src/gallium/targets/libgl-xlib/Makefile.am
+SUBST_FILES.wrapper-bug+= src/gallium/targets/osmesa/Makefile.am
+SUBST_FILES.wrapper-bug+= src/glx/Makefile.am
+SUBST_FILES.wrapper-bug+= src/mapi/Makefile.am
+SUBST_FILES.wrapper-bug+= src/mesa/drivers/osmesa/Makefile.am
+SUBST_FILES.wrapper-bug+= src/mesa/drivers/x11/Makefile.am
+SUBST_SED.wrapper-bug= -e 's,shared-glapi/libglapi\.la,shared-glapi/libglapi_tmp_rename.la,g'
+SUBST_SED.wrapper-bug+= -e 's,shared_glapi_libglapi_la,shared_glapi_libglapi_tmp_rename_la,g'
+SUBST_SED.wrapper-bug+= -e 's,libglapi\.la,libglapi_impl.la,g'
+SUBST_SED.wrapper-bug+= -e 's,libglapi_la,libglapi_impl_la,g'
+SUBST_SED.wrapper-bug+= -e 's,libglapi_tmp_rename\.la,libglapi.la,g'
+SUBST_SED.wrapper-bug+= -e 's,libglapi_tmp_rename_la,libglapi_la,g'
+
+# Replace /etc/drirc.d with ${PREFIX}/etc/drirc.d
+SUBST_CLASSES+= drirc
+SUBST_STAGE.drirc= pre-configure
+SUBST_MESSAGE.drirc= Fixing hardcoded /etc/drirc.d references
+SUBST_FILES.drirc+= src/util/xmlconfig.c
+SUBST_SED.drirc+= -e 's|/etc|${PREFIX}/etc|g'
+
+CFLAGS.SunOS+= -D__EXTENSIONS__ -D_POSIX_PTHREAD_SEMANTICS
+CXXFLAGS.SunOS+= -Drestrict=__restrict__
+LDFLAGS.SunOS+= -lsocket -lnsl
.include "../../mk/bsd.prefs.mk"
.include "../../mk/compiler.mk"
@@ -68,20 +70,11 @@ CFLAGS.SunOS+= -D__EXTENSIONS__
CONFIGURE_ARGS+= --enable-glx-read-only-text
.endif
-.if !empty(PKGSRC_COMPILER:Mclang)
-SUBST_CLASSES+= tr1
-SUBST_STAGE.tr1= pre-configure
-SUBST_MESSAGE.tr1= Fixing TR1 C++ namespace
-SUBST_FILES.tr1= src/gallium/drivers/nouveau/codegen/*.h
-SUBST_FILES.tr1+= src/gallium/drivers/nouveau/codegen/*.cpp
-SUBST_SED.tr1= -e 's,std::tr1::,std::,g'
-SUBST_SED.tr1+= -e 's,include <tr1/,include <,g'
-.endif
-
PYTHON_FOR_BUILD_ONLY= yes
-PYTHON_VERSIONS_INCOMPATIBLE= 36 37 # as of 11.2.2
BUILD_DEPENDS+= ${PYPKGPREFIX}-mako-[0-9]*:../../devel/py-mako
-CONFIGURE_ENV+= ac_cv_prog_PYTHON2=${PYTHONBIN}
+# needed to build vulkan support
+BUILD_DEPENDS+= ${PYPKGPREFIX}-cElementTree-[0-9]*:../../textproc/py-cElementTree
+CONFIGURE_ENV+= PYTHON=${PYTHONBIN}
.include "../../lang/python/tool.mk"
# Handle platforms without exp2
@@ -90,21 +83,29 @@ CPPFLAGS+= -Dexp2\(x\)=exp\(\(x\)\*M_LN2
CPPFLAGS+= -Dexp2f\(x\)=expf\(\(x\)\*M_LN2\)
.endif
-# Manual patch for FDO bug 90311. Don't apply if not on Darwin as there could
-# be side effects.
-.if ${OPSYS} == "Darwin"
-pre-configure: ${WRKDIR}/.manual_patch_done
-${WRKDIR}/.manual_patch_done:
- cd ${WRKSRC} && ${TOOLS_PATCH} -z .manual -p0 < ${FILESDIR}/patch-manual_fdo90311
- touch ${.TARGET}
-.endif
-
-INSTALLATION_DIRS+= share/examples/MesaLib
+# Work around Xorg segfaulting in radeon driver due to wrong alloca being used
+CFLAGS.NetBSD+= -Dalloca=__builtin_alloca
+CXXFLAGS.NetBSD+= -Dalloca=__builtin_alloca
+
+pre-configure:
+ touch ${WRKSRC}/src/glx/apple_dummy.cpp
+ cd ${WRKSRC} && autoreconf -vif
+
+DRIRC_DIR= ${PKG_SYSCONFDIR}/drirc.d
+EGDIR= ${PREFIX}/share/examples/mesa
+OWN_DIRS+= ${DRIRC_DIR}
+INSTALLATION_DIRS+= ${EGDIR}
+CONF_FILES+= ${EGDIR}/00-mesa-defaults.conf \
+ ${DRIRC_DIR}/00-mesa-defaults.conf
post-install:
- ${INSTALL_DATA} ${WRKSRC}/src/mesa/drivers/dri/common/drirc ${DESTDIR}${PREFIX}/share/examples/MesaLib
+ ${INSTALL_DATA} ${WRKSRC}/src/util/00-mesa-defaults.conf ${DESTDIR}${EGDIR}
+.include "../../devel/zlib/buildlink3.mk"
+.include "../../textproc/expat/buildlink3.mk"
+.include "../../x11/libXrandr/buildlink3.mk"
.include "../../x11/libX11/buildlink3.mk"
.include "../../x11/libXext/buildlink3.mk"
.include "../../x11/libxcb/buildlink3.mk"
+.include "../../x11/libxshmfence/buildlink3.mk"
.include "../../mk/bsd.pkg.mk"
Index: pkgsrc/graphics/MesaLib/PLIST
diff -u pkgsrc/graphics/MesaLib/PLIST:1.38 pkgsrc/graphics/MesaLib/PLIST:1.39
--- pkgsrc/graphics/MesaLib/PLIST:1.38 Mon Dec 24 13:56:44 2018
+++ pkgsrc/graphics/MesaLib/PLIST Wed Aug 21 13:35:28 2019
@@ -1,9 +1,9 @@
-@comment $NetBSD: PLIST,v 1.38 2018/12/24 13:56:44 sevan Exp $
-${PLIST.dri}include/EGL/egl.h
-${PLIST.dri}include/EGL/eglext.h
-${PLIST.dri}include/EGL/eglextchromium.h
-${PLIST.dri}include/EGL/eglmesaext.h
-${PLIST.dri}include/EGL/eglplatform.h
+@comment $NetBSD: PLIST,v 1.39 2019/08/21 13:35:28 nia Exp $
+${PLIST.egl}include/EGL/egl.h
+${PLIST.egl}include/EGL/eglext.h
+${PLIST.egl}include/EGL/eglextchromium.h
+${PLIST.egl}include/EGL/eglmesaext.h
+${PLIST.egl}include/EGL/eglplatform.h
include/GL/gl.h
include/GL/gl_mangle.h
include/GL/glcorearb.h
@@ -12,56 +12,74 @@ include/GL/glx.h
include/GL/glx_mangle.h
include/GL/glxext.h
${PLIST.dri}include/GL/internal/dri_interface.h
-include/GL/osmesa.h
-include/GL/wglext.h
-${PLIST.dri}include/GLES/egl.h
-${PLIST.dri}include/GLES/gl.h
-${PLIST.dri}include/GLES/glext.h
-${PLIST.dri}include/GLES/glplatform.h
-${PLIST.dri}include/GLES2/gl2.h
-${PLIST.dri}include/GLES2/gl2ext.h
-${PLIST.dri}include/GLES2/gl2platform.h
-${PLIST.dri}include/GLES3/gl3.h
-${PLIST.dri}include/GLES3/gl31.h
-${PLIST.dri}include/GLES3/gl3ext.h
-${PLIST.dri}include/GLES3/gl3platform.h
-${PLIST.dri}include/KHR/khrplatform.h
+${PLIST.osmesa}include/GL/osmesa.h
+${PLIST.glesv1}include/GLES/egl.h
+${PLIST.glesv1}include/GLES/gl.h
+${PLIST.glesv1}include/GLES/glext.h
+${PLIST.glesv1}include/GLES/glplatform.h
+${PLIST.glesv2}include/GLES2/gl2.h
+${PLIST.glesv2}include/GLES2/gl2ext.h
+${PLIST.glesv2}include/GLES2/gl2platform.h
+${PLIST.glesv2}include/GLES3/gl3.h
+${PLIST.glesv2}include/GLES3/gl31.h
+${PLIST.glesv2}include/GLES3/gl32.h
+${PLIST.glesv2}include/GLES3/gl3ext.h
+${PLIST.glesv2}include/GLES3/gl3platform.h
+include/KHR/khrplatform.h
${PLIST.gbm}include/gbm.h
+${PLIST.vulkan}include/vulkan/vulkan_intel.h
${PLIST.xatracker}include/xa_composite.h
${PLIST.xatracker}include/xa_context.h
${PLIST.xatracker}include/xa_tracker.h
-${PLIST.vaapi}lib/dri/gallium_drv_video.la
-${PLIST.i915_dri}lib/dri/i915_dri.so
-${PLIST.i965_dri}lib/dri/i965_dri.so
-${PLIST.ilo}lib/dri/ilo_dri.so
+@comment ${PLIST.vaapi}lib/dri/gallium_drv_video.la
+@comment ${PLIST.vaapi}lib/dri/gallium_drv_video.so
+${PLIST.i915}lib/dri/i915_dri.so
+${PLIST.i965}lib/dri/i965_dri.so
+@comment ${PLIST.ilo}lib/dri/ilo_dri.so
${PLIST.freedreno}lib/dri/kgsl_dri.so
${PLIST.swrast}lib/dri/kms_swrast_dri.so
${PLIST.freedreno}lib/dri/msm_dri.so
${PLIST.nouveau}lib/dri/nouveau_dri.so
+@comment ${PLIST.vdpau}lib/dri/nouveau_drv_video.la
+${PLIST.nouveau}${PLIST.vaapi}lib/dri/nouveau_drv_video.so
${PLIST.nouveau_dri}lib/dri/nouveau_vieux_dri.so
-${PLIST.r200_dri}lib/dri/r200_dri.so
+@comment ${PLIST.vdpau}lib/dri/radeonsi_drv_video.la
+${PLIST.r200}lib/dri/r200_dri.so
${PLIST.r300}lib/dri/r300_dri.so
${PLIST.r600}lib/dri/r600_dri.so
+@comment ${PLIST.vdpau}lib/dri/r600_drv_video.la
+${PLIST.vaapi}lib/dri/r600_drv_video.so
${PLIST.radeon_dri}lib/dri/radeon_dri.so
${PLIST.radeonsi}lib/dri/radeonsi_dri.so
+${PLIST.vaapi}lib/dri/radeonsi_drv_video.so
${PLIST.swrast_dri}lib/dri/swrast_dri.so
${PLIST.vc4}lib/dri/vc4_dri.so
${PLIST.svga}lib/dri/vmwgfx_dri.so
-${PLIST.dri}lib/libEGL.la
+${PLIST.egl}lib/libEGL.la
lib/libGL.la
-${PLIST.dri}lib/libGLESv1_CM.la
-${PLIST.dri}lib/libGLESv2.la
+${PLIST.glesv1}lib/libGLESv1_CM.la
+${PLIST.glesv2}lib/libGLESv2.la
+${PLIST.osmesa}lib/libOSMesa.la
+${PLIST.xvmc}${PLIST.nouveau}lib/libXvMCnouveau.so
+${PLIST.xvmc}${PLIST.nouveau}lib/libXvMCnouveau.so.1
+${PLIST.xvmc}${PLIST.nouveau}lib/libXvMCnouveau.so.1.0
+${PLIST.xvmc}${PLIST.nouveau}lib/libXvMCnouveau.so.1.0.0
+${PLIST.xvmc}${PLIST.r600}lib/libXvMCr600.so
+${PLIST.xvmc}${PLIST.r600}lib/libXvMCr600.so.1
+${PLIST.xvmc}${PLIST.r600}lib/libXvMCr600.so.1.0
+${PLIST.xvmc}${PLIST.r600}lib/libXvMCr600.so.1.0.0
${PLIST.gbm}lib/libgbm.la
lib/libglapi.la
-${PLIST.wayland}lib/libwayland-egl.la
+${PLIST.vulkan}lib/libvulkan_intel.la
+${PLIST.vulkan}lib/libvulkan_radeon.la
${PLIST.xatracker}lib/libxatracker.la
${PLIST.dri}lib/pkgconfig/dri.pc
-${PLIST.dri}lib/pkgconfig/egl.pc
+${PLIST.egl}lib/pkgconfig/egl.pc
${PLIST.gbm}lib/pkgconfig/gbm.pc
lib/pkgconfig/gl.pc
-${PLIST.dri}lib/pkgconfig/glesv1_cm.pc
-${PLIST.dri}lib/pkgconfig/glesv2.pc
-${PLIST.wayland}lib/pkgconfig/wayland-egl.pc
+${PLIST.glesv1}lib/pkgconfig/glesv1_cm.pc
+${PLIST.glesv2}lib/pkgconfig/glesv2.pc
+${PLIST.osmesa}lib/pkgconfig/osmesa.pc
${PLIST.xatracker}lib/pkgconfig/xatracker.pc
${PLIST.nouveau}${PLIST.vdpau}lib/vdpau/libvdpau_nouveau.so
${PLIST.nouveau}${PLIST.vdpau}lib/vdpau/libvdpau_nouveau.so.1
@@ -79,4 +97,6 @@ ${PLIST.vdpau}lib/vdpau/libvdpau_radeons
${PLIST.vdpau}lib/vdpau/libvdpau_radeonsi.so.1
${PLIST.vdpau}lib/vdpau/libvdpau_radeonsi.so.1.0
${PLIST.vdpau}lib/vdpau/libvdpau_radeonsi.so.1.0.0
-share/examples/MesaLib/drirc
+${PLIST.vulkan}share/vulkan/icd.d/intel_icd.${MACHINE_ARCH}.json
+${PLIST.vulkan}share/vulkan/icd.d/radeon_icd.${MACHINE_ARCH}.json
+share/examples/mesa/00-mesa-defaults.conf
Index: pkgsrc/graphics/MesaLib/buildlink3.mk
diff -u pkgsrc/graphics/MesaLib/buildlink3.mk:1.57 pkgsrc/graphics/MesaLib/buildlink3.mk:1.58
--- pkgsrc/graphics/MesaLib/buildlink3.mk:1.57 Sat Jan 19 21:36:21 2019
+++ pkgsrc/graphics/MesaLib/buildlink3.mk Wed Aug 21 13:35:28 2019
@@ -1,4 +1,4 @@
-# $NetBSD: buildlink3.mk,v 1.57 2019/01/19 21:36:21 tnn Exp $
+# $NetBSD: buildlink3.mk,v 1.58 2019/08/21 13:35:28 nia Exp $
BUILDLINK_TREE+= MesaLib
@@ -13,8 +13,8 @@ BUILDLINK_PKGSRCDIR.MesaLib?= ../../grap
.if ${X11_TYPE} == "modular"
BUILDLINK_ABI_DEPENDS.MesaLib+= MesaLib>=10.5.3
-# This is needed to avoid linking conflicting libstdc++ versions
. if defined(USE_LANGUAGES) && !empty(USE_LANGUAGES:Mc++)
+# This is needed to avoid linking conflicting libstdc++ versions
GCC_REQD+= 4.2
. endif
.endif
@@ -35,7 +35,7 @@ PKG_BUILD_OPTIONS.MesaLib+= dri
. include "../../graphics/MesaLib/dri.mk"
.endif
-.if ${X11_TYPE} == "modular" && !empty(PKG_BUILD_OPTIONS.MesaLib:Mdri) && ${OPSYS} != "Darwin" || \
+.if ${X11_TYPE} == "modular" && !empty(PKG_BUILD_OPTIONS.MesaLib:Mdri) || \
${X11_TYPE} == "native" && exists(${X11BASE}/include/EGL/egl.h)
MESALIB_SUPPORTS_EGL= yes
.else
@@ -43,6 +43,7 @@ MESALIB_SUPPORTS_EGL= no
.endif
.include "../../x11/libXext/buildlink3.mk"
+.include "../../mk/pthread.buildlink3.mk"
.endif # MESALIB_BUILDLINK3_MK
BUILDLINK_TREE+= -MesaLib
Index: pkgsrc/graphics/MesaLib/builtin.mk
diff -u pkgsrc/graphics/MesaLib/builtin.mk:1.21 pkgsrc/graphics/MesaLib/builtin.mk:1.22
--- pkgsrc/graphics/MesaLib/builtin.mk:1.21 Sun Jan 14 14:58:38 2018
+++ pkgsrc/graphics/MesaLib/builtin.mk Wed Aug 21 13:35:28 2019
@@ -1,4 +1,4 @@
-# $NetBSD: builtin.mk,v 1.21 2018/01/14 14:58:38 rillig Exp $
+# $NetBSD: builtin.mk,v 1.22 2019/08/21 13:35:28 nia Exp $
BUILTIN_PKG:= MesaLib
@@ -22,6 +22,7 @@ IS_BUILTIN.MesaLib= yes
IS_BUILTIN.MesaLib= no
. endif
.endif
+
MAKEVARS+= IS_BUILTIN.MesaLib
###
@@ -67,6 +68,7 @@ USE_BUILTIN.MesaLib!= \
. endif
. endif # PREFER.MesaLib
.endif
+
MAKEVARS+= USE_BUILTIN.MesaLib
###
Index: pkgsrc/graphics/MesaLib/distinfo
diff -u pkgsrc/graphics/MesaLib/distinfo:1.123 pkgsrc/graphics/MesaLib/distinfo:1.124
--- pkgsrc/graphics/MesaLib/distinfo:1.123 Sat Dec 29 13:38:53 2018
+++ pkgsrc/graphics/MesaLib/distinfo Wed Aug 21 13:35:28 2019
@@ -1,62 +1,71 @@
-$NetBSD: distinfo,v 1.123 2018/12/29 13:38:53 triaxx Exp $
+$NetBSD: distinfo,v 1.124 2019/08/21 13:35:28 nia Exp $
-SHA1 (mesa-11.2.2.tar.xz) = c3805020be6fef77d3b96a5ddf4ddc256dee16ff
-RMD160 (mesa-11.2.2.tar.xz) = 14bca7cc76015e53db2fafcebb8540f451be5aab
-SHA512 (mesa-11.2.2.tar.xz) = fd1fcb1bc97e52784a4b3dedfd8c8ba95bc1b03a62b132d2e16154d076be7a6fabbca1bcba705a7916a1507d811d7f3e6c3488aa386d5e63891282fb1713ce52
-Size (mesa-11.2.2.tar.xz) = 7860932 bytes
-SHA1 (patch-configure) = 87f0f2e60f342c91b3aecab02d3a4d8940eadf0a
-SHA1 (patch-include_GL_glxext.h) = 830902f2d38a8395cda682c059fc5223e1b0e89e
-SHA1 (patch-src_compiler_glsl_builtin__functions.cpp) = 1be4e67eda2105f375942c2991cf432e5d74e597
-SHA1 (patch-src_egl_drivers_dri2_platform__drm.c) = 99b6dd6739c29551ae2c885eabd7babd159fc3e5
-SHA1 (patch-src_egl_drivers_dri2_platform__x11.c) = 04b6ef8e755f226fbe3e6f2bea6c9e2a56a783ca
-SHA1 (patch-src_egl_main_eglglobals.c) = 2d81ae27f09162d23bc684456cc5fef48c042652
-SHA1 (patch-src_gallium_auxiliary_draw_draw__llvm.c) = fc1a313eed85042b7ac2db67c6fd1902074fb43a
-SHA1 (patch-src_gallium_auxiliary_gallivm_lp__bld__intr.c) = 4c40981645675cfeb55bf28317158ebb6332268d
-SHA1 (patch-src_gallium_auxiliary_gallivm_lp__bld__intr.h) = 07f2606d94b9af30df838206841cbcd8a198d799
-SHA1 (patch-src_gallium_auxiliary_gallivm_lp__bld__sample__soa.c) = e94692f8dbae1247e5780cebf24e4a333b1fcd0a
+SHA1 (mesa-18.3.4.tar.xz) = a9a6ea0f5b99df362dc35770ade10c1738e2629c
+RMD160 (mesa-18.3.4.tar.xz) = 659565933a679d04dda58c7314e5d7c172e46d12
+SHA512 (mesa-18.3.4.tar.xz) = e4ead944ba053aa05425e9e199d633f576dfa424976253fc32438e8db6da5e8d381122e4c4b7fb18f94177421f208bab5567cfec8d2692d104e266483ca02a99
+Size (mesa-18.3.4.tar.xz) = 11875224 bytes
+SHA1 (patch-configure.ac) = 5283215d27410c80f81ffd28b3f7b02506d1c1b8
+SHA1 (patch-include_GL_internal_dri__interface.h) = 146d2f3f3e50fc1947e8941301d9cf9d90a035e2
+SHA1 (patch-src_amd_common_ac__debug.c) = 8233367c3b5bc344442ea8d19488fdd1e3791ae9
+SHA1 (patch-src_amd_vulkan_winsys_amdgpu_radv__amdgpu__cs.c) = 1fe81a7b16e36dc9125400c20543271216a33a45
+SHA1 (patch-src_compiler_builtin__type__macros.h) = 857bca0c0f55ec8d7a20b3807c7a5d7bd06bdfbf
+SHA1 (patch-src_compiler_glsl_glsl__parser__extras.cpp) = ef114d6e288e6d212fce9d1c0606f7d454a171c4
+SHA1 (patch-src_egl_drivers_dri2_platform__drm.c) = e18e7b1ffbc74b8acf3d9095a92c750f9d005479
+SHA1 (patch-src_egl_drivers_dri2_platform__x11.c) = 49e48c31eacb79d1da357fe70eaffd2926b5280e
+SHA1 (patch-src_egl_main_eglglobals.c) = 0d52014f52e62fc5fa6650336ddb0011ecf331e6
+SHA1 (patch-src_gallium_auxiliary_drivers_trace_tr__dump.c) = 360e1608508a7bbb41acecd58930781038e2309e
+SHA1 (patch-src_gallium_auxiliary_pipe-loader_pipe__loader__drm.c) = f913b779404e6bd8ae707a4fd66eb7c1dca9b311
SHA1 (patch-src_gallium_auxiliary_util_u__format__tests.c) = 4d5e4677c2825778c43440ab131b8807f6840975
-SHA1 (patch-src_gallium_auxiliary_util_u__math.h) = 812e4a5291aea47e06505f09891e0434c4d9c34d
-SHA1 (patch-src_gallium_auxiliary_util_u__network.c) = 283f505af780071dc9fd7914f8065e3fb7d8a4fd
-SHA1 (patch-src_gallium_auxiliary_util_u__network.h) = c6106d67b4fa9db0d790474182d6e0ce0c5da677
-SHA1 (patch-src_gallium_drivers_llvmpipe_lp__state__fs.c) = b14ca18ae1dc03901b197c86e67052bbb154a81f
-SHA1 (patch-src_gallium_drivers_llvmpipe_lp__state__setup.c) = 1d6c24bc598da9945ce75c1cc6a2334228d66b41
-SHA1 (patch-src_gallium_drivers_nouveau_codegen_nv50__ir__peephole.cpp) = 5fc2ef7eafac3006896af96bac8176c79b17cfdc
-SHA1 (patch-src_gallium_drivers_nouveau_nouveau__debug.h) = dd60605a9d89e573ad2cdeb67b11450b0eedeebf
-SHA1 (patch-src_gallium_drivers_nouveau_nouveau__vp3__video.c) = ae1b6eb4df3e4db0f37e44118cdf69b16f3c471e
+SHA1 (patch-src_gallium_auxiliary_util_u__helpers.c) = a955657951d6d7d84ef349b3b6639a94e44994a5
+SHA1 (patch-src_gallium_drivers_nouveau_nouveau__vp3__video.c) = 04f95784c3270c9bb7e95377982e217962481525
SHA1 (patch-src_gallium_drivers_nouveau_nv50_nv84__video.c) = 1b4239fe053523835ecac006894bdb0cde0ee626
-SHA1 (patch-src_gallium_drivers_r600_r600__llvm.c) = 37ffa4df519df4b7a35b686448e823200d5144ae
-SHA1 (patch-src_gallium_drivers_radeon_radeon__llvm__util.c) = 63852f9abaa4d75d0043ae748bba718a35459a11
-SHA1 (patch-src_gallium_drivers_radeon_radeon__setup__tgsi__llvm.c) = 7957999b555c9c2e68a1d9b2eece5989e6612ff3
-SHA1 (patch-src_gallium_drivers_radeonsi_si__shader.c) = 44b790ee0d8b843421114b61ddae6a4d4ef2a099
-SHA1 (patch-src_gallium_targets_dri_Makefile.in) = a9a8265d97297040a3e3260b362ca920ec852280
-SHA1 (patch-src_gallium_winsys_radeon_drm_radeon__drm__winsys.c) = 2358b7d5ea89e28cb3ac07a408b18e8bf55e057a
-SHA1 (patch-src_gallium_winsys_svga_drm_vmw__screen.c) = 7b9c57c2b5a0f5d244c27d4c6164736853e43b47
-SHA1 (patch-src_gallium_winsys_svga_drm_vmw__screen__ioctl.c) = e4b891e8b4ebe5b8e8c7b8c2c1dbed11b9c417df
-SHA1 (patch-src_gbm_main_gbm.c) = e49c319c4a9a63433983ec024ccdfeb966b418b0
-SHA1 (patch-src_glsl_ralloc.c) = 63c8e40b9f74404033c20c5c9a00c5f6d8df6433
-SHA1 (patch-src_glx_apple_apple__glapi.c) = df70afc24759978f954ac3a774a14e6518dde97a
-SHA1 (patch-src_glx_glxclient.h) = e15256851559dafb7a86e1eb7e9d6afc86de581b
-SHA1 (patch-src_glx_glxcurrent.c) = 713f75bcafb186c7123d19a6aae3deaed9d5fa69
-SHA1 (patch-src_loader_Makefile.in) = 30454c207924183c881a84d31458fdc0ddb1680b
-SHA1 (patch-src_loader_loader.c) = 8dca08425dd0817eb5920705d61a257022240957
-SHA1 (patch-src_mapi_entry__x86-64__tls.h) = e1cc896dd9cf7d77b837104557c0e0bf9d41ff55
-SHA1 (patch-src_mapi_entry__x86__tls.h) = 3d6c11281b57c9c713899022bfc8fcea54d07d56
-SHA1 (patch-src_mapi_entry__x86__tsd.h) = 62501b6e609fa81e33fd826a694e9d9752a7ba21
-SHA1 (patch-src_mapi_glapi_gen_gl__gentable.py) = 53026e520a510e54494760a3fa05af6f15dfb9d8
-SHA1 (patch-src_mapi_u__current.c) = 1731375d82119be326b35d141d7879e083d6d620
-SHA1 (patch-src_mapi_u__current.h) = 214dd29cb0c4fe127eb1157b04b12ddfc455b4b0
-SHA1 (patch-src_mesa_drivers_dri_Makefile.in) = 48032b8f8e6eac59092f68f3c32cfdd44d7ce8bf
-SHA1 (patch-src_mesa_drivers_dri_common_Makefile.in) = 5e160f7d92c2e9f3fa36e52a082a496af67e634e
-SHA1 (patch-src_mesa_drivers_dri_common_xmlconfig.c) = b87644c5ef5fb5d71c3260026d3afdfbaee749a8
-SHA1 (patch-src_mesa_drivers_dri_i915_intel__screen.c) = fd8436e4e3a69250256c2cddf8138effb16bd7b3
-SHA1 (patch-src_mesa_drivers_dri_i965_intel__screen.c) = 7c1a1e5c549f64d4c390e0c87984c44a88d4abfe
-SHA1 (patch-src_mesa_drivers_dri_swrast_swrast.c) = b8a6cca517e1cccbdb2c59cf67a6d2481cdfebd4
-SHA1 (patch-src_mesa_main_context.c) = 695b0e04cbd08dfed46b4dae5f9602b35e21f5b3
-SHA1 (patch-src_mesa_main_extensions.c) = d650d7ddfe22ddbcd8a4c24b64feb27126521ae0
-SHA1 (patch-src_mesa_main_macros.h) = e0e98dff37bbf96fea2f3adf0dc9ef9911b711d9
-SHA1 (patch-src_mesa_main_shader__query.cpp) = 6273c74161f045363c58f38adeb672287f6a0898
-SHA1 (patch-src_mesa_tnl_t__pipeline.c) = afc7d5f27aeadacc7c6a762e5aa892e01a0c1317
-SHA1 (patch-src_mesa_x86_common__x86.c) = bdac91384d67ad0238ecd4cdcf5cfc787952a3d9
-SHA1 (patch-src_util_strndup.c) = b8dfae71f1b219e44f884b8fc6f89a86201353c3
-SHA1 (patch-src_util_strndup.h) = a48a0ebefbc79a770db4baa590d3f858bb52cacf
-SHA1 (patch-src_util_u__atomic.h) = 4a567b6fe5bf67fb7f386fa5f37bedb66d593085
+SHA1 (patch-src_gallium_drivers_radeonsi_si__state__shaders.c) = ed51a57765f2349bc91fd509dc03e709241bd899
+SHA1 (patch-src_gallium_drivers_vc4_vc4__bufmgr.c) = 1d591d346486fdf58893f69ab92a272e6a31a987
+SHA1 (patch-src_gallium_include_pipe_p__config.h) = f4e38eac66167b619c30076bb0144dd716310967
+SHA1 (patch-src_gallium_state__trackers_clover_llvm_invocation.cpp) = 3053db09fbfffffd82e232b60b244a0a80c8f181
+SHA1 (patch-src_gallium_state__trackers_clover_llvm_metadata.hpp) = c97d38098ea03658bc193a50e445b87f1c020839
+SHA1 (patch-src_gallium_state__trackers_clover_util_range.hpp) = cdc78067986c1b92818472c4201c58ef1b42c4f4
+SHA1 (patch-src_gbm_Makefile.am) = 5f3107afbf64b97f7d21ce427cecc4fb78974db3
+SHA1 (patch-src_glx_Makefile.am) = 869c4f2388f835b9b296b3c84c2a03ef7717f17d
+SHA1 (patch-src_glx_apple_apple__glapi.c) = c4eea8dabf74eb03d22da4eb834b18ae3384c63b
+SHA1 (patch-src_glx_dri__common.h) = 0274877f8c65a4bb729536a897df4704897a4c6e
+SHA1 (patch-src_glx_dri__glx.c) = 8fd48776e9953b18bd17ba130d90ae2935e67242
+SHA1 (patch-src_glx_glxclient.h) = f0358179ae397bc8677597b0ccb9a471f40f15de
+SHA1 (patch-src_glx_glxcurrent.c) = 8b8e949eded13491c5865601253c6e7d4b06e228
+SHA1 (patch-src_glx_glxext.c) = 15c2c5e0c6b5095ce849fb86ad148aa05d7d907a
+SHA1 (patch-src_intel_Makefile.tools.am) = 5253d5972b48ae3bc8d648bb9f479dcf6cbd3fab
+SHA1 (patch-src_intel_compiler_brw__fs__bank__conflicts.cpp) = 6276d2c6846bb4dd08699921bec4e20202a17478
+SHA1 (patch-src_intel_tools_aub__mem.c) = 6a21ecb4cfbdf216474b3be16bda441bb1390350
+SHA1 (patch-src_intel_tools_aubinator__error__decode.c) = d8f636e3c3e76763a505a1dce23de0b198ad62fa
+SHA1 (patch-src_intel_vulkan_anv__allocator.c) = da5a11c95d17d6476e7141572264a215807b8cd7
+SHA1 (patch-src_intel_vulkan_anv__device.c) = 5d581dcd9695c869855f200c575cf98b7165c1ba
+SHA1 (patch-src_intel_vulkan_anv__gem.c) = b8eb487fa704151e7c3c3b1d23973b2b0aa5922e
+SHA1 (patch-src_intel_vulkan_anv__gem__stubs.c) = ad5a4bd9fe521cf73faf2f0cf0f493a0b40f4c20
+SHA1 (patch-src_intel_vulkan_anv__queue.c) = 2dbf7dfd0c77f74f510032bf8d12109f58c50a30
+SHA1 (patch-src_mapi_entry__x86-64__tls.h) = 11b7ef1da435fa17fc7025a46a123d447d6a7d07
+SHA1 (patch-src_mapi_entry__x86__tls.h) = 11c0f5302d305a77f3a1780d44a2c61f48a66273
+SHA1 (patch-src_mapi_glapi_gen_gl__gentable.py) = 0b1d4ef3f78a9b3726ef7f9921608a48a5e4ac56
+SHA1 (patch-src_mapi_u__current.c) = 38d324fcd1c28d155106ccd248edb5eb1aa9ffac
+SHA1 (patch-src_mapi_u__current.h) = 465a992bd34057e9521f0a33e6f2e25cefc145ca
+SHA1 (patch-src_mesa_drivers_dri_i915_intel__screen.c) = e33f51b3502e8c52ff7283aeb807996717f79f4f
+SHA1 (patch-src_mesa_drivers_dri_i965_brw__oa__metrics.c) = bb7ca6a8b9e42c1dc4e59a3cf78d063699f7b66e
+SHA1 (patch-src_mesa_drivers_dri_i965_brw__performance__query.c) = 1250b3477c4b8013b928772b7dc7f24e8c4b67aa
+SHA1 (patch-src_mesa_drivers_dri_i965_intel__screen.c) = 795b17970e95347222514bacc0701aa86fa1ff02
+SHA1 (patch-src_mesa_drivers_dri_i965_intel__tiled__memcpy.c) = 5b940f9a56c694ffaf8a4383c3a2eae25cfd35a6
+SHA1 (patch-src_mesa_drivers_dri_swrast_swrast.c) = 3106f350e590f62c8bd29cd85f24f977639dccdb
+SHA1 (patch-src_mesa_drivers_x11_Makefile.am) = 172a8da11a620edce790f64338a0390cd1e93188
+SHA1 (patch-src_mesa_main_context.c) = 74226013b56ad6c9678f1970458538b35967678f
+SHA1 (patch-src_mesa_main_extensions.c) = 2f48bdb1176c2878bb33bcfab7556172b50a987e
+SHA1 (patch-src_mesa_main_macros.h) = c5dceaa8dc02a58e5b2273d82e3fe1cc12e327d3
+SHA1 (patch-src_mesa_main_shader__query.cpp) = 3f9c31645d87855759def11344dee16af23c7be3
+SHA1 (patch-src_mesa_x86_common__x86.c) = f8c4b93443ef66d017f6aa114b877565b30f2598
+SHA1 (patch-src_util_Makefile.am) = e390cd47b784ad08987b81fdbce537968ad4a624
+SHA1 (patch-src_util_build__id.c) = 7a9547bbda9d2fb9f0018ccf27b70b59e497aa2c
+SHA1 (patch-src_util_disk__cache.c) = cc0b29780dba5d5b5e43c0798336f16a1f0008de
+SHA1 (patch-src_util_futex.h) = 35097c3b8baf8b969c6ec5ec1feb6f4e0a48237e
+SHA1 (patch-src_util_ralloc.c) = d311bfd9ed7e673d72e050668d351c1e6552cdc8
+SHA1 (patch-src_util_strndup.h) = 73f49694ca48ad6b9a9d8346c5b84fddec2463bd
+SHA1 (patch-src_util_u__atomic.h) = 31d4514538ef5ee53012695eb5c66134aaec981e
+SHA1 (patch-src_util_u__queue.c) = ed1ea3f6fc37e9a64894a3e865c48691b6e01b2c
+SHA1 (patch-src_util_u__thread.h) = f0453485bb62d0b7c00a1b840cfce2726ebcbfd2
+SHA1 (patch-src_util_xmlconfig.c) = ad5619e067957b120a70c1c63421c92b356e16ac
Index: pkgsrc/graphics/MesaLib/dri.mk
diff -u pkgsrc/graphics/MesaLib/dri.mk:1.17 pkgsrc/graphics/MesaLib/dri.mk:1.18
--- pkgsrc/graphics/MesaLib/dri.mk:1.17 Wed Mar 7 11:57:30 2018
+++ pkgsrc/graphics/MesaLib/dri.mk Wed Aug 21 13:35:28 2019
@@ -1,37 +1,31 @@
-# $NetBSD: dri.mk,v 1.17 2018/03/07 11:57:30 wiz Exp $
+# $NetBSD: dri.mk,v 1.18 2019/08/21 13:35:28 nia Exp $
#
# Currently, this is for convenience only.
#
.if !defined(DRI_MK)
DRI_MK= # defined
-. if !defined(USE_BUILTIN.MesaLib)
+.if !defined(USE_BUILTIN.MesaLib)
CHECK_BUILTIN.MesaLib:= yes
-. include "../../graphics/MesaLib/builtin.mk"
+. include "../../graphics/MesaLib/builtin.mk"
CHECK_BUILTIN.MesaLib:= no
-. endif
+.endif
-. if !empty(USE_BUILTIN.MesaLib:M[Nn][Oo])
-. if ${OPSYS} != "Darwin"
+.if !empty(USE_BUILTIN.MesaLib:M[Nn][Oo])
+. if ${OPSYS} != "Darwin"
BUILDLINK_API_DEPENDS.libdrm+= libdrm>=2.4.60
-. endif
-. if ${OPSYS} == "Linux"
+. endif
+. if ${OPSYS} == "Linux"
BUILDLINK_API_DEPENDS.libxcb+= libxcb>=1.9.3
-. endif
. endif
-. include "../../textproc/expat/buildlink3.mk"
-. include "../../x11/xorgproto/buildlink3.mk"
+.endif
+.include "../../x11/xorgproto/buildlink3.mk"
# XXX these do not have builtin.mk
-. if ${X11_TYPE} == "modular"
-. include "../../x11/libxshmfence/buildlink3.mk"
-. endif
-. include "../../x11/libXdamage/buildlink3.mk"
-. include "../../x11/libXfixes/buildlink3.mk"
-. include "../../x11/libXxf86vm/buildlink3.mk"
-. if ${OPSYS} != "Darwin"
-. include "../../x11/libdrm/buildlink3.mk"
-. endif
-. if ${OPSYS} == "FreeBSD" || ${OPSYS} == "DragonFly"
-. include "../../devel/libdevq/buildlink3.mk"
-. endif
+.include "../../x11/libxshmfence/buildlink3.mk"
+.include "../../x11/libXdamage/buildlink3.mk"
+.include "../../x11/libXfixes/buildlink3.mk"
+.include "../../x11/libXxf86vm/buildlink3.mk"
+.if ${OPSYS} != "Darwin"
+. include "../../x11/libdrm/buildlink3.mk"
+.endif
.endif
Index: pkgsrc/graphics/MesaLib/options.mk
diff -u pkgsrc/graphics/MesaLib/options.mk:1.64 pkgsrc/graphics/MesaLib/options.mk:1.65
--- pkgsrc/graphics/MesaLib/options.mk:1.64 Sat Jan 26 20:33:39 2019
+++ pkgsrc/graphics/MesaLib/options.mk Wed Aug 21 13:35:28 2019
@@ -1,85 +1,146 @@
-# $NetBSD: options.mk,v 1.64 2019/01/26 20:33:39 tnn Exp $
+# $NetBSD: options.mk,v 1.65 2019/08/21 13:35:28 nia Exp $
PKG_OPTIONS_VAR= PKG_OPTIONS.MesaLib
-PKG_SUPPORTED_OPTIONS= llvm dri
+PKG_SUPPORTED_OPTIONS= llvm dri wayland
PKG_SUGGESTED_OPTIONS=
+PKG_SUPPORTED_OPTIONS+= glx-tls xvmc debug
+PKG_SUPPORTED_OPTIONS+= vdpau vaapi
+PKG_SUPPORTED_OPTIONS+= osmesa
+PKG_SUPPORTED_OPTIONS+= glesv1 glesv2
+PKG_SUPPORTED_OPTIONS+= xa
+PKG_SUPPORTED_OPTIONS+= noatexit
+PKG_SUPPORTED_OPTIONS+= vulkan
+
+# PKG_SUGGESTED_OPTIONS+= xvmc
+PKG_SUGGESTED_OPTIONS+= vdpau vaapi
+PKG_SUGGESTED_OPTIONS+= glesv1 glesv2
+
+PKG_SUGGESTED_OPTIONS+= xa
+PKG_SUGGESTED_OPTIONS+= noatexit
+
# The LLVM option enables JIT accelerated software rendering and
# is also required to support the latest RADEON GPUs, so enable it
# by default on platforms where such GPUs might be encountered.
.if (${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "x86_64") && \
- ${OPSYS} != "SunOS" && ${OPSYS} != "Darwin" && \
- !(${OPSYS} == "NetBSD" && ${X11_TYPE} == "native")
+ ${OPSYS} != "SunOS" && ${OPSYS} != "Darwin"
PKG_SUGGESTED_OPTIONS+= llvm
.endif
.if ${OPSYS} == "FreeBSD" || ${OPSYS} == "OpenBSD" || \
${OPSYS} == "DragonFly" || ${OPSYS} == "Linux" || \
- ${OPSYS} == "SunOS" || ${OPSYS} == "Darwin" || \
- (${OPSYS} == "NetBSD" && ${X11_TYPE} == "modular")
+ ${OPSYS} == "SunOS" || ${OPSYS} == "NetBSD" || \
+ ${OPSYS} == "Darwin"
PKG_SUGGESTED_OPTIONS+= dri
.endif
+
+# Use Thread Local Storage in GLX where it is supported by Mesa and works.
+.if \
+ !empty(MACHINE_PLATFORM:MNetBSD-[789].*-i386) || \
+ !empty(MACHINE_PLATFORM:MNetBSD-[789].*-x86_64) || \
+ !empty(MACHINE_PLATFORM:MLinux-*-i386) || \
+ !empty(MACHINE_PLATFORM:MLinux-*-x86_64) || \
+ !empty(MACHINE_PLATFORM:MFreeBSD-1[0-9].*-x86_64) || \
+ !empty(MACHINE_PLATFORM:MDragonFly-*-x86_64)
+PKG_SUGGESTED_OPTIONS+= glx-tls
+.endif
+
.include "../../mk/bsd.options.mk"
# gallium
-PLIST_VARS+= freedreno ilo i915 i965 nouveau r300 r600 radeonsi \
- swrast svga vc4 virgl
+PLIST_VARS+= freedreno i915 i965 nouveau r300 r600 radeonsi \
+ swrast svga vc4 virgl vulkan
# classic DRI
-PLIST_VARS+= dri swrast_dri i915_dri nouveau_dri i965_dri radeon_dri r200_dri
+PLIST_VARS+= dri swrast_dri nouveau_dri radeon_dri r200
# other features
-PLIST_VARS+= gbm vaapi vdpau wayland xatracker
+PLIST_VARS+= egl gbm vaapi vdpau wayland xatracker
+PLIST_VARS+= osmesa xvmc
+PLIST_VARS+= glesv1 glesv2
-.if !empty(PKG_OPTIONS:Mdri)
+EGL_PLATFORMS+= x11
-CONFIGURE_ARGS+= --enable-dri
-CONFIGURE_ARGS+= --enable-egl
.if ${OPSYS} != "Darwin"
-CFLAGS+= -DHAVE_DRI3
+EGL_PLATFORMS+= drm
+.endif
+
+.if !empty(PKG_OPTIONS:Mwayland)
+EGL_PLATFORMS+= wayland
+PLIST.wayland= yes
+.include "../../devel/wayland/buildlink3.mk"
+.include "../../devel/wayland-protocols/buildlink3.mk"
+.endif
+
+.if !empty(PKG_OPTIONS:Mdri)
+CONFIGURE_ARGS+= --enable-dri
+# Having DRI3 and egl compiled in by default doesn't hurt, the X server
+# will only use it if it is supported at run time.
CONFIGURE_ARGS+= --enable-dri3
+. if ${OPSYS} != "Darwin"
+CONFIGURE_ARGS+= --enable-egl
CONFIGURE_ARGS+= --enable-gbm
+PLIST.egl= yes
PLIST.gbm= yes
-.endif
+. else
+CONFIGURE_ARGS+= --disable-egl
+CONFIGURE_ARGS+= --disable-gbm
+. endif
+
+. if !empty(PKG_OPTIONS:Mosmesa)
+CONFIGURE_ARGS+= --enable-osmesa
+PLIST.osmesa= yes
+. endif
+
+. if !empty(PKG_OPTIONS:Mglesv1)
CONFIGURE_ARGS+= --enable-gles1
+PLIST.glesv1= yes
+. else
+CONFIGURE_ARGS+= --disable-gles1
+. endif
+
+. if !empty(PKG_OPTIONS:Mglesv2)
CONFIGURE_ARGS+= --enable-gles2
+PLIST.glesv2= yes
+. else
+CONFIGURE_ARGS+= --disable-gles2
+. endif
-# Use Thread Local Storage in GLX where it is supported by Mesa and works.
-.if \
- !empty(MACHINE_PLATFORM:MNetBSD-[789].*-i386) || \
- !empty(MACHINE_PLATFORM:MNetBSD-[789].*-x86_64) || \
- !empty(MACHINE_PLATFORM:MLinux-*-i386) || \
- !empty(MACHINE_PLATFORM:MLinux-*-x86_64) || \
- !empty(MACHINE_PLATFORM:MFreeBSD-1[0-9].*-x86_64) || \
- !empty(MACHINE_PLATFORM:MDragonFly-*-x86_64)
+. if !empty(PKG_OPTIONS:Mglx-tls)
+# Recommended by
+# http://www.freedesktop.org/wiki/Software/Glamor/
CONFIGURE_ARGS+= --enable-glx-tls
-.else
+. else
+# (EE) Failed to load /usr/pkg/lib/xorg/modules/extensions/libglx.so:
+# /usr/pkg/lib/libGL.so.1: Use of initialized Thread Local Storage with model
+# initial-exec and dlopen is not supported
CONFIGURE_ARGS+= --disable-glx-tls
-.endif
+. endif # glx-tls
# DRI on Linux needs either sysfs or udev
CONFIGURE_ARGS.Linux+= --enable-sysfs
PLIST.dri= yes
-.if ${OPSYS} != "Darwin"
+. if ${OPSYS} != "Darwin"
BUILDLINK_DEPMETHOD.libpciaccess= full
-.include "../../sysutils/libpciaccess/buildlink3.mk"
-.endif
-.include "../../graphics/MesaLib/dri.mk"
+. include "../../sysutils/libpciaccess/buildlink3.mk"
+. endif
+. include "../../graphics/MesaLib/dri.mk"
DRI_DRIVERS= #
GALLIUM_DRIVERS= #
+VULKAN_DRIVERS= #
# Software rasterizer
PLIST.swrast_dri= yes
DRI_DRIVERS+= swrast
-.if ${OPSYS} != "Darwin"
+. if ${OPSYS} != "Darwin"
PLIST.swrast= yes
GALLIUM_DRIVERS+= swrast
-.endif
+. endif
# x86 only drivers
-.if (${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "x86_64") && ${OPSYS} != "Darwin"
+. if (${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "x86_64") && ${OPSYS} != "Darwin"
# svga / VMWare driver
PLIST.svga= yes
GALLIUM_DRIVERS+= svga
@@ -87,116 +148,127 @@ GALLIUM_DRIVERS+= svga
# Intel chipsets, x86 only
PLIST.i915= yes
GALLIUM_DRIVERS+= i915
-PLIST.i915_dri= yes
DRI_DRIVERS+= i915
-# Experimental Intel driver
-PLIST.ilo= yes
-GALLIUM_DRIVERS+= ilo
-
-PLIST.i965_dri= yes
+PLIST.i965= yes
DRI_DRIVERS+= i965
-.endif
+
+. endif
+
+# Vulkan support
+. if !empty(PKG_OPTIONS:Mvulkan)
+VULKAN_DRIVERS+= intel
+VULKAN_DRIVERS+= radeon
+PLIST.vulkan= yes
+. endif
# ARM drivers
-.if !empty(MACHINE_PLATFORM:MNetBSD-*-*arm*)
+. if !empty(MACHINE_PLATFORM:MNetBSD-*-*arm*)
# Qualcomm SnapDragon, libdrm_freedreno.pc
-GALLIUM_DRIVERS+= freedreno
-PLIST.freedreno= yes
+#GALLIUM_DRIVERS+= freedreno
+#PLIST.freedreno= yes
# Broadcom VideoCore 4
GALLIUM_DRIVERS+= vc4
PLIST.vc4= yes
-.endif
+. endif
# qemu Linux guest driver
-.if !empty(MACHINE_PLATFORM:MLinux-*-x86_64)
+. if !empty(MACHINE_PLATFORM:MLinux-*-x86_64)
# XXX test this
#GALLIUM_DRIVERS+= virgl
#PLIST.virgl= yes
-.endif
+. endif
# theoretically cross platform PCI drivers
-.if ${OPSYS} != "Darwin" && empty(MACHINE_PLATFORM:MNetBSD-*-*arm*) && \
+. if ${OPSYS} != "Darwin" && empty(MACHINE_PLATFORM:MNetBSD-*-*arm*) && \
empty(MACHINE_PLATFORM:MNetBSD-*-mipsel)
# AMD Radeon r600
PLIST.r600= yes
GALLIUM_DRIVERS+= r600
+# FULL_OS_VERSION_CMD= ${UNAME} -r
+# FULL_OS_VERSION= ${FULL_OS_VERSION_CMD:sh}
+
# FreeBSD lacks nouveau support (there are official binaries from Nvidia)
-.if ${OPSYS} != "FreeBSD"
+. if ${OPSYS} != "FreeBSD"
# nVidia
PLIST.nouveau= yes
GALLIUM_DRIVERS+= nouveau
-.endif
+. endif
# classic DRI radeon
PLIST.radeon_dri= yes
DRI_DRIVERS+= radeon
# classic DRI r200
-PLIST.r200_dri= yes
+PLIST.r200= yes
DRI_DRIVERS+= r200
# FreeBSD lacks nouveau support (there are official binaries from Nvidia)
-.if ${OPSYS} != "FreeBSD"
+. if ${OPSYS} != "FreeBSD"
# classic DRI nouveau
PLIST.nouveau_dri= yes
DRI_DRIVERS+= nouveau
-.endif
-
-.endif
+. endif
+. endif
+# end cross platform PCI drivers
-.if ${OPSYS} == "Darwin"
-CONFIGURE_ARGS+= --with-egl-platforms=x11
-#.elif ${OPSYS} == "Linux"
-#.include "../../wip/wayland/buildlink3.mk"
-#CONFIGURE_ARGS+= --with-egl-platforms=x11,drm,wayland
-#PLIST.wayland= yes
-.else
-CONFIGURE_ARGS+= --with-egl-platforms=x11,drm
-.endif
-
-CONFIGURE_ARGS+= --with-gallium-drivers=${GALLIUM_DRIVERS:ts,}
-CONFIGURE_ARGS+= --with-dri-drivers=${DRI_DRIVERS:ts,}
-
-.if !empty(PKG_OPTIONS:Mllvm)
+. if !empty(PKG_OPTIONS:Mllvm)
# VA-API and VDPAU
-.include "../../multimedia/libva/available.mk"
-.if ${VAAPI_AVAILABLE} == "yes"
+. if !empty(PKG_OPTIONS:Mvaapi)
+. include "../../multimedia/libva/available.mk"
+. if ${VAAPI_AVAILABLE} == "yes"
PLIST.vaapi= yes
-.include "../../multimedia/libva/buildlink3.mk"
-.endif
-.include "../../multimedia/libvdpau/available.mk"
-.if ${VDPAU_AVAILABLE} == "yes"
+. include "../../multimedia/libva/buildlink3.mk"
+. endif
+. endif # vaapi
+. if !empty(PKG_OPTIONS:Mvdpau)
+. include "../../multimedia/libvdpau/available.mk"
+. if ${VDPAU_AVAILABLE} == "yes"
PLIST.vdpau= yes
-.include "../../multimedia/libvdpau/buildlink3.mk"
-.endif
+. include "../../multimedia/libvdpau/buildlink3.mk"
+. endif
+. endif # vdpau
# XA is useful for accelerating xf86-video-vmware
+. if !empty(PKG_OPTIONS:Mxa)
CONFIGURE_ARGS+= --enable-xa
PLIST.xatracker= yes
+. endif
+
# AMD Radeon r300
PLIST.r300= yes
GALLIUM_DRIVERS+= r300
# AMD Canary Islands GPUs
PLIST.radeonsi= yes
GALLIUM_DRIVERS+= radeonsi
-CONFIGURE_ARGS+= --enable-gallium-llvm
-CONFIGURE_ARGS+= --enable-r600-llvm-compiler
-.include "../../devel/libelf/buildlink3.mk"
-CPPFLAGS+= -I${BUILDLINK_PREFIX.libelf}/include/libelf
-.include "../../lang/libLLVM4/buildlink3.mk"
-CONFIGURE_ENV+= ac_cv_path_ac_pt_LLVM_CONFIG=${LLVM_CONFIG_PATH}
-.else # !llvm
+CONFIGURE_ARGS+= --enable-llvm
+CONFIGURE_ARGS+= --enable-llvm-shared-libs
+
+. if !exists(/usr/include/libelf.h)
+. include "../../devel/libelf/buildlink3.mk"
+. endif
+
+BUILDLINK_API_DEPENDS.libLLVM+= libLLVM>=7.0
+. include "../../lang/libLLVM/buildlink3.mk"
+CONFIGURE_ENV+= ac_cv_path_ac_pt_LLVM_CONFIG=${LLVM_CONFIG_PATH:Q}
+. else # !llvm
CONFIGURE_ARGS+= --disable-xa
-CONFIGURE_ARGS+= --disable-gallium-llvm
-CONFIGURE_ARGS+= --disable-r600-llvm-compiler
-.endif # llvm
+CONFIGURE_ARGS+= --disable-llvm
+CONFIGURE_ARGS+= --disable-llvm-shared-libs
+. endif # llvm
+
+CONFIGURE_ARGS+= --with-gallium-drivers=${GALLIUM_DRIVERS:ts,}
+CONFIGURE_ARGS+= --with-dri-drivers=${DRI_DRIVERS:ts,}
+CONFIGURE_ARGS+= --with-vulkan-drivers=${VULKAN_DRIVERS:ts,}
+CONFIGURE_ARGS+= --with-platforms=${EGL_PLATFORMS:S/ /,/gW}
+
.else # !dri
CONFIGURE_ARGS+= --with-gallium-drivers=
CONFIGURE_ARGS+= --with-dri-drivers=
+CONFIGURE_ARGS+= --with-vulkan-drivers=
CONFIGURE_ARGS+= --disable-dri
CONFIGURE_ARGS+= --disable-dri3
CONFIGURE_ARGS+= --disable-egl
@@ -204,7 +276,24 @@ CONFIGURE_ARGS+= --disable-gbm
CONFIGURE_ARGS+= --disable-gles1
CONFIGURE_ARGS+= --disable-gles2
CONFIGURE_ARGS+= --enable-xlib-glx
-.if !empty(PKG_OPTIONS:Mllvm)
+CONFIGURE_ARGS+= --with-platforms=x11
+. if !empty(PKG_OPTIONS:Mllvm)
PKG_FAIL_REASON+= "The llvm PKG_OPTION must also be disabled when dri is disabled"
+. endif
+.endif # dri
+
+.if !empty(PKG_OPTIONS:Mdebug)
+CONFIGURE_ARGS+= --enable-debug
.endif
+
+.if !empty(PKG_OPTIONS:Mxvmc)
+CONFIGURE_ARGS+= --enable-xvmc
+.include "../../x11/libXvMC/buildlink3.mk"
+PLIST.xvmc= yes
+.else
+CONFIGURE_ARGS+= --disable-xvmc
+.endif
+
+.if !empty(PKG_OPTIONS:Mnoatexit)
+CPPFLAGS+= -DHAVE_NOATEXIT
.endif
Index: pkgsrc/graphics/MesaLib/patches/patch-src_egl_drivers_dri2_platform__drm.c
diff -u pkgsrc/graphics/MesaLib/patches/patch-src_egl_drivers_dri2_platform__drm.c:1.2 pkgsrc/graphics/MesaLib/patches/patch-src_egl_drivers_dri2_platform__drm.c:1.3
--- pkgsrc/graphics/MesaLib/patches/patch-src_egl_drivers_dri2_platform__drm.c:1.2 Tue Jan 5 13:02:57 2016
+++ pkgsrc/graphics/MesaLib/patches/patch-src_egl_drivers_dri2_platform__drm.c Wed Aug 21 13:35:28 2019
@@ -1,16 +1,18 @@
-$NetBSD: patch-src_egl_drivers_dri2_platform__drm.c,v 1.2 2016/01/05 13:02:57 tnn Exp $
+$NetBSD: patch-src_egl_drivers_dri2_platform__drm.c,v 1.3 2019/08/21 13:35:28 nia Exp $
netbsd-5 build fix
---- src/egl/drivers/dri2/platform_drm.c.orig 2015-12-09 16:10:13.000000000 +0000
+--- src/egl/drivers/dri2/platform_drm.c.orig 2019-01-17 11:26:22.000000000 +0000
+++ src/egl/drivers/dri2/platform_drm.c
-@@ -626,7 +626,9 @@ dri2_initialize_drm(_EGLDriver *drv, _EG
- if (gbm == NULL)
- goto cleanup;
+@@ -725,7 +725,11 @@ dri2_initialize_drm(_EGLDriver *drv, _EG
+ }
+ dri2_dpy->own_device = true;
} else {
+#ifdef F_DUPFD_CLOEXEC
- fd = fcntl(gbm_device_get_fd(gbm), F_DUPFD_CLOEXEC, 3);
+ dri2_dpy->fd = fcntl(gbm_device_get_fd(gbm), F_DUPFD_CLOEXEC, 3);
++#else
++ dri2_dpy->fd = -1;
+#endif
- if (fd < 0)
+ if (dri2_dpy->fd < 0) {
+ err = "DRI2: failed to fcntl() existing gbm device";
goto cleanup;
- }
Index: pkgsrc/graphics/MesaLib/patches/patch-src_egl_drivers_dri2_platform__x11.c
diff -u pkgsrc/graphics/MesaLib/patches/patch-src_egl_drivers_dri2_platform__x11.c:1.2 pkgsrc/graphics/MesaLib/patches/patch-src_egl_drivers_dri2_platform__x11.c:1.3
--- pkgsrc/graphics/MesaLib/patches/patch-src_egl_drivers_dri2_platform__x11.c:1.2 Wed May 18 12:55:28 2016
+++ pkgsrc/graphics/MesaLib/patches/patch-src_egl_drivers_dri2_platform__x11.c Wed Aug 21 13:35:28 2019
@@ -1,10 +1,23 @@
-$NetBSD: patch-src_egl_drivers_dri2_platform__x11.c,v 1.2 2016/05/18 12:55:28 wiz Exp $
+$NetBSD: patch-src_egl_drivers_dri2_platform__x11.c,v 1.3 2019/08/21 13:35:28 nia Exp $
Provide compat strndup for older Darwin.
---- src/egl/drivers/dri2/platform_x11.c.orig 2016-05-05 12:59:22.000000000 +0000
+* From FreeBSD ports 18.0.0:
+work-around for https://bugs.freedesktop.org/show_bug.cgi?id=100627
+
+Mon Apr 10 19:14:48 2017 UTC
+DRI3 remains enabled at compile time, but it is now disabled at
+runtime for stock FreeBSD. Set LIBGL_DRI3_ENABLE in the
+environment to enable DRI3.
+This change was made to work around a problem in libEGL,
+which fails to fall back to using DRI2 when run on a system
+without DRI3 support.
+
+* Added logging statement to note dri3 initialization being invoked.
+
+--- src/egl/drivers/dri2/platform_x11.c.orig 2018-02-09 02:17:57.000000000 +0000
+++ src/egl/drivers/dri2/platform_x11.c
-@@ -591,6 +591,23 @@ dri2_x11_local_authenticate(struct dri2_
+@@ -608,6 +608,23 @@ dri2_x11_local_authenticate(struct dri2_
return EGL_TRUE;
}
@@ -28,3 +41,20 @@ Provide compat strndup for older Darwin.
static EGLBoolean
dri2_x11_connect(struct dri2_egl_display *dri2_dpy)
{
+@@ -1466,8 +1483,15 @@ dri2_initialize_x11(_EGLDriver *drv, _EG
+
+ if (!disp->Options.ForceSoftware) {
+ #ifdef HAVE_DRI3
+- if (!env_var_as_boolean("LIBGL_DRI3_DISABLE", false))
++#if ((defined(__FreeBSD__) || defined(__FreeBSD_kernel__)) && !defined(__DRM_NEXT__)) || defined(__DragonFly__) || defined(__NetBSD__)
++ if (env_var_as_boolean("LIBGL_DRI3_ENABLE", false))
++#endif
++ if (!env_var_as_boolean("LIBGL_DRI3_DISABLE", false)) {
++ _eglLog(_EGL_INFO, "platform_x11.c: calling dri2_initialize_x11_dri3\n");
+ initialized = dri2_initialize_x11_dri3(drv, disp);
++ if (initialized)
++ _eglLog(_EGL_INFO, "platform_x11.c: initialized by dri2_initialize_x11_dri3\n");
++ }
+ #endif
+
+ if (!initialized)
Index: pkgsrc/graphics/MesaLib/patches/patch-src_glx_glxcurrent.c
diff -u pkgsrc/graphics/MesaLib/patches/patch-src_glx_glxcurrent.c:1.2 pkgsrc/graphics/MesaLib/patches/patch-src_glx_glxcurrent.c:1.3
--- pkgsrc/graphics/MesaLib/patches/patch-src_glx_glxcurrent.c:1.2 Sat Sep 26 08:45:02 2015
+++ pkgsrc/graphics/MesaLib/patches/patch-src_glx_glxcurrent.c Wed Aug 21 13:35:28 2019
@@ -1,14 +1,14 @@
-$NetBSD: patch-src_glx_glxcurrent.c,v 1.2 2015/09/26 08:45:02 tnn Exp $
+$NetBSD: patch-src_glx_glxcurrent.c,v 1.3 2019/08/21 13:35:28 nia Exp $
Interim fix for toolchain/50277.
NetBSD only supports zero-initialized initial-exec tls variables in conjuction
with dlopen(3) at the moment.
---- src/glx/glxcurrent.c.orig 2015-09-02 17:06:23.000000000 +0000
+--- src/glx/glxcurrent.c.orig 2018-02-09 02:17:59.000000000 +0000
+++ src/glx/glxcurrent.c
@@ -40,6 +40,18 @@
- #include "glapi.h"
+ #include "glx_error.h"
/*
+ * MASSIVE KLUDGE!
Index: pkgsrc/graphics/MesaLib/patches/patch-src_mapi_entry__x86-64__tls.h
diff -u pkgsrc/graphics/MesaLib/patches/patch-src_mapi_entry__x86-64__tls.h:1.2 pkgsrc/graphics/MesaLib/patches/patch-src_mapi_entry__x86-64__tls.h:1.3
--- pkgsrc/graphics/MesaLib/patches/patch-src_mapi_entry__x86-64__tls.h:1.2 Sat Sep 26 08:45:02 2015
+++ pkgsrc/graphics/MesaLib/patches/patch-src_mapi_entry__x86-64__tls.h Wed Aug 21 13:35:28 2019
@@ -1,17 +1,20 @@
-$NetBSD: patch-src_mapi_entry__x86-64__tls.h,v 1.2 2015/09/26 08:45:02 tnn Exp $
+$NetBSD: patch-src_mapi_entry__x86-64__tls.h,v 1.3 2019/08/21 13:35:28 nia Exp $
NetBSD only supports zero-initialized initial-exec tls variables in conjuction
with dlopen(3) at the moment.
Fix --enable-glx-tls with clang. From FreeBSD.
---- src/mapi/entry_x86-64_tls.h.orig 2015-09-11 17:41:47.000000000 +0000
+table_noop_array is only defined for shared-glapi.
+es1api and es2api are not going to be patched for NetBSD.
+
+--- src/mapi/entry_x86-64_tls.h.orig 2017-11-20 14:25:47.000000000 +0000
+++ src/mapi/entry_x86-64_tls.h
-@@ -36,10 +36,19 @@ __asm__(".text\n"
- ".balign 32\n" \
- func ":"
+@@ -43,10 +43,19 @@ __asm__(".text\n"
+
+ #ifndef __ILP32__
-+#ifdef __NetBSD__
++#if defined(__NetBSD__) && defined(MAPI_MODE_GLAPI)
#define STUB_ASM_CODE(slot) \
"movq " ENTRY_CURRENT_TABLE "@GOTTPOFF(%rip), %rax\n\t" \
"movq %fs:(%rax), %r11\n\t" \
@@ -25,16 +28,5 @@ Fix --enable-glx-tls with clang. From Fr
+ "jmp *(8 * " slot ")(%r11)"
+#endif
- #define MAPI_TMP_STUB_ASM_GCC
- #include "mapi_tmp.h"
-@@ -61,8 +70,8 @@ entry_patch_public(void)
- {
- }
-
--static char
--x86_64_entry_start[];
-+extern char
-+x86_64_entry_start[] __attribute__((visibility("hidden")));
+ #else
- mapi_func
- entry_get_public(int slot)
Index: pkgsrc/graphics/MesaLib/patches/patch-src_mapi_entry__x86__tls.h
diff -u pkgsrc/graphics/MesaLib/patches/patch-src_mapi_entry__x86__tls.h:1.2 pkgsrc/graphics/MesaLib/patches/patch-src_mapi_entry__x86__tls.h:1.3
--- pkgsrc/graphics/MesaLib/patches/patch-src_mapi_entry__x86__tls.h:1.2 Sat Sep 26 08:45:02 2015
+++ pkgsrc/graphics/MesaLib/patches/patch-src_mapi_entry__x86__tls.h Wed Aug 21 13:35:28 2019
@@ -1,17 +1,20 @@
-$NetBSD: patch-src_mapi_entry__x86__tls.h,v 1.2 2015/09/26 08:45:02 tnn Exp $
+$NetBSD: patch-src_mapi_entry__x86__tls.h,v 1.3 2019/08/21 13:35:28 nia Exp $
NetBSD only supports zero-initialized initial-exec tls variables in conjuction
with dlopen(3) at the moment.
Fix --enable-glx-tls with clang. From FreeBSD.
---- src/mapi/entry_x86_tls.h.orig 2015-09-02 17:06:23.000000000 +0000
+table_noop_array is only defined for shared-glapi.
+es1api and es2api are not going to be patched for NetBSD.
+
+--- src/mapi/entry_x86_tls.h.orig 2018-01-18 21:30:29.000000000 +0000
+++ src/mapi/entry_x86_tls.h
-@@ -50,10 +50,27 @@ __asm__(".balign 16\n"
+@@ -56,10 +56,27 @@ __asm__(".balign 16\n"
".balign 16\n" \
func ":"
-+#ifdef __NetBSD__
++#if defined(__NetBSD__) && defined(MAPI_MODE_GLAPI)
+extern const mapi_func table_noop_array[];
#define STUB_ASM_CODE(slot) \
"call x86_current_tls\n\t" \
@@ -35,14 +38,3 @@ Fix --enable-glx-tls with clang. From Fr
#define MAPI_TMP_STUB_ASM_GCC
#include "mapi_tmp.h"
-@@ -71,8 +88,8 @@ __asm__(".text");
- extern unsigned long
- x86_current_tls();
-
--static char x86_entry_start[];
--static char x86_entry_end[];
-+extern char x86_entry_start[] __attribute__((visibility("hidden")));
-+extern char x86_entry_end[] __attribute__((visibility("hidden")));
-
- void
- entry_patch_public(void)
Index: pkgsrc/graphics/MesaLib/patches/patch-src_mesa_drivers_dri_i915_intel__screen.c
diff -u pkgsrc/graphics/MesaLib/patches/patch-src_mesa_drivers_dri_i915_intel__screen.c:1.2 pkgsrc/graphics/MesaLib/patches/patch-src_mesa_drivers_dri_i915_intel__screen.c:1.3
--- pkgsrc/graphics/MesaLib/patches/patch-src_mesa_drivers_dri_i915_intel__screen.c:1.2 Sun Jun 7 15:48:12 2015
+++ pkgsrc/graphics/MesaLib/patches/patch-src_mesa_drivers_dri_i915_intel__screen.c Wed Aug 21 13:35:28 2019
@@ -1,25 +1,30 @@
-$NetBSD: patch-src_mesa_drivers_dri_i915_intel__screen.c,v 1.2 2015/06/07 15:48:12 tnn Exp $
+$NetBSD: patch-src_mesa_drivers_dri_i915_intel__screen.c,v 1.3 2019/08/21 13:35:28 nia Exp $
+
+Move sys/sysctl.h include because on NetBSD, sysctl.h includes sys/param.h,
+and sys/param.h defines a one argument ALIGN. Allows mesa to redefine
+to a two argument ALIGN.
Fix build on older NetBSD w/o _SC_PHYS_PAGES.
---- src/mesa/drivers/dri/i915/intel_screen.c.orig 2015-06-07 10:06:53.000000000 +0000
+--- src/mesa/drivers/dri/i915/intel_screen.c.orig 2017-11-10 23:18:56.000000000 +0000
+++ src/mesa/drivers/dri/i915/intel_screen.c
-@@ -41,6 +41,10 @@
- #include "utils.h"
- #include "xmlpool.h"
-
-+#ifdef HAVE_SYS_SYSCTL_H
+@@ -28,6 +28,11 @@
+ #include <errno.h>
+ #include <time.h>
+ #include <unistd.h>
++
++#if defined(HAVE_SYS_SYSCTL_H) && defined(__NetBSD__)
+# include <sys/sysctl.h>
+#endif
+
- static const __DRIconfigOptionsExtension i915_config_options = {
- .base = { __DRI_CONFIG_OPTIONS, 1 },
- .xml =
-@@ -732,6 +736,13 @@ i915_query_renderer_integer(__DRIscreen
+ #include "main/glheader.h"
+ #include "main/context.h"
+ #include "main/framebuffer.h"
+@@ -739,6 +744,13 @@ i915_query_renderer_integer(__DRIscreen
const unsigned gpu_mappable_megabytes =
(aper_size / (1024 * 1024)) * 3 / 4;
-+#if defined(HW_PHYSMEM64)
++#if defined(HW_PHYSMEM64) && defined(__NetBSD__)
+ int mib[2] = { CTL_HW, HW_PHYSMEM64 };
+ uint64_t system_memory_bytes;
+ size_t len = sizeof(system_memory_bytes);
@@ -29,7 +34,7 @@ Fix build on older NetBSD w/o _SC_PHYS_P
const long system_memory_pages = sysconf(_SC_PHYS_PAGES);
const long system_page_size = sysconf(_SC_PAGE_SIZE);
-@@ -740,6 +751,7 @@ i915_query_renderer_integer(__DRIscreen
+@@ -747,6 +759,7 @@ i915_query_renderer_integer(__DRIscreen
const uint64_t system_memory_bytes = (uint64_t) system_memory_pages
* (uint64_t) system_page_size;
Index: pkgsrc/graphics/MesaLib/patches/patch-src_mesa_drivers_dri_i965_intel__screen.c
diff -u pkgsrc/graphics/MesaLib/patches/patch-src_mesa_drivers_dri_i965_intel__screen.c:1.2 pkgsrc/graphics/MesaLib/patches/patch-src_mesa_drivers_dri_i965_intel__screen.c:1.3
--- pkgsrc/graphics/MesaLib/patches/patch-src_mesa_drivers_dri_i965_intel__screen.c:1.2 Sun Jun 7 15:48:12 2015
+++ pkgsrc/graphics/MesaLib/patches/patch-src_mesa_drivers_dri_i965_intel__screen.c Wed Aug 21 13:35:28 2019
@@ -1,25 +1,30 @@
-$NetBSD: patch-src_mesa_drivers_dri_i965_intel__screen.c,v 1.2 2015/06/07 15:48:12 tnn Exp $
+$NetBSD: patch-src_mesa_drivers_dri_i965_intel__screen.c,v 1.3 2019/08/21 13:35:28 nia Exp $
+
+Move sys/sysctl.h include because on NetBSD, sysctl.h includes sys/param.h,
+and sys/param.h defines a one argument ALIGN. Allows mesa to redefine
+to a two argument ALIGN.
Fix build on older NetBSD w/o _SC_PHYS_PAGES.
---- src/mesa/drivers/dri/i965/intel_screen.c.orig 2015-06-07 10:06:53.000000000 +0000
+--- src/mesa/drivers/dri/i965/intel_screen.c.orig 2017-11-10 23:18:56.000000000 +0000
+++ src/mesa/drivers/dri/i965/intel_screen.c
-@@ -42,6 +42,10 @@
- #include "utils.h"
- #include "xmlpool.h"
-
-+#ifdef HAVE_SYS_SYSCTL_H
+@@ -27,6 +27,11 @@
+ #include <errno.h>
+ #include <time.h>
+ #include <unistd.h>
++
++#if defined(HAVE_SYS_SYSCTL_H) && defined(__NetBSD__)
+# include <sys/sysctl.h>
+#endif
+
- static const __DRIconfigOptionsExtension brw_config_options = {
- .base = { __DRI_CONFIG_OPTIONS, 1 },
- .xml =
-@@ -829,6 +833,13 @@ brw_query_renderer_integer(__DRIscreen *
+ #include "main/context.h"
+ #include "main/framebuffer.h"
+ #include "main/renderbuffer.h"
+@@ -1220,6 +1225,13 @@ brw_query_renderer_integer(__DRIscreen *
const unsigned gpu_mappable_megabytes =
- (aper_size / (1024 * 1024)) * 3 / 4;
+ screen->aperture_threshold / (1024 * 1024);
-+#if defined(HW_PHYSMEM64)
++#if defined(HW_PHYSMEM64) && defined(__NetBSD__)
+ int mib[2] = { CTL_HW, HW_PHYSMEM64 };
+ const uint64_t system_memory_bytes;
+ size_t len = sizeof(system_memory_bytes);
@@ -29,7 +34,7 @@ Fix build on older NetBSD w/o _SC_PHYS_P
const long system_memory_pages = sysconf(_SC_PHYS_PAGES);
const long system_page_size = sysconf(_SC_PAGE_SIZE);
-@@ -837,6 +848,7 @@ brw_query_renderer_integer(__DRIscreen *
+@@ -1228,6 +1240,7 @@ brw_query_renderer_integer(__DRIscreen *
const uint64_t system_memory_bytes = (uint64_t) system_memory_pages
* (uint64_t) system_page_size;
Index: pkgsrc/graphics/MesaLib/patches/patch-src_mesa_drivers_dri_swrast_swrast.c
diff -u pkgsrc/graphics/MesaLib/patches/patch-src_mesa_drivers_dri_swrast_swrast.c:1.2 pkgsrc/graphics/MesaLib/patches/patch-src_mesa_drivers_dri_swrast_swrast.c:1.3
--- pkgsrc/graphics/MesaLib/patches/patch-src_mesa_drivers_dri_swrast_swrast.c:1.2 Sun Jun 7 15:48:12 2015
+++ pkgsrc/graphics/MesaLib/patches/patch-src_mesa_drivers_dri_swrast_swrast.c Wed Aug 21 13:35:28 2019
@@ -1,14 +1,14 @@
-$NetBSD: patch-src_mesa_drivers_dri_swrast_swrast.c,v 1.2 2015/06/07 15:48:12 tnn Exp $
+$NetBSD: patch-src_mesa_drivers_dri_swrast_swrast.c,v 1.3 2019/08/21 13:35:28 nia Exp $
Fix build on older NetBSD w/o _SC_PHYS_PAGES.
---- src/mesa/drivers/dri/swrast/swrast.c.orig 2015-06-07 10:06:53.000000000 +0000
+--- src/mesa/drivers/dri/swrast/swrast.c.orig 2017-10-19 12:23:53.000000000 +0000
+++ src/mesa/drivers/dri/swrast/swrast.c
-@@ -150,6 +150,12 @@ swrast_query_renderer_integer(__DRIscree
+@@ -151,6 +151,12 @@ swrast_query_renderer_integer(__DRIscree
size_t len = sizeof(system_memory_bytes);
if (sysctl(mib, 2, &system_memory_bytes, &len, NULL, 0) != 0)
return -1;
-+#elif defined(HW_PHYSMEM64)
++#elif defined(HW_PHYSMEM64) && defined(__NetBSD__)
+ int mib[2] = { CTL_HW, HW_PHYSMEM64 };
+ uint64_t system_memory_bytes;
+ size_t len = sizeof(system_memory_bytes);
Index: pkgsrc/graphics/MesaLib/patches/patch-src_mesa_x86_common__x86.c
diff -u pkgsrc/graphics/MesaLib/patches/patch-src_mesa_x86_common__x86.c:1.2 pkgsrc/graphics/MesaLib/patches/patch-src_mesa_x86_common__x86.c:1.3
--- pkgsrc/graphics/MesaLib/patches/patch-src_mesa_x86_common__x86.c:1.2 Fri Sep 11 00:03:36 2015
+++ pkgsrc/graphics/MesaLib/patches/patch-src_mesa_x86_common__x86.c Wed Aug 21 13:35:28 2019
@@ -1,19 +1,19 @@
-$NetBSD: patch-src_mesa_x86_common__x86.c,v 1.2 2015/09/11 00:03:36 tnn Exp $
+$NetBSD: patch-src_mesa_x86_common__x86.c,v 1.3 2019/08/21 13:35:28 nia Exp $
DragonFly support.
---- src/mesa/x86/common_x86.c.orig 2015-07-14 18:10:47.000000000 +0000
+--- src/mesa/x86/common_x86.c.orig 2017-05-10 14:13:58.000000000 +0000
+++ src/mesa/x86/common_x86.c
-@@ -38,7 +38,7 @@
- #if defined(USE_SSE_ASM) && defined(__linux__)
- #include <linux/version.h>
- #endif
+@@ -35,7 +35,7 @@
+ */
+
+ /* XXX these includes should probably go into imports.h or glheader.h */
-#if defined(USE_SSE_ASM) && defined(__FreeBSD__)
+#if defined(USE_SSE_ASM) && (defined(__FreeBSD__) || defined(__DragonFly__))
#include <sys/types.h>
#include <sys/sysctl.h>
#endif
-@@ -128,7 +128,7 @@ static LONG WINAPI ExceptionFilter(LPEXC
+@@ -125,7 +125,7 @@ static LONG WINAPI ExceptionFilter(LPEXC
*/
void _mesa_check_os_sse_support( void )
{
Index: pkgsrc/graphics/MesaLib/patches/patch-src_egl_main_eglglobals.c
diff -u pkgsrc/graphics/MesaLib/patches/patch-src_egl_main_eglglobals.c:1.1 pkgsrc/graphics/MesaLib/patches/patch-src_egl_main_eglglobals.c:1.2
--- pkgsrc/graphics/MesaLib/patches/patch-src_egl_main_eglglobals.c:1.1 Wed Jan 27 07:39:54 2016
+++ pkgsrc/graphics/MesaLib/patches/patch-src_egl_main_eglglobals.c Wed Aug 21 13:35:28 2019
@@ -1,40 +1,53 @@
-$NetBSD: patch-src_egl_main_eglglobals.c,v 1.1 2016/01/27 07:39:54 wiz Exp $
+$NetBSD: patch-src_egl_main_eglglobals.c,v 1.2 2019/08/21 13:35:28 nia Exp $
atexit() is not a good idea in shared libraries.
---- src/egl/main/eglglobals.c.orig 2015-11-28 17:37:59.000000000 +0000
+FreeBSD reported atexit bug for 10.6:
+https://bugs.freedesktop.org/show_bug.cgi?id=91869
+
+--- src/egl/main/eglglobals.c.orig 2018-01-18 21:30:28.000000000 +0000
+++ src/egl/main/eglglobals.c
-@@ -59,11 +59,16 @@ struct _egl_global _eglGlobal =
- " EGL_MESA_platform_gbm"
+@@ -85,11 +85,22 @@ struct _egl_global _eglGlobal =
+ .debugTypesEnabled = _EGL_DEBUG_BIT_CRITICAL | _EGL_DEBUG_BIT_ERROR,
};
++#if defined(HAVE_NOATEXIT)
+static EGLBoolean registered = EGL_FALSE;
--static void
+static void __attribute__((__destructor__))
++#else
+ static void
++#endif
_eglAtExit(void)
{
EGLint i;
+
++#if defined(HAVE_NOATEXIT)
+ if (!registered)
-+ return;
++ return;
++#endif
+
for (i = _eglGlobal.NumAtExitCalls - 1; i >= 0; i--)
_eglGlobal.AtExitCalls[i]();
}
-@@ -73,14 +78,9 @@ void
+@@ -99,14 +110,20 @@ void
_eglAddAtExitCall(void (*func)(void))
{
if (func) {
-- static EGLBoolean registered = EGL_FALSE;
--
++#if !defined(HAVE_NOATEXIT)
+ static EGLBoolean registered = EGL_FALSE;
++#endif
+
mtx_lock(_eglGlobal.Mutex);
-- if (!registered) {
-- atexit(_eglAtExit);
-- registered = EGL_TRUE;
-- }
++#if defined(HAVE_NOATEXIT)
+ registered = EGL_TRUE;
++#else
+ if (!registered) {
+ atexit(_eglAtExit);
+ registered = EGL_TRUE;
+ }
++#endif
assert(_eglGlobal.NumAtExitCalls < ARRAY_SIZE(_eglGlobal.AtExitCalls));
_eglGlobal.AtExitCalls[_eglGlobal.NumAtExitCalls++] = func;
Index: pkgsrc/graphics/MesaLib/patches/patch-src_gallium_auxiliary_util_u__format__tests.c
diff -u pkgsrc/graphics/MesaLib/patches/patch-src_gallium_auxiliary_util_u__format__tests.c:1.1 pkgsrc/graphics/MesaLib/patches/patch-src_gallium_auxiliary_util_u__format__tests.c:1.2
--- pkgsrc/graphics/MesaLib/patches/patch-src_gallium_auxiliary_util_u__format__tests.c:1.1 Sat Apr 25 11:19:18 2015
+++ pkgsrc/graphics/MesaLib/patches/patch-src_gallium_auxiliary_util_u__format__tests.c Wed Aug 21 13:35:28 2019
@@ -1,4 +1,4 @@
-$NetBSD: patch-src_gallium_auxiliary_util_u__format__tests.c,v 1.1 2015/04/25 11:19:18 tnn Exp $
+$NetBSD: patch-src_gallium_auxiliary_util_u__format__tests.c,v 1.2 2019/08/21 13:35:28 nia Exp $
On old NetBSD, NAN in math.h is __nanf.__val. Which is not constant.
Index: pkgsrc/graphics/MesaLib/patches/patch-src_gallium_drivers_nouveau_nouveau__vp3__video.c
diff -u pkgsrc/graphics/MesaLib/patches/patch-src_gallium_drivers_nouveau_nouveau__vp3__video.c:1.1 pkgsrc/graphics/MesaLib/patches/patch-src_gallium_drivers_nouveau_nouveau__vp3__video.c:1.2
--- pkgsrc/graphics/MesaLib/patches/patch-src_gallium_drivers_nouveau_nouveau__vp3__video.c:1.1 Sat Apr 25 11:19:18 2015
+++ pkgsrc/graphics/MesaLib/patches/patch-src_gallium_drivers_nouveau_nouveau__vp3__video.c Wed Aug 21 13:35:28 2019
@@ -1,10 +1,10 @@
-$NetBSD: patch-src_gallium_drivers_nouveau_nouveau__vp3__video.c,v 1.1 2015/04/25 11:19:18 tnn Exp $
+$NetBSD: patch-src_gallium_drivers_nouveau_nouveau__vp3__video.c,v 1.2 2019/08/21 13:35:28 nia Exp $
Fix build on platforms without close-on-exec.
---- src/gallium/drivers/nouveau/nouveau_vp3_video.c.orig 2014-09-12 21:30:32.000000000 +0000
+--- src/gallium/drivers/nouveau/nouveau_vp3_video.c.orig 2017-02-13 11:55:49.000000000 +0000
+++ src/gallium/drivers/nouveau/nouveau_vp3_video.c
-@@ -292,7 +292,11 @@ nouveau_vp3_load_firmware(struct nouveau
+@@ -294,7 +294,11 @@ nouveau_vp3_load_firmware(struct nouveau
if (nouveau_bo_map(dec->fw_bo, NOUVEAU_BO_WR, dec->client))
return 1;
Index: pkgsrc/graphics/MesaLib/patches/patch-src_gallium_drivers_nouveau_nv50_nv84__video.c
diff -u pkgsrc/graphics/MesaLib/patches/patch-src_gallium_drivers_nouveau_nv50_nv84__video.c:1.1 pkgsrc/graphics/MesaLib/patches/patch-src_gallium_drivers_nouveau_nv50_nv84__video.c:1.2
--- pkgsrc/graphics/MesaLib/patches/patch-src_gallium_drivers_nouveau_nv50_nv84__video.c:1.1 Sat Apr 25 11:19:18 2015
+++ pkgsrc/graphics/MesaLib/patches/patch-src_gallium_drivers_nouveau_nv50_nv84__video.c Wed Aug 21 13:35:28 2019
@@ -1,4 +1,4 @@
-$NetBSD: patch-src_gallium_drivers_nouveau_nv50_nv84__video.c,v 1.1 2015/04/25 11:19:18 tnn Exp $
+$NetBSD: patch-src_gallium_drivers_nouveau_nv50_nv84__video.c,v 1.2 2019/08/21 13:35:28 nia Exp $
Fix build on platforms without close-on-exec.
Index: pkgsrc/graphics/MesaLib/patches/patch-src_glx_apple_apple__glapi.c
diff -u pkgsrc/graphics/MesaLib/patches/patch-src_glx_apple_apple__glapi.c:1.1 pkgsrc/graphics/MesaLib/patches/patch-src_glx_apple_apple__glapi.c:1.2
--- pkgsrc/graphics/MesaLib/patches/patch-src_glx_apple_apple__glapi.c:1.1 Sun Sep 27 21:58:03 2015
+++ pkgsrc/graphics/MesaLib/patches/patch-src_glx_apple_apple__glapi.c Wed Aug 21 13:35:28 2019
@@ -1,9 +1,9 @@
-$NetBSD: patch-src_glx_apple_apple__glapi.c,v 1.1 2015/09/27 21:58:03 tnn Exp $
+$NetBSD: patch-src_glx_apple_apple__glapi.c,v 1.2 2019/08/21 13:35:28 nia Exp $
https://bugs.freedesktop.org/show_bug.cgi?id=90311
See also hacks.mk.
---- src/glx/apple/apple_glapi.c.orig 2015-08-07 17:36:03.000000000 +0000
+--- src/glx/apple/apple_glapi.c.orig 2018-02-09 02:17:59.000000000 +0000
+++ src/glx/apple/apple_glapi.c
@@ -39,6 +39,7 @@
#include <GL/gl.h>
@@ -12,8 +12,8 @@ See also hacks.mk.
+#include "main/remap.h"
#include "glapi.h"
#include "glapitable.h"
- #include "main/dispatch.h"
-@@ -54,6 +55,8 @@ static void _apple_glapi_create_table(vo
+
+@@ -53,6 +54,8 @@ static void _apple_glapi_create_table(vo
if (__applegl_api)
return;
Index: pkgsrc/graphics/MesaLib/patches/patch-src_glx_glxclient.h
diff -u pkgsrc/graphics/MesaLib/patches/patch-src_glx_glxclient.h:1.1 pkgsrc/graphics/MesaLib/patches/patch-src_glx_glxclient.h:1.2
--- pkgsrc/graphics/MesaLib/patches/patch-src_glx_glxclient.h:1.1 Fri Sep 11 16:27:30 2015
+++ pkgsrc/graphics/MesaLib/patches/patch-src_glx_glxclient.h Wed Aug 21 13:35:28 2019
@@ -1,11 +1,11 @@
-$NetBSD: patch-src_glx_glxclient.h,v 1.1 2015/09/11 16:27:30 tnn Exp $
+$NetBSD: patch-src_glx_glxclient.h,v 1.2 2019/08/21 13:35:28 nia Exp $
NetBSD only supports zero-initialized initial-exec tls variables in conjuction
with dlopen(3) at the moment.
---- src/glx/glxclient.h.orig 2015-09-02 17:06:23.000000000 +0000
+--- src/glx/glxclient.h.orig 2017-02-13 11:55:49.000000000 +0000
+++ src/glx/glxclient.h
-@@ -635,7 +635,11 @@ extern void __glXSetCurrentContext(struc
+@@ -661,7 +661,11 @@ extern void __glXSetCurrentContext(struc
extern __thread void *__glX_tls_Context
__attribute__ ((tls_model("initial-exec")));
Index: pkgsrc/graphics/MesaLib/patches/patch-src_mapi_glapi_gen_gl__gentable.py
diff -u pkgsrc/graphics/MesaLib/patches/patch-src_mapi_glapi_gen_gl__gentable.py:1.1 pkgsrc/graphics/MesaLib/patches/patch-src_mapi_glapi_gen_gl__gentable.py:1.2
--- pkgsrc/graphics/MesaLib/patches/patch-src_mapi_glapi_gen_gl__gentable.py:1.1 Fri Sep 11 00:03:36 2015
+++ pkgsrc/graphics/MesaLib/patches/patch-src_mapi_glapi_gen_gl__gentable.py Wed Aug 21 13:35:28 2019
@@ -1,10 +1,10 @@
-$NetBSD: patch-src_mapi_glapi_gen_gl__gentable.py,v 1.1 2015/09/11 00:03:36 tnn Exp $
+$NetBSD: patch-src_mapi_glapi_gen_gl__gentable.py,v 1.2 2019/08/21 13:35:28 nia Exp $
FreeBSD support.
---- src/mapi/glapi/gen/gl_gentable.py.orig 2015-07-29 21:28:50.156039000 +0000
+--- src/mapi/glapi/gen/gl_gentable.py.orig 2017-02-13 11:55:49.000000000 +0000
+++ src/mapi/glapi/gen/gl_gentable.py
-@@ -42,7 +42,7 @@ header = """/* GLXEXT is the define used
+@@ -44,7 +44,7 @@ header = """/* GLXEXT is the define used
#endif
#if (defined(GLXEXT) && defined(HAVE_BACKTRACE)) \\
Index: pkgsrc/graphics/MesaLib/patches/patch-src_mapi_u__current.c
diff -u pkgsrc/graphics/MesaLib/patches/patch-src_mapi_u__current.c:1.1 pkgsrc/graphics/MesaLib/patches/patch-src_mapi_u__current.c:1.2
--- pkgsrc/graphics/MesaLib/patches/patch-src_mapi_u__current.c:1.1 Fri Sep 11 16:27:30 2015
+++ pkgsrc/graphics/MesaLib/patches/patch-src_mapi_u__current.c Wed Aug 21 13:35:28 2019
@@ -1,4 +1,4 @@
-$NetBSD: patch-src_mapi_u__current.c,v 1.1 2015/09/11 16:27:30 tnn Exp $
+$NetBSD: patch-src_mapi_u__current.c,v 1.2 2019/08/21 13:35:28 nia Exp $
NetBSD only supports zero-initialized initial-exec tls variables in conjuction
with dlopen(3) at the moment.
@@ -7,25 +7,25 @@ with dlopen(3) at the moment.
+++ src/mapi/u_current.c
@@ -101,7 +101,11 @@ extern void (*__glapi_noop_table[])(void
- __thread struct mapi_table *u_current_table
+ __thread struct _glapi_table *u_current_table
__attribute__((tls_model("initial-exec")))
+#if defined(__NetBSD__)
+ = NULL; /* non-zero initializers not supported with dlopen */
+#else
- = (struct mapi_table *) table_noop_array;
+ = (struct _glapi_table *) table_noop_array;
+#endif
__thread void *u_current_context
__attribute__((tls_model("initial-exec")));
-@@ -283,7 +287,11 @@ struct mapi_table *
+@@ -283,7 +287,11 @@ struct _glapi_table *
u_current_get_table_internal(void)
{
#if defined(GLX_USE_TLS)
+# if defined(__NetBSD__)
-+ return (likely(u_current_table) ? u_current_table : (struct mapi_table *) table_noop_array);
++ return (likely(u_current_table) ? u_current_table : (struct _glapi_table *) table_noop_array);
+# else
return u_current_table;
+# endif
#else
if (ThreadSafe)
- return (struct mapi_table *) tss_get(u_current_table_tsd);
+ return (struct _glapi_table *) tss_get(u_current_table_tsd);
Index: pkgsrc/graphics/MesaLib/patches/patch-src_mapi_u__current.h
diff -u pkgsrc/graphics/MesaLib/patches/patch-src_mapi_u__current.h:1.1 pkgsrc/graphics/MesaLib/patches/patch-src_mapi_u__current.h:1.2
--- pkgsrc/graphics/MesaLib/patches/patch-src_mapi_u__current.h:1.1 Fri Sep 11 16:27:30 2015
+++ pkgsrc/graphics/MesaLib/patches/patch-src_mapi_u__current.h Wed Aug 21 13:35:28 2019
@@ -1,4 +1,4 @@
-$NetBSD: patch-src_mapi_u__current.h,v 1.1 2015/09/11 16:27:30 tnn Exp $
+$NetBSD: patch-src_mapi_u__current.h,v 1.2 2019/08/21 13:35:28 nia Exp $
NetBSD only supports zero-initialized initial-exec tls variables in conjuction
with dlopen(3) at the moment.
@@ -6,7 +6,7 @@ with dlopen(3) at the moment.
--- src/mapi/u_current.h.orig 2015-09-02 17:06:23.000000000 +0000
+++ src/mapi/u_current.h
@@ -68,7 +68,7 @@ u_current_get_context_internal(void);
- static inline const struct mapi_table *
+ static inline const struct _glapi_table *
u_current_get_table(void)
{
-#ifdef GLX_USE_TLS
Index: pkgsrc/graphics/MesaLib/patches/patch-src_mesa_main_extensions.c
diff -u pkgsrc/graphics/MesaLib/patches/patch-src_mesa_main_extensions.c:1.1 pkgsrc/graphics/MesaLib/patches/patch-src_mesa_main_extensions.c:1.2
--- pkgsrc/graphics/MesaLib/patches/patch-src_mesa_main_extensions.c:1.1 Wed Jan 27 07:39:54 2016
+++ pkgsrc/graphics/MesaLib/patches/patch-src_mesa_main_extensions.c Wed Aug 21 13:35:28 2019
@@ -1,24 +1,31 @@
-$NetBSD: patch-src_mesa_main_extensions.c,v 1.1 2016/01/27 07:39:54 wiz Exp $
+$NetBSD: patch-src_mesa_main_extensions.c,v 1.2 2019/08/21 13:35:28 nia Exp $
atexit() is not a good idea in shared libraries.
---- src/mesa/main/extensions.c.orig 2016-01-07 16:17:53.000000000 +0000
+FreeBSD reported atexit bug for 10.6:
+https://bugs.freedesktop.org/show_bug.cgi?id=91869
+
+--- src/mesa/main/extensions.c.orig 2018-02-09 02:17:59.000000000 +0000
+++ src/mesa/main/extensions.c
-@@ -256,7 +256,7 @@ get_extension_override( struct gl_contex
- * These strings are allocated early during the first context creation by
+@@ -203,7 +203,11 @@ set_extension(struct gl_extensions *ext,
+ * This string is allocated early during the first context creation by
* _mesa_one_time_init_extension_overrides.
*/
--static void
++#if defined(HAVE_NOATEXIT)
+static void __attribute__((__destructor__))
++#else
+ static void
++#endif
free_unknown_extensions_strings(void)
{
- free(extra_extensions);
-@@ -277,7 +277,7 @@ _mesa_one_time_init_extension_overrides(
- int len;
- size_t offset;
-
-- atexit(free_unknown_extensions_strings);
-+ /* atexit(free_unknown_extensions_strings); */
+ free(unrecognized_extensions);
+@@ -293,7 +297,9 @@ _mesa_one_time_init_extension_overrides(
+ free(env);
+ } else {
+ unrecognized_extensions = env;
++#if !defined(HAVE_NOATEXIT)
+ atexit(free_unknown_extensions_strings);
++#endif
+ }
+ }
- memset(&_mesa_extension_override_enables, 0, sizeof(struct gl_extensions));
- memset(&_mesa_extension_override_disables, 0, sizeof(struct gl_extensions));
Index: pkgsrc/graphics/MesaLib/patches/patch-src_mesa_main_macros.h
diff -u pkgsrc/graphics/MesaLib/patches/patch-src_mesa_main_macros.h:1.1 pkgsrc/graphics/MesaLib/patches/patch-src_mesa_main_macros.h:1.2
--- pkgsrc/graphics/MesaLib/patches/patch-src_mesa_main_macros.h:1.1 Tue Jan 5 13:02:57 2016
+++ pkgsrc/graphics/MesaLib/patches/patch-src_mesa_main_macros.h Wed Aug 21 13:35:28 2019
@@ -1,14 +1,16 @@
-$NetBSD: patch-src_mesa_main_macros.h,v 1.1 2016/01/05 13:02:57 tnn Exp $
+$NetBSD: patch-src_mesa_main_macros.h,v 1.2 2019/08/21 13:35:28 nia Exp $
ALIGN is also defined in sys/param.h on NetBSD.
---- src/mesa/main/macros.h.orig 2015-12-09 16:10:13.000000000 +0000
+Extend undefining ALIGN to all other OSes.
+
+--- src/mesa/main/macros.h.orig 2017-11-10 23:18:56.000000000 +0000
+++ src/mesa/main/macros.h
-@@ -690,6 +690,9 @@ minify(unsigned value, unsigned levels)
+@@ -677,6 +677,9 @@ minify(unsigned value, unsigned levels)
*
* \sa ROUND_DOWN_TO()
*/
-+#if defined(__NetBSD__)
++#ifdef ALIGN
+#undef ALIGN
+#endif
static inline uintptr_t
Index: pkgsrc/graphics/MesaLib/patches/patch-src_mesa_main_shader__query.cpp
diff -u pkgsrc/graphics/MesaLib/patches/patch-src_mesa_main_shader__query.cpp:1.1 pkgsrc/graphics/MesaLib/patches/patch-src_mesa_main_shader__query.cpp:1.2
--- pkgsrc/graphics/MesaLib/patches/patch-src_mesa_main_shader__query.cpp:1.1 Sat May 16 16:39:52 2015
+++ pkgsrc/graphics/MesaLib/patches/patch-src_mesa_main_shader__query.cpp Wed Aug 21 13:35:28 2019
@@ -1,4 +1,4 @@
-$NetBSD: patch-src_mesa_main_shader__query.cpp,v 1.1 2015/05/16 16:39:52 tnn Exp $
+$NetBSD: patch-src_mesa_main_shader__query.cpp,v 1.2 2019/08/21 13:35:28 nia Exp $
https://bugs.freedesktop.org/show_bug.cgi?id=66346
@@ -15,34 +15,44 @@ https://bugs.freedesktop.org/show_bug.cg
src/mesa/main/shader_query.cpp | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
-diff --git a/src/mesa/main/shader_query.cpp b/src/mesa/main/shader_query.cpp
-index bc6fec5..22d9e0f 100644
---- src/mesa/main/shader_query.cpp
+--- src/mesa/main/shader_query.cpp.orig 2016-11-10 22:05:17.000000000 +0000
+++ src/mesa/main/shader_query.cpp
-@@ -68,7 +68,7 @@ _mesa_BindAttribLocation(GLhandleARB program, GLuint index,
+@@ -70,7 +70,12 @@ _mesa_BindAttribLocation(GLuint program,
GET_CURRENT_CONTEXT(ctx);
struct gl_shader_program *const shProg =
-- _mesa_lookup_shader_program_err(ctx, program, "glBindAttribLocation");
++#if defined(__APPLE__)
+ _mesa_lookup_shader_program_err(ctx, (GLuint)(uintptr_t)program, "glBindAttribLocation");
++#else
+ _mesa_lookup_shader_program_err(ctx, program, "glBindAttribLocation");
++#endif
++
if (!shProg)
return;
-@@ -136,7 +136,7 @@ _mesa_GetActiveAttrib(GLhandleARB program, GLuint desired_index,
+@@ -114,7 +119,12 @@ _mesa_GetActiveAttrib(GLuint program, GL
return;
}
-- shProg = _mesa_lookup_shader_program_err(ctx, program, "glGetActiveAttrib");
++#if defined(__APPLE__)
+ shProg = _mesa_lookup_shader_program_err(ctx, (GLuint)(uintptr_t)program, "glGetActiveAttrib");
++#else
+ shProg = _mesa_lookup_shader_program_err(ctx, program, "glGetActiveAttrib");
++#endif
++
if (!shProg)
return;
-@@ -250,7 +250,7 @@ _mesa_GetAttribLocation(GLhandleARB program, const GLcharARB * name)
+@@ -159,7 +169,12 @@ _mesa_GetAttribLocation(GLuint program,
{
GET_CURRENT_CONTEXT(ctx);
struct gl_shader_program *const shProg =
-- _mesa_lookup_shader_program_err(ctx, program, "glGetAttribLocation");
++
++#if defined(__APPLE__)
+ _mesa_lookup_shader_program_err(ctx, (GLuint)(uintptr_t)program, "glGetAttribLocation");
++#else
+ _mesa_lookup_shader_program_err(ctx, program, "glGetAttribLocation");
++#endif
if (!shProg) {
return -1;
Index: pkgsrc/graphics/MesaLib/patches/patch-src_util_strndup.h
diff -u pkgsrc/graphics/MesaLib/patches/patch-src_util_strndup.h:1.1 pkgsrc/graphics/MesaLib/patches/patch-src_util_strndup.h:1.2
--- pkgsrc/graphics/MesaLib/patches/patch-src_util_strndup.h:1.1 Tue Feb 23 11:16:55 2016
+++ pkgsrc/graphics/MesaLib/patches/patch-src_util_strndup.h Wed Aug 21 13:35:28 2019
@@ -1,15 +1,15 @@
-$NetBSD: patch-src_util_strndup.h,v 1.1 2016/02/23 11:16:55 jperkin Exp $
+$NetBSD: patch-src_util_strndup.h,v 1.2 2019/08/21 13:35:28 nia Exp $
Provide compat strndup for older Darwin.
---- src/util/strndup.h.orig 2016-01-22 15:44:31.000000000 +0000
+--- src/util/strndup.h.orig 2017-05-10 14:13:58.000000000 +0000
+++ src/util/strndup.h
-@@ -25,7 +25,7 @@
-
- #include <stdlib.h> // size_t
+@@ -24,7 +24,7 @@
+ #ifndef STRNDUP_H
+ #define STRNDUP_H
-#if defined(_WIN32)
+#if defined(_WIN32) || (defined(__APPLE__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__-0 < 1070)
- #ifdef __cplusplus
- extern "C" {
+ #include <stdlib.h> // size_t
+ #include <string.h>
Index: pkgsrc/graphics/MesaLib/patches/patch-src_util_u__atomic.h
diff -u pkgsrc/graphics/MesaLib/patches/patch-src_util_u__atomic.h:1.1 pkgsrc/graphics/MesaLib/patches/patch-src_util_u__atomic.h:1.2
--- pkgsrc/graphics/MesaLib/patches/patch-src_util_u__atomic.h:1.1 Sat Apr 25 11:19:18 2015
+++ pkgsrc/graphics/MesaLib/patches/patch-src_util_u__atomic.h Wed Aug 21 13:35:28 2019
@@ -1,30 +1,15 @@
-$NetBSD: patch-src_util_u__atomic.h,v 1.1 2015/04/25 11:19:18 tnn Exp $
+$NetBSD: patch-src_util_u__atomic.h,v 1.2 2019/08/21 13:35:28 nia Exp $
Fix SunOS atomic macros.
---- src/util/u_atomic.h.orig 2015-03-28 18:20:39.000000000 +0000
+--- src/util/u_atomic.h.orig 2018-09-07 21:18:07.000000000 +0000
+++ src/util/u_atomic.h
-@@ -175,7 +175,7 @@ char _InterlockedCompareExchange8(char v
- sizeof(*v) == sizeof(uint16_t) ? atomic_inc_16((uint16_t *)(v)) : \
- sizeof(*v) == sizeof(uint32_t) ? atomic_inc_32((uint32_t *)(v)) : \
- sizeof(*v) == sizeof(uint64_t) ? atomic_inc_64((uint64_t *)(v)) : \
-- (assert(!"should not get here"), 0))
-+ (assert(!"should not get here"), (void)0))
-
- #define p_atomic_inc_return(v) ((__typeof(*v)) \
- sizeof(*v) == sizeof(uint8_t) ? atomic_inc_8_nv ((uint8_t *)(v)) : \
-@@ -184,12 +184,12 @@ char _InterlockedCompareExchange8(char v
- sizeof(*v) == sizeof(uint64_t) ? atomic_inc_64_nv((uint64_t *)(v)) : \
- (assert(!"should not get here"), 0))
-
--#define p_atomic_dec(v) ((void) \
-+#define p_atomic_dec(v) (void) (\
- sizeof(*v) == sizeof(uint8_t) ? atomic_dec_8 ((uint8_t *)(v)) : \
- sizeof(*v) == sizeof(uint16_t) ? atomic_dec_16((uint16_t *)(v)) : \
- sizeof(*v) == sizeof(uint32_t) ? atomic_dec_32((uint32_t *)(v)) : \
- sizeof(*v) == sizeof(uint64_t) ? atomic_dec_64((uint64_t *)(v)) : \
-- (assert(!"should not get here"), 0))
-+ (assert(!"should not get here"), (void)0))
-
- #define p_atomic_dec_return(v) ((__typeof(*v)) \
- sizeof(*v) == sizeof(uint8_t) ? atomic_dec_8_nv ((uint8_t *)(v)) : \
+@@ -20,7 +20,7 @@
+ * locally coded assembly, compiler intrinsic or ultimately a
+ * mutex-based implementation.
+ */
+-#if defined(__sun)
++#if defined(__sun) && !defined(__GNUC__)
+ #define PIPE_ATOMIC_OS_SOLARIS
+ #elif defined(_MSC_VER)
+ #define PIPE_ATOMIC_MSVC_INTRINSIC
Index: pkgsrc/graphics/MesaLib/patches/patch-src_mesa_main_context.c
diff -u pkgsrc/graphics/MesaLib/patches/patch-src_mesa_main_context.c:1.3 pkgsrc/graphics/MesaLib/patches/patch-src_mesa_main_context.c:1.4
--- pkgsrc/graphics/MesaLib/patches/patch-src_mesa_main_context.c:1.3 Sat Sep 26 08:45:02 2015
+++ pkgsrc/graphics/MesaLib/patches/patch-src_mesa_main_context.c Wed Aug 21 13:35:28 2019
@@ -1,41 +1,57 @@
-$NetBSD: patch-src_mesa_main_context.c,v 1.3 2015/09/26 08:45:02 tnn Exp $
+$NetBSD: patch-src_mesa_main_context.c,v 1.4 2019/08/21 13:35:28 nia Exp $
* Fix exit time segfault of qt5 application with modular xorg
---- src/mesa/main/context.c.orig 2015-09-11 17:41:47.000000000 +0000
+Bug 82246 (atexit) - Libraries should not call atexit()
+
+https://bugs.freedesktop.org/show_bug.cgi?id=82246
+
+FreeBSD reported atexit bug for 10.6:
+https://bugs.freedesktop.org/show_bug.cgi?id=91869
+
+--- src/mesa/main/context.c.orig 2017-11-20 14:25:47.000000000 +0000
+++ src/mesa/main/context.c
-@@ -350,11 +350,14 @@ mtx_t OneTimeLock = _MTX_INITIALIZER_NP;
+@@ -354,11 +354,23 @@ mtx_t OneTimeLock = _MTX_INITIALIZER_NP;
* Calls all the various one-time-fini functions in Mesa
*/
--static void
++#if defined(HAVE_NOATEXIT)
+static GLbitfield api_init_mask = 0x0;
+static void __attribute__((__destructor__))
++#else
+ static void
++#endif
one_time_fini(void)
{
-- _mesa_destroy_shader_compiler();
-- _mesa_locale_fini();
++#if defined(HAVE_NOATEXIT)
+ if (api_init_mask) {
+ _mesa_destroy_shader_compiler();
+ _mesa_locale_fini();
+ }
++#else
+ _mesa_destroy_shader_compiler();
+ _mesa_locale_fini();
++#endif
}
/**
-@@ -369,7 +372,6 @@ one_time_fini(void)
+@@ -373,7 +385,9 @@ one_time_fini(void)
static void
one_time_init( struct gl_context *ctx )
{
-- static GLbitfield api_init_mask = 0x0;
++#if !defined(HAVE_NOATEXIT)
+ static GLbitfield api_init_mask = 0x0;
++#endif
mtx_lock(&OneTimeLock);
-@@ -394,8 +396,6 @@ one_time_init( struct gl_context *ctx )
+@@ -398,7 +412,9 @@ one_time_init( struct gl_context *ctx )
_mesa_ubyte_to_float_color_tab[i] = (float) i / 255.0F;
}
-- atexit(one_time_fini);
--
- #if defined(DEBUG) && defined(__DATE__) && defined(__TIME__)
++#if !defined(HAVE_NOATEXIT)
+ atexit(one_time_fini);
++#endif
+
+ #if defined(DEBUG)
if (MESA_VERBOSE != 0) {
- _mesa_debug(ctx, "Mesa %s DEBUG build %s %s\n",
Added files:
Index: pkgsrc/graphics/MesaLib/patches/patch-configure.ac
diff -u /dev/null pkgsrc/graphics/MesaLib/patches/patch-configure.ac:1.3
--- /dev/null Wed Aug 21 13:35:29 2019
+++ pkgsrc/graphics/MesaLib/patches/patch-configure.ac Wed Aug 21 13:35:28 2019
@@ -0,0 +1,110 @@
+$NetBSD: patch-configure.ac,v 1.3 2019/08/21 13:35:28 nia Exp $
+
+Don't check for pthread stubs anywhere, as we don't provide it.
+
+From FreeBSD ports graphics/mesa-dri 18.0.0,
+DragonFly dports graphics/mesa-dri 17.3.1,
+files/patch-configure
+
+* Extend to FreeBSD
+osx: ld does not support --build-ld
+
+* For FreeBSD: Use monotonic clock for timeouts.
+
+* For FreeBSD: Implement futex_wake() and futex_wait() via _umtx_op()
+
+* dri3: Mon Apr 10 19:14:48 2017 UTC
+DRI3 remains enabled at compile time, but it is now disabled at
+runtime for stock FreeBSD. Set LIBGL_DRI3_ENABLE in the
+environment to enable DRI3.
+This change was made to work around a problem in libEGL,
+which fails to fall back to using DRI2 when run on a system
+without DRI3 support.
+
+--- configure.ac.orig 2019-01-17 11:26:22.000000000 +0000
++++ configure.ac
+@@ -726,7 +726,7 @@ dnl
+ dnl OSX linker does not support build-id
+ dnl
+ case "$host_os" in
+-darwin*)
++darwin* | freebsd* | solaris*)
+ LD_BUILD_ID=""
+ ;;
+ *)
+@@ -931,7 +931,7 @@ case "$host_os" in
+ darwin*)
+ ;;
+ *)
+- AC_CHECK_FUNCS([clock_gettime], [CLOCK_LIB=],
++ AC_CHECK_FUNCS([clock_gettime clock_nanosleep], [CLOCK_LIB=],
+ [AC_CHECK_LIB([rt], [clock_gettime], [CLOCK_LIB=-lrt],
+ [AC_MSG_ERROR([Could not find clock_gettime])])])
+ AC_SUBST([CLOCK_LIB])
+@@ -941,6 +941,9 @@ esac
+ dnl See if posix_memalign is available
+ AC_CHECK_FUNC([posix_memalign], [DEFINES="$DEFINES -DHAVE_POSIX_MEMALIGN"])
+
++dnl See if open_memstream is available
++AC_CHECK_FUNC([open_memstream], [DEFINES="$DEFINES -DHAVE_OPEN_MEMSTREAM"])
++
+ dnl Check for zlib
+ PKG_CHECK_MODULES([ZLIB], [zlib >= $ZLIB_REQUIRED])
+ DEFINES="$DEFINES -DHAVE_ZLIB"
+@@ -966,7 +969,7 @@ PTHREAD_LIBS="$PTHREAD_LIBS -pthread"
+ dnl pthread-stubs is mandatory on some BSD platforms, due to the nature of the
+ dnl project. Even then there's a notable issue as described in the project README
+ case "$host_os" in
+-linux* | cygwin* | darwin* | solaris* | *-gnu* | gnu* | openbsd*)
++*)
+ pthread_stubs_possible="no"
+ ;;
+ * )
+@@ -995,7 +998,10 @@ AC_LINK_IFELSE([AC_LANG_SOURCE([[
+ LIBS="$save_LIBS"
+
+ dnl Check for futex for fast inline simple_mtx_t.
+-AC_CHECK_HEADER([linux/futex.h], [DEFINES="$DEFINES -DHAVE_LINUX_FUTEX_H"])
++AC_CHECK_HEADERS([linux/futex.h sys/umtx.h],
++ [DEFINES="$DEFINES -DHAVE_LINUX_FUTEX_H"],,
++ [#include <errno.h>
++ #include <sys/types.h>])
+
+ dnl SELinux awareness.
+ AC_ARG_ENABLE([selinux],
+@@ -1278,7 +1284,7 @@ fi
+ AC_SUBST(LIBSENSORS_LIBS)
+
+ case "$host_os" in
+-linux*)
++linux* | freebsd* | dragonfly*)
+ dri3_default=yes
+ ;;
+ *)
+@@ -1908,7 +1914,7 @@ if test x"$enable_dri3" = xyes; then
+ dri3_modifier_modules="xcb-dri3 >= $XCBDRI3_MODIFIERS_REQUIRED xcb-present >= $XCBPRESENT_MODIFIERS_REQUIRED"
+ PKG_CHECK_MODULES([XCB_DRI3_MODIFIERS], [$dri3_modifier_modules], [have_dri3_modifiers=yes], [have_dri3_modifiers=no])
+
+- if test "x$have_dri3_modifiers" == xyes; then
++ if test "x$have_dri3_modifiers" = xyes; then
+ DEFINES="$DEFINES -DHAVE_DRI3_MODIFIERS"
+ fi
+ fi
+@@ -2505,8 +2511,6 @@ if test "x$enable_opencl" = xyes; then
+ CLANG_LIBDIR=${LLVM_LIBDIR}
+ fi
+ CLANG_RESOURCE_DIR=$CLANG_LIBDIR/clang/${LLVM_VERSION}
+- AS_IF([test ! -f "$CLANG_RESOURCE_DIR/include/stddef.h"],
+- [AC_MSG_ERROR([Could not find clang internal header stddef.h in $CLANG_RESOURCE_DIR Use --with-clang-libdir to specify the correct path to the clang libraries.])])
+ fi
+ AM_CONDITIONAL(HAVE_CLOVER, test "x$enable_opencl" = xyes)
+ AM_CONDITIONAL(HAVE_CLOVER_ICD, test "x$enable_opencl_icd" = xyes)
+@@ -2941,7 +2945,7 @@ if test "x$enable_llvm" = xyes; then
+ dnl the LLVM library propagated in the Libs.private of the respective .pc
+ dnl file which ensures complete dependency information when statically
+ dnl linking.
+- if test "x$enable_glx" == xgallium-xlib; then
++ if test "x$enable_glx" = xgallium-xlib; then
+ GL_PC_LIB_PRIV="$GL_PC_LIB_PRIV $LLVM_LIBS"
+ fi
+ if test "x$enable_gallium_osmesa" = xyes; then
Index: pkgsrc/graphics/MesaLib/patches/patch-src_compiler_glsl_glsl__parser__extras.cpp
diff -u /dev/null pkgsrc/graphics/MesaLib/patches/patch-src_compiler_glsl_glsl__parser__extras.cpp:1.3
--- /dev/null Wed Aug 21 13:35:29 2019
+++ pkgsrc/graphics/MesaLib/patches/patch-src_compiler_glsl_glsl__parser__extras.cpp Wed Aug 21 13:35:28 2019
@@ -0,0 +1,18 @@
+$NetBSD: patch-src_compiler_glsl_glsl__parser__extras.cpp,v 1.3 2019/08/21 13:35:28 nia Exp $
+
+atexit() is not a good idea in a library; use destructor attribute.
+
+--- src/compiler/glsl/glsl_parser_extras.cpp.orig 2017-09-25 16:56:18.000000000 +0000
++++ src/compiler/glsl/glsl_parser_extras.cpp
+@@ -2224,7 +2224,11 @@ extern "C" {
+ * programs would be invalid. So this should happen at approximately
+ * program exit.
+ */
++#if defined(HAVE_NOATEXIT)
++void __attribute__((__destructor__))
++#else
+ void
++#endif
+ _mesa_destroy_shader_compiler(void)
+ {
+ _mesa_destroy_shader_compiler_caches();
Index: pkgsrc/graphics/MesaLib/patches/patch-include_GL_internal_dri__interface.h
diff -u /dev/null pkgsrc/graphics/MesaLib/patches/patch-include_GL_internal_dri__interface.h:1.1
--- /dev/null Wed Aug 21 13:35:29 2019
+++ pkgsrc/graphics/MesaLib/patches/patch-include_GL_internal_dri__interface.h Wed Aug 21 13:35:28 2019
@@ -0,0 +1,27 @@
+$NetBSD: patch-include_GL_internal_dri__interface.h,v 1.1 2019/08/21 13:35:28 nia Exp $
+
+From FreeBSD ports graphics/mesa-dri 17.2.4.
+
+GCC on 9.x doesn't allow types to be overwritten, these types are defined
+in drm.h also, which causes build issues in xorg-server.
+
+--- include/GL/internal/dri_interface.h.orig 2017-11-20 14:25:47.000000000 +0000
++++ include/GL/internal/dri_interface.h
+@@ -40,6 +40,9 @@
+ #ifndef DRI_INTERFACE_H
+ #define DRI_INTERFACE_H
+
++#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
++#include <drm.h>
++#else
+ #ifdef HAVE_LIBDRM
+ #include <drm.h>
+ #else
+@@ -47,6 +50,7 @@ typedef unsigned int drm_context_t;
+ typedef unsigned int drm_drawable_t;
+ typedef struct drm_clip_rect drm_clip_rect_t;
+ #endif
++#endif /* __FreeBSD__ || __DragonFly__ */
+
+ #include <stdint.h>
+
Index: pkgsrc/graphics/MesaLib/patches/patch-src_amd_common_ac__debug.c
diff -u /dev/null pkgsrc/graphics/MesaLib/patches/patch-src_amd_common_ac__debug.c:1.1
--- /dev/null Wed Aug 21 13:35:29 2019
+++ pkgsrc/graphics/MesaLib/patches/patch-src_amd_common_ac__debug.c Wed Aug 21 13:35:28 2019
@@ -0,0 +1,19 @@
+$NetBSD: patch-src_amd_common_ac__debug.c,v 1.1 2019/08/21 13:35:28 nia Exp $
+
+#if'out some debug code on SunOS. There is no open_memstream(3)
+
+--- src/amd/common/ac_debug.c.orig 2019-01-17 11:26:22.000000000 +0000
++++ src/amd/common/ac_debug.c
+@@ -571,10 +571,12 @@ void ac_parse_ib_chunk(FILE *f, uint32_t
+
+ char *out;
+ size_t outsize;
++#if defined(HAVE_OPEN_MEMSTREAM)
+ FILE *memf = open_memstream(&out, &outsize);
+ ib.f = memf;
+ ac_do_parse_ib(memf, &ib);
+ fclose(memf);
++#endif
+
+ if (out) {
+ format_ib_output(f, out);
Index: pkgsrc/graphics/MesaLib/patches/patch-src_amd_vulkan_winsys_amdgpu_radv__amdgpu__cs.c
diff -u /dev/null pkgsrc/graphics/MesaLib/patches/patch-src_amd_vulkan_winsys_amdgpu_radv__amdgpu__cs.c:1.1
--- /dev/null Wed Aug 21 13:35:29 2019
+++ pkgsrc/graphics/MesaLib/patches/patch-src_amd_vulkan_winsys_amdgpu_radv__amdgpu__cs.c Wed Aug 21 13:35:28 2019
@@ -0,0 +1,19 @@
+$NetBSD: patch-src_amd_vulkan_winsys_amdgpu_radv__amdgpu__cs.c,v 1.1 2019/08/21 13:35:28 nia Exp $
+
+Define ETIME if missing
+
+https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=225415
+FreeBSD Bugzilla: Bug 225415 graphics/mesa-dri: update to 18.0.0
+
+--- src/amd/vulkan/winsys/amdgpu/radv_amdgpu_cs.c.orig 2018-02-09 02:17:57.000000000 +0000
++++ src/amd/vulkan/winsys/amdgpu/radv_amdgpu_cs.c
+@@ -33,6 +33,9 @@
+ #include "radv_amdgpu_bo.h"
+ #include "sid.h"
+
++#ifndef ETIME
++#define ETIME ETIMEDOUT
++#endif
+
+ enum {
+ VIRTUAL_BUFFER_HASH_TABLE_SIZE = 1024
Index: pkgsrc/graphics/MesaLib/patches/patch-src_compiler_builtin__type__macros.h
diff -u /dev/null pkgsrc/graphics/MesaLib/patches/patch-src_compiler_builtin__type__macros.h:1.1
--- /dev/null Wed Aug 21 13:35:29 2019
+++ pkgsrc/graphics/MesaLib/patches/patch-src_compiler_builtin__type__macros.h Wed Aug 21 13:35:28 2019
@@ -0,0 +1,25 @@
+$NetBSD: patch-src_compiler_builtin__type__macros.h,v 1.1 2019/08/21 13:35:28 nia Exp $
+
+Workaround netbsd headers.
+
+--- src/compiler/builtin_type_macros.h.orig 2018-09-07 21:18:07.000000000 +0000
++++ src/compiler/builtin_type_macros.h
+@@ -28,6 +28,18 @@
+ * language version or extension might provide them.
+ */
+
++#ifdef __NetBSD__ /* XXX https://mail-index.netbsd.org/tech-userlevel/2018/09/08/msg011381.html */
++#undef uint8_t
++#undef uint16_t
++#undef uint32_t
++#undef uint64_t
++#undef int8_t
++#undef int16_t
++#undef int32_t
++#undef int64_t
++#endif
++
++
+ DECL_TYPE(error, GL_INVALID_ENUM, GLSL_TYPE_ERROR, 0, 0)
+ DECL_TYPE(void, GL_INVALID_ENUM, GLSL_TYPE_VOID, 0, 0)
+
Index: pkgsrc/graphics/MesaLib/patches/patch-src_gallium_auxiliary_drivers_trace_tr__dump.c
diff -u /dev/null pkgsrc/graphics/MesaLib/patches/patch-src_gallium_auxiliary_drivers_trace_tr__dump.c:1.1
--- /dev/null Wed Aug 21 13:35:29 2019
+++ pkgsrc/graphics/MesaLib/patches/patch-src_gallium_auxiliary_drivers_trace_tr__dump.c Wed Aug 21 13:35:28 2019
@@ -0,0 +1,50 @@
+$NetBSD: patch-src_gallium_auxiliary_drivers_trace_tr__dump.c,v 1.1 2019/08/21 13:35:28 nia Exp $
+
+atexit() is not a good idea in shared libraries.
+
+FreeBSD reported atexit bug for 10.6:
+https://bugs.freedesktop.org/show_bug.cgi?id=91869
+
+--- src/gallium/auxiliary/driver_trace/tr_dump.c.orig 2018-09-07 21:18:07.000000000 +0000
++++ src/gallium/auxiliary/driver_trace/tr_dump.c
+@@ -63,7 +63,6 @@ static mtx_t call_mutex = _MTX_INITIALIZ
+ static long unsigned call_no = 0;
+ static boolean dumping = FALSE;
+
+-
+ static inline void
+ trace_dump_write(const char *buf, size_t size)
+ {
+@@ -171,9 +170,20 @@ trace_dump_trace_flush(void)
+ }
+ }
+
++#if defined(HAVE_NOATEXIT)
++static boolean trace_dump_has_begun = FALSE;
++
++static void __attribute__((__destructor__))
++#else
+ static void
++#endif
+ trace_dump_trace_close(void)
+ {
++#if defined(HAVE_NOATEXIT)
++ if (!trace_dump_has_begun)
++ return;
++#endif
++
+ if (stream) {
+ trace_dump_writes("</trace>\n");
+ if (close_stream) {
+@@ -233,7 +243,11 @@ trace_dump_trace_begin(void)
+ * screen multiple times, so we only write </trace> tag and close at exit
+ * time.
+ */
++#if defined(HAVE_NOATEXIT)
++ trace_dump_has_begun = TRUE;
++#else
+ atexit(trace_dump_trace_close);
++#endif
+ }
+
+ return TRUE;
Index: pkgsrc/graphics/MesaLib/patches/patch-src_gallium_auxiliary_pipe-loader_pipe__loader__drm.c
diff -u /dev/null pkgsrc/graphics/MesaLib/patches/patch-src_gallium_auxiliary_pipe-loader_pipe__loader__drm.c:1.1
--- /dev/null Wed Aug 21 13:35:29 2019
+++ pkgsrc/graphics/MesaLib/patches/patch-src_gallium_auxiliary_pipe-loader_pipe__loader__drm.c Wed Aug 21 13:35:28 2019
@@ -0,0 +1,127 @@
+$NetBSD: patch-src_gallium_auxiliary_pipe-loader_pipe__loader__drm.c,v 1.1 2019/08/21 13:35:28 nia Exp $
+
+* From FreeBSD ports / DragonFly dports graphics/mesa-dri
+
+Revert the following commit.
+
+FreeBSD and DragonFly don't have the required render nodes.
+
+-------
+
+From 69a1b9959e59653da262185c4e2cf57d24939b19 Mon Sep 17 00:00:00 2001
+Date: Mon, 29 Jun 2015 12:36:45 +0100
+Subject: pipe-loader: drop support for non-render node devices
+
+Render nodes have been around for quite some time. Removing support via
+the master/primary node allows us to clean up the conditional
+compilation and simplify the build greatly.
+
+For example currently we the pipe-loader, which explicitly links against
+xcb and friends (for X auth) if found at compile-time. That
+would cause problems as one will be forced to use X/xcb, even if it's a
+headless system that is used for opencl.
+
+v2: Clarify the linking topic in the commit message.
+
+* Extended for NetBSD.
+
+--- src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c.orig 2018-12-11 21:13:57.000000000 +0000
++++ src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c
+@@ -229,6 +229,16 @@ pipe_loader_drm_probe_fd(struct pipe_loa
+ return ret;
+ }
+
++#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__) || defined(__NetBSD__)
++static int
++open_drm_minor(int minor)
++{
++ char path[PATH_MAX];
++ snprintf(path, sizeof(path), DRM_DEV_NAME, DRM_DIR_NAME, minor);
++ return open(path, O_RDWR, 0);
++}
++#endif
++
+ static int
+ open_drm_render_node_minor(int minor)
+ {
+@@ -241,7 +251,19 @@ open_drm_render_node_minor(int minor)
+ int
+ pipe_loader_drm_probe(struct pipe_loader_device **devs, int ndev)
+ {
++#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__) || defined(__NetBSD__)
++ int i, k, fd, num_render_node_devs;
++ int j = 0;
++
++ struct {
++ unsigned vendor_id;
++ unsigned chip_id;
++ } render_node_devs[DRM_RENDER_NODE_MAX_NODES];
++
++ /* Look for render nodes first */
++#else
+ int i, j, fd;
++#endif
+
+ for (i = DRM_RENDER_NODE_MIN_MINOR, j = 0;
+ i <= DRM_RENDER_NODE_MAX_MINOR; i++) {
+@@ -256,6 +278,11 @@ pipe_loader_drm_probe(struct pipe_loader
+ continue;
+ }
+
++#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__) || defined(__NetBSD__)
++ render_node_devs[j].vendor_id = dev->u.pci.vendor_id;
++ render_node_devs[j].chip_id = dev->u.pci.chip_id;
++
++#endif
+ if (j < ndev) {
+ devs[j] = dev;
+ } else {
+@@ -265,6 +292,48 @@ pipe_loader_drm_probe(struct pipe_loader
+ j++;
+ }
+
++#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__) || defined(__NetBSD__)
++ num_render_node_devs = j;
++
++ /* Next look for drm devices. */
++ for (i = 0; i < DRM_MAX_MINOR; i++) {
++ struct pipe_loader_device *dev;
++ boolean duplicate = FALSE;
++ fd = open_drm_minor(i);
++ if (fd < 0)
++ continue;
++
++ if (!pipe_loader_drm_probe_fd(&dev, fd)) {
++ close(fd);
++ continue;
++ }
++
++ /* Check to make sure we aren't already accessing this device via
++ * render nodes.
++ */
++ for (k = 0; k < num_render_node_devs; k++) {
++ if (dev->u.pci.vendor_id == render_node_devs[k].vendor_id &&
++ dev->u.pci.chip_id == render_node_devs[k].chip_id) {
++ close(fd);
++ dev->ops->release(&dev);
++ duplicate = TRUE;
++ break;
++ }
++ }
++
++ if (duplicate)
++ continue;
++
++ if (j < ndev) {
++ devs[j] = dev;
++ } else {
++ dev->ops->release(&dev);
++ }
++
++ j++;
++ }
++
++#endif
+ return j;
+ }
+
Index: pkgsrc/graphics/MesaLib/patches/patch-src_gallium_auxiliary_util_u__helpers.c
diff -u /dev/null pkgsrc/graphics/MesaLib/patches/patch-src_gallium_auxiliary_util_u__helpers.c:1.1
--- /dev/null Wed Aug 21 13:35:29 2019
+++ pkgsrc/graphics/MesaLib/patches/patch-src_gallium_auxiliary_util_u__helpers.c Wed Aug 21 13:35:28 2019
@@ -0,0 +1,34 @@
+$NetBSD: patch-src_gallium_auxiliary_util_u__helpers.c,v 1.1 2019/08/21 13:35:28 nia Exp $
+
+handle NetBSD-style pthread_setaffinity_np(3)
+
+--- src/gallium/auxiliary/util/u_helpers.c.orig 2018-12-11 21:13:57.000000000 +0000
++++ src/gallium/auxiliary/util/u_helpers.c
+@@ -129,6 +129,19 @@ static once_flag thread_pinning_once_fla
+ static void
+ util_set_full_cpu_affinity(void)
+ {
++#if defined(__NetBSD__)
++ cpuset_t *cpuset;
++
++ cpuset = cpuset_create();
++ if (cpuset != NULL) {
++ cpuset_zero(cpuset);
++ for (unsigned i = 0; i < cpuset_size(cpuset); i++)
++ cpuset_set(i, cpuset);
++
++ pthread_setaffinity_np(pthread_self(), cpuset_size(cpuset), cpuset);
++ cpuset_destroy(cpuset);
++ }
++#else
+ cpu_set_t cpuset;
+
+ CPU_ZERO(&cpuset);
+@@ -136,6 +149,7 @@ util_set_full_cpu_affinity(void)
+ CPU_SET(i, &cpuset);
+
+ pthread_setaffinity_np(pthread_self(), sizeof(cpuset), &cpuset);
++#endif
+ }
+
+ static void
Index: pkgsrc/graphics/MesaLib/patches/patch-src_gallium_drivers_radeonsi_si__state__shaders.c
diff -u /dev/null pkgsrc/graphics/MesaLib/patches/patch-src_gallium_drivers_radeonsi_si__state__shaders.c:1.1
--- /dev/null Wed Aug 21 13:35:29 2019
+++ pkgsrc/graphics/MesaLib/patches/patch-src_gallium_drivers_radeonsi_si__state__shaders.c Wed Aug 21 13:35:28 2019
@@ -0,0 +1,21 @@
+$NetBSD: patch-src_gallium_drivers_radeonsi_si__state__shaders.c,v 1.1 2019/08/21 13:35:28 nia Exp $
+
+#if'out some debug code on SunOS. There is no open_memstream(3)
+
+--- src/gallium/drivers/radeonsi/si_state_shaders.c.orig 2019-01-17 11:26:22.000000000 +0000
++++ src/gallium/drivers/radeonsi/si_state_shaders.c
+@@ -1721,12 +1721,14 @@ static void si_build_shader_variant(stru
+ }
+
+ if (shader->compiler_ctx_state.is_debug_context) {
++#if defined(HAVE_OPEN_MEMSTREAM)
+ FILE *f = open_memstream(&shader->shader_log,
+ &shader->shader_log_size);
+ if (f) {
+ si_shader_dump(sscreen, shader, NULL, sel->type, f, false);
+ fclose(f);
+ }
++#endif
+ }
+
+ si_shader_init_pm4_state(sscreen, shader);
Index: pkgsrc/graphics/MesaLib/patches/patch-src_gallium_drivers_vc4_vc4__bufmgr.c
diff -u /dev/null pkgsrc/graphics/MesaLib/patches/patch-src_gallium_drivers_vc4_vc4__bufmgr.c:1.1
--- /dev/null Wed Aug 21 13:35:29 2019
+++ pkgsrc/graphics/MesaLib/patches/patch-src_gallium_drivers_vc4_vc4__bufmgr.c Wed Aug 21 13:35:28 2019
@@ -0,0 +1,18 @@
+$NetBSD: patch-src_gallium_drivers_vc4_vc4__bufmgr.c,v 1.1 2019/08/21 13:35:28 nia Exp $
+
+Patch from FreeBSD ports graphics/mesa-dri 17.1.0
+
+# define ETIME as ETIMEOUT same as in intel driver
+
+--- src/gallium/drivers/vc4/vc4_bufmgr.c.orig 2017-05-25 07:13:13.000000000 +0000
++++ src/gallium/drivers/vc4/vc4_bufmgr.c
+@@ -27,6 +27,9 @@
+ #include <fcntl.h>
+ #include <xf86drm.h>
+ #include <xf86drmMode.h>
++#ifndef ETIME
++#define ETIME ETIMEDOUT
++#endif
+
+ #include "util/u_hash_table.h"
+ #include "util/u_memory.h"
Index: pkgsrc/graphics/MesaLib/patches/patch-src_gallium_state__trackers_clover_llvm_invocation.cpp
diff -u /dev/null pkgsrc/graphics/MesaLib/patches/patch-src_gallium_state__trackers_clover_llvm_invocation.cpp:1.1
--- /dev/null Wed Aug 21 13:35:29 2019
+++ pkgsrc/graphics/MesaLib/patches/patch-src_gallium_state__trackers_clover_llvm_invocation.cpp Wed Aug 21 13:35:28 2019
@@ -0,0 +1,40 @@
+$NetBSD: patch-src_gallium_state__trackers_clover_llvm_invocation.cpp,v 1.1 2019/08/21 13:35:28 nia Exp $
+
+Patch from FreeBSD ports graphics/mesa-dri 17.1.0
+
+# fix errors like the following
+#
+# llvm/invocation.cpp:(.text+0x1275): undefined reference to `std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::c_str()
+ const'
+# /usr/bin/ld: ../../../../src/gallium/state_trackers/clover/.libs/libclover.a(libclllvm_la-invocation.o): relocation R_X86_64_PC32 against `_ZNKSt3__112bas
+ic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE5c_strEv' can not be used when making a shared object; recompile with -fPIC
+# /usr/bin/ld: final link failed: Bad value
+#
+
+--- src/gallium/state_trackers/clover/llvm/invocation.cpp.orig 2018-09-07 21:18:07.000000000 +0000
++++ src/gallium/state_trackers/clover/llvm/invocation.cpp
+@@ -181,6 +181,10 @@ namespace {
+ return get_lang_standard_from_version_str(device_version);
+ }
+
++#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
++ const char* cstr(const std::string& str) { return str.c_str(); }
++#endif
++
+ std::unique_ptr<clang::CompilerInstance>
+ create_compiler_instance(const device &dev,
+ const std::vector<std::string> &opts,
+@@ -193,8 +197,13 @@ namespace {
+ // Parse the compiler options. A file name should be present at the end
+ // and must have the .cl extension in order for the CompilerInvocation
+ // class to recognize it as an OpenCL source file.
++#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
++ std::vector<const char *> copts(opts.size());
++ std::transform(opts.begin(), opts.end(), copts.begin(), cstr);
++#else
+ const std::vector<const char *> copts =
+ map(std::mem_fn(&std::string::c_str), opts);
++#endif
+
+ const target &target = dev.ir_target();
+ const std::string &device_clc_version = dev.device_clc_version();
Index: pkgsrc/graphics/MesaLib/patches/patch-src_gallium_state__trackers_clover_llvm_metadata.hpp
diff -u /dev/null pkgsrc/graphics/MesaLib/patches/patch-src_gallium_state__trackers_clover_llvm_metadata.hpp:1.1
--- /dev/null Wed Aug 21 13:35:29 2019
+++ pkgsrc/graphics/MesaLib/patches/patch-src_gallium_state__trackers_clover_llvm_metadata.hpp Wed Aug 21 13:35:28 2019
@@ -0,0 +1,21 @@
+$NetBSD: patch-src_gallium_state__trackers_clover_llvm_metadata.hpp,v 1.1 2019/08/21 13:35:28 nia Exp $
+
+From FreeBSD ports graphics/libGL mesa 13.0.5
+
+# Fix error: no matching constructor for initialization of 'std::vector<const ::llvm::MDNode *>'
+#
+
+--- src/gallium/state_trackers/clover/llvm/metadata.hpp.orig 2017-02-13 11:55:49.000000000 +0000
++++ src/gallium/state_trackers/clover/llvm/metadata.hpp
+@@ -42,7 +42,11 @@ namespace clover {
+ get_kernel_nodes(const ::llvm::Module &mod) {
+ if (const ::llvm::NamedMDNode *n =
+ mod.getNamedMetadata("opencl.kernels"))
++#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
++ return { n->getOperand(0), n->getOperand(n->getNumOperands()) };
++#else
+ return { n->op_begin(), n->op_end() };
++#endif
+ else
+ return {};
+ }
Index: pkgsrc/graphics/MesaLib/patches/patch-src_gallium_state__trackers_clover_util_range.hpp
diff -u /dev/null pkgsrc/graphics/MesaLib/patches/patch-src_gallium_state__trackers_clover_util_range.hpp:1.1
--- /dev/null Wed Aug 21 13:35:29 2019
+++ pkgsrc/graphics/MesaLib/patches/patch-src_gallium_state__trackers_clover_util_range.hpp Wed Aug 21 13:35:28 2019
@@ -0,0 +1,40 @@
+$NetBSD: patch-src_gallium_state__trackers_clover_util_range.hpp,v 1.1 2019/08/21 13:35:28 nia Exp $
+
+From FreeBSD ports for mesa 17.1.10:
+
+From b95533b981af9a6687b41418e7cc2a5652fc2bdb Mon Sep 17 00:00:00 2001
+Date: Fri, 7 Mar 2014 15:16:08 +0100
+Subject: [PATCH 3/3] Work around for clang 3.4 which fails to build Clover
+
+See:
+ https://bugs.freedesktop.org/show_bug.cgi?id=74098#c3
+
+--- src/gallium/state_trackers/clover/util/range.hpp.orig 2017-09-25 16:56:19.000000000 +0000
++++ src/gallium/state_trackers/clover/util/range.hpp
+@@ -362,6 +362,14 @@ namespace clover {
+ return { i, i + n };
+ }
+
++#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
++ namespace detail {
++ template<typename T>
++ using fixup_function_type =
++ typename std::conditional<std::is_function<T>::value, T &, T>::type;
++ }
++#endif
++
+ ///
+ /// Create a range by transforming the contents of a number of
+ /// source ranges \a rs element-wise using a provided functor \a f.
+@@ -369,7 +377,11 @@ namespace clover {
+ /// \sa adaptor_range.
+ ///
+ template<typename F, typename... Rs>
++#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
++ adaptor_range<detail::fixup_function_type<F>, Rs...>
++#else
+ adaptor_range<F, Rs...>
++#endif
+ map(F &&f, Rs &&... rs) {
+ return { std::forward<F>(f), std::forward<Rs>(rs)... };
+ }
Index: pkgsrc/graphics/MesaLib/patches/patch-src_gbm_Makefile.am
diff -u /dev/null pkgsrc/graphics/MesaLib/patches/patch-src_gbm_Makefile.am:1.1
--- /dev/null Wed Aug 21 13:35:29 2019
+++ pkgsrc/graphics/MesaLib/patches/patch-src_gbm_Makefile.am Wed Aug 21 13:35:28 2019
@@ -0,0 +1,12 @@
+$NetBSD: patch-src_gbm_Makefile.am,v 1.1 2019/08/21 13:35:28 nia Exp $
+
+--- src/gbm/Makefile.am.orig 2017-11-20 14:25:47.000000000 +0000
++++ src/gbm/Makefile.am
+@@ -28,6 +28,7 @@ libgbm_la_LIBADD = \
+ $(top_builddir)/src/loader/libloader.la \
+ $(top_builddir)/src/util/libmesautil.la \
+ $(top_builddir)/src/util/libxmlconfig.la \
++ $(PTHREAD_LIBS) \
+ $(DLOPEN_LIBS)
+
+ if HAVE_PLATFORM_WAYLAND
Index: pkgsrc/graphics/MesaLib/patches/patch-src_glx_Makefile.am
diff -u /dev/null pkgsrc/graphics/MesaLib/patches/patch-src_glx_Makefile.am:1.1
--- /dev/null Wed Aug 21 13:35:29 2019
+++ pkgsrc/graphics/MesaLib/patches/patch-src_glx_Makefile.am Wed Aug 21 13:35:28 2019
@@ -0,0 +1,49 @@
+$NetBSD: patch-src_glx_Makefile.am,v 1.1 2019/08/21 13:35:28 nia Exp $
+
+- We don't need libmesautil.la here. Those symbols seem to already be
+ included in libmesa.la.
+- force libtool to use clang++ to link libGL on OSX.
+ Otherwise we get:
+ Undefined symbols for architecture x86_64:
+ "std::terminate()", referenced from:
+ ___clang_call_terminate in libglx.a(glsl_parser.o)
+ ...
+
+--- src/glx/Makefile.am.orig 2019-01-17 11:26:23.000000000 +0000
++++ src/glx/Makefile.am
+@@ -89,10 +89,16 @@ libglx_la_SOURCES = \
+ singlepix.c \
+ vertarr.c
+
++if HAVE_APPLEDRI
++libglx_la_LIBADD = \
++ $(top_builddir)/src/loader/libloader.la \
++ $(top_builddir)/src/util/libxmlconfig.la
++else
+ libglx_la_LIBADD = \
+ $(top_builddir)/src/loader/libloader.la \
+ $(top_builddir)/src/util/libmesautil.la \
+ $(top_builddir)/src/util/libxmlconfig.la
++endif
+
+ if HAVE_DRISW
+ libglx_la_SOURCES += \
+@@ -136,6 +142,7 @@ libglx_la_SOURCES += \
+
+ SUBDIRS += apple
+ libglx_la_LIBADD += $(builddir)/apple/libappleglx.la
++libglx_la_LIBADD += $(top_builddir)/src/mesa/libmesa.la
+ endif
+
+ if HAVE_WINDOWSDRI
+@@ -187,6 +194,10 @@ lib@GL_LIB@_la_SOURCES =
+ lib@GL_LIB@_la_LIBADD = $(GL_LIBS)
+ lib@GL_LIB@_la_LDFLAGS = $(GL_LDFLAGS)
+
++if HAVE_APPLEDRI
++lib@GL_LIB@_la_SOURCES += apple_dummy.cpp
++endif
++
+ if HAVE_WINDOWSDRI
+ lib@GL_LIB@_la_LDFLAGS += -lgdi32 -lopengl32 -Wl,--disable-stdcall-fixup
+ endif
Index: pkgsrc/graphics/MesaLib/patches/patch-src_glx_dri__common.h
diff -u /dev/null pkgsrc/graphics/MesaLib/patches/patch-src_glx_dri__common.h:1.1
--- /dev/null Wed Aug 21 13:35:29 2019
+++ pkgsrc/graphics/MesaLib/patches/patch-src_glx_dri__common.h Wed Aug 21 13:35:28 2019
@@ -0,0 +1,17 @@
+$NetBSD: patch-src_glx_dri__common.h,v 1.1 2019/08/21 13:35:28 nia Exp $
+
+Fix error on OSX.
+
+--- src/glx/dri_common.h.orig 2019-01-17 11:26:23.000000000 +0000
++++ src/glx/dri_common.h
+@@ -55,8 +55,10 @@ extern struct glx_config *driConvertConf
+
+ extern void driDestroyConfigs(const __DRIconfig **configs);
+
++#if !defined(GLX_USE_APPLEGL)
+ extern __GLXDRIdrawable *
+ driFetchDrawable(struct glx_context *gc, GLXDrawable glxDrawable);
++#endif
+
+ extern void
+ driReleaseDrawables(struct glx_context *gc);
Index: pkgsrc/graphics/MesaLib/patches/patch-src_glx_dri__glx.c
diff -u /dev/null pkgsrc/graphics/MesaLib/patches/patch-src_glx_dri__glx.c:1.1
--- /dev/null Wed Aug 21 13:35:29 2019
+++ pkgsrc/graphics/MesaLib/patches/patch-src_glx_dri__glx.c Wed Aug 21 13:35:28 2019
@@ -0,0 +1,43 @@
+$NetBSD: patch-src_glx_dri__glx.c,v 1.1 2019/08/21 13:35:28 nia Exp $
+
+atexit() is not a good idea in shared libraries.
+
+FreeBSD reported atexit bug for 10.6:
+https://bugs.freedesktop.org/show_bug.cgi?id=91869
+
+--- src/glx/dri_glx.c.orig 2018-01-18 21:30:28.000000000 +0000
++++ src/glx/dri_glx.c
+@@ -183,9 +183,21 @@ static struct driver_config_entry *drive
+ /* Called as an atexit function. Otherwise, this would have to be called with
+ * driver_config_mutex locked.
+ */
++#if defined(HAVE_NOATEXIT)
++static Bool e_next_ever_null = False;
++
++static void __attribute__((__destructor__))
++#else
+ static void
++#endif
+ clear_driver_config_cache()
+ {
++
++#if defined(HAVE_NOATEXIT)
++ if (!e_next_ever_null)
++ return;
++#endif
++
+ while (driver_config_cache) {
+ struct driver_config_entry *e = driver_config_cache;
+ driver_config_cache = e->next;
+@@ -276,7 +288,11 @@ glXGetDriverConfig(const char *driverNam
+ driver_config_cache = e;
+
+ if (!e->next)
++#if defined(HAVE_NOATEXIT)
++ e_next_ever_null = True;
++#else
+ atexit(clear_driver_config_cache);
++#endif
+
+ out:
+ pthread_mutex_unlock(&driver_config_mutex);
Index: pkgsrc/graphics/MesaLib/patches/patch-src_glx_glxext.c
diff -u /dev/null pkgsrc/graphics/MesaLib/patches/patch-src_glx_glxext.c:1.1
--- /dev/null Wed Aug 21 13:35:29 2019
+++ pkgsrc/graphics/MesaLib/patches/patch-src_glx_glxext.c Wed Aug 21 13:35:28 2019
@@ -0,0 +1,47 @@
+$NetBSD: patch-src_glx_glxext.c,v 1.1 2019/08/21 13:35:28 nia Exp $
+
+* Patch from FreeBSD ports graphics/mesa-dri 18.0.0
+
+# work-around for https://bugs.freedesktop.org/show_bug.cgi?id=100627
+
+* Extended to DragonFly and NetBSD. Other OSes might need this as well.
+
+* Added logging statements to note dri3 initialization being invoked.
+
+--- src/glx/glxext.c.orig 2017-12-08 13:49:11.000000000 +0000
++++ src/glx/glxext.c
+@@ -55,6 +55,7 @@
+ #include <xcb/xcb.h>
+ #include <xcb/glx.h>
+
++#include "dri_common.h"
+
+ #ifdef DEBUG
+ void __glXDumpDrawBuffer(struct glx_context * ctx);
+@@ -817,7 +818,11 @@ AllocAndFetchScreenConfigs(Display * dpy
+ #if defined(GLX_USE_DRM)
+ #if defined(HAVE_DRI3)
+ if (priv->dri3Display)
++ InfoMessageF("glxext.c: AllocAndFetchScreenConfigs: priv->dri3Display\n");
++ if (priv->dri3Display)
+ psc = (*priv->dri3Display->createScreen) (i, priv);
++ if (psc != NULL && priv->dri3Display)
++ InfoMessageF("glxext.c: AllocAndFetchScreenConfigs: psc set by priv->dri3Display\n");
+ #endif /* HAVE_DRI3 */
+ if (psc == NULL && priv->dri2Display)
+ psc = (*priv->dri2Display->createScreen) (i, priv);
+@@ -920,8 +925,13 @@ __glXInitialize(Display * dpy)
+ #if defined(GLX_USE_DRM)
+ if (glx_direct && glx_accel) {
+ #if defined(HAVE_DRI3)
+- if (!env_var_as_boolean("LIBGL_DRI3_DISABLE", false))
++#if ((defined(__FreeBSD__) || defined(__FreeBSD_kernel__)) && !defined(__DRM_NEXT__)) || defined(__DragonFly__) || defined(__NetBSD__)
++ if (env_var_as_boolean("LIBGL_DRI3_ENABLE", false))
++#endif
++ if (!env_var_as_boolean("LIBGL_DRI3_DISABLE", false)) {
++ InfoMessageF("glxext.c: __glxInitialize: dpyPriv->dri3Display = dri3_create_display\n");
+ dpyPriv->dri3Display = dri3_create_display(dpy);
++ }
+ #endif /* HAVE_DRI3 */
+ dpyPriv->dri2Display = dri2CreateDisplay(dpy);
+ dpyPriv->driDisplay = driCreateDisplay(dpy);
Index: pkgsrc/graphics/MesaLib/patches/patch-src_intel_Makefile.tools.am
diff -u /dev/null pkgsrc/graphics/MesaLib/patches/patch-src_intel_Makefile.tools.am:1.1
--- /dev/null Wed Aug 21 13:35:29 2019
+++ pkgsrc/graphics/MesaLib/patches/patch-src_intel_Makefile.tools.am Wed Aug 21 13:35:28 2019
@@ -0,0 +1,14 @@
+$NetBSD: patch-src_intel_Makefile.tools.am,v 1.1 2019/08/21 13:35:28 nia Exp $
+
+-lrt for shm_open in aubinator.c, a more portable alternative to memfd_create
+
+--- src/intel/Makefile.tools.am.orig 2018-09-07 21:18:07.000000000 +0000
++++ src/intel/Makefile.tools.am
+@@ -43,6 +43,7 @@ tools_aubinator_LDADD = \
+ $(PTHREAD_LIBS) \
+ $(DLOPEN_LIBS) \
+ $(ZLIB_LIBS) \
++ -lrt \
+ -lm
+
+
Index: pkgsrc/graphics/MesaLib/patches/patch-src_intel_compiler_brw__fs__bank__conflicts.cpp
diff -u /dev/null pkgsrc/graphics/MesaLib/patches/patch-src_intel_compiler_brw__fs__bank__conflicts.cpp:1.1
--- /dev/null Wed Aug 21 13:35:29 2019
+++ pkgsrc/graphics/MesaLib/patches/patch-src_intel_compiler_brw__fs__bank__conflicts.cpp Wed Aug 21 13:35:28 2019
@@ -0,0 +1,23 @@
+$NetBSD: patch-src_intel_compiler_brw__fs__bank__conflicts.cpp,v 1.1 2019/08/21 13:35:28 nia Exp $
+
+https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=225415
+FreeBSD Bugzilla: Bug 225415 graphics/mesa-dri: update to 18.0.0
+
+compiler/brw_fs_bank_conflicts.cpp:719:25: error: scalar initializer cannot be empty
+ vector_type s_p = {}, s_n = {};
+ ^~
+compiler/brw_fs_bank_conflicts.cpp:719:35: error: scalar initializer cannot be empty
+ vector_type s_p = {}, s_n = {};
+ ^~
+
+--- src/intel/compiler/brw_fs_bank_conflicts.cpp.orig 2018-02-09 02:17:59.000000000 +0000
++++ src/intel/compiler/brw_fs_bank_conflicts.cpp
+@@ -716,7 +716,7 @@ namespace {
+ const weight_vector_type &conflicts)
+ {
+ const unsigned m = DIV_ROUND_UP(conflicts.size, vector_width);
+- vector_type s_p = {}, s_n = {};
++ vector_type s_p = {0}, s_n = {0};
+
+ for (unsigned r = 0; r < m; r++) {
+ s_p = adds(s_p, mask(bank_mask_p.v[r], conflicts.v[r]));
Index: pkgsrc/graphics/MesaLib/patches/patch-src_intel_tools_aub__mem.c
diff -u /dev/null pkgsrc/graphics/MesaLib/patches/patch-src_intel_tools_aub__mem.c:1.1
--- /dev/null Wed Aug 21 13:35:29 2019
+++ pkgsrc/graphics/MesaLib/patches/patch-src_intel_tools_aub__mem.c Wed Aug 21 13:35:28 2019
@@ -0,0 +1,36 @@
+$NetBSD: patch-src_intel_tools_aub__mem.c,v 1.1 2019/08/21 13:35:28 nia Exp $
+
+* Partially implement memfd_create() via mkostemp()
+
+--- src/intel/tools/aub_mem.c.orig 2018-12-11 21:13:57.000000000 +0000
++++ src/intel/tools/aub_mem.c
+@@ -34,7 +34,29 @@
+ static inline int
+ memfd_create(const char *name, unsigned int flags)
+ {
++#if defined(SYS_memfd_create)
+ return syscall(SYS_memfd_create, name, flags);
++#elif defined(__FreeBSD__)
++ return shm_open(SHM_ANON, flags | O_RDWR | O_CREAT, 0600);
++#else /* DragonFly, NetBSD, OpenBSD, Solaris */
++ char template[] = "/tmp/shmfd-XXXXXX";
++#ifdef HAVE_MKOSTEMP
++ int fd = mkostemp(template, flags);
++#else
++ int fd = mkstemp(template);
++ if (flags & O_CLOEXEC) {
++ int flags = fcntl(fd, F_GETFD);
++ if (flags != -1) {
++ flags |= FD_CLOEXEC;
++ (void) fcntl(fd, F_SETFD, &flags);
++ }
++ }
++#endif /* HAVE_MKOSTEMP */
++ if (fd >= 0)
++ unlink(template);
++
++ return fd;
++#endif /* __linux__ */
+ }
+ #endif
+
Index: pkgsrc/graphics/MesaLib/patches/patch-src_intel_tools_aubinator__error__decode.c
diff -u /dev/null pkgsrc/graphics/MesaLib/patches/patch-src_intel_tools_aubinator__error__decode.c:1.1
--- /dev/null Wed Aug 21 13:35:29 2019
+++ pkgsrc/graphics/MesaLib/patches/patch-src_intel_tools_aubinator__error__decode.c Wed Aug 21 13:35:28 2019
@@ -0,0 +1,19 @@
+$NetBSD: patch-src_intel_tools_aubinator__error__decode.c,v 1.1 2019/08/21 13:35:28 nia Exp $
+
+Patch from FreeBSD ports graphics/mesa-dri 17.1.0
+
+# expose getline in FreeBSD's stdio.h
+#
+
+--- src/intel/tools/aubinator_error_decode.c.orig 2017-05-25 07:13:13.000000000 +0000
++++ src/intel/tools/aubinator_error_decode.c
+@@ -22,6 +22,9 @@
+ *
+ */
+
++#ifdef __FreeBSD__
++#define _WITH_GETLINE
++#endif
+ #include <stdbool.h>
+ #include <stdio.h>
+ #include <stdlib.h>
Index: pkgsrc/graphics/MesaLib/patches/patch-src_intel_vulkan_anv__allocator.c
diff -u /dev/null pkgsrc/graphics/MesaLib/patches/patch-src_intel_vulkan_anv__allocator.c:1.1
--- /dev/null Wed Aug 21 13:35:29 2019
+++ pkgsrc/graphics/MesaLib/patches/patch-src_intel_vulkan_anv__allocator.c Wed Aug 21 13:35:28 2019
@@ -0,0 +1,62 @@
+$NetBSD: patch-src_intel_vulkan_anv__allocator.c,v 1.1 2019/08/21 13:35:28 nia Exp $
+
+* Partially implement memfd_create() via mkostemp()
+* Ignore MAP_POPULATE if unsupported
+
+FreeBSD Bugzilla - Bug 225415: graphics/mesa-dri: update to 18.0.0
+https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=225415
+
+--- src/intel/vulkan/anv_allocator.c.orig 2018-02-09 02:17:59.000000000 +0000
++++ src/intel/vulkan/anv_allocator.c
+@@ -25,9 +25,21 @@
+ #include <unistd.h>
+ #include <limits.h>
+ #include <assert.h>
++#ifdef __linux__
+ #include <linux/memfd.h>
++#else
++#include <fcntl.h>
++#endif
+ #include <sys/mman.h>
+
++#ifndef MAP_POPULATE
++#define MAP_POPULATE 0
++#endif
++
++#ifndef MFD_CLOEXEC
++#define MFD_CLOEXEC O_CLOEXEC
++#endif
++
+ #include "anv_private.h"
+
+ #include "util/hash_table.h"
+@@ -113,7 +125,29 @@ struct anv_mmap_cleanup {
+ static inline int
+ memfd_create(const char *name, unsigned int flags)
+ {
++#if defined(SYS_memfd_create)
+ return syscall(SYS_memfd_create, name, flags);
++#elif defined(__FreeBSD__)
++ return shm_open(SHM_ANON, flags | O_RDWR | O_CREAT, 0600);
++#else /* DragonFly, NetBSD, OpenBSD, Solaris */
++ char template[] = "/tmp/shmfd-XXXXXX";
++#ifdef HAVE_MKOSTEMP
++ int fd = mkostemp(template, flags);
++#else
++ int fd = mkstemp(template);
++ if (flags & O_CLOEXEC) {
++ int flags = fcntl(fd, F_GETFD);
++ if (flags != -1) {
++ flags |= FD_CLOEXEC;
++ (void) fcntl(fd, F_SETFD, &flags);
++ }
++ }
++#endif /* HAVE_MKOSTEMP */
++ if (fd >= 0)
++ unlink(template);
++
++ return fd;
++#endif /* __linux__ */
+ }
+ #endif
+
Index: pkgsrc/graphics/MesaLib/patches/patch-src_intel_vulkan_anv__device.c
diff -u /dev/null pkgsrc/graphics/MesaLib/patches/patch-src_intel_vulkan_anv__device.c:1.1
--- /dev/null Wed Aug 21 13:35:29 2019
+++ pkgsrc/graphics/MesaLib/patches/patch-src_intel_vulkan_anv__device.c Wed Aug 21 13:35:28 2019
@@ -0,0 +1,47 @@
+$NetBSD: patch-src_intel_vulkan_anv__device.c,v 1.1 2019/08/21 13:35:28 nia Exp $
+
+* Without sysinfo() fall back to sysconf()
+* Define ETIME if missing
+
+FreeBSD Bugzilla - Bug 225415: graphics/mesa-dri: update to 18.0.0
+https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=225415
+
+--- src/intel/vulkan/anv_device.c.orig 2018-09-07 21:18:07.000000000 +0000
++++ src/intel/vulkan/anv_device.c
+@@ -25,7 +25,9 @@
+ #include <stdbool.h>
+ #include <string.h>
+ #include <sys/mman.h>
++#ifdef __GLIBC__
+ #include <sys/sysinfo.h>
++#endif
+ #include <unistd.h>
+ #include <fcntl.h>
+ #include <xf86drm.h>
+@@ -42,6 +44,10 @@
+
+ #include "genxml/gen7_pack.h"
+
++#ifndef ETIME
++#define ETIME ETIMEDOUT
++#endif
++
+ static void
+ compiler_debug_log(void *data, const char *fmt, ...)
+ { }
+@@ -61,11 +67,15 @@ compiler_perf_log(void *data, const char
+ static VkResult
+ anv_compute_heap_size(int fd, uint64_t gtt_size, uint64_t *heap_size)
+ {
++#ifdef __GLIBC__
+ /* Query the total ram from the system */
+ struct sysinfo info;
+ sysinfo(&info);
+
+ uint64_t total_ram = (uint64_t)info.totalram * (uint64_t)info.mem_unit;
++#else
++ uint64_t total_ram = sysctlbyname(SYSCTL_MEMSIZE, &mem, &size, nullptr, 0);
++#endif
+
+ /* We don't want to burn too much ram with the GPU. If the user has 4GiB
+ * or less, we use at most half. If they have more than 4GiB, we use 3/4.
Index: pkgsrc/graphics/MesaLib/patches/patch-src_intel_vulkan_anv__gem.c
diff -u /dev/null pkgsrc/graphics/MesaLib/patches/patch-src_intel_vulkan_anv__gem.c:1.1
--- /dev/null Wed Aug 21 13:35:29 2019
+++ pkgsrc/graphics/MesaLib/patches/patch-src_intel_vulkan_anv__gem.c Wed Aug 21 13:35:28 2019
@@ -0,0 +1,19 @@
+$NetBSD: patch-src_intel_vulkan_anv__gem.c,v 1.1 2019/08/21 13:35:28 nia Exp $
+
+* Define ETIME if missing
+
+FreeBSD Bugzilla - Bug 225415: graphics/mesa-dri: update to 18.0.0
+https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=225415
+
+--- src/intel/vulkan/anv_gem.c.orig 2018-02-09 02:17:59.000000000 +0000
++++ src/intel/vulkan/anv_gem.c
+@@ -26,6 +26,9 @@
+ #include <sys/mman.h>
+ #include <string.h>
+ #include <errno.h>
++#ifndef ETIME
++#define ETIME ETIMEDOUT
++#endif
+ #include <unistd.h>
+ #include <fcntl.h>
+
Index: pkgsrc/graphics/MesaLib/patches/patch-src_intel_vulkan_anv__gem__stubs.c
diff -u /dev/null pkgsrc/graphics/MesaLib/patches/patch-src_intel_vulkan_anv__gem__stubs.c:1.1
--- /dev/null Wed Aug 21 13:35:29 2019
+++ pkgsrc/graphics/MesaLib/patches/patch-src_intel_vulkan_anv__gem__stubs.c Wed Aug 21 13:35:28 2019
@@ -0,0 +1,36 @@
+$NetBSD: patch-src_intel_vulkan_anv__gem__stubs.c,v 1.1 2019/08/21 13:35:28 nia Exp $
+
+* Partially implement memfd_create() via mkostemp()
+
+--- src/intel/vulkan/anv_gem_stubs.c.orig 2018-12-11 21:13:57.000000000 +0000
++++ src/intel/vulkan/anv_gem_stubs.c
+@@ -31,7 +31,29 @@
+ static inline int
+ memfd_create(const char *name, unsigned int flags)
+ {
++#if defined(SYS_memfd_create)
+ return syscall(SYS_memfd_create, name, flags);
++#elif defined(__FreeBSD__)
++ return shm_open(SHM_ANON, flags | O_RDWR | O_CREAT, 0600);
++#else /* DragonFly, NetBSD, OpenBSD, Solaris */
++ char template[] = "/tmp/shmfd-XXXXXX";
++#ifdef HAVE_MKOSTEMP
++ int fd = mkostemp(template, flags);
++#else
++ int fd = mkstemp(template);
++ if (flags & O_CLOEXEC) {
++ int flags = fcntl(fd, F_GETFD);
++ if (flags != -1) {
++ flags |= FD_CLOEXEC;
++ (void) fcntl(fd, F_SETFD, &flags);
++ }
++ }
++#endif /* HAVE_MKOSTEMP */
++ if (fd >= 0)
++ unlink(template);
++
++ return fd;
++#endif /* __linux__ */
+ }
+ #endif
+
Index: pkgsrc/graphics/MesaLib/patches/patch-src_intel_vulkan_anv__queue.c
diff -u /dev/null pkgsrc/graphics/MesaLib/patches/patch-src_intel_vulkan_anv__queue.c:1.1
--- /dev/null Wed Aug 21 13:35:29 2019
+++ pkgsrc/graphics/MesaLib/patches/patch-src_intel_vulkan_anv__queue.c Wed Aug 21 13:35:28 2019
@@ -0,0 +1,25 @@
+$NetBSD: patch-src_intel_vulkan_anv__queue.c,v 1.1 2019/08/21 13:35:28 nia Exp $
+
+* Define ETIME if missing
+* Drop header that was never used (modified for Linux inclusion)
+
+FreeBSD Bugzilla - Bug 225415: graphics/mesa-dri: update to 18.0.0
+https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=225415
+
+--- src/intel/vulkan/anv_queue.c.orig 2018-02-09 02:17:59.000000000 +0000
++++ src/intel/vulkan/anv_queue.c
+@@ -26,8 +26,14 @@
+ */
+
+ #include <fcntl.h>
++#include <errno.h>
++#ifndef ETIME
++#define ETIME ETIMEDOUT
++#endif
+ #include <unistd.h>
++#if defined(__linux__)
+ #include <sys/eventfd.h>
++#endif
+
+ #include "anv_private.h"
+ #include "vk_util.h"
Index: pkgsrc/graphics/MesaLib/patches/patch-src_mesa_drivers_dri_i965_brw__oa__metrics.c
diff -u /dev/null pkgsrc/graphics/MesaLib/patches/patch-src_mesa_drivers_dri_i965_brw__oa__metrics.c:1.1
--- /dev/null Wed Aug 21 13:35:29 2019
+++ pkgsrc/graphics/MesaLib/patches/patch-src_mesa_drivers_dri_i965_brw__oa__metrics.c Wed Aug 21 13:35:28 2019
@@ -0,0 +1,13 @@
+$NetBSD: patch-src_mesa_drivers_dri_i965_brw__oa__metrics.c,v 1.1 2019/08/21 13:35:28 nia Exp $
+
+XXX compilation takes forever with clang 7.0
+
+--- src/mesa/drivers/dri/i965/brw_oa_metrics.c.orig 2018-12-11 21:14:35.000000000 +0000
++++ src/mesa/drivers/dri/i965/brw_oa_metrics.c
+@@ -1,3 +1,6 @@
++#if defined(__clang__)
++#pragma clang optimize off
++#endif
+ /* Autogenerated file, DO NOT EDIT manually! generated by brw_oa.py
+ *
+ * Copyright (c) 2015 Intel Corporation
Index: pkgsrc/graphics/MesaLib/patches/patch-src_mesa_drivers_dri_i965_brw__performance__query.c
diff -u /dev/null pkgsrc/graphics/MesaLib/patches/patch-src_mesa_drivers_dri_i965_brw__performance__query.c:1.1
--- /dev/null Wed Aug 21 13:35:29 2019
+++ pkgsrc/graphics/MesaLib/patches/patch-src_mesa_drivers_dri_i965_brw__performance__query.c Wed Aug 21 13:35:28 2019
@@ -0,0 +1,72 @@
+$NetBSD: patch-src_mesa_drivers_dri_i965_brw__performance__query.c,v 1.1 2019/08/21 13:35:28 nia Exp $
+
+Prevents libdrm i915_drm.h header from being used.
+libdrm 2.4.88 does not have certain symbols defined in its i915_drm.h.
+
+--- src/mesa/drivers/dri/i965/brw_performance_query.c.orig 2018-09-07 21:18:07.000000000 +0000
++++ src/mesa/drivers/dri/i965/brw_performance_query.c
+@@ -56,7 +56,7 @@
+ #include <sys/ioctl.h>
+
+ #include <xf86drm.h>
+-#include <i915_drm.h>
++#include "drm-uapi/i915_drm.h"
+
+ #include "main/hash.h"
+ #include "main/macros.h"
+@@ -1796,6 +1796,9 @@ enumerate_sysfs_metrics(struct brw_conte
+ DIR *metricsdir = NULL;
+ struct dirent *metric_entry;
+ int len;
++#ifdef __sun
++ struct stat s;
++#endif
+
+ len = snprintf(buf, sizeof(buf), "%s/metrics", brw->perfquery.sysfs_dev_dir);
+ if (len < 0 || len >= sizeof(buf)) {
+@@ -1812,10 +1815,18 @@ enumerate_sysfs_metrics(struct brw_conte
+ while ((metric_entry = readdir(metricsdir))) {
+ struct hash_entry *entry;
+
++#if defined(__sun)
++ stat(metric_entry->d_name, &s);
++ if ((s.st_mode != S_IFDIR &&
++ s.st_mode != S_IFLNK) ||
++ metric_entry->d_name[0] == '.')
++ continue;
++#else
+ if ((metric_entry->d_type != DT_DIR &&
+ metric_entry->d_type != DT_LNK) ||
+ metric_entry->d_name[0] == '.')
+ continue;
++#endif
+
+ DBG("metric set: %s\n", metric_entry->d_name);
+ entry = _mesa_hash_table_search(brw->perfquery.oa_metrics_table,
+@@ -2057,6 +2068,9 @@ get_sysfs_dev_dir(struct brw_context *br
+ DIR *drmdir;
+ struct dirent *drm_entry;
+ int len;
++#ifdef __sun
++ struct stat s;
++#endif
+
+ brw->perfquery.sysfs_dev_dir[0] = '\0';
+
+@@ -2088,9 +2102,16 @@ get_sysfs_dev_dir(struct brw_context *br
+ }
+
+ while ((drm_entry = readdir(drmdir))) {
++#if defined(__sun)
++ stat(drm_entry->d_name, &s);
++ if ((s.st_mode == S_IFDIR ||
++ s.st_mode == S_IFLNK) &&
++ strncmp(drm_entry->d_name, "card", 4) == 0)
++#else
+ if ((drm_entry->d_type == DT_DIR ||
+ drm_entry->d_type == DT_LNK) &&
+ strncmp(drm_entry->d_name, "card", 4) == 0)
++#endif
+ {
+ len = snprintf(brw->perfquery.sysfs_dev_dir,
+ sizeof(brw->perfquery.sysfs_dev_dir),
Index: pkgsrc/graphics/MesaLib/patches/patch-src_mesa_drivers_dri_i965_intel__tiled__memcpy.c
diff -u /dev/null pkgsrc/graphics/MesaLib/patches/patch-src_mesa_drivers_dri_i965_intel__tiled__memcpy.c:1.1
--- /dev/null Wed Aug 21 13:35:29 2019
+++ pkgsrc/graphics/MesaLib/patches/patch-src_mesa_drivers_dri_i965_intel__tiled__memcpy.c Wed Aug 21 13:35:28 2019
@@ -0,0 +1,22 @@
+$NetBSD: patch-src_mesa_drivers_dri_i965_intel__tiled__memcpy.c,v 1.1 2019/08/21 13:35:28 nia Exp $
+
+From wip/MesaLib 13.0.1.
+
+--- src/mesa/drivers/dri/i965/intel_tiled_memcpy.c.orig 2016-11-10 22:05:17.000000000 +0000
++++ src/mesa/drivers/dri/i965/intel_tiled_memcpy.c
+@@ -64,6 +64,7 @@ ror(uint32_t n, uint32_t d)
+ return (n >> d) | (n << (32 - d));
+ }
+
++#if !defined(__NetBSD__)
+ static inline uint32_t
+ bswap32(uint32_t n)
+ {
+@@ -76,6 +77,7 @@ bswap32(uint32_t n)
+ (n << 24);
+ #endif
+ }
++#endif /* NetBSD */
+
+ /**
+ * Copy RGBA to BGRA - swap R and B.
Index: pkgsrc/graphics/MesaLib/patches/patch-src_mesa_drivers_x11_Makefile.am
diff -u /dev/null pkgsrc/graphics/MesaLib/patches/patch-src_mesa_drivers_x11_Makefile.am:1.1
--- /dev/null Wed Aug 21 13:35:29 2019
+++ pkgsrc/graphics/MesaLib/patches/patch-src_mesa_drivers_x11_Makefile.am Wed Aug 21 13:35:28 2019
@@ -0,0 +1,15 @@
+$NetBSD: patch-src_mesa_drivers_x11_Makefile.am,v 1.1 2019/08/21 13:35:28 nia Exp $
+
+We don't need libmesautil.la here. Those symbols seem to already be
+included in libmesa.la.
+
+--- src/mesa/drivers/x11/Makefile.am.orig 2019-01-17 11:26:23.000000000 +0000
++++ src/mesa/drivers/x11/Makefile.am
+@@ -68,7 +68,6 @@ GL_PATCH = 0
+ lib@GL_LIB@_la_LIBADD = \
+ $(top_builddir)/src/mesa/libmesa.la \
+ $(top_builddir)/src/mapi/glapi/libglapi.la \
+- $(top_builddir)/src/util/libmesautil.la \
+ $(SHARED_GLAPI_LIB) \
+ $(GL_LIB_DEPS)
+
Index: pkgsrc/graphics/MesaLib/patches/patch-src_util_Makefile.am
diff -u /dev/null pkgsrc/graphics/MesaLib/patches/patch-src_util_Makefile.am:1.1
--- /dev/null Wed Aug 21 13:35:29 2019
+++ pkgsrc/graphics/MesaLib/patches/patch-src_util_Makefile.am Wed Aug 21 13:35:28 2019
@@ -0,0 +1,15 @@
+$NetBSD: patch-src_util_Makefile.am,v 1.1 2019/08/21 13:35:28 nia Exp $
+
+handled with CONF_FILES
+
+--- src/util/Makefile.am.orig 2018-12-11 21:13:57.000000000 +0000
++++ src/util/Makefile.am
+@@ -75,7 +75,7 @@ libxmlconfig_la_CFLAGS = \
+ libxmlconfig_la_LIBADD = $(EXPAT_LIBS) -lm
+
+ drircdir = $(datadir)/drirc.d
+-drirc_DATA = 00-mesa-defaults.conf
++drirc_DATA = # 00-mesa-defaults.conf
+
+ u_atomic_test_LDADD = libmesautil.la
+ roundeven_test_LDADD = -lm
Index: pkgsrc/graphics/MesaLib/patches/patch-src_util_build__id.c
diff -u /dev/null pkgsrc/graphics/MesaLib/patches/patch-src_util_build__id.c:1.1
--- /dev/null Wed Aug 21 13:35:29 2019
+++ pkgsrc/graphics/MesaLib/patches/patch-src_util_build__id.c Wed Aug 21 13:35:28 2019
@@ -0,0 +1,25 @@
+$NetBSD: patch-src_util_build__id.c,v 1.1 2019/08/21 13:35:28 nia Exp $
+
+Patch taken from FreeBSD ports graphics/mesa-dri mesa 17.1.0.
+
+# Elf_ doesn't exist, use Elf32_ or Elf64_.
+
+--- src/util/build_id.c.orig 2018-09-07 21:18:07.000000000 +0000
++++ src/util/build_id.c
+@@ -35,7 +35,15 @@
+ #endif
+
+ #ifndef ElfW
+-#define ElfW(type) Elf_##type
++# if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
++# ifdef __LP64__
++# define ElfW(type) Elf64_##type
++# else
++# define ElfW(type) Elf32_##type
++# endif /* __LP64__ */
++# else
++# define ElfW(type) Elf_##type
++# endif
+ #endif
+
+ struct build_id_note {
Index: pkgsrc/graphics/MesaLib/patches/patch-src_util_disk__cache.c
diff -u /dev/null pkgsrc/graphics/MesaLib/patches/patch-src_util_disk__cache.c:1.1
--- /dev/null Wed Aug 21 13:35:29 2019
+++ pkgsrc/graphics/MesaLib/patches/patch-src_util_disk__cache.c Wed Aug 21 13:35:28 2019
@@ -0,0 +1,29 @@
+$NetBSD: patch-src_util_disk__cache.c,v 1.1 2019/08/21 13:35:28 nia Exp $
+
+Use fcntl() on SunOS.
+
+--- src/util/disk_cache.c.orig 2018-09-07 21:18:07.000000000 +0000
++++ src/util/disk_cache.c
+@@ -857,6 +857,9 @@ cache_put(void *job, int thread_index)
+ unsigned i = 0;
+ char *filename = NULL, *filename_tmp = NULL;
+ struct disk_cache_put_job *dc_job = (struct disk_cache_put_job *) job;
++#ifdef __sun
++ struct flock lock = {0};
++#endif
+
+ filename = get_cache_file(dc_job->cache, dc_job->key);
+ if (filename == NULL)
+@@ -895,7 +898,12 @@ cache_put(void *job, int thread_index)
+ * open with the flock held. So just let that file be responsible
+ * for writing the file.
+ */
++#ifdef __sun
++ lock.l_type = F_WRLCK;
++ err = fcntl(fd, F_SETLK, &lock);
++#else
+ err = flock(fd, LOCK_EX | LOCK_NB);
++#endif
+ if (err == -1)
+ goto done;
+
Index: pkgsrc/graphics/MesaLib/patches/patch-src_util_futex.h
diff -u /dev/null pkgsrc/graphics/MesaLib/patches/patch-src_util_futex.h:1.1
--- /dev/null Wed Aug 21 13:35:29 2019
+++ pkgsrc/graphics/MesaLib/patches/patch-src_util_futex.h Wed Aug 21 13:35:28 2019
@@ -0,0 +1,53 @@
+$NetBSD: patch-src_util_futex.h,v 1.1 2019/08/21 13:35:28 nia Exp $
+
+Implement futex_wake() and futex_wait() via _umtx_op()
+
+FreeBSD Bugzilla - Bug 225415: graphics/mesa-dri: update to 18.0.0
+https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=225415
+
+--- src/util/futex.h.orig 2018-02-09 02:18:00.000000000 +0000
++++ src/util/futex.h
+@@ -29,10 +29,35 @@
+ #include <limits.h>
+ #include <stdint.h>
+ #include <unistd.h>
++#if defined(__FreeBSD__)
++#include <errno.h>
++# if __FreeBSD__ < 11
++# include <machine/atomic.h>
++# endif
++#include <sys/umtx.h>
++#else
+ #include <linux/futex.h>
+ #include <sys/syscall.h>
++#endif
+ #include <sys/time.h>
+
++#if defined(__FreeBSD__)
++static inline int futex_wake(uint32_t *addr, int count)
++{
++ return _umtx_op(addr, UMTX_OP_WAKE, (uint32_t)count, NULL, NULL) == -1 ? errno : 0;
++}
++
++static inline int futex_wait(uint32_t *addr, int32_t value, struct timespec *timeout)
++{
++ void *uaddr = NULL, *uaddr2 = NULL;
++ if (timeout != NULL) {
++ const struct _umtx_time tmo = { ._timeout = *timeout, ._flags = UMTX_ABSTIME, ._clockid = CLOCK_MONOTONIC };
++ uaddr = (void *)(uintptr_t)sizeof(tmo);
++ uaddr2 = (void *)&tmo;
++ }
++ return _umtx_op(addr, UMTX_OP_WAIT_UINT, (uint32_t)value, uaddr, uaddr2) == -1 ? errno : 0;
++}
++#else
+ static inline long sys_futex(void *addr1, int op, int val1, const struct timespec *timeout, void *addr2, int val3)
+ {
+ return syscall(SYS_futex, addr1, op, val1, timeout, addr2, val3);
+@@ -50,6 +75,7 @@ static inline int futex_wait(uint32_t *a
+ return sys_futex(addr, FUTEX_WAIT_BITSET, value, timeout, NULL,
+ FUTEX_BITSET_MATCH_ANY);
+ }
++#endif
+
+ #endif
+
Index: pkgsrc/graphics/MesaLib/patches/patch-src_util_ralloc.c
diff -u /dev/null pkgsrc/graphics/MesaLib/patches/patch-src_util_ralloc.c:1.1
--- /dev/null Wed Aug 21 13:35:29 2019
+++ pkgsrc/graphics/MesaLib/patches/patch-src_util_ralloc.c Wed Aug 21 13:35:28 2019
@@ -0,0 +1,25 @@
+$NetBSD: patch-src_util_ralloc.c,v 1.1 2019/08/21 13:35:28 nia Exp $
+
+FreeBSD reported atexit bug for 10.6:
+https://bugs.freedesktop.org/show_bug.cgi?id=91869
+
+* Fix exit time segfault of qt5 application with modular xorg
+* Provide compat strnlen for older Darwin.
+
+--- src/util/ralloc.c.orig 2017-05-10 14:13:58.000000000 +0000
++++ src/util/ralloc.c
+@@ -368,7 +368,14 @@ ralloc_strndup(const void *ctx, const ch
+ if (unlikely(str == NULL))
+ return NULL;
+
++#if (defined(__APPLE__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__-0 < 1070)
++ for (n = 0; n < max; n++, str++) {
++ if (!*str)
++ break;
++ }
++#else
+ n = strnlen(str, max);
++#endif
+ ptr = ralloc_array(ctx, char, n + 1);
+ memcpy(ptr, str, n);
+ ptr[n] = '\0';
Index: pkgsrc/graphics/MesaLib/patches/patch-src_util_u__queue.c
diff -u /dev/null pkgsrc/graphics/MesaLib/patches/patch-src_util_u__queue.c:1.1
--- /dev/null Wed Aug 21 13:35:29 2019
+++ pkgsrc/graphics/MesaLib/patches/patch-src_util_u__queue.c Wed Aug 21 13:35:28 2019
@@ -0,0 +1,70 @@
+$NetBSD: patch-src_util_u__queue.c,v 1.1 2019/08/21 13:35:28 nia Exp $
+
+atexit() is not a good idea in shared libraries.
+
+FreeBSD reported atexit bug for 10.6:
+https://bugs.freedesktop.org/show_bug.cgi?id=91869
+
+--- src/util/u_queue.c.orig 2018-12-11 21:13:57.000000000 +0000
++++ src/util/u_queue.c
+@@ -46,11 +46,22 @@ static once_flag atexit_once_flag = ONCE
+ static struct list_head queue_list;
+ static mtx_t exit_mutex = _MTX_INITIALIZER_NP;
+
++#if defined(HAVE_NOATEXIT)
++static int global_init_called = 0;
++
++static void __attribute__((__destructor__))
++#else
+ static void
++#endif
+ atexit_handler(void)
+ {
+ struct util_queue *iter;
+
++#if defined(HAVE_NOATEXIT)
++ if (!global_init_called)
++ return;
++#endif
++
+ mtx_lock(&exit_mutex);
+ /* Wait for all queues to assert idle. */
+ LIST_FOR_EACH_ENTRY(iter, &queue_list, head) {
+@@ -63,7 +74,11 @@ static void
+ global_init(void)
+ {
+ LIST_INITHEAD(&queue_list);
++#if defined(HAVE_NOATEXIT)
++ global_init_called = 1;
++#else
+ atexit(atexit_handler);
++#endif
+ }
+
+ static void
+@@ -244,12 +259,25 @@ util_queue_thread_func(void *input)
+ /* Don't inherit the thread affinity from the parent thread.
+ * Set the full mask.
+ */
++#if defined(__NetBSD__)
++ cpuset_t *cpuset;
++ cpuset = cpuset_create();
++ if (cpuset != NULL) {
++ cpuset_zero(cpuset);
++ for (unsigned i = 0; i < cpuset_size(cpuset); i++)
++ cpuset_set(i, cpuset);
++
++ pthread_setaffinity_np(pthread_self(), cpuset_size(cpuset), cpuset);
++ cpuset_destroy(cpuset);
++ }
++#else
+ cpu_set_t cpuset;
+ CPU_ZERO(&cpuset);
+ for (unsigned i = 0; i < CPU_SETSIZE; i++)
+ CPU_SET(i, &cpuset);
+
+ pthread_setaffinity_np(pthread_self(), sizeof(cpuset), &cpuset);
++#endif
+ }
+ #endif
+
Index: pkgsrc/graphics/MesaLib/patches/patch-src_util_u__thread.h
diff -u /dev/null pkgsrc/graphics/MesaLib/patches/patch-src_util_u__thread.h:1.1
--- /dev/null Wed Aug 21 13:35:29 2019
+++ pkgsrc/graphics/MesaLib/patches/patch-src_util_u__thread.h Wed Aug 21 13:35:28 2019
@@ -0,0 +1,76 @@
+$NetBSD: patch-src_util_u__thread.h,v 1.1 2019/08/21 13:35:28 nia Exp $
+
+handle NetBSD-style pthread_setaffinity_np(3)
+
+--- src/util/u_thread.h.orig 2018-12-11 21:13:57.000000000 +0000
++++ src/util/u_thread.h
+@@ -83,6 +83,17 @@ static inline void
+ util_pin_thread_to_L3(thrd_t thread, unsigned L3_index, unsigned cores_per_L3)
+ {
+ #if defined(HAVE_PTHREAD_SETAFFINITY)
++#if defined(__NetBSD__)
++ cpuset_t *cpuset;
++ cpuset = cpuset_create();
++ if (cpuset == NULL)
++ return;
++ cpuset_zero(cpuset);
++ for (unsigned i = 0; i < cores_per_L3; i++)
++ cpuset_set(L3_index * cores_per_L3 + i, cpuset);
++ pthread_setaffinity_np(thread, cpuset_size(cpuset), cpuset);
++ cpuset_destroy(cpuset);
++#else
+ cpu_set_t cpuset;
+
+ CPU_ZERO(&cpuset);
+@@ -90,6 +101,7 @@ util_pin_thread_to_L3(thrd_t thread, uns
+ CPU_SET(L3_index * cores_per_L3 + i, &cpuset);
+ pthread_setaffinity_np(thread, sizeof(cpuset), &cpuset);
+ #endif
++#endif
+ }
+
+ /**
+@@ -103,6 +115,35 @@ static inline int
+ util_get_L3_for_pinned_thread(thrd_t thread, unsigned cores_per_L3)
+ {
+ #if defined(HAVE_PTHREAD_SETAFFINITY)
++#if defined(__NetBSD__)
++ cpuset_t *cpuset;
++
++ cpuset = cpuset_create();
++ if (cpuset == NULL)
++ return -1;
++
++ if (pthread_getaffinity_np(thread, cpuset_size(cpuset), cpuset) == 0) {
++ int L3_index = -1;
++
++ for (unsigned i = 0; i < cpuset_size(cpuset); i++) {
++ if (cpuset_isset(i, cpuset)) {
++ int x = i / cores_per_L3;
++
++ if (L3_index != x) {
++ if (L3_index == -1)
++ L3_index = x;
++ else {
++ cpuset_destroy(cpuset);
++ return -1; /* multiple L3s are set */
++ }
++ }
++ }
++ }
++ cpuset_destroy(cpuset);
++ return L3_index;
++ }
++ cpuset_destroy(cpuset);
++#else
+ cpu_set_t cpuset;
+
+ if (pthread_getaffinity_np(thread, sizeof(cpuset), &cpuset) == 0) {
+@@ -123,6 +164,7 @@ util_get_L3_for_pinned_thread(thrd_t thr
+ return L3_index;
+ }
+ #endif
++#endif
+ return -1;
+ }
+
Index: pkgsrc/graphics/MesaLib/patches/patch-src_util_xmlconfig.c
diff -u /dev/null pkgsrc/graphics/MesaLib/patches/patch-src_util_xmlconfig.c:1.1
--- /dev/null Wed Aug 21 13:35:29 2019
+++ pkgsrc/graphics/MesaLib/patches/patch-src_util_xmlconfig.c Wed Aug 21 13:35:28 2019
@@ -0,0 +1,31 @@
+$NetBSD: patch-src_util_xmlconfig.c,v 1.1 2019/08/21 13:35:28 nia Exp $
+
+PR pkg/50202.
+Provide compat strndup for older Darwin.
+
+--- src/util/xmlconfig.c.orig 2018-09-07 21:18:07.000000000 +0000
++++ src/util/xmlconfig.c
+@@ -39,6 +39,23 @@
+ #include "xmlconfig.h"
+ #include "u_process.h"
+
++#if (defined(__APPLE__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__-0 < 1070)
++static char *
++strndup(const char *str, size_t n)
++{
++ size_t len;
++ char *copy;
++
++ for (len = 0; len < n && str[len]; len++)
++ continue;
++
++ if ((copy = (char *)malloc(len + 1)) == NULL)
++ return (NULL);
++ memcpy(copy, str, len);
++ copy[len] = '\0';
++ return (copy);
++}
++#endif
+
+ /** \brief Find an option in an option cache with the name as key */
+ static uint32_t
Index: pkgsrc/graphics/MesaLib/patches/patch-src_gallium_include_pipe_p__config.h
diff -u /dev/null pkgsrc/graphics/MesaLib/patches/patch-src_gallium_include_pipe_p__config.h:1.7
--- /dev/null Wed Aug 21 13:35:29 2019
+++ pkgsrc/graphics/MesaLib/patches/patch-src_gallium_include_pipe_p__config.h Wed Aug 21 13:35:28 2019
@@ -0,0 +1,31 @@
+$NetBSD: patch-src_gallium_include_pipe_p__config.h,v 1.7 2019/08/21 13:35:28 nia Exp $
+
+* Patches for Sparc from FreeBSD ports for mesa-dri 17.2.3.
+
+* Definitions for DragonFly already in upstream source.
+
+--- src/gallium/include/pipe/p_config.h.orig 2017-10-19 12:23:53.000000000 +0000
++++ src/gallium/include/pipe/p_config.h
+@@ -77,6 +77,12 @@
+ #define PIPE_CC_ICL
+ #endif
+
++#if defined(__sparc__) || defined(__sparc64__)
++#define PIPE_ARCH_SPARC
++#if defined(__sparc64__)
++#define PIPE_ARCH_SPARC_64
++#endif
++#endif
+
+ /*
+ * Processor architecture
+@@ -131,7 +137,8 @@
+
+ #if defined(PIPE_ARCH_X86) || defined(PIPE_ARCH_X86_64) || defined(PIPE_ARCH_ARM) || defined(PIPE_ARCH_AARCH64)
+ #define PIPE_ARCH_LITTLE_ENDIAN
+-#elif defined(PIPE_ARCH_PPC) || defined(PIPE_ARCH_PPC_64) || defined(PIPE_ARCH_S390)
++#elif defined(PIPE_ARCH_PPC) || defined(PIPE_ARCH_PPC_64) || defined(PIPE_ARCH_S390) || defined(PIPE_ARCH_SPARC) || defined(PIPE_ARCH_SPARC_64)
++
+ #define PIPE_ARCH_BIG_ENDIAN
+ #endif
+
Index: pkgsrc/graphics/MesaLib11/DESCR
diff -u /dev/null pkgsrc/graphics/MesaLib11/DESCR:1.1
--- /dev/null Wed Aug 21 13:35:29 2019
+++ pkgsrc/graphics/MesaLib11/DESCR Wed Aug 21 13:35:28 2019
@@ -0,0 +1,5 @@
+MesaLib is a 3-D graphics library with an API which is very similar to
+that of OpenGL*. To the extent that Mesa utilizes the OpenGL command syntax
+or state machine, it is being used with authorization from Silicon Graphics,
+Inc. However, the author makes no claim that Mesa is in any way a
+compatible replacement for OpenGL or associated with Silicon Graphics, Inc.
Index: pkgsrc/graphics/MesaLib11/Makefile
diff -u /dev/null pkgsrc/graphics/MesaLib11/Makefile:1.1
--- /dev/null Wed Aug 21 13:35:29 2019
+++ pkgsrc/graphics/MesaLib11/Makefile Wed Aug 21 13:35:28 2019
@@ -0,0 +1,110 @@
+# $NetBSD: Makefile,v 1.1 2019/08/21 13:35:28 nia Exp $
+
+DISTNAME= mesa-11.2.2
+PKGNAME= ${DISTNAME:S/mesa/MesaLib/}
+PKGREVISION= 11
+CATEGORIES= graphics x11
+MASTER_SITES= ftp://ftp.freedesktop.org/pub/mesa/${PKGVERSION_NOREV}/
+EXTRACT_SUFX= .tar.xz
+
+MAINTAINER= pkgsrc-users%NetBSD.org@localhost
+HOMEPAGE= https://www.mesa3d.org/
+COMMENT= The Mesa 3D Graphics Library
+LICENSE= mit
+
+GNU_CONFIGURE= yes
+USE_TOOLS+= bison pkg-config gmake flex
+USE_LANGUAGES= c99 c++
+USE_LIBTOOL= yes
+
+#CFLAGS+= -g -O0
+#CXXFLAGS+= -g -O0
+
+GCC_REQD+= 4.2
+
+PKGCONFIG_OVERRIDE+= src/egl/main/egl.pc.in
+PKGCONFIG_OVERRIDE+= src/egl/wayland/wayland-egl/wayland-egl.pc.in
+PKGCONFIG_OVERRIDE+= src/gallium/targets/d3dadapter9/d3d.pc.in
+PKGCONFIG_OVERRIDE+= src/gallium/targets/osmesa/osmesa.pc.in
+PKGCONFIG_OVERRIDE+= src/gallium/targets/xa/xatracker.pc.in
+PKGCONFIG_OVERRIDE+= src/gbm/main/gbm.pc.in
+PKGCONFIG_OVERRIDE+= src/mapi/es1api/glesv1_cm.pc.in
+PKGCONFIG_OVERRIDE+= src/mapi/es2api/glesv2.pc.in
+PKGCONFIG_OVERRIDE+= src/mesa/drivers/dri/dri.pc.in
+PKGCONFIG_OVERRIDE+= src/mesa/drivers/osmesa/osmesa.pc.in
+PKGCONFIG_OVERRIDE+= src/mesa/gl.pc.in
+
+CONFIGURE_ARGS+= --enable-shared-glapi
+
+# Work around a buildlink and/or libtool bug:
+# In the libtool install/relink stage, if we want to link with two static
+# archives named libglapi.la but in different directories, bad things happen.
+SUBST_CLASSES+= wrapper-bug
+SUBST_STAGE.wrapper-bug= pre-configure
+SUBST_MESSAGE.wrapper-bug= Renaming glapi-shared/libglapi in Makefiles
+SUBST_FILES.wrapper-bug= src/gbm/Makefile.in
+SUBST_FILES.wrapper-bug+= src/glx/Makefile.in
+SUBST_FILES.wrapper-bug+= src/mapi/Makefile.in
+SUBST_FILES.wrapper-bug+= src/mesa/drivers/x11/Makefile.in
+SUBST_SED.wrapper-bug= -e 's,shared-glapi/libglapi.la,shared-glapi/libglapi_tmp_rename.la,g'
+SUBST_SED.wrapper-bug+= -e 's,libglapi.la,libglapi_impl.la,g'
+SUBST_SED.wrapper-bug+= -e 's,libglapi_tmp_rename.la,libglapi.la,g'
+
+# Replace /etc/drirc with ${PREFIX}/etc/drirc
+SUBST_CLASSES+= drirc
+SUBST_STAGE.drirc= pre-configure
+SUBST_MESSAGE.drirc= Fixing hardcoded /etc/drirc references
+SUBST_FILES.drirc+= src/mesa/drivers/dri/common/xmlconfig.c
+SUBST_SED.drirc+= -e 's|/etc/|${PREFIX}/etc/|g'
+
+# Required due to clang defaulting to strict C standard by default (no strdup).
+CFLAGS.SunOS+= -D__EXTENSIONS__
+
+.include "../../mk/bsd.prefs.mk"
+.include "../../mk/compiler.mk"
+.include "options.mk"
+
+.if ${MACHINE_ARCH} == "i386"
+CONFIGURE_ARGS+= --enable-glx-read-only-text
+.endif
+
+.if !empty(PKGSRC_COMPILER:Mclang)
+SUBST_CLASSES+= tr1
+SUBST_STAGE.tr1= pre-configure
+SUBST_MESSAGE.tr1= Fixing TR1 C++ namespace
+SUBST_FILES.tr1= src/gallium/drivers/nouveau/codegen/*.h
+SUBST_FILES.tr1+= src/gallium/drivers/nouveau/codegen/*.cpp
+SUBST_SED.tr1= -e 's,std::tr1::,std::,g'
+SUBST_SED.tr1+= -e 's,include <tr1/,include <,g'
+.endif
+
+PYTHON_FOR_BUILD_ONLY= yes
+PYTHON_VERSIONS_INCOMPATIBLE= 36 37 # as of 11.2.2
+BUILD_DEPENDS+= ${PYPKGPREFIX}-mako-[0-9]*:../../devel/py-mako
+CONFIGURE_ENV+= ac_cv_prog_PYTHON2=${PYTHONBIN}
+.include "../../lang/python/tool.mk"
+
+# Handle platforms without exp2
+.if !empty(MACHINE_PLATFORM:MNetBSD-[1-5].*-*)
+CPPFLAGS+= -Dexp2\(x\)=exp\(\(x\)\*M_LN2\)
+CPPFLAGS+= -Dexp2f\(x\)=expf\(\(x\)\*M_LN2\)
+.endif
+
+# Manual patch for FDO bug 90311. Don't apply if not on Darwin as there could
+# be side effects.
+.if ${OPSYS} == "Darwin"
+pre-configure: ${WRKDIR}/.manual_patch_done
+${WRKDIR}/.manual_patch_done:
+ cd ${WRKSRC} && ${TOOLS_PATCH} -z .manual -p0 < ${FILESDIR}/patch-manual_fdo90311
+ touch ${.TARGET}
+.endif
+
+INSTALLATION_DIRS+= share/examples/MesaLib
+
+post-install:
+ ${INSTALL_DATA} ${WRKSRC}/src/mesa/drivers/dri/common/drirc ${DESTDIR}${PREFIX}/share/examples/MesaLib
+
+.include "../../x11/libX11/buildlink3.mk"
+.include "../../x11/libXext/buildlink3.mk"
+.include "../../x11/libxcb/buildlink3.mk"
+.include "../../mk/bsd.pkg.mk"
Index: pkgsrc/graphics/MesaLib11/PLIST
diff -u /dev/null pkgsrc/graphics/MesaLib11/PLIST:1.1
--- /dev/null Wed Aug 21 13:35:29 2019
+++ pkgsrc/graphics/MesaLib11/PLIST Wed Aug 21 13:35:28 2019
@@ -0,0 +1,82 @@
+@comment $NetBSD: PLIST,v 1.1 2019/08/21 13:35:28 nia Exp $
+${PLIST.dri}include/EGL/egl.h
+${PLIST.dri}include/EGL/eglext.h
+${PLIST.dri}include/EGL/eglextchromium.h
+${PLIST.dri}include/EGL/eglmesaext.h
+${PLIST.dri}include/EGL/eglplatform.h
+include/GL/gl.h
+include/GL/gl_mangle.h
+include/GL/glcorearb.h
+include/GL/glext.h
+include/GL/glx.h
+include/GL/glx_mangle.h
+include/GL/glxext.h
+${PLIST.dri}include/GL/internal/dri_interface.h
+include/GL/osmesa.h
+include/GL/wglext.h
+${PLIST.dri}include/GLES/egl.h
+${PLIST.dri}include/GLES/gl.h
+${PLIST.dri}include/GLES/glext.h
+${PLIST.dri}include/GLES/glplatform.h
+${PLIST.dri}include/GLES2/gl2.h
+${PLIST.dri}include/GLES2/gl2ext.h
+${PLIST.dri}include/GLES2/gl2platform.h
+${PLIST.dri}include/GLES3/gl3.h
+${PLIST.dri}include/GLES3/gl31.h
+${PLIST.dri}include/GLES3/gl3ext.h
+${PLIST.dri}include/GLES3/gl3platform.h
+${PLIST.dri}include/KHR/khrplatform.h
+${PLIST.gbm}include/gbm.h
+${PLIST.xatracker}include/xa_composite.h
+${PLIST.xatracker}include/xa_context.h
+${PLIST.xatracker}include/xa_tracker.h
+${PLIST.vaapi}lib/dri/gallium_drv_video.la
+${PLIST.i915_dri}lib/dri/i915_dri.so
+${PLIST.i965_dri}lib/dri/i965_dri.so
+${PLIST.ilo}lib/dri/ilo_dri.so
+${PLIST.freedreno}lib/dri/kgsl_dri.so
+${PLIST.swrast}lib/dri/kms_swrast_dri.so
+${PLIST.freedreno}lib/dri/msm_dri.so
+${PLIST.nouveau}lib/dri/nouveau_dri.so
+${PLIST.nouveau_dri}lib/dri/nouveau_vieux_dri.so
+${PLIST.r200_dri}lib/dri/r200_dri.so
+${PLIST.r300}lib/dri/r300_dri.so
+${PLIST.r600}lib/dri/r600_dri.so
+${PLIST.radeon_dri}lib/dri/radeon_dri.so
+${PLIST.radeonsi}lib/dri/radeonsi_dri.so
+${PLIST.swrast_dri}lib/dri/swrast_dri.so
+${PLIST.vc4}lib/dri/vc4_dri.so
+${PLIST.svga}lib/dri/vmwgfx_dri.so
+${PLIST.dri}lib/libEGL.la
+lib/libGL.la
+${PLIST.dri}lib/libGLESv1_CM.la
+${PLIST.dri}lib/libGLESv2.la
+${PLIST.gbm}lib/libgbm.la
+lib/libglapi.la
+${PLIST.wayland}lib/libwayland-egl.la
+${PLIST.xatracker}lib/libxatracker.la
+${PLIST.dri}lib/pkgconfig/dri.pc
+${PLIST.dri}lib/pkgconfig/egl.pc
+${PLIST.gbm}lib/pkgconfig/gbm.pc
+lib/pkgconfig/gl.pc
+${PLIST.dri}lib/pkgconfig/glesv1_cm.pc
+${PLIST.dri}lib/pkgconfig/glesv2.pc
+${PLIST.wayland}lib/pkgconfig/wayland-egl.pc
+${PLIST.xatracker}lib/pkgconfig/xatracker.pc
+${PLIST.nouveau}${PLIST.vdpau}lib/vdpau/libvdpau_nouveau.so
+${PLIST.nouveau}${PLIST.vdpau}lib/vdpau/libvdpau_nouveau.so.1
+${PLIST.nouveau}${PLIST.vdpau}lib/vdpau/libvdpau_nouveau.so.1.0
+${PLIST.nouveau}${PLIST.vdpau}lib/vdpau/libvdpau_nouveau.so.1.0.0
+${PLIST.vdpau}lib/vdpau/libvdpau_r300.so
+${PLIST.vdpau}lib/vdpau/libvdpau_r300.so.1
+${PLIST.vdpau}lib/vdpau/libvdpau_r300.so.1.0
+${PLIST.vdpau}lib/vdpau/libvdpau_r300.so.1.0.0
+${PLIST.vdpau}lib/vdpau/libvdpau_r600.so
+${PLIST.vdpau}lib/vdpau/libvdpau_r600.so.1
+${PLIST.vdpau}lib/vdpau/libvdpau_r600.so.1.0
+${PLIST.vdpau}lib/vdpau/libvdpau_r600.so.1.0.0
+${PLIST.vdpau}lib/vdpau/libvdpau_radeonsi.so
+${PLIST.vdpau}lib/vdpau/libvdpau_radeonsi.so.1
+${PLIST.vdpau}lib/vdpau/libvdpau_radeonsi.so.1.0
+${PLIST.vdpau}lib/vdpau/libvdpau_radeonsi.so.1.0.0
+share/examples/MesaLib/drirc
Index: pkgsrc/graphics/MesaLib11/buildlink3.mk
diff -u /dev/null pkgsrc/graphics/MesaLib11/buildlink3.mk:1.1
--- /dev/null Wed Aug 21 13:35:29 2019
+++ pkgsrc/graphics/MesaLib11/buildlink3.mk Wed Aug 21 13:35:28 2019
@@ -0,0 +1,48 @@
+# $NetBSD: buildlink3.mk,v 1.1 2019/08/21 13:35:28 nia Exp $
+
+BUILDLINK_TREE+= MesaLib
+
+.if !defined(MESALIB_BUILDLINK3_MK)
+MESALIB_BUILDLINK3_MK:=
+
+BUILDLINK_API_DEPENDS.MesaLib+= MesaLib>=3.4.2
+BUILDLINK_ABI_DEPENDS.MesaLib+= MesaLib>=7.11.2
+BUILDLINK_PKGSRCDIR.MesaLib?= ../../graphics/MesaLib
+
+.include "../../mk/bsd.fast.prefs.mk"
+
+.if ${X11_TYPE} == "modular"
+BUILDLINK_ABI_DEPENDS.MesaLib+= MesaLib>=10.5.3
+# This is needed to avoid linking conflicting libstdc++ versions
+. if defined(USE_LANGUAGES) && !empty(USE_LANGUAGES:Mc++)
+GCC_REQD+= 4.2
+. endif
+.endif
+
+# See <http://developer.apple.com/qa/qa2007/qa1567.html>.
+.if ${X11_TYPE} == "native" && !empty(MACHINE_PLATFORM:MDarwin-[9].*-*)
+BUILDLINK_LDFLAGS.MesaLib+=
-Wl,-dylib_file,/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib:/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib
+.endif
+
+pkgbase:= MesaLib
+.include "../../mk/pkg-build-options.mk"
+
+.if ${X11_TYPE} == "native" && ${OPSYS} != "Cygwin" && exists(${X11BASE}/lib/pkgconfig/dri.pc)
+PKG_BUILD_OPTIONS.MesaLib+= dri
+.endif
+
+.if !empty(PKG_BUILD_OPTIONS.MesaLib:Mdri)
+. include "../../graphics/MesaLib/dri.mk"
+.endif
+
+.if ${X11_TYPE} == "modular" && !empty(PKG_BUILD_OPTIONS.MesaLib:Mdri) && ${OPSYS} != "Darwin" || \
+ ${X11_TYPE} == "native" && exists(${X11BASE}/include/EGL/egl.h)
+MESALIB_SUPPORTS_EGL= yes
+.else
+MESALIB_SUPPORTS_EGL= no
+.endif
+
+.include "../../x11/libXext/buildlink3.mk"
+.endif # MESALIB_BUILDLINK3_MK
+
+BUILDLINK_TREE+= -MesaLib
Index: pkgsrc/graphics/MesaLib11/builtin.mk
diff -u /dev/null pkgsrc/graphics/MesaLib11/builtin.mk:1.1
--- /dev/null Wed Aug 21 13:35:29 2019
+++ pkgsrc/graphics/MesaLib11/builtin.mk Wed Aug 21 13:35:28 2019
@@ -0,0 +1,87 @@
+# $NetBSD: builtin.mk,v 1.1 2019/08/21 13:35:28 nia Exp $
+
+BUILTIN_PKG:= MesaLib
+
+BUILTIN_FIND_FILES_VAR:= H_MESALIB PC_GL
+BUILTIN_FIND_FILES.H_MESALIB= ${X11BASE}/include/GL/glx.h
+BUILTIN_FIND_FILES.PC_GL= ${X11BASE}/lib/pkgconfig/gl.pc
+BUILTIN_FIND_FILES.PC_GL+= ${X11BASE}/lib${LIBABISUFFIX}/pkgconfig/gl.pc
+
+.include "../../mk/buildlink3/bsd.builtin.mk"
+
+###
+### Determine if there is a built-in implementation of the package and
+### set IS_BUILTIN.<pkg> appropriately ("yes" or "no").
+###
+.if !defined(IS_BUILTIN.MesaLib)
+. if empty(PC_GL:M__nonexistent__)
+IS_BUILTIN.MesaLib= yes
+. elif empty(H_MESALIB:M__nonexistent__)
+IS_BUILTIN.MesaLib= yes
+. else
+IS_BUILTIN.MesaLib= no
+. endif
+.endif
+MAKEVARS+= IS_BUILTIN.MesaLib
+
+###
+### If there is a built-in implementation, then set BUILTIN_PKG.<pkg> to
+### a package name to represent the built-in package.
+###
+.if !defined(BUILTIN_PKG.MesaLib) && \
+ !empty(IS_BUILTIN.MesaLib:M[yY][eE][sS])
+. if empty(PC_GL:M__nonexistent__)
+BUILTIN_VERSION.Mesa!= ${SED} -n -e 's/Version: //p' ${PC_GL}
+. elif empty(H_MESALIB:M__nonexistent__)
+. include "../../graphics/Mesa/version.mk"
+. else # ?
+BUILTIN_VERSION.Mesa:= 0.something-weird-happened
+. endif
+BUILTIN_PKG.MesaLib= MesaLib-${BUILTIN_VERSION.Mesa}
+MAKEVARS+= BUILTIN_VERSION.Mesa
+.endif
+MAKEVARS+= BUILTIN_PKG.MesaLib
+
+###
+### Determine whether we should use the built-in implementation if it
+### exists, and set USE_BUILTIN.<pkg> appropriate ("yes" or "no").
+###
+.if !defined(USE_BUILTIN.MesaLib)
+. if ${PREFER.MesaLib} == "pkgsrc"
+USE_BUILTIN.MesaLib= no
+. else
+USE_BUILTIN.MesaLib= ${IS_BUILTIN.MesaLib}
+. if defined(BUILTIN_PKG.MesaLib) && \
+ !empty(IS_BUILTIN.MesaLib:M[yY][eE][sS])
+USE_BUILTIN.MesaLib= yes
+. for dep in ${BUILDLINK_API_DEPENDS.MesaLib}
+. if !empty(USE_BUILTIN.MesaLib:M[yY][eE][sS])
+USE_BUILTIN.MesaLib!= \
+ if ${PKG_ADMIN} pmatch ${dep:Q} ${BUILTIN_PKG.MesaLib}; then \
+ ${ECHO} yes; \
+ else \
+ ${ECHO} no; \
+ fi
+. endif
+. endfor
+. endif
+. endif # PREFER.MesaLib
+.endif
+MAKEVARS+= USE_BUILTIN.MesaLib
+
+###
+### The section below only applies if we are not including this file
+### solely to determine whether a built-in implementation exists.
+###
+CHECK_BUILTIN.MesaLib?= no
+.if !empty(CHECK_BUILTIN.MesaLib:M[nN][oO])
+
+. if !empty(USE_BUILTIN.MesaLib:M[nN][oO])
+. include "../../mk/pthread.buildlink3.mk"
+. include "../../mk/pthread.builtin.mk"
+BUILTIN_PKG:= MesaLib
+. endif
+
+. include "../../mk/x11.builtin.mk"
+
+.endif # CHECK_BUILTIN.MesaLib
Index: pkgsrc/graphics/MesaLib11/distinfo
diff -u /dev/null pkgsrc/graphics/MesaLib11/distinfo:1.1
--- /dev/null Wed Aug 21 13:35:29 2019
+++ pkgsrc/graphics/MesaLib11/distinfo Wed Aug 21 13:35:28 2019
@@ -0,0 +1,62 @@
+$NetBSD: distinfo,v 1.1 2019/08/21 13:35:28 nia Exp $
+
+SHA1 (mesa-11.2.2.tar.xz) = c3805020be6fef77d3b96a5ddf4ddc256dee16ff
+RMD160 (mesa-11.2.2.tar.xz) = 14bca7cc76015e53db2fafcebb8540f451be5aab
+SHA512 (mesa-11.2.2.tar.xz) = fd1fcb1bc97e52784a4b3dedfd8c8ba95bc1b03a62b132d2e16154d076be7a6fabbca1bcba705a7916a1507d811d7f3e6c3488aa386d5e63891282fb1713ce52
+Size (mesa-11.2.2.tar.xz) = 7860932 bytes
+SHA1 (patch-configure) = 87f0f2e60f342c91b3aecab02d3a4d8940eadf0a
+SHA1 (patch-include_GL_glxext.h) = 830902f2d38a8395cda682c059fc5223e1b0e89e
+SHA1 (patch-src_compiler_glsl_builtin__functions.cpp) = 1be4e67eda2105f375942c2991cf432e5d74e597
+SHA1 (patch-src_egl_drivers_dri2_platform__drm.c) = 99b6dd6739c29551ae2c885eabd7babd159fc3e5
+SHA1 (patch-src_egl_drivers_dri2_platform__x11.c) = 04b6ef8e755f226fbe3e6f2bea6c9e2a56a783ca
+SHA1 (patch-src_egl_main_eglglobals.c) = 2d81ae27f09162d23bc684456cc5fef48c042652
+SHA1 (patch-src_gallium_auxiliary_draw_draw__llvm.c) = fc1a313eed85042b7ac2db67c6fd1902074fb43a
+SHA1 (patch-src_gallium_auxiliary_gallivm_lp__bld__intr.c) = 4c40981645675cfeb55bf28317158ebb6332268d
+SHA1 (patch-src_gallium_auxiliary_gallivm_lp__bld__intr.h) = 07f2606d94b9af30df838206841cbcd8a198d799
+SHA1 (patch-src_gallium_auxiliary_gallivm_lp__bld__sample__soa.c) = e94692f8dbae1247e5780cebf24e4a333b1fcd0a
+SHA1 (patch-src_gallium_auxiliary_util_u__format__tests.c) = 4d5e4677c2825778c43440ab131b8807f6840975
+SHA1 (patch-src_gallium_auxiliary_util_u__math.h) = 812e4a5291aea47e06505f09891e0434c4d9c34d
+SHA1 (patch-src_gallium_auxiliary_util_u__network.c) = 283f505af780071dc9fd7914f8065e3fb7d8a4fd
+SHA1 (patch-src_gallium_auxiliary_util_u__network.h) = c6106d67b4fa9db0d790474182d6e0ce0c5da677
+SHA1 (patch-src_gallium_drivers_llvmpipe_lp__state__fs.c) = b14ca18ae1dc03901b197c86e67052bbb154a81f
+SHA1 (patch-src_gallium_drivers_llvmpipe_lp__state__setup.c) = 1d6c24bc598da9945ce75c1cc6a2334228d66b41
+SHA1 (patch-src_gallium_drivers_nouveau_codegen_nv50__ir__peephole.cpp) = 5fc2ef7eafac3006896af96bac8176c79b17cfdc
+SHA1 (patch-src_gallium_drivers_nouveau_nouveau__debug.h) = dd60605a9d89e573ad2cdeb67b11450b0eedeebf
+SHA1 (patch-src_gallium_drivers_nouveau_nouveau__vp3__video.c) = ae1b6eb4df3e4db0f37e44118cdf69b16f3c471e
+SHA1 (patch-src_gallium_drivers_nouveau_nv50_nv84__video.c) = 1b4239fe053523835ecac006894bdb0cde0ee626
+SHA1 (patch-src_gallium_drivers_r600_r600__llvm.c) = 37ffa4df519df4b7a35b686448e823200d5144ae
+SHA1 (patch-src_gallium_drivers_radeon_radeon__llvm__util.c) = 63852f9abaa4d75d0043ae748bba718a35459a11
+SHA1 (patch-src_gallium_drivers_radeon_radeon__setup__tgsi__llvm.c) = 7957999b555c9c2e68a1d9b2eece5989e6612ff3
+SHA1 (patch-src_gallium_drivers_radeonsi_si__shader.c) = 44b790ee0d8b843421114b61ddae6a4d4ef2a099
+SHA1 (patch-src_gallium_targets_dri_Makefile.in) = a9a8265d97297040a3e3260b362ca920ec852280
+SHA1 (patch-src_gallium_winsys_radeon_drm_radeon__drm__winsys.c) = 2358b7d5ea89e28cb3ac07a408b18e8bf55e057a
+SHA1 (patch-src_gallium_winsys_svga_drm_vmw__screen.c) = 7b9c57c2b5a0f5d244c27d4c6164736853e43b47
+SHA1 (patch-src_gallium_winsys_svga_drm_vmw__screen__ioctl.c) = e4b891e8b4ebe5b8e8c7b8c2c1dbed11b9c417df
+SHA1 (patch-src_gbm_main_gbm.c) = e49c319c4a9a63433983ec024ccdfeb966b418b0
+SHA1 (patch-src_glsl_ralloc.c) = 63c8e40b9f74404033c20c5c9a00c5f6d8df6433
+SHA1 (patch-src_glx_apple_apple__glapi.c) = df70afc24759978f954ac3a774a14e6518dde97a
+SHA1 (patch-src_glx_glxclient.h) = e15256851559dafb7a86e1eb7e9d6afc86de581b
+SHA1 (patch-src_glx_glxcurrent.c) = 713f75bcafb186c7123d19a6aae3deaed9d5fa69
+SHA1 (patch-src_loader_Makefile.in) = 30454c207924183c881a84d31458fdc0ddb1680b
+SHA1 (patch-src_loader_loader.c) = 8dca08425dd0817eb5920705d61a257022240957
+SHA1 (patch-src_mapi_entry__x86-64__tls.h) = e1cc896dd9cf7d77b837104557c0e0bf9d41ff55
+SHA1 (patch-src_mapi_entry__x86__tls.h) = 3d6c11281b57c9c713899022bfc8fcea54d07d56
+SHA1 (patch-src_mapi_entry__x86__tsd.h) = 62501b6e609fa81e33fd826a694e9d9752a7ba21
+SHA1 (patch-src_mapi_glapi_gen_gl__gentable.py) = 53026e520a510e54494760a3fa05af6f15dfb9d8
+SHA1 (patch-src_mapi_u__current.c) = 1731375d82119be326b35d141d7879e083d6d620
+SHA1 (patch-src_mapi_u__current.h) = 214dd29cb0c4fe127eb1157b04b12ddfc455b4b0
+SHA1 (patch-src_mesa_drivers_dri_Makefile.in) = 48032b8f8e6eac59092f68f3c32cfdd44d7ce8bf
+SHA1 (patch-src_mesa_drivers_dri_common_Makefile.in) = 5e160f7d92c2e9f3fa36e52a082a496af67e634e
+SHA1 (patch-src_mesa_drivers_dri_common_xmlconfig.c) = b87644c5ef5fb5d71c3260026d3afdfbaee749a8
+SHA1 (patch-src_mesa_drivers_dri_i915_intel__screen.c) = fd8436e4e3a69250256c2cddf8138effb16bd7b3
+SHA1 (patch-src_mesa_drivers_dri_i965_intel__screen.c) = 7c1a1e5c549f64d4c390e0c87984c44a88d4abfe
+SHA1 (patch-src_mesa_drivers_dri_swrast_swrast.c) = b8a6cca517e1cccbdb2c59cf67a6d2481cdfebd4
+SHA1 (patch-src_mesa_main_context.c) = 695b0e04cbd08dfed46b4dae5f9602b35e21f5b3
+SHA1 (patch-src_mesa_main_extensions.c) = d650d7ddfe22ddbcd8a4c24b64feb27126521ae0
+SHA1 (patch-src_mesa_main_macros.h) = e0e98dff37bbf96fea2f3adf0dc9ef9911b711d9
+SHA1 (patch-src_mesa_main_shader__query.cpp) = 6273c74161f045363c58f38adeb672287f6a0898
+SHA1 (patch-src_mesa_tnl_t__pipeline.c) = afc7d5f27aeadacc7c6a762e5aa892e01a0c1317
+SHA1 (patch-src_mesa_x86_common__x86.c) = bdac91384d67ad0238ecd4cdcf5cfc787952a3d9
+SHA1 (patch-src_util_strndup.c) = b8dfae71f1b219e44f884b8fc6f89a86201353c3
+SHA1 (patch-src_util_strndup.h) = a48a0ebefbc79a770db4baa590d3f858bb52cacf
+SHA1 (patch-src_util_u__atomic.h) = 4a567b6fe5bf67fb7f386fa5f37bedb66d593085
Index: pkgsrc/graphics/MesaLib11/dri.mk
diff -u /dev/null pkgsrc/graphics/MesaLib11/dri.mk:1.1
--- /dev/null Wed Aug 21 13:35:29 2019
+++ pkgsrc/graphics/MesaLib11/dri.mk Wed Aug 21 13:35:28 2019
@@ -0,0 +1,37 @@
+# $NetBSD: dri.mk,v 1.1 2019/08/21 13:35:28 nia Exp $
+#
+# Currently, this is for convenience only.
+#
+.if !defined(DRI_MK)
+DRI_MK= # defined
+
+. if !defined(USE_BUILTIN.MesaLib)
+CHECK_BUILTIN.MesaLib:= yes
+. include "../../graphics/MesaLib/builtin.mk"
+CHECK_BUILTIN.MesaLib:= no
+. endif
+
+. if !empty(USE_BUILTIN.MesaLib:M[Nn][Oo])
+. if ${OPSYS} != "Darwin"
+BUILDLINK_API_DEPENDS.libdrm+= libdrm>=2.4.60
+. endif
+. if ${OPSYS} == "Linux"
+BUILDLINK_API_DEPENDS.libxcb+= libxcb>=1.9.3
+. endif
+. endif
+. include "../../textproc/expat/buildlink3.mk"
+. include "../../x11/xorgproto/buildlink3.mk"
+# XXX these do not have builtin.mk
+. if ${X11_TYPE} == "modular"
+. include "../../x11/libxshmfence/buildlink3.mk"
+. endif
+. include "../../x11/libXdamage/buildlink3.mk"
+. include "../../x11/libXfixes/buildlink3.mk"
+. include "../../x11/libXxf86vm/buildlink3.mk"
+. if ${OPSYS} != "Darwin"
+. include "../../x11/libdrm/buildlink3.mk"
+. endif
+. if ${OPSYS} == "FreeBSD" || ${OPSYS} == "DragonFly"
+. include "../../devel/libdevq/buildlink3.mk"
+. endif
+.endif
Index: pkgsrc/graphics/MesaLib11/options.mk
diff -u /dev/null pkgsrc/graphics/MesaLib11/options.mk:1.1
--- /dev/null Wed Aug 21 13:35:29 2019
+++ pkgsrc/graphics/MesaLib11/options.mk Wed Aug 21 13:35:28 2019
@@ -0,0 +1,215 @@
+# $NetBSD: options.mk,v 1.1 2019/08/21 13:35:28 nia Exp $
+
+PKG_OPTIONS_VAR= PKG_OPTIONS.MesaLib
+PKG_SUPPORTED_OPTIONS= llvm dri wayland
+PKG_SUGGESTED_OPTIONS=
+
+# The LLVM option enables JIT accelerated software rendering and
+# is also required to support the latest RADEON GPUs, so enable it
+# by default on platforms where such GPUs might be encountered.
+.if (${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "x86_64") && \
+ ${OPSYS} != "SunOS" && ${OPSYS} != "Darwin" && \
+ !(${OPSYS} == "NetBSD" && ${X11_TYPE} == "native")
+PKG_SUGGESTED_OPTIONS+= llvm
+.endif
+
+.if ${OPSYS} == "FreeBSD" || ${OPSYS} == "OpenBSD" || \
+ ${OPSYS} == "DragonFly" || ${OPSYS} == "Linux" || \
+ ${OPSYS} == "SunOS" || ${OPSYS} == "Darwin" || \
+ (${OPSYS} == "NetBSD" && ${X11_TYPE} == "modular")
+PKG_SUGGESTED_OPTIONS+= dri
+.endif
+
+.include "../../mk/bsd.options.mk"
+
+# gallium
+PLIST_VARS+= freedreno ilo i915 i965 nouveau r300 r600 radeonsi \
+ swrast svga vc4 virgl
+# classic DRI
+PLIST_VARS+= dri swrast_dri i915_dri nouveau_dri i965_dri radeon_dri r200_dri
+# other features
+PLIST_VARS+= gbm vaapi vdpau wayland xatracker
+
+.if !empty(PKG_OPTIONS:Mdri)
+
+CONFIGURE_ARGS+= --enable-dri
+CONFIGURE_ARGS+= --enable-egl
+.if ${OPSYS} != "Darwin"
+CFLAGS+= -DHAVE_DRI3
+CONFIGURE_ARGS+= --enable-dri3
+CONFIGURE_ARGS+= --enable-gbm
+PLIST.gbm= yes
+.endif
+CONFIGURE_ARGS+= --enable-gles1
+CONFIGURE_ARGS+= --enable-gles2
+
+# Use Thread Local Storage in GLX where it is supported by Mesa and works.
+.if \
+ !empty(MACHINE_PLATFORM:MNetBSD-[789].*-i386) || \
+ !empty(MACHINE_PLATFORM:MNetBSD-[789].*-x86_64) || \
+ !empty(MACHINE_PLATFORM:MLinux-*-i386) || \
+ !empty(MACHINE_PLATFORM:MLinux-*-x86_64) || \
+ !empty(MACHINE_PLATFORM:MFreeBSD-1[0-9].*-x86_64) || \
+ !empty(MACHINE_PLATFORM:MDragonFly-*-x86_64)
+CONFIGURE_ARGS+= --enable-glx-tls
+.else
+CONFIGURE_ARGS+= --disable-glx-tls
+.endif
+
+# DRI on Linux needs either sysfs or udev
+CONFIGURE_ARGS.Linux+= --enable-sysfs
+
+PLIST.dri= yes
+
+.if ${OPSYS} != "Darwin"
+BUILDLINK_DEPMETHOD.libpciaccess= full
+.include "../../sysutils/libpciaccess/buildlink3.mk"
+.endif
+.include "../../graphics/MesaLib/dri.mk"
+
+DRI_DRIVERS= #
+GALLIUM_DRIVERS= #
+
+# Software rasterizer
+PLIST.swrast_dri= yes
+DRI_DRIVERS+= swrast
+.if ${OPSYS} != "Darwin"
+PLIST.swrast= yes
+GALLIUM_DRIVERS+= swrast
+.endif
+
+# x86 only drivers
+.if (${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "x86_64") && ${OPSYS} != "Darwin"
+# svga / VMWare driver
+PLIST.svga= yes
+GALLIUM_DRIVERS+= svga
+
+# Intel chipsets, x86 only
+PLIST.i915= yes
+GALLIUM_DRIVERS+= i915
+PLIST.i915_dri= yes
+DRI_DRIVERS+= i915
+
+# Experimental Intel driver
+PLIST.ilo= yes
+GALLIUM_DRIVERS+= ilo
+
+PLIST.i965_dri= yes
+DRI_DRIVERS+= i965
+.endif
+
+# ARM drivers
+.if !empty(MACHINE_PLATFORM:MNetBSD-*-*arm*)
+# Qualcomm SnapDragon, libdrm_freedreno.pc
+GALLIUM_DRIVERS+= freedreno
+PLIST.freedreno= yes
+
+# Broadcom VideoCore 4
+GALLIUM_DRIVERS+= vc4
+PLIST.vc4= yes
+.endif
+
+# qemu Linux guest driver
+.if !empty(MACHINE_PLATFORM:MLinux-*-x86_64)
+# XXX test this
+#GALLIUM_DRIVERS+= virgl
+#PLIST.virgl= yes
+.endif
+
+# theoretically cross platform PCI drivers
+.if ${OPSYS} != "Darwin" && empty(MACHINE_PLATFORM:MNetBSD-*-*arm*) && \
+ empty(MACHINE_PLATFORM:MNetBSD-*-mipsel)
+
+# AMD Radeon r600
+PLIST.r600= yes
+GALLIUM_DRIVERS+= r600
+
+# FreeBSD lacks nouveau support (there are official binaries from Nvidia)
+.if ${OPSYS} != "FreeBSD"
+# nVidia
+PLIST.nouveau= yes
+GALLIUM_DRIVERS+= nouveau
+.endif
+
+# classic DRI radeon
+PLIST.radeon_dri= yes
+DRI_DRIVERS+= radeon
+
+# classic DRI r200
+PLIST.r200_dri= yes
+DRI_DRIVERS+= r200
+
+# FreeBSD lacks nouveau support (there are official binaries from Nvidia)
+.if ${OPSYS} != "FreeBSD"
+# classic DRI nouveau
+PLIST.nouveau_dri= yes
+DRI_DRIVERS+= nouveau
+.endif
+
+.endif
+
+.if ${OPSYS} == "Darwin"
+CONFIGURE_ARGS+= --with-egl-platforms=x11
+#.elif ${OPSYS} == "Linux"
+#.include "../../wip/wayland/buildlink3.mk"
+#CONFIGURE_ARGS+= --with-egl-platforms=x11,drm,wayland
+#PLIST.wayland= yes
+.else
+CONFIGURE_ARGS+= --with-egl-platforms=x11,drm
+.endif
+
+CONFIGURE_ARGS+= --with-gallium-drivers=${GALLIUM_DRIVERS:ts,}
+CONFIGURE_ARGS+= --with-dri-drivers=${DRI_DRIVERS:ts,}
+
+.if !empty(PKG_OPTIONS:Mllvm)
+# VA-API and VDPAU
+.include "../../multimedia/libva/available.mk"
+.if ${VAAPI_AVAILABLE} == "yes"
+PLIST.vaapi= yes
+.include "../../multimedia/libva/buildlink3.mk"
+.endif
+.include "../../multimedia/libvdpau/available.mk"
+.if ${VDPAU_AVAILABLE} == "yes"
+PLIST.vdpau= yes
+.include "../../multimedia/libvdpau/buildlink3.mk"
+.endif
+
+# XA is useful for accelerating xf86-video-vmware
+CONFIGURE_ARGS+= --enable-xa
+PLIST.xatracker= yes
+# AMD Radeon r300
+PLIST.r300= yes
+GALLIUM_DRIVERS+= r300
+# AMD Canary Islands GPUs
+PLIST.radeonsi= yes
+GALLIUM_DRIVERS+= radeonsi
+CONFIGURE_ARGS+= --enable-gallium-llvm
+CONFIGURE_ARGS+= --enable-r600-llvm-compiler
+.include "../../devel/libelf/buildlink3.mk"
+CPPFLAGS+= -I${BUILDLINK_PREFIX.libelf}/include/libelf
+.include "../../lang/libLLVM4/buildlink3.mk"
+CONFIGURE_ENV+= ac_cv_path_ac_pt_LLVM_CONFIG=${LLVM_CONFIG_PATH}
+.else # !llvm
+CONFIGURE_ARGS+= --disable-xa
+CONFIGURE_ARGS+= --disable-gallium-llvm
+CONFIGURE_ARGS+= --disable-r600-llvm-compiler
+.endif # llvm
+.else # !dri
+CONFIGURE_ARGS+= --with-gallium-drivers=
+CONFIGURE_ARGS+= --with-dri-drivers=
+CONFIGURE_ARGS+= --disable-dri
+CONFIGURE_ARGS+= --disable-dri3
+CONFIGURE_ARGS+= --disable-egl
+CONFIGURE_ARGS+= --disable-gbm
+CONFIGURE_ARGS+= --disable-gles1
+CONFIGURE_ARGS+= --disable-gles2
+CONFIGURE_ARGS+= --enable-xlib-glx
+.if !empty(PKG_OPTIONS:Mllvm)
+PKG_FAIL_REASON+= "The llvm PKG_OPTION must also be disabled when dri is disabled"
+.endif
+.endif
+
+.if !empty(PKG_OPTIONS:Mwayland)
+.include "../../wip/wayland/buildlink3.mk"
+.include "../../wip/wayland-protocols/buildlink3.mk"
+.endif
Index: pkgsrc/graphics/MesaLib11/files/patch-manual_fdo90311
diff -u /dev/null pkgsrc/graphics/MesaLib11/files/patch-manual_fdo90311:1.1
--- /dev/null Wed Aug 21 13:35:29 2019
+++ pkgsrc/graphics/MesaLib11/files/patch-manual_fdo90311 Wed Aug 21 13:35:28 2019
@@ -0,0 +1,111 @@
+$NetBSD: patch-manual_fdo90311,v 1.1 2019/08/21 13:35:28 nia Exp $
+
+https://bugs.freedesktop.org/show_bug.cgi?id=90311
+
+Regenerated with autoconf to link with C++ linker using this addition:
+
+libglx_la_LIBADD += $(builddir)/apple/libappleglx.la + $(top_builddir)/src/mesa/libmesa.la
+nodist_EXTRA_lib@GL_LIB@_la_SOURCES = dummy.cpp
+
+and then dummy.cpp manuallly edited out.
+
+--- src/glx/Makefile.in.orig 2015-12-15 14:52:32.000000000 +0000
++++ src/glx/Makefile.in
+@@ -143,7 +143,7 @@ target_triplet = @target@
+ @HAVE_APPLEDRI_TRUE@ applegl_glx.c
+
+ @HAVE_APPLEDRI_TRUE@am__append_7 = apple
+-@HAVE_APPLEDRI_TRUE@am__append_8 = $(builddir)/apple/libappleglx.la
++@HAVE_APPLEDRI_TRUE@am__append_8 = $(builddir)/apple/libappleglx.la $(top_builddir)/src/mesa/libmesa.la
+ subdir = src/glx
+ ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+ am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_gnu_make.m4 \
+@@ -202,10 +202,10 @@ AM_V_lt = $(am__v_lt_@AM_V@)
+ am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
+ am__v_lt_0 = --silent
+ am__v_lt_1 =
+-lib@GL_LIB@_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
+- $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
+- $(AM_CFLAGS) $(CFLAGS) $(lib@GL_LIB@_la_LDFLAGS) $(LDFLAGS) -o \
+- $@
++lib@GL_LIB@_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX \
++ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CXXLD) \
++ $(AM_CXXFLAGS) $(CXXFLAGS) $(lib@GL_LIB@_la_LDFLAGS) \
++ $(LDFLAGS) -o $@
+ libglx_la_DEPENDENCIES = $(top_builddir)/src/loader/libloader.la \
+ $(am__append_5) $(am__append_8)
+ am__libglx_la_SOURCES_DIST = clientattrib.c clientinfo.c compsize.c \
+@@ -276,6 +276,24 @@ AM_V_CCLD = $(am__v_CCLD_@AM_V@)
+ am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
+ am__v_CCLD_0 = @echo " CCLD " $@;
+ am__v_CCLD_1 =
++CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
++ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
++LTCXXCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \
++ $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) \
++ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
++ $(AM_CXXFLAGS) $(CXXFLAGS)
++AM_V_CXX = $(am__v_CXX_@AM_V@)
++am__v_CXX_ = $(am__v_CXX_@AM_DEFAULT_V@)
++am__v_CXX_0 = @echo " CXX " $@;
++am__v_CXX_1 =
++CXXLD = $(CXX)
++CXXLINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \
++ $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \
++ $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
++AM_V_CXXLD = $(am__v_CXXLD_@AM_V@)
++am__v_CXXLD_ = $(am__v_CXXLD_@AM_DEFAULT_V@)
++am__v_CXXLD_0 = @echo " CXXLD " $@;
++am__v_CXXLD_1 =
+ SOURCES = $(lib@GL_LIB@_la_SOURCES) $(libglx_la_SOURCES)
+ DIST_SOURCES = $(lib@GL_LIB@_la_SOURCES) $(am__libglx_la_SOURCES_DIST)
+ RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \
+@@ -696,7 +714,7 @@ lib@GL_LIB@_la_LDFLAGS = $(GL_LDFLAGS)
+ all: all-recursive
+
+ .SUFFIXES:
+-.SUFFIXES: .c .lo .o .obj
++.SUFFIXES: .c .cpp .lo .o .obj
+ $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/install-lib-links.mk $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+@@ -775,7 +793,7 @@ clean-noinstLTLIBRARIES:
+ }
+
+ lib@GL_LIB@.la: $(lib@GL_LIB@_la_OBJECTS) $(lib@GL_LIB@_la_DEPENDENCIES) $(EXTRA_lib@GL_LIB@_la_DEPENDENCIES)
+- $(AM_V_CCLD)$(lib@GL_LIB@_la_LINK) -rpath $(libdir) $(lib@GL_LIB@_la_OBJECTS) $(lib@GL_LIB@_la_LIBADD) $(LIBS)
++ $(AM_V_CXXLD)$(lib@GL_LIB@_la_LINK) -rpath $(libdir) $(lib@GL_LIB@_la_OBJECTS) $(lib@GL_LIB@_la_LIBADD) $(LIBS)
+
+ libglx.la: $(libglx_la_OBJECTS) $(libglx_la_DEPENDENCIES) $(EXTRA_libglx_la_DEPENDENCIES)
+ $(AM_V_CCLD)$(LINK) $(libglx_la_OBJECTS) $(libglx_la_LIBADD) $(LIBS)
+@@ -852,6 +870,30 @@ distclean-compile:
+ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $<
+
++.cpp.o:
++@am__fastdepCXX_TRUE@ $(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
++@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
++@am__fastdepCXX_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po
++@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
++@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
++@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ $<
++
++.cpp.obj:
++@am__fastdepCXX_TRUE@ $(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
++@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\
++@am__fastdepCXX_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po
++@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
++@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
++@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
++
++.cpp.lo:
++@am__fastdepCXX_TRUE@ $(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\
++@am__fastdepCXX_TRUE@ $(LTCXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
++@am__fastdepCXX_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo
++@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
++@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
++@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LTCXXCOMPILE) -c -o $@ $<
++
+ mostlyclean-libtool:
+ -rm -f *.lo
+
Index: pkgsrc/graphics/MesaLib11/patches/patch-configure
diff -u /dev/null pkgsrc/graphics/MesaLib11/patches/patch-configure:1.1
--- /dev/null Wed Aug 21 13:35:29 2019
+++ pkgsrc/graphics/MesaLib11/patches/patch-configure Wed Aug 21 13:35:29 2019
@@ -0,0 +1,161 @@
+$NetBSD: patch-configure,v 1.1 2019/08/21 13:35:29 nia Exp $
+
+Add libdevq support from FreeBSD ports.
+
+--- configure.orig 2016-01-13 10:48:25.000000000 +0000
++++ configure
+@@ -860,6 +860,8 @@ GLPROTO_LIBS
+ GLPROTO_CFLAGS
+ XLIBGL_LIBS
+ XLIBGL_CFLAGS
++LIBDEVQ_LIBS
++LIBDEVQ_CFLAGS
+ LIBUDEV_LIBS
+ LIBUDEV_CFLAGS
+ ENABLE_SHADER_CACHE_FALSE
+@@ -1174,6 +1176,8 @@ OPENSSL_CFLAGS
+ OPENSSL_LIBS
+ LIBUDEV_CFLAGS
+ LIBUDEV_LIBS
++LIBDEVQ_CFLAGS
++LIBDEVQ_LIBS
+ XLIBGL_CFLAGS
+ XLIBGL_LIBS
+ GLPROTO_CFLAGS
+@@ -5287,6 +5291,7 @@ DRI2PROTO_REQUIRED=2.6
+ DRI3PROTO_REQUIRED=1.0
+ PRESENTPROTO_REQUIRED=1.0
+ LIBUDEV_REQUIRED=151
++LIBDEVQ_REQUIRED=0.0.2
+ GLPROTO_REQUIRED=1.4.14
+ LIBOMXIL_BELLAGIO_REQUIRED=0.0
+ LIBVA_REQUIRED=0.38.0
+@@ -20727,7 +20732,7 @@ _ACEOF
+ $as_echo_n "checking if more special flags are required for pthreads... " >&6; }
+ flag=no
+ case ${host_os} in
+- aix* | freebsd* | darwin*) flag="-D_THREAD_SAFE";;
++ aix* | freebsd* | dragonfly* | darwin*) flag="-D_THREAD_SAFE";;
+ osf* | hpux*) flag="-D_REENTRANT";;
+ solaris*)
+ if test "$GCC" = "yes"; then
+@@ -22087,6 +22092,89 @@ else
+ fi
+
+
++
++# Check for libdevq
++
++pkg_failed=no
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for LIBDEVQ" >&5
++$as_echo_n "checking for LIBDEVQ... " >&6; }
++if test -n "$LIBDEVQ_CFLAGS"; then
++ pkg_cv_LIBDEVQ_CFLAGS="$LIBDEVQ_CFLAGS"
++ elif test -n "$PKG_CONFIG"; then
++ if test -n "$PKG_CONFIG" && \
++ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists
++ --print-errors \"libdevq-1.0 >= \$LIBDEVQ_REQUIRED\""; } >&5
++ ($PKG_CONFIG --exists --print-errors "libdevq-1.0 >= $LIBDEVQ_REQUIRED") 2>&5
++ ac_status=$?
++ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
++ test $ac_status = 0; }; then
++ pkg_cv_LIBDEVQ_CFLAGS=`$PKG_CONFIG --cflags "libdevq-1.0 >=
++ $LIBDEVQ_REQUIRED" 2>/dev/null`
++ test "x$?" != "x0" && pkg_failed=yes
++else
++ pkg_failed=yes
++fi
++ else
++ pkg_failed=untried
++fi
++if test -n "$LIBDEVQ_LIBS"; then
++ pkg_cv_LIBDEVQ_LIBS="$LIBDEVQ_LIBS"
++ elif test -n "$PKG_CONFIG"; then
++ if test -n "$PKG_CONFIG" && \
++ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists
++ --print-errors \"libdevq-1.0 >= \$LIBDEVQ_REQUIRED\""; } >&5
++ ($PKG_CONFIG --exists --print-errors "libdevq-1.0 >= $LIBDEVQ_REQUIRED") 2>&5
++ ac_status=$?
++ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
++ test $ac_status = 0; }; then
++ pkg_cv_LIBDEVQ_LIBS=`$PKG_CONFIG --libs "libdevq-1.0 >=
++ $LIBDEVQ_REQUIRED" 2>/dev/null`
++ test "x$?" != "x0" && pkg_failed=yes
++else
++ pkg_failed=yes
++fi
++ else
++ pkg_failed=untried
++fi
++
++
++
++if test $pkg_failed = yes; then
++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
++$as_echo "no" >&6; }
++
++if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
++ _pkg_short_errors_supported=yes
++else
++ _pkg_short_errors_supported=no
++fi
++ if test $_pkg_short_errors_supported = yes; then
++ LIBDEVQ_PKG_ERRORS=`$PKG_CONFIG --short-errors
++ --print-errors --cflags --libs "libdevq-1.0 >= $LIBDEVQ_REQUIRED"
++ 2>&1`
++ else
++ LIBDEVQ_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags
++ --libs "libdevq-1.0 >= $LIBDEVQ_REQUIRED" 2>&1`
++ fi
++ # Put the nasty error message in config.log where it belongs
++ echo "$LIBDEVQ_PKG_ERRORS" >&5
++
++ have_libdevq=no
++elif test $pkg_failed = untried; then
++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
++$as_echo "no" >&6; }
++ have_libdevq=no
++else
++ LIBDEVQ_CFLAGS=$pkg_cv_LIBDEVQ_CFLAGS
++ LIBDEVQ_LIBS=$pkg_cv_LIBDEVQ_LIBS
++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
++$as_echo "yes" >&6; }
++ have_libdevq=yes
++fi
++
++
++
++
+ if test "x$enable_dri" = xyes; then
+ if test "$enable_static" = yes; then
+ as_fn_error $? "Cannot use static libraries for DRI drivers" "$LINENO" 5
+@@ -22889,6 +22977,10 @@ if test "$have_sysfs" = yes; then
+ DEFINES="$DEFINES -DHAVE_SYSFS"
+ have_pci_id=yes
+ fi
++if test "$have_libdevq" = yes; then
++ DEFINES="$DEFINES -DHAVE_LIBDEVQ"
++ have_pci_id=yes
++fi
+
+ # This is outside the case (above) so that it is invoked even for non-GLX
+ # builds.
+@@ -23821,6 +23913,8 @@ fi
+
+ if test "x$need_pci_id$have_libudev" = xyesyes; then
+ GBM_PC_REQ_PRIV="libudev >= $LIBUDEV_REQUIRED"
++elif test "x$need_libdevq" = xyes; then
++ GBM_PC_REQ_PRIV="libdevq-1.0 >= $LIBDEVQ_REQUIRED"
+ else
+ GBM_PC_REQ_PRIV=""
+ fi
+@@ -25468,9 +25562,6 @@ fi
+ CLANG_LIBDIR=${LLVM_LIBDIR}
+ fi
+ CLANG_RESOURCE_DIR=$CLANG_LIBDIR/clang/${LLVM_VERSION}
+- if test ! -f "$CLANG_RESOURCE_DIR/include/stddef.h"; then :
+- as_fn_error $? "Could not find clang internal header stddef.h in $CLANG_RESOURCE_DIR Use --with-clang-libdir to specify the correct path to the clang libraries." "$LINENO" 5
+-fi
+ fi
+ else
+ MESA_LLVM=0
Index: pkgsrc/graphics/MesaLib11/patches/patch-include_GL_glxext.h
diff -u /dev/null pkgsrc/graphics/MesaLib11/patches/patch-include_GL_glxext.h:1.1
--- /dev/null Wed Aug 21 13:35:29 2019
+++ pkgsrc/graphics/MesaLib11/patches/patch-include_GL_glxext.h Wed Aug 21 13:35:29 2019
@@ -0,0 +1,17 @@
+$NetBSD: patch-include_GL_glxext.h,v 1.1 2019/08/21 13:35:29 nia Exp $
+
+Make sure the GLsizeiptr and GLintptr types are defined
+
+--- include/GL/glxext.h.orig 2014-10-03 03:59:50.000000000 +0000
++++ include/GL/glxext.h
+@@ -477,6 +477,10 @@ Bool glXSet3DfxModeMESA (int mode);
+
+ #ifndef GLX_NV_copy_buffer
+ #define GLX_NV_copy_buffer 1
++#ifndef GL_VERSION_1_5
++typedef ptrdiff_t GLsizeiptr;
++typedef ptrdiff_t GLintptr;
++#endif
+ typedef void ( *PFNGLXCOPYBUFFERSUBDATANVPROC) (Display *dpy, GLXContext readCtx, GLXContext writeCtx, GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr
size);
+ typedef void ( *PFNGLXNAMEDCOPYBUFFERSUBDATANVPROC) (Display *dpy, GLXContext readCtx, GLXContext writeCtx, GLuint readBuffer, GLuint writeBuffer, GLintptr readOffset, GLintptr writeOffset,
GLsizeiptr size);
+ #ifdef GLX_GLXEXT_PROTOTYPES
Index: pkgsrc/graphics/MesaLib11/patches/patch-src_compiler_glsl_builtin__functions.cpp
diff -u /dev/null pkgsrc/graphics/MesaLib11/patches/patch-src_compiler_glsl_builtin__functions.cpp:1.1
--- /dev/null Wed Aug 21 13:35:29 2019
+++ pkgsrc/graphics/MesaLib11/patches/patch-src_compiler_glsl_builtin__functions.cpp Wed Aug 21 13:35:29 2019
@@ -0,0 +1,14 @@
+$NetBSD: patch-src_compiler_glsl_builtin__functions.cpp,v 1.1 2019/08/21 13:35:29 nia Exp $
+
+Avoid double free().
+
+--- src/compiler/glsl/builtin_functions.cpp.orig 2016-05-09 12:51:42.000000000 +0000
++++ src/compiler/glsl/builtin_functions.cpp
+@@ -853,6 +853,7 @@ builtin_builder::builtin_builder()
+ builtin_builder::~builtin_builder()
+ {
+ ralloc_free(mem_ctx);
++ mem_ctx = NULL;
+ }
+
+ ir_function_signature *
Index: pkgsrc/graphics/MesaLib11/patches/patch-src_egl_drivers_dri2_platform__drm.c
diff -u /dev/null pkgsrc/graphics/MesaLib11/patches/patch-src_egl_drivers_dri2_platform__drm.c:1.1
--- /dev/null Wed Aug 21 13:35:29 2019
+++ pkgsrc/graphics/MesaLib11/patches/patch-src_egl_drivers_dri2_platform__drm.c Wed Aug 21 13:35:29 2019
@@ -0,0 +1,16 @@
+$NetBSD: patch-src_egl_drivers_dri2_platform__drm.c,v 1.1 2019/08/21 13:35:29 nia Exp $
+
+netbsd-5 build fix
+
+--- src/egl/drivers/dri2/platform_drm.c.orig 2015-12-09 16:10:13.000000000 +0000
++++ src/egl/drivers/dri2/platform_drm.c
+@@ -626,7 +626,9 @@ dri2_initialize_drm(_EGLDriver *drv, _EG
+ if (gbm == NULL)
+ goto cleanup;
+ } else {
++#ifdef F_DUPFD_CLOEXEC
+ fd = fcntl(gbm_device_get_fd(gbm), F_DUPFD_CLOEXEC, 3);
++#endif
+ if (fd < 0)
+ goto cleanup;
+ }
Index: pkgsrc/graphics/MesaLib11/patches/patch-src_egl_drivers_dri2_platform__x11.c
diff -u /dev/null pkgsrc/graphics/MesaLib11/patches/patch-src_egl_drivers_dri2_platform__x11.c:1.1
--- /dev/null Wed Aug 21 13:35:29 2019
+++ pkgsrc/graphics/MesaLib11/patches/patch-src_egl_drivers_dri2_platform__x11.c Wed Aug 21 13:35:29 2019
@@ -0,0 +1,30 @@
+$NetBSD: patch-src_egl_drivers_dri2_platform__x11.c,v 1.1 2019/08/21 13:35:29 nia Exp $
+
+Provide compat strndup for older Darwin.
+
+--- src/egl/drivers/dri2/platform_x11.c.orig 2016-05-05 12:59:22.000000000 +0000
++++ src/egl/drivers/dri2/platform_x11.c
+@@ -591,6 +591,23 @@ dri2_x11_local_authenticate(struct dri2_
+ return EGL_TRUE;
+ }
+
++#if (defined(__APPLE__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__-0 < 1070)
++static char *
++strndup(const char *s, int length)
++{
++ char *d;
++
++ d = malloc(length + 1);
++ if (d == NULL)
++ return NULL;
++
++ memcpy(d, s, length);
++ d[length] = '\0';
++
++ return d;
++}
++#endif
++
+ static EGLBoolean
+ dri2_x11_connect(struct dri2_egl_display *dri2_dpy)
+ {
Index: pkgsrc/graphics/MesaLib11/patches/patch-src_egl_main_eglglobals.c
diff -u /dev/null pkgsrc/graphics/MesaLib11/patches/patch-src_egl_main_eglglobals.c:1.1
--- /dev/null Wed Aug 21 13:35:29 2019
+++ pkgsrc/graphics/MesaLib11/patches/patch-src_egl_main_eglglobals.c Wed Aug 21 13:35:29 2019
@@ -0,0 +1,40 @@
+$NetBSD: patch-src_egl_main_eglglobals.c,v 1.1 2019/08/21 13:35:29 nia Exp $
+
+atexit() is not a good idea in shared libraries.
+
+--- src/egl/main/eglglobals.c.orig 2015-11-28 17:37:59.000000000 +0000
++++ src/egl/main/eglglobals.c
+@@ -59,11 +59,16 @@ struct _egl_global _eglGlobal =
+ " EGL_MESA_platform_gbm"
+ };
+
++static EGLBoolean registered = EGL_FALSE;
+
+-static void
++static void __attribute__((__destructor__))
+ _eglAtExit(void)
+ {
+ EGLint i;
++
++ if (!registered)
++ return;
++
+ for (i = _eglGlobal.NumAtExitCalls - 1; i >= 0; i--)
+ _eglGlobal.AtExitCalls[i]();
+ }
+@@ -73,14 +78,9 @@ void
+ _eglAddAtExitCall(void (*func)(void))
+ {
+ if (func) {
+- static EGLBoolean registered = EGL_FALSE;
+-
+ mtx_lock(_eglGlobal.Mutex);
+
+- if (!registered) {
+- atexit(_eglAtExit);
+- registered = EGL_TRUE;
+- }
++ registered = EGL_TRUE;
+
+ assert(_eglGlobal.NumAtExitCalls < ARRAY_SIZE(_eglGlobal.AtExitCalls));
+ _eglGlobal.AtExitCalls[_eglGlobal.NumAtExitCalls++] = func;
Index: pkgsrc/graphics/MesaLib11/patches/patch-src_gallium_auxiliary_draw_draw__llvm.c
diff -u /dev/null pkgsrc/graphics/MesaLib11/patches/patch-src_gallium_auxiliary_draw_draw__llvm.c:1.1
--- /dev/null Wed Aug 21 13:35:29 2019
+++ pkgsrc/graphics/MesaLib11/patches/patch-src_gallium_auxiliary_draw_draw__llvm.c Wed Aug 21 13:35:29 2019
@@ -0,0 +1,27 @@
+$NetBSD: patch-src_gallium_auxiliary_draw_draw__llvm.c,v 1.1 2019/08/21 13:35:29 nia Exp $
+
+llvm api change
+commit 8bdd52c8f3595128cbc1da4f23cdb10ff861a6ef
+
+--- src/gallium/auxiliary/draw/draw_llvm.c.orig 2016-05-09 12:51:42.000000000 +0000
++++ src/gallium/auxiliary/draw/draw_llvm.c
+@@ -1612,8 +1612,7 @@ draw_llvm_generate(struct draw_llvm *llv
+ LLVMSetFunctionCallConv(variant_func, LLVMCCallConv);
+ for (i = 0; i < num_arg_types; ++i)
+ if (LLVMGetTypeKind(arg_types[i]) == LLVMPointerTypeKind)
+- LLVMAddAttribute(LLVMGetParam(variant_func, i),
+- LLVMNoAliasAttribute);
++ lp_add_function_attr(variant_func, i + 1, LP_FUNC_ATTR_NOALIAS);
+
+ context_ptr = LLVMGetParam(variant_func, 0);
+ io_ptr = LLVMGetParam(variant_func, 1);
+@@ -2158,8 +2157,7 @@ draw_gs_llvm_generate(struct draw_llvm *
+
+ for (i = 0; i < Elements(arg_types); ++i)
+ if (LLVMGetTypeKind(arg_types[i]) == LLVMPointerTypeKind)
+- LLVMAddAttribute(LLVMGetParam(variant_func, i),
+- LLVMNoAliasAttribute);
++ lp_add_function_attr(variant_func, i + 1, LP_FUNC_ATTR_NOALIAS);
+
+ context_ptr = LLVMGetParam(variant_func, 0);
+ input_array = LLVMGetParam(variant_func, 1);
Index: pkgsrc/graphics/MesaLib11/patches/patch-src_gallium_auxiliary_gallivm_lp__bld__intr.c
diff -u /dev/null pkgsrc/graphics/MesaLib11/patches/patch-src_gallium_auxiliary_gallivm_lp__bld__intr.c:1.1
--- /dev/null Wed Aug 21 13:35:29 2019
+++ pkgsrc/graphics/MesaLib11/patches/patch-src_gallium_auxiliary_gallivm_lp__bld__intr.c Wed Aug 21 13:35:29 2019
@@ -0,0 +1,105 @@
+$NetBSD: patch-src_gallium_auxiliary_gallivm_lp__bld__intr.c,v 1.1 2019/08/21 13:35:29 nia Exp $
+
+llvm api change
+commit 8bdd52c8f3595128cbc1da4f23cdb10ff861a6ef
+
+--- src/gallium/auxiliary/gallivm/lp_bld_intr.c.orig 2016-05-09 12:20:52.000000000 +0000
++++ src/gallium/auxiliary/gallivm/lp_bld_intr.c
+@@ -45,6 +45,7 @@
+
+
+ #include "util/u_debug.h"
++#include "util/u_math.h"
+
+ #include "lp_bld_const.h"
+ #include "lp_bld_intr.h"
+@@ -75,6 +76,65 @@ lp_declare_intrinsic(LLVMModuleRef modul
+ return function;
+ }
+
++#if HAVE_LLVM < 0x0400
++static LLVMAttribute lp_attr_to_llvm_attr(enum lp_func_attr attr)
++{
++ switch (attr) {
++ case LP_FUNC_ATTR_ALWAYSINLINE: return LLVMAlwaysInlineAttribute;
++ case LP_FUNC_ATTR_BYVAL: return LLVMByValAttribute;
++ case LP_FUNC_ATTR_INREG: return LLVMInRegAttribute;
++ case LP_FUNC_ATTR_NOALIAS: return LLVMNoAliasAttribute;
++ case LP_FUNC_ATTR_NOUNWIND: return LLVMNoUnwindAttribute;
++ case LP_FUNC_ATTR_READNONE: return LLVMReadNoneAttribute;
++ case LP_FUNC_ATTR_READONLY: return LLVMReadOnlyAttribute;
++ default:
++ _debug_printf("Unhandled function attribute: %x\n", attr);
++ return 0;
++ }
++}
++
++#else
++
++static const char *attr_to_str(enum lp_func_attr attr)
++{
++ switch (attr) {
++ case LP_FUNC_ATTR_ALWAYSINLINE: return "alwaysinline";
++ case LP_FUNC_ATTR_BYVAL: return "byval";
++ case LP_FUNC_ATTR_INREG: return "inreg";
++ case LP_FUNC_ATTR_NOALIAS: return "noalias";
++ case LP_FUNC_ATTR_NOUNWIND: return "nounwind";
++ case LP_FUNC_ATTR_READNONE: return "readnone";
++ case LP_FUNC_ATTR_READONLY: return "readonly";
++ default:
++ _debug_printf("Unhandled function attribute: %x\n", attr);
++ return 0;
++ }
++}
++
++#endif
++
++void
++lp_add_function_attr(LLVMValueRef function,
++ int attr_idx,
++ enum lp_func_attr attr)
++{
++
++#if HAVE_LLVM < 0x0400
++ LLVMAttribute llvm_attr = lp_attr_to_llvm_attr(attr);
++ if (attr_idx == -1) {
++ LLVMAddFunctionAttr(function, llvm_attr);
++ } else {
++ LLVMAddAttribute(LLVMGetParam(function, attr_idx - 1), llvm_attr);
++ }
++#else
++ LLVMContextRef context = LLVMGetModuleContext(LLVMGetGlobalParent(function));
++ const char *attr_name = attr_to_str(attr);
++ unsigned kind_id = LLVMGetEnumAttributeKindForName(attr_name,
++ strlen(attr_name));
++ LLVMAttributeRef llvm_attr = LLVMCreateEnumAttribute(context, kind_id, 0);
++ LLVMAddAttributeAtIndex(function, attr_idx, llvm_attr);
++#endif
++}
+
+ LLVMValueRef
+ lp_build_intrinsic(LLVMBuilderRef builder,
+@@ -82,7 +142,7 @@ lp_build_intrinsic(LLVMBuilderRef builde
+ LLVMTypeRef ret_type,
+ LLVMValueRef *args,
+ unsigned num_args,
+- LLVMAttribute attr)
++ unsigned attr_mask)
+ {
+ LLVMModuleRef module = LLVMGetGlobalParent(LLVMGetBasicBlockParent(LLVMGetInsertBlock(builder)));
+ LLVMValueRef function;
+@@ -101,8 +161,12 @@ lp_build_intrinsic(LLVMBuilderRef builde
+
+ function = lp_declare_intrinsic(module, name, ret_type, arg_types, num_args);
+
+- if (attr)
+- LLVMAddFunctionAttr(function, attr);
++ attr_mask |= LP_FUNC_ATTR_NOUNWIND;
++
++ while (attr_mask) {
++ enum lp_func_attr attr = 1 << u_bit_scan(&attr_mask);
++ lp_add_function_attr(function, -1, attr);
++ }
+ }
+
+ return LLVMBuildCall(builder, function, args, num_args, "");
Index: pkgsrc/graphics/MesaLib11/patches/patch-src_gallium_auxiliary_gallivm_lp__bld__intr.h
diff -u /dev/null pkgsrc/graphics/MesaLib11/patches/patch-src_gallium_auxiliary_gallivm_lp__bld__intr.h:1.1
--- /dev/null Wed Aug 21 13:35:29 2019
+++ pkgsrc/graphics/MesaLib11/patches/patch-src_gallium_auxiliary_gallivm_lp__bld__intr.h Wed Aug 21 13:35:29 2019
@@ -0,0 +1,44 @@
+$NetBSD: patch-src_gallium_auxiliary_gallivm_lp__bld__intr.h,v 1.1 2019/08/21 13:35:29 nia Exp $
+
+llvm api change
+commit 8bdd52c8f3595128cbc1da4f23cdb10ff861a6ef
+
+--- src/gallium/auxiliary/gallivm/lp_bld_intr.h.orig 2016-05-09 12:20:52.000000000 +0000
++++ src/gallium/auxiliary/gallivm/lp_bld_intr.h
+@@ -46,6 +46,16 @@
+ */
+ #define LP_MAX_FUNC_ARGS 32
+
++enum lp_func_attr {
++ LP_FUNC_ATTR_ALWAYSINLINE = (1 << 0),
++ LP_FUNC_ATTR_BYVAL = (1 << 1),
++ LP_FUNC_ATTR_INREG = (1 << 2),
++ LP_FUNC_ATTR_NOALIAS = (1 << 3),
++ LP_FUNC_ATTR_NOUNWIND = (1 << 4),
++ LP_FUNC_ATTR_READNONE = (1 << 5),
++ LP_FUNC_ATTR_READONLY = (1 << 6),
++ LP_FUNC_ATTR_LAST = (1 << 7)
++};
+
+ LLVMValueRef
+ lp_declare_intrinsic(LLVMModuleRef module,
+@@ -54,13 +64,18 @@ lp_declare_intrinsic(LLVMModuleRef modul
+ LLVMTypeRef *arg_types,
+ unsigned num_args);
+
++void
++lp_add_function_attr(LLVMValueRef function,
++ int attr_idx,
++ enum lp_func_attr attr);
++
+ LLVMValueRef
+ lp_build_intrinsic(LLVMBuilderRef builder,
+ const char *name,
+ LLVMTypeRef ret_type,
+ LLVMValueRef *args,
+ unsigned num_args,
+- LLVMAttribute attr);
++ unsigned attr_mask);
+
+
+ LLVMValueRef
Index: pkgsrc/graphics/MesaLib11/patches/patch-src_gallium_auxiliary_gallivm_lp__bld__sample__soa.c
diff -u /dev/null pkgsrc/graphics/MesaLib11/patches/patch-src_gallium_auxiliary_gallivm_lp__bld__sample__soa.c:1.1
--- /dev/null Wed Aug 21 13:35:29 2019
+++ pkgsrc/graphics/MesaLib11/patches/patch-src_gallium_auxiliary_gallivm_lp__bld__sample__soa.c Wed Aug 21 13:35:29 2019
@@ -0,0 +1,24 @@
+$NetBSD: patch-src_gallium_auxiliary_gallivm_lp__bld__sample__soa.c,v 1.1 2019/08/21 13:35:29 nia Exp $
+
+llvm api change
+commit 8bdd52c8f3595128cbc1da4f23cdb10ff861a6ef
+
+--- src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c.orig 2016-05-09 12:20:52.000000000 +0000
++++ src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c
+@@ -60,6 +60,7 @@
+ #include "lp_bld_struct.h"
+ #include "lp_bld_quad.h"
+ #include "lp_bld_pack.h"
++#include "lp_bld_intr.h"
+
+
+ /**
+@@ -3315,7 +3316,7 @@ lp_build_sample_soa_func(struct gallivm_
+
+ for (i = 0; i < num_param; ++i) {
+ if(LLVMGetTypeKind(arg_types[i]) == LLVMPointerTypeKind) {
+- LLVMAddAttribute(LLVMGetParam(function, i), LLVMNoAliasAttribute);
++ lp_add_function_attr(function, i + 1, LP_FUNC_ATTR_NOALIAS);
+ }
+ }
+
Index: pkgsrc/graphics/MesaLib11/patches/patch-src_gallium_auxiliary_util_u__format__tests.c
diff -u /dev/null pkgsrc/graphics/MesaLib11/patches/patch-src_gallium_auxiliary_util_u__format__tests.c:1.1
--- /dev/null Wed Aug 21 13:35:29 2019
+++ pkgsrc/graphics/MesaLib11/patches/patch-src_gallium_auxiliary_util_u__format__tests.c Wed Aug 21 13:35:29 2019
@@ -0,0 +1,17 @@
+$NetBSD: patch-src_gallium_auxiliary_util_u__format__tests.c,v 1.1 2019/08/21 13:35:29 nia Exp $
+
+On old NetBSD, NAN in math.h is __nanf.__val. Which is not constant.
+
+--- src/gallium/auxiliary/util/u_format_tests.c.orig 2014-09-12 21:30:32.000000000 +0000
++++ src/gallium/auxiliary/util/u_format_tests.c
+@@ -28,6 +28,10 @@
+
+ #include <math.h>
+ #include <float.h>
++#if defined(__NetBSD__) && __NetBSD_Version__ < 600000000
++#undef NAN
++#define NAN __builtin_nanf("")
++#endif
+
+ #include "pipe/p_config.h"
+ #include "u_memory.h"
Index: pkgsrc/graphics/MesaLib11/patches/patch-src_gallium_auxiliary_util_u__math.h
diff -u /dev/null pkgsrc/graphics/MesaLib11/patches/patch-src_gallium_auxiliary_util_u__math.h:1.1
--- /dev/null Wed Aug 21 13:35:29 2019
+++ pkgsrc/graphics/MesaLib11/patches/patch-src_gallium_auxiliary_util_u__math.h Wed Aug 21 13:35:29 2019
@@ -0,0 +1,31 @@
+$NetBSD: patch-src_gallium_auxiliary_util_u__math.h,v 1.1 2019/08/21 13:35:29 nia Exp $
+
+The C99 "restrict" keyword is not valid in C++, but most compilers will
+understand __restrict.
+
+--- src/gallium/auxiliary/util/u_math.h.orig 2015-09-11 17:41:47.000000000 +0000
++++ src/gallium/auxiliary/util/u_math.h
+@@ -709,6 +712,11 @@ util_bswap16(uint16_t n)
+ (n << 8);
+ }
+
++#if defined(__cplusplus) && !defined(restrict)
++#define undef_restrict
++#define restrict __restrict
++#endif
++
+ static inline void*
+ util_memcpy_cpu_to_le32(void * restrict dest, const void * restrict src, size_t n)
+ {
+@@ -727,6 +735,11 @@ util_memcpy_cpu_to_le32(void * restrict
+ #endif
+ }
+
++#if defined(undef_restrict)
++#undef undef_restrict
++#undef restrict
++#endif
++
+ /**
+ * Clamp X to [MIN, MAX].
+ * This is a macro to allow float, int, uint, etc. types.
Index: pkgsrc/graphics/MesaLib11/patches/patch-src_gallium_auxiliary_util_u__network.c
diff -u /dev/null pkgsrc/graphics/MesaLib11/patches/patch-src_gallium_auxiliary_util_u__network.c:1.1
--- /dev/null Wed Aug 21 13:35:29 2019
+++ pkgsrc/graphics/MesaLib11/patches/patch-src_gallium_auxiliary_util_u__network.c Wed Aug 21 13:35:29 2019
@@ -0,0 +1,33 @@
+$NetBSD: patch-src_gallium_auxiliary_util_u__network.c,v 1.1 2019/08/21 13:35:29 nia Exp $
+
+BSD has sockets, silence warning about missing implementation.
+
+--- src/gallium/auxiliary/util/u_network.c.orig 2014-09-12 21:30:32.000000000 +0000
++++ src/gallium/auxiliary/util/u_network.c
+@@ -7,7 +7,7 @@
+ # include <winsock2.h>
+ # include <windows.h>
+ #elif defined(PIPE_OS_LINUX) || defined(PIPE_OS_HAIKU) || \
+- defined(PIPE_OS_APPLE) || defined(PIPE_OS_CYGWIN) || defined(PIPE_OS_SOLARIS)
++ defined(PIPE_OS_APPLE) || defined(PIPE_OS_CYGWIN) || defined(PIPE_OS_SOLARIS) || defined(PIPE_OS_BSD)
+ # include <sys/socket.h>
+ # include <netinet/in.h>
+ # include <unistd.h>
+@@ -56,7 +56,7 @@ u_socket_close(int s)
+ return;
+
+ #if defined(PIPE_OS_LINUX) || defined(PIPE_OS_HAIKU) \
+- || defined(PIPE_OS_APPLE) || defined(PIPE_OS_SOLARIS)
++ || defined(PIPE_OS_APPLE) || defined(PIPE_OS_SOLARIS) || defined(PIPE_OS_BSD)
+ shutdown(s, SHUT_RDWR);
+ close(s);
+ #elif defined(PIPE_SUBSYSTEM_WINDOWS_USER)
+@@ -172,7 +172,7 @@ void
+ u_socket_block(int s, boolean block)
+ {
+ #if defined(PIPE_OS_LINUX) || defined(PIPE_OS_HAIKU) \
+- || defined(PIPE_OS_APPLE) || defined(PIPE_OS_SOLARIS)
++ || defined(PIPE_OS_APPLE) || defined(PIPE_OS_SOLARIS) || defined(PIPE_OS_BSD)
+ int old = fcntl(s, F_GETFL, 0);
+ if (old == -1)
+ return;
Index: pkgsrc/graphics/MesaLib11/patches/patch-src_gallium_auxiliary_util_u__network.h
diff -u /dev/null pkgsrc/graphics/MesaLib11/patches/patch-src_gallium_auxiliary_util_u__network.h:1.1
--- /dev/null Wed Aug 21 13:35:29 2019
+++ pkgsrc/graphics/MesaLib11/patches/patch-src_gallium_auxiliary_util_u__network.h Wed Aug 21 13:35:29 2019
@@ -0,0 +1,15 @@
+$NetBSD: patch-src_gallium_auxiliary_util_u__network.h,v 1.1 2019/08/21 13:35:29 nia Exp $
+
+BSD has sockets, silence warning about missing implementation.
+
+--- src/gallium/auxiliary/util/u_network.h.orig 2014-09-12 21:30:32.000000000 +0000
++++ src/gallium/auxiliary/util/u_network.h
+@@ -7,7 +7,7 @@
+ #if defined(PIPE_SUBSYSTEM_WINDOWS_USER)
+ # define PIPE_HAVE_SOCKETS
+ #elif defined(PIPE_OS_LINUX) || defined(PIPE_OS_HAIKU) || \
+- defined(PIPE_OS_APPLE) || defined(PIPE_OS_SOLARIS)
++ defined(PIPE_OS_APPLE) || defined(PIPE_OS_SOLARIS) || defined(PIPE_OS_BSD)
+ # define PIPE_HAVE_SOCKETS
+ #endif
+
Index: pkgsrc/graphics/MesaLib11/patches/patch-src_gallium_drivers_llvmpipe_lp__state__fs.c
diff -u /dev/null pkgsrc/graphics/MesaLib11/patches/patch-src_gallium_drivers_llvmpipe_lp__state__fs.c:1.1
--- /dev/null Wed Aug 21 13:35:29 2019
+++ pkgsrc/graphics/MesaLib11/patches/patch-src_gallium_drivers_llvmpipe_lp__state__fs.c Wed Aug 21 13:35:29 2019
@@ -0,0 +1,16 @@
+$NetBSD: patch-src_gallium_drivers_llvmpipe_lp__state__fs.c,v 1.1 2019/08/21 13:35:29 nia Exp $
+
+llvm api change
+commit 14926330703bb5ea6a84c845e192021f057f9401
+
+--- src/gallium/drivers/llvmpipe/lp_state_fs.c.orig 2016-05-09 12:51:42.000000000 +0000
++++ src/gallium/drivers/llvmpipe/lp_state_fs.c
+@@ -2279,7 +2279,7 @@ generate_fragment(struct llvmpipe_contex
+ */
+ for(i = 0; i < Elements(arg_types); ++i)
+ if(LLVMGetTypeKind(arg_types[i]) == LLVMPointerTypeKind)
+- LLVMAddAttribute(LLVMGetParam(function, i), LLVMNoAliasAttribute);
++ lp_add_function_attr(function, i + 1, LP_FUNC_ATTR_NOALIAS);
+
+ context_ptr = LLVMGetParam(function, 0);
+ x = LLVMGetParam(function, 1);
Index: pkgsrc/graphics/MesaLib11/patches/patch-src_gallium_drivers_llvmpipe_lp__state__setup.c
diff -u /dev/null pkgsrc/graphics/MesaLib11/patches/patch-src_gallium_drivers_llvmpipe_lp__state__setup.c:1.1
--- /dev/null Wed Aug 21 13:35:29 2019
+++ pkgsrc/graphics/MesaLib11/patches/patch-src_gallium_drivers_llvmpipe_lp__state__setup.c Wed Aug 21 13:35:29 2019
@@ -0,0 +1,17 @@
+$NetBSD: patch-src_gallium_drivers_llvmpipe_lp__state__setup.c,v 1.1 2019/08/21 13:35:29 nia Exp $
+
+llvm api change
+commit 14926330703bb5ea6a84c845e192021f057f9401
+
+--- src/gallium/drivers/llvmpipe/lp_state_setup.c.orig 2016-05-09 12:51:42.000000000 +0000
++++ src/gallium/drivers/llvmpipe/lp_state_setup.c
+@@ -624,8 +624,7 @@ set_noalias(LLVMBuilderRef builder,
+ int i;
+ for(i = 0; i < nr_args; ++i)
+ if(LLVMGetTypeKind(arg_types[i]) == LLVMPointerTypeKind)
+- LLVMAddAttribute(LLVMGetParam(function, i),
+- LLVMNoAliasAttribute);
++ lp_add_function_attr(function, i + 1, LP_FUNC_ATTR_NOALIAS);
+ }
+
+ static void
Index: pkgsrc/graphics/MesaLib11/patches/patch-src_gallium_drivers_nouveau_codegen_nv50__ir__peephole.cpp
diff -u /dev/null pkgsrc/graphics/MesaLib11/patches/patch-src_gallium_drivers_nouveau_codegen_nv50__ir__peephole.cpp:1.1
--- /dev/null Wed Aug 21 13:35:29 2019
+++ pkgsrc/graphics/MesaLib11/patches/patch-src_gallium_drivers_nouveau_codegen_nv50__ir__peephole.cpp Wed Aug 21 13:35:29 2019
@@ -0,0 +1,25 @@
+$NetBSD: patch-src_gallium_drivers_nouveau_codegen_nv50__ir__peephole.cpp,v 1.1 2019/08/21 13:35:29 nia Exp $
+
+The C99 "restrict" keyword is not valid in C++, but most compilers will
+understand __restrict.
+
+--- src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp.orig 2015-03-28 18:20:39.000000000 +0000
++++ src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
+@@ -1530,7 +1530,7 @@ private:
+
+ bool replaceLdFromLd(Instruction *ld, Record *ldRec);
+ bool replaceLdFromSt(Instruction *ld, Record *stRec);
+- bool replaceStFromSt(Instruction *restrict st, Record *stRec);
++ bool replaceStFromSt(Instruction *__restrict st, Record *stRec);
+
+ void addRecord(Instruction *ldst);
+ void purgeRecords(Instruction *const st, DataFile);
+@@ -1817,7 +1817,7 @@ MemoryOpt::replaceLdFromLd(Instruction *
+ }
+
+ bool
+-MemoryOpt::replaceStFromSt(Instruction *restrict st, Record *rec)
++MemoryOpt::replaceStFromSt(Instruction *__restrict st, Record *rec)
+ {
+ const Instruction *const ri = rec->insn;
+ Value *extra[3];
Index: pkgsrc/graphics/MesaLib11/patches/patch-src_gallium_drivers_nouveau_nouveau__debug.h
diff -u /dev/null pkgsrc/graphics/MesaLib11/patches/patch-src_gallium_drivers_nouveau_nouveau__debug.h:1.1
--- /dev/null Wed Aug 21 13:35:29 2019
+++ pkgsrc/graphics/MesaLib11/patches/patch-src_gallium_drivers_nouveau_nouveau__debug.h Wed Aug 21 13:35:29 2019
@@ -0,0 +1,15 @@
+$NetBSD: patch-src_gallium_drivers_nouveau_nouveau__debug.h,v 1.1 2019/08/21 13:35:29 nia Exp $
+
+Avoid "C++11 requires a space between literal and identifier" error.
+
+--- src/gallium/drivers/nouveau/nouveau_debug.h.orig 2016-05-09 12:20:52.000000000 +0000
++++ src/gallium/drivers/nouveau/nouveau_debug.h
+@@ -16,7 +16,7 @@
+ #define NOUVEAU_DEBUG 0
+
+ #define NOUVEAU_ERR(fmt, args...) \
+- fprintf(stderr, "%s:%d - "fmt, __FUNCTION__, __LINE__, ##args)
++ fprintf(stderr, "%s:%d - " fmt, __FUNCTION__, __LINE__, ##args)
+
+ #define NOUVEAU_DBG(ch, args...) \
+ if ((NOUVEAU_DEBUG) & (NOUVEAU_DEBUG_##ch)) \
Index: pkgsrc/graphics/MesaLib11/patches/patch-src_gallium_drivers_nouveau_nouveau__vp3__video.c
diff -u /dev/null pkgsrc/graphics/MesaLib11/patches/patch-src_gallium_drivers_nouveau_nouveau__vp3__video.c:1.1
--- /dev/null Wed Aug 21 13:35:29 2019
+++ pkgsrc/graphics/MesaLib11/patches/patch-src_gallium_drivers_nouveau_nouveau__vp3__video.c Wed Aug 21 13:35:29 2019
@@ -0,0 +1,18 @@
+$NetBSD: patch-src_gallium_drivers_nouveau_nouveau__vp3__video.c,v 1.1 2019/08/21 13:35:29 nia Exp $
+
+Fix build on platforms without close-on-exec.
+
+--- src/gallium/drivers/nouveau/nouveau_vp3_video.c.orig 2014-09-12 21:30:32.000000000 +0000
++++ src/gallium/drivers/nouveau/nouveau_vp3_video.c
+@@ -292,7 +292,11 @@ nouveau_vp3_load_firmware(struct nouveau
+ if (nouveau_bo_map(dec->fw_bo, NOUVEAU_BO_WR, dec->client))
+ return 1;
+
++#ifdef O_CLOEXEC
+ fd = open(path, O_RDONLY | O_CLOEXEC);
++#else
++ fd = open(path, O_RDONLY);
++#endif
+ if (fd < 0) {
+ fprintf(stderr, "opening firmware file %s failed: %m\n", path);
+ return 1;
Index: pkgsrc/graphics/MesaLib11/patches/patch-src_gallium_drivers_nouveau_nv50_nv84__video.c
diff -u /dev/null pkgsrc/graphics/MesaLib11/patches/patch-src_gallium_drivers_nouveau_nv50_nv84__video.c:1.1
--- /dev/null Wed Aug 21 13:35:29 2019
+++ pkgsrc/graphics/MesaLib11/patches/patch-src_gallium_drivers_nouveau_nv50_nv84__video.c Wed Aug 21 13:35:29 2019
@@ -0,0 +1,18 @@
+$NetBSD: patch-src_gallium_drivers_nouveau_nv50_nv84__video.c,v 1.1 2019/08/21 13:35:29 nia Exp $
+
+Fix build on platforms without close-on-exec.
+
+--- src/gallium/drivers/nouveau/nv50/nv84_video.c.orig 2015-03-21 00:51:18.000000000 +0000
++++ src/gallium/drivers/nouveau/nv50/nv84_video.c
+@@ -34,7 +34,11 @@
+ static int
+ nv84_copy_firmware(const char *path, void *dest, ssize_t len)
+ {
++#ifdef O_CLOEXEC
+ int fd = open(path, O_RDONLY | O_CLOEXEC);
++#else
++ int fd = open(path, O_RDONLY);
++#endif
+ ssize_t r;
+ if (fd < 0) {
+ fprintf(stderr, "opening firmware file %s failed: %m\n", path);
Index: pkgsrc/graphics/MesaLib11/patches/patch-src_gallium_drivers_r600_r600__llvm.c
diff -u /dev/null pkgsrc/graphics/MesaLib11/patches/patch-src_gallium_drivers_r600_r600__llvm.c:1.1
--- /dev/null Wed Aug 21 13:35:29 2019
+++ pkgsrc/graphics/MesaLib11/patches/patch-src_gallium_drivers_r600_r600__llvm.c Wed Aug 21 13:35:29 2019
@@ -0,0 +1,71 @@
+$NetBSD: patch-src_gallium_drivers_r600_r600__llvm.c,v 1.1 2019/08/21 13:35:29 nia Exp $
+
+--- src/gallium/drivers/r600/r600_llvm.c.orig 2016-05-09 12:51:42.000000000 +0000
++++ src/gallium/drivers/r600/r600_llvm.c
+@@ -101,9 +101,9 @@ llvm_load_input_vector(
+ lp_build_const_int32(&(ctx->gallivm), 2 * (ijregs % 2) + 1), "");
+ LLVMValueRef HalfVec[2] = {
+ lp_build_intrinsic(ctx->gallivm.builder, "llvm.R600.interp.xy",
+- VecType, Args, ArgCount, LLVMReadNoneAttribute),
++ VecType, Args, ArgCount, LP_FUNC_ATTR_READNONE),
+ lp_build_intrinsic(ctx->gallivm.builder, "llvm.R600.interp.zw",
+- VecType, Args, ArgCount, LLVMReadNoneAttribute)
++ VecType, Args, ArgCount, LP_FUNC_ATTR_READNONE)
+ };
+ LLVMValueRef MaskInputs[4] = {
+ lp_build_const_int32(&(ctx->gallivm), 0),
+@@ -117,7 +117,7 @@ llvm_load_input_vector(
+ } else {
+ VecType = LLVMVectorType(ctx->soa.bld_base.base.elem_type, 4);
+ return lp_build_intrinsic(ctx->gallivm.builder, "llvm.R600.interp.const",
+- VecType, Args, ArgCount, LLVMReadNoneAttribute);
++ VecType, Args, ArgCount, LP_FUNC_ATTR_READNONE);
+ }
+ }
+
+@@ -273,7 +273,7 @@ static void llvm_emit_epilogue(struct lp
+ args[1] = base_vector;
+ adjusted_elements[chan] = lp_build_intrinsic(base->gallivm->builder,
+ "llvm.AMDGPU.dp4", bld_base->base.elem_type,
+- args, 2, LLVMReadNoneAttribute);
++ args, 2, LP_FUNC_ATTR_READNONE);
+ }
+ args[0] = lp_build_gather_values(base->gallivm,
+ adjusted_elements, 4);
+@@ -443,7 +443,7 @@ static void llvm_emit_tex(
+ args[1] = lp_build_const_int32(gallivm, R600_MAX_CONST_BUFFERS);
+ emit_data->output[0] = lp_build_intrinsic(gallivm->builder,
+ "llvm.R600.load.texbuf",
+- emit_data->dst_type, args, 2, LLVMReadNoneAttribute);
++ emit_data->dst_type, args, 2, LP_FUNC_ATTR_READNONE);
+ if (ctx->chip_class >= EVERGREEN)
+ return;
+ ctx->uses_tex_buffers = true;
+@@ -558,7 +558,7 @@ static void llvm_emit_tex(
+ };
+ LLVMValueRef ptr = lp_build_intrinsic(gallivm->builder,
+ "llvm.R600.ldptr",
+- emit_data->dst_type, ldptr_args, 10, LLVMReadNoneAttribute);
++ emit_data->dst_type, ldptr_args, 10, LP_FUNC_ATTR_READNONE);
+ LLVMValueRef Tmp = LLVMBuildExtractElement(gallivm->builder, args[0],
+ lp_build_const_int32(gallivm, 3), "");
+ Tmp = LLVMBuildMul(gallivm->builder, Tmp,
+@@ -579,7 +579,7 @@ static void llvm_emit_tex(
+
+ emit_data->output[0] = lp_build_intrinsic(gallivm->builder,
+ action->intr_name,
+- emit_data->dst_type, args, c, LLVMReadNoneAttribute);
++ emit_data->dst_type, args, c, LP_FUNC_ATTR_READNONE);
+
+ if (emit_data->inst->Instruction.Opcode == TGSI_OPCODE_TXQ &&
+ ((emit_data->inst->Texture.Texture == TGSI_TEXTURE_CUBE_ARRAY ||
+@@ -791,8 +791,7 @@ LLVMModuleRef r600_tgsi_llvm(
+ Arguments[ArgumentsCount++] = LLVMVectorType(bld_base->base.elem_type, 4);
+ radeon_llvm_create_func(ctx, NULL, 0, Arguments, ArgumentsCount);
+ for (unsigned i = 0; i < ctx->inputs_count; i++) {
+- LLVMValueRef P = LLVMGetParam(ctx->main_fn, i);
+- LLVMAddAttribute(P, LLVMInRegAttribute);
++ lp_add_function_attr(ctx->main_fn, i + 1, LP_FUNC_ATTR_INREG);
+ }
+ tgsi_scan_shader(tokens, &shader_info);
+
Index: pkgsrc/graphics/MesaLib11/patches/patch-src_gallium_drivers_radeon_radeon__llvm__util.c
diff -u /dev/null pkgsrc/graphics/MesaLib11/patches/patch-src_gallium_drivers_radeon_radeon__llvm__util.c:1.1
--- /dev/null Wed Aug 21 13:35:29 2019
+++ pkgsrc/graphics/MesaLib11/patches/patch-src_gallium_drivers_radeon_radeon__llvm__util.c Wed Aug 21 13:35:29 2019
@@ -0,0 +1,27 @@
+$NetBSD: patch-src_gallium_drivers_radeon_radeon__llvm__util.c,v 1.1 2019/08/21 13:35:29 nia Exp $
+
+--- src/gallium/drivers/radeon/radeon_llvm_util.c.orig 2016-05-09 12:51:42.000000000 +0000
++++ src/gallium/drivers/radeon/radeon_llvm_util.c
+@@ -26,6 +26,13 @@
+
+ #include "radeon_llvm_util.h"
+ #include "util/u_memory.h"
++#include "gallivm/lp_bld_const.h"
++#include "gallivm/lp_bld_gather.h"
++#include "gallivm/lp_bld_flow.h"
++#include "gallivm/lp_bld_init.h"
++#include "gallivm/lp_bld_intr.h"
++#include "gallivm/lp_bld_misc.h"
++#include "gallivm/lp_bld_swizzle.h"
+
+ #include <llvm-c/BitReader.h>
+ #include <llvm-c/Core.h>
+@@ -75,7 +82,7 @@ static void radeon_llvm_optimize(LLVMMod
+ for (fn = LLVMGetFirstFunction(mod); fn; fn = LLVMGetNextFunction(fn)) {
+ /* All the non-kernel functions have internal linkage */
+ if (LLVMGetLinkage(fn) == LLVMInternalLinkage) {
+- LLVMAddFunctionAttr(fn, LLVMAlwaysInlineAttribute);
++ lp_add_function_attr(fn, -1, LP_FUNC_ATTR_ALWAYSINLINE);
+ }
+ }
+
Index: pkgsrc/graphics/MesaLib11/patches/patch-src_gallium_drivers_radeon_radeon__setup__tgsi__llvm.c
diff -u /dev/null pkgsrc/graphics/MesaLib11/patches/patch-src_gallium_drivers_radeon_radeon__setup__tgsi__llvm.c:1.1
--- /dev/null Wed Aug 21 13:35:29 2019
+++ pkgsrc/graphics/MesaLib11/patches/patch-src_gallium_drivers_radeon_radeon__setup__tgsi__llvm.c Wed Aug 21 13:35:29 2019
@@ -0,0 +1,66 @@
+$NetBSD: patch-src_gallium_drivers_radeon_radeon__setup__tgsi__llvm.c,v 1.1 2019/08/21 13:35:29 nia Exp $
+
+--- src/gallium/drivers/radeon/radeon_setup_tgsi_llvm.c.orig 2016-05-09 12:51:42.000000000 +0000
++++ src/gallium/drivers/radeon/radeon_setup_tgsi_llvm.c
+@@ -773,14 +773,14 @@ static void radeon_llvm_cube_to_2d_coord
+
+ cube_vec = lp_build_gather_values(bld_base->base.gallivm, in, 4);
+ v = lp_build_intrinsic(builder, "llvm.AMDGPU.cube", LLVMVectorType(type, 4),
+- &cube_vec, 1, LLVMReadNoneAttribute);
++ &cube_vec, 1, LP_FUNC_ATTR_READNONE);
+
+ for (i = 0; i < 4; ++i)
+ coords[i] = LLVMBuildExtractElement(builder, v,
+ lp_build_const_int32(gallivm, i), "");
+
+ coords[2] = lp_build_intrinsic(builder, "llvm.fabs.f32",
+- type, &coords[2], 1, LLVMReadNoneAttribute);
++ type, &coords[2], 1, LP_FUNC_ATTR_READNONE);
+ coords[2] = lp_build_emit_llvm_unary(bld_base, TGSI_OPCODE_RCP, coords[2]);
+
+ mad_args[1] = coords[2];
+@@ -1215,7 +1215,7 @@ static void emit_frac(
+
+ LLVMValueRef floor = lp_build_intrinsic(builder, intr, emit_data->dst_type,
+ &emit_data->args[0], 1,
+- LLVMReadNoneAttribute);
++ LP_FUNC_ATTR_READNONE);
+ emit_data->output[emit_data->chan] = LLVMBuildFSub(builder,
+ emit_data->args[0], floor, "");
+ }
+@@ -1283,7 +1283,7 @@ build_tgsi_intrinsic_nomem(const struct
+ emit_data->output[emit_data->chan] =
+ lp_build_intrinsic(base->gallivm->builder, action->intr_name,
+ emit_data->dst_type, emit_data->args,
+- emit_data->arg_count, LLVMReadNoneAttribute);
++ emit_data->arg_count, LP_FUNC_ATTR_READNONE);
+ }
+
+ static void emit_bfi(const struct lp_build_tgsi_action * action,
+@@ -1341,7 +1341,7 @@ static void emit_lsb(const struct lp_bui
+ emit_data->output[emit_data->chan] =
+ lp_build_intrinsic(gallivm->builder, "llvm.cttz.i32",
+ emit_data->dst_type, args, Elements(args),
+- LLVMReadNoneAttribute);
++ LP_FUNC_ATTR_READNONE);
+ }
+
+ /* Find the last bit set. */
+@@ -1360,7 +1360,7 @@ static void emit_umsb(const struct lp_bu
+ LLVMValueRef msb =
+ lp_build_intrinsic(builder, "llvm.ctlz.i32",
+ emit_data->dst_type, args, Elements(args),
+- LLVMReadNoneAttribute);
++ LP_FUNC_ATTR_READNONE);
+
+ /* The HW returns the last bit index from MSB, but TGSI wants
+ * the index from LSB. Invert it by doing "31 - msb". */
+@@ -1387,7 +1387,7 @@ static void emit_imsb(const struct lp_bu
+ LLVMValueRef msb =
+ lp_build_intrinsic(builder, "llvm.AMDGPU.flbit.i32",
+ emit_data->dst_type, &arg, 1,
+- LLVMReadNoneAttribute);
++ LP_FUNC_ATTR_READNONE);
+
+ /* The HW returns the last bit index from MSB, but TGSI wants
+ * the index from LSB. Invert it by doing "31 - msb". */
Index: pkgsrc/graphics/MesaLib11/patches/patch-src_gallium_drivers_radeonsi_si__shader.c
diff -u /dev/null pkgsrc/graphics/MesaLib11/patches/patch-src_gallium_drivers_radeonsi_si__shader.c:1.1
--- /dev/null Wed Aug 21 13:35:29 2019
+++ pkgsrc/graphics/MesaLib11/patches/patch-src_gallium_drivers_radeonsi_si__shader.c Wed Aug 21 13:35:29 2019
@@ -0,0 +1,204 @@
+$NetBSD: patch-src_gallium_drivers_radeonsi_si__shader.c,v 1.1 2019/08/21 13:35:29 nia Exp $
+
+llvm api change
+commit 8bdd52c8f3595128cbc1da4f23cdb10ff861a6ef
+
+--- src/gallium/drivers/radeonsi/si_shader.c.orig 2016-05-09 12:51:42.000000000 +0000
++++ src/gallium/drivers/radeonsi/si_shader.c
+@@ -472,7 +472,7 @@ static void declare_input_vs(
+ args[2] = buffer_index;
+ input = lp_build_intrinsic(gallivm->builder,
+ "llvm.SI.vs.load.input", ctx->v4f32, args, 3,
+- LLVMReadNoneAttribute | LLVMNoUnwindAttribute);
++ LP_FUNC_ATTR_READNONE);
+
+ /* Break up the vec4 into individual components */
+ for (chan = 0; chan < 4; chan++) {
+@@ -834,14 +834,14 @@ static LLVMValueRef fetch_input_gs(
+ value = lp_build_intrinsic(gallivm->builder,
+ "llvm.SI.buffer.load.dword.i32.i32",
+ ctx->i32, args, 9,
+- LLVMReadOnlyAttribute | LLVMNoUnwindAttribute);
++ LP_FUNC_ATTR_READONLY);
+ if (type == TGSI_TYPE_DOUBLE) {
+ LLVMValueRef value2;
+ args[2] = lp_build_const_int32(gallivm, (param * 4 + swizzle + 1) * 256);
+ value2 = lp_build_intrinsic(gallivm->builder,
+ "llvm.SI.buffer.load.dword.i32.i32",
+ ctx->i32, args, 9,
+- LLVMReadOnlyAttribute | LLVMNoUnwindAttribute);
++ LP_FUNC_ATTR_READONLY);
+ return radeon_llvm_emit_fetch_double(bld_base,
+ value, value2);
+ }
+@@ -981,12 +981,12 @@ static void interp_fs_input(struct si_sh
+ args[1] = attr_number;
+ front = lp_build_intrinsic(gallivm->builder, intr_name,
+ ctx->f32, args, args[3] ? 4 : 3,
+- LLVMReadNoneAttribute | LLVMNoUnwindAttribute);
++ LP_FUNC_ATTR_READNONE);
+
+ args[1] = back_attr_number;
+ back = lp_build_intrinsic(gallivm->builder, intr_name,
+ ctx->f32, args, args[3] ? 4 : 3,
+- LLVMReadNoneAttribute | LLVMNoUnwindAttribute);
++ LP_FUNC_ATTR_READNONE);
+
+ result[chan] = LLVMBuildSelect(gallivm->builder,
+ is_face_positive,
+@@ -1003,7 +1003,7 @@ static void interp_fs_input(struct si_sh
+ args[3] = interp_param;
+ result[0] = lp_build_intrinsic(gallivm->builder, intr_name,
+ ctx->f32, args, args[3] ? 4 : 3,
+- LLVMReadNoneAttribute | LLVMNoUnwindAttribute);
++ LP_FUNC_ATTR_READNONE);
+ result[1] =
+ result[2] = lp_build_const_float(gallivm, 0.0f);
+ result[3] = lp_build_const_float(gallivm, 1.0f);
+@@ -1018,7 +1018,7 @@ static void interp_fs_input(struct si_sh
+ args[3] = interp_param;
+ result[chan] = lp_build_intrinsic(gallivm->builder, intr_name,
+ ctx->f32, args, args[3] ? 4 : 3,
+- LLVMReadNoneAttribute | LLVMNoUnwindAttribute);
++ LP_FUNC_ATTR_READNONE);
+ }
+ }
+ }
+@@ -1089,7 +1089,7 @@ static LLVMValueRef buffer_load_const(LL
+ LLVMValueRef args[2] = {resource, offset};
+
+ return lp_build_intrinsic(builder, "llvm.SI.load.const", return_type, args, 2,
+- LLVMReadNoneAttribute | LLVMNoUnwindAttribute);
++ LP_FUNC_ATTR_READNONE);
+ }
+
+ static LLVMValueRef load_sample_position(struct radeon_llvm_context *radeon_bld, LLVMValueRef sample_id)
+@@ -1432,7 +1432,7 @@ static void si_llvm_init_export_args(str
+ packed = lp_build_intrinsic(base->gallivm->builder,
+ "llvm.SI.packf16",
+ ctx->i32, pack_args, 2,
+- LLVMReadNoneAttribute | LLVMNoUnwindAttribute);
++ LP_FUNC_ATTR_READNONE);
+ args[chan + 5] =
+ LLVMBuildBitCast(base->gallivm->builder,
+ packed, ctx->f32, "");
+@@ -1577,7 +1577,7 @@ static LLVMValueRef si_scale_alpha_by_sa
+
+ coverage = lp_build_intrinsic(gallivm->builder, "llvm.ctpop.i32",
+ ctx->i32,
+- &coverage, 1, LLVMReadNoneAttribute);
++ &coverage, 1, LP_FUNC_ATTR_READNONE);
+
+ coverage = LLVMBuildUIToFP(gallivm->builder, coverage,
+ ctx->f32, "");
+@@ -1742,7 +1742,7 @@ static void si_llvm_emit_streamout(struc
+ unpack_param(ctx, ctx->param_streamout_config, 16, 7);
+
+ LLVMValueRef tid = lp_build_intrinsic(builder, "llvm.SI.tid", ctx->i32,
+- NULL, 0, LLVMReadNoneAttribute);
++ NULL, 0, LP_FUNC_ATTR_READNONE);
+
+ /* can_emit = tid < so_vtx_count; */
+ LLVMValueRef can_emit =
+@@ -2242,7 +2242,7 @@ static void si_llvm_emit_gs_epilogue(str
+ args[0] = lp_build_const_int32(gallivm, SENDMSG_GS_OP_NOP | SENDMSG_GS_DONE);
+ args[1] = LLVMGetParam(ctx->radeon_bld.main_fn, SI_PARAM_GS_WAVE_ID);
+ lp_build_intrinsic(gallivm->builder, "llvm.SI.sendmsg",
+- ctx->voidt, args, 2, LLVMNoUnwindAttribute);
++ ctx->voidt, args, 2, LP_FUNC_ATTR_NOUNWIND);
+ }
+
+ static void si_llvm_emit_vs_epilogue(struct lp_build_tgsi_context *bld_base)
+@@ -3191,7 +3191,7 @@ static void build_tex_intrinsic(const st
+ base->gallivm->builder,
+ "llvm.SI.vs.load.input", emit_data->dst_type,
+ emit_data->args, emit_data->arg_count,
+- LLVMReadNoneAttribute | LLVMNoUnwindAttribute);
++ LP_FUNC_ATTR_READNONE);
+ return;
+ }
+
+@@ -3251,7 +3251,7 @@ static void build_tex_intrinsic(const st
+ emit_data->output[emit_data->chan] = lp_build_intrinsic(
+ base->gallivm->builder, intr_name, emit_data->dst_type,
+ emit_data->args, emit_data->arg_count,
+- LLVMReadNoneAttribute | LLVMNoUnwindAttribute);
++ LP_FUNC_ATTR_READNONE);
+
+ /* Divide the number of layers by 6 to get the number of cubes. */
+ if (opcode == TGSI_OPCODE_TXQ &&
+@@ -3347,7 +3347,7 @@ static void si_llvm_emit_ddxy(
+
+ indices[0] = bld_base->uint_bld.zero;
+ indices[1] = lp_build_intrinsic(gallivm->builder, "llvm.SI.tid", ctx->i32,
+- NULL, 0, LLVMReadNoneAttribute);
++ NULL, 0, LP_FUNC_ATTR_READNONE);
+ store_ptr = LLVMBuildGEP(gallivm->builder, ctx->lds,
+ indices, 2, "");
+
+@@ -3419,7 +3419,7 @@ static LLVMValueRef si_llvm_emit_ddxy_in
+
+ indices[0] = bld_base->uint_bld.zero;
+ indices[1] = lp_build_intrinsic(gallivm->builder, "llvm.SI.tid", ctx->i32,
+- NULL, 0, LLVMReadNoneAttribute);
++ NULL, 0, LP_FUNC_ATTR_READNONE);
+ store_ptr = LLVMBuildGEP(gallivm->builder, ctx->lds,
+ indices, 2, "");
+
+@@ -3616,7 +3616,7 @@ static void build_interp_intrinsic(const
+ emit_data->output[chan] =
+ lp_build_intrinsic(gallivm->builder, intr_name,
+ ctx->f32, args, args[3] ? 4 : 3,
+- LLVMReadNoneAttribute | LLVMNoUnwindAttribute);
++ LP_FUNC_ATTR_READNONE);
+ }
+ }
+
+@@ -3708,7 +3708,7 @@ static void si_llvm_emit_vertex(
+ args[0] = lp_build_const_int32(gallivm, SENDMSG_GS_OP_EMIT | SENDMSG_GS | (stream << 8));
+ args[1] = LLVMGetParam(ctx->radeon_bld.main_fn, SI_PARAM_GS_WAVE_ID);
+ lp_build_intrinsic(gallivm->builder, "llvm.SI.sendmsg",
+- ctx->voidt, args, 2, LLVMNoUnwindAttribute);
++ ctx->voidt, args, 2, LP_FUNC_ATTR_NOUNWIND);
+ }
+
+ /* Cut one primitive from the geometry shader */
+@@ -3727,7 +3727,7 @@ static void si_llvm_emit_primitive(
+ args[0] = lp_build_const_int32(gallivm, SENDMSG_GS_OP_CUT | SENDMSG_GS | (stream << 8));
+ args[1] = LLVMGetParam(ctx->radeon_bld.main_fn, SI_PARAM_GS_WAVE_ID);
+ lp_build_intrinsic(gallivm->builder, "llvm.SI.sendmsg",
+- ctx->voidt, args, 2, LLVMNoUnwindAttribute);
++ ctx->voidt, args, 2, LP_FUNC_ATTR_NOUNWIND);
+ }
+
+ static void si_llvm_emit_barrier(const struct lp_build_tgsi_action *action,
+@@ -3740,7 +3740,7 @@ static void si_llvm_emit_barrier(const s
+ lp_build_intrinsic(gallivm->builder,
+ HAVE_LLVM >= 0x0309 ? "llvm.amdgcn.s.barrier"
+ : "llvm.AMDGPU.barrier.local",
+- ctx->voidt, NULL, 0, LLVMNoUnwindAttribute);
++ ctx->voidt, NULL, 0, LP_FUNC_ATTR_NOUNWIND);
+ }
+
+ static const struct lp_build_tgsi_action tex_action = {
+@@ -3771,9 +3771,9 @@ static void si_create_function(struct si
+ /* We tell llvm that array inputs are passed by value to allow Sinking pass
+ * to move load. Inputs are constant so this is fine. */
+ if (i <= last_array_pointer)
+- LLVMAddAttribute(P, LLVMByValAttribute);
++ lp_add_function_attr(ctx->radeon_bld.main_fn, i + 1, LP_FUNC_ATTR_BYVAL);
+ else
+- LLVMAddAttribute(P, LLVMInRegAttribute);
++ lp_add_function_attr(ctx->radeon_bld.main_fn, i + 1, LP_FUNC_ATTR_INREG);
+ }
+ }
+
+@@ -4699,7 +4699,7 @@ static int si_generate_gs_copy_shader(st
+ lp_build_intrinsic(gallivm->builder,
+ "llvm.SI.buffer.load.dword.i32.i32",
+ ctx->i32, args, 9,
+- LLVMReadOnlyAttribute | LLVMNoUnwindAttribute),
++ LP_FUNC_ATTR_READONLY),
+ ctx->f32, "");
+ }
+ }
Index: pkgsrc/graphics/MesaLib11/patches/patch-src_gallium_targets_dri_Makefile.in
diff -u /dev/null pkgsrc/graphics/MesaLib11/patches/patch-src_gallium_targets_dri_Makefile.in:1.1
--- /dev/null Wed Aug 21 13:35:29 2019
+++ pkgsrc/graphics/MesaLib11/patches/patch-src_gallium_targets_dri_Makefile.in Wed Aug 21 13:35:29 2019
@@ -0,0 +1,15 @@
+$NetBSD: patch-src_gallium_targets_dri_Makefile.in,v 1.1 2019/08/21 13:35:29 nia Exp $
+
+DRI drivers need explicit linkage to glapi. FDO bug 57702. We only need to do
+this for the "mega" drivers since that's where final linking takes place.
+
+--- src/gallium/targets/dri/Makefile.in.orig 2015-03-28 18:43:38.000000000 +0000
++++ src/gallium/targets/dri/Makefile.in
+@@ -735,6 +735,7 @@ GALLIUM_TARGET_CFLAGS = \
+ $(VISIBILITY_CFLAGS)
+
+ GALLIUM_COMMON_LIB_DEPS = \
++ $(top_srcdir)/src/mapi/shared-glapi/libglapi.la \
+ -lm \
+ $(CLOCK_LIB) \
+ $(PTHREAD_LIBS) \
Index: pkgsrc/graphics/MesaLib11/patches/patch-src_gallium_winsys_radeon_drm_radeon__drm__winsys.c
diff -u /dev/null pkgsrc/graphics/MesaLib11/patches/patch-src_gallium_winsys_radeon_drm_radeon__drm__winsys.c:1.1
--- /dev/null Wed Aug 21 13:35:29 2019
+++ pkgsrc/graphics/MesaLib11/patches/patch-src_gallium_winsys_radeon_drm_radeon__drm__winsys.c Wed Aug 21 13:35:29 2019
@@ -0,0 +1,18 @@
+$NetBSD: patch-src_gallium_winsys_radeon_drm_radeon__drm__winsys.c,v 1.1 2019/08/21 13:35:29 nia Exp $
+
+Don't create pipe thread on NetBSD. It triggers some kernel bug.
+kern/49838.
+
+--- src/gallium/winsys/radeon/drm/radeon_drm_winsys.c.orig 2015-03-28 18:20:39.000000000 +0000
++++ src/gallium/winsys/radeon/drm/radeon_drm_winsys.c
+@@ -704,8 +704,10 @@ radeon_drm_winsys_create(int fd, radeon_
+
+ ws->ncs = 0;
+ pipe_semaphore_init(&ws->cs_queued, 0);
++#if !defined(__NetBSD__)
+ if (ws->num_cpus > 1 && debug_get_option_thread())
+ ws->thread = pipe_thread_create(radeon_drm_cs_emit_ioctl, ws);
++#endif
+
+ /* Create the screen at the end. The winsys must be initialized
+ * completely.
Index: pkgsrc/graphics/MesaLib11/patches/patch-src_gallium_winsys_svga_drm_vmw__screen.c
diff -u /dev/null pkgsrc/graphics/MesaLib11/patches/patch-src_gallium_winsys_svga_drm_vmw__screen.c:1.1
--- /dev/null Wed Aug 21 13:35:29 2019
+++ pkgsrc/graphics/MesaLib11/patches/patch-src_gallium_winsys_svga_drm_vmw__screen.c Wed Aug 21 13:35:29 2019
@@ -0,0 +1,19 @@
+$NetBSD: patch-src_gallium_winsys_svga_drm_vmw__screen.c,v 1.1 2019/08/21 13:35:29 nia Exp $
+
+* Solaris needs sys/mkdev.h for major(2).
+* Linux needs sys/sysmacros.h for major(2).
+
+--- src/gallium/winsys/svga/drm/vmw_screen.c.orig 2016-01-22 15:44:31.000000000 +0000
++++ src/gallium/winsys/svga/drm/vmw_screen.c
+@@ -32,6 +32,11 @@
+ #include "pipe/p_compiler.h"
+ #include "util/u_hash_table.h"
+ #include <sys/types.h>
++#ifdef __sun
++#include <sys/mkdev.h> /* for major(2) */
++#elif defined(__linux__)
++#include <sys/sysmacros.h>
++#endif
+ #include <sys/stat.h>
+ #include <unistd.h>
+
Index: pkgsrc/graphics/MesaLib11/patches/patch-src_gallium_winsys_svga_drm_vmw__screen__ioctl.c
diff -u /dev/null pkgsrc/graphics/MesaLib11/patches/patch-src_gallium_winsys_svga_drm_vmw__screen__ioctl.c:1.1
--- /dev/null Wed Aug 21 13:35:29 2019
+++ pkgsrc/graphics/MesaLib11/patches/patch-src_gallium_winsys_svga_drm_vmw__screen__ioctl.c Wed Aug 21 13:35:29 2019
@@ -0,0 +1,32 @@
+$NetBSD: patch-src_gallium_winsys_svga_drm_vmw__screen__ioctl.c,v 1.1 2019/08/21 13:35:29 nia Exp $
+
+Make sure ERESTART gets defined.
+
+--- src/gallium/winsys/svga/drm/vmw_screen_ioctl.c.orig 2015-04-24 21:09:35.000000000 +0000
++++ src/gallium/winsys/svga/drm/vmw_screen_ioctl.c
+@@ -48,6 +48,25 @@
+
+ #include "os/os_mman.h"
+
++#if defined(__NetBSD__)
++#define _KMEMUSER
++#include <errno.h>
++#if !defined(ERESTART)
++#define ERESTART -3
++#endif
++#endif
++
++#if defined(__FreeBSD__)
++#include <errno.h>
++#if !defined(ERESTART)
++#define ERESTART -1
++#endif
++#endif
++
++#if defined(__DragonFly__)
++#define _KERNEL_STRUCTURES 1
++#endif
++
+ #include <errno.h>
+ #include <unistd.h>
+
Index: pkgsrc/graphics/MesaLib11/patches/patch-src_gbm_main_gbm.c
diff -u /dev/null pkgsrc/graphics/MesaLib11/patches/patch-src_gbm_main_gbm.c:1.1
--- /dev/null Wed Aug 21 13:35:29 2019
+++ pkgsrc/graphics/MesaLib11/patches/patch-src_gbm_main_gbm.c Wed Aug 21 13:35:29 2019
@@ -0,0 +1,19 @@
+$NetBSD: patch-src_gbm_main_gbm.c,v 1.1 2019/08/21 13:35:29 nia Exp $
+
+* Solaris needs sys/mkdev.h for major(2).
+* Linux needs sys/sysmacros.h for major(2).
+
+--- src/gbm/main/gbm.c.orig 2016-05-01 12:48:59.000000000 +0000
++++ src/gbm/main/gbm.c
+@@ -35,6 +35,11 @@
+ #include <stdint.h>
+
+ #include <sys/types.h>
++#ifdef __sun
++#include <sys/mkdev.h> /* for major(2) */
++#elif defined(__linux__)
++#include <sys/sysmacros.h>
++#endif
+ #include <sys/stat.h>
+ #include <unistd.h>
+ #include <errno.h>
Index: pkgsrc/graphics/MesaLib11/patches/patch-src_glsl_ralloc.c
diff -u /dev/null pkgsrc/graphics/MesaLib11/patches/patch-src_glsl_ralloc.c:1.1
--- /dev/null Wed Aug 21 13:35:29 2019
+++ pkgsrc/graphics/MesaLib11/patches/patch-src_glsl_ralloc.c Wed Aug 21 13:35:29 2019
@@ -0,0 +1,39 @@
+$NetBSD: patch-src_glsl_ralloc.c,v 1.1 2019/08/21 13:35:29 nia Exp $
+
+* Fix exit time segfault of qt5 application with modular xorg
+* Provide compat strnlen for older Darwin.
+
+--- src/util/ralloc.c.orig 2016-01-29 12:21:30.000000000 +0000
++++ src/util/ralloc.c
+@@ -312,7 +312,7 @@ ralloc_parent(const void *ptr)
+
+ static void *autofree_context = NULL;
+
+-static void
++static void __attribute__((__destructor__))
+ autofree(void)
+ {
+ ralloc_free(autofree_context);
+@@ -323,7 +323,6 @@ ralloc_autofree_context(void)
+ {
+ if (unlikely(autofree_context == NULL)) {
+ autofree_context = ralloc_context(NULL);
+- atexit(autofree);
+ }
+ return autofree_context;
+ }
+@@ -360,7 +359,14 @@ ralloc_strndup(const void *ctx, const ch
+ if (unlikely(str == NULL))
+ return NULL;
+
++#if (defined(__APPLE__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__-0 < 1070)
++ for (n = 0; n < max; n++, str++) {
++ if (!*str)
++ break;
++ }
++#else
+ n = strnlen(str, max);
++#endif
+ ptr = ralloc_array(ctx, char, n + 1);
+ memcpy(ptr, str, n);
+ ptr[n] = '\0';
Index: pkgsrc/graphics/MesaLib11/patches/patch-src_glx_apple_apple__glapi.c
diff -u /dev/null pkgsrc/graphics/MesaLib11/patches/patch-src_glx_apple_apple__glapi.c:1.1
--- /dev/null Wed Aug 21 13:35:29 2019
+++ pkgsrc/graphics/MesaLib11/patches/patch-src_glx_apple_apple__glapi.c Wed Aug 21 13:35:29 2019
@@ -0,0 +1,24 @@
+$NetBSD: patch-src_glx_apple_apple__glapi.c,v 1.1 2019/08/21 13:35:29 nia Exp $
+
+https://bugs.freedesktop.org/show_bug.cgi?id=90311
+See also hacks.mk.
+
+--- src/glx/apple/apple_glapi.c.orig 2015-08-07 17:36:03.000000000 +0000
++++ src/glx/apple/apple_glapi.c
+@@ -39,6 +39,7 @@
+ #include <GL/gl.h>
+
+ #include "main/glheader.h"
++#include "main/remap.h"
+ #include "glapi.h"
+ #include "glapitable.h"
+ #include "main/dispatch.h"
+@@ -54,6 +55,8 @@ static void _apple_glapi_create_table(vo
+ if (__applegl_api)
+ return;
+
++ _mesa_init_remap_table();
++
+ __ogl_framework_api = _glapi_create_table_from_handle(apple_cgl_get_dl_handle(), "gl");
+ assert(__ogl_framework_api);
+
Index: pkgsrc/graphics/MesaLib11/patches/patch-src_glx_glxclient.h
diff -u /dev/null pkgsrc/graphics/MesaLib11/patches/patch-src_glx_glxclient.h:1.1
--- /dev/null Wed Aug 21 13:35:29 2019
+++ pkgsrc/graphics/MesaLib11/patches/patch-src_glx_glxclient.h Wed Aug 21 13:35:29 2019
@@ -0,0 +1,19 @@
+$NetBSD: patch-src_glx_glxclient.h,v 1.1 2019/08/21 13:35:29 nia Exp $
+
+NetBSD only supports zero-initialized initial-exec tls variables in conjuction
+with dlopen(3) at the moment.
+
+--- src/glx/glxclient.h.orig 2015-09-02 17:06:23.000000000 +0000
++++ src/glx/glxclient.h
+@@ -635,7 +635,11 @@ extern void __glXSetCurrentContext(struc
+ extern __thread void *__glX_tls_Context
+ __attribute__ ((tls_model("initial-exec")));
+
++#if defined(__NetBSD__)
++# define __glXGetCurrentContext() (likely(__glX_tls_Context) ? __glX_tls_Context : (void*)&dummyContext)
++#else
+ # define __glXGetCurrentContext() __glX_tls_Context
++#endif
+
+ # else
+
Index: pkgsrc/graphics/MesaLib11/patches/patch-src_glx_glxcurrent.c
diff -u /dev/null pkgsrc/graphics/MesaLib11/patches/patch-src_glx_glxcurrent.c:1.1
--- /dev/null Wed Aug 21 13:35:29 2019
+++ pkgsrc/graphics/MesaLib11/patches/patch-src_glx_glxcurrent.c Wed Aug 21 13:35:29 2019
@@ -0,0 +1,40 @@
+$NetBSD: patch-src_glx_glxcurrent.c,v 1.1 2019/08/21 13:35:29 nia Exp $
+
+Interim fix for toolchain/50277.
+
+NetBSD only supports zero-initialized initial-exec tls variables in conjuction
+with dlopen(3) at the moment.
+
+--- src/glx/glxcurrent.c.orig 2015-09-02 17:06:23.000000000 +0000
++++ src/glx/glxcurrent.c
+@@ -40,6 +40,18 @@
+ #include "glapi.h"
+
+ /*
++ * MASSIVE KLUDGE!
++ * We need these to not be extern in libGL.so because of
++ * PR toolchain/50277
++ */
++#if defined(GLX_USE_TLS) && defined(__NetBSD__)
++_X_EXPORT __thread struct _glapi_table * _glapi_tls_Dispatch
++ __attribute__((tls_model("initial-exec"))) = NULL;
++_X_EXPORT __thread void * _glapi_tls_Context
++ __attribute__((tls_model("initial-exec")));
++#endif
++
++/*
+ ** We setup some dummy structures here so that the API can be used
+ ** even if no context is current.
+ */
+@@ -77,7 +89,11 @@ _X_HIDDEN pthread_mutex_t __glXmutex = P
+ * \c __glXGetCurrentContext can be implemented as trivial macro.
+ */
+ __thread void *__glX_tls_Context __attribute__ ((tls_model("initial-exec")))
++#if defined(__NetBSD__)
++ = NULL; /* non-zero initializers not supported with dlopen */
++#else
+ = &dummyContext;
++#endif
+
+ _X_HIDDEN void
+ __glXSetCurrentContext(struct glx_context * c)
Index: pkgsrc/graphics/MesaLib11/patches/patch-src_loader_Makefile.in
diff -u /dev/null pkgsrc/graphics/MesaLib11/patches/patch-src_loader_Makefile.in:1.1
--- /dev/null Wed Aug 21 13:35:29 2019
+++ pkgsrc/graphics/MesaLib11/patches/patch-src_loader_Makefile.in Wed Aug 21 13:35:29 2019
@@ -0,0 +1,24 @@
+$NetBSD: patch-src_loader_Makefile.in,v 1.1 2019/08/21 13:35:29 nia Exp $
+
+FreeBSD & DragonFly support for libdevq.
+
+--- src/loader/Makefile.in.orig 2016-01-13 10:48:30.000000000 +0000
++++ src/loader/Makefile.in
+@@ -320,6 +320,8 @@ LEXLIB = @LEXLIB@
+ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+ LIBCLC_INCLUDEDIR = @LIBCLC_INCLUDEDIR@
+ LIBCLC_LIBEXECDIR = @LIBCLC_LIBEXECDIR@
++LIBDEVQ_CFLAGS = @LIBDEVQ_CFLAGS@
++LIBDEVQ_LIBS = @LIBDEVQ_LIBS@
+ LIBDRM_CFLAGS = @LIBDRM_CFLAGS@
+ LIBDRM_LIBS = @LIBDRM_LIBS@
+ LIBELF_CFLAGS = @LIBELF_CFLAGS@
+@@ -532,7 +534,7 @@ AM_CPPFLAGS = \
+ $(LIBDRM_CFLAGS) \
+ $(LIBUDEV_CFLAGS)
+
+-libloader_la_CPPFLAGS = $(AM_CPPFLAGS) $(am__append_1)
++libloader_la_CPPFLAGS = $(AM_CPPFLAGS) $(am__append_1) $(LIBDEVQ_CFLAGS)
+ libloader_la_SOURCES = $(LOADER_C_FILES)
+ libloader_la_LIBADD = $(am__append_2) $(am__append_3)
+ @HAVE_DRI3_TRUE@libloader_dri3_helper_la_SOURCES = \
Index: pkgsrc/graphics/MesaLib11/patches/patch-src_loader_loader.c
diff -u /dev/null pkgsrc/graphics/MesaLib11/patches/patch-src_loader_loader.c:1.1
--- /dev/null Wed Aug 21 13:35:29 2019
+++ pkgsrc/graphics/MesaLib11/patches/patch-src_loader_loader.c Wed Aug 21 13:35:29 2019
@@ -0,0 +1,96 @@
+$NetBSD: patch-src_loader_loader.c,v 1.1 2019/08/21 13:35:29 nia Exp $
+
+* FreeBSD & DragonFly support for libdevq. From FreeBSD ports(?).
+* Linux needs sys/sysmacros.h for major(2).
+
+--- src/loader/loader.c.orig 2016-05-09 12:20:52.000000000 +0000
++++ src/loader/loader.c
+@@ -70,7 +70,7 @@
+ #include <stdarg.h>
+ #include <stdio.h>
+ #include <string.h>
+-#ifdef HAVE_LIBUDEV
++#if defined(HAVE_LIBUDEV) || defined(HAVE_LIBDEVQ)
+ #include <assert.h>
+ #include <dlfcn.h>
+ #include <unistd.h>
+@@ -81,8 +81,12 @@
+ #endif
+ #endif
+ #ifdef HAVE_SYSFS
++#if defined(__linux__)
++#include <sys/sysmacros.h>
++#else
+ #include <sys/types.h>
+ #endif
++#endif
+ #include "loader.h"
+
+ #ifdef HAVE_LIBDRM
+@@ -505,6 +509,53 @@ sysfs_get_pci_id_for_fd(int fd, int *ven
+ }
+ #endif
+
++#if defined(HAVE_LIBDEVQ)
++#include <libdevq.h>
++
++static void *devq_handle = NULL;
++
++static void *
++devq_dlopen_handle(void)
++{
++ if (!devq_handle) {
++ devq_handle = dlopen("libdevq.so.0", RTLD_LOCAL | RTLD_LAZY);
++ }
++
++ return devq_handle;
++}
++
++static void *
++asserted_dlsym(void *dlopen_handle, const char *name)
++{
++ void *result = dlsym(dlopen_handle, name);
++ assert(result);
++ return result;
++}
++
++#define DEVQ_SYMBOL(ret, name, args) \
++ ret (*name) args = asserted_dlsym(devq_dlopen_handle(), #name);
++
++static int
++devq_get_pci_id_from_fd(int fd, int *vendor_id, int *chip_id)
++{
++ int ret;
++ DEVQ_SYMBOL(int, devq_device_get_pciid_from_fd,
++ (int fd, int *vendor_id, int *chip_id));
++
++ *chip_id = -1;
++
++ ret = devq_device_get_pciid_from_fd(fd, vendor_id, chip_id);
++ if (ret < 0) {
++ log_(_LOADER_WARNING, "MESA-LOADER: could not get PCI ID\n");
++ goto out;
++ }
++
++out:
++ return (*chip_id >= 0);
++}
++
++#endif
++
+ #if defined(HAVE_LIBDRM)
+ /* for i915 */
+ #include <i915_drm.h>
+@@ -588,6 +639,12 @@ loader_get_pci_id_for_fd(int fd, int *ve
+ if (sysfs_get_pci_id_for_fd(fd, vendor_id, chip_id))
+ return 1;
+ #endif
++
++#if HAVE_LIBDEVQ
++ if (devq_get_pci_id_from_fd(fd, vendor_id, chip_id))
++ return 1;
++#endif
++
+ #if HAVE_LIBDRM
+ if (drm_get_pci_id_for_fd(fd, vendor_id, chip_id))
+ return 1;
Index: pkgsrc/graphics/MesaLib11/patches/patch-src_mapi_entry__x86-64__tls.h
diff -u /dev/null pkgsrc/graphics/MesaLib11/patches/patch-src_mapi_entry__x86-64__tls.h:1.1
--- /dev/null Wed Aug 21 13:35:29 2019
+++ pkgsrc/graphics/MesaLib11/patches/patch-src_mapi_entry__x86-64__tls.h Wed Aug 21 13:35:29 2019
@@ -0,0 +1,40 @@
+$NetBSD: patch-src_mapi_entry__x86-64__tls.h,v 1.1 2019/08/21 13:35:29 nia Exp $
+
+NetBSD only supports zero-initialized initial-exec tls variables in conjuction
+with dlopen(3) at the moment.
+
+Fix --enable-glx-tls with clang. From FreeBSD.
+
+--- src/mapi/entry_x86-64_tls.h.orig 2015-09-11 17:41:47.000000000 +0000
++++ src/mapi/entry_x86-64_tls.h
+@@ -36,10 +36,19 @@ __asm__(".text\n"
+ ".balign 32\n" \
+ func ":"
+
++#ifdef __NetBSD__
+ #define STUB_ASM_CODE(slot) \
+ "movq " ENTRY_CURRENT_TABLE "@GOTTPOFF(%rip), %rax\n\t" \
+ "movq %fs:(%rax), %r11\n\t" \
++ "testq %r11, %r11\n\t" \
++ "cmoveq table_noop_array@GOTPCREL(%rip), %r11\n\t" \
+ "jmp *(8 * " slot ")(%r11)"
++#else
++#define STUB_ASM_CODE(slot) \
++ "movq " ENTRY_CURRENT_TABLE "@GOTTPOFF(%rip), %rax\n\t" \
++ "movq %fs:(%rax), %r11\n\t" \
++ "jmp *(8 * " slot ")(%r11)"
++#endif
+
+ #define MAPI_TMP_STUB_ASM_GCC
+ #include "mapi_tmp.h"
+@@ -61,8 +70,8 @@ entry_patch_public(void)
+ {
+ }
+
+-static char
+-x86_64_entry_start[];
++extern char
++x86_64_entry_start[] __attribute__((visibility("hidden")));
+
+ mapi_func
+ entry_get_public(int slot)
Index: pkgsrc/graphics/MesaLib11/patches/patch-src_mapi_entry__x86__tls.h
diff -u /dev/null pkgsrc/graphics/MesaLib11/patches/patch-src_mapi_entry__x86__tls.h:1.1
--- /dev/null Wed Aug 21 13:35:29 2019
+++ pkgsrc/graphics/MesaLib11/patches/patch-src_mapi_entry__x86__tls.h Wed Aug 21 13:35:29 2019
@@ -0,0 +1,48 @@
+$NetBSD: patch-src_mapi_entry__x86__tls.h,v 1.1 2019/08/21 13:35:29 nia Exp $
+
+NetBSD only supports zero-initialized initial-exec tls variables in conjuction
+with dlopen(3) at the moment.
+
+Fix --enable-glx-tls with clang. From FreeBSD.
+
+--- src/mapi/entry_x86_tls.h.orig 2015-09-02 17:06:23.000000000 +0000
++++ src/mapi/entry_x86_tls.h
+@@ -50,10 +50,27 @@ __asm__(".balign 16\n"
+ ".balign 16\n" \
+ func ":"
+
++#ifdef __NetBSD__
++extern const mapi_func table_noop_array[];
+ #define STUB_ASM_CODE(slot) \
+ "call x86_current_tls\n\t" \
+ "movl %gs:(%eax), %eax\n\t" \
++ "testl %eax, %eax\n\t" \
++ "je 1f\n\t" \
++ "jmp *(4 * " slot ")(%eax)\n\t" \
++ "1:\n\t" \
++ "call 2f\n" \
++ "2:\n\t" \
++ "popl %eax\n\t" \
++ "addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %eax\n\t" \
++ "movl table_noop_array@GOT(%eax), %eax\n\t" \
+ "jmp *(4 * " slot ")(%eax)"
++#else
++#define STUB_ASM_CODE(slot) \
++ "call x86_current_tls\n\t" \
++ "movl %gs:(%eax), %eax\n\t" \
++ "jmp *(4 * " slot ")(%eax)"
++#endif
+
+ #define MAPI_TMP_STUB_ASM_GCC
+ #include "mapi_tmp.h"
+@@ -71,8 +88,8 @@ __asm__(".text");
+ extern unsigned long
+ x86_current_tls();
+
+-static char x86_entry_start[];
+-static char x86_entry_end[];
++extern char x86_entry_start[] __attribute__((visibility("hidden")));
++extern char x86_entry_end[] __attribute__((visibility("hidden")));
+
+ void
+ entry_patch_public(void)
Index: pkgsrc/graphics/MesaLib11/patches/patch-src_mapi_entry__x86__tsd.h
diff -u /dev/null pkgsrc/graphics/MesaLib11/patches/patch-src_mapi_entry__x86__tsd.h:1.1
--- /dev/null Wed Aug 21 13:35:29 2019
+++ pkgsrc/graphics/MesaLib11/patches/patch-src_mapi_entry__x86__tsd.h Wed Aug 21 13:35:29 2019
@@ -0,0 +1,17 @@
+$NetBSD: patch-src_mapi_entry__x86__tsd.h,v 1.1 2019/08/21 13:35:29 nia Exp $
+
+Fix --enable-glx-tls with clang. From FreeBSD.
+
+--- src/mapi/entry_x86_tsd.h.orig 2015-03-28 18:20:39.000000000 +0000
++++ src/mapi/entry_x86_tsd.h
+@@ -59,8 +59,8 @@ __asm__(".balign 32\n"
+ #include <string.h>
+ #include "u_execmem.h"
+
+-static const char x86_entry_start[];
+-static const char x86_entry_end[];
++extern const char x86_entry_start[] __attribute__((visibility("hidden")));
++extern const char x86_entry_end[] __attribute__((visibility("hidden")));
+
+ void
+ entry_patch_public(void)
Index: pkgsrc/graphics/MesaLib11/patches/patch-src_mapi_glapi_gen_gl__gentable.py
diff -u /dev/null pkgsrc/graphics/MesaLib11/patches/patch-src_mapi_glapi_gen_gl__gentable.py:1.1
--- /dev/null Wed Aug 21 13:35:29 2019
+++ pkgsrc/graphics/MesaLib11/patches/patch-src_mapi_glapi_gen_gl__gentable.py Wed Aug 21 13:35:29 2019
@@ -0,0 +1,15 @@
+$NetBSD: patch-src_mapi_glapi_gen_gl__gentable.py,v 1.1 2019/08/21 13:35:29 nia Exp $
+
+FreeBSD support.
+
+--- src/mapi/glapi/gen/gl_gentable.py.orig 2015-07-29 21:28:50.156039000 +0000
++++ src/mapi/glapi/gen/gl_gentable.py
+@@ -42,7 +42,7 @@ header = """/* GLXEXT is the define used
+ #endif
+
+ #if (defined(GLXEXT) && defined(HAVE_BACKTRACE)) \\
+- || (!defined(GLXEXT) && defined(DEBUG) && !defined(__CYGWIN__) && !defined(__MINGW32__) && !defined(__OpenBSD__) && !defined(__NetBSD__) && !defined(__DragonFly__))
++ || (!defined(GLXEXT) && defined(DEBUG) && !defined(__CYGWIN__) && !defined(__MINGW32__) && !defined(__OpenBSD__) && !defined(__NetBSD__) && !defined(__FreeBSD__) && !defined(__DragonFly__))
+ #define USE_BACKTRACE
+ #endif
+
Index: pkgsrc/graphics/MesaLib11/patches/patch-src_mapi_u__current.c
diff -u /dev/null pkgsrc/graphics/MesaLib11/patches/patch-src_mapi_u__current.c:1.1
--- /dev/null Wed Aug 21 13:35:29 2019
+++ pkgsrc/graphics/MesaLib11/patches/patch-src_mapi_u__current.c Wed Aug 21 13:35:29 2019
@@ -0,0 +1,31 @@
+$NetBSD: patch-src_mapi_u__current.c,v 1.1 2019/08/21 13:35:29 nia Exp $
+
+NetBSD only supports zero-initialized initial-exec tls variables in conjuction
+with dlopen(3) at the moment.
+
+--- src/mapi/u_current.c.orig 2015-09-02 17:06:23.000000000 +0000
++++ src/mapi/u_current.c
+@@ -101,7 +101,11 @@ extern void (*__glapi_noop_table[])(void
+
+ __thread struct mapi_table *u_current_table
+ __attribute__((tls_model("initial-exec")))
++#if defined(__NetBSD__)
++ = NULL; /* non-zero initializers not supported with dlopen */
++#else
+ = (struct mapi_table *) table_noop_array;
++#endif
+
+ __thread void *u_current_context
+ __attribute__((tls_model("initial-exec")));
+@@ -283,7 +287,11 @@ struct mapi_table *
+ u_current_get_table_internal(void)
+ {
+ #if defined(GLX_USE_TLS)
++# if defined(__NetBSD__)
++ return (likely(u_current_table) ? u_current_table : (struct mapi_table *) table_noop_array);
++# else
+ return u_current_table;
++# endif
+ #else
+ if (ThreadSafe)
+ return (struct mapi_table *) tss_get(u_current_table_tsd);
Index: pkgsrc/graphics/MesaLib11/patches/patch-src_mapi_u__current.h
diff -u /dev/null pkgsrc/graphics/MesaLib11/patches/patch-src_mapi_u__current.h:1.1
--- /dev/null Wed Aug 21 13:35:29 2019
+++ pkgsrc/graphics/MesaLib11/patches/patch-src_mapi_u__current.h Wed Aug 21 13:35:29 2019
@@ -0,0 +1,16 @@
+$NetBSD: patch-src_mapi_u__current.h,v 1.1 2019/08/21 13:35:29 nia Exp $
+
+NetBSD only supports zero-initialized initial-exec tls variables in conjuction
+with dlopen(3) at the moment.
+
+--- src/mapi/u_current.h.orig 2015-09-02 17:06:23.000000000 +0000
++++ src/mapi/u_current.h
+@@ -68,7 +68,7 @@ u_current_get_context_internal(void);
+ static inline const struct mapi_table *
+ u_current_get_table(void)
+ {
+-#ifdef GLX_USE_TLS
++#if defined(GLX_USE_TLS) && !defined(__NetBSD__)
+ return u_current_table;
+ #else
+ return (likely(u_current_table) ?
Index: pkgsrc/graphics/MesaLib11/patches/patch-src_mesa_drivers_dri_Makefile.in
diff -u /dev/null pkgsrc/graphics/MesaLib11/patches/patch-src_mesa_drivers_dri_Makefile.in:1.1
--- /dev/null Wed Aug 21 13:35:29 2019
+++ pkgsrc/graphics/MesaLib11/patches/patch-src_mesa_drivers_dri_Makefile.in Wed Aug 21 13:35:29 2019
@@ -0,0 +1,15 @@
+$NetBSD: patch-src_mesa_drivers_dri_Makefile.in,v 1.1 2019/08/21 13:35:29 nia Exp $
+
+DRI drivers need explicit linkage to glapi. FDO bug 57702. We only need to do
+this for the "mega" drivers since that's where final linking takes place.
+
+--- src/mesa/drivers/dri/Makefile.in.orig 2015-07-04 11:11:08.000000000 +0000
++++ src/mesa/drivers/dri/Makefile.in
+@@ -583,6 +583,7 @@ mesa_dri_drivers_la_LIBADD = \
+ common/libxmlconfig.la \
+ $(MEGADRIVERS_DEPS) \
+ $(DRI_LIB_DEPS) \
++ $(top_srcdir)/src/mapi/shared-glapi/libglapi.la \
+ $()
+
+ @NEED_MEGADRIVER_TRUE@dri_LTLIBRARIES = mesa_dri_drivers.la
Index: pkgsrc/graphics/MesaLib11/patches/patch-src_mesa_drivers_dri_common_Makefile.in
diff -u /dev/null pkgsrc/graphics/MesaLib11/patches/patch-src_mesa_drivers_dri_common_Makefile.in:1.1
--- /dev/null Wed Aug 21 13:35:29 2019
+++ pkgsrc/graphics/MesaLib11/patches/patch-src_mesa_drivers_dri_common_Makefile.in Wed Aug 21 13:35:29 2019
@@ -0,0 +1,16 @@
+$NetBSD: patch-src_mesa_drivers_dri_common_Makefile.in,v 1.1 2019/08/21 13:35:29 nia Exp $
+
+Don't install the sysconf directory for now.
+
+--- src/mesa/drivers/dri/common/Makefile.in.orig 2015-02-28 00:06:10.000000000 +0000
++++ src/mesa/drivers/dri/common/Makefile.in
+@@ -710,6 +710,9 @@ mostlyclean-libtool:
+ clean-libtool:
+ -rm -rf .libs _libs
+ install-sysconfDATA: $(sysconf_DATA)
++ true
++
++disabled-install-sysconfDATA:
+ @$(NORMAL_INSTALL)
+ @list='$(sysconf_DATA)'; test -n "$(sysconfdir)" || list=; \
+ if test -n "$$list"; then \
Index: pkgsrc/graphics/MesaLib11/patches/patch-src_mesa_drivers_dri_common_xmlconfig.c
diff -u /dev/null pkgsrc/graphics/MesaLib11/patches/patch-src_mesa_drivers_dri_common_xmlconfig.c:1.1
--- /dev/null Wed Aug 21 13:35:29 2019
+++ pkgsrc/graphics/MesaLib11/patches/patch-src_mesa_drivers_dri_common_xmlconfig.c Wed Aug 21 13:35:29 2019
@@ -0,0 +1,50 @@
+$NetBSD: patch-src_mesa_drivers_dri_common_xmlconfig.c,v 1.1 2019/08/21 13:35:29 nia Exp $
+
+PR pkg/50202.
+Provide compat strndup for older Darwin.
+
+--- src/mesa/drivers/dri/common/xmlconfig.c.orig 2016-01-29 12:21:30.000000000 +0000
++++ src/mesa/drivers/dri/common/xmlconfig.c
+@@ -50,12 +50,17 @@ extern char *program_invocation_name, *p
+ # define GET_PROGRAM_NAME() program_invocation_short_name
+ #elif defined(__CYGWIN__)
+ # define GET_PROGRAM_NAME() program_invocation_short_name
++/*
+ #elif defined(__FreeBSD__) && (__FreeBSD__ >= 2)
+ # include <osreldate.h>
+ # if (__FreeBSD_version >= 440000)
+ # include <stdlib.h>
+ # define GET_PROGRAM_NAME() getprogname()
+ # endif
++*/
++#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
++# include <stdlib.h>
++# define GET_PROGRAM_NAME() getprogname()
+ #elif defined(__NetBSD__) && defined(__NetBSD_Version__) && (__NetBSD_Version__ >= 106000100)
+ # include <stdlib.h>
+ # define GET_PROGRAM_NAME() getprogname()
+@@ -111,6 +116,24 @@ static const char *__getProgramName () {
+ # endif
+ #endif
+
++#if (defined(__APPLE__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__-0 < 1070)
++static char *
++strndup(const char *str, size_t n)
++{
++ size_t len;
++ char *copy;
++
++ for (len = 0; len < n && str[len]; len++)
++ continue;
++
++ if ((copy = (char *)malloc(len + 1)) == NULL)
++ return (NULL);
++ memcpy(copy, str, len);
++ copy[len] = '\0';
++ return (copy);
++}
++#endif
++
+ /** \brief Find an option in an option cache with the name as key */
+ static uint32_t findOption (const driOptionCache *cache, const char *name) {
+ uint32_t len = strlen (name);
Index: pkgsrc/graphics/MesaLib11/patches/patch-src_mesa_drivers_dri_i915_intel__screen.c
diff -u /dev/null pkgsrc/graphics/MesaLib11/patches/patch-src_mesa_drivers_dri_i915_intel__screen.c:1.1
--- /dev/null Wed Aug 21 13:35:29 2019
+++ pkgsrc/graphics/MesaLib11/patches/patch-src_mesa_drivers_dri_i915_intel__screen.c Wed Aug 21 13:35:29 2019
@@ -0,0 +1,39 @@
+$NetBSD: patch-src_mesa_drivers_dri_i915_intel__screen.c,v 1.1 2019/08/21 13:35:29 nia Exp $
+
+Fix build on older NetBSD w/o _SC_PHYS_PAGES.
+
+--- src/mesa/drivers/dri/i915/intel_screen.c.orig 2015-06-07 10:06:53.000000000 +0000
++++ src/mesa/drivers/dri/i915/intel_screen.c
+@@ -41,6 +41,10 @@
+ #include "utils.h"
+ #include "xmlpool.h"
+
++#ifdef HAVE_SYS_SYSCTL_H
++# include <sys/sysctl.h>
++#endif
++
+ static const __DRIconfigOptionsExtension i915_config_options = {
+ .base = { __DRI_CONFIG_OPTIONS, 1 },
+ .xml =
+@@ -732,6 +736,13 @@ i915_query_renderer_integer(__DRIscreen
+ const unsigned gpu_mappable_megabytes =
+ (aper_size / (1024 * 1024)) * 3 / 4;
+
++#if defined(HW_PHYSMEM64)
++ int mib[2] = { CTL_HW, HW_PHYSMEM64 };
++ uint64_t system_memory_bytes;
++ size_t len = sizeof(system_memory_bytes);
++ if (sysctl(mib, 2, &system_memory_bytes, &len, NULL, 0) != 0)
++ return -1;
++#else
+ const long system_memory_pages = sysconf(_SC_PHYS_PAGES);
+ const long system_page_size = sysconf(_SC_PAGE_SIZE);
+
+@@ -740,6 +751,7 @@ i915_query_renderer_integer(__DRIscreen
+
+ const uint64_t system_memory_bytes = (uint64_t) system_memory_pages
+ * (uint64_t) system_page_size;
++#endif
+
+ const unsigned system_memory_megabytes =
+ (unsigned) (system_memory_bytes / (1024 * 1024));
Index: pkgsrc/graphics/MesaLib11/patches/patch-src_mesa_drivers_dri_i965_intel__screen.c
diff -u /dev/null pkgsrc/graphics/MesaLib11/patches/patch-src_mesa_drivers_dri_i965_intel__screen.c:1.1
--- /dev/null Wed Aug 21 13:35:29 2019
+++ pkgsrc/graphics/MesaLib11/patches/patch-src_mesa_drivers_dri_i965_intel__screen.c Wed Aug 21 13:35:29 2019
@@ -0,0 +1,39 @@
+$NetBSD: patch-src_mesa_drivers_dri_i965_intel__screen.c,v 1.1 2019/08/21 13:35:29 nia Exp $
+
+Fix build on older NetBSD w/o _SC_PHYS_PAGES.
+
+--- src/mesa/drivers/dri/i965/intel_screen.c.orig 2015-06-07 10:06:53.000000000 +0000
++++ src/mesa/drivers/dri/i965/intel_screen.c
+@@ -42,6 +42,10 @@
+ #include "utils.h"
+ #include "xmlpool.h"
+
++#ifdef HAVE_SYS_SYSCTL_H
++# include <sys/sysctl.h>
++#endif
++
+ static const __DRIconfigOptionsExtension brw_config_options = {
+ .base = { __DRI_CONFIG_OPTIONS, 1 },
+ .xml =
+@@ -829,6 +833,13 @@ brw_query_renderer_integer(__DRIscreen *
+ const unsigned gpu_mappable_megabytes =
+ (aper_size / (1024 * 1024)) * 3 / 4;
+
++#if defined(HW_PHYSMEM64)
++ int mib[2] = { CTL_HW, HW_PHYSMEM64 };
++ const uint64_t system_memory_bytes;
++ size_t len = sizeof(system_memory_bytes);
++ if (sysctl(mib, 2, &system_memory_bytes, &len, NULL, 0) != 0)
++ return -1;
++#else
+ const long system_memory_pages = sysconf(_SC_PHYS_PAGES);
+ const long system_page_size = sysconf(_SC_PAGE_SIZE);
+
+@@ -837,6 +848,7 @@ brw_query_renderer_integer(__DRIscreen *
+
+ const uint64_t system_memory_bytes = (uint64_t) system_memory_pages
+ * (uint64_t) system_page_size;
++#endif
+
+ const unsigned system_memory_megabytes =
+ (unsigned) (system_memory_bytes / (1024 * 1024));
Index: pkgsrc/graphics/MesaLib11/patches/patch-src_mesa_drivers_dri_swrast_swrast.c
diff -u /dev/null pkgsrc/graphics/MesaLib11/patches/patch-src_mesa_drivers_dri_swrast_swrast.c:1.1
--- /dev/null Wed Aug 21 13:35:29 2019
+++ pkgsrc/graphics/MesaLib11/patches/patch-src_mesa_drivers_dri_swrast_swrast.c Wed Aug 21 13:35:29 2019
@@ -0,0 +1,19 @@
+$NetBSD: patch-src_mesa_drivers_dri_swrast_swrast.c,v 1.1 2019/08/21 13:35:29 nia Exp $
+
+Fix build on older NetBSD w/o _SC_PHYS_PAGES.
+
+--- src/mesa/drivers/dri/swrast/swrast.c.orig 2015-06-07 10:06:53.000000000 +0000
++++ src/mesa/drivers/dri/swrast/swrast.c
+@@ -150,6 +150,12 @@ swrast_query_renderer_integer(__DRIscree
+ size_t len = sizeof(system_memory_bytes);
+ if (sysctl(mib, 2, &system_memory_bytes, &len, NULL, 0) != 0)
+ return -1;
++#elif defined(HW_PHYSMEM64)
++ int mib[2] = { CTL_HW, HW_PHYSMEM64 };
++ uint64_t system_memory_bytes;
++ size_t len = sizeof(system_memory_bytes);
++ if (sysctl(mib, 2, &system_memory_bytes, &len, NULL, 0) != 0)
++ return -1;
+ #elif defined(_SC_PHYS_PAGES) && defined(_SC_PAGE_SIZE)
+ /* XXX: Do we want to return the full amount of system memory ? */
+ const long system_memory_pages = sysconf(_SC_PHYS_PAGES);
Index: pkgsrc/graphics/MesaLib11/patches/patch-src_mesa_main_context.c
diff -u /dev/null pkgsrc/graphics/MesaLib11/patches/patch-src_mesa_main_context.c:1.1
--- /dev/null Wed Aug 21 13:35:29 2019
+++ pkgsrc/graphics/MesaLib11/patches/patch-src_mesa_main_context.c Wed Aug 21 13:35:29 2019
@@ -0,0 +1,41 @@
+$NetBSD: patch-src_mesa_main_context.c,v 1.1 2019/08/21 13:35:29 nia Exp $
+
+* Fix exit time segfault of qt5 application with modular xorg
+
+--- src/mesa/main/context.c.orig 2015-09-11 17:41:47.000000000 +0000
++++ src/mesa/main/context.c
+@@ -350,11 +350,14 @@ mtx_t OneTimeLock = _MTX_INITIALIZER_NP;
+ * Calls all the various one-time-fini functions in Mesa
+ */
+
+-static void
++static GLbitfield api_init_mask = 0x0;
++static void __attribute__((__destructor__))
+ one_time_fini(void)
+ {
+- _mesa_destroy_shader_compiler();
+- _mesa_locale_fini();
++ if (api_init_mask) {
++ _mesa_destroy_shader_compiler();
++ _mesa_locale_fini();
++ }
+ }
+
+ /**
+@@ -369,7 +372,6 @@ one_time_fini(void)
+ static void
+ one_time_init( struct gl_context *ctx )
+ {
+- static GLbitfield api_init_mask = 0x0;
+
+ mtx_lock(&OneTimeLock);
+
+@@ -394,8 +396,6 @@ one_time_init( struct gl_context *ctx )
+ _mesa_ubyte_to_float_color_tab[i] = (float) i / 255.0F;
+ }
+
+- atexit(one_time_fini);
+-
+ #if defined(DEBUG) && defined(__DATE__) && defined(__TIME__)
+ if (MESA_VERBOSE != 0) {
+ _mesa_debug(ctx, "Mesa %s DEBUG build %s %s\n",
Index: pkgsrc/graphics/MesaLib11/patches/patch-src_mesa_main_extensions.c
diff -u /dev/null pkgsrc/graphics/MesaLib11/patches/patch-src_mesa_main_extensions.c:1.1
--- /dev/null Wed Aug 21 13:35:29 2019
+++ pkgsrc/graphics/MesaLib11/patches/patch-src_mesa_main_extensions.c Wed Aug 21 13:35:29 2019
@@ -0,0 +1,24 @@
+$NetBSD: patch-src_mesa_main_extensions.c,v 1.1 2019/08/21 13:35:29 nia Exp $
+
+atexit() is not a good idea in shared libraries.
+
+--- src/mesa/main/extensions.c.orig 2016-01-07 16:17:53.000000000 +0000
++++ src/mesa/main/extensions.c
+@@ -256,7 +256,7 @@ get_extension_override( struct gl_contex
+ * These strings are allocated early during the first context creation by
+ * _mesa_one_time_init_extension_overrides.
+ */
+-static void
++static void __attribute__((__destructor__))
+ free_unknown_extensions_strings(void)
+ {
+ free(extra_extensions);
+@@ -277,7 +277,7 @@ _mesa_one_time_init_extension_overrides(
+ int len;
+ size_t offset;
+
+- atexit(free_unknown_extensions_strings);
++ /* atexit(free_unknown_extensions_strings); */
+
+ memset(&_mesa_extension_override_enables, 0, sizeof(struct gl_extensions));
+ memset(&_mesa_extension_override_disables, 0, sizeof(struct gl_extensions));
Index: pkgsrc/graphics/MesaLib11/patches/patch-src_mesa_main_macros.h
diff -u /dev/null pkgsrc/graphics/MesaLib11/patches/patch-src_mesa_main_macros.h:1.1
--- /dev/null Wed Aug 21 13:35:29 2019
+++ pkgsrc/graphics/MesaLib11/patches/patch-src_mesa_main_macros.h Wed Aug 21 13:35:29 2019
@@ -0,0 +1,16 @@
+$NetBSD: patch-src_mesa_main_macros.h,v 1.1 2019/08/21 13:35:29 nia Exp $
+
+ALIGN is also defined in sys/param.h on NetBSD.
+
+--- src/mesa/main/macros.h.orig 2015-12-09 16:10:13.000000000 +0000
++++ src/mesa/main/macros.h
+@@ -690,6 +690,9 @@ minify(unsigned value, unsigned levels)
+ *
+ * \sa ROUND_DOWN_TO()
+ */
++#if defined(__NetBSD__)
++#undef ALIGN
++#endif
+ static inline uintptr_t
+ ALIGN(uintptr_t value, int32_t alignment)
+ {
Index: pkgsrc/graphics/MesaLib11/patches/patch-src_mesa_main_shader__query.cpp
diff -u /dev/null pkgsrc/graphics/MesaLib11/patches/patch-src_mesa_main_shader__query.cpp:1.1
--- /dev/null Wed Aug 21 13:35:29 2019
+++ pkgsrc/graphics/MesaLib11/patches/patch-src_mesa_main_shader__query.cpp Wed Aug 21 13:35:29 2019
@@ -0,0 +1,48 @@
+$NetBSD: patch-src_mesa_main_shader__query.cpp,v 1.1 2019/08/21 13:35:29 nia Exp $
+
+https://bugs.freedesktop.org/show_bug.cgi?id=66346
+
+From c4a1fec68d2508ff0c4fc2831465aca8c4ca783a Mon Sep 17 00:00:00 2001
+From: Julien Isorce <j.isorce%samsung.com@localhost>
+Date: Wed, 22 Apr 2015 23:04:42 +0100
+Subject: [PATCH 1/2] shader_query: convert GLhandleARB to uintptr_t before
+ troncating to GLuint
+
+Fixes compiler error on OSX as GLhandleARB is defined as void* if __APPLE__.
+
+https://bugs.freedesktop.org/show_bug.cgi?id=66346
+---
+ src/mesa/main/shader_query.cpp | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/src/mesa/main/shader_query.cpp b/src/mesa/main/shader_query.cpp
+index bc6fec5..22d9e0f 100644
+--- src/mesa/main/shader_query.cpp
++++ src/mesa/main/shader_query.cpp
+@@ -68,7 +68,7 @@ _mesa_BindAttribLocation(GLhandleARB program, GLuint index,
+ GET_CURRENT_CONTEXT(ctx);
+
+ struct gl_shader_program *const shProg =
+- _mesa_lookup_shader_program_err(ctx, program, "glBindAttribLocation");
++ _mesa_lookup_shader_program_err(ctx, (GLuint)(uintptr_t)program, "glBindAttribLocation");
+ if (!shProg)
+ return;
+
+@@ -136,7 +136,7 @@ _mesa_GetActiveAttrib(GLhandleARB program, GLuint desired_index,
+ return;
+ }
+
+- shProg = _mesa_lookup_shader_program_err(ctx, program, "glGetActiveAttrib");
++ shProg = _mesa_lookup_shader_program_err(ctx, (GLuint)(uintptr_t)program, "glGetActiveAttrib");
+ if (!shProg)
+ return;
+
+@@ -250,7 +250,7 @@ _mesa_GetAttribLocation(GLhandleARB program, const GLcharARB * name)
+ {
+ GET_CURRENT_CONTEXT(ctx);
+ struct gl_shader_program *const shProg =
+- _mesa_lookup_shader_program_err(ctx, program, "glGetAttribLocation");
++ _mesa_lookup_shader_program_err(ctx, (GLuint)(uintptr_t)program, "glGetAttribLocation");
+
+ if (!shProg) {
+ return -1;
Index: pkgsrc/graphics/MesaLib11/patches/patch-src_mesa_tnl_t__pipeline.c
diff -u /dev/null pkgsrc/graphics/MesaLib11/patches/patch-src_mesa_tnl_t__pipeline.c:1.1
--- /dev/null Wed Aug 21 13:35:29 2019
+++ pkgsrc/graphics/MesaLib11/patches/patch-src_mesa_tnl_t__pipeline.c Wed Aug 21 13:35:29 2019
@@ -0,0 +1,20 @@
+$NetBSD: patch-src_mesa_tnl_t__pipeline.c,v 1.1 2019/08/21 13:35:29 nia Exp $
+
+i386 FPU control word defaults.
+
+--- src/mesa/tnl/t_pipeline.c.orig 2015-09-09 17:55:36.000000000 +0000
++++ src/mesa/tnl/t_pipeline.c
+@@ -132,7 +132,13 @@ static GLuint check_output_changes( stru
+ /* Hardware default: All exceptions masked, extended double precision,
+ * round to nearest (IEEE compliant):
+ */
++#if defined(__NetBSD__)
++#define DEFAULT_X86_FPU 0x127f /* __NetBSD_NPXCW__ */
++#elif defined(__FreeBSD__)
++#define DEFAULT_X86_FPU 0x1272 /* __FreeBSD_NPXCW__ */
++#else
+ #define DEFAULT_X86_FPU 0x037f
++#endif
+ /* All exceptions masked, single precision, round to nearest:
+ */
+ #define FAST_X86_FPU 0x003f
Index: pkgsrc/graphics/MesaLib11/patches/patch-src_mesa_x86_common__x86.c
diff -u /dev/null pkgsrc/graphics/MesaLib11/patches/patch-src_mesa_x86_common__x86.c:1.1
--- /dev/null Wed Aug 21 13:35:29 2019
+++ pkgsrc/graphics/MesaLib11/patches/patch-src_mesa_x86_common__x86.c Wed Aug 21 13:35:29 2019
@@ -0,0 +1,24 @@
+$NetBSD: patch-src_mesa_x86_common__x86.c,v 1.1 2019/08/21 13:35:29 nia Exp $
+
+DragonFly support.
+
+--- src/mesa/x86/common_x86.c.orig 2015-07-14 18:10:47.000000000 +0000
++++ src/mesa/x86/common_x86.c
+@@ -38,7 +38,7 @@
+ #if defined(USE_SSE_ASM) && defined(__linux__)
+ #include <linux/version.h>
+ #endif
+-#if defined(USE_SSE_ASM) && defined(__FreeBSD__)
++#if defined(USE_SSE_ASM) && (defined(__FreeBSD__) || defined(__DragonFly__))
+ #include <sys/types.h>
+ #include <sys/sysctl.h>
+ #endif
+@@ -128,7 +128,7 @@ static LONG WINAPI ExceptionFilter(LPEXC
+ */
+ void _mesa_check_os_sse_support( void )
+ {
+-#if defined(__FreeBSD__)
++#if defined(__FreeBSD__) || defined(__DragonFly__)
+ {
+ int ret, enabled;
+ unsigned int len;
Index: pkgsrc/graphics/MesaLib11/patches/patch-src_util_strndup.c
diff -u /dev/null pkgsrc/graphics/MesaLib11/patches/patch-src_util_strndup.c:1.1
--- /dev/null Wed Aug 21 13:35:29 2019
+++ pkgsrc/graphics/MesaLib11/patches/patch-src_util_strndup.c Wed Aug 21 13:35:29 2019
@@ -0,0 +1,30 @@
+$NetBSD: patch-src_util_strndup.c,v 1.1 2019/08/21 13:35:29 nia Exp $
+
+Provide compat strndup for older Darwin.
+
+--- src/util/strndup.c.orig 2016-01-22 15:44:31.000000000 +0000
++++ src/util/strndup.c
+@@ -21,7 +21,7 @@
+ * IN THE SOFTWARE.
+ */
+
+-#if defined(_WIN32)
++#if defined(_WIN32) || (defined(__APPLE__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__-0 < 1070)
+ #include <stdlib.h>
+ #include <string.h>
+ #include "strndup.h"
+@@ -35,7 +35,14 @@ strndup(const char *str, size_t max)
+ if (!str)
+ return NULL;
+
++#if defined(__APPLE__)
++ for (n = 0; n < max; n++, str++) {
++ if (!*str)
++ break;
++ }
++#else
+ n = strnlen(str, max);
++#endif
+ ptr = (char *) calloc(n + 1, sizeof(char));
+ if (!ptr)
+ return NULL;
Index: pkgsrc/graphics/MesaLib11/patches/patch-src_util_strndup.h
diff -u /dev/null pkgsrc/graphics/MesaLib11/patches/patch-src_util_strndup.h:1.1
--- /dev/null Wed Aug 21 13:35:29 2019
+++ pkgsrc/graphics/MesaLib11/patches/patch-src_util_strndup.h Wed Aug 21 13:35:29 2019
@@ -0,0 +1,15 @@
+$NetBSD: patch-src_util_strndup.h,v 1.1 2019/08/21 13:35:29 nia Exp $
+
+Provide compat strndup for older Darwin.
+
+--- src/util/strndup.h.orig 2016-01-22 15:44:31.000000000 +0000
++++ src/util/strndup.h
+@@ -25,7 +25,7 @@
+
+ #include <stdlib.h> // size_t
+
+-#if defined(_WIN32)
++#if defined(_WIN32) || (defined(__APPLE__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__-0 < 1070)
+
+ #ifdef __cplusplus
+ extern "C" {
Index: pkgsrc/graphics/MesaLib11/patches/patch-src_util_u__atomic.h
diff -u /dev/null pkgsrc/graphics/MesaLib11/patches/patch-src_util_u__atomic.h:1.1
--- /dev/null Wed Aug 21 13:35:29 2019
+++ pkgsrc/graphics/MesaLib11/patches/patch-src_util_u__atomic.h Wed Aug 21 13:35:29 2019
@@ -0,0 +1,30 @@
+$NetBSD: patch-src_util_u__atomic.h,v 1.1 2019/08/21 13:35:29 nia Exp $
+
+Fix SunOS atomic macros.
+
+--- src/util/u_atomic.h.orig 2015-03-28 18:20:39.000000000 +0000
++++ src/util/u_atomic.h
+@@ -175,7 +175,7 @@ char _InterlockedCompareExchange8(char v
+ sizeof(*v) == sizeof(uint16_t) ? atomic_inc_16((uint16_t *)(v)) : \
+ sizeof(*v) == sizeof(uint32_t) ? atomic_inc_32((uint32_t *)(v)) : \
+ sizeof(*v) == sizeof(uint64_t) ? atomic_inc_64((uint64_t *)(v)) : \
+- (assert(!"should not get here"), 0))
++ (assert(!"should not get here"), (void)0))
+
+ #define p_atomic_inc_return(v) ((__typeof(*v)) \
+ sizeof(*v) == sizeof(uint8_t) ? atomic_inc_8_nv ((uint8_t *)(v)) : \
+@@ -184,12 +184,12 @@ char _InterlockedCompareExchange8(char v
+ sizeof(*v) == sizeof(uint64_t) ? atomic_inc_64_nv((uint64_t *)(v)) : \
+ (assert(!"should not get here"), 0))
+
+-#define p_atomic_dec(v) ((void) \
++#define p_atomic_dec(v) (void) (\
+ sizeof(*v) == sizeof(uint8_t) ? atomic_dec_8 ((uint8_t *)(v)) : \
+ sizeof(*v) == sizeof(uint16_t) ? atomic_dec_16((uint16_t *)(v)) : \
+ sizeof(*v) == sizeof(uint32_t) ? atomic_dec_32((uint32_t *)(v)) : \
+ sizeof(*v) == sizeof(uint64_t) ? atomic_dec_64((uint64_t *)(v)) : \
+- (assert(!"should not get here"), 0))
++ (assert(!"should not get here"), (void)0))
+
+ #define p_atomic_dec_return(v) ((__typeof(*v)) \
+ sizeof(*v) == sizeof(uint8_t) ? atomic_dec_8_nv ((uint8_t *)(v)) : \
Home |
Main Index |
Thread Index |
Old Index