diff options
Diffstat (limited to 'nixpkgs/pkgs/development/libraries/cairo')
6 files changed, 351 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..017b4cf46a79 --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/cairo/default.nix @@ -0,0 +1,115 @@ +{ lib, stdenv, fetchurl, fetchpatch, gtk-doc, meson, ninja, pkg-config, python3 +, docbook_xsl, fontconfig, freetype, libpng, pixman, zlib +, x11Support? !stdenv.isDarwin || true, libXext, libXrender +, gobjectSupport ? true, glib +, xcbSupport ? x11Support, libxcb +, darwin +, testers +}: + +let + inherit (lib) optional optionals; +in stdenv.mkDerivation (finalAttrs: let + inherit (finalAttrs) pname version; +in { + pname = "cairo"; + version = "1.18.0"; + + 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"; + hash = "sha256-JDoHNrl4oz3uKfnMp1IXM7eKZbVBggb+970cPUzxC2Q="; + }; + + outputs = [ "out" "dev" "devdoc" ]; + outputBin = "dev"; # very small + separateDebugInfo = true; + + nativeBuildInputs = [ + gtk-doc + meson + ninja + pkg-config + python3 + ]; + + buildInputs = [ + docbook_xsl + ] ++ optionals stdenv.isDarwin (with darwin.apple_sdk.frameworks; [ + CoreGraphics + CoreText + ApplicationServices + Carbon + ]); + + propagatedBuildInputs = [ fontconfig freetype pixman libpng zlib ] + ++ optionals x11Support [ libXext libXrender ] + ++ optionals xcbSupport [ libxcb ] + ++ optional gobjectSupport glib + ; # TODO: maybe liblzo but what would it be for here? + + mesonFlags = [ + "-Dgtk_doc=true" + + # error: #error config.h must be included before this header + "-Dsymbol-lookup=disabled" + + # Only used in tests, causes a dependency cycle + "-Dspectre=disabled" + + (lib.mesonEnable "glib" gobjectSupport) + (lib.mesonEnable "tests" finalAttrs.doCheck) + (lib.mesonEnable "xlib" x11Support) + (lib.mesonEnable "xcb" xcbSupport) + ] ++ lib.optionals (!stdenv.buildPlatform.canExecute stdenv.hostPlatform) [ + "--cross-file=${builtins.toFile "cross-file.conf" '' + [properties] + ipc_rmid_deferred_release = ${ + { + linux = "true"; + freebsd = "true"; + netbsd = "false"; + }.${stdenv.hostPlatform.parsed.kernel.name} or + (throw "Unknown value for ipc_rmid_deferred_release") + } + ''}" + ]; + + preConfigure = '' + patchShebangs version.py + ''; + + enableParallelBuilding = true; + + doCheck = false; # fails + + postInstall = '' + # Work around broken `Requires.private' that prevents Freetype + # `-I' flags to be propagated. + sed -i "$out/lib/pkgconfig/cairo.pc" \ + -es'|^Cflags:\(.*\)$|Cflags: \1 -I${freetype.dev}/include/freetype2 -I${freetype.dev}/include|g' + '' + lib.optionalString stdenv.isDarwin glib.flattenInclude; + + passthru.tests.pkg-config = testers.testMetaPkgConfig finalAttrs.finalPackage; + + 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, XCB, Quartz, Win32, image buffers, PostScript, + PDF, and SVG file output. + + 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 ]; + pkgConfigModules = [ + "cairo-pdf" + "cairo-ps" + "cairo-svg" + ] ++ lib.optional gobjectSupport "cairo-gobject"; + platforms = platforms.all; + }; +}) diff --git a/nixpkgs/pkgs/development/libraries/cairo/skip-configure-stderr-check.patch b/nixpkgs/pkgs/development/libraries/cairo/skip-configure-stderr-check.patch new file mode 100644 index 000000000000..6deecf2a9717 --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/cairo/skip-configure-stderr-check.patch @@ -0,0 +1,89 @@ +https://bugs.freedesktop.org/show_bug.cgi?id=30910#c6 + +Comment 6 Jeremy Huddleston Sequoia 2014-07-15 04:12:40 UTC + +Yes, it is still an issue. We just disable the buggy '"x$cairo_cc_stderr" != "x"' logic, but that's not really a portable solution for you: + +diff -Naurp cairo-1.12.2.orig/configure cairo-1.12.2/configure +--- cairo-1.12.2.orig/configure 2012-04-29 11:49:59.000000000 -0700 ++++ cairo-1.12.2/configure 2012-05-03 11:23:49.000000000 -0700 +@@ -18044,7 +18044,7 @@ fi + rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + +- if test "x$cairo_cc_stderr" != "x"; then ++ if false; then + cairo_cc_flag=no + fi + +@@ -18091,7 +18091,7 @@ fi + rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + +- if test "x$cairo_cc_stderr" != "x"; then ++ if false; then + cairo_cc_flag=no + fi + +@@ -18161,7 +18161,7 @@ fi + rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + +- if test "x$cairo_cc_stderr" != "x"; then ++ if false; then + cairo_cc_flag=no + fi + +@@ -18217,7 +18217,7 @@ fi + rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + +- if test "x$cairo_cc_stderr" != "x"; then ++ if false; then + cairo_cc_flag=no + fi + +@@ -19663,7 +19663,7 @@ fi + rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + +- if test "x$cairo_cc_stderr" != "x"; then ++ if false; then + cairo_cc_flag=no + fi + +@@ -19710,7 +19710,7 @@ fi + rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + +- if test "x$cairo_cc_stderr" != "x"; then ++ if false; then + cairo_cc_flag=no + fi + +@@ -32692,7 +32692,7 @@ fi + rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + +- if test "x$cairo_cc_stderr" != "x"; then ++ if false; then + cairo_cc_flag=no + fi + +@@ -32811,7 +32811,7 @@ fi + rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + +- if test "x$cairo_cc_stderr" != "x"; then ++ if false ; then + cairo_cc_flag=no + fi + +@@ -32892,7 +32892,7 @@ fi + rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + +- if test "x$cairo_cc_stderr" != "x"; then ++ if false; then + cairo_cc_flag=no + fi |