diff options
author | Alyssa Ross <hi@alyssa.is> | 2019-04-22 17:50:29 +0000 |
---|---|---|
committer | Alyssa Ross <hi@alyssa.is> | 2019-04-23 10:13:18 +0000 |
commit | 9240c60bf923394212bf34f6a70b7d66f4af2d09 (patch) | |
tree | d3381e0cfce31746ea87bcb5f6dcc0354133f5f9 /nixpkgs/pkgs/development/libraries/cairo | |
parent | b0de6eb3337b81eb07af08a0114462d7bf314cb6 (diff) | |
download | nixlib-9240c60bf923394212bf34f6a70b7d66f4af2d09.tar nixlib-9240c60bf923394212bf34f6a70b7d66f4af2d09.tar.gz nixlib-9240c60bf923394212bf34f6a70b7d66f4af2d09.tar.bz2 nixlib-9240c60bf923394212bf34f6a70b7d66f4af2d09.tar.lz nixlib-9240c60bf923394212bf34f6a70b7d66f4af2d09.tar.xz nixlib-9240c60bf923394212bf34f6a70b7d66f4af2d09.tar.zst nixlib-9240c60bf923394212bf34f6a70b7d66f4af2d09.zip |
cairo: make xlib support optional
Diffstat (limited to 'nixpkgs/pkgs/development/libraries/cairo')
3 files changed, 88 insertions, 2 deletions
diff --git a/nixpkgs/pkgs/development/libraries/cairo/0002-gl-don-t-implicitly-include-X11-headers.patch b/nixpkgs/pkgs/development/libraries/cairo/0002-gl-don-t-implicitly-include-X11-headers.patch new file mode 100644 index 000000000000..c34e93ae676a --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/cairo/0002-gl-don-t-implicitly-include-X11-headers.patch @@ -0,0 +1,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 + diff --git a/nixpkgs/pkgs/development/libraries/cairo/0003-test-only-build-GL-tests-when-Xlib-is-enabled.patch b/nixpkgs/pkgs/development/libraries/cairo/0003-test-only-build-GL-tests-when-Xlib-is-enabled.patch new file mode 100644 index 000000000000..09d7fd88627d --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/cairo/0003-test-only-build-GL-tests-when-Xlib-is-enabled.patch @@ -0,0 +1,41 @@ +From 84593a7e01b9afa74ec0bddd9515b666d476efba Mon Sep 17 00:00:00 2001 +From: Alyssa Ross <hi@alyssa.is> +Date: Mon, 22 Apr 2019 11:29:48 +0000 +Subject: [PATCH 3/5] test: only build GL tests when Xlib is enabled + +The GL tests all depend on Xlib functions, so they should only be +enabled when Xlib is enabled, because otherwise the required functions +might not be present. +--- + test/Makefile.am | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/test/Makefile.am b/test/Makefile.am +index e3c42ea88..9f77622bc 100644 +--- a/test/Makefile.am ++++ b/test/Makefile.am +@@ -16,10 +16,6 @@ test_sources += $(ft_font_test_sources) + endif + endif + +-if CAIRO_HAS_GL_SURFACE +-test_sources += $(gl_surface_test_sources) +-endif +- + if CAIRO_HAS_EGL_FUNCTIONS + test_sources += $(egl_surface_test_sources) + endif +@@ -51,6 +47,10 @@ endif + + if CAIRO_HAS_XLIB_SURFACE + test_sources += $(xlib_surface_test_sources) ++ ++if CAIRO_HAS_GL_SURFACE ++test_sources += $(gl_surface_test_sources) ++endif + endif + + if CAIRO_HAS_XLIB_XRENDER_SURFACE +-- +2.19.2 + diff --git a/nixpkgs/pkgs/development/libraries/cairo/default.nix b/nixpkgs/pkgs/development/libraries/cairo/default.nix index 2bd35f32610d..149ac5490461 100644 --- a/nixpkgs/pkgs/development/libraries/cairo/default.nix +++ b/nixpkgs/pkgs/development/libraries/cairo/default.nix @@ -3,7 +3,8 @@ , freetypeSupport ? true, freetype , fontconfigSupport ? freetypeSupport, fontconfig , gobjectSupport ? true, glib -, xlibXrenderSupport ? true +, xlibSupport ? true +, xlibXrenderSupport ? xlibSupport , xcbSupport ? true # no longer experimental since 1.12 , libGLSupported , glSupport ? config.cairo.gl or (libGLSupported && stdenv.isLinux && !stdenv.isAarch32 && !stdenv.isMips) @@ -13,6 +14,7 @@ }: assert fontconfigSupport -> freetypeSupport; +assert xlibXrenderSupport -> xlibSupport; assert glSupport -> libGL != null; let @@ -39,6 +41,8 @@ in stdenv.mkDerivation rec { }) ./0001-test-don-t-always-build-FreeType-dependent-test.patch + ./0002-gl-don-t-implicitly-include-X11-headers.patch + ./0003-test-only-build-GL-tests-when-Xlib-is-enabled.patch ]; outputs = [ "out" "dev" "devdoc" ]; @@ -60,7 +64,8 @@ in stdenv.mkDerivation rec { ]); propagatedBuildInputs = - with xorg; [ libX11 libXext expat pixman zlib libpng ] + with xorg; [ expat pixman zlib libpng ] + ++ optionals xlibSupport [ libX11 libXext ] ++ optional xlibXrenderSupport libXrender ++ optionals xcbSupport [ libxcb xcbutil ] ++ optional freetypeSupport freetype |