pkgsrc-WIP-changes archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
MesaLib-dfbsd: Replace wip/MesaLib 13.0.2 functional Net/Free/DragonFly BSD
Module Name: pkgsrc-wip
Committed By: David Shao <davshao%gmail.com@localhost>
Pushed By: dshao
Date: Tue Jan 17 00:33:46 2017 -0800
Changeset: 8aee418b949cf967e4327ce6f5926192c339d149
Modified Files:
Makefile
Added Files:
MesaLib-dfbsd/DESCR
MesaLib-dfbsd/Makefile
MesaLib-dfbsd/PLIST
MesaLib-dfbsd/TODO
MesaLib-dfbsd/buildlink3.mk
MesaLib-dfbsd/builtin.mk
MesaLib-dfbsd/distinfo
MesaLib-dfbsd/dri.mk
MesaLib-dfbsd/files/patch-manual_fdo90311
MesaLib-dfbsd/options.mk
MesaLib-dfbsd/patches/patch-configure
MesaLib-dfbsd/patches/patch-include_GL_glxext.h
MesaLib-dfbsd/patches/patch-src_compiler_glsl_glsl__parser__extras.cpp
MesaLib-dfbsd/patches/patch-src_egl_drivers_dri2_platform__drm.c
MesaLib-dfbsd/patches/patch-src_egl_drivers_dri2_platform__x11.c
MesaLib-dfbsd/patches/patch-src_egl_main_eglglobals.c
MesaLib-dfbsd/patches/patch-src_gallium_auxiliary_pipe-loader_pipe__loader__drm.c
MesaLib-dfbsd/patches/patch-src_gallium_auxiliary_util_u__format__tests.c
MesaLib-dfbsd/patches/patch-src_gallium_auxiliary_util_u__math.h
MesaLib-dfbsd/patches/patch-src_gallium_auxiliary_util_u__network.c
MesaLib-dfbsd/patches/patch-src_gallium_auxiliary_util_u__network.h
MesaLib-dfbsd/patches/patch-src_gallium_drivers_nouveau_codegen_nv50__ir__peephole.cpp
MesaLib-dfbsd/patches/patch-src_gallium_drivers_nouveau_nouveau__vp3__video.c
MesaLib-dfbsd/patches/patch-src_gallium_drivers_nouveau_nv50_nv84__video.c
MesaLib-dfbsd/patches/patch-src_gallium_state__trackers_clover_llvm_invocation.cpp
MesaLib-dfbsd/patches/patch-src_gallium_state__trackers_clover_llvm_metadata.hpp
MesaLib-dfbsd/patches/patch-src_gallium_targets_dri_Makefile.in
MesaLib-dfbsd/patches/patch-src_gallium_winsys_radeon_drm_radeon__drm__winsys.c
MesaLib-dfbsd/patches/patch-src_gallium_winsys_svga_drm_vmw__screen__ioctl.c
MesaLib-dfbsd/patches/patch-src_glsl_ralloc.c
MesaLib-dfbsd/patches/patch-src_glx_apple_apple__glapi.c
MesaLib-dfbsd/patches/patch-src_glx_glxclient.h
MesaLib-dfbsd/patches/patch-src_glx_glxcurrent.c
MesaLib-dfbsd/patches/patch-src_intel_tools_aubinator.c
MesaLib-dfbsd/patches/patch-src_mapi_entry.c
MesaLib-dfbsd/patches/patch-src_mapi_entry__x86-64__tls.h
MesaLib-dfbsd/patches/patch-src_mapi_entry__x86__tls.h
MesaLib-dfbsd/patches/patch-src_mapi_glapi_gen_gl__gentable.py
MesaLib-dfbsd/patches/patch-src_mapi_table.h
MesaLib-dfbsd/patches/patch-src_mapi_u__current.c
MesaLib-dfbsd/patches/patch-src_mapi_u__current.h
MesaLib-dfbsd/patches/patch-src_mesa_drivers_dri_Makefile.in
MesaLib-dfbsd/patches/patch-src_mesa_drivers_dri_common_Makefile.in
MesaLib-dfbsd/patches/patch-src_mesa_drivers_dri_common_xmlconfig.c
MesaLib-dfbsd/patches/patch-src_mesa_drivers_dri_i915_intel__screen.c
MesaLib-dfbsd/patches/patch-src_mesa_drivers_dri_i965_intel__screen.c
MesaLib-dfbsd/patches/patch-src_mesa_drivers_dri_i965_intel__tiled__memcpy.c
MesaLib-dfbsd/patches/patch-src_mesa_drivers_dri_swrast_swrast.c
MesaLib-dfbsd/patches/patch-src_mesa_main_context.c
MesaLib-dfbsd/patches/patch-src_mesa_main_extensions.c
MesaLib-dfbsd/patches/patch-src_mesa_main_macros.h
MesaLib-dfbsd/patches/patch-src_mesa_main_shader__query.cpp
MesaLib-dfbsd/patches/patch-src_mesa_tnl_t__pipeline.c
MesaLib-dfbsd/patches/patch-src_mesa_x86_common__x86.c
MesaLib-dfbsd/patches/patch-src_util_strndup.c
MesaLib-dfbsd/patches/patch-src_util_strndup.h
MesaLib-dfbsd/patches/patch-src_util_u__atomic.h
MesaLib-dfbsd/patches/patch-src_util_u__endian.h
Log Message:
MesaLib-dfbsd: Replace wip/MesaLib 13.0.2 functional Net/Free/DragonFly BSD
Functional mesa 13.0.2 for Net/Free/DragonFly BSD
using changes discussed in pkg/51796
(graphics/MesaLib Update to 13.0.2 with glamor / egl somewhat working)
Requires libdrm-dfbsd.
Removes now unneeded FreeBSD DragonFly libdevq dependence.
Adds dependence on libpthread-stubs-dfbsd.
To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=8aee418b949cf967e4327ce6f5926192c339d149
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
diffstat:
Makefile | 1 +
MesaLib-dfbsd/DESCR | 5 +
MesaLib-dfbsd/Makefile | 109 ++
MesaLib-dfbsd/PLIST | 67 +
MesaLib-dfbsd/TODO | 8 +
MesaLib-dfbsd/buildlink3.mk | 52 +
MesaLib-dfbsd/builtin.mk | 87 ++
MesaLib-dfbsd/distinfo | 54 +
MesaLib-dfbsd/dri.mk | 41 +
MesaLib-dfbsd/files/patch-manual_fdo90311 | 111 ++
MesaLib-dfbsd/options.mk | 233 +++
MesaLib-dfbsd/patches/patch-configure | 35 +
MesaLib-dfbsd/patches/patch-include_GL_glxext.h | 17 +
...atch-src_compiler_glsl_glsl__parser__extras.cpp | 15 +
.../patch-src_egl_drivers_dri2_platform__drm.c | 16 +
.../patch-src_egl_drivers_dri2_platform__x11.c | 30 +
.../patches/patch-src_egl_main_eglglobals.c | 40 +
...llium_auxiliary_pipe-loader_pipe__loader__drm.c | 125 ++
...h-src_gallium_auxiliary_util_u__format__tests.c | 17 +
.../patch-src_gallium_auxiliary_util_u__math.h | 31 +
.../patch-src_gallium_auxiliary_util_u__network.c | 33 +
.../patch-src_gallium_auxiliary_util_u__network.h | 15 +
..._drivers_nouveau_codegen_nv50__ir__peephole.cpp | 25 +
...c_gallium_drivers_nouveau_nouveau__vp3__video.c | 18 +
...-src_gallium_drivers_nouveau_nv50_nv84__video.c | 18 +
...lium_state__trackers_clover_llvm_invocation.cpp | 37 +
...allium_state__trackers_clover_llvm_metadata.hpp | 19 +
.../patch-src_gallium_targets_dri_Makefile.in | 15 +
...gallium_winsys_radeon_drm_radeon__drm__winsys.c | 18 +
...rc_gallium_winsys_svga_drm_vmw__screen__ioctl.c | 32 +
MesaLib-dfbsd/patches/patch-src_glsl_ralloc.c | 39 +
.../patches/patch-src_glx_apple_apple__glapi.c | 24 +
MesaLib-dfbsd/patches/patch-src_glx_glxclient.h | 19 +
MesaLib-dfbsd/patches/patch-src_glx_glxcurrent.c | 40 +
.../patches/patch-src_intel_tools_aubinator.c | 24 +
MesaLib-dfbsd/patches/patch-src_mapi_entry.c | 1620 ++++++++++++++++++++
.../patches/patch-src_mapi_entry__x86-64__tls.h | 32 +
.../patches/patch-src_mapi_entry__x86__tls.h | 40 +
.../patch-src_mapi_glapi_gen_gl__gentable.py | 15 +
MesaLib-dfbsd/patches/patch-src_mapi_table.h | 15 +
MesaLib-dfbsd/patches/patch-src_mapi_u__current.c | 31 +
MesaLib-dfbsd/patches/patch-src_mapi_u__current.h | 16 +
.../patches/patch-src_mesa_drivers_dri_Makefile.in | 15 +
.../patch-src_mesa_drivers_dri_common_Makefile.in | 16 +
.../patch-src_mesa_drivers_dri_common_xmlconfig.c | 59 +
...patch-src_mesa_drivers_dri_i915_intel__screen.c | 39 +
...patch-src_mesa_drivers_dri_i965_intel__screen.c | 39 +
...rc_mesa_drivers_dri_i965_intel__tiled__memcpy.c | 20 +
.../patch-src_mesa_drivers_dri_swrast_swrast.c | 19 +
.../patches/patch-src_mesa_main_context.c | 41 +
.../patches/patch-src_mesa_main_extensions.c | 24 +
MesaLib-dfbsd/patches/patch-src_mesa_main_macros.h | 16 +
.../patches/patch-src_mesa_main_shader__query.cpp | 58 +
.../patches/patch-src_mesa_tnl_t__pipeline.c | 20 +
.../patches/patch-src_mesa_x86_common__x86.c | 24 +
MesaLib-dfbsd/patches/patch-src_util_strndup.c | 30 +
MesaLib-dfbsd/patches/patch-src_util_strndup.h | 15 +
MesaLib-dfbsd/patches/patch-src_util_u__atomic.h | 30 +
MesaLib-dfbsd/patches/patch-src_util_u__endian.h | 16 +
59 files changed, 3720 insertions(+)
diffs:
diff --git a/Makefile b/Makefile
index 07e71a2..951a371 100644
--- a/Makefile
+++ b/Makefile
@@ -19,6 +19,7 @@ SUBDIR+= GoogleEarth
SUBDIR+= I2util
SUBDIR+= LabPlot
SUBDIR+= MesaLib
+SUBDIR+= MesaLib-dfbsd
SUBDIR+= MoleInvasion
SUBDIR+= OpenBLAS
SUBDIR+= OpenGLUT
diff --git a/MesaLib-dfbsd/DESCR b/MesaLib-dfbsd/DESCR
new file mode 100644
index 0000000..8a8cccf
--- /dev/null
+++ b/MesaLib-dfbsd/DESCR
@@ -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.
diff --git a/MesaLib-dfbsd/Makefile b/MesaLib-dfbsd/Makefile
new file mode 100644
index 0000000..9f8c00f
--- /dev/null
+++ b/MesaLib-dfbsd/Makefile
@@ -0,0 +1,109 @@
+# $NetBSD: Makefile,v 1.129 2016/10/20 12:06:06 wiz Exp $
+
+DISTNAME= mesa-13.0.2
+PKGNAME= ${DISTNAME:S/mesa/MesaLib/}
+CATEGORIES= graphics x11
+MASTER_SITES= ftp://ftp.freedesktop.org/pub/mesa/${PKGVERSION_NOREV}/
+EXTRACT_SUFX= .tar.xz
+
+MAINTAINER= pkgsrc-users%NetBSD.org@localhost
+HOMEPAGE= http://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
+
+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_FILES.wrapper-bug+= src/mesa/drivers/osmesa/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'
+
+.include "../../mk/bsd.prefs.mk"
+.include "../../mk/compiler.mk"
+.include "options.mk"
+
+.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= 34 35 36 # 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"
+
+# On NetBSD < 6 we need to compile with GCC from pkgsrc.
+# But GCC from pkgsrc does not add implicit -lc like base GCC does,
+# which breaks the build with -Wl,--no-undefined.
+# So we piggy back on -lpthread and inject -lc after it.
+.if !empty(MACHINE_PLATFORM:MNetBSD-[1-5].*-*)
+BUILDLINK_TRANSFORM+= l:pthread:pthread:c l:m:m:c
+.endif
+
+# 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 "../../devel/libpthread-stubs/buildlink3.mk"
+.include "../../x11/libX11/buildlink3.mk"
+.include "../../x11/libXext/buildlink3.mk"
+.include "../../x11/libxcb/buildlink3.mk"
+.include "../../mk/bsd.pkg.mk"
diff --git a/MesaLib-dfbsd/PLIST b/MesaLib-dfbsd/PLIST
new file mode 100644
index 0000000..f38e673
--- /dev/null
+++ b/MesaLib-dfbsd/PLIST
@@ -0,0 +1,67 @@
+@comment $NetBSD: PLIST,v 1.33 2016/02/23 14:40:36 tnn 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.osmesa}include/GL/osmesa.h
+${PLIST.dri}include/GL/internal/dri_interface.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/gl32.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.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.osmesa}lib/libOSMesa.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
+${PLIST.osmesa}lib/pkgconfig/osmesa.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
+share/examples/MesaLib/drirc
diff --git a/MesaLib-dfbsd/TODO b/MesaLib-dfbsd/TODO
new file mode 100644
index 0000000..c390cbc
--- /dev/null
+++ b/MesaLib-dfbsd/TODO
@@ -0,0 +1,8 @@
+Copy port to graphics/MesaLib, do not install from wip.
+
+fix bitrot that broke GLX TLS on NetBSD, replace hack
+see if libLLVM 3.9 on FreeBSD can build nouveau
+test OSX quartz, check if bug 90311 patch needs regen
+test Solaris
+test Linux
+test NetBSD 7
diff --git a/MesaLib-dfbsd/buildlink3.mk b/MesaLib-dfbsd/buildlink3.mk
new file mode 100644
index 0000000..065162d
--- /dev/null
+++ b/MesaLib-dfbsd/buildlink3.mk
@@ -0,0 +1,52 @@
+# $NetBSD: buildlink3.mk,v 1.54 2015/09/27 21:58:03 tnn 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>=13
+# 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) || \
+ ${X11_TYPE} == "native" && exists(${X11BASE}/include/EGL/egl.h)
+MESALIB_SUPPORTS_EGL= yes
+.else
+MESALIB_SUPPORTS_EGL= no
+.endif
+
+.include "../../x11/libXext/buildlink3.mk"
+.if ${X11_TYPE} == "modular"
+.include "../../devel/libpthread-stubs/buildlink3.mk"
+.endif
+
+.endif # MESALIB_BUILDLINK3_MK
+
+BUILDLINK_TREE+= -MesaLib
diff --git a/MesaLib-dfbsd/builtin.mk b/MesaLib-dfbsd/builtin.mk
new file mode 100644
index 0000000..1e7d558
--- /dev/null
+++ b/MesaLib-dfbsd/builtin.mk
@@ -0,0 +1,87 @@
+# $NetBSD: builtin.mk,v 1.20 2014/03/22 08:19:24 jperkin 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:Q}; 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
diff --git a/MesaLib-dfbsd/distinfo b/MesaLib-dfbsd/distinfo
new file mode 100644
index 0000000..1bebb5b
--- /dev/null
+++ b/MesaLib-dfbsd/distinfo
@@ -0,0 +1,54 @@
+$NetBSD: distinfo,v 1.117 2016/05/18 12:55:28 wiz Exp $
+
+SHA1 (mesa-13.0.2.tar.xz) = 457331f16b229e02594477307604b0a92a155fd2
+RMD160 (mesa-13.0.2.tar.xz) = 107d2b33f5199bf14a61775c01ddaa2556b4b9dd
+SHA512 (mesa-13.0.2.tar.xz) = e4e2b9d685910f9b1d70958c50f54d059263623865571a92c3aa185914f4f7aa745d74afc9706b64ecd1f8d04c603ad03a78365d976382e2664284dc6a8351be
+Size (mesa-13.0.2.tar.xz) = 9159100 bytes
+SHA1 (patch-configure) = 71d621a23e895d828ef3be348df44574d6c8e2fe
+SHA1 (patch-include_GL_glxext.h) = 830902f2d38a8395cda682c059fc5223e1b0e89e
+SHA1 (patch-src_compiler_glsl_glsl__parser__extras.cpp) = c5046ce848d0b1ea428e29611b6822d4f4ab970d
+SHA1 (patch-src_egl_drivers_dri2_platform__drm.c) = 75144a5c2cbcda3f7ccd708ff2ac03c823c045d7
+SHA1 (patch-src_egl_drivers_dri2_platform__x11.c) = 04b6ef8e755f226fbe3e6f2bea6c9e2a56a783ca
+SHA1 (patch-src_egl_main_eglglobals.c) = 194954826564d1053544a88c771019faf4d07df2
+SHA1 (patch-src_gallium_auxiliary_pipe-loader_pipe__loader__drm.c) = e190c9bc287b2f81ce13e641980fed3ec0ecfacb
+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_nouveau_codegen_nv50__ir__peephole.cpp) = 5fc2ef7eafac3006896af96bac8176c79b17cfdc
+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_state__trackers_clover_llvm_invocation.cpp) = f283ec2fa88bf3a542343db7205ff63d9b5c871f
+SHA1 (patch-src_gallium_state__trackers_clover_llvm_metadata.hpp) = 21973190b9b9521c2c4df20a1982ca4da3c8e90b
+SHA1 (patch-src_gallium_targets_dri_Makefile.in) = a9a8265d97297040a3e3260b362ca920ec852280
+SHA1 (patch-src_gallium_winsys_radeon_drm_radeon__drm__winsys.c) = 94e05c38ab2a8d2bcc25dd477cbd1fd5d681182a
+SHA1 (patch-src_gallium_winsys_svga_drm_vmw__screen__ioctl.c) = e4b891e8b4ebe5b8e8c7b8c2c1dbed11b9c417df
+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_intel_tools_aubinator.c) = 4437e19acab1de56f7335378f210a0d415c71478
+SHA1 (patch-src_mapi_entry.c) = b0af9f644ed5be023010b44981827bfce5986d79
+SHA1 (patch-src_mapi_entry__x86-64__tls.h) = 7653433abf2a1f972beebd20bab43f02db9a9ebf
+SHA1 (patch-src_mapi_entry__x86__tls.h) = a763f1f1a5e4eb458f7a654266e53e6470d3a882
+SHA1 (patch-src_mapi_glapi_gen_gl__gentable.py) = 53026e520a510e54494760a3fa05af6f15dfb9d8
+SHA1 (patch-src_mapi_table.h) = 272d00c45f742303a5ff84da82c1cd585846d6e1
+SHA1 (patch-src_mapi_u__current.c) = 1731375d82119be326b35d141d7879e083d6d620
+SHA1 (patch-src_mapi_u__current.h) = 214dd29cb0c4fe127eb1157b04b12ddfc455b4b0
+SHA1 (patch-src_mesa_drivers_dri_Makefile.in) = 2fb1471045ae88eaa4fca162bf86330b833167fd
+SHA1 (patch-src_mesa_drivers_dri_common_Makefile.in) = 5e160f7d92c2e9f3fa36e52a082a496af67e634e
+SHA1 (patch-src_mesa_drivers_dri_common_xmlconfig.c) = ad6f459e6df955c6a06cde7e03de7d0324b0281f
+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_i965_intel__tiled__memcpy.c) = c0d465fb65939ead71c9d02b6f6793824dbf441d
+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) = 3f9c31645d87855759def11344dee16af23c7be3
+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_util_u__endian.h) = 1ab4cea9eabac5c2d967138f082c57b6c7d524c4
diff --git a/MesaLib-dfbsd/dri.mk b/MesaLib-dfbsd/dri.mk
new file mode 100644
index 0000000..d0f7b90
--- /dev/null
+++ b/MesaLib-dfbsd/dri.mk
@@ -0,0 +1,41 @@
+# $NetBSD: dri.mk,v 1.16 2016/03/10 05:29:56 tnn 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])
+BUILDLINK_API_DEPENDS.dri2proto+= dri2proto>=2.1
+BUILDLINK_API_DEPENDS.glproto+= glproto>=1.4.11
+. 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/dri2proto/buildlink3.mk"
+# XXX these do not have builtin.mk
+. if ${X11_TYPE} == "modular"
+. include "../../x11/dri3proto/buildlink3.mk"
+. include "../../x11/libxshmfence/buildlink3.mk"
+. include "../../x11/presentproto/buildlink3.mk"
+. endif
+. include "../../x11/glproto/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
+. include "../../x11/xf86driproto/buildlink3.mk"
+. include "../../x11/xf86vidmodeproto/buildlink3.mk"
+.endif
diff --git a/MesaLib-dfbsd/files/patch-manual_fdo90311 b/MesaLib-dfbsd/files/patch-manual_fdo90311
new file mode 100644
index 0000000..845ab87
--- /dev/null
+++ b/MesaLib-dfbsd/files/patch-manual_fdo90311
@@ -0,0 +1,111 @@
+$NetBSD: patch-manual_fdo90311,v 1.2 2016/01/18 17:59:01 jperkin 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
+
diff --git a/MesaLib-dfbsd/options.mk b/MesaLib-dfbsd/options.mk
new file mode 100644
index 0000000..3a55587
--- /dev/null
+++ b/MesaLib-dfbsd/options.mk
@@ -0,0 +1,233 @@
+# $NetBSD: options.mk,v 1.49 2016/02/25 13:37:46 jperkin Exp $
+
+PKG_OPTIONS_VAR= PKG_OPTIONS.MesaLib
+PKG_SUPPORTED_OPTIONS= llvm dri
+PKG_SUPPORTED_OPTIONS+= glamor debug xvmc
+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 \
+ !empty(MACHINE_PLATFORM:MNetBSD-[789].*-i386) || \
+ !empty(MACHINE_PLATFORM:MNetBSD-[789].*-x86_64) || \
+ !empty(MACHINE_PLATFORM:MNetBSD-[789].*-sparc64) || \
+ !empty(MACHINE_PLATFORM:MNetBSD-[789].*-*arm*)
+PKG_SUGGESTED_OPTIONS+= llvm
+.endif
+
+.if (!empty(MACHINE_PLATFORM:MLinux-*-i386) || \
+ !empty(MACHINE_PLATFORM:MLinux-*-x86_64)) && \
+ (!empty(CC_VERSION:Mgcc-4.[89].*) || \
+ !empty(CC_VERSION:Mgcc-[56].*))
+PKG_SUGGESTED_OPTIONS+= llvm
+.endif
+
+.if ${OPSYS} == "FreeBSD" || ${OPSYS} == "OpenBSD" || \
+ ${OPSYS} == "DragonFly" || ${OPSYS} == "Linux" || \
+ ${OPSYS} == "SunOS" || ${OPSYS} == "NetBSD" || \
+ ${OPSYS} == "Darwin"
+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 wayland xatracker osmesa xvmc
+
+.if !empty(PKG_OPTIONS:Mdri)
+
+CONFIGURE_ARGS+= --enable-dri
+CONFIGURE_ARGS+= --enable-egl
+.if ${OPSYS} != "Darwin"
+.if ${OPSYS} != "DragonFly" && ${OPSYS} != "NetBSD"
+CFLAGS+= -DHAVE_DRI3
+CONFIGURE_ARGS+= --enable-dri3
+.endif
+CONFIGURE_ARGS+= --enable-gbm
+PLIST.gbm= yes
+.endif
+CONFIGURE_ARGS+= --enable-texture-float
+CONFIGURE_ARGS+= --enable-osmesa
+PLIST.osmesa= yes
+CONFIGURE_ARGS+= --enable-gles1
+CONFIGURE_ARGS+= --enable-gles2
+
+# Use Thread Local Storage in GLX where it is supported by Mesa and works.
+# XXX Fixme
+.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+= glamor
+.endif
+
+.if !empty(PKG_OPTIONS:Mglamor)
+# Recommended by
+# http://www.freedesktop.org/wiki/Software/Glamor/
+
+CONFIGURE_ARGS+= --enable-glx-tls
+
+.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
+
+# 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, but don't build on ARM
+.if ${OPSYS} != "Darwin" && empty(MACHINE_PLATFORM:MNetBSD-*-*arm*)
+
+# AMD Radeon r600
+PLIST.r600= yes
+GALLIUM_DRIVERS+= r600
+
+.if ${OPSYS} != "FreeBSD" || empty(OS_VERSION:M12.*)
+# 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
+
+.if ${OPSYS} != "FreeBSD" || empty(OS_VERSION:M12.*)
+# 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)
+# 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-llvm-shared-libs
+# CONFIGURE_ARGS+= --enable-r600-llvm-compiler
+.include "../../devel/libelf/buildlink3.mk"
+CPPFLAGS+= -I${BUILDLINK_PREFIX.libelf}/include/libelf
+.include "../../lang/libLLVM/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-llvm-shared-libs
+# 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 # dri
+
+.if !empty(PKG_OPTIONS:Mdebug)
+CONFIGURE_ARGS+= --enable-debug
+.endif
+
+.if !empty(PKG_OPTIONS:Mxvmc)
+.include "../../x11/libXvMC/buildlink3.mk"
+PLIST.xvmc= yes
+.endif
diff --git a/MesaLib-dfbsd/patches/patch-configure b/MesaLib-dfbsd/patches/patch-configure
new file mode 100644
index 0000000..2903cd9
--- /dev/null
+++ b/MesaLib-dfbsd/patches/patch-configure
@@ -0,0 +1,35 @@
+$NetBSD$
+
+--- configure.orig 2016-11-28 15:16:01.000000000 +0000
++++ configure
+@@ -24711,7 +24711,7 @@ if test -n "$with_vulkan_drivers"; then
+ if test "x$HAVE_I965_DRI" != xyes; then
+ as_fn_error $? "Intel Vulkan driver requires the i965 dri driver" "$LINENO" 5
+ fi
+- if test "x$with_sha1" == "x"; then
++ if test "x$with_sha1" = "x"; then
+ as_fn_error $? "Intel Vulkan driver requires SHA1" "$LINENO" 5
+ fi
+ HAVE_INTEL_VULKAN=yes;
+@@ -24810,7 +24810,7 @@ $as_echo "yes" >&6; }
+
+ fi
+ HAVE_RADEON_VULKAN=yes;
+- if test "x$with_sha1" == "x"; then
++ if test "x$with_sha1" = "x"; then
+ as_fn_error $? "radv vulkan driver requires SHA1" "$LINENO" 5
+ fi
+ ;;
+@@ -26375,9 +26375,9 @@ fi
+ strip_unwanted_llvm_flags() {
+ # Use \> (marks the end of the word)
+ echo `$1` | sed \
+- -e 's/-march=\S*//g' \
+- -e 's/-mtune=\S*//g' \
+- -e 's/-mcpu=\S*//g' \
++ -e 's/-march=[-a-zA-Z0-9]*//g' \
++ -e 's/-mtune=[-a-zA-Z0-9]*//g' \
++ -e 's/-mcpu=[-a-zA-Z0-9]*//g' \
+ -e 's/-DNDEBUG\>//g' \
+ -e 's/-D_GNU_SOURCE\>//g' \
+ -e 's/-pedantic\>//g' \
diff --git a/MesaLib-dfbsd/patches/patch-include_GL_glxext.h b/MesaLib-dfbsd/patches/patch-include_GL_glxext.h
new file mode 100644
index 0000000..876b16d
--- /dev/null
+++ b/MesaLib-dfbsd/patches/patch-include_GL_glxext.h
@@ -0,0 +1,17 @@
+$NetBSD: patch-include_GL_glxext.h,v 1.1 2015/04/25 11:19:18 tnn 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
diff --git a/MesaLib-dfbsd/patches/patch-src_compiler_glsl_glsl__parser__extras.cpp b/MesaLib-dfbsd/patches/patch-src_compiler_glsl_glsl__parser__extras.cpp
new file mode 100644
index 0000000..d912e19
--- /dev/null
+++ b/MesaLib-dfbsd/patches/patch-src_compiler_glsl_glsl__parser__extras.cpp
@@ -0,0 +1,15 @@
+$NetBSD: patch-src_compiler_glsl_glsl__parser__extras.cpp,v 1.1 2016/04/17 00:03:00 wiz Exp $
+
+atexit() is not a good idea in a library; use destructor attribute.
+
+--- src/compiler/glsl/glsl_parser_extras.cpp.orig 2016-04-04 10:24:28.000000000 +0000
++++ src/compiler/glsl/glsl_parser_extras.cpp
+@@ -1938,7 +1938,7 @@ extern "C" {
+ * programs would be invalid. So this should happen at approximately
+ * program exit.
+ */
+-void
++void __attribute__((__destructor__))
+ _mesa_destroy_shader_compiler(void)
+ {
+ _mesa_destroy_shader_compiler_caches();
diff --git a/MesaLib-dfbsd/patches/patch-src_egl_drivers_dri2_platform__drm.c b/MesaLib-dfbsd/patches/patch-src_egl_drivers_dri2_platform__drm.c
new file mode 100644
index 0000000..c5ccec6
--- /dev/null
+++ b/MesaLib-dfbsd/patches/patch-src_egl_drivers_dri2_platform__drm.c
@@ -0,0 +1,16 @@
+$NetBSD$
+
+netbsd-5 build fix
+
+--- src/egl/drivers/dri2/platform_drm.c.orig 2016-11-10 22:06:40.000000000 +0000
++++ src/egl/drivers/dri2/platform_drm.c
+@@ -683,7 +683,9 @@ dri2_initialize_drm(_EGLDriver *drv, _EG
+ goto cleanup;
+ }
+ } else {
++#ifdef F_DUPFD_CLOEXEC
+ fd = fcntl(gbm_device_get_fd(gbm), F_DUPFD_CLOEXEC, 3);
++#endif
+ if (fd < 0) {
+ err = "DRI2: failed to fcntl() existing gbm device";
+ goto cleanup;
diff --git a/MesaLib-dfbsd/patches/patch-src_egl_drivers_dri2_platform__x11.c b/MesaLib-dfbsd/patches/patch-src_egl_drivers_dri2_platform__x11.c
new file mode 100644
index 0000000..bc38731
--- /dev/null
+++ b/MesaLib-dfbsd/patches/patch-src_egl_drivers_dri2_platform__x11.c
@@ -0,0 +1,30 @@
+$NetBSD: patch-src_egl_drivers_dri2_platform__x11.c,v 1.2 2016/05/18 12:55:28 wiz 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)
+ {
diff --git a/MesaLib-dfbsd/patches/patch-src_egl_main_eglglobals.c b/MesaLib-dfbsd/patches/patch-src_egl_main_eglglobals.c
new file mode 100644
index 0000000..9286f9a
--- /dev/null
+++ b/MesaLib-dfbsd/patches/patch-src_egl_main_eglglobals.c
@@ -0,0 +1,40 @@
+$NetBSD$
+
+atexit() is not a good idea in shared libraries.
+
+--- src/egl/main/eglglobals.c.orig 2016-11-10 22:05:17.000000000 +0000
++++ src/egl/main/eglglobals.c
+@@ -72,11 +72,16 @@ struct _egl_global _eglGlobal =
+ _EGL_DEBUG_BIT_CRITICAL | _EGL_DEBUG_BIT_ERROR, /* debugTypesEnabled */
+ };
+
++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]();
+ }
+@@ -86,14 +91,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;
diff --git a/MesaLib-dfbsd/patches/patch-src_gallium_auxiliary_pipe-loader_pipe__loader__drm.c b/MesaLib-dfbsd/patches/patch-src_gallium_auxiliary_pipe-loader_pipe__loader__drm.c
new file mode 100644
index 0000000..51bb045
--- /dev/null
+++ b/MesaLib-dfbsd/patches/patch-src_gallium_auxiliary_pipe-loader_pipe__loader__drm.c
@@ -0,0 +1,125 @@
+$NetBSD$
+
+From FreeBSD ports / DragonFly dports, email addresses expunged:
+
+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.
+
+--- src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c.orig 2016-11-10 22:05:17.000000000 +0000
++++ src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c
+@@ -214,6 +214,16 @@ pipe_loader_drm_probe_fd(struct pipe_loa
+ return false;
+ }
+
++#if defined(__FreeBSD__) || 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)
+ {
+@@ -226,7 +236,19 @@ open_drm_render_node_minor(int minor)
+ int
+ pipe_loader_drm_probe(struct pipe_loader_device **devs, int ndev)
+ {
++#if defined(__FreeBSD__) || 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++) {
+@@ -241,6 +263,11 @@ pipe_loader_drm_probe(struct pipe_loader
+ continue;
+ }
+
++#if defined(__FreeBSD__) || 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 {
+@@ -250,6 +277,48 @@ pipe_loader_drm_probe(struct pipe_loader
+ j++;
+ }
+
++#if defined(__FreeBSD__) || 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;
+ }
+
diff --git a/MesaLib-dfbsd/patches/patch-src_gallium_auxiliary_util_u__format__tests.c b/MesaLib-dfbsd/patches/patch-src_gallium_auxiliary_util_u__format__tests.c
new file mode 100644
index 0000000..0458cbd
--- /dev/null
+++ b/MesaLib-dfbsd/patches/patch-src_gallium_auxiliary_util_u__format__tests.c
@@ -0,0 +1,17 @@
+$NetBSD: patch-src_gallium_auxiliary_util_u__format__tests.c,v 1.1 2015/04/25 11:19:18 tnn 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"
diff --git a/MesaLib-dfbsd/patches/patch-src_gallium_auxiliary_util_u__math.h b/MesaLib-dfbsd/patches/patch-src_gallium_auxiliary_util_u__math.h
new file mode 100644
index 0000000..0c8b6f7
--- /dev/null
+++ b/MesaLib-dfbsd/patches/patch-src_gallium_auxiliary_util_u__math.h
@@ -0,0 +1,31 @@
+$NetBSD: patch-src_gallium_auxiliary_util_u__math.h,v 1.4 2015/09/26 08:45:02 tnn 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.
diff --git a/MesaLib-dfbsd/patches/patch-src_gallium_auxiliary_util_u__network.c b/MesaLib-dfbsd/patches/patch-src_gallium_auxiliary_util_u__network.c
new file mode 100644
index 0000000..de17091
--- /dev/null
+++ b/MesaLib-dfbsd/patches/patch-src_gallium_auxiliary_util_u__network.c
@@ -0,0 +1,33 @@
+$NetBSD: patch-src_gallium_auxiliary_util_u__network.c,v 1.1 2015/04/25 11:19:18 tnn 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;
diff --git a/MesaLib-dfbsd/patches/patch-src_gallium_auxiliary_util_u__network.h b/MesaLib-dfbsd/patches/patch-src_gallium_auxiliary_util_u__network.h
new file mode 100644
index 0000000..095a244
--- /dev/null
+++ b/MesaLib-dfbsd/patches/patch-src_gallium_auxiliary_util_u__network.h
@@ -0,0 +1,15 @@
+$NetBSD: patch-src_gallium_auxiliary_util_u__network.h,v 1.1 2015/04/25 11:19:18 tnn 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
+
diff --git a/MesaLib-dfbsd/patches/patch-src_gallium_drivers_nouveau_codegen_nv50__ir__peephole.cpp b/MesaLib-dfbsd/patches/patch-src_gallium_drivers_nouveau_codegen_nv50__ir__peephole.cpp
new file mode 100644
index 0000000..4a2b50d
--- /dev/null
+++ b/MesaLib-dfbsd/patches/patch-src_gallium_drivers_nouveau_codegen_nv50__ir__peephole.cpp
@@ -0,0 +1,25 @@
+$NetBSD: patch-src_gallium_drivers_nouveau_codegen_nv50__ir__peephole.cpp,v 1.1 2015/04/25 11:19:18 tnn 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];
diff --git a/MesaLib-dfbsd/patches/patch-src_gallium_drivers_nouveau_nouveau__vp3__video.c b/MesaLib-dfbsd/patches/patch-src_gallium_drivers_nouveau_nouveau__vp3__video.c
new file mode 100644
index 0000000..89b3d08
--- /dev/null
+++ b/MesaLib-dfbsd/patches/patch-src_gallium_drivers_nouveau_nouveau__vp3__video.c
@@ -0,0 +1,18 @@
+$NetBSD: patch-src_gallium_drivers_nouveau_nouveau__vp3__video.c,v 1.1 2015/04/25 11:19:18 tnn 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;
diff --git a/MesaLib-dfbsd/patches/patch-src_gallium_drivers_nouveau_nv50_nv84__video.c b/MesaLib-dfbsd/patches/patch-src_gallium_drivers_nouveau_nv50_nv84__video.c
new file mode 100644
index 0000000..4aab565
--- /dev/null
+++ b/MesaLib-dfbsd/patches/patch-src_gallium_drivers_nouveau_nv50_nv84__video.c
@@ -0,0 +1,18 @@
+$NetBSD: patch-src_gallium_drivers_nouveau_nv50_nv84__video.c,v 1.1 2015/04/25 11:19:18 tnn 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);
diff --git a/MesaLib-dfbsd/patches/patch-src_gallium_state__trackers_clover_llvm_invocation.cpp b/MesaLib-dfbsd/patches/patch-src_gallium_state__trackers_clover_llvm_invocation.cpp
new file mode 100644
index 0000000..6f20d79
--- /dev/null
+++ b/MesaLib-dfbsd/patches/patch-src_gallium_state__trackers_clover_llvm_invocation.cpp
@@ -0,0 +1,37 @@
+$NetBSD$
+
+From freebsd-base-ports
+https://github.com/FreeBSDDesktop/freebsd-ports-graphics/tree/xserver-mesa-next-udev
+
+--- src/gallium/state_trackers/clover/llvm/invocation.cpp.orig 2016-11-10 22:06:40.000000000 +0000
++++ src/gallium/state_trackers/clover/llvm/invocation.cpp
+@@ -85,6 +85,14 @@ namespace {
+ }
+ }
+
++#if defined(__FreeBSD__)
++ char* convert(const std::string&s){
++ char *pc = new char[s.size()+1];
++ std::strcpy(pc, s.c_str());
++ return pc;
++ }
++#endif
++
+ std::unique_ptr<LLVMContext>
+ create_context(std::string &r_log) {
+ init_targets();
+@@ -104,8 +112,14 @@ 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__)
++ std::vector<const char *> copts;
++ std::transform(opts.begin(), opts.end(), std::back_inserter(copts), convert);
++#else
+ const std::vector<const char *> copts =
+ map(std::mem_fn(&std::string::c_str), opts);
++#endif
+
+ if (!clang::CompilerInvocation::CreateFromArgs(
+ c->getInvocation(), copts.data(), copts.data() + copts.size(), diag))
diff --git a/MesaLib-dfbsd/patches/patch-src_gallium_state__trackers_clover_llvm_metadata.hpp b/MesaLib-dfbsd/patches/patch-src_gallium_state__trackers_clover_llvm_metadata.hpp
new file mode 100644
index 0000000..08594f6
--- /dev/null
+++ b/MesaLib-dfbsd/patches/patch-src_gallium_state__trackers_clover_llvm_metadata.hpp
@@ -0,0 +1,19 @@
+$NetBSD$
+
+From freebsd-base-ports
+https://github.com/FreeBSDDesktop/freebsd-ports-graphics/tree/xserver-mesa-next-udev
+
+--- src/gallium/state_trackers/clover/llvm/metadata.hpp.orig 2016-11-10 22:05:17.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__)
++ return { n->getOperand(0), n->getOperand(n->getNumOperands()) };
++#else
+ return { n->op_begin(), n->op_end() };
++#endif
+ else
+ return {};
+ }
diff --git a/MesaLib-dfbsd/patches/patch-src_gallium_targets_dri_Makefile.in b/MesaLib-dfbsd/patches/patch-src_gallium_targets_dri_Makefile.in
new file mode 100644
index 0000000..e54ff8c
--- /dev/null
+++ b/MesaLib-dfbsd/patches/patch-src_gallium_targets_dri_Makefile.in
@@ -0,0 +1,15 @@
+$NetBSD: patch-src_gallium_targets_dri_Makefile.in,v 1.1 2015/04/25 11:19:18 tnn 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) \
diff --git a/MesaLib-dfbsd/patches/patch-src_gallium_winsys_radeon_drm_radeon__drm__winsys.c b/MesaLib-dfbsd/patches/patch-src_gallium_winsys_radeon_drm_radeon__drm__winsys.c
new file mode 100644
index 0000000..e14f4dd
--- /dev/null
+++ b/MesaLib-dfbsd/patches/patch-src_gallium_winsys_radeon_drm_radeon__drm__winsys.c
@@ -0,0 +1,18 @@
+$NetBSD$
+
+Don't create pipe thread on NetBSD. It triggers some kernel bug.
+kern/49838.
+
+--- src/gallium/winsys/radeon/drm/radeon_drm_winsys.c.orig 2016-11-10 22:05:17.000000000 +0000
++++ src/gallium/winsys/radeon/drm/radeon_drm_winsys.c
+@@ -819,8 +819,10 @@ radeon_drm_winsys_create(int fd, radeon_
+ /* TTM aligns the BO size to the CPU page size */
+ ws->info.gart_page_size = sysconf(_SC_PAGESIZE);
+
++#if !defined(__NetBSD__)
+ if (ws->num_cpus > 1 && debug_get_option_thread())
+ util_queue_init(&ws->cs_queue, "radeon_cs", 8, 1);
++#endif
+
+ /* Create the screen at the end. The winsys must be initialized
+ * completely.
diff --git a/MesaLib-dfbsd/patches/patch-src_gallium_winsys_svga_drm_vmw__screen__ioctl.c b/MesaLib-dfbsd/patches/patch-src_gallium_winsys_svga_drm_vmw__screen__ioctl.c
new file mode 100644
index 0000000..93b1be2
--- /dev/null
+++ b/MesaLib-dfbsd/patches/patch-src_gallium_winsys_svga_drm_vmw__screen__ioctl.c
@@ -0,0 +1,32 @@
+$NetBSD: patch-src_gallium_winsys_svga_drm_vmw__screen__ioctl.c,v 1.3 2015/05/15 14:27:42 nros 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>
+
diff --git a/MesaLib-dfbsd/patches/patch-src_glsl_ralloc.c b/MesaLib-dfbsd/patches/patch-src_glsl_ralloc.c
new file mode 100644
index 0000000..f0e3ba6
--- /dev/null
+++ b/MesaLib-dfbsd/patches/patch-src_glsl_ralloc.c
@@ -0,0 +1,39 @@
+$NetBSD: patch-src_glsl_ralloc.c,v 1.4 2016/02/23 11:16:55 jperkin 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';
diff --git a/MesaLib-dfbsd/patches/patch-src_glx_apple_apple__glapi.c b/MesaLib-dfbsd/patches/patch-src_glx_apple_apple__glapi.c
new file mode 100644
index 0000000..6e538e6
--- /dev/null
+++ b/MesaLib-dfbsd/patches/patch-src_glx_apple_apple__glapi.c
@@ -0,0 +1,24 @@
+$NetBSD: patch-src_glx_apple_apple__glapi.c,v 1.1 2015/09/27 21:58:03 tnn 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);
+
diff --git a/MesaLib-dfbsd/patches/patch-src_glx_glxclient.h b/MesaLib-dfbsd/patches/patch-src_glx_glxclient.h
new file mode 100644
index 0000000..60ecfcf
--- /dev/null
+++ b/MesaLib-dfbsd/patches/patch-src_glx_glxclient.h
@@ -0,0 +1,19 @@
+$NetBSD: patch-src_glx_glxclient.h,v 1.1 2015/09/11 16:27:30 tnn 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
+
diff --git a/MesaLib-dfbsd/patches/patch-src_glx_glxcurrent.c b/MesaLib-dfbsd/patches/patch-src_glx_glxcurrent.c
new file mode 100644
index 0000000..86406e4
--- /dev/null
+++ b/MesaLib-dfbsd/patches/patch-src_glx_glxcurrent.c
@@ -0,0 +1,40 @@
+$NetBSD: patch-src_glx_glxcurrent.c,v 1.2 2015/09/26 08:45:02 tnn 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)
diff --git a/MesaLib-dfbsd/patches/patch-src_intel_tools_aubinator.c b/MesaLib-dfbsd/patches/patch-src_intel_tools_aubinator.c
new file mode 100644
index 0000000..f9688b9
--- /dev/null
+++ b/MesaLib-dfbsd/patches/patch-src_intel_tools_aubinator.c
@@ -0,0 +1,24 @@
+$NetBSD$
+
+From freebsd-base-ports
+https://github.com/FreeBSDDesktop/freebsd-ports-graphics/tree/xserver-mesa-next-udev
+
+Not sure if these mmap() flags are right ...
+
+--- src/intel/tools/aubinator.c.orig 2016-11-10 22:06:40.000000000 +0000
++++ src/intel/tools/aubinator.c
+@@ -1225,8 +1225,14 @@ int main(int argc, char *argv[])
+
+ /* mmap a terabyte for our gtt space. */
+ gtt_size = 1ul << 40;
++/* MAP_NORESERVE removed in FreeBSD 11 and never was implemented before */
++#if defined(__FreeBSD__) || defined(__DragonFly__)
++ gtt = mmap(NULL, gtt_size, PROT_READ | PROT_WRITE,
++ MAP_PRIVATE | MAP_ANONYMOUS | MAP_NOSYNC | MAP_NOCORE, -1, 0);
++#else
+ gtt = mmap(NULL, gtt_size, PROT_READ | PROT_WRITE,
+ MAP_PRIVATE | MAP_ANONYMOUS | MAP_NORESERVE, -1, 0);
++#endif
+ if (gtt == MAP_FAILED) {
+ fprintf(stderr, "failed to alloc gtt space: %s\n", strerror(errno));
+ exit(EXIT_FAILURE);
diff --git a/MesaLib-dfbsd/patches/patch-src_mapi_entry.c b/MesaLib-dfbsd/patches/patch-src_mapi_entry.c
new file mode 100644
index 0000000..bbbd0dd
--- /dev/null
+++ b/MesaLib-dfbsd/patches/patch-src_mapi_entry.c
@@ -0,0 +1,1620 @@
+$NetBSD$
+
+For some reason the previously used table_noop_array has a link error.
+
+HACK: Create new array of noop functions.
+BUG: Using environment variable LIBGL_DEBUG=verbose causes
+massive failure in keyboard input for a Radeon 6450 (CAICOS) card.
+
+--- src/mapi/entry.c.orig 2016-11-10 22:05:17.000000000 +0000
++++ src/mapi/entry.c
+@@ -41,6 +41,1609 @@
+ #define ENTRY_CURRENT_TABLE_GET U_STRINGIFY(u_current_get_table_internal)
+ #endif
+
++#if defined(__NetBSD__) && defined(GLX_USE_TLS)
++static int netbsd_noop_generic(void) {
++ return 0;
++}
++
++/*
++ * src/mapi/table.h defines
++ * MAPI_TABLE_NUM_SLOTS to be
++ * MAPI_TABLE_NUM_STATIC + MAPI_TABLE_NUM_DYNAMIC
++ * = 1330 + 256 = 1586 entries
++ * according to values from mapi/shared-glapi/glapi_mapi_tmp.h
++ */
++
++const mapi_func netbsd_table_noop_array[] = {
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic,
++ (mapi_func)netbsd_noop_generic
++};
++#endif /* defined(__NetBSD__) && defined(GLX_USE_TLS) */
++
+ #if defined(USE_X86_ASM) && defined(__GNUC__)
+ # ifdef GLX_USE_TLS
+ # include "entry_x86_tls.h"
diff --git a/MesaLib-dfbsd/patches/patch-src_mapi_entry__x86-64__tls.h b/MesaLib-dfbsd/patches/patch-src_mapi_entry__x86-64__tls.h
new file mode 100644
index 0000000..2b0b5df
--- /dev/null
+++ b/MesaLib-dfbsd/patches/patch-src_mapi_entry__x86-64__tls.h
@@ -0,0 +1,32 @@
+$NetBSD: patch-src_mapi_entry__x86-64__tls.h,v 1.2 2015/09/26 08:45:02 tnn 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.
+
+HACK: Renamed non-linking table_noop_array to locally created
+netbsd_table_noop_array.
+
+--- src/mapi/entry_x86-64_tls.h.orig 2016-11-10 22:05:17.000000000 +0000
++++ src/mapi/entry_x86-64_tls.h
+@@ -41,10 +41,19 @@ __asm__(".text\n"
+ ".balign 32\n" \
+ func ":"
+
++#if defined(__NetBSD__) && defined(GLX_USE_TLS)
+ #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 netbsd_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"
diff --git a/MesaLib-dfbsd/patches/patch-src_mapi_entry__x86__tls.h b/MesaLib-dfbsd/patches/patch-src_mapi_entry__x86__tls.h
new file mode 100644
index 0000000..2013d31
--- /dev/null
+++ b/MesaLib-dfbsd/patches/patch-src_mapi_entry__x86__tls.h
@@ -0,0 +1,40 @@
+$NetBSD: patch-src_mapi_entry__x86__tls.h,v 1.2 2015/09/26 08:45:02 tnn 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.
+
+HACK: Renamed non-linking table_noop_array to locally created
+netbsd_table_noop_array.
+
+--- src/mapi/entry_x86_tls.h.orig 2016-11-10 22:05:17.000000000 +0000
++++ src/mapi/entry_x86_tls.h
+@@ -56,10 +56,27 @@ __asm__(".balign 16\n"
+ ".balign 16\n" \
+ func ":"
+
++#if defined(__NetBSD__) && defined(GLX_USE_TLS)
++extern const mapi_func netbsd_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 netbsd_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"
diff --git a/MesaLib-dfbsd/patches/patch-src_mapi_glapi_gen_gl__gentable.py b/MesaLib-dfbsd/patches/patch-src_mapi_glapi_gen_gl__gentable.py
new file mode 100644
index 0000000..4c9561c
--- /dev/null
+++ b/MesaLib-dfbsd/patches/patch-src_mapi_glapi_gen_gl__gentable.py
@@ -0,0 +1,15 @@
+$NetBSD: patch-src_mapi_glapi_gen_gl__gentable.py,v 1.1 2015/09/11 00:03:36 tnn 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
+
diff --git a/MesaLib-dfbsd/patches/patch-src_mapi_table.h b/MesaLib-dfbsd/patches/patch-src_mapi_table.h
new file mode 100644
index 0000000..28f2042
--- /dev/null
+++ b/MesaLib-dfbsd/patches/patch-src_mapi_table.h
@@ -0,0 +1,15 @@
+$NetBSD$
+
+--- src/mapi/table.h.orig 2016-11-10 22:05:17.000000000 +0000
++++ src/mapi/table.h
+@@ -40,7 +40,9 @@
+ struct mapi_table;
+
+ extern const mapi_func table_noop_array[];
+-
++#if defined(__NetBSD__) && defined(GLX_USE_TLS)
++extern const mapi_func netbsd_table_noop_array[];
++#endif
+
+ typedef void (*nop_handler_proc)(const char *name);
+
diff --git a/MesaLib-dfbsd/patches/patch-src_mapi_u__current.c b/MesaLib-dfbsd/patches/patch-src_mapi_u__current.c
new file mode 100644
index 0000000..1091eb4
--- /dev/null
+++ b/MesaLib-dfbsd/patches/patch-src_mapi_u__current.c
@@ -0,0 +1,31 @@
+$NetBSD: patch-src_mapi_u__current.c,v 1.1 2015/09/11 16:27:30 tnn 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);
diff --git a/MesaLib-dfbsd/patches/patch-src_mapi_u__current.h b/MesaLib-dfbsd/patches/patch-src_mapi_u__current.h
new file mode 100644
index 0000000..c137f91
--- /dev/null
+++ b/MesaLib-dfbsd/patches/patch-src_mapi_u__current.h
@@ -0,0 +1,16 @@
+$NetBSD: patch-src_mapi_u__current.h,v 1.1 2015/09/11 16:27:30 tnn 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) ?
diff --git a/MesaLib-dfbsd/patches/patch-src_mesa_drivers_dri_Makefile.in b/MesaLib-dfbsd/patches/patch-src_mesa_drivers_dri_Makefile.in
new file mode 100644
index 0000000..663a1d7
--- /dev/null
+++ b/MesaLib-dfbsd/patches/patch-src_mesa_drivers_dri_Makefile.in
@@ -0,0 +1,15 @@
+$NetBSD$
+
+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 2016-11-14 11:29:32.000000000 +0000
++++ src/mesa/drivers/dri/Makefile.in
+@@ -614,6 +614,7 @@ mesa_dri_drivers_la_LIBADD = \
+ $(SHARED_GLAPI_LIB) \
+ $(MEGADRIVERS_DEPS) \
+ $(DRI_LIB_DEPS) \
++ $(top_srcdir)/src/mapi/shared-glapi/libglapi.la \
+ $()
+
+ @NEED_MEGADRIVER_TRUE@dri_LTLIBRARIES = mesa_dri_drivers.la
diff --git a/MesaLib-dfbsd/patches/patch-src_mesa_drivers_dri_common_Makefile.in b/MesaLib-dfbsd/patches/patch-src_mesa_drivers_dri_common_Makefile.in
new file mode 100644
index 0000000..20e3007
--- /dev/null
+++ b/MesaLib-dfbsd/patches/patch-src_mesa_drivers_dri_common_Makefile.in
@@ -0,0 +1,16 @@
+$NetBSD: patch-src_mesa_drivers_dri_common_Makefile.in,v 1.1 2015/04/25 11:19:18 tnn 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 \
diff --git a/MesaLib-dfbsd/patches/patch-src_mesa_drivers_dri_common_xmlconfig.c b/MesaLib-dfbsd/patches/patch-src_mesa_drivers_dri_common_xmlconfig.c
new file mode 100644
index 0000000..c79e11a
--- /dev/null
+++ b/MesaLib-dfbsd/patches/patch-src_mesa_drivers_dri_common_xmlconfig.c
@@ -0,0 +1,59 @@
+$NetBSD: patch-src_mesa_drivers_dri_common_xmlconfig.c,v 1.3 2016/02/23 11:16:55 jperkin Exp $
+
+PR pkg/50202.
+Provide compat strndup for older Darwin.
+
+--- src/mesa/drivers/dri/common/xmlconfig.c.orig 2016-11-10 22:05:17.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);
+@@ -939,7 +962,7 @@ static void parseOneConfigFile (XML_Pars
+ }
+
+ #ifndef SYSCONFDIR
+-#define SYSCONFDIR "/etc"
++#define SYSCONFDIR "/usr/pkg/etc"
+ #endif
+
+ void driParseConfigFiles (driOptionCache *cache, const driOptionCache *info,
diff --git a/MesaLib-dfbsd/patches/patch-src_mesa_drivers_dri_i915_intel__screen.c b/MesaLib-dfbsd/patches/patch-src_mesa_drivers_dri_i915_intel__screen.c
new file mode 100644
index 0000000..3b8aa7d
--- /dev/null
+++ b/MesaLib-dfbsd/patches/patch-src_mesa_drivers_dri_i915_intel__screen.c
@@ -0,0 +1,39 @@
+$NetBSD: patch-src_mesa_drivers_dri_i915_intel__screen.c,v 1.2 2015/06/07 15:48:12 tnn 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));
diff --git a/MesaLib-dfbsd/patches/patch-src_mesa_drivers_dri_i965_intel__screen.c b/MesaLib-dfbsd/patches/patch-src_mesa_drivers_dri_i965_intel__screen.c
new file mode 100644
index 0000000..b301211
--- /dev/null
+++ b/MesaLib-dfbsd/patches/patch-src_mesa_drivers_dri_i965_intel__screen.c
@@ -0,0 +1,39 @@
+$NetBSD: patch-src_mesa_drivers_dri_i965_intel__screen.c,v 1.2 2015/06/07 15:48:12 tnn 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));
diff --git a/MesaLib-dfbsd/patches/patch-src_mesa_drivers_dri_i965_intel__tiled__memcpy.c b/MesaLib-dfbsd/patches/patch-src_mesa_drivers_dri_i965_intel__tiled__memcpy.c
new file mode 100644
index 0000000..8c2201e
--- /dev/null
+++ b/MesaLib-dfbsd/patches/patch-src_mesa_drivers_dri_i965_intel__tiled__memcpy.c
@@ -0,0 +1,20 @@
+$NetBSD$
+
+--- 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.
diff --git a/MesaLib-dfbsd/patches/patch-src_mesa_drivers_dri_swrast_swrast.c b/MesaLib-dfbsd/patches/patch-src_mesa_drivers_dri_swrast_swrast.c
new file mode 100644
index 0000000..6d7a514
--- /dev/null
+++ b/MesaLib-dfbsd/patches/patch-src_mesa_drivers_dri_swrast_swrast.c
@@ -0,0 +1,19 @@
+$NetBSD: patch-src_mesa_drivers_dri_swrast_swrast.c,v 1.2 2015/06/07 15:48:12 tnn 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);
diff --git a/MesaLib-dfbsd/patches/patch-src_mesa_main_context.c b/MesaLib-dfbsd/patches/patch-src_mesa_main_context.c
new file mode 100644
index 0000000..486ba22
--- /dev/null
+++ b/MesaLib-dfbsd/patches/patch-src_mesa_main_context.c
@@ -0,0 +1,41 @@
+$NetBSD: patch-src_mesa_main_context.c,v 1.3 2015/09/26 08:45:02 tnn 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",
diff --git a/MesaLib-dfbsd/patches/patch-src_mesa_main_extensions.c b/MesaLib-dfbsd/patches/patch-src_mesa_main_extensions.c
new file mode 100644
index 0000000..395d96d
--- /dev/null
+++ b/MesaLib-dfbsd/patches/patch-src_mesa_main_extensions.c
@@ -0,0 +1,24 @@
+$NetBSD: patch-src_mesa_main_extensions.c,v 1.1 2016/01/27 07:39:54 wiz 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));
diff --git a/MesaLib-dfbsd/patches/patch-src_mesa_main_macros.h b/MesaLib-dfbsd/patches/patch-src_mesa_main_macros.h
new file mode 100644
index 0000000..8b26b14
--- /dev/null
+++ b/MesaLib-dfbsd/patches/patch-src_mesa_main_macros.h
@@ -0,0 +1,16 @@
+$NetBSD: patch-src_mesa_main_macros.h,v 1.1 2016/01/05 13:02:57 tnn 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)
+ {
diff --git a/MesaLib-dfbsd/patches/patch-src_mesa_main_shader__query.cpp b/MesaLib-dfbsd/patches/patch-src_mesa_main_shader__query.cpp
new file mode 100644
index 0000000..f8c6779
--- /dev/null
+++ b/MesaLib-dfbsd/patches/patch-src_mesa_main_shader__query.cpp
@@ -0,0 +1,58 @@
+$NetBSD: patch-src_mesa_main_shader__query.cpp,v 1.1 2015/05/16 16:39:52 tnn 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(-)
+
+--- src/mesa/main/shader_query.cpp.orig 2016-11-10 22:05:17.000000000 +0000
++++ src/mesa/main/shader_query.cpp
+@@ -70,7 +70,12 @@ _mesa_BindAttribLocation(GLuint program,
+ GET_CURRENT_CONTEXT(ctx);
+
+ struct gl_shader_program *const shProg =
++#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;
+
+@@ -114,7 +119,12 @@ _mesa_GetActiveAttrib(GLuint program, GL
+ return;
+ }
+
++#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;
+
+@@ -159,7 +169,12 @@ _mesa_GetAttribLocation(GLuint program,
+ {
+ GET_CURRENT_CONTEXT(ctx);
+ struct gl_shader_program *const shProg =
++
++#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;
diff --git a/MesaLib-dfbsd/patches/patch-src_mesa_tnl_t__pipeline.c b/MesaLib-dfbsd/patches/patch-src_mesa_tnl_t__pipeline.c
new file mode 100644
index 0000000..a089340
--- /dev/null
+++ b/MesaLib-dfbsd/patches/patch-src_mesa_tnl_t__pipeline.c
@@ -0,0 +1,20 @@
+$NetBSD: patch-src_mesa_tnl_t__pipeline.c,v 1.1 2015/09/11 00:03:36 tnn 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
diff --git a/MesaLib-dfbsd/patches/patch-src_mesa_x86_common__x86.c b/MesaLib-dfbsd/patches/patch-src_mesa_x86_common__x86.c
new file mode 100644
index 0000000..49217fd
--- /dev/null
+++ b/MesaLib-dfbsd/patches/patch-src_mesa_x86_common__x86.c
@@ -0,0 +1,24 @@
+$NetBSD: patch-src_mesa_x86_common__x86.c,v 1.2 2015/09/11 00:03:36 tnn 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;
diff --git a/MesaLib-dfbsd/patches/patch-src_util_strndup.c b/MesaLib-dfbsd/patches/patch-src_util_strndup.c
new file mode 100644
index 0000000..3afd89b
--- /dev/null
+++ b/MesaLib-dfbsd/patches/patch-src_util_strndup.c
@@ -0,0 +1,30 @@
+$NetBSD: patch-src_util_strndup.c,v 1.1 2016/02/23 11:16:55 jperkin 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;
diff --git a/MesaLib-dfbsd/patches/patch-src_util_strndup.h b/MesaLib-dfbsd/patches/patch-src_util_strndup.h
new file mode 100644
index 0000000..5de6a78
--- /dev/null
+++ b/MesaLib-dfbsd/patches/patch-src_util_strndup.h
@@ -0,0 +1,15 @@
+$NetBSD: patch-src_util_strndup.h,v 1.1 2016/02/23 11:16:55 jperkin 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" {
diff --git a/MesaLib-dfbsd/patches/patch-src_util_u__atomic.h b/MesaLib-dfbsd/patches/patch-src_util_u__atomic.h
new file mode 100644
index 0000000..2b71ffd
--- /dev/null
+++ b/MesaLib-dfbsd/patches/patch-src_util_u__atomic.h
@@ -0,0 +1,30 @@
+$NetBSD: patch-src_util_u__atomic.h,v 1.1 2015/04/25 11:19:18 tnn 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)) : \
diff --git a/MesaLib-dfbsd/patches/patch-src_util_u__endian.h b/MesaLib-dfbsd/patches/patch-src_util_u__endian.h
new file mode 100644
index 0000000..f85c306
--- /dev/null
+++ b/MesaLib-dfbsd/patches/patch-src_util_u__endian.h
@@ -0,0 +1,16 @@
+$NetBSD$
+
+From freebsd-base-ports
+https://github.com/FreeBSDDesktop/freebsd-ports-graphics/tree/xserver-mesa-next-udev
+
+--- src/util/u_endian.h.orig 2016-11-10 22:05:17.000000000 +0000
++++ src/util/u_endian.h
+@@ -54,7 +54,7 @@
+ # define PIPE_ARCH_BIG_ENDIAN
+ #endif
+
+-#elif defined(__OpenBSD__) || defined(__NetBSD__)
++#elif defined(__OpenBSD__) || defined(__NetBSD__) || defined(__FreeBSD__) || defined(__DragonFly__)
+ #include <sys/types.h>
+ #include <machine/endian.h>
+
Home |
Main Index |
Thread Index |
Old Index