diff options
Diffstat (limited to 'nixpkgs/pkgs/development/libraries/cairo')
5 files changed, 289 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/development/libraries/cairo/0001-test-don-t-always-build-FreeType-dependent-test.patch b/nixpkgs/pkgs/development/libraries/cairo/0001-test-don-t-always-build-FreeType-dependent-test.patch new file mode 100644 index 000000000000..9688aca55ab9 --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/cairo/0001-test-don-t-always-build-FreeType-dependent-test.patch @@ -0,0 +1,34 @@ +From 3910b1155f2d5a98142ade67e09f097cb94a2d2e Mon Sep 17 00:00:00 2001 +From: Alyssa Ross <hi@alyssa.is> +Date: Mon, 22 Apr 2019 09:53:54 +0000 +Subject: [PATCH 1/5] test: don't always build FreeType-dependent test + +This caused a build failure when attempting to build cairo without +FreeType available on the system. +--- + test/Makefile.sources | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/test/Makefile.sources b/test/Makefile.sources +index c47131faf..cc3d81f7e 100644 +--- a/test/Makefile.sources ++++ b/test/Makefile.sources +@@ -144,7 +144,6 @@ test_sources = \ + font-face-get-type.c \ + font-matrix-translation.c \ + font-options.c \ +- font-variations.c \ + glyph-cache-pressure.c \ + get-and-set.c \ + get-clip.c \ +@@ -399,6 +398,7 @@ pthread_test_sources = \ + + ft_font_test_sources = \ + bitmap-font.c \ ++ font-variations.c \ + ft-font-create-for-ft-face.c \ + ft-show-glyphs-positioning.c \ + ft-show-glyphs-table.c \ +-- +2.19.2 + 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/0004-util-don-t-build-cairo-sphinx-unless-PNG-enabled.patch b/nixpkgs/pkgs/development/libraries/cairo/0004-util-don-t-build-cairo-sphinx-unless-PNG-enabled.patch new file mode 100644 index 000000000000..702c4d49e484 --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/cairo/0004-util-don-t-build-cairo-sphinx-unless-PNG-enabled.patch @@ -0,0 +1,32 @@ +From 8b7816ea38a1869e7de94341e3ea9e1eebb8eb4f Mon Sep 17 00:00:00 2001 +From: Alyssa Ross <hi@alyssa.is> +Date: Mon, 22 Apr 2019 13:08:30 +0000 +Subject: [PATCH 4/5] util: don't build cairo-sphinx unless PNG enabled + +cairo-sphinx won't build without libpng, because +cairo_surface_write_to_png won't be defined. +--- + util/Makefile.am | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/util/Makefile.am b/util/Makefile.am +index 82d0a804c..119b59f48 100644 +--- a/util/Makefile.am ++++ b/util/Makefile.am +@@ -25,11 +25,13 @@ if BUILD_SPHINX + if CAIRO_HAS_DLSYM + if CAIRO_HAS_SCRIPT_SURFACE + if CAIRO_HAS_TEE_SURFACE ++if CAIRO_HAS_PNG_FUNCTIONS + SUBDIRS += cairo-sphinx + endif + endif + endif + endif ++endif + + AM_CPPFLAGS = -I$(top_srcdir)/src \ + -I$(top_builddir)/src \ +-- +2.19.2 + diff --git a/nixpkgs/pkgs/development/libraries/cairo/default.nix b/nixpkgs/pkgs/development/libraries/cairo/default.nix new file mode 100644 index 000000000000..9997dcec2970 --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/cairo/default.nix @@ -0,0 +1,142 @@ +{ config, stdenv, lib, fetchurl, fetchpatch, pkgconfig, autoreconfHook +, pixman +, zlibSupport ? true, zlib +, pngSupport ? true, libpng +, freetypeSupport ? true, freetype +, fontconfigSupport ? freetypeSupport, fontconfig +, gobjectSupport ? true, glib +, x11Support ? !stdenv.isDarwin, libX11, libXext +, x11XrenderSupport ? x11Support, libXrender +, xcbSupport ? !stdenv.isDarwin, libxcb # no longer experimental since 1.12 +, libGLSupported ? stdenv.lib.elem stdenv.hostPlatform.system stdenv.lib.platforms.mesaPlatforms +, glSupport ? config.cairo.gl or (libGLSupported && stdenv.isLinux) +, libGL ? null # libGLU libGL is no longer a big dependency +, darwin +}: + +assert fontconfigSupport -> freetypeSupport; +assert x11XrenderSupport -> x11Support; +assert glSupport -> libGL != null; + +let + version = "1.16.0"; + inherit (lib) enableFeature optional optionals; +in stdenv.mkDerivation rec { + pname = "cairo"; + inherit version; + + src = fetchurl { + url = "https://cairographics.org/${if lib.mod (builtins.fromJSON (lib.versions.minor version)) 2 == 0 then "releases" else "snapshots"}/${pname}-${version}.tar.xz"; + sha256 = "0c930mk5xr2bshbdljv005j3j8zr47gqmkry3q6qgvqky6rjjysy"; + }; + + patches = [ + # Fixes CVE-2018-19876; see Nixpkgs issue #55384 + # CVE information: https://nvd.nist.gov/vuln/detail/CVE-2018-19876 + # Upstream PR: https://gitlab.freedesktop.org/cairo/cairo/merge_requests/5 + # + # This patch is the merged commit from the above PR. + (fetchpatch { + name = "CVE-2018-19876.patch"; + url = "https://gitlab.freedesktop.org/cairo/cairo/commit/6edf572ebb27b00d3c371ba5ae267e39d27d5b6d.patch"; + sha256 = "112hgrrsmcwxh1r52brhi5lksq4pvrz4xhkzcf2iqp55jl2pb7n1"; + }) + + ./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 + ./0004-util-don-t-build-cairo-sphinx-unless-PNG-enabled.patch + ]; + + outputs = [ "out" "dev" "devdoc" ]; + outputBin = "dev"; # very small + + nativeBuildInputs = [ + autoreconfHook + pkgconfig + autoreconfHook + ]; + + buildInputs = optionals stdenv.isDarwin (with darwin.apple_sdk.frameworks; [ + CoreGraphics + CoreText + ApplicationServices + Carbon + ]); + + propagatedBuildInputs = + [ pixman ] + ++ optional zlibSupport zlib + ++ optional pngSupport libpng + ++ optionals x11Support [ libX11 libXext ] + ++ optional x11XrenderSupport libXrender + ++ optional xcbSupport libxcb + ++ optional freetypeSupport freetype + ++ optional fontconfigSupport fontconfig + ++ optional gobjectSupport glib + ++ optional glSupport libGL + ; # TODO: maybe liblzo but what would it be for here? + + configureFlags = if stdenv.isDarwin then [ + "--disable-dependency-tracking" + "--enable-quartz" + "--enable-quartz-font" + "--enable-quartz-image" + "--enable-ft" + ] else [ + (enableFeature zlibSupport "script") + (enableFeature zlibSupport "ps") + (enableFeature zlibSupport "pdf") + (enableFeature zlibSupport "interpreter") + (enableFeature pngSupport "png") + (enableFeature pngSupport "svg") + "--enable-tee" + (enableFeature glSupport "gl") + ]; + + preConfigure = + # On FreeBSD, `-ldl' doesn't exist. + stdenv.lib.optionalString stdenv.isFreeBSD + '' for i in "util/"*"/Makefile.in" boilerplate/Makefile.in + do + cat "$i" | sed -es/-ldl//g > t + mv t "$i" + done + '' + + + '' + # Work around broken `Requires.private' that prevents Freetype + # `-I' flags to be propagated. + sed -i "src/cairo.pc.in" \ + -es'|^Cflags:\(.*\)$|Cflags: \1 -I${freetype.dev}/include/freetype2 -I${freetype.dev}/include|g' + substituteInPlace configure --replace strings $STRINGS + ''; + + enableParallelBuilding = true; + + doCheck = false; # fails + + postInstall = lib.optionalString stdenv.isDarwin glib.flattenInclude; + + meta = with lib; { + description = "A 2D graphics library with support for multiple output devices"; + + longDescription = '' + Cairo is a 2D graphics library with support for multiple output + devices. Currently supported output targets include the X + Window System, Quartz, Win32, image buffers, PostScript, PDF, + and SVG file output. Experimental backends include OpenGL + (through glitz), XCB, BeOS, OS/2, and DirectFB. + + Cairo is designed to produce consistent output on all output + media while taking advantage of display hardware acceleration + when available (e.g., through the X Render Extension). + ''; + + homepage = "http://cairographics.org/"; + + license = with licenses; [ lgpl2Plus mpl10 ]; + + platforms = platforms.all; + }; +} |