about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/libraries/cairo/0002-gl-don-t-implicitly-include-X11-headers.patch
blob: c34e93ae676acffe326f5664a5e43592763969f5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
From ec6ee0e09e2d59455241081af66fb3ba02def7e4 Mon Sep 17 00:00:00 2001
From: Alyssa Ross <hi@alyssa.is>
Date: Mon, 22 Apr 2019 10:41:27 +0000
Subject: [PATCH 2/5] gl: don't implicitly include X11 headers

EGL/egl.h on my system includes X11 headers by default, which breaks
compilation when they aren't available, even though Cairo doesn't need
them.

Fortunately, this only happens if MESA_EGL_NO_X11_HEADERS is not
defined, so defining that allows Cairo to be built with GL enabled even
when X11 isn't available.

Only when the Xlib surface is enabled are the headers guaranteed to be
available. In that case, MESA_EGL_NO_X11_HEADERS should not be defined,
to preserve compatibility with users expecting Cairo to include these
headers. (There are tests that make this assumption.)
---
 src/cairo-gl.h | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/cairo-gl.h b/src/cairo-gl.h
index 7cd869c76..a95b07bc3 100644
--- a/src/cairo-gl.h
+++ b/src/cairo-gl.h
@@ -127,6 +127,11 @@ cairo_gl_surface_create_for_dc (cairo_device_t		*device,
 #endif
 
 #if CAIRO_HAS_EGL_FUNCTIONS
+
+#if !CAIRO_HAS_XLIB_SURFACE && !defined(MESA_EGL_NO_X11_HEADERS)
+#define MESA_EGL_NO_X11_HEADERS
+#endif
+
 #include <EGL/egl.h>
 
 cairo_public cairo_device_t *
-- 
2.19.2