summary refs log tree commit diff
path: root/pkgs/development/libraries/cairo
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/libraries/cairo')
-rw-r--r--pkgs/development/libraries/cairo/default.nix33
-rw-r--r--pkgs/development/libraries/cairo/skip-configure-stderr-check.patch89
2 files changed, 111 insertions, 11 deletions
diff --git a/pkgs/development/libraries/cairo/default.nix b/pkgs/development/libraries/cairo/default.nix
index a414191ac0d..f18a7e94f06 100644
--- a/pkgs/development/libraries/cairo/default.nix
+++ b/pkgs/development/libraries/cairo/default.nix
@@ -1,9 +1,9 @@
-{ config, stdenv, fetchurl, fetchpatch, pkgconfig, libiconv
+{ config, lib, stdenv, fetchurl, fetchpatch, pkg-config, libiconv
 , libintl, expat, zlib, libpng, pixman, fontconfig, freetype
 , x11Support? !stdenv.isDarwin, libXext, libXrender
 , gobjectSupport ? true, glib
 , xcbSupport ? x11Support, libxcb, xcbutil # no longer experimental since 1.12
-, libGLSupported ? stdenv.lib.elem stdenv.hostPlatform.system stdenv.lib.platforms.mesaPlatforms
+, libGLSupported ? lib.elem stdenv.hostPlatform.system lib.platforms.mesaPlatforms
 , glSupport ? x11Support && config.cairo.gl or (libGLSupported && stdenv.isLinux)
 , libGL ? null # libGLU libGL is no longer a big dependency
 , pdfSupport ? true
@@ -14,13 +14,13 @@ assert glSupport -> x11Support && libGL != null;
 
 let
   version = "1.16.0";
-  inherit (stdenv.lib) optional optionals;
+  inherit (lib) optional optionals;
 in stdenv.mkDerivation rec {
   pname = "cairo";
   inherit version;
 
   src = fetchurl {
-    url = "https://cairographics.org/${if stdenv.lib.mod (builtins.fromJSON (stdenv.lib.versions.minor version)) 2 == 0 then "releases" else "snapshots"}/${pname}-${version}.tar.xz";
+    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";
   };
 
@@ -35,13 +35,23 @@ in stdenv.mkDerivation rec {
       url    = "https://gitlab.freedesktop.org/cairo/cairo/commit/6edf572ebb27b00d3c371ba5ae267e39d27d5b6d.patch";
       sha256 = "112hgrrsmcwxh1r52brhi5lksq4pvrz4xhkzcf2iqp55jl2pb7n1";
     })
+
+    # Fix PDF output.
+    # https://gitlab.freedesktop.org/cairo/cairo/issues/342
+    (fetchpatch {
+      url = "https://gitlab.freedesktop.org/cairo/cairo/commit/5e34c5a9640e49dcc29e6b954c4187cfc838dbd1.patch";
+      sha256 = "yCwsDUY7efVvOZkA6a0bPS+RrVc8Yk9bfPwWHeOjq5o=";
+    })
+  ] ++ optionals stdenv.hostPlatform.isDarwin [
+    # Workaround https://gitlab.freedesktop.org/cairo/cairo/-/issues/121
+    ./skip-configure-stderr-check.patch
   ];
 
   outputs = [ "out" "dev" "devdoc" ];
   outputBin = "dev"; # very small
 
   nativeBuildInputs = [
-    pkgconfig
+    pkg-config
   ];
 
   buildInputs = [
@@ -61,21 +71,22 @@ in stdenv.mkDerivation rec {
     ++ optional glSupport libGL
     ; # TODO: maybe liblzo but what would it be for here?
 
-  configureFlags = (if stdenv.isDarwin then [
+  configureFlags = [
+    "--enable-tee"
+  ] ++ (if stdenv.isDarwin then [
     "--disable-dependency-tracking"
     "--enable-quartz"
     "--enable-quartz-font"
     "--enable-quartz-image"
     "--enable-ft"
-  ] else ([ "--enable-tee" ]
-    ++ optional xcbSupport "--enable-xcb"
+  ] else (optional xcbSupport "--enable-xcb"
     ++ optional glSupport "--enable-gl"
     ++ optional pdfSupport "--enable-pdf"
   )) ++ optional (!x11Support) "--disable-xlib";
 
   preConfigure =
   # On FreeBSD, `-ldl' doesn't exist.
-    stdenv.lib.optionalString stdenv.isFreeBSD
+    lib.optionalString stdenv.isFreeBSD
        '' for i in "util/"*"/Makefile.in" boilerplate/Makefile.in
           do
             cat "$i" | sed -es/-ldl//g > t
@@ -95,9 +106,9 @@ in stdenv.mkDerivation rec {
 
   doCheck = false; # fails
 
-  postInstall = stdenv.lib.optionalString stdenv.isDarwin glib.flattenInclude;
+  postInstall = lib.optionalString stdenv.isDarwin glib.flattenInclude;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A 2D graphics library with support for multiple output devices";
 
     longDescription = ''
diff --git a/pkgs/development/libraries/cairo/skip-configure-stderr-check.patch b/pkgs/development/libraries/cairo/skip-configure-stderr-check.patch
new file mode 100644
index 00000000000..6deecf2a971
--- /dev/null
+++ b/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