Ravenports generated: 22 Dec 2017 10:32
[ravenports.git] / bucket_F0 / mesa
1 # Buildsheet autogenerated by ravenadm tool -- Do not edit.
2
3 NAMEBASE=               mesa
4 VERSION=                17.3.1
5 KEYWORDS=               graphics
6 VARIANTS=               standard
7 SDESC[standard]=        Mesa 3D Graphics Library
8 HOMEPAGE=               https://www.mesa3d.org/
9 CONTACT=                nobody
10
11 DOWNLOAD_GROUPS=        main
12 SITES[main]=            https://mesa.freedesktop.org/archive/
13                         https://mesa.freedesktop.org/archive/17.3.1/
14                         ftp://ftp.freedesktop.org/pub/mesa/17.3.1/
15 DISTFILE[1]=            mesa-17.3.1.tar.xz:main
16 DF_INDEX=               1
17 SPKGS[standard]=        complete
18                         libs
19                         clover
20                         drivers
21                         osmesa
22
23 OPTIONS_AVAILABLE=      X86_DRIVERS ARM_DRIVERS
24 OPTIONS_STANDARD=       X86_DRIVERS ARM_DRIVERS
25 OPT_ON[aarch64]=        ARM_DRIVERS
26 OPT_ON[x86_64]=         X86_DRIVERS
27 OPT_ON[i386]=           X86_DRIVERS
28
29 BUILD_DEPENDS=          libpthread-stubs:single:standard
30                         libclc:single:standard
31                         llvm40:llvm:standard
32                         llvm40:clang:standard
33                         zlib:complete:standard
34                         libelf:single:standard
35                         libvdpau:single:standard
36                         libva:single:standard
37                         expat:static:standard
38 BUILDRUN_DEPENDS=       expat:shared:standard
39                         libdrm:single:standard
40                         ocl-icd:primary:standard
41                         opencl:single:standard
42 EXRUN[clover]=          llvm40:llvm:standard
43                         zlib:shared:standard
44                         libelf:single:standard
45                         expat:shared:standard
46                         libdrm:single:standard
47 EXRUN[drivers]=         llvm40:llvm:standard
48                         mesa:libs:standard
49                         zlib:shared:standard
50                         libelf:single:standard
51 EXRUN[osmesa]=          llvm40:llvm:standard
52                         mesa:libs:standard
53                         zlib:shared:standard
54
55 USES=                   bison gettext-tools gmake libtool pkgconfig
56                         python:py27,build shebangfix
57                         c++:clover,drivers,osmesa
58 XORG_COMPONENTS=        dri2proto dri3proto glproto presentproto x11 xcb
59                         xdamage xext xfixes xshmfence xxf86vm xv xvmc
60
61 FPC_EQUIVALENT=         graphics/mesa-libs
62 SHEBANG_FILES=          src/gallium/*/*/*.py
63                         src/gallium/tools/trace/*.py
64                         src/gallium/drivers/svga/svgadump/svga_dump.py
65                         src/mapi/glapi/gen/*.py
66                         src/mapi/mapi_abi.py
67                         src/util/xmlpool/gen_xmlpool.py
68                         src/mesa/main/get_*.py
69                         src/util/format_srgb.py
70                         src/amd/*/*.py
71                         src/intel/genxml/gen_pack_header.py
72 SHEBANG_OLD_PYTHON=     /usr/bin/env[[:space:]]python2
73                         /usr/bin/python2
74                         /bin/env[[:space:]]python
75
76 MUST_CONFIGURE=         gnu
77 CONFIGURE_ARGS=         --enable-llvm
78                         --enable-texture-float
79                         --enable-vdpau
80                         --enable-va
81                         --enable-xvmc
82                         --disable-glx-tls
83                         --disable-gles1
84                         --disable-libunwind
85                         --with-platforms=x11,drm
86                         --enable-gallium-osmesa
87                         --with-llvm-prefix={{LOCALBASE}}/llvm40
88                         --with-dri-drivers="{{DRI_DRIVERS:tl}}"
89                         --with-gallium_drivers="{{GALLIUM_DRIVERS:tl}}"
90
91 INSTALL_TARGET=         install-strip
92 INSTALL_REQ_TOOLCHAIN=  yes
93
94 LDFLAGS=                -Wl,-rpath={{LOCALBASE}}/llvm40/lib
95
96 [ARM_DRIVERS].DESCRIPTION=              Build drivers for aarch64 architecture
97 [ARM_DRIVERS].MAKEFILE_ON=              GALLIUM_DRIVERS+=FREEDRENO
98                                         GALLIUM_DRIVERS+=VC4
99
100 [X86_DRIVERS].DESCRIPTION=              Build drivers for i386 and x86_64 architectures
101 [X86_DRIVERS].CONFIGURE_ENABLE_BOTH=    opencl
102                                         opencl-icd
103 [X86_DRIVERS].MAKEFILE_ON=              DRI_DRIVERS+=RADEON
104                                         DRI_DRIVERS+=R200
105                                         DRI_DRIVERS+=I915
106                                         DRI_DRIVERS+=I965
107                                         GALLIUM_DRIVERS+=R300
108                                         GALLIUM_DRIVERS+=R600
109                                         GALLIUM_DRIVERS+=RADEONSI
110                                         GALLIUM_DRIVERS+=SVGA
111
112 post-patch:
113         @${REINPLACE_CMD} -e 's|/etc/|${PREFIX}/etc/|g' \
114                 ${WRKSRC}/src/util/xmlconfig.c
115         # Use --link-static until ports/223191 is fixed
116         @${REINPLACE_CMD} -e '/$$LLVM_VERSION_MAJOR -ge 4/s|test |false |' \
117                 ${WRKSRC}/configure
118
119 post-patch-freebsd:
120         @${REINPLACE_CMD} -e 's|x86_64|amd64|' ${WRKSRC}/configure
121
122 [FILE:808:descriptions/desc.libs]
123 The Mesa project began as an open-source implementation of the OpenGL
124 specification - a system for rendering interactive 3D graphics.
125
126 Over the years the project has grown to implement more graphics APIs,
127 including OpenGL ES (versions 1, 2, 3), OpenCL, OpenMAX, VDPAU, VA API,
128 XvMC and Vulkan.
129
130 A variety of device drivers allows the Mesa libraries to be used in many
131 different environments ranging from software emulation to complete
132 hardware acceleration for modern GPUs.
133
134 Mesa ties into several other open-source projects: the Direct Rendering
135 Infrastructure and X.org to provide OpenGL support on Linux, FreeBSD
136 and other operating systems.
137
138 This package contains the Mesa OpenGL libraries for GLX and EGL clients.
139 These include libEGL, libGL, and libglesv2 as well as utlity libraries
140 libglapi and gbm.
141
142
143 [FILE:130:descriptions/desc.clover]
144 This package contains Mesa's libOpenCL implementation "Clover".
145 It is built upon GALLIUM and currently only supports Radeon GPUs.
146
147
148 [FILE:162:descriptions/desc.drivers]
149 This package contains the Mesa OpenGL libraries for GLX and EGL clients.
150 These include libEGL, libGL, and libglesv2 as well as utlity libraries
151 libglapi and gbm.
152
153
154 [FILE:591:descriptions/desc.osmesa]
155 Mesa is a 3-D graphics library with an API which is very similar to that
156 of OpenGL*.  To the extent that Mesa utilizes the OpenGL command syntax or
157 state machine, it is being used with authorization from Silicon Graphics,
158 Inc.  However, the author makes no claim that Mesa is in any way a
159 compatible replacement for OpenGL or associated with Silicon Graphics, Inc.
160
161 This is a Off-Screen version of Mesa in order to do off-screen rendering in
162 other packages like VTK. Offscreen rendering is useful for a
163 number of things, such as batch processing, parallel processing, and
164 remote processing.
165
166
167 [FILE:97:distinfo]
168 9ae607e0998a586fb2c866cfc8e45e6f52d1c56cb1b41288253ea83eada824c1     10669392 mesa-17.3.1.tar.xz
169
170
171 [FILE:721:manifests/plist.libs]
172 include/EGL/
173  egl.h
174  eglext.h
175  eglextchromium.h
176  eglmesaext.h
177  eglplatform.h
178 include/GL/
179  gl.h
180  gl_mangle.h
181  glcorearb.h
182  glext.h
183  glx.h
184  glx_mangle.h
185  glxext.h
186 include/GLES2/
187  gl2.h
188  gl2ext.h
189  gl2platform.h
190 include/GLES3/
191  gl3.h
192  gl31.h
193  gl32.h
194  gl3ext.h
195  gl3platform.h
196 include/KHR/khrplatform.h
197 include/gbm.h
198 lib/
199  libEGL.so
200  libEGL.so.1
201  libEGL.so.1.0.0
202  libGL.so
203  libGL.so.1
204  libGL.so.1.2.0
205  libGLESv2.so
206  libGLESv2.so.2
207  libGLESv2.so.2.0.0
208  libgbm.so
209  libgbm.so.1
210  libgbm.so.1.0.0
211  libglapi.so
212  libglapi.so.0
213  libglapi.so.0.0.0
214 @comment lib/libwayland-egl.so
215 @comment lib/libwayland-egl.so.1
216 @comment lib/libwayland-egl.so.1.0.0
217 lib/pkgconfig/
218  egl.pc
219  gbm.pc
220  gl.pc
221  glesv2.pc
222 @comment lib/pkgconfig/wayland-egl.pc
223
224
225 [FILE:245:manifests/plist.clover]
226 %%X86_DRIVERS-ON%%etc/OpenCL/vendors/mesa.icd
227 %%X86_DRIVERS-ON%%lib/gallium-pipe/
228  pipe_r300.so
229  pipe_r600.so
230  pipe_radeonsi.so
231  pipe_swrast.so
232  pipe_vmwgfx.so
233 %%X86_DRIVERS-ON%%lib/
234  libMesaOpenCL.so
235  libMesaOpenCL.so.1
236  libMesaOpenCL.so.1.0.0
237
238
239 [FILE:868:manifests/plist.drivers]
240 etc/drirc
241 include/GL/internal/dri_interface.h
242 %%X86_DRIVERS-ON%%lib/dri/
243  i915_dri.so
244  i965_dri.so
245 %%ARM_DRIVERS-ON%%lib/dri/
246  kgsl_dri.so
247 lib/dri/
248  kms_swrast_dri.so
249 %%ARM_DRIVERS-ON%%lib/dri/
250  msm_dri.so
251 %%X86_DRIVERS-ON%%lib/dri/
252  r200_dri.so
253  r300_dri.so
254  r600_dri.so
255  r600_drv_video.so
256  radeon_dri.so
257  radeonsi_dri.so
258  radeonsi_drv_video.so
259 lib/dri/
260  swrast_dri.so
261 %%ARM_DRIVERS-ON%%lib/dri/
262  vc4_dri.so
263 %%X86_DRIVERS-ON%%lib/dri/
264  vmwgfx_dri.so
265 %%X86_DRIVERS-ON%%lib/
266  libXvMCr600.so
267  libXvMCr600.so.1
268  libXvMCr600.so.1.0
269  libXvMCr600.so.1.0.0
270 %%X86_DRIVERS-ON%%lib/vdpau/
271  libvdpau_r300.so
272  libvdpau_r300.so.1
273  libvdpau_r300.so.1.0
274  libvdpau_r300.so.1.0.0
275  libvdpau_r600.so
276  libvdpau_r600.so.1
277  libvdpau_r600.so.1.0
278  libvdpau_r600.so.1.0.0
279  libvdpau_radeonsi.so
280  libvdpau_radeonsi.so.1
281  libvdpau_radeonsi.so.1.0
282  libvdpau_radeonsi.so.1.0.0
283 lib/pkgconfig/dri.pc
284
285
286 [FILE:99:manifests/plist.osmesa]
287 include/GL/osmesa.h
288 lib/
289  libOSMesa.so
290  libOSMesa.so.8
291  libOSMesa.so.8.0.0
292 lib/pkgconfig/osmesa.pc
293
294
295 [FILE:1408:patches/patch-configure]
296 --- configure.orig      2017-12-21 17:31:27 UTC
297 +++ configure
298 @@ -23308,7 +23308,7 @@ fi
299  
300  
301  case "$host_os" in
302 -linux*)
303 +linux* | freebsd* | dragonfly*)
304      dri3_default=yes
305      ;;
306  *)
307 @@ -27028,9 +27028,19 @@ if test "x$enable_opencl" = xyes; then
308          as_fn_error $? "cannot enable OpenCL without Gallium" "$LINENO" 5
309      fi
310  
311 +    if test "x$acv_mesa_CLANG" = xno; then
312 +
313 +    GCC_VERSION=`$CC -dumpversion`
314 +    if test $? -eq 0; then
315 +        GCC_VERSION_MAJOR=`echo $GCC_VERSION | cut -d. -f1`
316 +        GCC_VERSION_MINOR=`echo $GCC_VERSION | cut -d. -f2`
317 +    fi
318 +
319      if test $GCC_VERSION_MAJOR -lt 4 -o $GCC_VERSION_MAJOR -eq 4 -a $GCC_VERSION_MINOR -lt 7; then
320          as_fn_error $? "gcc >= 4.7 is required to build clover" "$LINENO" 5
321      fi
322 +# end of clang test.
323 +    fi
324  
325      if test "x$have_libclc" = xno; then
326          as_fn_error $? "pkg-config cannot find libclc.pc which is required to build clover.
327 @@ -27096,9 +27106,6 @@ rm -f core conftest.err conftest.$ac_obj
328          CLANG_LIBDIR=${LLVM_LIBDIR}
329      fi
330      CLANG_RESOURCE_DIR=$CLANG_LIBDIR/clang/${LLVM_VERSION}
331 -    if test ! -f "$CLANG_RESOURCE_DIR/include/stddef.h"; then :
332 -  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
333 -fi
334  fi
335   if test "x$enable_opencl" = xyes; then
336    HAVE_CLOVER_TRUE=
337
338
339 [FILE:512:patches/patch-include_GL_internal_dri__interface.h]
340 GCC on 9.x doesn't allow types to be overwritten, these types are defined
341 in drm.h also, which causes build issues in xorg-server.
342
343 --- include/GL/internal/dri_interface.h.orig    2017-12-21 17:31:21 UTC
344 +++ include/GL/internal/dri_interface.h
345 @@ -40,13 +40,7 @@
346  #ifndef DRI_INTERFACE_H
347  #define DRI_INTERFACE_H
348  
349 -#ifdef HAVE_LIBDRM
350  #include <drm.h>
351 -#else
352 -typedef unsigned int drm_context_t;
353 -typedef unsigned int drm_drawable_t;
354 -typedef struct drm_clip_rect drm_clip_rect_t;
355 -#endif
356  
357  #include <stdint.h>
358  
359
360
361 [FILE:584:patches/patch-src_egl_drivers_dri2_platform__x11.c]
362 # work-around for https://bugs.freedesktop.org/show_bug.cgi?id=100627
363 #
364 --- src/egl/drivers/dri2/platform_x11.c.orig    2017-12-21 17:31:21 UTC
365 +++ src/egl/drivers/dri2/platform_x11.c
366 @@ -1462,6 +1462,9 @@ dri2_initialize_x11(_EGLDriver *drv, _EG
367  
368     if (!disp->Options.UseFallback) {
369  #ifdef HAVE_DRI3
370 +#if (defined(__FreeBSD__) || defined(__FreeBSD_kernel__)) && !defined(__DRM_NEXT__)
371 +      if (env_var_as_boolean("LIBGL_DRI3_ENABLE", false))
372 +#endif
373        if (!env_var_as_boolean("LIBGL_DRI3_DISABLE", false))
374           initialized = dri2_initialize_x11_dri3(drv, disp);
375  #endif
376
377
378 [FILE:3256:patches/patch-src_gallium_auxiliary_pipe-loader_pipe__loader__drm.c]
379 Revert the following commit.
380
381 FreeBSD and DragonFly don't have the required render nodes.
382
383 -------
384
385 From 69a1b9959e59653da262185c4e2cf57d24939b19 Mon Sep 17 00:00:00 2001
386 From: Emil Velikov <emil.l.velikov@gmail.com>
387 Date: Mon, 29 Jun 2015 12:36:45 +0100
388 Subject: pipe-loader: drop support for non-render node devices
389
390 Render nodes have been around for quite some time. Removing support via
391 the master/primary node allows us to clean up the conditional
392 compilation and simplify the build greatly.
393
394 For example currently we the pipe-loader, which explicitly links against
395 xcb and friends (for X auth) if found at compile-time. That
396 would cause problems as one will be forced to use X/xcb, even if it's a
397 headless system that is used for opencl.
398
399 v2: Clarify the linking topic in the commit message.
400
401 Cc: Tom Stellard <thomas.stellard@amd.com>
402 Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
403 Reviewed-by: Francisco Jerez <currojerez@riseup.net>
404
405
406 --- src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c.orig    2017-12-21 17:31:21 UTC
407 +++ src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c
408 @@ -207,6 +207,14 @@ pipe_loader_drm_probe_fd(struct pipe_loa
409  }
410  
411  static int
412 +open_drm_minor(int minor)
413 +{
414 +   char path[PATH_MAX];
415 +   snprintf(path, sizeof(path), DRM_DEV_NAME, DRM_DIR_NAME, minor);
416 +   return open(path, O_RDWR, 0);
417 +}
418 +
419 +static int
420  open_drm_render_node_minor(int minor)
421  {
422     char path[PATH_MAX];
423 @@ -218,8 +226,15 @@ open_drm_render_node_minor(int minor)
424  int
425  pipe_loader_drm_probe(struct pipe_loader_device **devs, int ndev)
426  {
427 -   int i, j, fd;
428 +   int i, k, fd, num_render_node_devs;
429 +   int j = 0;
430 +
431 +   struct {
432 +      unsigned vendor_id;
433 +      unsigned chip_id;
434 +   } render_node_devs[DRM_RENDER_NODE_MAX_NODES];
435  
436 +   /* Look for render nodes first */
437     for (i = DRM_RENDER_NODE_MIN_MINOR, j = 0;
438          i <= DRM_RENDER_NODE_MAX_MINOR; i++) {
439        struct pipe_loader_device *dev;
440 @@ -233,6 +248,9 @@ pipe_loader_drm_probe(struct pipe_loader
441           continue;
442        }
443  
444 +      render_node_devs[j].vendor_id = dev->u.pci.vendor_id;
445 +      render_node_devs[j].chip_id = dev->u.pci.chip_id;
446 +
447        if (j < ndev) {
448           devs[j] = dev;
449        } else {
450 @@ -242,6 +260,46 @@ pipe_loader_drm_probe(struct pipe_loader
451        j++;
452     }
453  
454 +   num_render_node_devs = j;
455 +
456 +   /* Next look for drm devices. */
457 +   for (i = 0; i < DRM_MAX_MINOR; i++) {
458 +      struct pipe_loader_device *dev;
459 +      boolean duplicate = FALSE;
460 +      fd = open_drm_minor(i);
461 +      if (fd < 0)
462 +         continue;
463 +
464 +      if (!pipe_loader_drm_probe_fd(&dev, fd)) {
465 +         close(fd);
466 +         continue;
467 +      }
468 +
469 +      /* Check to make sure we aren't already accessing this device via
470 +       * render nodes.
471 +       */
472 +      for (k = 0; k < num_render_node_devs; k++) {
473 +         if (dev->u.pci.vendor_id == render_node_devs[k].vendor_id &&
474 +             dev->u.pci.chip_id == render_node_devs[k].chip_id) {
475 +            close(fd);
476 +            dev->ops->release(&dev);
477 +            duplicate = TRUE;
478 +            break;
479 +         }
480 +      }
481 +
482 +      if (duplicate)
483 +         continue;
484 +
485 +      if (j < ndev) {
486 +         devs[j] = dev;
487 +      } else {
488 +         dev->ops->release(&dev);
489 +      }
490 +
491 +      j++;
492 +   }
493 +
494     return j;
495  }
496  
497
498
499 [FILE:504:patches/patch-src_gallium_auxiliary_util_u__network.c]
500 --- src/gallium/auxiliary/util/u_network.c.orig 2017-12-21 17:31:21 UTC
501 +++ src/gallium/auxiliary/util/u_network.c
502 @@ -6,7 +6,7 @@
503  #if defined(PIPE_SUBSYSTEM_WINDOWS_USER)
504  #  include <winsock2.h>
505  #  include <windows.h>
506 -#elif defined(PIPE_OS_LINUX) || defined(PIPE_OS_HAIKU) || \
507 +#elif defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_HAIKU) || \
508     defined(PIPE_OS_APPLE) || defined(PIPE_OS_CYGWIN) || defined(PIPE_OS_SOLARIS)
509  #  include <sys/socket.h>
510  #  include <netinet/in.h>
511
512
513 [FILE:360:patches/patch-src_gallium_drivers_vc4_vc4__bufmgr.c]
514 # define ETIME as ETIMEOUT same as in intel driver
515 #
516 --- src/gallium/drivers/vc4/vc4_bufmgr.c.orig   2017-12-21 17:31:21 UTC
517 +++ src/gallium/drivers/vc4/vc4_bufmgr.c
518 @@ -27,6 +27,9 @@
519  #include <fcntl.h>
520  #include <xf86drm.h>
521  #include <xf86drmMode.h>
522 +#ifndef ETIME
523 +#define ETIME ETIMEDOUT
524 +#endif
525  
526  #include "util/u_hash_table.h"
527  #include "util/u_memory.h"
528
529
530 [FILE:1043:patches/patch-src_gallium_include_pipe_p__config.h]
531 --- src/gallium/include/pipe/p_config.h.orig    2017-12-21 17:31:21 UTC
532 +++ src/gallium/include/pipe/p_config.h
533 @@ -77,6 +77,13 @@
534  #define PIPE_CC_ICL
535  #endif
536  
537 +#if defined(__sparc__) || defined(__sparc64__)
538 +#define PIPE_ARCH_SPARC
539 +#if defined(__sparc64__)
540 +#define PIPE_ARCH_SPARC_64
541 +#endif
542 +#endif
543 +
544  
545  /*
546   * Processor architecture
547 @@ -131,7 +138,7 @@
548  
549  #if defined(PIPE_ARCH_X86) || defined(PIPE_ARCH_X86_64) || defined(PIPE_ARCH_ARM) || defined(PIPE_ARCH_AARCH64)
550  #define PIPE_ARCH_LITTLE_ENDIAN
551 -#elif defined(PIPE_ARCH_PPC) || defined(PIPE_ARCH_PPC_64) || defined(PIPE_ARCH_S390)
552 +#elif defined(PIPE_ARCH_PPC) || defined(PIPE_ARCH_PPC_64) || defined(PIPE_ARCH_S390) || defined(PIPE_ARCH_SPARC) || defined(PIPE_ARCH_SPARC_64)
553  #define PIPE_ARCH_BIG_ENDIAN
554  #endif
555  
556 @@ -160,6 +167,12 @@
557  #define PIPE_OS_ANDROID
558  #endif
559  
560 +#if defined(__DragonFly__)
561 +#define PIPE_OS_DRAGONFLY
562 +#define PIPE_OS_BSD
563 +#define PIPE_OS_UNIX
564 +#endif
565 +
566  #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
567  #define PIPE_OS_FREEBSD
568  #define PIPE_OS_BSD
569
570
571 [FILE:1577:patches/patch-src_gallium_state__trackers_clover_llvm_invocation.cpp]
572 # fix errors like the following
573 #
574 # llvm/invocation.cpp:(.text+0x1275): undefined reference to `std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::c_str()
575  const'
576 # /usr/bin/ld: ../../../../src/gallium/state_trackers/clover/.libs/libclover.a(libclllvm_la-invocation.o): relocation R_X86_64_PC32 against `_ZNKSt3__112bas
577 ic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE5c_strEv' can not be used when making a shared object; recompile with -fPIC
578 # /usr/bin/ld: final link failed: Bad value
579 #
580 --- src/gallium/state_trackers/clover/llvm/invocation.cpp.orig  2017-12-21 17:31:21 UTC
581 +++ src/gallium/state_trackers/clover/llvm/invocation.cpp
582 @@ -93,6 +93,8 @@ namespace {
583        return ctx;
584     }
585  
586 +   const char* cstr(const std::string& str) { return str.c_str(); }
587 +
588     std::unique_ptr<clang::CompilerInstance>
589     create_compiler_instance(const target &target,
590                              const std::vector<std::string> &opts,
591 @@ -105,8 +107,8 @@ namespace {
592        // Parse the compiler options.  A file name should be present at the end
593        // and must have the .cl extension in order for the CompilerInvocation
594        // class to recognize it as an OpenCL source file.
595 -      const std::vector<const char *> copts =
596 -         map(std::mem_fn(&std::string::c_str), opts);
597 +      std::vector<const char *> copts(opts.size());
598 +      std::transform(opts.begin(), opts.end(), copts.begin(), cstr);
599  
600        if (!clang::CompilerInvocation::CreateFromArgs(
601               c->getInvocation(), copts.data(), copts.data() + copts.size(), diag))
602
603
604 [FILE:635:patches/patch-src_gallium_state__trackers_clover_llvm_metadata.hpp]
605 # Fix error: no matching constructor for initialization of 'std::vector<const ::llvm::MDNode *>' 
606 #
607 --- src/gallium/state_trackers/clover/llvm/metadata.hpp.orig    2017-12-21 17:31:21 UTC
608 +++ src/gallium/state_trackers/clover/llvm/metadata.hpp
609 @@ -42,7 +42,7 @@ namespace clover {
610           get_kernel_nodes(const ::llvm::Module &mod) {
611              if (const ::llvm::NamedMDNode *n =
612                     mod.getNamedMetadata("opencl.kernels"))
613 -               return { n->op_begin(), n->op_end() };
614 +               return { n->getOperand(0), n->getOperand(n->getNumOperands()) };
615              else
616                 return {};
617           }
618
619
620 [FILE:1150:patches/patch-src_gallium_state__trackers_clover_util_range.hpp]
621 From b95533b981af9a6687b41418e7cc2a5652fc2bdb Mon Sep 17 00:00:00 2001
622 From: =?UTF-8?q?Jean-S=C3=A9bastien=20P=C3=A9dron?= <dumbbell@FreeBSD.org>
623 Date: Fri, 7 Mar 2014 15:16:08 +0100
624 Subject: [PATCH 3/3] Work around for clang 3.4 which fails to build Clover
625
626 See:
627   https://bugs.freedesktop.org/show_bug.cgi?id=74098#c3
628 --- src/gallium/state_trackers/clover/util/range.hpp.orig       2017-12-21 17:31:21 UTC
629 +++ src/gallium/state_trackers/clover/util/range.hpp
630 @@ -362,6 +362,12 @@ namespace clover {
631        return { i, i + n };
632     }
633  
634 +   namespace detail {
635 +      template<typename T>
636 +      using fixup_function_type =
637 +         typename std::conditional<std::is_function<T>::value, T &, T>::type;
638 +   }
639 +
640     ///
641     /// Create a range by transforming the contents of a number of
642     /// source ranges \a rs element-wise using a provided functor \a f.
643 @@ -369,7 +375,7 @@ namespace clover {
644     /// \sa adaptor_range.
645     ///
646     template<typename F, typename... Rs>
647 -   adaptor_range<F, Rs...>
648 +   adaptor_range<detail::fixup_function_type<F>, Rs...>
649     map(F &&f, Rs &&... rs) {
650        return { std::forward<F>(f), std::forward<Rs>(rs)... };
651     }
652
653
654 [FILE:429:patches/patch-src_gallium_winsys_svga_drm_vmw__screen__ioctl.c]
655 --- src/gallium/winsys/svga/drm/vmw_screen_ioctl.c.orig 2017-12-21 17:31:21 UTC
656 +++ src/gallium/winsys/svga/drm/vmw_screen_ioctl.c
657 @@ -70,6 +70,11 @@ vmw_region_size(struct vmw_region *regio
658     return region->size;
659  }
660  
661 +#if defined(__DragonFly__) || defined(__FreeBSD__) || \
662 +    defined(__NetBSD__) || defined(__OpenBSD__)
663 +#define ERESTART EINTR
664 +#endif
665 +
666  uint32
667  vmw_ioctl_context_create(struct vmw_winsys_screen *vws)
668  {
669
670
671 [FILE:575:patches/patch-src_glx_glxext.c]
672 # work-around for https://bugs.freedesktop.org/show_bug.cgi?id=100627
673 #
674 --- src/glx/glxext.c.orig       2017-12-21 17:31:21 UTC
675 +++ src/glx/glxext.c
676 @@ -920,6 +920,9 @@ __glXInitialize(Display * dpy)
677  #if defined(GLX_USE_DRM)
678     if (glx_direct && glx_accel) {
679  #if defined(HAVE_DRI3)
680 +#if (defined(__FreeBSD__) || defined(__FreeBSD_kernel__)) && !defined(__DRM_NEXT__)
681 +      if (env_var_as_boolean("LIBGL_DRI3_ENABLE", false))
682 +#endif
683        if (!env_var_as_boolean("LIBGL_DRI3_DISABLE", false))
684           dpyPriv->dri3Display = dri3_create_display(dpy);
685  #endif /* HAVE_DRI3 */
686
687
688 [FILE:702:patches/patch-src_intel_Makefile.in]
689 ../../src/util/.libs/libmesautil.a(libmesautil_la-half_float.o): In function `_mesa_float_to_half':
690 half_float.c:(.text+0x94): undefined reference to `lrintf'
691 half_float.c:(.text+0xbf): undefined reference to `lrintf'
692 cc: error: linker command failed with exit code 1 (use -v to see invocation)
693 gmake[5]: *** [Makefile:2706: tools/aubinator_error_decode] Error 1
694
695 --- src/intel/Makefile.in.orig  2017-12-21 17:31:31 UTC
696 +++ src/intel/Makefile.in
697 @@ -1977,7 +1977,8 @@ tools_aubinator_error_decode_LDADD = \
698         compiler/libintel_compiler.la \
699         $(top_builddir)/src/util/libmesautil.la \
700         $(PTHREAD_LIBS) \
701 -       $(ZLIB_LIBS)
702 +       $(ZLIB_LIBS) \
703 +       -lm
704  
705  tools_aubinator_error_decode_CFLAGS = \
706         $(AM_CFLAGS) \
707
708
709 [FILE:302:patches/patch-src_intel_tools_aubinator__error__decode.c]
710 # expose getline in FreeBSD's stdio.h
711 #
712 --- src/intel/tools/aubinator_error_decode.c.orig       2017-12-21 17:31:21 UTC
713 +++ src/intel/tools/aubinator_error_decode.c
714 @@ -22,6 +22,9 @@
715   *
716   */
717  
718 +#ifdef __FreeBSD__
719 +#define _WITH_GETLINE
720 +#endif
721  #include <stdbool.h>
722  #include <stdio.h>
723  #include <stdlib.h>
724
725
726 [FILE:619:patches/patch-src_mapi_glapi_gen_gl__gentable.py]
727 --- src/mapi/glapi/gen/gl_gentable.py.orig      2017-12-21 17:31:21 UTC
728 +++ src/mapi/glapi/gen/gl_gentable.py
729 @@ -43,7 +43,7 @@ header = """/* GLXEXT is the define used
730  #endif
731  
732  #if (defined(GLXEXT) && defined(HAVE_BACKTRACE)) \\
733 -       || (!defined(GLXEXT) && defined(DEBUG) && !defined(__CYGWIN__) && !defined(__MINGW32__) && !defined(__OpenBSD__) && !defined(__NetBSD__) && !defined(__DragonFly__))
734 +       || (!defined(GLXEXT) && defined(DEBUG) && !defined(__CYGWIN__) && !defined(__MINGW32__) && !defined(__OpenBSD__) && !defined(__NetBSD__) && !defined(__FreeBSD__) && !defined(__DragonFly__))
735  #define USE_BACKTRACE
736  #endif
737  
738
739
740 [FILE:406:patches/patch-src_mesa_main_compiler.h]
741 --- src/mesa/main/compiler.h.orig       2017-12-21 17:31:22 UTC
742 +++ src/mesa/main/compiler.h
743 @@ -51,6 +51,9 @@
744  #if defined(__linux__)
745  #include <byteswap.h>
746  #define CPU_TO_LE32( x )       bswap_32( x )
747 +#elif defined(__FreeBSD__)
748 +#include <sys/endian.h>
749 +#define CPU_TO_LE32( x )       bswap32( x )
750  #elif defined(__APPLE__)
751  #include <CoreFoundation/CFByteOrder.h>
752  #define CPU_TO_LE32( x )       CFSwapInt32HostToLittle( x )
753
754
755 [FILE:377:patches/patch-src_util_build__id.c]
756 # Elf_ doesn't exist, use Elf32_ or Elf64_
757 #
758 --- src/util/build_id.c.orig    2017-12-21 17:31:22 UTC
759 +++ src/util/build_id.c
760 @@ -34,7 +34,11 @@
761  #endif
762  
763  #ifndef ElfW
764 -#define ElfW(type) Elf_##type
765 +#ifdef __LP64__
766 +#define ElfW(type) Elf64_##type
767 +#else
768 +#define ElfW(type) Elf32_##type
769 +#endif
770  #endif
771  
772  #define ALIGN(val, align)      (((val) + (align) - 1) & ~((align) - 1))
773
774
775 [FILE:343:patches/patch-src_util_u__endian.h]
776 --- src/util/u_endian.h.orig    2017-12-21 17:31:22 UTC
777 +++ src/util/u_endian.h
778 @@ -54,7 +54,7 @@
779  # define PIPE_ARCH_BIG_ENDIAN
780  #endif
781  
782 -#elif defined(__OpenBSD__) || defined(__NetBSD__)
783 +#elif defined(__OpenBSD__) || defined(__NetBSD__) || defined(__FreeBSD__) || defined(__DragonFly__)
784  #include <sys/types.h>
785  #include <machine/endian.h>
786  
787
788
789 [FILE:47:files/special.mk]
790 DRI_DRIVERS+=           SWRAST
791 GALLIUM_DRIVERS+=       SWRAST
792
793
794 [FILE:686:dragonfly/patch-src_intel_tools_aubinator.c]
795 # We don't have MAP_NORESERVE so use MAP_NOSYNC | MAP_NOCORE and
796 # hope for the best (this alloc is too big but it's only a test)
797 #
798 --- src/intel/tools/aubinator.c.orig    2017-12-21 17:31:21 UTC
799 +++ src/intel/tools/aubinator.c
800 @@ -1237,7 +1237,7 @@ int main(int argc, char *argv[])
801     /* mmap a terabyte for our gtt space. */
802     gtt_size = 1ull << 40;
803     gtt = mmap(NULL, gtt_size, PROT_READ | PROT_WRITE,
804 -              MAP_PRIVATE | MAP_ANONYMOUS |  MAP_NORESERVE, -1, 0);
805 +              MAP_PRIVATE | MAP_ANONYMOUS | MAP_NOSYNC | MAP_NOCORE, -1, 0);
806     if (gtt == MAP_FAILED) {
807        fprintf(stderr, "failed to alloc gtt space: %s\n", strerror(errno));
808        exit(EXIT_FAILURE);
809
810
811 [FILE:686:freebsd/patch-src_intel_tools_aubinator.c]
812 # We don't have MAP_NORESERVE so use MAP_NOSYNC | MAP_NOCORE and
813 # hope for the best (this alloc is too big but it's only a test)
814 #
815 --- src/intel/tools/aubinator.c.orig    2017-12-21 17:31:21 UTC
816 +++ src/intel/tools/aubinator.c
817 @@ -1237,7 +1237,7 @@ int main(int argc, char *argv[])
818     /* mmap a terabyte for our gtt space. */
819     gtt_size = 1ull << 40;
820     gtt = mmap(NULL, gtt_size, PROT_READ | PROT_WRITE,
821 -              MAP_PRIVATE | MAP_ANONYMOUS |  MAP_NORESERVE, -1, 0);
822 +              MAP_PRIVATE | MAP_ANONYMOUS | MAP_NOSYNC | MAP_NOCORE, -1, 0);
823     if (gtt == MAP_FAILED) {
824        fprintf(stderr, "failed to alloc gtt space: %s\n", strerror(errno));
825        exit(EXIT_FAILURE);
826