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