aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Mk/bsd.port.mk1
-rw-r--r--graphics/Makefile1
-rw-r--r--graphics/dri/Makefile119
-rw-r--r--graphics/dri/pkg-help13
-rw-r--r--graphics/dri/pkg-plist83
-rw-r--r--graphics/dri/pkg-plist-old67
-rw-r--r--graphics/gbm/Makefile41
-rw-r--r--graphics/gbm/pkg-descr3
-rw-r--r--graphics/gbm/pkg-plist5
-rw-r--r--graphics/libEGL/Makefile44
-rw-r--r--graphics/libEGL/pkg-plist4
-rw-r--r--graphics/libGL/Makefile23
-rw-r--r--graphics/libGL/bsd.mesalib.mk101
-rw-r--r--graphics/libGL/distinfo4
-rw-r--r--graphics/libGL/files-old/patch-Makefile.in13
-rw-r--r--graphics/libGL/files-old/patch-configure422
-rw-r--r--graphics/libGL/files-old/patch-mach64_context.h20
-rw-r--r--graphics/libGL/files-old/patch-src-glsl_ir_constant_expression.cpp (renamed from graphics/libGL/files/patch-src-glsl_ir_constant_expression.cpp)0
-rw-r--r--graphics/libGL/files-old/patch-src__egl__drivers__dri2__Makefile.in21
-rw-r--r--graphics/libGL/files-old/patch-src__egl__drivers__dri2__common.c87
-rw-r--r--graphics/libGL/files-old/patch-src__egl__drivers__glx__Makefile.in19
-rw-r--r--graphics/libGL/files-old/patch-src__gallium__auxiliary__pipe-loader__pipe_loader_drm.c43
-rw-r--r--graphics/libGL/files-old/patch-src__gallium__include__pipe__p_config.h16
-rw-r--r--graphics/libGL/files-old/patch-src__gallium__state_trackers__egl__drm__native_drm.c42
-rw-r--r--graphics/libGL/files-old/patch-src__gallium__state_trackers__xvmc__tests__xvmc_bench.c52
-rw-r--r--graphics/libGL/files-old/patch-src__gallium__targets__egl-static__egl.c37
-rw-r--r--graphics/libGL/files-old/patch-src__gallium__targets__gbm__Makefile.in29
-rw-r--r--graphics/libGL/files-old/patch-src__gbm__Makefile.in42
-rw-r--r--graphics/libGL/files-old/patch-src__gbm__backends__dri__driver_name.c53
-rw-r--r--graphics/libGL/files-old/patch-src__gbm__main__common.c69
-rw-r--r--graphics/libGL/files-old/patch-src__gbm__main__common.h15
-rw-r--r--graphics/libGL/files-old/patch-src__mesa__x86-64__glapi_x86-64.S12
-rw-r--r--graphics/libGL/files-old/patch-src__mesa__x86-64__xform4.S74
-rw-r--r--graphics/libGL/files-old/patch-src__mesa__x86__glapi_x86.S11
-rw-r--r--graphics/libGL/files-old/patch-src__mesa__x86__read_rgba_span_x86.S11
-rw-r--r--graphics/libGL/files-old/patch-src_gallium_drivers_r300_r300-chipset.c (renamed from graphics/libGL/files/patch-src_gallium_drivers_r300_r300-chipset.c)0
-rw-r--r--graphics/libGL/files-old/patch-src_gallium_drivers_r600_r600-asm.c (renamed from graphics/libGL/files/patch-src_gallium_drivers_r600_r600-asm.c)0
-rw-r--r--graphics/libGL/files-old/patch-src_gallium_drivers_r600_r600-shader.c (renamed from graphics/libGL/files/patch-src_gallium_drivers_r600_r600-shader.c)0
-rw-r--r--graphics/libGL/files-old/patch-src_gallium_drivers_r600_r600_state_common.c (renamed from graphics/libGL/files/patch-src_gallium_drivers_r600_r600_state_common.c)0
-rw-r--r--graphics/libGL/files-old/patch-src_gallium_drivers_radeon_radeon-llvm-emit.cpp (renamed from graphics/libGL/files/patch-src_gallium_drivers_radeon_radeon-llvm-emit.cpp)0
-rw-r--r--graphics/libGL/files-old/patch-src_gallium_drivers_radeonsi_r600-buffer.c (renamed from graphics/libGL/files/patch-src_gallium_drivers_radeonsi_r600-buffer.c)0
-rw-r--r--graphics/libGL/files-old/patch-src_gallium_winsys_svga_drm_vmw-screen-ioctl.c (renamed from graphics/libGL/files/patch-src_gallium_winsys_svga_drm_vmw-screen-ioctl.c)0
-rw-r--r--graphics/libGL/files-old/patch-src_glx_x11_XF86dri.c38
-rw-r--r--graphics/libGL/files-old/patch-src_mapi_glapi_gen_gl-gentable.py (renamed from graphics/libGL/files/patch-src_mapi_glapi_gen_gl-gentable.py)0
-rw-r--r--graphics/libGL/files-old/patch-src_mapi_mapi_entry_x86-64_tls.h13
-rw-r--r--graphics/libGL/files-old/patch-src_mapi_mapi_entry_x86_tls.h13
-rw-r--r--graphics/libGL/files-old/patch-src_mapi_mapi_entry_x86_tsd.h13
-rw-r--r--graphics/libGL/files-old/patch-src_mesa_Makefile15
-rw-r--r--graphics/libGL/files-old/patch-src_mesa_drivers_dri_common_Makefile.in (renamed from graphics/libGL/files/patch-src_mesa_drivers_dri_common_Makefile.in)0
-rw-r--r--graphics/libGL/files-old/patch-src_mesa_drivers_dri_common_xmlpool_Makefile.in (renamed from graphics/libGL/files/patch-src_mesa_drivers_dri_common_xmlpool_Makefile.in)0
-rw-r--r--graphics/libGL/files-old/patch-src_mesa_main_compiler.h (renamed from graphics/libGL/files/patch-src_mesa_main_compiler.h)0
-rw-r--r--graphics/libGL/files-old/patch-src_mesa_main_imports.c (renamed from graphics/libGL/files/patch-src_mesa_main_imports.c)0
-rw-r--r--graphics/libGL/files-old/pkg-deinstall.in12
-rw-r--r--graphics/libGL/files-old/pkg-install.in18
-rw-r--r--graphics/libGL/files/configure.ac100
-rw-r--r--graphics/libGL/files/patch-Makefile.in18
-rw-r--r--graphics/libGL/files/patch-configure233
-rw-r--r--graphics/libGL/files/patch-src__gallium__drivers__r300__r300_chipset.c24
-rw-r--r--graphics/libGL/files/patch-src__gallium__include__pipe__p_config.h19
-rw-r--r--graphics/libGL/files/patch-src__gallium__state_trackers__clover__util__range.hpp40
-rw-r--r--graphics/libGL/files/patch-src__gallium__winsys__svga__drm__vmw_screen_ioctl.c14
-rw-r--r--graphics/libGL/files/patch-src__glsl__ir_constant_expression.cpp14
-rw-r--r--graphics/libGL/files/patch-src__loader__Makefile.in20
-rw-r--r--graphics/libGL/files/patch-src__loader__loader.c90
-rw-r--r--graphics/libGL/files/patch-src__mapi__entry_x86-64_tls.h13
-rw-r--r--graphics/libGL/files/patch-src__mapi__entry_x86_tls.h13
-rw-r--r--graphics/libGL/files/patch-src__mapi__entry_x86_tsd.h13
-rw-r--r--graphics/libGL/files/patch-src__mapi__glapi__gen__gl_gentable.py11
-rw-r--r--graphics/libGL/files/patch-src__mesa__main__compiler.h12
-rw-r--r--graphics/libGL/files/patch-src__mesa__main__imports.c11
-rw-r--r--graphics/libGL/files/pkg-install.in1
-rw-r--r--graphics/libGL/files/src__loader__Makefile.am12
-rw-r--r--graphics/libGL/pkg-plist19
-rw-r--r--graphics/libglapi/Makefile29
-rw-r--r--graphics/libglapi/pkg-descr2
-rw-r--r--graphics/libglapi/pkg-plist1
-rw-r--r--graphics/libglesv2/Makefile39
-rw-r--r--graphics/libglesv2/pkg-plist4
78 files changed, 2000 insertions, 471 deletions
diff --git a/Mk/bsd.port.mk b/Mk/bsd.port.mk
index 22d7e08ce521..08f76d1477b8 100644
--- a/Mk/bsd.port.mk
+++ b/Mk/bsd.port.mk
@@ -1773,6 +1773,7 @@ RUN_DEPENDS+= ${LINUX_BASE_PORT}
PKG_IGNORE_DEPENDS?= 'this_port_does_not_exist'
+_GL_gbm_LIB_DEPENDS= libgbm.so:${PORTSDIR}/graphics/gbm
_GL_glesv2_LIB_DEPENDS= libGLESv2.so:${PORTSDIR}/graphics/libglesv2
_GL_egl_LIB_DEPENDS= libEGL.so:${PORTSDIR}/graphics/libEGL
_GL_gl_LIB_DEPENDS= libGL.so:${PORTSDIR}/graphics/libGL
diff --git a/graphics/Makefile b/graphics/Makefile
index 9622189951fe..466061dc8252 100644
--- a/graphics/Makefile
+++ b/graphics/Makefile
@@ -226,6 +226,7 @@
SUBDIR += fyre
SUBDIR += g2
SUBDIR += gauche-gl
+ SUBDIR += gbm
SUBDIR += gcolor
SUBDIR += gcolor2
SUBDIR += gd
diff --git a/graphics/dri/Makefile b/graphics/dri/Makefile
index 29c2be3c4798..2dc5bf868e46 100644
--- a/graphics/dri/Makefile
+++ b/graphics/dri/Makefile
@@ -3,7 +3,7 @@
PORTNAME= dri
PORTVERSION= ${MESAVERSION}
-PORTREVISION= 5
+PORTREVISION= ${DRIREVISION}
PORTEPOCH= 2
CATEGORIES= graphics
@@ -12,31 +12,37 @@ COMMENT= OpenGL hardware acceleration drivers for the DRI
LIB_DEPENDS= libdrm.so:${PORTSDIR}/graphics/libdrm \
libexpat.so:${PORTSDIR}/textproc/expat2
-USES+= gettext:build
-USE_XORG= glproto x11 xext xxf86vm xdamage xfixes dri2proto
+USE_XORG= glproto x11 xext xxf86vm xdamage xfixes dri2proto \
+ presentproto xvmc xshmfence
+
+OPTIONS_DEFINE= TEXTURE
+
+OPTIONS_DEFINE_i386= GALLIUM VDPAU
+OPTIONS_DEFAULT_i386= GALLIUM VDPAU
+OPTIONS_DEFINE_amd64= GALLIUM VDPAU
+OPTIONS_DEFAULT_amd64= GALLIUM VDPAU
+
+GALLIUM_DESC= Gallium (llvm backed) dri drivers
+TEXTURE_DESC= Enable texture-float support (patent encumbered)
+VDPAU_DESC= VDPAU (GPU video acceleration) support (needs Gallium)
+
+PKGHELP= ${.CURDIR}/pkg-help
.include <bsd.port.options.mk>
# gcc from base can't handle some code in mesa 9.1+
-# We only care for 9.x and 8.x, not for old pre-clang default current.
+# We only care for 9.x and 8.x. clang in 10.x is new enough.
# This is for 0b0000 binary which gcc 4.3+ understands and is in the i965 driver.
-.if defined(WITH_NEW_XORG)
-. if (${OSVERSION} >= 901500 && ${OSVERSION} < 1000000) \
- && ${ARCH} == amd64
+. if (${OSVERSION} >= 901500 && ${OSVERSION} < 1000000)
CC=clang
CXX=clang++
CPP=clang-cpp
. elif ${OSVERSION} < 901500
USE_GCC=yes
. endif
-.endif
ALL_DRI_DRIVERS=I915 I965 R200 RADEON SWRAST
-.if !defined(WITH_NEW_XORG)
-ALL_DRI_DRIVERS+=I810 MACH64 MGA R128 R300 R600 SAVAGE SIS TDFX UNICHROME
-.endif
-
.include "${.CURDIR}/../../graphics/libGL/bsd.mesalib.mk"
PLIST_SUB+= VERSION=${MESADISTVERSION}
@@ -45,42 +51,63 @@ PLIST_SUB+= VERSION=${MESADISTVERSION}
DRI_DRIVERS= ${ALL_DRI_DRIVERS}
.endif
-.if defined(WITH_NEW_XORG)
-. if !defined(WITHOUT_GALLIUM) && (${ARCH} == i386 || ${ARCH} == amd64)
-BUILD_DEPENDS+= llvm-config33:${PORTSDIR}/devel/llvm33
-CONFIGURE_ENV+= LLVM_CONFIG=${LOCALBASE}/bin/llvm-config33
+.if defined(WITH_NEW_MESA)
+DRIREVISION= 0
+PLIST= ${.CURDIR}/pkg-plist
+.else
+DRIREVISION= 6
+PLIST= ${.CURDIR}/pkg-plist-old
+.endif
-CONFIGURE_ARGS+=--enable-gallium-llvm --disable-gallium-egl
+.if ${PORT_OPTIONS:MGALLIUM}
+. if defined(WITH_NEW_MESA)
+# keep in sync with libopencl please
+BUILD_DEPENDS+= llvm34>=0:${PORTSDIR}/devel/llvm34
+CONFIGURE_ENV+= LLVM_CONFIG=${LOCALBASE}/bin/llvm-config34
+. else
+BUILD_DEPENDS+= llvm33>=0:${PORTSDIR}/devel/llvm33
+CONFIGURE_ENV+= LLVM_CONFIG=${LOCALBASE}/bin/llvm-config33
+. endif
-CONFIGURE_ARGS+=--with-gallium-drivers=r300,r600,radeonsi,svga,swrast
+CONFIGURE_ARGS+=--enable-gallium-llvm \
+ --enable-xvmc \
+ --with-gallium-drivers=r300,r600,radeonsi,svga,swrast
PLIST_SUB+= GALLIUM=""
-. else
-CONFIGURE_ARGS+=--enable-gallium-llvm=no --without-gallium-drivers
+.else
+CONFIGURE_ARGS+=--enable-gallium-llvm=no --without-gallium-drivers \
+ --disable-gallium-egl
PLIST_SUB+= GALLIUM="@comment "
-. endif
-. if ${ARCH} == powerpc || ${ARCH} == powerpc64
+.endif
+
+.if ${PORT_OPTIONS:MTEXTURE}
+CONFIGURE_ARGS+=--enable-texture-float
+.endif
+
+.if ${PORT_OPTIONS:MVDPAU}
+CONFIGURE_ARGS+=--enable-vdpau
+LIB_DEPENDS+= libvdpau.so:${PORTSDIR}/multimedia/libvdpau
+PLIST_SUB+= VDPAU=""
+.else
+CONFIGURE_ARGS+=--disable-vdpau
+PLIST_SUB+= VDPAU="@comment "
+.endif
+
+.if ${ARCH} == powerpc || ${ARCH} == powerpc64
DRI_DRIVERS= RADEON SWRAST
-. endif
-. if ${ARCH} == sparc64 || ${ARCH} == armv6
+.endif
+.if ${ARCH} == sparc64 || ${ARCH} == armv6
DRI_DRIVERS= SWRAST
-. endif
-.else # !defined(WITH_NEW_XORG)
-. if ${ARCH} == powerpc || ${ARCH} == powerpc64
-DRI_DRIVERS= MACH64 RADEON SWRAST TDFX
-. elif ${ARCH} == sparc64
-DRI_DRIVERS= MACH64 RADEON SWRAST
-. endif
-.endif # defined(WITH_NEW_XORG)
+.endif
# empty for unsupported arches
DRI_DRIVERS+=
.for _d in ${ALL_DRI_DRIVERS}
-.if ${DRI_DRIVERS:M${_d}}
+. if ${DRI_DRIVERS:M${_d}}
PLIST_SUB+= ${_d}_DRIVER=""
-.else
+. else
PLIST_SUB+= ${_d}_DRIVER="@comment "
-.endif
+. endif
.endfor
.if !(${ARCH} == amd64 || ${ARCH} == i386)
@@ -88,26 +115,4 @@ CONFIGURE_ARGS+=--disable-gallium-intel
.endif
CONFIGURE_ARGS+=--with-dri-drivers="${DRI_DRIVERS:tl}"
-.if defined(WITH_NEW_XORG) && !defined(WITH_GALLIUM) \
- && (${ARCH} == i386 || ${ARCH} == amd64)
-pre-everything::
- @${ECHO_MSG} ""
- @${ECHO_MSG} "For r300, r600, radeonsi and swrast gallium based drivers."
- @${ECHO_MSG} "Please define WITH_GALLIUM in /etc/make.conf"
- @${ECHO_MSG} "Note that gallium support is highly experimental."
- @${ECHO_MSG} ""
-.endif
-
-post-install:
-.if defined(WITH_NEW_XORG)
- @${RM} -f ${STAGEDIR}${PREFIX}/include/GL/*.h
- @${RM} ${STAGEDIR}${PREFIX}/lib/libGL.*
- @${RM} ${STAGEDIR}${PREFIX}/lib/libglapi.*
- @${RM} -f ${STAGEDIR}${PREFIX}/libdata/pkgconfig/gl.pc
-.else
- @${RM} -f ${STAGEDIR}${PREFIX}/include/GL/*.h
- @${RM} -rf ${STAGEDIR}${PREFIX}/lib/.libGL
- @${RM} -f ${STAGEDIR}${PREFIX}/libdata/pkgconfig/gl.pc
-.endif
-
.include <bsd.port.mk>
diff --git a/graphics/dri/pkg-help b/graphics/dri/pkg-help
new file mode 100644
index 000000000000..97cbd655e9dc
--- /dev/null
+++ b/graphics/dri/pkg-help
@@ -0,0 +1,13 @@
+The GALLIUM option enables gallium (llvm) backed drivers such as for example
+the r600 and radeonsi driver.
+
+The VDPAU option enables VDPAU drivers to decode video on the GPU via the
+VDPAU library.
+
+The TEXTURE option enables texture-float support. However Silicon Graphics
+owns the US Patent #6,650,327 [1]. Use at your own risk!
+
+See docs/patents.txt in the Mesa tarball or the follewing urls:
+
+[1] http://www.google.com/patents/about?id=mIIOAAAAEBAJ&dq=6650327
+[2] http://www.opengl.org/registry/specs/ARB/texture_float.txt
diff --git a/graphics/dri/pkg-plist b/graphics/dri/pkg-plist
index 21dd35247a8f..83562b26b114 100644
--- a/graphics/dri/pkg-plist
+++ b/graphics/dri/pkg-plist
@@ -1,40 +1,57 @@
-%%NEW%%%%I965_DRIVER%%etc/drirc
+%%I965_DRIVER%%etc/drirc
+@comment include/EGL/egl.h
+@comment include/EGL/eglext.h
+@comment include/EGL/eglextchromium.h
+@comment include/EGL/eglmesaext.h
+@comment include/EGL/eglplatform.h
include/GL/internal/dri_interface.h
-%%OLD%%%%I810_DRIVER%%lib/dri/i810_dri.so
-%%NEW%%%%I915_DRIVER%%lib/dri/i915_dri.la
+@comment include/GL/gl.h
+@comment include/GL/gl_mangle.h
+@comment include/GL/glcorearb.h
+@comment include/GL/glext.h
+@comment include/GL/glx.h
+@comment include/GL/glx_mangle.h
+@comment include/GL/glxext.h
+@comment include/GL/osmesa.h
+@comment include/GL/wglext.h
+@comment include/GL/wmesa.h
+@comment include/KHR/khrplatform.h
+@comment include/gbm.h
+%%GALLIUM%%lib/dri/kms_swrast_dri.so
%%I915_DRIVER%%lib/dri/i915_dri.so
-%%NEW%%%%I965_DRIVER%%lib/dri/i965_dri.la
%%I965_DRIVER%%lib/dri/i965_dri.so
-%%OLD%%%%MACH64_DRIVER%%lib/dri/mach64_dri.so
-%%OLD%%%%MGA_DRIVER%%lib/dri/mga_dri.so
-%%OLD%%%%R128_DRIVER%%lib/dri/r128_dri.so
-%%NEW%%%%R200_DRIVER%%lib/dri/r200_dri.la
%%R200_DRIVER%%lib/dri/r200_dri.so
-%%OLD%%%%R300_DRIVER%%lib/dri/r300_dri.so
-%%NEW%%%%GALLIUM%%lib/dri/r300_dri.la
-%%NEW%%%%GALLIUM%%lib/dri/r300_dri.so
-%%OLD%%%%R600_DRIVER%%lib/dri/r600_dri.so
-%%NEW%%%%GALLIUM%%lib/dri/r600_dri.la
-%%NEW%%%%GALLIUM%%lib/dri/r600_dri.so
-%%NEW%%%%RADEON_DRIVER%%lib/dri/radeon_dri.la
+%%GALLIUM%%lib/dri/r300_dri.so
+%%GALLIUM%%lib/dri/r600_dri.so
%%RADEON_DRIVER%%lib/dri/radeon_dri.so
-%%NEW%%%%GALLIUM%%lib/dri/radeonsi_dri.la
-%%NEW%%%%GALLIUM%%lib/dri/radeonsi_dri.so
-%%OLD%%%%SAVAGE_DRIVER%%lib/dri/savage_dri.so
-%%OLD%%%%SIS_DRIVER%%lib/dri/sis_dri.so
-%%NEW%%%%SWRAST_DRIVER%%lib/dri/swrast_dri.la
+%%GALLIUM%%lib/dri/radeonsi_dri.so
%%SWRAST_DRIVER%%lib/dri/swrast_dri.so
-%%OLD%%%%TDFX_DRIVER%%lib/dri/tdfx_dri.so
-%%OLD%%%%UNICHROME_DRIVER%%lib/dri/unichrome_dri.so
-%%NEW%%%%GALLIUM%%lib/dri/vmwgfx_dri.la
-%%NEW%%%%GALLIUM%%lib/dri/vmwgfx_dri.so
-%%NEW%%lib/libdricore%%VERSION%%.la
-%%NEW%%lib/libdricore%%VERSION%%.so
-%%NEW%%lib/libdricore%%VERSION%%.so.1
-%%NEW%%lib/libdricore%%VERSION%%.so.1.0.0
-%%NEW%%%%GALLIUM%%lib/libllvmradeon%%VERSION%%.la
-%%NEW%%%%GALLIUM%%lib/libllvmradeon%%VERSION%%.so
+%%GALLIUM%%lib/dri/vmwgfx_dri.so
+%%GALLIUM%%lib/libXvMCr600.so
+%%GALLIUM%%lib/libXvMCr600.so.1
+%%GALLIUM%%lib/libXvMCr600.so.1.0
+%%GALLIUM%%lib/libXvMCr600.so.1.0.0
+@comment lib/libEGL.so
+@comment lib/libEGL.so.1
+@comment lib/libEGL.so.1.0.0
+@comment lib/libGL.so
+@comment lib/libGL.so.1
+@comment lib/libGL.so.1.2.0
+@comment lib/libgbm.so
+@comment lib/libgbm.so.1
+@comment lib/libgbm.so.1.0.0
+@comment lib/libglapi.so
+@comment lib/libglapi.so.0
+@comment lib/libglapi.so.0.0.0
+%%VDPAU%%lib/vdpau/libvdpau_r600.so
+%%VDPAU%%lib/vdpau/libvdpau_r600.so.1
+%%VDPAU%%lib/vdpau/libvdpau_r600.so.1.0
+%%VDPAU%%lib/vdpau/libvdpau_r600.so.1.0.0
+%%VDPAU%%lib/vdpau/libvdpau_radeonsi.so
+%%VDPAU%%lib/vdpau/libvdpau_radeonsi.so.1
+%%VDPAU%%lib/vdpau/libvdpau_radeonsi.so.1.0
+%%VDPAU%%lib/vdpau/libvdpau_radeonsi.so.1.0.0
+@comment libdata/pkgconfig/egl.pc
libdata/pkgconfig/dri.pc
-@dirrm lib/dri
-@dirrmtry include/GL/internal
-@dirrmtry include/GL
+@comment libdata/pkgconfig/gbm.pc
+@comment libdata/pkgconfig/gl.pc
diff --git a/graphics/dri/pkg-plist-old b/graphics/dri/pkg-plist-old
new file mode 100644
index 000000000000..6ccab8b5ffb2
--- /dev/null
+++ b/graphics/dri/pkg-plist-old
@@ -0,0 +1,67 @@
+%%I965_DRIVER%%etc/drirc
+@comment include/EGL/egl.h
+@comment include/EGL/eglext.h
+@comment include/EGL/eglmesaext.h
+@comment include/EGL/eglplatform.h
+@comment include/GL/gl.h
+@comment include/GL/gl_mangle.h
+@comment include/GL/glext.h
+@comment include/GL/glx.h
+@comment include/GL/glx_mangle.h
+@comment include/GL/glxext.h
+include/GL/internal/dri_interface.h
+@comment include/GL/osmesa.h
+@comment include/GL/wglext.h
+@comment include/GL/wmesa.h
+@comment include/KHR/khrplatform.h
+@comment include/gbm.h
+%%I915_DRIVER%%lib/dri/i915_dri.so
+%%I965_DRIVER%%lib/dri/i965_dri.so
+%%R200_DRIVER%%lib/dri/r200_dri.so
+%%GALLIUM%%lib/dri/r300_dri.so
+%%GALLIUM%%lib/dri/r600_dri.so
+%%RADEON_DRIVER%%lib/dri/radeon_dri.so
+%%GALLIUM%%lib/dri/radeonsi_dri.so
+%%SWRAST_DRIVER%%lib/dri/swrast_dri.so
+%%GALLIUM%%lib/dri/vmwgfx_dri.so
+%%GALLIUM%%lib/libXvMCr300.so
+%%GALLIUM%%lib/libXvMCr300.so.1
+%%GALLIUM%%lib/libXvMCr300.so.1.0.0
+%%GALLIUM%%lib/libXvMCr600.so
+%%GALLIUM%%lib/libXvMCr600.so.1
+%%GALLIUM%%lib/libXvMCr600.so.1.0.0
+%%GALLIUM%%lib/libXvMCsoftpipe.so
+%%GALLIUM%%lib/libXvMCsoftpipe.so.1
+%%GALLIUM%%lib/libXvMCsoftpipe.so.1.0.0
+@comment lib/libEGL.so
+@comment lib/libEGL.so.1
+@comment lib/libEGL.so.1.0.0
+@comment lib/libGL.so
+@comment lib/libGL.so.1
+@comment lib/libGL.so.1.2.0
+lib/libdricore9.1.7.so
+lib/libdricore9.1.7.so.1
+lib/libdricore9.1.7.so.1.0.0
+@comment lib/libgbm.so
+@comment lib/libgbm.so.1
+@comment lib/libgbm.so.1.0.0
+@comment lib/libglapi.so
+@comment lib/libglapi.so.0
+@comment lib/libglapi.so.0.0.0
+%%GALLIUM%%lib/libllvmradeon%%VERSION%%.so
+%%GALLIUM%%%%VDPAU%%lib/vdpau/libvdpau_r300.so
+%%GALLIUM%%%%VDPAU%%lib/vdpau/libvdpau_r300.so.1
+%%GALLIUM%%%%VDPAU%%lib/vdpau/libvdpau_r300.so.1.0.0
+%%GALLIUM%%%%VDPAU%%lib/vdpau/libvdpau_r600.so
+%%GALLIUM%%%%VDPAU%%lib/vdpau/libvdpau_r600.so.1
+%%GALLIUM%%%%VDPAU%%lib/vdpau/libvdpau_r600.so.1.0.0
+%%GALLIUM%%%%VDPAU%%lib/vdpau/libvdpau_radeonsi.so
+%%GALLIUM%%%%VDPAU%%lib/vdpau/libvdpau_radeonsi.so.1
+%%GALLIUM%%%%VDPAU%%lib/vdpau/libvdpau_radeonsi.so.1.0.0
+%%GALLIUM%%%%VDPAU%%lib/vdpau/libvdpau_softpipe.so
+%%GALLIUM%%%%VDPAU%%lib/vdpau/libvdpau_softpipe.so.1
+%%GALLIUM%%%%VDPAU%%lib/vdpau/libvdpau_softpipe.so.1.0.0
+libdata/pkgconfig/dri.pc
+@comment libdata/pkgconfig/egl.pc
+@comment libdata/pkgconfig/gbm.pc
+@comment libdata/pkgconfig/gl.pc
diff --git a/graphics/gbm/Makefile b/graphics/gbm/Makefile
new file mode 100644
index 000000000000..c2c08e15fa97
--- /dev/null
+++ b/graphics/gbm/Makefile
@@ -0,0 +1,41 @@
+# Created by: kwm@FreeBSD.org
+# $FreeBSD$
+
+PORTNAME= gbm
+PORTVERSION= ${MESAVERSION}
+PORTREVISION= ${GBM_REVISION}
+CATEGORIES= graphics
+
+COMMENT= gbm library
+
+LIB_DEPENDS+= libpthread-stubs.so:${PORTSDIR}/devel/libpthread-stubs \
+ libexpat.so:${PORTSDIR}/textproc/expat2 \
+ libdrm.so:${PORTSDIR}/graphics/libdrm \
+ libglapi.so:${PORTSDIR}/graphics/libglapi
+
+USE_XORG= x11 xau xcb xdmcp
+
+# stuff not needed by gbm but configure wants it
+USE_XORG+= glproto dri2proto xext xdamage xfixes presentproto \
+ xshmfence
+
+BUILD_WRKSRC= ${WRKSRC}/src/gbm
+INSTALL_WRKSRC= ${WRKSRC}/src/gbm
+
+.include <bsd.port.options.mk>
+.include "${.CURDIR}/../../graphics/libGL/bsd.mesalib.mk"
+
+.if defined(WITH_NEW_MESA)
+GBM_REVISION= 0
+.else
+GBM_REVISION= 0
+.endif
+
+pre-build:
+.if defined(WITH_NEW_MESA)
+ @cd ${WRKSRC}/src/mapi/ && ${MAKE_CMD} ${_MAKE_JOBS}
+.else
+ @cd ${WRKSRC}/src/mapi/shared-glapi && ${MAKE_CMD} ${_MAKE_JOBS}
+.endif
+
+.include <bsd.port.mk>
diff --git a/graphics/gbm/pkg-descr b/graphics/gbm/pkg-descr
new file mode 100644
index 000000000000..f0ed995240bf
--- /dev/null
+++ b/graphics/gbm/pkg-descr
@@ -0,0 +1,3 @@
+This package contains the EGL utility library.
+
+WWW: http://www.freedesktop.org/Software/xorg
diff --git a/graphics/gbm/pkg-plist b/graphics/gbm/pkg-plist
new file mode 100644
index 000000000000..891e4aeed89b
--- /dev/null
+++ b/graphics/gbm/pkg-plist
@@ -0,0 +1,5 @@
+include/gbm.h
+lib/libgbm.so
+lib/libgbm.so.1
+lib/libgbm.so.1.0.0
+libdata/pkgconfig/gbm.pc
diff --git a/graphics/libEGL/Makefile b/graphics/libEGL/Makefile
index 340d18969796..9819cd90f060 100644
--- a/graphics/libEGL/Makefile
+++ b/graphics/libEGL/Makefile
@@ -3,28 +3,54 @@
PORTNAME= libEGL
PORTVERSION= ${MESAVERSION}
-PORTREVISION= 3
+PORTREVISION= ${LIBEGL_REVISION}
CATEGORIES= graphics
COMMENT= OpenEGL library
-LIB_DEPENDS+= libpthread-stubs.so:${PORTSDIR}/devel/libpthread-stubs
+LIB_DEPENDS+= libpthread-stubs.so:${PORTSDIR}/devel/libpthread-stubs \
+ libexpat.so:${PORTSDIR}/textproc/expat2 \
+ libdevq.so:${PORTSDIR}/devel/libdevq \
+ libdrm.so:${PORTSDIR}/graphics/libdrm
USE_XORG= x11 xau xcb xdmcp
# stuff not needed by libEGL but configure wants it
-USE_XORG+= glproto dri2proto xext xdamage xfixes
-LIB_DEPENDS+= libexpat.so:${PORTSDIR}/textproc/expat2 \
- libdrm.so:${PORTSDIR}/graphics/libdrm
+USE_XORG+= glproto dri2proto xext xdamage xfixes presentproto \
+ xshmfence
+
+.include <bsd.port.options.mk>
+.include "${.CURDIR}/../../graphics/libGL/bsd.mesalib.mk"
+.if defined(WITH_NEW_MESA)
+BUILD_WRKSRC= src/egl/drivers/dri2 src/egl/main
+INSTALL_WRKSRC= src/egl/drivers/dri2 src/egl/main
+.else
BUILD_WRKSRC= ${WRKSRC}/src/egl
INSTALL_WRKSRC= ${WRKSRC}/src/egl
+.endif
-.include <bsd.port.options.mk>
+.if defined(WITH_NEW_MESA)
+LIBEGL_REVISION= 0
+.else
+LIBEGL_REVISION= 4
+.endif
+
+.if defined(WITH_NEW_MESA)
+do-build: egl-do-build
+do-install: egl-do-install
-.if ! defined(WITH_NEW_XORG)
-IGNORE= Please enable WITH_NEW_XORG, libEGL needs libdrm higher then 2.4.24
+egl-do-build:
+. for dir in ${BUILD_WRKSRC}
+ @(cd ${WRKSRC}/${dir}; ${DO_MAKE_BUILD} ${ALL_TARGET};)
+. endfor
+
+egl-do-install:
+. for dir in ${INSTALL_WRKSRC}
+ @(cd ${WRKSRC}/${dir} && ${SETENV} ${MAKE_ENV} ${MAKE_CMD} \
+ ${MAKE_FLAGS} ${MAKEFILE} ${MAKE_ARGS} ${INSTALL_TARGET})
+
+. endfor
.endif
-.include "${.CURDIR}/../../graphics/libGL/bsd.mesalib.mk"
.include <bsd.port.mk>
diff --git a/graphics/libEGL/pkg-plist b/graphics/libEGL/pkg-plist
index e5a8156f0334..fb478a869f65 100644
--- a/graphics/libEGL/pkg-plist
+++ b/graphics/libEGL/pkg-plist
@@ -1,12 +1,10 @@
include/EGL/egl.h
include/EGL/eglext.h
+%%NEW%%include/EGL/eglextchromium.h
include/EGL/eglmesaext.h
include/EGL/eglplatform.h
include/KHR/khrplatform.h
-lib/libEGL.la
lib/libEGL.so
lib/libEGL.so.1
lib/libEGL.so.1.0.0
libdata/pkgconfig/egl.pc
-@dirrmtry include/KHR
-@dirrmtry include/EGL
diff --git a/graphics/libGL/Makefile b/graphics/libGL/Makefile
index a54845e8a619..e3b49c977239 100644
--- a/graphics/libGL/Makefile
+++ b/graphics/libGL/Makefile
@@ -9,39 +9,30 @@ CATEGORIES= graphics
COMMENT= OpenGL library that renders using GLX or DRI
LIB_DEPENDS+= libdrm.so:${PORTSDIR}/graphics/libdrm \
+ libglapi.so:${PORTSDIR}/graphics/libglapi \
libexpat.so:${PORTSDIR}/textproc/expat2
-USES= pkgconfig
-USE_XORG= glproto x11 xext xxf86vm xdamage xfixes dri2proto:both
+USE_XORG= glproto x11 xext xxf86vm xdamage xfixes dri2proto:both \
+ presentproto xshmfence
SUB_FILES= pkg-install pkg-deinstall
.include <bsd.port.options.mk>
+.include "${.CURDIR}/bsd.mesalib.mk"
-.if defined(WITH_NEW_XORG)
-LIBGLREVISION= 2
-LIB_DEPENDS+= libglapi.so:${PORTSDIR}/graphics/libglapi
+.if defined(WITH_NEW_MESA)
+LIBGLREVISION= 0
.else
-LIBGLREVISION= 5
+LIBGLREVISION= 3
.endif
-.include "${.CURDIR}/bsd.mesalib.mk"
-
.if !(${ARCH} == "amd64" || ${ARCH} == "i386")
CONFIGURE_ARGS+=--disable-gallium-intel
.endif
post-install:
- ${RM} -f ${STAGEDIR}${PREFIX}/libdata/pkgconfig/dri.pc
- ${RM} -rf ${STAGEDIR}${PREFIX}/include/GL/internal
-.if defined(WITH_NEW_XORG)
@${MKDIR} ${STAGEDIR}${PREFIX}/lib/.libGL
@${MV} ${STAGEDIR}${PREFIX}/lib/libGL* \
${STAGEDIR}${PREFIX}/lib/.libGL/
- ${RM} ${STAGEDIR}${PREFIX}/lib/libglapi*
-.else
- ${RM} ${STAGEDIR}${PREFIX}/include/GL/glu.h
- ${RM} ${STAGEDIR}${PREFIX}/include/GL/glu_mangle.h
-.endif
.include <bsd.port.mk>
diff --git a/graphics/libGL/bsd.mesalib.mk b/graphics/libGL/bsd.mesalib.mk
index a700b338faeb..fd01de1f8197 100644
--- a/graphics/libGL/bsd.mesalib.mk
+++ b/graphics/libGL/bsd.mesalib.mk
@@ -4,37 +4,54 @@
#
# Remember to upgrade the following ports everytime you bump MESAVERSION:
#
+# - graphics/dri
+# - graphics/gbm
# - graphics/libEGL
# - graphics/libGL
+# - graphics/libglapi
# - grahpics/libglesv2
-# - graphics/dri
#
# $FreeBSD$
+# hw context support in the i915kms driver
+.if ${OPSYS} == FreeBSD && \
+ (${OSVERSION} >= 1000717 && ${OSVERSION} < 1100000 || \
+ ${OSVERSION} >= 1100035)
+WITH_NEW_MESA=1
+.endif
+
MESAVERSION= ${MESABASEVERSION}${MESASUBVERSION:C/^(.)/.\1/}
MESADISTVERSION=${MESABASEVERSION}${MESASUBVERSION:C/^(.)/-\1/}
-.if defined(WITH_NEW_XORG)
-MESABASEVERSION= 9.1.7
-# if there is a subversion, include the '-' between 7.11-rc2 for example.
-MESASUBVERSION=
+.if defined(WITH_NEW_MESA)
+MESABASEVERSION= 10.3.0
+# if there is a subversion, don't include the '-' between 7.11-rc2.
+MESASUBVERSION=
+
+MASTER_SITES= ftp://ftp.freedesktop.org/pub/mesa/${MESABASEVERSION:R}/
PLIST_SUB+= OLD="@comment " NEW=""
+
+# work around libarchive bug?
+EXTRACT_CMD= ${LOCALBASE}/bin/gtar
+EXTRACT_DEPENDS+= gtar:${PORTSDIR}/archivers/gtar
+
.else
-MESABASEVERSION= 7.6.1
+MESABASEVERSION= 9.1.7
MESASUBVERSION=
+MASTER_SITES= ftp://ftp.freedesktop.org/pub/mesa/older-versions/${MESABASEVERSION:R:R}.x/${MESABASEVERSION}/
PLIST_SUB+= OLD="" NEW="@comment "
.endif
-MASTER_SITES= ftp://ftp.freedesktop.org/pub/mesa/older-versions/${MESABASEVERSION:R:R}.x/${MESABASEVERSION}/
DISTFILES= MesaLib-${MESADISTVERSION}${EXTRACT_SUFX}
MAINTAINER= x11@FreeBSD.org
BUILD_DEPENDS+= makedepend:${PORTSDIR}/devel/makedepend \
- python2:${PORTSDIR}/lang/python2 \
${PYTHON_SITELIBDIR}/libxml2.py:${PORTSDIR}/textproc/py-libxml2
-USES+= bison gmake pathfix pkgconfig shebangfix tar:bzip2
-USE_PYTHON_BUILD=2
+LIB_DEPENDS+= libdevq.so:${PORTSDIR}/devel/libdevq
+
+USES+= bison gmake libtool pathfix pkgconfig python:2,build \
+ shebangfix tar:bzip2
USE_LDCONFIG= yes
GNU_CONFIGURE= yes
@@ -43,39 +60,30 @@ LDFLAGS+= -Wl,-Y${LOCALBASE}/lib
.if ${OSVERSION} < 1000033
BUILD_DEPENDS+= ${LOCALBASE}/bin/flex:${PORTSDIR}/textproc/flex
-CONFIGURE_ENV+=ac_cv_prog_LEX=${LOCALBASE}/bin/flex
+CONFIGURE_ENV+= ac_cv_prog_LEX=${LOCALBASE}/bin/flex
.endif
-.if defined(WITH_NEW_XORG)
-INSTALL_TARGET= install-strip
-USES+= libtool:keepla
-
python_OLD_CMD= "/usr/bin/env[[:space:]]python"
python_CMD= ${LOCALBASE}/bin/python2
SHEBANG_FILES= src/gallium/*/*/*.py src/gallium/tools/trace/*.py \
src/gallium/drivers/svga/svgadump/svga_dump.py \
- src/glsl/tests/compare_ir src/mapi/glapi/gen/*.py \
- src/mapi/mapi/mapi_abi.py
-
-# i386 triggers clang bug 19778. This happens with clang 3.4.1 and older.
-. if ${ARCH} == i386
-USE_GCC=yes
-. endif
-.else
-CONFIGURE_ARGS+=--disable-glut --disable-glw --disable-glu
+ src/glsl/tests/compare_ir src/mapi/glapi/gen/*.py
-ALL_TARGET= default
+.if defined(WITH_NEW_MESA)
+SHEBANG_FILES+= src/mapi/mapi_abi.py
.endif
MASTERDIR= ${.CURDIR}/../../graphics/libGL
-.if defined(WITH_NEW_XORG)
+.if defined(WITH_NEW_MESA)
PATCHDIR= ${MASTERDIR}/files
+CONFIGURE_ARGS+= --disable-dri3
.else
PATCHDIR= ${MASTERDIR}/files-old
.endif
DESCR= ${.CURDIR}/pkg-descr
PLIST= ${.CURDIR}/pkg-plist
WRKSRC= ${WRKDIR}/Mesa-${MESADISTVERSION}
+INSTALL_TARGET= install-strip
COMPONENT= ${PORTNAME:tl:C/^lib//:C/mesa-//}
@@ -91,19 +99,26 @@ CONFIGURE_ARGS+= --disable-egl
CONFIGURE_ARGS+= --enable-egl
.endif
+.if ${COMPONENT:Mopencl} == ""
+CONFIGURE_ARGS+= --disable-opencl
+.else
+CONFIGURE_ARGS+= --enable-opencl
+.endif
+
.if ${COMPONENT:Mdri} == ""
CONFIGURE_ARGS+=--with-dri-drivers=no
CONFIGURE_ARGS+=--enable-gallium-llvm=no --without-gallium-drivers
.else
# done in the dri port
+# need to enable this globaly because it also used in dri ..
+# the third possible option is wayland.
+CONFIGURE_ARGS+= --enable-egl --with-egl-platforms=x11,drm
.endif
-.if !defined(WITH_NEW_XORG)
-.if defined(WITHOUT_XCB)
-CONFIGURE_ARGS+= --disable-xcb
+.if ${COMPONENT:Mvdpau} == ""
+CONFIGURE_ARGS+=--disable-vdpau
.else
-CONFIGURE_ARGS+= --enable-xcb
-.endif
+CONFIGURE_ARGS+=--enable-vdpau
.endif
post-patch:
@@ -111,19 +126,25 @@ post-patch:
${WRKSRC}/configure
@${REINPLACE_CMD} -e 's|/etc/|${PREFIX}/etc/|g' \
${WRKSRC}/src/mesa/drivers/dri/common/xmlconfig.c
-.if !defined(WITH_NEW_XORG)
- @${REINPLACE_CMD} -e 's|python|${PYTHON_CMD}|' \
- ${WRKSRC}/src/gallium/auxiliary/util/Makefile
- @${REINPLACE_CMD} -e 's|[$$](INSTALL_LIB_DIR)/pkgconfig|${PREFIX}/libdata/pkgconfig|' \
- ${WRKSRC}/src/glu/Makefile \
- ${WRKSRC}/src/mesa/Makefile \
- ${WRKSRC}/src/mesa/drivers/dri/Makefile
-.else
+.if !defined(WITH_NEW_MESA)
@${REINPLACE_CMD} -e 's|#!/usr/bin/python|#!${PYTHON_CMD}|g' \
${WRKSRC}/src/mesa/drivers/dri/common/xmlpool/gen_xmlpool.py \
${WRKSRC}/src/glsl/builtins/tools/*.py
- @${REINPLACE_CMD} -e 's|!/usr/bin/python2|!${PYTHON_CMD}|g' \
+.else
+ @${REINPLACE_CMD} -e 's|#!/use/bin/python|#!${PYTHON_CMD}|g' \
+ ${WRKSRC}/src/mesa/drivers/dri/common/xmlpool/gen_xmlpool.py
+.endif
+ @${REINPLACE_CMD} -e 's|!/use/bin/python2|!${PYTHON_CMD}|g' \
${WRKSRC}/src/mesa/main/get_hash_generator.py \
${WRKSRC}/src/mapi/glapi/gen/gl_enums.py \
${WRKSRC}/src/mapi/glapi/gen/gl_table.py
+
+pre-build: pre-mesa-build
+
+pre-mesa-build:
+.if defined(WITH_NEW_MESA)
+# do propper gmake target.
+ @cd ${WRKSRC}/src/mesa/drivers/dri/common/xmlpool && ${MAKE_CMD}
+ @cd ${WRKSRC}/src/loader && ${MAKE_CMD} libloader.la
.endif
+
diff --git a/graphics/libGL/distinfo b/graphics/libGL/distinfo
index fd2024b73e0a..6b5195658eab 100644
--- a/graphics/libGL/distinfo
+++ b/graphics/libGL/distinfo
@@ -1,4 +1,4 @@
-SHA256 (MesaLib-7.6.1.tar.bz2) = 701f0e4cb85d6298181651b780d1c0a439fadd02aad29ee6623fc05588bb8d44
-SIZE (MesaLib-7.6.1.tar.bz2) = 4886995
SHA256 (MesaLib-9.1.7.tar.bz2) = 30e6b878b457c716221a9730b179b2846c38cfd5aa1b02d54aff685f50b844a0
SIZE (MesaLib-9.1.7.tar.bz2) = 6134393
+SHA256 (MesaLib-10.3.0.tar.bz2) = 0283bfe710fa449ed82e465cfa09612a269e19abb7e0382082608062ce7960b5
+SIZE (MesaLib-10.3.0.tar.bz2) = 7252038
diff --git a/graphics/libGL/files-old/patch-Makefile.in b/graphics/libGL/files-old/patch-Makefile.in
new file mode 100644
index 000000000000..3adcc5d6156f
--- /dev/null
+++ b/graphics/libGL/files-old/patch-Makefile.in
@@ -0,0 +1,13 @@
+--- Makefile.in.orig 2014-05-11 21:01:42.000000000 +0200
++++ Makefile.in 2014-05-11 21:02:12.000000000 +0200
+@@ -87,9 +87,7 @@
+ $(top_srcdir)/m4/ax_prog_flex.m4 \
+ $(top_srcdir)/m4/ax_pthread.m4 \
+ $(top_srcdir)/m4/ax_python_module.m4 \
+- $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
+- $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
+- $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac
++ $(top_srcdir)/configure.ac
+ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+ am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
diff --git a/graphics/libGL/files-old/patch-configure b/graphics/libGL/files-old/patch-configure
index c9faeefb3a67..e56b2c20a78b 100644
--- a/graphics/libGL/files-old/patch-configure
+++ b/graphics/libGL/files-old/patch-configure
@@ -1,52 +1,424 @@
---- configure.orig 2013-12-12 18:52:32.304356162 +0000
-+++ configure 2013-12-12 19:50:44.434111814 +0000
-@@ -5393,7 +5393,7 @@
- ;;
- *freebsd* | dragonfly*)
- case "$host_cpu" in
-- i*86|x86_64|powerpc*|sparc*) default_driver="dri";;
-+ i*86|x86_64|ia64|powerpc*|sparc*) default_driver="dri";;
- esac
- ;;
- esac
-@@ -6946,12 +6946,35 @@
- CXXFLAGS="$CXXFLAGS -ansi -pedantic"
- fi
+--- configure.orig 2014-03-14 20:50:56.000000000 +0100
++++ configure 2014-03-14 20:51:25.000000000 +0100
+@@ -779,6 +779,8 @@
+ GBM_PC_REQ_PRIV
+ LIBUDEV_LIBS
+ LIBUDEV_CFLAGS
++LIBDEVQ_LIBS
++LIBDEVQ_CFLAGS
+ OSMESA_PC_LIB_PRIV
+ OSMESA_PC_REQ
+ OSMESA_MESA_DEPS
+@@ -1126,6 +1128,8 @@
+ NOUVEAU_LIBS
+ RADEON_CFLAGS
+ RADEON_LIBS
++LIBDEVQ_CFLAGS
++LIBDEVQ_LIBS
+ LIBUDEV_CFLAGS
+ LIBUDEV_LIBS
+ XORG_CFLAGS
+@@ -1930,6 +1934,10 @@
+ RADEON_CFLAGS
+ C compiler flags for RADEON, overriding pkg-config
+ RADEON_LIBS linker flags for RADEON, overriding pkg-config
++ LIBDEVQ_CFLAGS
++ C compiler flags for LIBDEVQ, overriding pkg-config
++ LIBDEVQ_LIBS
++ linker flags for LIBDEVQ, overriding pkg-config
+ LIBUDEV_CFLAGS
+ C compiler flags for LIBUDEV, overriding pkg-config
+ LIBUDEV_LIBS
+@@ -21184,9 +21192,34 @@
+ DEFINES="$DEFINES -DHAVE_PTHREAD -DUSE_EXTERNAL_DXTN_LIB=1"
+ DEFINES="$DEFINES -DIN_DRI_DRIVER -DHAVE_ALIAS"
-- # ffb and gamma are missing because they have not been converted
-- # to use the new interface.
- if test "x$DRI_DIRS" = "xyes"; then
-- DRI_DIRS="i810 i915 i965 mach64 mga r128 r200 r300 r600 radeon tdfx \
+- DRI_DIRS="i915 i965 nouveau r200 radeon swrast"
+- fi
+ case "$host_cpu" in
+ x86_64|ia64)
+ # i810 is missing because there is no x86-64 system where it
+ # could *ever* be used.
+ if test "x$DRI_DIRS" = "xyes"; then
-+ DRI_DIRS="i915 i965 mach64 mga r128 r200 r300 r600 radeon tdfx \
- unichrome savage sis swrast"
-- fi
++ DRI_DIRS="i915 i965 nouveau r200 radeon swrast"
+ fi
+ ;;
+ i*86)
+ if test "x$DRI_DIRS" = "xyes"; then
-+ DRI_DIRS="i810 i915 i965 mach64 mga r128 r200 r300 r600 radeon tdfx \
-+ unichrome savage sis swrast"
++ DRI_DIRS="i915 i965 nouveau r200 radeon swrast"
+ fi
+ ;;
+ powerpc*)
+ # Build only the drivers for cards that exist on PowerPC.
+ # At some point MGA will be added, but not yet.
+ if test "x$DRI_DIRS" = "xyes"; then
-+ DRI_DIRS="mach64 r128 r200 r300 r600 radeon tdfx swrast"
-+ fi
++ DRI_DIRS="r200 radeon swrast"
++ fi
+ ;;
+ sparc*)
+ # Build only the drivers for cards that exist on SPARC.
+ if test "x$DRI_DIRS" = "xyes"; then
-+ DRI_DIRS="mach64 r128 r200 r300 r600 radeon swrast"
++ DRI_DIRS="r200 radeon swrast"
+ fi
+ ;;
+ esac
++
;;
gnu*)
DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER"
+@@ -21684,6 +21717,81 @@
+ if test "x$enable_gbm" = xyes; then
+ SRC_DIRS="$SRC_DIRS gbm"
+
++ case "$host_os" in
++ *freebsd*)
++
++pkg_failed=no
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for LIBDEVQ" >&5
++$as_echo_n "checking for LIBDEVQ... " >&6; }
++
++if test -n "$LIBDEVQ_CFLAGS"; then
++ pkg_cv_LIBDEVQ_CFLAGS="$LIBDEVQ_CFLAGS"
++ elif test -n "$PKG_CONFIG"; then
++ if test -n "$PKG_CONFIG" && \
++ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libdevq-1.0\""; } >&5
++ ($PKG_CONFIG --exists --print-errors "libdevq-1.0") 2>&5
++ ac_status=$?
++ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
++ test $ac_status = 0; }; then
++ pkg_cv_LIBDEVQ_CFLAGS=`$PKG_CONFIG --cflags "libdevq-1.0" 2>/dev/null`
++ test "x$?" != "x0" && pkg_failed=yes
++else
++ pkg_failed=yes
++fi
++ else
++ pkg_failed=untried
++fi
++if test -n "$LIBDEVQ_LIBS"; then
++ pkg_cv_LIBDEVQ_LIBS="$LIBDEVQ_LIBS"
++ elif test -n "$PKG_CONFIG"; then
++ if test -n "$PKG_CONFIG" && \
++ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libdevq-1.0\""; } >&5
++ ($PKG_CONFIG --exists --print-errors "libdevq-1.0") 2>&5
++ ac_status=$?
++ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
++ test $ac_status = 0; }; then
++ pkg_cv_LIBDEVQ_LIBS=`$PKG_CONFIG --libs "libdevq-1.0" 2>/dev/null`
++ test "x$?" != "x0" && pkg_failed=yes
++else
++ pkg_failed=yes
++fi
++ else
++ pkg_failed=untried
++fi
++
++
++
++if test $pkg_failed = yes; then
++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
++$as_echo "no" >&6; }
++
++if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
++ _pkg_short_errors_supported=yes
++else
++ _pkg_short_errors_supported=no
++fi
++ if test $_pkg_short_errors_supported = yes; then
++ LIBDEVQ_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libdevq-1.0" 2>&1`
++ else
++ LIBDEVQ_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libdevq-1.0" 2>&1`
++ fi
++ # Put the nasty error message in config.log where it belongs
++ echo "$LIBDEVQ_PKG_ERRORS" >&5
++
++ as_fn_error $? "gbm needs libdevq" "$LINENO" 5
++elif test $pkg_failed = untried; then
++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
++$as_echo "no" >&6; }
++ as_fn_error $? "gbm needs libdevq" "$LINENO" 5
++else
++ LIBDEVQ_CFLAGS=$pkg_cv_LIBDEVQ_CFLAGS
++ LIBDEVQ_LIBS=$pkg_cv_LIBDEVQ_LIBS
++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
++$as_echo "yes" >&6; }
++
++fi
++ ;;
++ *)
+
+ pkg_failed=no
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for LIBUDEV" >&5
+@@ -21755,6 +21863,8 @@
+ $as_echo "yes" >&6; }
+
+ fi
++ ;;
++ esac
+
+ if test "x$enable_dri" = xyes; then
+ GBM_BACKEND_DIRS="$GBM_BACKEND_DIRS dri"
+@@ -21763,7 +21873,14 @@
+ fi
+ fi
+ fi
+-GBM_PC_REQ_PRIV="libudev"
++case "$host_os" in
++*freebsd*)
++ GBM_PC_REQ_PRIV="libdevq-1.0"
++ ;;
++*)
++ GBM_PC_REQ_PRIV="libudev"
++ ;;
++esac
+ GBM_PC_LIB_PRIV="$DLOPEN_LIBS"
+
+
+@@ -21782,6 +21899,81 @@
+
+ if test "$enable_static" != yes; then
+ # build egl_glx when libGL is built
++ case "$host_os" in
++ *freebsd*)
++
++pkg_failed=no
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for LIBDEVQ" >&5
++$as_echo_n "checking for LIBDEVQ... " >&6; }
++
++if test -n "$LIBDEVQ_CFLAGS"; then
++ pkg_cv_LIBDEVQ_CFLAGS="$LIBDEVQ_CFLAGS"
++ elif test -n "$PKG_CONFIG"; then
++ if test -n "$PKG_CONFIG" && \
++ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libdevq-1.0\""; } >&5
++ ($PKG_CONFIG --exists --print-errors "libdevq-1.0") 2>&5
++ ac_status=$?
++ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
++ test $ac_status = 0; }; then
++ pkg_cv_LIBDEVQ_CFLAGS=`$PKG_CONFIG --cflags "libdevq-1.0" 2>/dev/null`
++ test "x$?" != "x0" && pkg_failed=yes
++else
++ pkg_failed=yes
++fi
++ else
++ pkg_failed=untried
++fi
++if test -n "$LIBDEVQ_LIBS"; then
++ pkg_cv_LIBDEVQ_LIBS="$LIBDEVQ_LIBS"
++ elif test -n "$PKG_CONFIG"; then
++ if test -n "$PKG_CONFIG" && \
++ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libdevq-1.0\""; } >&5
++ ($PKG_CONFIG --exists --print-errors "libdevq-1.0") 2>&5
++ ac_status=$?
++ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
++ test $ac_status = 0; }; then
++ pkg_cv_LIBDEVQ_LIBS=`$PKG_CONFIG --libs "libdevq-1.0" 2>/dev/null`
++ test "x$?" != "x0" && pkg_failed=yes
++else
++ pkg_failed=yes
++fi
++ else
++ pkg_failed=untried
++fi
++
++
++
++if test $pkg_failed = yes; then
++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
++$as_echo "no" >&6; }
++
++if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
++ _pkg_short_errors_supported=yes
++else
++ _pkg_short_errors_supported=no
++fi
++ if test $_pkg_short_errors_supported = yes; then
++ LIBDEVQ_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libdevq-1.0" 2>&1`
++ else
++ LIBDEVQ_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libdevq-1.0" 2>&1`
++ fi
++ # Put the nasty error message in config.log where it belongs
++ echo "$LIBDEVQ_PKG_ERRORS" >&5
++
++ have_libdevq=no
++elif test $pkg_failed = untried; then
++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
++$as_echo "no" >&6; }
++ have_libdevq=no
++else
++ LIBDEVQ_CFLAGS=$pkg_cv_LIBDEVQ_CFLAGS
++ LIBDEVQ_LIBS=$pkg_cv_LIBDEVQ_LIBS
++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
++$as_echo "yes" >&6; }
++ have_libdevq=yes
++fi
++ ;;
++ *)
+
+ pkg_failed=no
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for LIBUDEV" >&5
+@@ -21853,8 +22045,12 @@
+ $as_echo "yes" >&6; }
+ have_libudev=yes
+ fi
++ ;;
++ esac
+ if test "$have_libudev" = yes; then
+ DEFINES="$DEFINES -DHAVE_LIBUDEV"
++ elif test "$have_libdevq" = yes; then
++ DEFINES="$DEFINES -DHAVE_LIBDEVQ"
+ fi
+
+ if test "x$enable_dri" = xyes; then
+@@ -23053,9 +23249,19 @@
+ ;;
+ esac
+
+- case "$plat$have_libudev" in
+- waylandno|drmno)
+- as_fn_error $? "cannot build $plat platfrom without udev" "$LINENO" 5 ;;
++ case "$host_os" in
++ *freebsd*)
++ case "$plat$have_libdevq" in
++ waylandno|drmno)
++ as_fn_error $? "cannot build $plat platfrom without libdevq" "$LINENO" 5 ;;
++ esac
++ ;;
++ *)
++ case "$plat$have_libudev" in
++ waylandno|drmno)
++ as_fn_error $? "cannot build $plat platfrom without udev" "$LINENO" 5 ;;
++ esac
++ ;;
+ esac
+ done
+
+@@ -23348,29 +23554,6 @@
+ CLANG_LIBDIR=${LLVM_LIBDIR}
+ fi
+ CLANG_RESOURCE_DIR=$CLANG_LIBDIR/clang/${LLVM_VERSION}
+- as_ac_File=`$as_echo "ac_cv_file_"$CLANG_RESOURCE_DIR/include/stddef.h"" | $as_tr_sh`
+-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for \"$CLANG_RESOURCE_DIR/include/stddef.h\"" >&5
+-$as_echo_n "checking for \"$CLANG_RESOURCE_DIR/include/stddef.h\"... " >&6; }
+-if eval \${$as_ac_File+:} false; then :
+- $as_echo_n "(cached) " >&6
+-else
+- test "$cross_compiling" = yes &&
+- as_fn_error $? "cannot check for file existence when cross compiling" "$LINENO" 5
+-if test -r ""$CLANG_RESOURCE_DIR/include/stddef.h""; then
+- eval "$as_ac_File=yes"
+-else
+- eval "$as_ac_File=no"
+-fi
+-fi
+-eval ac_res=\$$as_ac_File
+- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+-$as_echo "$ac_res" >&6; }
+-if eval test \"x\$"$as_ac_File"\" = x"yes"; then :
+-
+-else
+- as_fn_error $? "Could not find clang internal header stddef.h in $CLANG_RESOURCE_DIR Use --with-clang-libdir to specify the correct path to the clang libraries." "$LINENO" 5
+-fi
+-
+ fi
+ else
+ MESA_LLVM=0
+@@ -23453,6 +23636,81 @@
+
+ gallium_require_drm_loader() {
+ if test "x$enable_gallium_loader" = xyes; then
++ case "$host_os" in
++ *freebsd*)
++
++pkg_failed=no
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for LIBDEVQ" >&5
++$as_echo_n "checking for LIBDEVQ... " >&6; }
++
++if test -n "$LIBDEVQ_CFLAGS"; then
++ pkg_cv_LIBDEVQ_CFLAGS="$LIBDEVQ_CFLAGS"
++ elif test -n "$PKG_CONFIG"; then
++ if test -n "$PKG_CONFIG" && \
++ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libdevq-1.0\""; } >&5
++ ($PKG_CONFIG --exists --print-errors "libdevq-1.0") 2>&5
++ ac_status=$?
++ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
++ test $ac_status = 0; }; then
++ pkg_cv_LIBDEVQ_CFLAGS=`$PKG_CONFIG --cflags "libdevq-1.0" 2>/dev/null`
++ test "x$?" != "x0" && pkg_failed=yes
++else
++ pkg_failed=yes
++fi
++ else
++ pkg_failed=untried
++fi
++if test -n "$LIBDEVQ_LIBS"; then
++ pkg_cv_LIBDEVQ_LIBS="$LIBDEVQ_LIBS"
++ elif test -n "$PKG_CONFIG"; then
++ if test -n "$PKG_CONFIG" && \
++ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libdevq-1.0\""; } >&5
++ ($PKG_CONFIG --exists --print-errors "libdevq-1.0") 2>&5
++ ac_status=$?
++ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
++ test $ac_status = 0; }; then
++ pkg_cv_LIBDEVQ_LIBS=`$PKG_CONFIG --libs "libdevq-1.0" 2>/dev/null`
++ test "x$?" != "x0" && pkg_failed=yes
++else
++ pkg_failed=yes
++fi
++ else
++ pkg_failed=untried
++fi
++
++
++
++if test $pkg_failed = yes; then
++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
++$as_echo "no" >&6; }
++
++if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
++ _pkg_short_errors_supported=yes
++else
++ _pkg_short_errors_supported=no
++fi
++ if test $_pkg_short_errors_supported = yes; then
++ LIBDEVQ_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libdevq-1.0" 2>&1`
++ else
++ LIBDEVQ_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libdevq-1.0" 2>&1`
++ fi
++ # Put the nasty error message in config.log where it belongs
++ echo "$LIBDEVQ_PKG_ERRORS" >&5
++
++ as_fn_error $? "Gallium drm loader requires libdevq" "$LINENO" 5
++elif test $pkg_failed = untried; then
++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
++$as_echo "no" >&6; }
++ as_fn_error $? "Gallium drm loader requires libdevq" "$LINENO" 5
++else
++ LIBDEVQ_CFLAGS=$pkg_cv_LIBDEVQ_CFLAGS
++ LIBDEVQ_LIBS=$pkg_cv_LIBDEVQ_LIBS
++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
++$as_echo "yes" >&6; }
++
++fi
++ ;;
++ *)
+
+ pkg_failed=no
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for LIBUDEV" >&5
+@@ -23524,6 +23782,8 @@
+ $as_echo "yes" >&6; }
+
+ fi
++ ;;
++ esac
+ if test "x$have_libdrm" != xyes; then
+ as_fn_error $? "Gallium drm loader requires libdrm >= $LIBDRM_REQUIRED" "$LINENO" 5
+ fi
+@@ -23534,7 +23794,7 @@
+ radeon_llvm_check() {
+ LLVM_REQUIRED_VERSION_MAJOR="3"
+ LLVM_REQUIRED_VERSION_MINOR="2"
+- if test "$LLVM_VERSION_INT" -ne "${LLVM_REQUIRED_VERSION_MAJOR}0${LLVM_REQUIRED_VERSION_MINOR}"; then
++ if test "$LLVM_VERSION_INT" -lt "${LLVM_REQUIRED_VERSION_MAJOR}0${LLVM_REQUIRED_VERSION_MINOR}"; then
+ as_fn_error $? "LLVM $LLVM_REQUIRED_VERSION_MAJOR.$LLVM_REQUIRED_VERSION_MINOR with R600 target enabled is required.
+ To use the r600/radeonsi LLVM backend, you need to fetch the LLVM source from:
+ git://people.freedesktop.org/~tstellar/llvm master
diff --git a/graphics/libGL/files-old/patch-mach64_context.h b/graphics/libGL/files-old/patch-mach64_context.h
deleted file mode 100644
index 9e3b38e357cd..000000000000
--- a/graphics/libGL/files-old/patch-mach64_context.h
+++ /dev/null
@@ -1,20 +0,0 @@
---- src/mesa/drivers/dri/mach64/mach64_context.h.orig 2012-06-27 19:59:32.000000000 +0200
-+++ src/mesa/drivers/dri/mach64/mach64_context.h 2012-06-27 20:08:30.000000000 +0200
-@@ -294,11 +294,14 @@
- #define LE32_OUT( x, y ) do { *(GLuint *)(x) = (y); } while (0)
- #define LE32_OUT_FLOAT( x, y ) do { *(GLfloat *)(x) = (y); } while (0)
- #else
--#ifndef __OpenBSD__
--#include <byteswap.h>
--#else
-+#if defined(__OpenBSD__)
- #include <machine/endian.h>
- #define bswap_32 bswap32
-+#elif defined(__FreeBSD__)
-+#include <sys/endian.h>
-+#define bswap_32 bswap32
-+#else
-+#include <byteswap.h>
- #endif
-
- #define LE32_IN( x ) bswap_32( *(GLuint *)(x) )
diff --git a/graphics/libGL/files/patch-src-glsl_ir_constant_expression.cpp b/graphics/libGL/files-old/patch-src-glsl_ir_constant_expression.cpp
index 8df40432dfc9..8df40432dfc9 100644
--- a/graphics/libGL/files/patch-src-glsl_ir_constant_expression.cpp
+++ b/graphics/libGL/files-old/patch-src-glsl_ir_constant_expression.cpp
diff --git a/graphics/libGL/files-old/patch-src__egl__drivers__dri2__Makefile.in b/graphics/libGL/files-old/patch-src__egl__drivers__dri2__Makefile.in
new file mode 100644
index 000000000000..50ca60d9aff5
--- /dev/null
+++ b/graphics/libGL/files-old/patch-src__egl__drivers__dri2__Makefile.in
@@ -0,0 +1,21 @@
+--- src/egl/drivers/dri2/Makefile.in.orig 2014-05-20 21:03:39.000000000 +0200
++++ src/egl/drivers/dri2/Makefile.in 2014-05-20 21:14:20.000000000 +0200
+@@ -289,6 +289,8 @@
+ LIBTOOL = @LIBTOOL@
+ LIBUDEV_CFLAGS = @LIBUDEV_CFLAGS@
+ LIBUDEV_LIBS = @LIBUDEV_LIBS@
++LIBDEVQ_CFLAGS= @LIBDEVQ_CFLAGS@
++LIBDEVQ_LIBS = @LIBDEVQ_LIBS@
+ LIB_DIR = @LIB_DIR@
+ LIPO = @LIPO@
+ LLVM_BINDIR = @LLVM_BINDIR@
+@@ -455,7 +457,8 @@
+ -I$(top_srcdir)/src/egl/wayland/wayland-egl \
+ -I$(top_srcdir)/src/egl/wayland/wayland-drm \
+ -I$(top_builddir)/src/egl/wayland/wayland-drm $(DEFINES) \
+- $(LIBDRM_CFLAGS) $(LIBUDEV_CFLAGS) $(LIBKMS_CFLAGS) \
++ $(LIBDRM_CFLAGS) $(LIBUDEV_CFLAGS) $(LIBDEVQ_CFLAGS) \
++ $(LIBKMS_CFLAGS) \
+ -DDEFAULT_DRIVER_DIR=\"$(DRI_DRIVER_SEARCH_DIR)\" \
+ $(am__append_1) $(am__append_3) $(am__append_5) \
+ $(am__append_7)
diff --git a/graphics/libGL/files-old/patch-src__egl__drivers__dri2__common.c b/graphics/libGL/files-old/patch-src__egl__drivers__dri2__common.c
new file mode 100644
index 000000000000..73c4f8169d5b
--- /dev/null
+++ b/graphics/libGL/files-old/patch-src__egl__drivers__dri2__common.c
@@ -0,0 +1,87 @@
+--- src/egl/drivers/dri2/common.c.orig 2012-11-24 18:57:41.000000000 +0100
++++ src/egl/drivers/dri2/common.c 2014-03-02 11:36:35.000000000 +0100
+@@ -35,11 +35,11 @@
+
+ #include "egl_dri2.h"
+
+-#ifdef HAVE_LIBUDEV
+-
+ #define DRIVER_MAP_DRI2_ONLY
+ #include "pci_ids/pci_id_driver_map.h"
+
++#ifdef HAVE_LIBUDEV
++
+ #include <libudev.h>
+
+ static struct udev_device *
+@@ -141,4 +141,70 @@
+ return driver;
+ }
+
++#elif defined(HAVE_LIBDEVQ)
++
++#include <libdevq.h>
++#include <stdlib.h>
++
++char *
++dri2_get_device_name_for_fd(int fd)
++{
++ int ret;
++ char *device_name = NULL;
++ size_t device_name_len;
++
++ ret = devq_device_get_devpath_from_fd(fd,
++ NULL, &device_name_len);
++ if (ret < 0)
++ return (NULL);
++
++ device_name = malloc(device_name_len + 1);
++ ret = devq_device_get_devpath_from_fd(fd,
++ device_name, &device_name_len);
++ if (ret < 0) {
++ free(device_name);
++ return (NULL);
++ }
++
++ device_name[device_name_len] = '\0';
++
++ return device_name;
++}
++
++char *
++dri2_get_driver_for_fd(int fd)
++{
++ int ret;
++ char *driver = NULL;
++ int vendor_id, chip_id, i, j;
++
++ ret = devq_device_get_pciid_from_fd(fd, &vendor_id, &chip_id);
++ if (ret < 0) {
++ _eglLog(_EGL_WARNING, "EGL-DRI2: malformed or no PCI ID");
++ goto out;
++ }
++
++ for (i = 0; driver_map[i].driver; i++) {
++ if (vendor_id != driver_map[i].vendor_id)
++ continue;
++ if (driver_map[i].num_chips_ids == -1) {
++ driver = strdup(driver_map[i].driver);
++ _eglLog(_EGL_DEBUG, "pci id for %d: %04x:%04x, driver %s",
++ fd, vendor_id, chip_id, driver);
++ goto out;
++ }
++
++ for (j = 0; j < driver_map[i].num_chips_ids; j++)
++ if (driver_map[i].chip_ids[j] == chip_id) {
++ driver = strdup(driver_map[i].driver);
++ _eglLog(_EGL_DEBUG, "pci id for %d: %04x:%04x, driver %s",
++ fd, vendor_id, chip_id, driver);
++ goto out;
++ }
++ }
++
++out:
++ return driver;
++}
++
+ #endif /* HAVE_LIBUDEV */
diff --git a/graphics/libGL/files-old/patch-src__egl__drivers__glx__Makefile.in b/graphics/libGL/files-old/patch-src__egl__drivers__glx__Makefile.in
new file mode 100644
index 000000000000..701071759daf
--- /dev/null
+++ b/graphics/libGL/files-old/patch-src__egl__drivers__glx__Makefile.in
@@ -0,0 +1,19 @@
+--- src/egl/drivers/glx/Makefile.in.orig 2014-05-20 21:15:30.000000000 +0200
++++ src/egl/drivers/glx/Makefile.in 2014-05-20 21:16:33.000000000 +0200
+@@ -273,6 +273,8 @@
+ LIBTOOL = @LIBTOOL@
+ LIBUDEV_CFLAGS = @LIBUDEV_CFLAGS@
+ LIBUDEV_LIBS = @LIBUDEV_LIBS@
++LIBDEVQ_CFLAGS = @LIBDEVQ_CFLAGS@
++LIBDEVQ_LIBS = @LIBDEVQ_LIBS@
+ LIB_DIR = @LIB_DIR@
+ LIPO = @LIPO@
+ LLVM_BINDIR = @LLVM_BINDIR@
+@@ -442,6 +444,7 @@
+ noinst_LTLIBRARIES = libegl_glx.la
+ libegl_glx_la_SOURCES = egl_glx.c
+ libegl_glx_la_LIBADD = \
++ $(LIBDEVQ_LIBS) \
+ $(EGL_LIB_DEPS)
+
+ all: all-am
diff --git a/graphics/libGL/files-old/patch-src__gallium__auxiliary__pipe-loader__pipe_loader_drm.c b/graphics/libGL/files-old/patch-src__gallium__auxiliary__pipe-loader__pipe_loader_drm.c
new file mode 100644
index 000000000000..071391b49d98
--- /dev/null
+++ b/graphics/libGL/files-old/patch-src__gallium__auxiliary__pipe-loader__pipe_loader_drm.c
@@ -0,0 +1,43 @@
+--- ./src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c.orig 2014-02-03 18:42:39.000000000 +0100
++++ ./src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c 2014-02-15 21:11:55.000000000 +0100
+@@ -32,7 +32,14 @@
+
+ #include <fcntl.h>
+ #include <stdio.h>
++
++#if defined(HAVE_LIBUDEV)
+ #include <libudev.h>
++#elif defined(HAVE_LIBDEVQ)
++#include <libdevq.h>
++#include <stdlib.h>
++#endif
++
+ #include <xf86drm.h>
+
+ #ifdef HAVE_PIPE_LOADER_XCB
+@@ -62,6 +69,7 @@
+ static boolean
+ find_drm_pci_id(struct pipe_loader_drm_device *ddev)
+ {
++#if defined(HAVE_LIBUDEV)
+ struct udev *udev = NULL;
+ struct udev_device *parent, *device = NULL;
+ struct stat stat;
+@@ -100,6 +108,17 @@
+ udev_unref(udev);
+
+ return FALSE;
++#elif defined(HAVE_LIBDEVQ)
++ int ret;
++
++ ret = devq_device_get_pciid_from_fd(ddev->fd,
++ &ddev->base.u.pci.vendor_id,
++ &ddev->base.u.pci.chip_id);
++ if (ret < 0)
++ return FALSE;
++
++ return TRUE;
++#endif
+ }
+
+ static boolean
diff --git a/graphics/libGL/files-old/patch-src__gallium__include__pipe__p_config.h b/graphics/libGL/files-old/patch-src__gallium__include__pipe__p_config.h
new file mode 100644
index 000000000000..be72edbcf99b
--- /dev/null
+++ b/graphics/libGL/files-old/patch-src__gallium__include__pipe__p_config.h
@@ -0,0 +1,16 @@
+--- ./src/gallium/include/pipe/p_config.h.orig 2014-02-03 18:42:39.000000000 +0100
++++ ./src/gallium/include/pipe/p_config.h 2014-02-15 21:11:34.000000000 +0100
+@@ -81,6 +81,13 @@
+ #define PIPE_CC_SUNPRO
+ #endif
+
++#if defined(__sparc__) || defined(__sparc64__)
++#define PIPE_ARCH_SPARC
++#if defined(__sparc64__)
++#define PIPE_ARCH_SPARC_64
++#endif
++#endif
++
+
+ /*
+ * Processor architecture
diff --git a/graphics/libGL/files-old/patch-src__gallium__state_trackers__egl__drm__native_drm.c b/graphics/libGL/files-old/patch-src__gallium__state_trackers__egl__drm__native_drm.c
new file mode 100644
index 000000000000..701b7fcf0558
--- /dev/null
+++ b/graphics/libGL/files-old/patch-src__gallium__state_trackers__egl__drm__native_drm.c
@@ -0,0 +1,42 @@
+--- ./src/gallium/state_trackers/egl/drm/native_drm.c.orig 2014-02-03 18:42:39.000000000 +0100
++++ ./src/gallium/state_trackers/egl/drm/native_drm.c 2014-02-15 21:11:55.000000000 +0100
+@@ -35,8 +35,11 @@
+
+ #include "gbm_gallium_drmint.h"
+
+-#ifdef HAVE_LIBUDEV
++#if defined(HAVE_LIBUDEV)
+ #include <libudev.h>
++#elif defined(HAVE_LIBDEVQ)
++#include <libdevq.h>
++#include <stdlib.h>
+ #endif
+
+ static boolean
+@@ -183,8 +186,26 @@
+ udev_device_unref(device);
+ outudev:
+ udev_unref(udev);
++#elif defined(HAVE_LIBDEVQ)
++ int ret;
++ size_t device_name_len;
+
++ ret = devq_device_get_devpath_from_fd(fd,
++ NULL, &device_name_len);
++ if (ret < 0)
++ return (NULL);
++
++ device_name = malloc(device_name_len + 1);
++ ret = devq_device_get_devpath_from_fd(fd,
++ device_name, &device_name_len);
++ if (ret < 0) {
++ free(device_name);
++ return (NULL);
++ }
++
++ device_name[device_name_len] = '\0';
+ #endif
++
+ return device_name;
+ }
+
diff --git a/graphics/libGL/files-old/patch-src__gallium__state_trackers__xvmc__tests__xvmc_bench.c b/graphics/libGL/files-old/patch-src__gallium__state_trackers__xvmc__tests__xvmc_bench.c
new file mode 100644
index 000000000000..367424c73d98
--- /dev/null
+++ b/graphics/libGL/files-old/patch-src__gallium__state_trackers__xvmc__tests__xvmc_bench.c
@@ -0,0 +1,52 @@
+--- src/gallium/state_trackers/xvmc/tests/xvmc_bench.c.orig 2013-10-05 03:59:22.000000000 +0000
++++ src/gallium/state_trackers/xvmc/tests/xvmc_bench.c 2014-10-16 13:46:30.000000000 +0000
+@@ -27,9 +27,10 @@
+
+ #include <assert.h>
+ #include <stdio.h>
++#include <stdlib.h>
+ #include <string.h>
+-#include <error.h>
+ #include <sys/time.h>
++#include <unistd.h>
+ #include "testlib.h"
+
+ #define MACROBLOCK_WIDTH 16
+@@ -144,23 +145,10 @@
+ }
+
+ if (fail)
+- error
+- (
+- 1, 0,
+- "Bad argument.\n"
+- "\n"
+- "Usage: %s [options]\n"
+- "\t-iw <width>\tInput width\n"
+- "\t-ih <height>\tInput height\n"
+- "\t-ow <width>\tOutput width\n"
+- "\t-oh <height>\tOutput height\n"
+- "\t-p <pipeline>\tPipeline to test\n"
+- "\t-mb <mb type>\tMacroBlock types to use\n"
+- "\t-r <reps>\tRepetitions\n\n"
+- "\tPipeline steps: mc,csc,swap\n"
+- "\tMB types: i,p,b\n",
+- argv[0]
+- );
++ {
++ printf ("error happened\n");
++ exit(1);
++ }
+
+ if (config->output_width == 0)
+ config->output_width = config->input_width;
+@@ -214,7 +202,8 @@
+ ))
+ {
+ XCloseDisplay(display);
+- error(1, 0, "Error, unable to find a good port.\n");
++ printf("Error, unable to find a good port.\n");
++ exit(1);
+ }
+
+ if (is_overlay)
diff --git a/graphics/libGL/files-old/patch-src__gallium__targets__egl-static__egl.c b/graphics/libGL/files-old/patch-src__gallium__targets__egl-static__egl.c
new file mode 100644
index 000000000000..225cdc49c4ab
--- /dev/null
+++ b/graphics/libGL/files-old/patch-src__gallium__targets__egl-static__egl.c
@@ -0,0 +1,37 @@
+--- ./src/gallium/targets/egl-static/egl.c.orig 2014-02-03 18:42:39.000000000 +0100
++++ ./src/gallium/targets/egl-static/egl.c 2014-02-15 21:11:55.000000000 +0100
+@@ -29,9 +29,12 @@
+ #include "egldriver.h"
+ #include "egllog.h"
+
+-#ifdef HAVE_LIBUDEV
++#if defined(HAVE_LIBUDEV)
+ #include <stdio.h> /* for sscanf */
+ #include <libudev.h>
++#elif defined(HAVE_LIBDEVQ)
++#include <libdevq.h>
++#include <stdlib.h>
+ #endif
+
+ #define DRIVER_MAP_GALLIUM_ONLY
+@@ -108,6 +111,20 @@
+ return (*chip_id >= 0);
+ }
+
++#elif defined(HAVE_LIBDEVQ)
++
++static boolean
++drm_fd_get_pci_id(int fd, int *vendor_id, int *chip_id)
++{
++ int ret;
++
++ ret = devq_device_get_pciid_from_fd(fd, vendor_id, chip_id);
++ if (ret < 0)
++ return FALSE;
++
++ return TRUE;
++}
++
+ #elif defined(PIPE_OS_ANDROID) && !defined(_EGL_NO_DRM)
+
+ #include <xf86drm.h>
diff --git a/graphics/libGL/files-old/patch-src__gallium__targets__gbm__Makefile.in b/graphics/libGL/files-old/patch-src__gallium__targets__gbm__Makefile.in
new file mode 100644
index 000000000000..dd55acc5ad24
--- /dev/null
+++ b/graphics/libGL/files-old/patch-src__gallium__targets__gbm__Makefile.in
@@ -0,0 +1,29 @@
+--- src/gallium/targets/gbm/Makefile.in.orig 2014-03-02 12:23:28.000000000 +0100
++++ src/gallium/targets/gbm/Makefile.in 2014-03-02 12:23:59.000000000 +0100
+@@ -157,7 +157,7 @@
+ $(top_builddir)/src/gallium/state_trackers/gbm/libgbm.la \
+ $(top_builddir)/src/gallium/auxiliary/libgallium.la \
+ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+- $(am__DEPENDENCIES_2)
++ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2)
+ am_gbm_gallium_drm_la_OBJECTS = gbm.lo
+ gbm_gallium_drm_la_OBJECTS = $(am_gbm_gallium_drm_la_OBJECTS)
+ AM_V_P = $(am__v_P_@AM_V@)
+@@ -554,6 +554,7 @@
+ AM_CFLAGS = \
+ $(GALLIUM_CFLAGS) \
+ $(LIBUDEV_CFLAGS) \
++ $(LIBDEVQ_CFLAGS) \
+ $(LIBDRM_CFLAGS)
+
+ gbm_LTLIBRARIES = gbm_gallium_drm.la
+@@ -561,7 +562,8 @@
+ gbm_gallium_drm_la_LIBADD = $(GALLIUM_PIPE_LOADER_LIBS) \
+ $(top_builddir)/src/gallium/state_trackers/gbm/libgbm.la \
+ $(top_builddir)/src/gallium/auxiliary/libgallium.la \
+- $(LIBUDEV_LIBS) $(LIBDRM_LIBS) -lm $(am__append_1)
++ $(LIBUDEV_LIBS) $(LIBDEVQ_LIBS) $(LIBDRM_LIBS) -lm \
++ $(am__append_1)
+ gbm_gallium_drm_la_LDFLAGS = -no-undefined -avoid-version -module \
+ $(am__append_2)
+ @HAVE_MESA_LLVM_FALSE@gbm_gallium_drm_la_LINK = $(CXXLINK) $(gbm_gallium_drm_la_LDFLAGS)
diff --git a/graphics/libGL/files-old/patch-src__gbm__Makefile.in b/graphics/libGL/files-old/patch-src__gbm__Makefile.in
new file mode 100644
index 000000000000..07e196e31dc4
--- /dev/null
+++ b/graphics/libGL/files-old/patch-src__gbm__Makefile.in
@@ -0,0 +1,42 @@
+--- src/gbm/Makefile.in.orig 2014-05-20 21:18:10.000000000 +0200
++++ src/gbm/Makefile.in 2014-05-20 21:19:09.000000000 +0200
+@@ -107,7 +107,7 @@
+ LTLIBRARIES = $(lib_LTLIBRARIES) $(noinst_LTLIBRARIES)
+ am__DEPENDENCIES_1 =
+ libgbm_la_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+- $(am__append_2)
++ $(am__DEPENDENCIES_1) $(am__append_2)
+ am_libgbm_la_OBJECTS = gbm.lo backend.lo common.lo
+ libgbm_la_OBJECTS = $(am_libgbm_la_OBJECTS)
+ AM_V_lt = $(am__v_lt_@AM_V@)
+@@ -303,6 +303,8 @@
+ LIBTOOL = @LIBTOOL@
+ LIBUDEV_CFLAGS = @LIBUDEV_CFLAGS@
+ LIBUDEV_LIBS = @LIBUDEV_LIBS@
++LIBDEVQ_CFLAGS = @LIBDEVQ_CFLAGS@
++LIBDEVQ_LIBS = @LIBDEVQ_LIBS@
+ LIB_DIR = @LIB_DIR@
+ LIPO = @LIPO@
+ LLVM_BINDIR = @LLVM_BINDIR@
+@@ -467,8 +469,8 @@
+ pkgconfig_DATA = main/gbm.pc
+ AM_CFLAGS = -D_OS_UNIX=1 -DMODULEDIR='"$(libdir)/gbm"' \
+ -I$(top_srcdir)/include -I$(top_srcdir)/src/gbm/main \
+- $(LIBUDEV_CFLAGS) $(LIBKMS_CFLAGS) $(DLOPEN_CFLAGS) $(DEFINES) \
+- $(am__append_1)
++ $(LIBUDEV_CFLAGS) $(LIBDEVQ_CFLAGS) $(LIBKMS_CFLAGS) \
++ $(DLOPEN_CFLAGS) $(DEFINES) $(am__append_1)
+ lib_LTLIBRARIES = libgbm.la
+ include_HEADERS = main/gbm.h
+ libgbm_la_SOURCES = \
+@@ -477,8 +479,8 @@
+ main/common.c
+
+ libgbm_la_LDFLAGS = -version-info 1:0
+-libgbm_la_LIBADD = $(LIBUDEV_LIBS) $(LIBKMS_LIBS) $(DLOPEN_LIBS) \
+- $(am__append_2)
++libgbm_la_LIBADD = $(LIBUDEV_LIBS) $(LIBDEVQ_LIBS) $(LIBKMS_LIBS) \
++ $(DLOPEN_LIBS) $(am__append_2)
+ @HAVE_EGL_PLATFORM_WAYLAND_TRUE@AM_CPPFLAGS = -DHAVE_WAYLAND_PLATFORM
+ @HAVE_DRI_TRUE@noinst_LTLIBRARIES = libgbm_dri.la
+ @HAVE_DRI_TRUE@libgbm_dri_la_SOURCES = \
diff --git a/graphics/libGL/files-old/patch-src__gbm__backends__dri__driver_name.c b/graphics/libGL/files-old/patch-src__gbm__backends__dri__driver_name.c
new file mode 100644
index 000000000000..ac73872f94ff
--- /dev/null
+++ b/graphics/libGL/files-old/patch-src__gbm__backends__dri__driver_name.c
@@ -0,0 +1,53 @@
+--- ./src/gbm/backends/dri/driver_name.c.orig 2014-02-03 18:42:39.000000000 +0100
++++ ./src/gbm/backends/dri/driver_name.c 2014-02-15 21:11:55.000000000 +0100
+@@ -29,7 +29,12 @@
+ #include <stdio.h>
+ #include <string.h>
+
++#if defined(HAVE_LIBUDEV)
+ #include <libudev.h>
++#elif defined(HAVE_LIBDEVQ)
++#include <libdevq.h>
++#include <stdlib.h>
++#endif
+
+ #include "gbm_driint.h"
+ #define DRIVER_MAP_DRI2_ONLY
+@@ -38,10 +43,12 @@
+ char *
+ dri_fd_get_driver_name(int fd)
+ {
++ char *driver = NULL;
++
++#if defined(HAVE_LIBUDEV)
+ struct udev *udev;
+ struct udev_device *device, *parent;
+ const char *pci_id;
+- char *driver = NULL;
+ int vendor_id, chip_id, i, j;
+
+ udev = udev_new();
+@@ -84,6 +91,23 @@
+ out:
+ udev_device_unref(device);
+ udev_unref(udev);
++#elif defined(HAVE_LIBDEVQ)
++ int ret;
++ size_t driver_len;
++
++ ret = devq_device_drm_get_drvname_from_fd(fd, NULL, &driver_len);
++ if (ret < 0)
++ return (NULL);
++
++ driver = malloc(driver_len + 1);
++ ret = devq_device_drm_get_drvname_from_fd(fd, driver, &driver_len);
++ if (ret < 0) {
++ free(driver);
++ return (NULL);
++ }
++
++ driver[driver_len] = '\0';
++#endif
+
+ return driver;
+ }
diff --git a/graphics/libGL/files-old/patch-src__gbm__main__common.c b/graphics/libGL/files-old/patch-src__gbm__main__common.c
new file mode 100644
index 000000000000..662d0229694b
--- /dev/null
+++ b/graphics/libGL/files-old/patch-src__gbm__main__common.c
@@ -0,0 +1,69 @@
+--- ./src/gbm/main/common.c.orig 2014-02-03 18:42:39.000000000 +0100
++++ ./src/gbm/main/common.c 2014-02-15 21:11:55.000000000 +0100
+@@ -28,7 +28,13 @@
+ #include <stdio.h>
+ #include <string.h>
+
++#if defined(HAVE_LIBUDEV)
+ #include <libudev.h>
++#elif defined(HAVE_LIBDEVQ)
++#include <libdevq.h>
++#include <stdlib.h>
++#endif
++
+ #include <sys/types.h>
+ #include <sys/stat.h>
+ #include <unistd.h>
+@@ -36,6 +42,7 @@
+ #include "common.h"
+ #include "gbmint.h"
+
++#if defined(HAVE_LIBUDEV)
+ GBM_EXPORT struct udev_device *
+ _gbm_udev_device_new_from_fd(struct udev *udev, int fd)
+ {
+@@ -56,14 +63,17 @@
+
+ return device;
+ }
++#endif /* defined(HAVE_LIBUDEV) */
+
+ GBM_EXPORT char *
+ _gbm_fd_get_device_name(int fd)
+ {
++ char *device_name = NULL;
++
++#if defined(HAVE_LIBUDEV)
+ struct udev *udev;
+ struct udev_device *device;
+ const char *const_device_name;
+- char *device_name = NULL;
+
+ udev = udev_new();
+ device = _gbm_udev_device_new_from_fd(udev, fd);
+@@ -78,6 +88,25 @@
+ out:
+ udev_device_unref(device);
+ udev_unref(udev);
++#elif defined(HAVE_LIBDEVQ)
++ int ret;
++ size_t device_name_len;
++
++ ret = devq_device_get_devpath_from_fd(fd,
++ NULL, &device_name_len);
++ if (ret < 0)
++ return (NULL);
++
++ device_name = malloc(device_name_len + 1);
++ ret = devq_device_get_devpath_from_fd(fd,
++ device_name, &device_name_len);
++ if (ret < 0) {
++ free(device_name);
++ return (NULL);
++ }
++
++ device_name[device_name_len] = '\0';
++#endif
+
+ return device_name;
+ }
diff --git a/graphics/libGL/files-old/patch-src__gbm__main__common.h b/graphics/libGL/files-old/patch-src__gbm__main__common.h
new file mode 100644
index 000000000000..cd870e508167
--- /dev/null
+++ b/graphics/libGL/files-old/patch-src__gbm__main__common.h
@@ -0,0 +1,15 @@
+--- ./src/gbm/main/common.h.orig 2014-02-03 18:42:39.000000000 +0100
++++ ./src/gbm/main/common.h 2014-02-15 21:11:55.000000000 +0100
+@@ -28,10 +28,12 @@
+ #ifndef _COMMON_H_
+ #define _COMMON_H_
+
++#if defined(HAVE_LIBUDEV)
+ #include <libudev.h>
+
+ struct udev_device *
+ _gbm_udev_device_new_from_fd(struct udev *udev, int fd);
++#endif
+
+ char *
+ _gbm_fd_get_device_name(int fd);
diff --git a/graphics/libGL/files-old/patch-src__mesa__x86-64__glapi_x86-64.S b/graphics/libGL/files-old/patch-src__mesa__x86-64__glapi_x86-64.S
deleted file mode 100644
index 908a6fe300aa..000000000000
--- a/graphics/libGL/files-old/patch-src__mesa__x86-64__glapi_x86-64.S
+++ /dev/null
@@ -1,12 +0,0 @@
---- ./src/mesa/x86-64/glapi_x86-64.S.orig 2009-03-13 04:28:49.000000000 +0100
-+++ ./src/mesa/x86-64/glapi_x86-64.S 2011-01-28 18:12:18.000000000 +0100
-@@ -73,7 +73,8 @@ _x86_64_get_dispatch:
-
- .p2align 4,,15
- _x86_64_get_dispatch:
-- movq _gl_DispatchTSD(%rip), %rdi
-+ movq _gl_DispatchTSD@GOTPCREL(%rip), %rax
-+ movl (%rax), %edi
- jmp pthread_getspecific@PLT
-
- #elif defined(THREADS)
diff --git a/graphics/libGL/files-old/patch-src__mesa__x86-64__xform4.S b/graphics/libGL/files-old/patch-src__mesa__x86-64__xform4.S
deleted file mode 100644
index 193e6cc30fbe..000000000000
--- a/graphics/libGL/files-old/patch-src__mesa__x86-64__xform4.S
+++ /dev/null
@@ -1,74 +0,0 @@
---- src/mesa/x86-64/xform4.S.orig 2009-01-22 18:38:35.000000000 +0100
-+++ src/mesa/x86-64/xform4.S 2011-05-09 21:26:00.000000000 +0200
-@@ -53,7 +53,7 @@ _mesa_x86_64_transform_points4_general:
- * rdx = source
- */
- movl V4F_COUNT(%rdx), %ecx /* count */
-- movzx V4F_STRIDE(%rdx), %eax /* stride */
-+ movzbl V4F_STRIDE(%rdx), %eax /* stride */
-
- movl %ecx, V4F_COUNT(%rdi) /* set dest count */
- movl $4, V4F_SIZE(%rdi) /* set dest size */
-@@ -116,7 +116,7 @@ p4_constants:
- .byte 0x00, 0x00, 0x00, 0x00
- .byte 0x00, 0x00, 0x00, 0x00
- .byte 0x00, 0x00, 0x00, 0x00
--.float 0f+1.0
-+.float 1.0
-
- .text
- .align 16
-@@ -135,7 +135,7 @@ _mesa_x86_64_transform_points4_3d:
- movaps 16(%rax), %xmm10
-
- movl V4F_COUNT(%rdx), %ecx /* count */
-- movzx V4F_STRIDE(%rdx), %eax /* stride */
-+ movzbl V4F_STRIDE(%rdx), %eax /* stride */
-
- movl %ecx, V4F_COUNT(%rdi) /* set dest count */
- movl $4, V4F_SIZE(%rdi) /* set dest size */
-@@ -195,7 +195,7 @@ p4_3d_done:
- _mesa_x86_64_transform_points4_identity:
-
- movl V4F_COUNT(%rdx), %ecx /* count */
-- movzx V4F_STRIDE(%rdx), %eax /* stride */
-+ movzbl V4F_STRIDE(%rdx), %eax /* stride */
-
- movl %ecx, V4F_COUNT(%rdi) /* set dest count */
- movl $4, V4F_SIZE(%rdi) /* set dest size */
-@@ -223,7 +223,7 @@ p4_identity_done:
- _mesa_3dnow_transform_points4_3d_no_rot:
-
- movl V4F_COUNT(%rdx), %ecx /* count */
-- movzx V4F_STRIDE(%rdx), %eax /* stride */
-+ movzbl V4F_STRIDE(%rdx), %eax /* stride */
-
- movl %ecx, V4F_COUNT(%rdi) /* set dest count */
- movl $4, V4F_SIZE(%rdi) /* set dest size */
-@@ -287,7 +287,7 @@ p4_3d_no_rot_done:
- _mesa_3dnow_transform_points4_perspective:
-
- movl V4F_COUNT(%rdx), %ecx /* count */
-- movzx V4F_STRIDE(%rdx), %eax /* stride */
-+ movzbl V4F_STRIDE(%rdx), %eax /* stride */
-
- movl %ecx, V4F_COUNT(%rdi) /* set dest count */
- movl $4, V4F_SIZE(%rdi) /* set dest size */
-@@ -353,7 +353,7 @@ p4_perspective_done:
- _mesa_3dnow_transform_points4_2d_no_rot:
-
- movl V4F_COUNT(%rdx), %ecx /* count */
-- movzx V4F_STRIDE(%rdx), %eax /* stride */
-+ movzbl V4F_STRIDE(%rdx), %eax /* stride */
-
- movl %ecx, V4F_COUNT(%rdi) /* set dest count */
- movl $4, V4F_SIZE(%rdi) /* set dest size */
-@@ -408,7 +408,7 @@ p4_2d_no_rot_done:
- _mesa_3dnow_transform_points4_2d:
-
- movl V4F_COUNT(%rdx), %ecx /* count */
-- movzx V4F_STRIDE(%rdx), %eax /* stride */
-+ movzbl V4F_STRIDE(%rdx), %eax /* stride */
-
- movl %ecx, V4F_COUNT(%rdi) /* set dest count */
- movl $4, V4F_SIZE(%rdi) /* set dest size */
diff --git a/graphics/libGL/files-old/patch-src__mesa__x86__glapi_x86.S b/graphics/libGL/files-old/patch-src__mesa__x86__glapi_x86.S
deleted file mode 100644
index 71da78c83ffd..000000000000
--- a/graphics/libGL/files-old/patch-src__mesa__x86__glapi_x86.S
+++ /dev/null
@@ -1,11 +0,0 @@
---- ./src/mesa/x86/glapi_x86.S.orig 2009-03-13 04:28:49.000000000 +0100
-+++ ./src/mesa/x86/glapi_x86.S 2011-01-28 18:11:56.000000000 +0100
-@@ -47,7 +47,7 @@
- #define GL_OFFSET(x) CODEPTR(REGOFF(4 * x, EAX))
-
- #if defined(GNU_ASSEMBLER) && !defined(__DJGPP__) && !defined(__MINGW32__)
--#define GLOBL_FN(x) GLOBL x ; .type x, function
-+#define GLOBL_FN(x) GLOBL x ; .type x, @function
- #else
- #define GLOBL_FN(x) GLOBL x
- #endif
diff --git a/graphics/libGL/files-old/patch-src__mesa__x86__read_rgba_span_x86.S b/graphics/libGL/files-old/patch-src__mesa__x86__read_rgba_span_x86.S
deleted file mode 100644
index 37b08d1cda3c..000000000000
--- a/graphics/libGL/files-old/patch-src__mesa__x86__read_rgba_span_x86.S
+++ /dev/null
@@ -1,11 +0,0 @@
---- ./src/mesa/x86/read_rgba_span_x86.S.orig 2008-08-25 16:46:47.000000000 +0200
-+++ ./src/mesa/x86/read_rgba_span_x86.S 2011-01-28 18:10:06.000000000 +0100
-@@ -648,7 +648,7 @@ _generic_read_RGBA_span_RGB565_MMX:
- testl $0x01, %ecx
- je .L01
-
-- movzxw (%eax), %ecx
-+ movzwl (%eax), %ecx
- movd %ecx, %mm4
-
- pshufw $0x00, %mm4, %mm0
diff --git a/graphics/libGL/files/patch-src_gallium_drivers_r300_r300-chipset.c b/graphics/libGL/files-old/patch-src_gallium_drivers_r300_r300-chipset.c
index 821b07ce8be2..821b07ce8be2 100644
--- a/graphics/libGL/files/patch-src_gallium_drivers_r300_r300-chipset.c
+++ b/graphics/libGL/files-old/patch-src_gallium_drivers_r300_r300-chipset.c
diff --git a/graphics/libGL/files/patch-src_gallium_drivers_r600_r600-asm.c b/graphics/libGL/files-old/patch-src_gallium_drivers_r600_r600-asm.c
index 3b580dd81030..3b580dd81030 100644
--- a/graphics/libGL/files/patch-src_gallium_drivers_r600_r600-asm.c
+++ b/graphics/libGL/files-old/patch-src_gallium_drivers_r600_r600-asm.c
diff --git a/graphics/libGL/files/patch-src_gallium_drivers_r600_r600-shader.c b/graphics/libGL/files-old/patch-src_gallium_drivers_r600_r600-shader.c
index 3721b25cd83b..3721b25cd83b 100644
--- a/graphics/libGL/files/patch-src_gallium_drivers_r600_r600-shader.c
+++ b/graphics/libGL/files-old/patch-src_gallium_drivers_r600_r600-shader.c
diff --git a/graphics/libGL/files/patch-src_gallium_drivers_r600_r600_state_common.c b/graphics/libGL/files-old/patch-src_gallium_drivers_r600_r600_state_common.c
index f7ad4caea427..f7ad4caea427 100644
--- a/graphics/libGL/files/patch-src_gallium_drivers_r600_r600_state_common.c
+++ b/graphics/libGL/files-old/patch-src_gallium_drivers_r600_r600_state_common.c
diff --git a/graphics/libGL/files/patch-src_gallium_drivers_radeon_radeon-llvm-emit.cpp b/graphics/libGL/files-old/patch-src_gallium_drivers_radeon_radeon-llvm-emit.cpp
index ee67776d839e..ee67776d839e 100644
--- a/graphics/libGL/files/patch-src_gallium_drivers_radeon_radeon-llvm-emit.cpp
+++ b/graphics/libGL/files-old/patch-src_gallium_drivers_radeon_radeon-llvm-emit.cpp
diff --git a/graphics/libGL/files/patch-src_gallium_drivers_radeonsi_r600-buffer.c b/graphics/libGL/files-old/patch-src_gallium_drivers_radeonsi_r600-buffer.c
index 505f3a17f03f..505f3a17f03f 100644
--- a/graphics/libGL/files/patch-src_gallium_drivers_radeonsi_r600-buffer.c
+++ b/graphics/libGL/files-old/patch-src_gallium_drivers_radeonsi_r600-buffer.c
diff --git a/graphics/libGL/files/patch-src_gallium_winsys_svga_drm_vmw-screen-ioctl.c b/graphics/libGL/files-old/patch-src_gallium_winsys_svga_drm_vmw-screen-ioctl.c
index 208601de99a0..208601de99a0 100644
--- a/graphics/libGL/files/patch-src_gallium_winsys_svga_drm_vmw-screen-ioctl.c
+++ b/graphics/libGL/files-old/patch-src_gallium_winsys_svga_drm_vmw-screen-ioctl.c
diff --git a/graphics/libGL/files-old/patch-src_glx_x11_XF86dri.c b/graphics/libGL/files-old/patch-src_glx_x11_XF86dri.c
deleted file mode 100644
index 1d082b54e21d..000000000000
--- a/graphics/libGL/files-old/patch-src_glx_x11_XF86dri.c
+++ /dev/null
@@ -1,38 +0,0 @@
---- src/glx/x11/XF86dri.c.orig 2009-06-17 18:35:16.000000000 +0000
-+++ src/glx/x11/XF86dri.c 2013-05-29 10:09:37.000000000 +0000
-@@ -43,6 +43,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN
- #include <X11/extensions/Xext.h>
- #include <X11/extensions/extutil.h>
- #include "xf86dristr.h"
-+#include <limits.h>
-
-
- #if defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__) >= 303
-@@ -212,7 +213,11 @@ XF86DRIOpenConnection(Display * dpy, int
- }
-
- if (rep.length) {
-- if (!(*busIdString = (char *) Xcalloc(rep.busIdStringLength + 1, 1))) {
-+ if (rep.busIdStringLength < INT_MAX)
-+ *busIdString = Xcalloc(rep.busIdStringLength + 1, 1);
-+ else
-+ *busIdString = NULL;
-+ if (*busIdString == NULL) {
- _XEatData(dpy, ((rep.busIdStringLength + 3) & ~3));
- UnlockDisplay(dpy);
- SyncHandle();
-@@ -311,9 +316,11 @@ XF86DRIGetClientDriverName(Display * dpy
- *ddxDriverPatchVersion = rep.ddxDriverPatchVersion;
-
- if (rep.length) {
-- if (!
-- (*clientDriverName =
-- (char *) Xcalloc(rep.clientDriverNameLength + 1, 1))) {
-+ if (rep.clientDriverNameLength < INT_MAX)
-+ *clientDriverName = Xcalloc(rep.clientDriverNameLength + 1, 1);
-+ else
-+ *clientDriverName = NULL;
-+ if (*clientDriverName == NULL) {
- _XEatData(dpy, ((rep.clientDriverNameLength + 3) & ~3));
- UnlockDisplay(dpy);
- SyncHandle();
diff --git a/graphics/libGL/files/patch-src_mapi_glapi_gen_gl-gentable.py b/graphics/libGL/files-old/patch-src_mapi_glapi_gen_gl-gentable.py
index d952bb61cf26..d952bb61cf26 100644
--- a/graphics/libGL/files/patch-src_mapi_glapi_gen_gl-gentable.py
+++ b/graphics/libGL/files-old/patch-src_mapi_glapi_gen_gl-gentable.py
diff --git a/graphics/libGL/files-old/patch-src_mapi_mapi_entry_x86-64_tls.h b/graphics/libGL/files-old/patch-src_mapi_mapi_entry_x86-64_tls.h
new file mode 100644
index 000000000000..13c245eb8cdf
--- /dev/null
+++ b/graphics/libGL/files-old/patch-src_mapi_mapi_entry_x86-64_tls.h
@@ -0,0 +1,13 @@
+--- src/mapi/mapi/entry_x86-64_tls.h.orig 2013-10-05 05:59:22.000000000 +0200
++++ src/mapi/mapi/entry_x86-64_tls.h 2014-07-29 20:28:05.000000000 +0200
+@@ -63,8 +63,8 @@ entry_patch_public(void)
+ {
+ }
+
+-static char
+-x86_64_entry_start[];
++extern char
++x86_64_entry_start[] __attribute__((visibility("hidden")));
+
+ mapi_func
+ entry_get_public(int slot)
diff --git a/graphics/libGL/files-old/patch-src_mapi_mapi_entry_x86_tls.h b/graphics/libGL/files-old/patch-src_mapi_mapi_entry_x86_tls.h
new file mode 100644
index 000000000000..d8a8e24d5eca
--- /dev/null
+++ b/graphics/libGL/files-old/patch-src_mapi_mapi_entry_x86_tls.h
@@ -0,0 +1,13 @@
+--- src/mapi/mapi/entry_x86_tls.h.orig 2013-10-05 05:59:22.000000000 +0200
++++ src/mapi/mapi/entry_x86_tls.h 2014-07-29 20:28:05.000000000 +0200
+@@ -73,8 +73,8 @@ __asm__(".text");
+ extern unsigned long
+ x86_current_tls();
+
+-static char x86_entry_start[];
+-static char x86_entry_end[];
++extern char x86_entry_start[] __attribute__((visibility("hidden")));
++extern char x86_entry_end[] __attribute__((visibility("hidden")));
+
+ void
+ entry_patch_public(void)
diff --git a/graphics/libGL/files-old/patch-src_mapi_mapi_entry_x86_tsd.h b/graphics/libGL/files-old/patch-src_mapi_mapi_entry_x86_tsd.h
new file mode 100644
index 000000000000..b97cf4cd9fb9
--- /dev/null
+++ b/graphics/libGL/files-old/patch-src_mapi_mapi_entry_x86_tsd.h
@@ -0,0 +1,13 @@
+--- src/mapi/mapi/entry_x86_tsd.h.orig 2013-10-05 05:59:22.000000000 +0200
++++ src/mapi/mapi/entry_x86_tsd.h 2014-07-29 20:28:05.000000000 +0200
+@@ -60,8 +60,8 @@ __asm__(".balign 32\n"
+ #include <string.h>
+ #include "u_execmem.h"
+
+-static const char x86_entry_start[];
+-static const char x86_entry_end[];
++extern const char x86_entry_start[] __attribute__((visibility("hidden")));
++extern const char x86_entry_end[] __attribute__((visibility("hidden")));
+
+ void
+ entry_patch_public(void)
diff --git a/graphics/libGL/files-old/patch-src_mesa_Makefile b/graphics/libGL/files-old/patch-src_mesa_Makefile
deleted file mode 100644
index 433f3fbbf182..000000000000
--- a/graphics/libGL/files-old/patch-src_mesa_Makefile
+++ /dev/null
@@ -1,15 +0,0 @@
---- src/mesa/Makefile.orig 2009-12-22 03:31:19.000000000 +0100
-+++ src/mesa/Makefile 2013-08-19 23:19:42.000000000 +0200
-@@ -127,10 +127,10 @@
- $(DESTDIR)$(INSTALL_INC_DIR)/GL
-
- install-libgl: default gl.pc install-headers
-- $(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR)
-+ $(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR)/.libGL
- $(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR)/pkgconfig
- $(MINSTALL) $(TOP)/$(LIB_DIR)/$(GL_LIB_GLOB) \
-- $(DESTDIR)$(INSTALL_LIB_DIR)
-+ $(DESTDIR)$(INSTALL_LIB_DIR)/.libGL
- $(INSTALL) -m 644 gl.pc $(DESTDIR)$(INSTALL_LIB_DIR)/pkgconfig
-
- install-osmesa: default osmesa.pc
diff --git a/graphics/libGL/files/patch-src_mesa_drivers_dri_common_Makefile.in b/graphics/libGL/files-old/patch-src_mesa_drivers_dri_common_Makefile.in
index 1084e90fd805..1084e90fd805 100644
--- a/graphics/libGL/files/patch-src_mesa_drivers_dri_common_Makefile.in
+++ b/graphics/libGL/files-old/patch-src_mesa_drivers_dri_common_Makefile.in
diff --git a/graphics/libGL/files/patch-src_mesa_drivers_dri_common_xmlpool_Makefile.in b/graphics/libGL/files-old/patch-src_mesa_drivers_dri_common_xmlpool_Makefile.in
index 4f2a84b8be96..4f2a84b8be96 100644
--- a/graphics/libGL/files/patch-src_mesa_drivers_dri_common_xmlpool_Makefile.in
+++ b/graphics/libGL/files-old/patch-src_mesa_drivers_dri_common_xmlpool_Makefile.in
diff --git a/graphics/libGL/files/patch-src_mesa_main_compiler.h b/graphics/libGL/files-old/patch-src_mesa_main_compiler.h
index 50cf3a8454f6..50cf3a8454f6 100644
--- a/graphics/libGL/files/patch-src_mesa_main_compiler.h
+++ b/graphics/libGL/files-old/patch-src_mesa_main_compiler.h
diff --git a/graphics/libGL/files/patch-src_mesa_main_imports.c b/graphics/libGL/files-old/patch-src_mesa_main_imports.c
index c5979f7c15fe..c5979f7c15fe 100644
--- a/graphics/libGL/files/patch-src_mesa_main_imports.c
+++ b/graphics/libGL/files-old/patch-src_mesa_main_imports.c
diff --git a/graphics/libGL/files-old/pkg-deinstall.in b/graphics/libGL/files-old/pkg-deinstall.in
new file mode 100644
index 000000000000..37d895397fcb
--- /dev/null
+++ b/graphics/libGL/files-old/pkg-deinstall.in
@@ -0,0 +1,12 @@
+#!/bin/sh
+#
+# $FreeBSD$
+#
+
+PREFIX="${PKG_PREFIX-/usr/local}"
+
+case $2 in
+DEINSTALL)
+ /bin/rm -f ${PREFIX}/lib/libGL.so*
+ ;;
+esac
diff --git a/graphics/libGL/files-old/pkg-install.in b/graphics/libGL/files-old/pkg-install.in
new file mode 100644
index 000000000000..280922c0bbfc
--- /dev/null
+++ b/graphics/libGL/files-old/pkg-install.in
@@ -0,0 +1,18 @@
+#!/bin/sh
+#
+# $FreeBSD$
+#
+
+PREFIX="${PKG_PREFIX-/usr/local}"
+
+case $2 in
+POST-INSTALL)
+ if [ -f ${PREFIX}/lib/.nvidia/libGL.so.1 ]; then
+ /bin/ln -f ${PREFIX}/lib/.nvidia/libGL.so.1 ${PREFIX}/lib/libGL.so
+ /bin/ln -f ${PREFIX}/lib/.nvidia/libGL.so.1 ${PREFIX}/lib/libGL.so.1
+ else
+ /bin/ln -f ${PREFIX}/lib/.libGL/libGL.so.1 ${PREFIX}/lib/libGL.so
+ /bin/ln -f ${PREFIX}/lib/.libGL/libGL.so.1 ${PREFIX}/lib/libGL.so.1
+ fi
+ ;;
+esac
diff --git a/graphics/libGL/files/configure.ac b/graphics/libGL/files/configure.ac
new file mode 100644
index 000000000000..170618f7be0b
--- /dev/null
+++ b/graphics/libGL/files/configure.ac
@@ -0,0 +1,100 @@
+--- configure.ac.orig 2014-08-21 01:41:38.000000000 +0200
++++ configure.ac 2014-08-29 13:40:20.688548140 +0200
+@@ -37,6 +37,7 @@
+ DRI3PROTO_REQUIRED=1.0
+ PRESENTPROTO_REQUIRED=1.0
+ LIBUDEV_REQUIRED=151
++LIBDEVQ_REQUIRED=0.0.2
+ GLPROTO_REQUIRED=1.4.14
+ LIBOMXIL_BELLAGIO_REQUIRED=0.0
+ VDPAU_REQUIRED=0.4.1
+@@ -53,7 +54,7 @@
+ AM_PROG_CC_C_O
+ AM_PROG_AS
+ AC_CHECK_PROGS([MAKE], [gmake make])
+-AC_CHECK_PROGS([PYTHON2], [python2 python])
++AC_CHECK_PROGS([PYTHON2], [python2.7 python2 python])
+ AC_PROG_SED
+ AC_PROG_MKDIR_P
+
+@@ -152,7 +153,7 @@
+ DEFINES="-DUSE_EXTERNAL_DXTN_LIB=1"
+ AC_SUBST([DEFINES])
+ case "$host_os" in
+-linux*|*-gnu*|gnu*)
++linux*|*-gnu*|gnu*|freebsd*)
+ DEFINES="$DEFINES -D_GNU_SOURCE -DHAVE_PTHREAD"
+ ;;
+ solaris*)
+@@ -581,7 +582,7 @@
+ [enable_dri=yes])
+
+ case "$host_os" in
+-linux*)
++linux*|freebsd*)
+ dri3_default=yes
+ ;;
+ *)
+@@ -855,6 +856,9 @@
+ PKG_CHECK_MODULES([LIBUDEV], [libudev >= $LIBUDEV_REQUIRED],
+ have_libudev=yes, have_libudev=no)
+
++PKG_CHECK_MODULES([LIBDEVQ], [libdevq-1.0 >= $LIBDEVQ_REQUIRED],
++ have_libdevq=yes, have_libdevq=no)
++
+ AC_ARG_ENABLE([sysfs],
+ [AS_HELP_STRING([--enable-sysfs],
+ [enable /sys PCI identification @<:@default=disabled@:>@])],
+@@ -949,6 +953,10 @@
+ DEFINES="$DEFINES -DHAVE_LIBUDEV"
+ have_pci_id=yes
+ fi
++if test "$have_libdevq" = yes; then
++ DEFINES="$DEFINES -DHAVE_LIBDEVQ"
++ have_pci_id=yes
++fi
+
+ if test "$have_sysfs" = yes; then
+ DEFINES="$DEFINES -DHAVE_SYSFS"
+@@ -1069,6 +1077,23 @@
+ *freebsd* | dragonfly* | *netbsd* | openbsd*)
+ DEFINES="$DEFINES -DHAVE_PTHREAD"
+ DEFINES="$DEFINES -DHAVE_ALIAS"
++dnl not sure about dri3 support, just enable it for now.
++ if test "x$enable_dri3" = xyes; then
++ DEFINES="$DEFINES -DHAVE_DRI3"
++ fi
++
++ if test "x$have_libdevq" != xyes; then
++ AC_MSG_ERROR([libdevq required for building DRI])
++ fi
++
++ case "$host_cpu" in
++ powerpc* | sparc*)
++ # Build only the drivers for cards that exist on PowerPC/sparc
++ if test "x$with_dri_drivers" = "xyes"; then
++ with_dri_drivers="r200 radeon swrast"
++ fi
++ ;;
++ esac
+ ;;
+ gnu*)
+ DEFINES="$DEFINES -DHAVE_ALIAS"
+@@ -1252,6 +1277,8 @@
+ AM_CONDITIONAL(HAVE_GBM, test "x$enable_gbm" = xyes)
+ if test "x$need_pci_id$have_libudev" = xyesyes; then
+ GBM_PC_REQ_PRIV="libudev >= $LIBUDEV_REQUIRED"
++elif test "x$need_libdevq" = xyes; then
++ GBM_PC_REQ_PRIV="libdevq-1.0 >= $LIBDEVQ_REQUIRED"
+ else
+ GBM_PC_REQ_PRIV=""
+ fi
+@@ -1728,8 +1755,6 @@
+ CLANG_LIBDIR=${LLVM_LIBDIR}
+ fi
+ CLANG_RESOURCE_DIR=$CLANG_LIBDIR/clang/${LLVM_VERSION}
+- AS_IF([test ! -f "$CLANG_RESOURCE_DIR/include/stddef.h"],
+- [AC_MSG_ERROR([Could not find clang internal header stddef.h in $CLANG_RESOURCE_DIR Use --with-clang-libdir to specify the correct path to the clang libraries.])])
+ fi
+ else
+ MESA_LLVM=0
diff --git a/graphics/libGL/files/patch-Makefile.in b/graphics/libGL/files/patch-Makefile.in
index 3adcc5d6156f..8bebfd693010 100644
--- a/graphics/libGL/files/patch-Makefile.in
+++ b/graphics/libGL/files/patch-Makefile.in
@@ -1,12 +1,14 @@
---- Makefile.in.orig 2014-05-11 21:01:42.000000000 +0200
-+++ Makefile.in 2014-05-11 21:02:12.000000000 +0200
-@@ -87,9 +87,7 @@
+--- Makefile.in.orig 2014-05-18 10:37:51.000000000 +0200
++++ Makefile.in 2014-05-18 10:38:21.000000000 +0200
+@@ -85,10 +85,8 @@
+ $(top_srcdir)/m4/ax_gcc_builtin.m4 \
+ $(top_srcdir)/m4/ax_prog_bison.m4 \
$(top_srcdir)/m4/ax_prog_flex.m4 \
- $(top_srcdir)/m4/ax_pthread.m4 \
- $(top_srcdir)/m4/ax_python_module.m4 \
-- $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
-- $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
-- $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac
+- $(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/libtool.m4 \
+- $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
+- $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
+- $(top_srcdir)/VERSION $(top_srcdir)/configure.ac
++ $(top_srcdir)/m4/ax_pthread.m4 \
+ $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
diff --git a/graphics/libGL/files/patch-configure b/graphics/libGL/files/patch-configure
index 0bfe1925179a..be9deef8a05a 100644
--- a/graphics/libGL/files/patch-configure
+++ b/graphics/libGL/files/patch-configure
@@ -1,49 +1,198 @@
---- configure.orig 2013-08-01 23:22:15.000000000 +0200
-+++ configure 2013-08-19 20:05:02.000000000 +0200
-@@ -21046,9 +21046,34 @@
- DEFINES="$DEFINES -DHAVE_PTHREAD -DUSE_EXTERNAL_DXTN_LIB=1"
- DEFINES="$DEFINES -DIN_DRI_DRIVER -DHAVE_ALIAS"
+--- configure.orig 2014-08-29 13:42:21.635540273 +0200
++++ configure 2014-08-29 13:42:55.401537200 +0200
+@@ -858,6 +858,8 @@
+ GLPROTO_CFLAGS
+ XLIBGL_LIBS
+ XLIBGL_CFLAGS
++LIBDEVQ_LIBS
++LIBDEVQ_CFLAGS
+ LIBUDEV_LIBS
+ LIBUDEV_CFLAGS
+ LIBDRM_LIBS
+@@ -1146,6 +1148,8 @@
+ LIBDRM_LIBS
+ LIBUDEV_CFLAGS
+ LIBUDEV_LIBS
++LIBDEVQ_CFLAGS
++LIBDEVQ_LIBS
+ XLIBGL_CFLAGS
+ XLIBGL_LIBS
+ GLPROTO_CFLAGS
+@@ -1945,6 +1949,10 @@
+ C compiler flags for LIBUDEV, overriding pkg-config
+ LIBUDEV_LIBS
+ linker flags for LIBUDEV, overriding pkg-config
++ LIBDEVQ_CFLAGS
++ C compiler flags for LIBDEVQ, overriding pkg-config
++ LIBDEVQ_LIBS
++ linker flags for LIBDEVQ, overriding pkg-config
+ XLIBGL_CFLAGS
+ C compiler flags for XLIBGL, overriding pkg-config
+ XLIBGL_LIBS linker flags for XLIBGL, overriding pkg-config
+@@ -5086,6 +5094,7 @@
+ DRI3PROTO_REQUIRED=1.0
+ PRESENTPROTO_REQUIRED=1.0
+ LIBUDEV_REQUIRED=151
++LIBDEVQ_REQUIRED=0.0.2
+ GLPROTO_REQUIRED=1.4.14
+ LIBOMXIL_BELLAGIO_REQUIRED=0.0
+ VDPAU_REQUIRED=0.4.1
+@@ -6519,7 +6528,7 @@
+ test -n "$MAKE" && break
+ done
-- if test "x$DRI_DIRS" = "xyes"; then
-- DRI_DIRS="i915 i965 nouveau r200 radeon swrast"
-- fi
+-for ac_prog in python2 python
++for ac_prog in python2.7 python2 python
+ do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+ set dummy $ac_prog; ac_word=$2
+@@ -17891,7 +17900,7 @@
+ DEFINES="-DUSE_EXTERNAL_DXTN_LIB=1"
+
+ case "$host_os" in
+-linux*|*-gnu*|gnu*)
++linux*|*-gnu*|gnu*|freebsd*)
+ DEFINES="$DEFINES -D_GNU_SOURCE -DHAVE_PTHREAD"
+ ;;
+ solaris*)
+@@ -19147,7 +19156,7 @@
+
+
+ case "$host_os" in
+-linux*)
++linux*|freebsd*)
+ dri3_default=yes
+ ;;
+ *)
+@@ -19669,6 +19678,78 @@
+ have_libudev=yes
+ fi
+
++
++pkg_failed=no
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for LIBDEVQ" >&5
++$as_echo_n "checking for LIBDEVQ... " >&6; }
++
++if test -n "$LIBDEVQ_CFLAGS"; then
++ pkg_cv_LIBDEVQ_CFLAGS="$LIBDEVQ_CFLAGS"
++ elif test -n "$PKG_CONFIG"; then
++ if test -n "$PKG_CONFIG" && \
++ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libdevq-1.0 >= \$LIBDEVQ_REQUIRED\""; } >&5
++ ($PKG_CONFIG --exists --print-errors "libdevq-1.0 >= $LIBDEVQ_REQUIRED") 2>&5
++ ac_status=$?
++ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
++ test $ac_status = 0; }; then
++ pkg_cv_LIBDEVQ_CFLAGS=`$PKG_CONFIG --cflags "libdevq-1.0 >= $LIBDEVQ_REQUIRED" 2>/dev/null`
++ test "x$?" != "x0" && pkg_failed=yes
++else
++ pkg_failed=yes
++fi
++ else
++ pkg_failed=untried
++fi
++if test -n "$LIBDEVQ_LIBS"; then
++ pkg_cv_LIBDEVQ_LIBS="$LIBDEVQ_LIBS"
++ elif test -n "$PKG_CONFIG"; then
++ if test -n "$PKG_CONFIG" && \
++ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libdevq-1.0 >= \$LIBDEVQ_REQUIRED\""; } >&5
++ ($PKG_CONFIG --exists --print-errors "libdevq-1.0 >= $LIBDEVQ_REQUIRED") 2>&5
++ ac_status=$?
++ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
++ test $ac_status = 0; }; then
++ pkg_cv_LIBDEVQ_LIBS=`$PKG_CONFIG --libs "libdevq-1.0 >= $LIBDEVQ_REQUIRED" 2>/dev/null`
++ test "x$?" != "x0" && pkg_failed=yes
++else
++ pkg_failed=yes
++fi
++ else
++ pkg_failed=untried
++fi
++
++
++
++if test $pkg_failed = yes; then
++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
++$as_echo "no" >&6; }
++
++if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
++ _pkg_short_errors_supported=yes
++else
++ _pkg_short_errors_supported=no
++fi
++ if test $_pkg_short_errors_supported = yes; then
++ LIBDEVQ_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libdevq-1.0 >= $LIBDEVQ_REQUIRED" 2>&1`
++ else
++ LIBDEVQ_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libdevq-1.0 >= $LIBDEVQ_REQUIRED" 2>&1`
++ fi
++ # Put the nasty error message in config.log where it belongs
++ echo "$LIBDEVQ_PKG_ERRORS" >&5
++
++ have_libdevq=no
++elif test $pkg_failed = untried; then
++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
++$as_echo "no" >&6; }
++ have_libdevq=no
++else
++ LIBDEVQ_CFLAGS=$pkg_cv_LIBDEVQ_CFLAGS
++ LIBDEVQ_LIBS=$pkg_cv_LIBDEVQ_LIBS
++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
++$as_echo "yes" >&6; }
++ have_libdevq=yes
++fi
++
+ # Check whether --enable-sysfs was given.
+ if test "${enable_sysfs+set}" = set; then :
+ enableval=$enable_sysfs; have_sysfs="$enableval"
+@@ -20373,6 +20454,10 @@
+ DEFINES="$DEFINES -DHAVE_LIBUDEV"
+ have_pci_id=yes
+ fi
++if test "$have_libdevq" = yes; then
++ DEFINES="$DEFINES -DHAVE_LIBDEVQ"
++ have_pci_id=yes
++fi
+
+ if test "$have_sysfs" = yes; then
+ DEFINES="$DEFINES -DHAVE_SYSFS"
+@@ -20498,6 +20583,22 @@
+ *freebsd* | dragonfly* | *netbsd* | openbsd*)
+ DEFINES="$DEFINES -DHAVE_PTHREAD"
+ DEFINES="$DEFINES -DHAVE_ALIAS"
++ if test "x$enable_dri3" = xyes; then
++ DEFINES="$DEFINES -DHAVE_DRI3"
++ fi
++
++ if test "x$have_libdevq" != xyes; then
++ as_fn_error $? "libdevq required for building DRI" "$LINENO" 5
++ fi
++
+ case "$host_cpu" in
-+ x86_64|ia64)
-+ # i810 is missing because there is no x86-64 system where it
-+ # could *ever* be used.
-+ if test "x$DRI_DIRS" = "xyes"; then
-+ DRI_DIRS="i915 i965 nouveau r200 radeon swrast"
-+ fi
-+ ;;
-+ i*86)
-+ if test "x$DRI_DIRS" = "xyes"; then
-+ DRI_DIRS="i915 i965 nouveau r200 radeon swrast"
-+ fi
-+ ;;
-+ powerpc*)
-+ # Build only the drivers for cards that exist on PowerPC.
-+ # At some point MGA will be added, but not yet.
-+ if test "x$DRI_DIRS" = "xyes"; then
-+ DRI_DIRS="r200 radeon swrast"
-+ fi
-+ ;;
-+ sparc*)
-+ # Build only the drivers for cards that exist on SPARC.
-+ if test "x$DRI_DIRS" = "xyes"; then
-+ DRI_DIRS="r200 radeon swrast"
++ powerpc* | sparc*)
++ # Build only the drivers for cards that exist on PowerPC/sparc
++ if test "x$with_dri_drivers" = "xyes"; then
++ with_dri_drivers="r200 radeon swrast"
+ fi
+ ;;
+ esac
-+
;;
gnu*)
- DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER"
-@@ -23396,7 +23421,7 @@
- radeon_llvm_check() {
- LLVM_REQUIRED_VERSION_MAJOR="3"
- LLVM_REQUIRED_VERSION_MINOR="2"
-- if test "$LLVM_VERSION_INT" -ne "${LLVM_REQUIRED_VERSION_MAJOR}0${LLVM_REQUIRED_VERSION_MINOR}"; then
-+ if test "$LLVM_VERSION_INT" -lt "${LLVM_REQUIRED_VERSION_MAJOR}0${LLVM_REQUIRED_VERSION_MINOR}"; then
- as_fn_error $? "LLVM $LLVM_REQUIRED_VERSION_MAJOR.$LLVM_REQUIRED_VERSION_MINOR with R600 target enabled is required.
- To use the r600/radeonsi LLVM backend, you need to fetch the LLVM source from:
- git://people.freedesktop.org/~tstellar/llvm master
+ DEFINES="$DEFINES -DHAVE_ALIAS"
+@@ -21226,6 +21327,8 @@
+
+ if test "x$need_pci_id$have_libudev" = xyesyes; then
+ GBM_PC_REQ_PRIV="libudev >= $LIBUDEV_REQUIRED"
++elif test "x$need_libdevq" = xyes; then
++ GBM_PC_REQ_PRIV="libdevq-1.0 >= $LIBDEVQ_REQUIRED"
+ else
+ GBM_PC_REQ_PRIV=""
+ fi
+@@ -22541,9 +22644,6 @@
+ CLANG_LIBDIR=${LLVM_LIBDIR}
+ fi
+ CLANG_RESOURCE_DIR=$CLANG_LIBDIR/clang/${LLVM_VERSION}
+- if test ! -f "$CLANG_RESOURCE_DIR/include/stddef.h"; then :
+- as_fn_error $? "Could not find clang internal header stddef.h in $CLANG_RESOURCE_DIR Use --with-clang-libdir to specify the correct path to the clang libraries." "$LINENO" 5
+-fi
+ fi
+ else
+ MESA_LLVM=0
diff --git a/graphics/libGL/files/patch-src__gallium__drivers__r300__r300_chipset.c b/graphics/libGL/files/patch-src__gallium__drivers__r300__r300_chipset.c
new file mode 100644
index 000000000000..c1f766250bad
--- /dev/null
+++ b/graphics/libGL/files/patch-src__gallium__drivers__r300__r300_chipset.c
@@ -0,0 +1,24 @@
+--- ./src/gallium/drivers/r300/r300_chipset.c.orig 2014-01-06 22:15:40.000000000 +0100
++++ ./src/gallium/drivers/r300/r300_chipset.c 2014-02-23 22:01:50.000000000 +0100
+@@ -53,6 +53,21 @@
+ if (!os_get_process_name(proc_name, sizeof(proc_name)))
+ return;
+
++#if defined(__DragonFly__) || \
++ defined(__FreeBSD__) || \
++ defined(__NetBSD__) || \
++ defined(__OpenBSD__)
++ const char *progname, *program_invocation_short_name;
++
++ progname = getprogname();
++ program_invocation_short_name = strrchr(progname, '/');
++ if (program_invocation_short_name) {
++ program_invocation_short_name++;
++ } else {
++ program_invocation_short_name = progname;
++ }
++#endif
++
+ for (i = 0; i < Elements(list); i++) {
+ if (strcmp(list[i], proc_name) == 0) {
+ caps->zmask_ram = 0;
diff --git a/graphics/libGL/files/patch-src__gallium__include__pipe__p_config.h b/graphics/libGL/files/patch-src__gallium__include__pipe__p_config.h
index 41f38a9663bb..f6df7a33783b 100644
--- a/graphics/libGL/files/patch-src__gallium__include__pipe__p_config.h
+++ b/graphics/libGL/files/patch-src__gallium__include__pipe__p_config.h
@@ -1,7 +1,7 @@
---- src/gallium/include/pipe/p_config.h.orig 2011-10-15 02:43:58.000000000 +0200
-+++ src/gallium/include/pipe/p_config.h 2012-06-28 21:27:06.000000000 +0200
-@@ -106,6 +106,13 @@
- #endif
+--- ./src/gallium/include/pipe/p_config.h.orig 2014-01-23 18:02:42.000000000 +0100
++++ ./src/gallium/include/pipe/p_config.h 2014-02-23 22:01:50.000000000 +0100
+@@ -81,6 +81,13 @@
+ #define PIPE_CC_SUNPRO
#endif
+#if defined(__sparc__) || defined(__sparc64__)
@@ -13,13 +13,4 @@
+
/*
- * Endian detection.
-@@ -133,7 +140,7 @@
-
- #if defined(PIPE_ARCH_X86) || defined(PIPE_ARCH_X86_64)
- #define PIPE_ARCH_LITTLE_ENDIAN
--#elif defined(PIPE_ARCH_PPC) || defined(PIPE_ARCH_PPC_64)
-+#elif defined(PIPE_ARCH_PPC) || defined(PIPE_ARCH_PPC_64) || defined(PIPE_ARCH_SPARC) || defined(PIPE_ARCH_SPARC_64)
- #define PIPE_ARCH_BIG_ENDIAN
- #endif
-
+ * Processor architecture
diff --git a/graphics/libGL/files/patch-src__gallium__state_trackers__clover__util__range.hpp b/graphics/libGL/files/patch-src__gallium__state_trackers__clover__util__range.hpp
new file mode 100644
index 000000000000..426ceb57206a
--- /dev/null
+++ b/graphics/libGL/files/patch-src__gallium__state_trackers__clover__util__range.hpp
@@ -0,0 +1,40 @@
+From b95533b981af9a6687b41418e7cc2a5652fc2bdb Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Jean-S=C3=A9bastien=20P=C3=A9dron?= <dumbbell@FreeBSD.org>
+Date: Fri, 7 Mar 2014 15:16:08 +0100
+Subject: [PATCH 3/3] Work around for clang 3.4 which fails to build Clover
+
+See:
+ https://bugs.freedesktop.org/show_bug.cgi?id=74098#c3
+---
+ src/gallium/state_trackers/clover/util/range.hpp | 8 +++++++-
+ 1 file changed, 7 insertions(+), 1 deletion(-)
+
+diff --git a/src/gallium/state_trackers/clover/util/range.hpp b/src/gallium/state_trackers/clover/util/range.hpp
+index afa5f77..359edda 100644
+--- src/gallium/state_trackers/clover/util/range.hpp
++++ src/gallium/state_trackers/clover/util/range.hpp
+@@ -362,6 +362,12 @@ namespace clover {
+ return { i, i + n };
+ }
+
++ namespace detail {
++ template<typename T>
++ using fixup_function_type =
++ typename std::conditional<std::is_function<T>::value, T &, T>::type;
++ }
++
+ ///
+ /// Create a range by transforming the contents of a number of
+ /// source ranges \a rs element-wise using a provided functor \a f.
+@@ -369,7 +375,7 @@ namespace clover {
+ /// \sa adaptor_range.
+ ///
+ template<typename F, typename... Rs>
+- adaptor_range<F, Rs...>
++ adaptor_range<detail::fixup_function_type<F>, Rs...>
+ map(F &&f, Rs &&... rs) {
+ return { std::forward<F>(f), std::forward<Rs>(rs)... };
+ }
+--
+1.8.5.4
+
diff --git a/graphics/libGL/files/patch-src__gallium__winsys__svga__drm__vmw_screen_ioctl.c b/graphics/libGL/files/patch-src__gallium__winsys__svga__drm__vmw_screen_ioctl.c
new file mode 100644
index 000000000000..ae12d3f6e5b7
--- /dev/null
+++ b/graphics/libGL/files/patch-src__gallium__winsys__svga__drm__vmw_screen_ioctl.c
@@ -0,0 +1,14 @@
+--- ./src/gallium/winsys/svga/drm/vmw_screen_ioctl.c.orig 2014-01-06 22:15:40.000000000 +0100
++++ ./src/gallium/winsys/svga/drm/vmw_screen_ioctl.c 2014-02-23 22:01:50.000000000 +0100
+@@ -66,6 +66,11 @@
+ */
+ #define SVGA3D_SURFACE_HINT_SCANOUT (1 << 9)
+
++#if defined(__DragonFly__) || defined(__FreeBSD__) || \
++ defined(__NetBSD__) || defined(__OpenBSD__)
++#define ERESTART EINTR
++#endif
++
+ uint32
+ vmw_ioctl_context_create(struct vmw_winsys_screen *vws)
+ {
diff --git a/graphics/libGL/files/patch-src__glsl__ir_constant_expression.cpp b/graphics/libGL/files/patch-src__glsl__ir_constant_expression.cpp
new file mode 100644
index 000000000000..168ac035a8b0
--- /dev/null
+++ b/graphics/libGL/files/patch-src__glsl__ir_constant_expression.cpp
@@ -0,0 +1,14 @@
+--- ./src/glsl/ir_constant_expression.cpp.orig 2014-02-05 21:59:10.000000000 +0100
++++ ./src/glsl/ir_constant_expression.cpp 2014-02-23 22:01:50.000000000 +0100
+@@ -60,6 +60,11 @@
+ }
+ #endif
+
++#include <sys/param.h>
++#if __FreeBSD_version <= 704100 || (__FreeBSD_version >= 800000 && __FreeBSD_version < 802502) || (__FreeBSD_version >= 900000 && __FreeBSD_version < 900027)
++#define log2(x) (log(x) / log(2))
++#endif
++
+ static float
+ dot(ir_constant *op0, ir_constant *op1)
+ {
diff --git a/graphics/libGL/files/patch-src__loader__Makefile.in b/graphics/libGL/files/patch-src__loader__Makefile.in
new file mode 100644
index 000000000000..94068d3859bd
--- /dev/null
+++ b/graphics/libGL/files/patch-src__loader__Makefile.in
@@ -0,0 +1,20 @@
+--- src/loader/Makefile.in.orig 2014-08-29 13:44:57.595529080 +0200
++++ src/loader/Makefile.in 2014-08-29 13:46:36.674521667 +0200
+@@ -315,6 +315,8 @@
+ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+ LIBCLC_INCLUDEDIR = @LIBCLC_INCLUDEDIR@
+ LIBCLC_LIBEXECDIR = @LIBCLC_LIBEXECDIR@
++LIBDEVQ_CFLAGS = @LIBDEVQ_CFLAGS@
++LIBDEVQ_LIBS = @LIBDEVQ_LIBS@
+ LIBDRM_CFLAGS = @LIBDRM_CFLAGS@
+ LIBDRM_LIBS = @LIBDRM_LIBS@
+ LIBOBJS = @LIBOBJS@
+@@ -485,7 +487,7 @@
+ noinst_LTLIBRARIES = libloader.la
+ libloader_la_CPPFLAGS = $(DEFINES) -I$(top_srcdir)/include \
+ -I$(top_srcdir)/src $(VISIBILITY_CFLAGS) $(LIBUDEV_CFLAGS) \
+- $(am__append_1) $(am__append_4) $(am__append_5)
++ $(LIBDEVQ_CFLAGS) $(am__append_1) $(am__append_4) $(am__append_5)
+ libloader_la_SOURCES = $(LOADER_C_FILES) $(am__append_2)
+ libloader_la_LIBADD = $(am__append_3) $(am__append_6)
+ all: all-am
diff --git a/graphics/libGL/files/patch-src__loader__loader.c b/graphics/libGL/files/patch-src__loader__loader.c
new file mode 100644
index 000000000000..ea8ae2b2ce6e
--- /dev/null
+++ b/graphics/libGL/files/patch-src__loader__loader.c
@@ -0,0 +1,90 @@
+--- src/loader/loader.c.orig 2014-08-21 01:27:47.000000000 +0200
++++ src/loader/loader.c 2014-09-04 19:57:56.384142575 +0200
+@@ -67,7 +67,7 @@
+ #include <stdarg.h>
+ #include <stdio.h>
+ #include <string.h>
+-#ifdef HAVE_LIBUDEV
++#if defined(HAVE_LIBUDEV) || defined(HAVE_LIBDEVQ)
+ #include <assert.h>
+ #include <dlfcn.h>
+ #include <fcntl.h>
+@@ -488,6 +488,53 @@
+ }
+ #endif
+
++#if defined(HAVE_LIBDEVQ)
++#include <libdevq.h>
++
++static void *devq_handle = NULL;
++
++static void *
++devq_dlopen_handle(void)
++{
++ if (!devq_handle) {
++ devq_handle = dlopen("libdevq.so.0", RTLD_LOCAL | RTLD_LAZY);
++ }
++
++ return devq_handle;
++}
++
++static void *
++asserted_dlsym(void *dlopen_handle, const char *name)
++{
++ void *result = dlsym(dlopen_handle, name);
++ assert(result);
++ return result;
++}
++
++#define DEVQ_SYMBOL(ret, name, args) \
++ ret (*name) args = asserted_dlsym(devq_dlopen_handle(), #name);
++
++static int
++devq_get_pci_id_from_fd(int fd, int *vendor_id, int *chip_id)
++{
++ int ret;
++ DEVQ_SYMBOL(int, devq_device_get_pciid_from_fd,
++ (int fd, int *vendor_id, int *chip_id));
++
++ *chip_id = -1;
++
++ ret = devq_device_get_pciid_from_fd(fd, vendor_id, chip_id);
++ if (ret < 0) {
++ log_(_LOADER_WARNING, "MESA-LOADER: could not get PCI ID\n");
++ goto out;
++ }
++
++out:
++ return (*chip_id >= 0);
++}
++
++#endif
++
+ #if !defined(__NOT_HAVE_DRM_H)
+ /* for i915 */
+ #include <i915_drm.h>
+@@ -571,6 +618,10 @@
+ if (sysfs_get_pci_id_for_fd(fd, vendor_id, chip_id))
+ return 1;
+ #endif
++#if HAVE_LIBDEVQ
++ if (devq_get_pci_id_from_fd(fd, vendor_id, chip_id))
++ return 1;
++#endif
+ #if !defined(__NOT_HAVE_DRM_H)
+ if (drm_get_pci_id_for_fd(fd, vendor_id, chip_id))
+ return 1;
+@@ -665,6 +716,13 @@
+ if ((result = sysfs_get_device_name_for_fd(fd)))
+ return result;
+ #endif
++#if HAVE_LIBDEVQ
++#if 0
++/* XXX implement this function in libdevq */
++ if ((result = devq_device_get_name_for_fd(fd)))
++ return result;
++#endif
++#endif
+ return result;
+ }
+
diff --git a/graphics/libGL/files/patch-src__mapi__entry_x86-64_tls.h b/graphics/libGL/files/patch-src__mapi__entry_x86-64_tls.h
new file mode 100644
index 000000000000..32d4b0577c3a
--- /dev/null
+++ b/graphics/libGL/files/patch-src__mapi__entry_x86-64_tls.h
@@ -0,0 +1,13 @@
+--- src/mapi/entry_x86-64_tls.h.orig 2013-10-05 05:59:22.000000000 +0200
++++ src/mapi/entry_x86-64_tls.h 2014-07-29 20:28:05.000000000 +0200
+@@ -63,8 +63,8 @@ entry_patch_public(void)
+ {
+ }
+
+-static char
+-x86_64_entry_start[];
++extern char
++x86_64_entry_start[] __attribute__((visibility("hidden")));
+
+ mapi_func
+ entry_get_public(int slot)
diff --git a/graphics/libGL/files/patch-src__mapi__entry_x86_tls.h b/graphics/libGL/files/patch-src__mapi__entry_x86_tls.h
new file mode 100644
index 000000000000..51f2839b1a0c
--- /dev/null
+++ b/graphics/libGL/files/patch-src__mapi__entry_x86_tls.h
@@ -0,0 +1,13 @@
+--- src/mapi/entry_x86_tls.h.orig 2013-10-05 05:59:22.000000000 +0200
++++ src/mapi/entry_x86_tls.h 2014-07-29 20:28:05.000000000 +0200
+@@ -73,8 +73,8 @@ __asm__(".text");
+ extern unsigned long
+ x86_current_tls();
+
+-static char x86_entry_start[];
+-static char x86_entry_end[];
++extern char x86_entry_start[] __attribute__((visibility("hidden")));
++extern char x86_entry_end[] __attribute__((visibility("hidden")));
+
+ void
+ entry_patch_public(void)
diff --git a/graphics/libGL/files/patch-src__mapi__entry_x86_tsd.h b/graphics/libGL/files/patch-src__mapi__entry_x86_tsd.h
new file mode 100644
index 000000000000..0aceed574163
--- /dev/null
+++ b/graphics/libGL/files/patch-src__mapi__entry_x86_tsd.h
@@ -0,0 +1,13 @@
+--- src/mapi/entry_x86_tsd.h.orig 2013-10-05 05:59:22.000000000 +0200
++++ src/mapi/entry_x86_tsd.h 2014-07-29 20:28:05.000000000 +0200
+@@ -60,8 +60,8 @@ __asm__(".balign 32\n"
+ #include <string.h>
+ #include "u_execmem.h"
+
+-static const char x86_entry_start[];
+-static const char x86_entry_end[];
++extern const char x86_entry_start[] __attribute__((visibility("hidden")));
++extern const char x86_entry_end[] __attribute__((visibility("hidden")));
+
+ void
+ entry_patch_public(void)
diff --git a/graphics/libGL/files/patch-src__mapi__glapi__gen__gl_gentable.py b/graphics/libGL/files/patch-src__mapi__glapi__gen__gl_gentable.py
new file mode 100644
index 000000000000..b4541a5f1ba1
--- /dev/null
+++ b/graphics/libGL/files/patch-src__mapi__glapi__gen__gl_gentable.py
@@ -0,0 +1,11 @@
+--- src/mapi/glapi/gen/gl_gentable.py.orig 2014-08-31 01:21:41.368693630 +0200
++++ src/mapi/glapi/gen/gl_gentable.py 2014-08-31 01:23:09.451686631 +0200
+@@ -42,7 +42,7 @@
+ #endif
+
+ #if (defined(GLXEXT) && defined(HAVE_BACKTRACE)) \\
+- || (!defined(GLXEXT) && defined(DEBUG) && !defined(_WIN32_WCE) && !defined(__CYGWIN__) && !defined(__MINGW32__) && !defined(__OpenBSD__) && !defined(__NetBSD__) && !defined(__DragonFly__))
++ || (!defined(GLXEXT) && defined(DEBUG) && !defined(_WIN32_WCE) && !defined(__CYGWIN__) && !defined(__MINGW32__) && !defined(__OpenBSD__) && !defined(__NetBSD__) && !defined(__FreeBSD__) && !defined(__DragonFly__))
+ #define USE_BACKTRACE
+ #endif
+
diff --git a/graphics/libGL/files/patch-src__mesa__main__compiler.h b/graphics/libGL/files/patch-src__mesa__main__compiler.h
new file mode 100644
index 000000000000..2cd6606bec40
--- /dev/null
+++ b/graphics/libGL/files/patch-src__mesa__main__compiler.h
@@ -0,0 +1,12 @@
+--- ./src/mesa/main/compiler.h.orig 2014-01-23 18:02:42.000000000 +0100
++++ ./src/mesa/main/compiler.h 2014-02-23 22:01:50.000000000 +0100
+@@ -162,6 +162,9 @@
+ #if defined(__linux__)
+ #include <byteswap.h>
+ #define CPU_TO_LE32( x ) bswap_32( x )
++#elif defined(__FreeBSD__)
++#include <sys/endian.h>
++#define CPU_TO_LE32( x ) bswap32( x )
+ #elif defined(__APPLE__)
+ #include <CoreFoundation/CFByteOrder.h>
+ #define CPU_TO_LE32( x ) CFSwapInt32HostToLittle( x )
diff --git a/graphics/libGL/files/patch-src__mesa__main__imports.c b/graphics/libGL/files/patch-src__mesa__main__imports.c
new file mode 100644
index 000000000000..2751c385fd8d
--- /dev/null
+++ b/graphics/libGL/files/patch-src__mesa__main__imports.c
@@ -0,0 +1,11 @@
+--- src/mesa/main/imports.c.orig 2014-05-28 09:50:40.000000000 +0200
++++ src/mesa/main/imports.c 2014-05-28 09:50:56.000000000 +0200
+@@ -571,7 +571,7 @@
+ {
+ #if defined(_GNU_SOURCE) && !defined(__CYGWIN__) && !defined(__FreeBSD__) && \
+ !defined(ANDROID) && !defined(__HAIKU__) && !defined(__UCLIBC__) && \
+- !defined(__NetBSD__)
++ !defined(__DragonFly__) && !defined(__NetBSD__)
+ static locale_t loc = NULL;
+ if (!loc) {
+ loc = newlocale(LC_CTYPE_MASK, "C", NULL);
diff --git a/graphics/libGL/files/pkg-install.in b/graphics/libGL/files/pkg-install.in
index 280922c0bbfc..f94c9f163ccb 100644
--- a/graphics/libGL/files/pkg-install.in
+++ b/graphics/libGL/files/pkg-install.in
@@ -12,6 +12,7 @@ POST-INSTALL)
/bin/ln -f ${PREFIX}/lib/.nvidia/libGL.so.1 ${PREFIX}/lib/libGL.so.1
else
/bin/ln -f ${PREFIX}/lib/.libGL/libGL.so.1 ${PREFIX}/lib/libGL.so
+ /bin/ln -f ${PREFIX}/lib/.libGL/libGL.so.1.2.0 ${PREFIX}/lib/libGL.so.1.2.0
/bin/ln -f ${PREFIX}/lib/.libGL/libGL.so.1 ${PREFIX}/lib/libGL.so.1
fi
;;
diff --git a/graphics/libGL/files/src__loader__Makefile.am b/graphics/libGL/files/src__loader__Makefile.am
new file mode 100644
index 000000000000..3739f42fd09d
--- /dev/null
+++ b/graphics/libGL/files/src__loader__Makefile.am
@@ -0,0 +1,12 @@
+--- ./src/loader/Makefile.am.orig 2014-02-05 21:59:10.000000000 +0100
++++ ./src/loader/Makefile.am 2014-02-23 22:01:50.000000000 +0100
+@@ -27,7 +27,8 @@
+ $(DEFINES) \
+ -I$(top_srcdir)/include \
+ $(VISIBILITY_CFLAGS) \
+- $(LIBUDEV_CFLAGS)
++ $(LIBUDEV_CFLAGS) \
++ $(LIBDEVQ_CFLAGS)
+
+ if !HAVE_LIBDRM
+ libloader_la_CPPFLAGS += \
diff --git a/graphics/libGL/pkg-plist b/graphics/libGL/pkg-plist
index 9cdb2a817f8b..9a467158be5c 100644
--- a/graphics/libGL/pkg-plist
+++ b/graphics/libGL/pkg-plist
@@ -1,23 +1,20 @@
-%%OLD%%include/GL/dmesa.h
-%%OLD%%include/GL/ggimesa.h
+@comment etc/drirc
+@comment include/GL/internal/dri_interface.h
include/GL/gl.h
include/GL/gl_mangle.h
+%%NEW%%include/GL/glcorearb.h
include/GL/glext.h
-%%OLD%%include/GL/glfbdev.h
include/GL/glx.h
include/GL/glx_mangle.h
include/GL/glxext.h
-%%OLD%%include/GL/mesa_wgl.h
-%%OLD%%include/GL/mglmesa.h
include/GL/osmesa.h
-%%OLD%%include/GL/svgamesa.h
-%%OLD%%include/GL/vms_x_fix.h
include/GL/wglext.h
include/GL/wmesa.h
-%%NEW%%lib/.libGL/libGL.la
lib/.libGL/libGL.so
lib/.libGL/libGL.so.1
-%%NEW%%lib/.libGL/libGL.so.1.2.0
+lib/.libGL/libGL.so.1.2.0
+@comment lib/libglapi.so
+@comment lib/libglapi.so.0
+@comment lib/libglapi.so.0.0.0
+@comment libdata/pkgconfig/dri.pc
libdata/pkgconfig/gl.pc
-@dirrm lib/.libGL
-@dirrmtry include/GL
diff --git a/graphics/libglapi/Makefile b/graphics/libglapi/Makefile
index 5cc98d90590c..fd441c6a820c 100644
--- a/graphics/libglapi/Makefile
+++ b/graphics/libglapi/Makefile
@@ -3,29 +3,36 @@
PORTNAME= libglapi
PORTVERSION= ${MESAVERSION}
-PORTREVISION= 1
+PORTREVISION= ${LIBGLAPI_REVISION}
CATEGORIES= graphics
COMMENT= Common GL api library used by Mesa based ports
-BUILD_DEPENDS= expat>=0:${PORTSDIR}/textproc/expat2 \
- libdrm>=0:${PORTSDIR}/graphics/libdrm \
- libpthread-stubs>=0:${PORTSDIR}/devel/libpthread-stubs
+LIB_DEPENDS+= libpthread-stubs.so:${PORTSDIR}/devel/libpthread-stubs
USE_XORG= x11 xau xcb xdmcp
# stuff not needed by libglapi but configure wants it
-USE_XORG+= glproto dri2proto dri3proto xext xdamage xfixes presentproto \
+USE_XORG+= glproto dri2proto xext xdamage xfixes presentproto \
xshmfence
-
-BUILD_WRKSRC= ${WRKSRC}/src/mapi/shared-glapi
-INSTALL_WRKSRC= ${WRKSRC}/src/mapi/shared-glapi
+LIB_DEPENDS+= libexpat.so:${PORTSDIR}/textproc/expat2 \
+ libdrm.so:${PORTSDIR}/graphics/libdrm
.include <bsd.port.options.mk>
+.include "${.CURDIR}/../../graphics/libGL/bsd.mesalib.mk"
-.if ! defined(WITH_NEW_XORG)
-IGNORE= Please enable WITH_NEW_XORG, libglapi needs libdrm higher then 2.4.24
+.if defined (WITH_NEW_MESA)
+LIBGLAPI_REVISION= 0
+.else
+LIBGLAPI_REVISION= 2
+.endif
+
+.if defined (WITH_NEW_MESA)
+BUILD_WRKSRC= ${WRKSRC}/src/mapi
+INSTALL_WRKSRC= ${WRKSRC}/src/mapi
+.else
+BUILD_WRKSRC= ${WRKSRC}/src/mapi/shared-glapi
+INSTALL_WRKSRC= ${WRKSRC}/src/mapi/shared-glapi
.endif
-.include "${.CURDIR}/../../graphics/libGL/bsd.mesalib.mk"
.include <bsd.port.mk>
diff --git a/graphics/libglapi/pkg-descr b/graphics/libglapi/pkg-descr
index a7fd4a9c80cc..f0ed995240bf 100644
--- a/graphics/libglapi/pkg-descr
+++ b/graphics/libglapi/pkg-descr
@@ -1,3 +1,3 @@
-This package contains the share GL API library.
+This package contains the EGL utility library.
WWW: http://www.freedesktop.org/Software/xorg
diff --git a/graphics/libglapi/pkg-plist b/graphics/libglapi/pkg-plist
index 184b8a40f2c0..f2a3e03c9109 100644
--- a/graphics/libglapi/pkg-plist
+++ b/graphics/libglapi/pkg-plist
@@ -1,4 +1,3 @@
-lib/libglapi.la
lib/libglapi.so
lib/libglapi.so.0
lib/libglapi.so.0.0.0
diff --git a/graphics/libglesv2/Makefile b/graphics/libglesv2/Makefile
index 371e0d445db1..5f74dbf2144e 100644
--- a/graphics/libglesv2/Makefile
+++ b/graphics/libglesv2/Makefile
@@ -3,31 +3,42 @@
PORTNAME= libglesv2
PORTVERSION= ${MESAVERSION}
-PORTREVISION= 2
+PORTREVISION= ${LIBGLES_REVISION}
CATEGORIES= graphics
COMMENT= OpenGL ES v2 library
-BUILD_DEPENDS= expat>=0:${PORTSDIR}/textproc/expat2
LIB_DEPENDS+= libdrm.so:${PORTSDIR}/graphics/libdrm \
- libglapi.so:${PORTSDIR}/graphics/libglapi
+ libglapi.so:${PORTSDIR}/graphics/libglapi \
+ libexpat.so:${PORTSDIR}/textproc/expat2
+
+# stuff not needed by libglesv2 but configure wants it
+USE_XORG+= glproto dri2proto xext xdamage xfixes presentproto \
+ xshmfence
.include <bsd.port.options.mk>
+.include "${.CURDIR}/../../graphics/libGL/bsd.mesalib.mk"
-.if ! defined(WITH_NEW_XORG)
-IGNORE= Please enable WITH_NEW_XORG, libglesv2 needs libdrm higher then 2.4.24
+.if defined(WITH_NEW_MESA)
+LIBGLES_REVISION= 0
+.else
+LIBGLES_REVISION= 3
.endif
-# stuff not needed by libEGL but configure wants it
-USE_XORG+= glproto dri2proto xext xdamage xfixes
-
-
-BUILD_WKRSRC= ${WRKSRC}/src/mapi/es2api
+.if defined(WITH_NEW_MESA)
+BUILD_WRKSRC= ${WRKSRC}/src/mapi
+INSTALL_WRKSRC= ${WRKSRC}/src/mapi
+.else
+BUILD_WRKSRC= ${WRKSRC}/src/mapi/es2api
INSTALL_WRKSRC= ${WRKSRC}/src/mapi/es2api
+.endif
-# this library doesn't exist in Mesa 7.6 so use newer
-WITH_NEW_XORG=yes
+.if !defined(WITH_NEW_MESA)
+pre-build:
+ @cd ${WRKSRC}/src/mapi/shared-glapi && ${MAKE_CMD} ${_MAKE_JOBS}
+.else
+post-install:
+ @${RM} ${STAGEDIR}/${PREFIX}/lib/libglapi*
+.endif
-.include <bsd.port.options.mk>
-.include "${.CURDIR}/../../graphics/libGL/bsd.mesalib.mk"
.include <bsd.port.mk>
diff --git a/graphics/libglesv2/pkg-plist b/graphics/libglesv2/pkg-plist
index 45c4e97a929e..3c7cb53d2282 100644
--- a/graphics/libglesv2/pkg-plist
+++ b/graphics/libglesv2/pkg-plist
@@ -2,12 +2,10 @@ include/GLES2/gl2.h
include/GLES2/gl2ext.h
include/GLES2/gl2platform.h
include/GLES3/gl3.h
+%%NEW%%include/GLES3/gl31.h
include/GLES3/gl3ext.h
include/GLES3/gl3platform.h
-lib/libGLESv2.la
lib/libGLESv2.so
lib/libGLESv2.so.2
lib/libGLESv2.so.2.0.0
libdata/pkgconfig/glesv2.pc
-@dirrmtry include/GLES3
-@dirrmtry include/GLES2